package com.ikea.kompis.extendedcontent;

import android.content.Intent;
import android.content.res.Resources;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import com.ikea.kompis.WelcomeActivity;
import com.ikea.kompis.fragments.SearchFragment;
import com.ikea.kompis.util.UiUtil;
import com.ikea.shared.AppError;
import com.ikea.shared.cart.model.ShoppingBags;
import com.ikea.shared.util.L;
import com.ikea.shared.util.ServiceCallback;
import java.util.List;

public class ECWelcomeActivity extends WelcomeActivity
{
  protected View.OnClickListener mProgressDialogCancelClickListner = new View.OnClickListener()
  {
    public void onClick(View paramAnonymousView)
    {
      ECWelcomeActivity.this.dismisLoadingContentDialog();
      ECWelcomeActivity.this.mServiceCallback.markInvalid();
      ECWelcomeActivity.this.mLaunchedFromCatalogueURI = null;
      ECWelcomeActivity.access$1102(ECWelcomeActivity.this, null);
    }
  };
  private final ServiceCallback<ShoppingBags> mServiceCallback = new ServiceCallback()
  {
    public void done(ShoppingBags paramAnonymousShoppingBags, AppError paramAnonymousAppError, Exception paramAnonymousException)
    {
      L.I("callback done  :: " + paramAnonymousShoppingBags);
      ECWelcomeActivity.this.dismisLoadingContentDialog();
      if ((paramAnonymousShoppingBags != null) && (paramAnonymousShoppingBags.isSuccessful()))
      {
        ECWelcomeActivity.access$002(ECWelcomeActivity.this, paramAnonymousShoppingBags);
        String str5 = paramAnonymousShoppingBags.getBagId();
        if (str5 != null)
        {
          ECWelcomeActivity.this.showMergeDialog(ECWelcomeActivity.this.mResult, str5);
          return;
        }
        ECWelcomeActivity.this.openLocalshoppingList();
        return;
      }
      if ((paramAnonymousShoppingBags != null) && ((paramAnonymousShoppingBags.getErrorCode() == 404) || (paramAnonymousShoppingBags.isStatusCode(404))))
      {
        UiUtil.showCustomToast(ECWelcomeActivity.this.getResources().getString(2131165648), ECWelcomeActivity.this.mContext);
        String str1 = "";
        Object localObject = "";
        String str2 = "";
        String str3 = "";
        Uri localUri = ECWelcomeActivity.this.mLaunchedFromCatalogueURI;
        List localList = null;
        if (localUri != null)
        {
          str1 = ECWelcomeActivity.this.mLaunchedFromCatalogueURI.getAuthority();
          localList = ECWelcomeActivity.this.mLaunchedFromCatalogueURI.getPathSegments();
        }
        if (ECWelcomeActivity.this.mReturnFromLoginURI != null)
        {
          str1 = ECWelcomeActivity.this.mReturnFromLoginURI.getAuthority();
          localList = ECWelcomeActivity.this.mReturnFromLoginURI.getPathSegments();
        }
        String str4;
        if ((localList != null) && (localList.size() == 3))
        {
          str4 = (String)localList.get(0);
          if (!str4.contains("-"))
            break label311;
          String[] arrayOfString = str4.split("-");
          localObject = arrayOfString[0];
          str3 = arrayOfString[1];
        }
        while (true)
        {
          str2 = (String)localList.get(1);
          ECWelcomeActivity.this.switchAccount(str1, (String)localObject, str3, str2);
          return;
          label311: localObject = str4;
        }
      }
      ECWelcomeActivity.this.openLocalshoppingList();
    }
  };

  protected Intent getLoginIntent()
  {
    return new Intent(this, ECLoginActivity.class);
  }

  protected SearchFragment getSearchFragment()
  {
    if (new ECCountryUtils().isECEnabledInCurrentStore(this))
      return new ECSearchFragment();
    return new SearchFragment();
  }

  protected Intent getStoreLocatorIntent()
  {
    return new Intent(this, ECStoreLocatorActivity.class);
  }

  protected Intent getWelcomeActivityIntent()
  {
    return new Intent(getApplicationContext(), ECMainActivity.class);
  }

  protected void handleCatalogueRequest(Intent paramIntent)
  {
    if ((paramIntent != null) && (paramIntent.getExtras() != null))
    {
      this.mLaunchedFromCatalogueURI = ((Uri)paramIntent.getExtras().getParcelable("LaunchedFromCatalogue"));
      this.mReturnFromLoginURI = ((Uri)paramIntent.getExtras().getParcelable("returnFromLogin"));
    }
    if ((this.mLaunchedFromCatalogueURI != null) && (this.mLaunchedFromCatalogueURI.toString().contains(getString(2131165809))))
      if ((this.mLoadingContentDialogFragment == null) || (!this.mLoadingContentDialogFragment.isShowing()));
    do
    {
      return;
      handleECUris(paramIntent);
      return;
      if ((this.mReturnFromLoginURI == null) || (!this.mReturnFromLoginURI.toString().contains(getString(2131165809))))
        break;
    }
    while ((this.mLaunchedFromCatalogueURI != null) && (!this.mLaunchedFromCatalogueURI.toString().equalsIgnoreCase("")));
    showToastMessage(getString(2131165779));
    return;
    super.handleCatalogueRequest(paramIntent);
  }

  public void onActivityResult(int paramInt1, int paramInt2, Intent paramIntent)
  {
    if ((paramIntent != null) && (paramIntent.hasExtra("eccontent")))
    {
      this.mLaunchedFromCatalogueURI = ((Uri)paramIntent.getExtras().getParcelable("eccontent"));
      if (this.mLaunchedFromCatalogueURI != null)
      {
        this.scanType = ExtentedContentCostant.EC_ScanType.NFC.toString();
        if ((this.mLaunchedFromCatalogueURI != null) && (this.mLaunchedFromCatalogueURI.toString().contains("https://in-store-experience.vmobapps.com/redirect/tag/")))
          callVmobApi(this.mLaunchedFromCatalogueURI.toString().replaceFirst("https://in-store-experience.vmobapps.com/redirect/tag/", ""));
      }
      return;
    }
    super.onActivityResult(paramInt1, paramInt2, paramIntent);
  }

  protected void onCreate(Bundle paramBundle)
  {
    super.onCreate(paramBundle);
    this.mContext = this;
    if ((this.mLaunchedFromCatalogueURI == null) && (getIntent() != null) && (getIntent().getExtras() != null) && (getIntent().getExtras().getParcelable("LaunchedFromCatalogue") != null))
    {
      this.mLaunchedFromCatalogueURI = ((Uri)getIntent().getExtras().getParcelable("LaunchedFromCatalogue"));
      handleECUris(getIntent());
    }
  }
}

/* Location:           C:\Documents and Settings\Cesar Cabello Cea\Mis documentos\Downloads\apk-downloader\com.ikea.kompis-6_dex2jar.jar
 * Qualified Name:     com.ikea.kompis.extendedcontent.ECWelcomeActivity
 * JD-Core Version:    0.6.2
 */