AvatarBuilderMetricsHelper.java 7.8 KB
package com.bitstrips.imoji.abv3;

import android.support.annotation.NonNull;
import android.util.Log;
import com.bitstrips.imoji.analytics.Action;
import com.bitstrips.imoji.analytics.Category;
import com.bitstrips.imoji.analytics.LegacyAnalyticsService;
import javax.inject.Inject;
import javax.inject.Singleton;
import org.json.JSONException;
import org.json.JSONObject;

@Singleton
public class AvatarBuilderMetricsHelper
{
  public static final String BITMOJI = "bitmoji";
  public static final String FULL = "full";
  public static final String HALF = "half";
  public static final String PARAM_GENDER = "gender";
  public static final String SNAPCHAT = "snapchat";
  public static final String UPGRADE_TEASER_SHOW_ME = "show_me";
  public static final String UPGRADE_TEASER_SKIP = "skip";
  public static final String UPGRADE_TEASER_SOURCE = "source";
  public static final String UPGRADE_TEASER_TYPE = "teaser_type";
  public static final String UPGRADE_TEASER_UPGRADE_ACTION = "upgrade_action";
  public static final String UPGRADE_TEASER_VIEW = "view";
  public static final String UPGRADE_TEASER_VIEW_COUNT = "teaser_view_count";
  private static final String a = AvatarBuilderMetricsHelper.class.getSimpleName();
  private final LegacyAnalyticsService b;
  
  @Inject
  public AvatarBuilderMetricsHelper(LegacyAnalyticsService paramLegacyAnalyticsService)
  {
    this.b = paramLegacyAnalyticsService;
  }
  
  @NonNull
  private static JSONObject a(AvatarBuilderGender paramAvatarBuilderGender, AvatarBuilderStyle paramAvatarBuilderStyle)
    throws JSONException
  {
    JSONObject localJSONObject = new JSONObject();
    if (paramAvatarBuilderGender != null) {}
    for (paramAvatarBuilderGender = paramAvatarBuilderGender.getMetricsLabel();; paramAvatarBuilderGender = "")
    {
      localJSONObject.put("gender", paramAvatarBuilderGender);
      localJSONObject.put("style", paramAvatarBuilderStyle.getMetricsLabel());
      return localJSONObject;
    }
  }
  
  private void a(AvatarBuilderGender paramAvatarBuilderGender, AvatarBuilderStyle paramAvatarBuilderStyle, String paramString)
  {
    try
    {
      paramAvatarBuilderGender = a(paramAvatarBuilderGender, paramAvatarBuilderStyle);
      paramAvatarBuilderGender.put("selfie_action", paramString);
      paramAvatarBuilderGender = paramAvatarBuilderGender.toString();
      a(Category.NATIVE_AVATAR_BUILDER, Action.BITMOJI_AVATAR_SELFIE_ACTION, paramAvatarBuilderGender);
      return;
    }
    catch (JSONException paramAvatarBuilderGender)
    {
      Log.e(a, "Unable to create selfie metric", paramAvatarBuilderGender);
    }
  }
  
  private void a(Category paramCategory, Action paramAction, String paramString)
  {
    this.b.sendEvent(paramCategory, paramAction, paramString);
  }
  
  private void a(String paramString1, String paramString2, String paramString3, Integer paramInteger)
  {
    try
    {
      JSONObject localJSONObject = new JSONObject();
      localJSONObject.put("source", paramString1);
      localJSONObject.put("teaser_type", paramString2);
      localJSONObject.put("upgrade_action", paramString3);
      if (paramInteger != null) {
        localJSONObject.put("teaser_view_count", paramInteger);
      }
      paramString1 = localJSONObject.toString();
      a(Category.NATIVE_AVATAR_BUILDER, Action.BITMOJI_UPGRADE_STYLE_ACTION, paramString1);
      return;
    }
    catch (JSONException paramString1)
    {
      Log.e(a, "Unable to create upgrade metric", paramString1);
    }
  }
  
  private void b(AvatarBuilderGender paramAvatarBuilderGender, AvatarBuilderStyle paramAvatarBuilderStyle, String paramString)
  {
    try
    {
      paramAvatarBuilderGender = a(paramAvatarBuilderGender, paramAvatarBuilderStyle);
      paramAvatarBuilderGender.put("likeness", paramString);
      paramAvatarBuilderGender = paramAvatarBuilderGender.toString();
      a(Category.NATIVE_AVATAR_BUILDER, Action.BITMOJI_AVATAR_LIKENESS_ACTION, paramAvatarBuilderGender);
      return;
    }
    catch (JSONException paramAvatarBuilderGender)
    {
      Log.e(a, "Unable to create likeness metric", paramAvatarBuilderGender);
    }
  }
  
  public void avatarExit(AvatarBuilderGender paramAvatarBuilderGender, AvatarBuilderStyle paramAvatarBuilderStyle, AvatarBuilderActivityMode paramAvatarBuilderActivityMode, String paramString)
  {
    try
    {
      paramAvatarBuilderGender = a(paramAvatarBuilderGender, paramAvatarBuilderStyle);
      paramAvatarBuilderGender.put("editflow", paramAvatarBuilderActivityMode.getModeName());
      paramAvatarBuilderGender.put("exit", paramString);
      paramAvatarBuilderGender = paramAvatarBuilderGender.toString();
      a(Category.NATIVE_AVATAR_BUILDER, Action.BITMOJI_AVATAR_EXIT, paramAvatarBuilderGender);
      return;
    }
    catch (JSONException paramAvatarBuilderGender)
    {
      Log.e(a, "Unable to create avatarExit metric", paramAvatarBuilderGender);
    }
  }
  
  public void genderSelected(AvatarBuilderGender paramAvatarBuilderGender)
  {
    try
    {
      JSONObject localJSONObject = new JSONObject();
      localJSONObject.put("gender", paramAvatarBuilderGender.getMetricsLabel());
      paramAvatarBuilderGender = localJSONObject.toString();
      a(Category.NATIVE_AVATAR_BUILDER, Action.BITMOJI_AVATAR_GENDER_SELECT, paramAvatarBuilderGender);
      return;
    }
    catch (JSONException paramAvatarBuilderGender)
    {
      Log.e(a, "Unable to create gender metric", paramAvatarBuilderGender);
    }
  }
  
  public void looksLikeMe(AvatarBuilderGender paramAvatarBuilderGender, AvatarBuilderStyle paramAvatarBuilderStyle)
  {
    b(paramAvatarBuilderGender, paramAvatarBuilderStyle, "lookslikeme");
  }
  
  public void save(AvatarBuilderGender paramAvatarBuilderGender, AvatarBuilderStyle paramAvatarBuilderStyle, AvatarBuilderActivityMode paramAvatarBuilderActivityMode, Integer paramInteger, String paramString)
  {
    try
    {
      paramAvatarBuilderGender = a(paramAvatarBuilderGender, paramAvatarBuilderStyle);
      paramAvatarBuilderGender.put("editflow", paramAvatarBuilderActivityMode.getModeName());
      if (paramInteger != null) {
        paramAvatarBuilderGender.put("outfit_id", paramInteger);
      }
      paramAvatarBuilderGender.put("exit", paramString);
      paramAvatarBuilderGender = paramAvatarBuilderGender.toString();
      a(Category.NATIVE_AVATAR_BUILDER, Action.BITMOJI_AVATAR_SAVE, paramAvatarBuilderGender);
      return;
    }
    catch (JSONException paramAvatarBuilderGender)
    {
      Log.e(a, "Unable to create save metric", paramAvatarBuilderGender);
    }
  }
  
  public void selfieCancel(AvatarBuilderGender paramAvatarBuilderGender, AvatarBuilderStyle paramAvatarBuilderStyle)
  {
    a(paramAvatarBuilderGender, paramAvatarBuilderStyle, "cancel");
  }
  
  public void selfieSnap(AvatarBuilderGender paramAvatarBuilderGender, AvatarBuilderStyle paramAvatarBuilderStyle)
  {
    a(paramAvatarBuilderGender, paramAvatarBuilderStyle, "snap");
  }
  
  public void selfieStart(AvatarBuilderGender paramAvatarBuilderGender, AvatarBuilderStyle paramAvatarBuilderStyle)
  {
    a(paramAvatarBuilderGender, paramAvatarBuilderStyle, "start");
  }
  
  public void tweak(AvatarBuilderGender paramAvatarBuilderGender, AvatarBuilderStyle paramAvatarBuilderStyle)
  {
    b(paramAvatarBuilderGender, paramAvatarBuilderStyle, "tweakflow");
  }
  
  public void upgradeTeaserShowMe(String paramString1, String paramString2)
  {
    a(paramString1, paramString2, "show_me", null);
  }
  
  public void upgradeTeaserSkip(String paramString1, String paramString2)
  {
    a(paramString1, paramString2, "skip", null);
  }
  
  public void upgradeTeaserView(String paramString1, String paramString2, Integer paramInteger)
  {
    a(paramString1, paramString2, "view", paramInteger);
  }
}


/* Location:              /home/merong/decompile/hackery-dex2jar.jar!/com/bitstrips/imoji/abv3/AvatarBuilderMetricsHelper.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       0.7.1
 */