BehaviourHelper.java 8.41 KB
package com.bitstrips.imoji.behaviour;

import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.res.Resources;
import android.net.Uri;
import android.net.Uri.Builder;
import android.os.Build;
import android.os.Build.VERSION;
import android.support.annotation.NonNull;
import com.bitstrips.imoji.abv3.AvatarBuilderStyle;
import com.bitstrips.imoji.experiments.Experiments;
import com.bitstrips.imoji.monouser.controllers.UserLogoutController;
import com.bitstrips.imoji.monouser.models.OAuth2Constants;
import com.bitstrips.imoji.ui.BitmojiBaseActivity;
import com.bitstrips.imoji.util.PreferenceUtils;
import dagger.Lazy;
import javax.inject.Inject;
import javax.inject.Singleton;

@Singleton
public class BehaviourHelper
{
  private final Context a;
  private final Lazy<UserLogoutController> b;
  
  @Inject
  public BehaviourHelper(Context paramContext, Lazy<UserLogoutController> paramLazy)
  {
    this.a = paramContext;
    this.b = paramLazy;
  }
  
  private SharedPreferences a()
  {
    return this.a.getSharedPreferences(this.a.getString(2131231182), 0);
  }
  
  public boolean avatarBuilderPreloadAdjacent(Experiments paramExperiments)
  {
    return getBoolean(this.a.getString(2131231159), false);
  }
  
  public boolean faceRecognitionIsEnabled(Experiments paramExperiments)
  {
    float f2 = Float.valueOf(getString(this.a.getString(2131231226), "-1")).floatValue();
    float f1 = f2;
    if (f2 == -1.0F) {
      f1 = paramExperiments.getFloat("settings.face-recognition-v2-enable-ratio", 0.0F);
    }
    return Math.random() < f1;
  }
  
  public String getAccountsEndpoint()
  {
    return getString(this.a.getString(2131231281), OAuth2Constants.OAUTH2_ACCOUNTS_ENDPOINT);
  }
  
  public int getAppIndexingJobPeriod()
  {
    return 12;
  }
  
  public boolean getBoolean(String paramString, boolean paramBoolean)
  {
    return a().getBoolean(paramString, paramBoolean);
  }
  
  public String getChillvibesContentGroup(Experiments paramExperiments)
  {
    return paramExperiments.getString("experiments.chillvibes.content-group", "default");
  }
  
  public AvatarBuilderStyle getDefaultStyle()
  {
    if (!getBoolean(this.a.getString(2131231190), true)) {
      return AvatarBuilderStyle.STYLE_BITSTRIPS;
    }
    return AvatarBuilderStyle.STYLE_CM;
  }
  
  public String getEndpoint()
  {
    return getString(this.a.getResources().getString(2131231222), this.a.getResources().getString(2131231197));
  }
  
  public int getForcedGboardRequiredStorage()
  {
    return 0;
  }
  
  public int getInteger(String paramString, int paramInt)
  {
    return Integer.valueOf(a().getString(paramString, String.valueOf(paramInt))).intValue();
  }
  
  public String getPreviewEndpoint()
  {
    if (this.a.getResources().getString(2131231308).equals(getEndpoint())) {
      return this.a.getResources().getString(2131231169);
    }
    return getEndpoint();
  }
  
  public String getRenderEndpoint()
  {
    if (this.a.getResources().getString(2131231323).equals(getEndpoint())) {
      return this.a.getResources().getString(2131231325);
    }
    if (this.a.getResources().getString(2131231200).equals(getEndpoint())) {
      return this.a.getResources().getString(2131231202);
    }
    return this.a.getResources().getString(2131231315);
  }
  
  public String getResetPasswordURL()
  {
    if (this.a.getResources().getString(2131231323).equals(getEndpoint())) {
      return this.a.getResources().getString(2131231326);
    }
    return this.a.getResources().getString(2131231317);
  }
  
  public boolean getSmartvibesReorderContentEnabled(Experiments paramExperiments)
  {
    return paramExperiments.getBoolean("experiments.smartvibes.reorderContentEnabled", false);
  }
  
  public boolean getSmartvibesSuggestContentEnabled(Experiments paramExperiments)
  {
    return paramExperiments.getBoolean("experiments.smartvibes.suggestContentEnabled", false);
  }
  
  public String getString(String paramString1, String paramString2)
  {
    return a().getString(paramString1, paramString2);
  }
  
  public String getSupportURL(PreferenceUtils paramPreferenceUtils)
  {
    String str3 = this.a.getResources().getString(2131231293);
    try
    {
      String str1 = this.a.getPackageManager().getPackageInfo(this.a.getPackageName(), 0).versionName;
      return Uri.parse(str3).buildUpon().appendQueryParameter("bitmoji-version", str1).appendQueryParameter("device", Build.MANUFACTURER + " " + Build.MODEL).appendQueryParameter("os-version", "Android-" + Build.VERSION.RELEASE).appendQueryParameter("avatar-id", paramPreferenceUtils.getString(2131231270, null)).build().toString();
    }
    catch (PackageManager.NameNotFoundException localNameNotFoundException)
    {
      for (;;)
      {
        String str2 = "";
      }
    }
  }
  
  public int getWebpQuality()
  {
    return Integer.valueOf(getString(this.a.getString(2131231341), "50")).intValue();
  }
  
  public boolean isAnalyticsDebugEnabled()
  {
    return false;
  }
  
  public boolean isBiggerSelfieEnabled(Experiments paramExperiments)
  {
    boolean bool2 = getBoolean(this.a.getString(2131231184), false);
    boolean bool1 = bool2;
    if (!bool2) {
      bool1 = paramExperiments.getBoolean("experiments.bigger-selfie.enabled", false);
    }
    return bool1;
  }
  
  public boolean isCMSaveEnabled()
  {
    boolean bool = true;
    if (getEndpoint().equals(this.a.getResources().getString(2131231197))) {
      bool = getBoolean(this.a.getString(2131231212), true);
    }
    return bool;
  }
  
  public boolean isFewerOptionTraitsEnabled(Experiments paramExperiments)
  {
    boolean bool2 = getBoolean(this.a.getString(2131231157), false);
    boolean bool1 = bool2;
    if (!bool2) {
      bool1 = paramExperiments.getBoolean("experiments.filter-option-traits.enabled", false);
    }
    return bool1;
  }
  
  public boolean isLogcatPostRequestEnabled()
  {
    return false;
  }
  
  public boolean isLoggedInWithSnapchat(PreferenceUtils paramPreferenceUtils)
  {
    return (paramPreferenceUtils.getString(2131231318, null) != null) || (paramPreferenceUtils.getString(2131231283, null) != null);
  }
  
  public boolean isLoginFailureForced()
  {
    return false;
  }
  
  public boolean isMirrorGeoIpValidationOverrideEnabled()
  {
    return getBoolean(this.a.getString(2131231278), false);
  }
  
  public boolean isMonoUserLoginEnabled(Experiments paramExperiments)
  {
    boolean bool = getBoolean(this.a.getString(2131231215), true);
    if (Math.random() < paramExperiments.getFloat("settings.monouser-enable", 1.0F)) {}
    for (int i = 1; (i != 0) && (bool); i = 0) {
      return true;
    }
    return false;
  }
  
  public boolean isSignUpButtonEnabled()
  {
    return false;
  }
  
  public boolean isStagingEndpoint()
  {
    return !getEndpoint().equals(this.a.getResources().getString(2131231197));
  }
  
  public boolean isSvgAvatarPreview()
  {
    return getBoolean(this.a.getString(2131231161), false);
  }
  
  public boolean isTokenRefreshForced()
  {
    return getBoolean(this.a.getString(2131231287), false);
  }
  
  public Boolean isUpgradeTeaserExperimentEnabled(Experiments paramExperiments)
  {
    boolean bool2 = getBoolean(this.a.getString(2131231339), false);
    boolean bool1 = bool2;
    if (!bool2) {
      bool1 = paramExperiments.getBoolean("experiments.full-upgrade-teaser-android.enabled", false);
    }
    return Boolean.valueOf(bool1);
  }
  
  public boolean isWebLoginForced()
  {
    return getBoolean(this.a.getString(2131231290), false);
  }
  
  public boolean isWebpEnabled()
  {
    return false;
  }
  
  public float mirrorSaveRatio()
  {
    return Float.valueOf(getString(this.a.getString(2131231280), "-1")).floatValue();
  }
  
  public boolean setAccountsEndpoint(@NonNull String paramString)
  {
    String str = this.a.getString(2131231281);
    return a().edit().putString(str, paramString).commit();
  }
  
  public void setEndpoint(String paramString)
  {
    String str = this.a.getResources().getString(2131231222);
    a().edit().putString(str, paramString).commit();
    ((UserLogoutController)this.b.get()).logout();
    BitmojiBaseActivity.sendShowForceLogoutDialogBroadcast(this.a);
  }
}


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