IntentCreatorService.java 9.49 KB
package com.bitstrips.imoji.ui;

import android.app.Activity;
import android.app.AlertDialog.Builder;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Bundle;
import com.bitstrips.imoji.abv3.AvatarBuilderActivityMode;
import com.bitstrips.imoji.abv3.AvatarBuilderActivityV3;
import com.bitstrips.imoji.behaviour.BehaviourHelper;
import com.bitstrips.imoji.behaviour.SecretBehaviourActivity;
import com.bitstrips.imoji.browser.ImojiBrowserActivity;
import com.bitstrips.imoji.services.PackageService;
import com.bitstrips.imoji.ui.activities.ConnectSnapchatActivity;
import com.bitstrips.imoji.ui.activities.SignUpActivity;
import com.bitstrips.imoji.util.PreferenceUtils;
import java.util.List;
import javax.inject.Inject;
import javax.inject.Singleton;

@Singleton
public class IntentCreatorService
{
  public static final String EXTRA_ACTION_GOTO_CONNECT_SC = "com.bitstrips.imoji.browser.extra.action.connect.sc";
  public static final String EXTRA_ACTION_KEY = "com.bitstrips.imoji.browser.extra.action";
  public static final String IMOJI_PACKAGE_NAME = "com.bitstrips.imoji";
  private final PreferenceUtils a;
  private final Context b;
  private final PackageService c;
  private final BehaviourHelper d;
  
  @Inject
  public IntentCreatorService(Context paramContext, PreferenceUtils paramPreferenceUtils, PackageService paramPackageService, BehaviourHelper paramBehaviourHelper)
  {
    this.b = paramContext;
    this.a = paramPreferenceUtils;
    this.c = paramPackageService;
    this.d = paramBehaviourHelper;
  }
  
  private static Intent a(Activity paramActivity, AvatarBuilderActivityMode paramAvatarBuilderActivityMode)
  {
    paramActivity = new Intent(paramActivity, AvatarBuilderActivityV3.class);
    Bundle localBundle = new Bundle();
    localBundle.putSerializable("EXTRA_AVATAR_BUILDER_MODE", paramAvatarBuilderActivityMode);
    paramActivity.putExtras(localBundle);
    return paramActivity;
  }
  
  public void displayUpgradeDialog(final Activity paramActivity)
  {
    String str = paramActivity.getString(2131231059);
    new AlertDialog.Builder(paramActivity).setTitle(2131231165).setMessage(str).setPositiveButton(2131231058, new DialogInterface.OnClickListener()
    {
      public final void onClick(DialogInterface paramAnonymousDialogInterface, int paramAnonymousInt)
      {
        if (IntentCreatorService.a(IntentCreatorService.this).isAppInstalled("com.bitstrips.imoji"))
        {
          IntentCreatorService.a(IntentCreatorService.this).launchApp("com.bitstrips.imoji");
          return;
        }
        IntentCreatorService.this.goToGooglePlayStore("com.bitstrips.imoji", paramActivity);
      }
    }).setNegativeButton(2131230868, new DialogInterface.OnClickListener()
    {
      public final void onClick(DialogInterface paramAnonymousDialogInterface, int paramAnonymousInt) {}
    }).show();
  }
  
  public void goToAvatarBuilderCreate(Activity paramActivity)
  {
    paramActivity.startActivity(a(paramActivity, AvatarBuilderActivityMode.CREATE));
  }
  
  public void goToAvatarBuilderCreateWithinSnapchatLinkingFlow(Activity paramActivity)
  {
    Intent localIntent = a(paramActivity, AvatarBuilderActivityMode.CREATE);
    localIntent.putExtra("com.bitstrips.imoji.avatar.issnapchat", true);
    paramActivity.startActivity(localIntent);
  }
  
  public void goToAvatarBuilderEdit(Activity paramActivity)
  {
    paramActivity.startActivity(a(paramActivity, AvatarBuilderActivityMode.EDIT));
  }
  
  public void goToAvatarBuilderEdit(Activity paramActivity, String paramString, int paramInt)
  {
    Intent localIntent = a(paramActivity, AvatarBuilderActivityMode.EDIT);
    localIntent.putExtra("EXTRA_EDIT_START_CATEGORY", paramString);
    paramActivity.startActivityForResult(localIntent, paramInt);
  }
  
  public void goToAvatarBuilderFromSnapchat(Activity paramActivity)
  {
    Intent localIntent = a(paramActivity, AvatarBuilderActivityMode.EDIT);
    localIntent.putExtra("com.bitstrips.imoji.avatar.isEditFromSnapchat", true);
    paramActivity.startActivity(localIntent);
    paramActivity.finish();
  }
  
  public void goToAvatarBuilderReset(Activity paramActivity)
  {
    paramActivity.startActivity(a(paramActivity, AvatarBuilderActivityMode.RESET));
  }
  
  public void goToAvatarBuilderResetFromUpgradeTeaser(Activity paramActivity)
  {
    Intent localIntent = a(paramActivity, AvatarBuilderActivityMode.RESET);
    Bundle localBundle2 = localIntent.getExtras();
    Bundle localBundle1 = localBundle2;
    if (localBundle2 == null) {
      localBundle1 = new Bundle();
    }
    localBundle1.putBoolean("EXTRA_RESET_UPGRADE_TO_CM", true);
    localIntent.putExtras(localBundle1);
    paramActivity.startActivity(localIntent);
  }
  
  public void goToConnectSnapchatActivity(Activity paramActivity, String paramString)
  {
    Intent localIntent = new Intent(paramActivity, ConnectSnapchatActivity.class);
    localIntent.putExtra("request_token", paramString);
    paramActivity.startActivityForResult(localIntent, 55);
  }
  
  public void goToForcedConnectSnapchatActivity(Activity paramActivity)
  {
    Intent localIntent = new Intent(paramActivity, ConnectSnapchatActivity.class);
    localIntent.setFlags(536870912);
    paramActivity.startActivityForResult(localIntent, 55);
  }
  
  public void goToGooglePlayStore(String paramString, Context paramContext)
  {
    Intent localIntent = new Intent("android.intent.action.VIEW", Uri.parse("market://details?id=" + paramString));
    localIntent.addFlags(268435456);
    if (this.b.getPackageManager().queryIntentActivities(localIntent, 65536).size() > 0) {
      try
      {
        paramContext.startActivity(localIntent);
        return;
      }
      catch (ActivityNotFoundException localActivityNotFoundException) {}
    }
    localIntent.setData(Uri.parse("http://play.google.com/store/apps/details?id=" + paramString));
    paramContext.startActivity(localIntent);
  }
  
  public void goToImojiBrowser(Activity paramActivity)
  {
    goToImojiBrowser(paramActivity, null);
  }
  
  public void goToImojiBrowser(Activity paramActivity, Bundle paramBundle)
  {
    Intent localIntent1 = new Intent(paramActivity, ImojiBrowserActivity.class);
    Intent localIntent2 = paramActivity.getIntent();
    localIntent1.setAction(localIntent2.getAction());
    localIntent1.setFlags(33554432);
    Object localObject = paramActivity.getIntent().getExtras();
    if (localObject != null) {}
    for (;;)
    {
      localIntent1.putExtras((Bundle)localObject);
      localObject = localIntent2.getData();
      if (localObject != null) {
        localIntent1.putExtra("schemeHost", ((Uri)localObject).getHost());
      }
      if (paramBundle != null) {
        localIntent1.putExtra("com.bitstrips.imoji.browser.extra.bundle", paramBundle);
      }
      paramActivity.startActivity(localIntent1);
      paramActivity.finish();
      return;
      localObject = new Bundle();
    }
  }
  
  public void goToImojiBrowserThenSnapchatActivity(Activity paramActivity, String paramString)
  {
    Bundle localBundle = new Bundle();
    localBundle.putString("request_token", paramString);
    localBundle.putString("com.bitstrips.imoji.browser.extra.action", "com.bitstrips.imoji.browser.extra.action.connect.sc");
    goToImojiBrowser(paramActivity, localBundle);
  }
  
  public void goToLinkBSAuth(Activity paramActivity)
  {
    Intent localIntent = new Intent(paramActivity, SignUpActivity.class);
    localIntent.putExtra("linkBSAuth", true);
    paramActivity.startActivity(localIntent);
  }
  
  public void goToLoginActivity(Activity paramActivity)
  {
    paramActivity.startActivity(new Intent(paramActivity, LoginActivity.class));
  }
  
  public void goToOutfitBuilder(Activity paramActivity, int paramInt)
  {
    goToAvatarBuilderEdit(paramActivity, "outfit", paramInt);
  }
  
  public void goToOutfitBuilderFromSnapchat(Activity paramActivity, int paramInt)
  {
    goToOutfitBuilder(paramActivity, paramInt);
  }
  
  public void goToPrivacyPolicy(Activity paramActivity)
  {
    Intent localIntent = new Intent(paramActivity, ImojiWebViewActivity.class);
    localIntent.setData(Uri.parse(paramActivity.getString(2131231306)));
    localIntent.putExtra("android.intent.extra.TITLE", paramActivity.getString(2131231008));
    paramActivity.startActivity(localIntent);
  }
  
  public void goToSecretBehaviourActivity(Activity paramActivity)
  {
    Intent localIntent = new Intent(paramActivity, SecretBehaviourActivity.class);
    localIntent.setFlags(268435456);
    paramActivity.startActivity(localIntent);
  }
  
  public void goToSupportPage(Activity paramActivity)
  {
    Intent localIntent = new Intent(paramActivity, ImojiWebViewActivity.class);
    localIntent.setData(Uri.parse(this.d.getSupportURL(this.a)));
    localIntent.putExtra("android.intent.extra.TITLE", paramActivity.getString(2131231042));
    paramActivity.startActivity(localIntent);
  }
  
  public void goToTermsOfService(Activity paramActivity)
  {
    Intent localIntent = new Intent(paramActivity, ImojiWebViewActivity.class);
    localIntent.setData(Uri.parse(paramActivity.getString(2131231072)));
    localIntent.putExtra("android.intent.extra.TITLE", paramActivity.getString(2131231043));
    paramActivity.startActivity(localIntent);
  }
}


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