package com.ikea.kompis;

import android.annotation.SuppressLint;
import android.app.AlertDialog.Builder;
import android.app.Dialog;
import android.app.PendingIntent;
import android.content.Intent;
import android.content.res.Resources;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.support.v4.app.Fragment;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.Toast;
import com.ikea.kompis.browse.CategorysBaseFragment;
import com.ikea.kompis.browse.SubCategoryBaseFragment;
import com.ikea.kompis.browse.event.BrowseProductEvent;
import com.ikea.kompis.browse.event.CategorySelectedEvent;
import com.ikea.kompis.browse.event.FindProductEvent;
import com.ikea.kompis.browse.event.GoToSearchEvent;
import com.ikea.kompis.browse.event.PerformSearchEvent;
import com.ikea.kompis.browse.event.ShoppingCartMenuButtonClicked;
import com.ikea.kompis.browse.event.SubCategorySelectedEvent;
import com.ikea.kompis.campaign.CampaignListFragment;
import com.ikea.kompis.campaign.CampaignViewFragment;
import com.ikea.kompis.campaign.WelcomeFragment;
import com.ikea.kompis.campaign.event.CampaignListEvent;
import com.ikea.kompis.campaign.event.CampaignViewEvent;
import com.ikea.kompis.campaign.event.WelcomeResumedEvent;
import com.ikea.kompis.event.ShowInformationEvent;
import com.ikea.kompis.event.ShowWelcomeEvent;
import com.ikea.kompis.fragments.ContentFragment;
import com.ikea.kompis.fragments.InformationFragment;
import com.ikea.kompis.fragments.LegalNoticeFragment;
import com.ikea.kompis.fragments.OpenBaseFamily;
import com.ikea.kompis.fragments.SearchFragment;
import com.ikea.kompis.fragments.TrayFragment;
import com.ikea.kompis.fragments.event.ShowLegalNoticeEvent;
import com.ikea.kompis.products.ProductDetailsBaseFragment;
import com.ikea.kompis.products.ProductListBaseFragment;
import com.ikea.kompis.products.event.ProductSelectedEvent;
import com.ikea.kompis.scan.MainActivity;
import com.ikea.kompis.scan.event.ScanEvent;
import com.ikea.kompis.setting.LocaleManager;
import com.ikea.kompis.setting.SettingFragment;
import com.ikea.kompis.setting.event.ShowSettingsEvent;
import com.ikea.kompis.shopping.ShoppingLayout;
import com.ikea.kompis.shopping.event.MotherSPRSelectedEvent;
import com.ikea.kompis.stores.StoreBaseFragment;
import com.ikea.kompis.stores.StoreLocatorActivity;
import com.ikea.kompis.stores.event.GoToStoreLocatorEvent;
import com.ikea.kompis.user.FamilyBaseFragment;
import com.ikea.kompis.user.LoginActivity;
import com.ikea.kompis.user.LoginBaseFragment;
import com.ikea.kompis.user.LoginCanceledEvent;
import com.ikea.kompis.user.event.LoginDoneEvent;
import com.ikea.kompis.user.event.LoginResultEvent;
import com.ikea.kompis.user.event.PerformLoginEvent;
import com.ikea.kompis.util.CustomPopUp;
import com.ikea.kompis.util.CustomPopUp.CustomPopupClickListener;
import com.ikea.kompis.util.UiUtil;
import com.ikea.kompis.view.NetworkDialogFragment;
import com.ikea.shared.AppConfigData;
import com.ikea.shared.AppConfigManager;
import com.ikea.shared.AppError;
import com.ikea.shared.analytics.UsageTracker;
import com.ikea.shared.browse.service.CatalogService;
import com.ikea.shared.campaign.model.Campaign;
import com.ikea.shared.cart.ShoppingCart;
import com.ikea.shared.cart.model.ShoppingBags;
import com.ikea.shared.cart.model.SyncEventModel;
import com.ikea.shared.config.model.Config;
import com.ikea.shared.config.model.Country;
import com.ikea.shared.config.model.Language;
import com.ikea.shared.config.model.Languages;
import com.ikea.shared.config.model.Region;
import com.ikea.shared.config.model.RegionList;
import com.ikea.shared.config.service.ConfigService;
import com.ikea.shared.products.model.RetailItemCommunication;
import com.ikea.shared.shopping.event.SessionExpiredEvent;
import com.ikea.shared.shopping.service.ShoppingCartService;
import com.ikea.shared.stores.model.StoreRef;
import com.ikea.shared.user.event.LoginSyncFailedEvent;
import com.ikea.shared.user.event.LoginSyncResultEvent;
import com.ikea.shared.user.model.User;
import com.ikea.shared.user.service.UserService;
import com.ikea.shared.util.L;
import com.ikea.shared.util.ServiceCallback;
import com.squareup.otto.Bus;
import com.squareup.otto.Subscribe;
import java.io.IOException;
import java.util.Iterator;
import java.util.List;
import java.util.UnknownFormatConversionException;

public class WelcomeActivity extends TrayActivity
{
  private static final String CAMERA_POPUP_MESSAGE = "CAMERA_POPUP_MESSAGE";
  public static final int FOR_CATALOGUE_LOGIN = 2;
  public static final int FOR_LOGIN = 1;
  public static final int FOR_SHOPPING_DETAILS_UPDATE = 3;
  protected static final String HYPHEN = "-";
  private static final String IS_CAMERA_POPUP_VISIBLE = "IS_CAMERA_POPUP_VISIBLE";
  private static final String IS_COULD_NOT_RETRIEVED_CATALOGUE_SL_VISIBLE = "IS_COULD_NOT_RETRIEVED_CATALOGUE_SL_VISIBLE";
  private static final String IS_DIFFERENT_COUNTRY_POPUP_VISIBLE = "IS_DIFFERENT_COUNTRY_POPUP_VISIBLE";
  private static final String IS_DIFFERENT_LOCALE_POPUP_VISIBLE = "IS_DIFFERENT_LOCALE_POPUP_VISIBLE";
  private static final String IS_DIFFERENT_LOGIN_POPUP_VISIBLE = "IS_DIFFERENT_LOGIN_POPUP_VISIBLE";
  private static final String IS_DIFFERENT_REGION_POPUP_VISIBLE = "IS_DIFFERENT_REGION_POPUP_VISIBLE";
  private static final String IS_LOGIN_POPUP_VISIBLE = "IS_LOGIN_POPUP_VISIBLE";
  private static final String IS_MERGE_POPUP_VISIBLE = "IS_MERGE_POPUP_VISIBLE";
  private static final String IS_SYNC_POPUP_VISIBLE = "IS_SYNC_POPUP_VISIBLE";
  public static final String SCAN_PRODUCT_ID = "SCAN_PRODUCT_ID";
  private static final String SHOPPING_RESULT = "SHOPPING_RESULT";
  private static final String SYNC_MESSSAGE = "SYNC_MESSSAGE";
  private boolean isDestroy = true;
  protected boolean isExternalScanCode;
  private String mCameraMessage = "";
  private String mCatalogueLanguage;
  private Dialog mCatalogueLoadingDialog;
  protected WelcomeActivity mContext;
  private EventHandler mEventHandler;
  private PendingIntent mKillSwitchIntent;
  protected ShoppingBags mResult;
  protected Uri mReturnFromLoginURI;
  private final ServiceCallback<ShoppingBags> mServiceCallback = new ServiceCallback()
  {
    public void done(ShoppingBags paramAnonymousShoppingBags, AppError paramAnonymousAppError, Exception paramAnonymousException)
    {
      L.I("callback done  :: " + paramAnonymousShoppingBags);
      if ((WelcomeActivity.this.mCatalogueLoadingDialog != null) && (WelcomeActivity.this.mCatalogueLoadingDialog.isShowing()))
      {
        WelcomeActivity.this.mCatalogueLoadingDialog.dismiss();
        WelcomeActivity.access$002(WelcomeActivity.this, null);
      }
      if ((paramAnonymousShoppingBags != null) && (paramAnonymousShoppingBags.isSuccessful()))
      {
        WelcomeActivity.this.mResult = paramAnonymousShoppingBags;
        String str5 = paramAnonymousShoppingBags.getBagId();
        if (str5 != null)
        {
          WelcomeActivity.this.showMergeDialog(WelcomeActivity.this.mResult, str5);
          return;
        }
        WelcomeActivity.this.openLocalshoppingList();
        return;
      }
      if ((paramAnonymousShoppingBags != null) && ((paramAnonymousShoppingBags.getErrorCode() == 404) || (paramAnonymousShoppingBags.isStatusCode(404))))
      {
        UiUtil.showCustomToast(WelcomeActivity.this.getResources().getString(2131165648), WelcomeActivity.this.mContext);
        String str1 = "";
        Object localObject = "";
        String str2 = "";
        String str3 = "";
        Uri localUri = WelcomeActivity.this.mLaunchedFromCatalogueURI;
        List localList = null;
        if (localUri != null)
        {
          str1 = WelcomeActivity.this.mLaunchedFromCatalogueURI.getAuthority();
          localList = WelcomeActivity.this.mLaunchedFromCatalogueURI.getPathSegments();
        }
        if (WelcomeActivity.this.mReturnFromLoginURI != null)
        {
          str1 = WelcomeActivity.this.mReturnFromLoginURI.getAuthority();
          localList = WelcomeActivity.this.mReturnFromLoginURI.getPathSegments();
        }
        String str4;
        if ((localList != null) && (localList.size() == 3))
        {
          str4 = (String)localList.get(0);
          if (!str4.contains("-"))
            break label345;
          String[] arrayOfString = str4.split("-");
          localObject = arrayOfString[0];
          str3 = arrayOfString[1];
        }
        while (true)
        {
          str2 = (String)localList.get(1);
          WelcomeActivity.this.switchAccount(str1, (String)localObject, str3, str2);
          return;
          label345: localObject = str4;
        }
      }
      WelcomeActivity.this.openLocalshoppingList();
    }
  };
  private CustomPopUp mShowCameraErrorDialog;
  private CustomPopUp mShowDifferentCountryDialog;
  private CustomPopUp mShowDifferentLocaleDialog;
  private CustomPopUp mShowDifferentLoginDialog;
  private CustomPopUp mShowDifferentRegionDialog;
  private CustomPopUp mShowLoginDialog;
  private CustomPopUp mShowMergeDialog;
  private CustomPopUp mShowNOCSLDialog;
  private CustomPopUp mShowSyncDialog;
  private String mSyncMessage = "";
  private Fragment mTrayFragment;
  private View mTrayHandle;

  private void applyChanges()
  {
    LocaleManager.i(this.mContext, this.mBus).applyinBackground();
  }

  private void fetchCatalogueList(String paramString1, String paramString2, String paramString3, String paramString4, String paramString5)
  {
    User localUser = UserService.i(this.mContext).getUser();
    if (((AppConfigManager.i(this.mContext).getAppConfigData().getCountryCode().equalsIgnoreCase(paramString2)) && (localUser.getEmailID().equalsIgnoreCase(paramString1))) || ((localUser.getIkeaFamilyNumber() != null) && (localUser.getIkeaFamilyNumber().equalsIgnoreCase(paramString1))))
    {
      Country localCountry = AppConfigManager.i(this.mContext).getAppConfigData().getConfig();
      if ((!TextUtils.isEmpty(paramString3)) && (localCountry.getRegions() != null) && (localCountry.getRegions().getRegions() != null) && (!localCountry.getRegions().getRegions().isEmpty()) && ((AppConfigManager.i(this.mContext).getAppConfigData().getRegionCode() == null) || ((AppConfigManager.i(this.mContext).getAppConfigData().getRegionCode() != null) && (!AppConfigManager.i(this.mContext).getAppConfigData().getRegionCode().equalsIgnoreCase(paramString3)))))
      {
        showDifferentRegionDialog(paramString1, paramString2, paramString3, paramString4, paramString5);
        return;
      }
      if (paramString4.equalsIgnoreCase(AppConfigManager.i(this.mContext).getAppConfigData().getLanguageCode()))
      {
        loadCatalogueList(paramString5);
        return;
      }
      showDifferentLocaleDialog(paramString4, paramString5);
      return;
    }
    showSwitchAccountPopUp(paramString1, paramString2, paramString3, paramString4);
  }

  private void showCameraErrorPopUp(String paramString)
  {
    this.mCameraMessage = paramString;
    this.mShowCameraErrorDialog = new CustomPopUp(this, getString(2131165517), this.mCameraMessage);
    this.mShowCameraErrorDialog.show();
  }

  @SuppressLint({"InflateParams"})
  private void showCatalogueLoadingDialog()
  {
    View localView = LayoutInflater.from(this.mContext).inflate(2130903099, null);
    ((Button)localView.findViewById(2131624081)).setOnClickListener(new View.OnClickListener()
    {
      public void onClick(View paramAnonymousView)
      {
        WelcomeActivity.this.mCatalogueLoadingDialog.dismiss();
        WelcomeActivity.this.mServiceCallback.markInvalid();
        WelcomeActivity.access$002(WelcomeActivity.this, null);
        WelcomeActivity.access$1302(WelcomeActivity.this, null);
        WelcomeActivity.this.mReturnFromLoginURI = null;
      }
    });
    AlertDialog.Builder localBuilder = new AlertDialog.Builder(this.mContext);
    localBuilder.setView(localView);
    localBuilder.setCancelable(false);
    this.mCatalogueLoadingDialog = localBuilder.create();
    this.mCatalogueLoadingDialog.show();
  }

  private void showCatalogueWarning(final String paramString1, final String paramString2, final String paramString3, final String paramString4)
  {
    this.mShowLoginDialog = new CustomPopUp(this.mContext, this.mContext.getString(2131165444), this.mContext.getString(2131165282), this.mContext.getString(2131165755), "", "");
    this.mShowLoginDialog.show(new CustomPopUp.CustomPopupClickListener()
    {
      public boolean onBackKeyPressed()
      {
        WelcomeActivity.this.mShowLoginDialog.dismiss();
        WelcomeActivity.this.openLocalshoppingList();
        return false;
      }

      public void onCancel()
      {
        WelcomeActivity.this.openLocalshoppingList();
      }

      public void onLinkClick()
      {
      }

      public void onPrimaryBtnClick()
      {
        WelcomeActivity.this.switchAccount(paramString1, paramString2, paramString3, paramString4);
      }

      public void onSecondaryBtnClick()
      {
        WelcomeActivity.this.openLocalshoppingList();
      }
    });
  }

  private void showDifferentConutryDialog(final String paramString1, final String paramString2, final String paramString3, final String paramString4, String paramString5)
  {
    String str1 = "";
    Config localConfig = ConfigService.i(this.mContext).getCachedConfig();
    if ((localConfig != null) && (localConfig.getCountry() != null))
    {
      Iterator localIterator = localConfig.getCountry().iterator();
      while (localIterator.hasNext())
      {
        Country localCountry = (Country)localIterator.next();
        if (localCountry.getCountrycode().equalsIgnoreCase(paramString2))
          str1 = localCountry.getCountryName();
      }
    }
    Object localObject;
    if (!str1.isEmpty())
      localObject = "";
    try
    {
      String str2 = this.mContext.getString(2131165757, new Object[] { str1 });
      localObject = str2;
      this.mShowDifferentCountryDialog = new CustomPopUp(this.mContext, this.mContext.getString(2131165743), this.mContext.getString(2131165489), (String)localObject, "", "");
      this.mShowDifferentCountryDialog.show(new CustomPopUp.CustomPopupClickListener()
      {
        public boolean onBackKeyPressed()
        {
          WelcomeActivity.this.mShowDifferentCountryDialog.dismiss();
          WelcomeActivity.this.openLocalshoppingList();
          return false;
        }

        public void onCancel()
        {
          WelcomeActivity.this.openLocalshoppingList();
        }

        public void onLinkClick()
        {
        }

        public void onPrimaryBtnClick()
        {
          WelcomeActivity.this.switchAccount(paramString1, paramString2, paramString3, paramString4);
        }

        public void onSecondaryBtnClick()
        {
          WelcomeActivity.this.openLocalshoppingList();
        }
      });
      return;
    }
    catch (UnknownFormatConversionException localUnknownFormatConversionException)
    {
      while (true)
        localUnknownFormatConversionException.printStackTrace();
    }
    catch (Exception localException)
    {
      while (true)
        localException.printStackTrace();
    }
  }

  private void showDifferentLocaleDialog(final String paramString1, final String paramString2)
  {
    this.mCatalogueLanguage = "";
    AppConfigData localAppConfigData = AppConfigManager.i(this.mContext).getAppConfigData();
    if ((localAppConfigData != null) && (!localAppConfigData.getLanguageCode().equalsIgnoreCase(paramString1)))
    {
      Iterator localIterator = localAppConfigData.getConfig().getLanguages().getLanguage().iterator();
      while (localIterator.hasNext())
      {
        Language localLanguage = (Language)localIterator.next();
        if (localLanguage.getValue().equalsIgnoreCase(paramString1))
          this.mCatalogueLanguage = localLanguage.getName();
      }
    }
    if (!this.mCatalogueLanguage.isEmpty())
    {
      Object localObject = "";
      try
      {
        WelcomeActivity localWelcomeActivity = this.mContext;
        Object[] arrayOfObject = new Object[1];
        arrayOfObject[0] = this.mCatalogueLanguage;
        String str = localWelcomeActivity.getString(2131165758, arrayOfObject);
        localObject = str;
        this.mShowDifferentLocaleDialog = new CustomPopUp(this.mContext, this.mContext.getString(2131165743), this.mContext.getString(2131165489), (String)localObject, "", "");
        this.mShowDifferentLocaleDialog.show(new CustomPopUp.CustomPopupClickListener()
        {
          public boolean onBackKeyPressed()
          {
            WelcomeActivity.this.mShowDifferentLocaleDialog.dismiss();
            WelcomeActivity.this.openLocalshoppingList();
            return false;
          }

          public void onCancel()
          {
            WelcomeActivity.this.openLocalshoppingList();
          }

          public void onLinkClick()
          {
          }

          public void onPrimaryBtnClick()
          {
            try
            {
              AppConfigManager.i(WelcomeActivity.this.mContext).updateSelcetedLanguage(WelcomeActivity.this.mCatalogueLanguage, paramString1);
              WelcomeActivity.this.applyChanges();
              WelcomeActivity.this.loadCatalogueList(paramString2);
              return;
            }
            catch (IOException localIOException)
            {
              while (true)
                localIOException.printStackTrace();
            }
          }

          public void onSecondaryBtnClick()
          {
            WelcomeActivity.this.openLocalshoppingList();
          }
        });
        return;
      }
      catch (UnknownFormatConversionException localUnknownFormatConversionException)
      {
        while (true)
          localUnknownFormatConversionException.printStackTrace();
      }
      catch (Exception localException)
      {
        while (true)
          localException.printStackTrace();
      }
    }
    Toast.makeText(this.mContext, "language is not supported", 1).show();
  }

  private void showDifferentRegionDialog(final String paramString1, final String paramString2, final String paramString3, final String paramString4, String paramString5)
  {
    String str1 = "";
    Config localConfig = ConfigService.i(this.mContext).getCachedConfig();
    if ((localConfig != null) && (localConfig.getCountry() != null))
    {
      Iterator localIterator1 = localConfig.getCountry().iterator();
      while (localIterator1.hasNext())
      {
        Country localCountry = (Country)localIterator1.next();
        if (localCountry.getCountrycode().equalsIgnoreCase(paramString2))
          if ((localCountry.getRegions() != null) && (localCountry.getRegions().getRegions() != null) && (!localCountry.getRegions().getRegions().isEmpty()))
          {
            Iterator localIterator2 = localCountry.getRegions().getRegions().iterator();
            while (localIterator2.hasNext())
            {
              Region localRegion = (Region)localIterator2.next();
              if (localRegion.getValue().equalsIgnoreCase(paramString3))
                str1 = localRegion.getName();
            }
          }
      }
    }
    if (!str1.isEmpty())
    {
      Object localObject = "";
      try
      {
        String str2 = this.mContext.getString(2131165759, new Object[] { str1 });
        localObject = str2;
        this.mShowDifferentRegionDialog = new CustomPopUp(this.mContext, this.mContext.getString(2131165743), this.mContext.getString(2131165489), (String)localObject, "", "");
        this.mShowDifferentRegionDialog.show(new CustomPopUp.CustomPopupClickListener()
        {
          public boolean onBackKeyPressed()
          {
            WelcomeActivity.this.mShowDifferentRegionDialog.dismiss();
            WelcomeActivity.this.openLocalshoppingList();
            return false;
          }

          public void onCancel()
          {
            WelcomeActivity.this.openLocalshoppingList();
          }

          public void onLinkClick()
          {
          }

          public void onPrimaryBtnClick()
          {
            WelcomeActivity.this.switchAccount(paramString1, paramString2, paramString3, paramString4);
          }

          public void onSecondaryBtnClick()
          {
            WelcomeActivity.this.openLocalshoppingList();
          }
        });
        return;
      }
      catch (UnknownFormatConversionException localUnknownFormatConversionException)
      {
        while (true)
          localUnknownFormatConversionException.printStackTrace();
      }
      catch (Exception localException)
      {
        while (true)
          localException.printStackTrace();
      }
    }
    Toast.makeText(this.mContext, "region is not supported", 1).show();
  }

  private void showSwitchAccountPopUp(final String paramString1, final String paramString2, final String paramString3, final String paramString4)
  {
    this.mShowDifferentLoginDialog = new CustomPopUp(this.mContext, this.mContext.getString(2131165683), this.mContext.getString(2131165282), this.mContext.getString(2131165748), "", "");
    this.mShowDifferentLoginDialog.show(new CustomPopUp.CustomPopupClickListener()
    {
      public boolean onBackKeyPressed()
      {
        WelcomeActivity.this.mShowDifferentLoginDialog.dismiss();
        WelcomeActivity.this.openLocalshoppingList();
        return false;
      }

      public void onCancel()
      {
        WelcomeActivity.this.openLocalshoppingList();
      }

      public void onLinkClick()
      {
      }

      public void onPrimaryBtnClick()
      {
        try
        {
          UserService.i(WelcomeActivity.this.mContext).logout();
          WelcomeActivity.this.switchAccount(paramString1, paramString2, paramString3, paramString4);
          return;
        }
        catch (IOException localIOException)
        {
          while (true)
            localIOException.printStackTrace();
        }
      }

      public void onSecondaryBtnClick()
      {
        WelcomeActivity.this.openLocalshoppingList();
      }
    });
  }

  private void showSyncDialog(String paramString)
  {
    this.mSyncMessage = paramString;
    ShoppingCartService.i(this.mContext).setShowSLMergeResult(false);
    String str = "";
    if (paramString.equalsIgnoreCase("MergeListValues"))
      str = getResources().getString(2131165462);
    while (true)
    {
      this.mShowSyncDialog = new CustomPopUp(this, getString(2131165517), str);
      this.mShowSyncDialog.show();
      return;
      if (paramString.equalsIgnoreCase("Duplicates"))
        str = getResources().getString(2131165463);
    }
  }

  protected ContentFragment createContentFragment()
  {
    UsageTracker.i().viewHomePage(this, false, false, false);
    WelcomeFragment localWelcomeFragment = new WelcomeFragment();
    localWelcomeFragment.setArguments(new Bundle());
    return localWelcomeFragment;
  }

  protected Fragment createFlyinFragment()
  {
    TrayFragment localTrayFragment = new TrayFragment();
    this.mTrayFragment = localTrayFragment;
    return localTrayFragment;
  }

  protected Intent getLoginIntent()
  {
    return new Intent(this, LoginActivity.class);
  }

  protected SearchFragment getSearchFragment()
  {
    return new SearchFragment();
  }

  protected Intent getStoreLocatorIntent()
  {
    return new Intent(this, StoreLocatorActivity.class);
  }

  public Fragment getTrayFragment()
  {
    return this.mTrayFragment;
  }

  protected Intent getWelcomeActivityIntent()
  {
    return new Intent(this, MainActivity.class);
  }

  protected void handleCatalogueRequest(Intent paramIntent)
  {
    String str1;
    List localList;
    String str2;
    String str3;
    if ((paramIntent != null) && (paramIntent.getExtras() != null))
    {
      this.mLaunchedFromCatalogueURI = ((Uri)paramIntent.getExtras().getParcelable("LaunchedFromCatalogue"));
      this.mReturnFromLoginURI = ((Uri)paramIntent.getExtras().getParcelable("returnFromLogin"));
      str1 = "";
      if (this.mLaunchedFromCatalogueURI == null)
        break label183;
      localList = this.mLaunchedFromCatalogueURI.getPathSegments();
      if ((localList != null) && (localList.size() == 3))
      {
        str2 = (String)localList.get(0);
        if (!str2.contains("-"))
          break label207;
        String[] arrayOfString = str2.split("-");
        str3 = arrayOfString[0];
        str1 = arrayOfString[1];
        label123: if (this.mLaunchedFromCatalogueURI == null)
          break label307;
        if (!UserService.i(this.mContext).getUser().isLoggedIn())
          break label214;
        fetchCatalogueList(this.mLaunchedFromCatalogueURI.getAuthority(), str3, str1, (String)localList.get(1), (String)localList.get(2));
      }
    }
    label183: label207: label214: 
    while (this.mReturnFromLoginURI == null)
    {
      return;
      Uri localUri = this.mReturnFromLoginURI;
      localList = null;
      if (localUri == null)
        break;
      localList = this.mReturnFromLoginURI.getPathSegments();
      break;
      str3 = str2;
      break label123;
      AppConfigData localAppConfigData = AppConfigManager.i(this.mContext).getAppConfigData();
      if ((localAppConfigData != null) && (!localAppConfigData.getCountryCode().equalsIgnoreCase(str3)))
      {
        showDifferentConutryDialog(this.mLaunchedFromCatalogueURI.getAuthority(), str3, str1, (String)localList.get(1), (String)localList.get(2));
        return;
      }
      switchAccount(this.mLaunchedFromCatalogueURI.getAuthority(), str3, str1, (String)localList.get(1));
      return;
    }
    label307: if (UserService.i(this.mContext).getUser().isLoggedIn())
    {
      fetchCatalogueList(this.mReturnFromLoginURI.getAuthority(), str3, str1, (String)localList.get(1), (String)localList.get(3));
      return;
    }
    showCatalogueWarning(this.mReturnFromLoginURI.getAuthority(), str3, str1, (String)localList.get(1));
  }

  protected void loadCatalogueList(String paramString)
  {
    if (paramString.equalsIgnoreCase(ShoppingCart.i(this.mContext).getShoppingBagId()))
    {
      openSL();
      return;
    }
    showCatalogueLoadingDialog();
    String str = "";
    StoreRef localStoreRef = AppConfigManager.i(this).getAppConfigData().getFavStore();
    if (localStoreRef != null)
      str = localStoreRef.getStoreNo();
    ShoppingCartService.i(this.mContext).getShoppingBagByIdWLAsyncWL(this.mServiceCallback, UserService.i(this.mContext).getUser(), str, paramString);
  }

  protected void notifyShoppingListTransitionStop(boolean paramBoolean)
  {
    L.D("is shoping open " + paramBoolean);
    if (paramBoolean)
      close();
    super.notifyShoppingListTransitionStop(paramBoolean);
  }

  protected void notifyStopped()
  {
    super.notifyStopped();
    if (this.mTrayHandle != null)
      this.mTrayHandle.setEnabled(true);
  }

  public void onActivityResult(int paramInt1, int paramInt2, Intent paramIntent)
  {
    super.onActivityResult(paramInt1, paramInt2, paramIntent);
    String str8;
    String str9;
    String str10;
    if ((paramInt1 == 3048) && (paramInt2 == -1))
    {
      L.I(this, "Scan from ScanActivity");
      if (paramIntent != null)
      {
        str8 = paramIntent.getStringExtra("PRODUCT_ID");
        str9 = paramIntent.getStringExtra("PRODUCT_NAME");
        str10 = paramIntent.getStringExtra("GPR_ORIGIN");
        boolean bool = ShoppingCart.i(this).isExits(str8);
        L.I("is exits scan item in SC " + bool);
        if (!bool)
          break label411;
      }
    }
    if ((paramInt1 == 1) && (paramInt2 == -1) && (UiUtil.isTablet(getApplicationContext())))
    {
      close();
      if (paramIntent != null)
      {
        if (!paramIntent.getBooleanExtra("LOGIN_FROM_IKEA_FAMILY", false))
          break label452;
        this.mBus.post(new OpenBaseFamily(true));
      }
    }
    label151: if ((paramInt1 == 1) && (paramInt2 == 0))
      this.mHandler.post(new Runnable()
      {
        public void run()
        {
          WelcomeActivity.this.mBus.post(new LoginCanceledEvent());
        }
      });
    String str2;
    String str3;
    String str4;
    String str5;
    label319: String str6;
    if ((paramInt1 == 2) && (paramInt2 == -1))
    {
      str2 = "";
      str3 = "";
      Uri localUri = this.mLaunchedFromCatalogueURI;
      List localList = null;
      if (localUri != null)
      {
        str2 = this.mLaunchedFromCatalogueURI.getAuthority();
        localList = this.mLaunchedFromCatalogueURI.getPathSegments();
      }
      if (this.mReturnFromLoginURI != null)
      {
        str2 = this.mReturnFromLoginURI.getAuthority();
        localList = this.mReturnFromLoginURI.getPathSegments();
      }
      if ((!str2.isEmpty()) && (localList != null) && (localList.size() == 3))
      {
        str4 = (String)localList.get(0);
        if (!str4.contains("-"))
          break label496;
        String[] arrayOfString = str4.split("-");
        str5 = arrayOfString[0];
        str3 = arrayOfString[1];
        str6 = (String)localList.get(1);
        String str7 = (String)localList.get(2);
        if (!UserService.i(this.mContext).getUser().isLoggedIn())
          break label503;
        fetchCatalogueList(str2, str5, str3, str6, str7);
      }
    }
    while (true)
    {
      if ((paramInt1 == 3) && (paramInt2 == 1))
      {
        String str1 = paramIntent.getStringExtra("USER_NAME");
        this.mEventHandler.handleSessionExpiresEvent(new SessionExpiredEvent(str1));
      }
      return;
      label411: if ((UiUtil.isTablet(this)) && (isShoppingListMaximize()))
        closeShoppingWithotAnim();
      updateContentFragment(ProductDetailsBaseFragment.newInstance(this, 0, str8, str9, str10, false, false, true), false, true);
      break;
      label452: this.mEventHandler.showWelcome(new ShowWelcomeEvent(true, true, false));
      if (this.mTrayFragment == null)
        break label151;
      ((TrayFragment)this.mTrayFragment).handleWelcomeResume(new WelcomeResumedEvent());
      break label151;
      label496: str5 = str4;
      break label319;
      label503: showCatalogueWarning(str2, str5, str3, str6);
    }
  }

  protected void onCreate(Bundle paramBundle)
  {
    super.onCreate(paramBundle);
    UiUtil.applyLocaleString(this, false);
    this.mContext = this;
    this.mEventHandler = new EventHandler(null);
    if (paramBundle == null)
    {
      ShoppingCartService.i(this).processSyncSL(new SyncEventModel());
      ConfigService.i(getApplicationContext()).getConfigurationKSAsync(null, null, null);
    }
    if ((paramBundle == null) && (getIntent() != null) && (getIntent().getExtras() != null))
      if ((0x4 & getIntent().getFlags()) == 4)
        handleCatalogueRequest(getIntent());
    try
    {
      do
      {
        AppConfigManager.i(this.mContext).updateFirstTimeExp(false);
        setShowOverlayWhileSLOpening(false);
        String str5 = "";
        if ((paramBundle != null) && (paramBundle.containsKey("IS_SYNC_POPUP_VISIBLE")) && (paramBundle.getBoolean("IS_SYNC_POPUP_VISIBLE")))
          str5 = paramBundle.getString("SYNC_MESSSAGE");
        if (ShoppingCartService.i(this.mContext).isShowSLMergeResult())
          str5 = ShoppingCartService.i(this.mContext).getmSLMergeResult();
        if (!TextUtils.isEmpty(str5))
          showSyncDialog(str5);
        if ((paramBundle != null) && (paramBundle.containsKey("IS_CAMERA_POPUP_VISIBLE")))
        {
          boolean bool = paramBundle.getBoolean("IS_CAMERA_POPUP_VISIBLE");
          this.mCameraMessage = paramBundle.getString("CAMERA_POPUP_MESSAGE");
          if (bool)
            showCameraErrorPopUp(this.mCameraMessage);
        }
        if ((!this.mWasIRestoredAfterBeingKilledBySystem) && (!UiUtil.isConnectionAvailable(this)))
        {
          setNetworkPopUpVisibility(true);
          NetworkDialogFragment localNetworkDialogFragment = getNetworkDialogFragment();
          if (localNetworkDialogFragment != null)
            localNetworkDialogFragment.show(getSupportFragmentManager(), "NO_NETWORK_POP_UP");
        }
        return;
        if ((getIntent() != null) && (getIntent().getExtras() != null))
        {
          this.mLaunchedFromCatalogueURI = ((Uri)getIntent().getExtras().getParcelable("LaunchedFromCatalogue"));
          this.mReturnFromLoginURI = ((Uri)getIntent().getExtras().getParcelable("returnFromLogin"));
        }
      }
      while (paramBundle == null);
      String str1 = "";
      Object localObject = "";
      String str2 = "";
      String str3 = "";
      String str4 = "";
      String str7;
      if (this.mLaunchedFromCatalogueURI != null)
      {
        str1 = this.mLaunchedFromCatalogueURI.getAuthority();
        List localList2 = this.mLaunchedFromCatalogueURI.getPathSegments();
        if ((localList2 != null) && (localList2.size() == 3))
        {
          str7 = (String)localList2.get(0);
          if (!str7.contains("-"))
            break label769;
          String[] arrayOfString2 = str7.split("-");
          localObject = arrayOfString2[0];
          str2 = arrayOfString2[1];
          label439: str3 = (String)localList2.get(1);
          str4 = (String)localList2.get(2);
        }
      }
      List localList1;
      String str6;
      if (this.mReturnFromLoginURI != null)
      {
        str1 = this.mReturnFromLoginURI.getAuthority();
        localList1 = this.mReturnFromLoginURI.getPathSegments();
        if ((localList1 != null) && (localList1.size() == 3))
        {
          str6 = (String)localList1.get(0);
          if (!str6.contains("-"))
            break label775;
          String[] arrayOfString1 = str6.split("-");
          localObject = arrayOfString1[0];
          str2 = arrayOfString1[1];
        }
      }
      while (true)
      {
        str3 = (String)localList1.get(1);
        str4 = (String)localList1.get(2);
        if ((paramBundle.containsKey("IS_DIFFERENT_LOCALE_POPUP_VISIBLE")) && (paramBundle.getBoolean("IS_DIFFERENT_LOCALE_POPUP_VISIBLE")))
          showDifferentLocaleDialog(str3, str4);
        if ((paramBundle.containsKey("IS_DIFFERENT_COUNTRY_POPUP_VISIBLE")) && (paramBundle.getBoolean("IS_DIFFERENT_COUNTRY_POPUP_VISIBLE")))
          showDifferentConutryDialog(str1, (String)localObject, str2, str3, str4);
        if ((paramBundle.containsKey("IS_DIFFERENT_REGION_POPUP_VISIBLE")) && (paramBundle.getBoolean("IS_DIFFERENT_REGION_POPUP_VISIBLE")))
          showDifferentRegionDialog(str1, (String)localObject, str2, str3, str4);
        if ((paramBundle.containsKey("IS_DIFFERENT_LOGIN_POPUP_VISIBLE")) && (paramBundle.getBoolean("IS_DIFFERENT_LOGIN_POPUP_VISIBLE")))
          showSwitchAccountPopUp(str1, (String)localObject, str2, str3);
        if ((paramBundle.containsKey("IS_LOGIN_POPUP_VISIBLE")) && (paramBundle.getBoolean("IS_LOGIN_POPUP_VISIBLE")))
          showCatalogueWarning(str1, (String)localObject, str3, str4);
        if ((paramBundle.containsKey("IS_MERGE_POPUP_VISIBLE")) && (paramBundle.getBoolean("IS_MERGE_POPUP_VISIBLE")))
          showMergeDialog(this.mResult, str4);
        if ((!paramBundle.containsKey("IS_COULD_NOT_RETRIEVED_CATALOGUE_SL_VISIBLE")) || (!paramBundle.getBoolean("IS_COULD_NOT_RETRIEVED_CATALOGUE_SL_VISIBLE")))
          break;
        openLocalshoppingList();
        break;
        label769: localObject = str7;
        break label439;
        label775: localObject = str6;
      }
    }
    catch (Exception localException)
    {
      while (true)
        localException.printStackTrace();
    }
  }

  protected void onDestroy()
  {
    super.onDestroy();
    if (this.isDestroy)
      CatalogService.i(this).resetCachedCatalogInfo();
  }

  public void onNewIntent(Intent paramIntent)
  {
    super.onNewIntent(paramIntent);
    if ((paramIntent != null) && (paramIntent.getExtras() != null) && (paramIntent.hasExtra("SCAN_PRODUCT_ID")))
    {
      openSL();
      localRetailItemCommunication = ShoppingCart.i(this.mContext).getProduct(paramIntent.getStringExtra("SCAN_PRODUCT_ID"));
      this.mHandler.postDelayed(new Runnable()
      {
        public void run()
        {
          WelcomeActivity.this.mBus.post(new MotherSPRSelectedEvent(localRetailItemCommunication));
        }
      }
      , 100L);
    }
    while (paramIntent == null)
    {
      final RetailItemCommunication localRetailItemCommunication;
      return;
    }
    handleCatalogueRequest(paramIntent);
  }

  protected void onPause()
  {
    super.onPause();
    this.mServiceCallback.markInvalid();
    this.mBus.unregister(this.mEventHandler);
    this.mBus.unregister(this);
  }

  protected void onRestoreInstanceState(Bundle paramBundle)
  {
    super.onRestoreInstanceState(paramBundle);
    this.isDestroy = true;
  }

  protected void onResume()
  {
    super.onResume();
    this.mServiceCallback.markValid();
    this.mBus.register(this.mEventHandler);
    this.mBus.register(this);
  }

  protected void onSaveInstanceState(Bundle paramBundle)
  {
    super.onSaveInstanceState(paramBundle);
    this.isDestroy = false;
    if ((this.mShowSyncDialog != null) && (this.mShowSyncDialog.isShowing()))
    {
      paramBundle.putBoolean("IS_SYNC_POPUP_VISIBLE", this.mShowSyncDialog.isShowing());
      paramBundle.putString("SYNC_MESSSAGE", this.mSyncMessage);
    }
    if ((this.mShowCameraErrorDialog != null) && (this.mShowCameraErrorDialog.isShowing()))
    {
      paramBundle.putBoolean("IS_CAMERA_POPUP_VISIBLE", this.mShowCameraErrorDialog.isShowing());
      paramBundle.putString("CAMERA_POPUP_MESSAGE", this.mCameraMessage);
    }
    if ((this.mShowDifferentLocaleDialog != null) && (this.mShowDifferentLocaleDialog.isShowing()))
      paramBundle.putBoolean("IS_DIFFERENT_LOCALE_POPUP_VISIBLE", this.mShowDifferentLocaleDialog.isShowing());
    if ((this.mShowDifferentCountryDialog != null) && (this.mShowDifferentCountryDialog.isShowing()))
      paramBundle.putBoolean("IS_DIFFERENT_COUNTRY_POPUP_VISIBLE", this.mShowDifferentCountryDialog.isShowing());
    if ((this.mShowDifferentRegionDialog != null) && (this.mShowDifferentRegionDialog.isShowing()))
      paramBundle.putBoolean("IS_DIFFERENT_REGION_POPUP_VISIBLE", this.mShowDifferentRegionDialog.isShowing());
    if ((this.mShowDifferentLoginDialog != null) && (this.mShowDifferentLoginDialog.isShowing()))
      paramBundle.putBoolean("IS_DIFFERENT_LOGIN_POPUP_VISIBLE", this.mShowDifferentLoginDialog.isShowing());
    if ((this.mShowLoginDialog != null) && (this.mShowLoginDialog.isShowing()))
      paramBundle.putBoolean("IS_LOGIN_POPUP_VISIBLE", this.mShowLoginDialog.isShowing());
    if ((this.mShowNOCSLDialog != null) && (this.mShowNOCSLDialog.isShowing()))
      paramBundle.putBoolean("IS_COULD_NOT_RETRIEVED_CATALOGUE_SL_VISIBLE", this.mShowNOCSLDialog.isShowing());
    if ((this.mShowMergeDialog != null) && (this.mShowMergeDialog.isShowing()))
    {
      paramBundle.putBoolean("IS_MERGE_POPUP_VISIBLE", this.mShowMergeDialog.isShowing());
      paramBundle.putSerializable("SHOPPING_RESULT", this.mResult);
    }
  }

  protected void openLocalshoppingList()
  {
    this.mShowNOCSLDialog = new CustomPopUp(this.mContext, this.mContext.getString(2131165517), this.mContext.getString(2131165760));
    this.mShowNOCSLDialog.show();
    this.mContext.openSL();
  }

  public void openSL()
  {
    this.mEventHandler.showWelcome(new ShowWelcomeEvent(true, false, false));
    if (UiUtil.isTablet(this.mContext))
    {
      openCart();
      return;
    }
    this.mShopping.maximize(true);
  }

  public void refreshTray()
  {
    if (this.mTrayFragment != null)
      ((TrayFragment)this.mTrayFragment).refreshAdapter();
  }

  protected void showMergeDialog(final ShoppingBags paramShoppingBags, final String paramString)
  {
    WelcomeActivity localWelcomeActivity1 = this.mContext;
    String str1 = this.mContext.getString(2131165743);
    String str2 = this.mContext.getString(2131165489);
    WelcomeActivity localWelcomeActivity2 = this.mContext;
    Object[] arrayOfObject = new Object[1];
    arrayOfObject[0] = this.mCatalogueLanguage;
    this.mShowMergeDialog = new CustomPopUp(localWelcomeActivity1, str1, str2, localWelcomeActivity2.getString(2131165461, arrayOfObject), "", "");
    this.mShowMergeDialog.show(new CustomPopUp.CustomPopupClickListener()
    {
      public boolean onBackKeyPressed()
      {
        WelcomeActivity.this.mShowMergeDialog.dismiss();
        ShoppingCartService.i(WelcomeActivity.this.mContext).updateShoppingList(paramShoppingBags.getShoppingBagItemList(paramString), paramString, false);
        WelcomeActivity.this.openSL();
        return false;
      }

      public void onCancel()
      {
        ShoppingCartService.i(WelcomeActivity.this.mContext).updateShoppingList(paramShoppingBags.getShoppingBagItemList(paramString), paramString, false);
        WelcomeActivity.this.openSL();
      }

      public void onLinkClick()
      {
      }

      public void onPrimaryBtnClick()
      {
        ShoppingCartService.i(WelcomeActivity.this.mContext).mergeShoppingList(paramShoppingBags.getShoppingBagItemList(paramString), paramString);
        WelcomeActivity.this.openSL();
      }

      public void onSecondaryBtnClick()
      {
        ShoppingCartService.i(WelcomeActivity.this.mContext).updateShoppingList(paramShoppingBags.getShoppingBagItemList(paramString), paramString, false);
        WelcomeActivity.this.openSL();
      }
    });
  }

  protected void switchAccount(String paramString1, String paramString2, String paramString3, String paramString4)
  {
    AppConfigData localAppConfigData = AppConfigManager.i(this.mContext).getAppConfigData();
    int i;
    if ((localAppConfigData != null) && (localAppConfigData.getCountryCode().equalsIgnoreCase(paramString2)))
    {
      boolean bool4 = TextUtils.isEmpty(paramString3);
      i = 0;
      Object localObject2;
      if (!bool4)
      {
        List localList2 = localAppConfigData.getConfig().getRegions().getRegions();
        Iterator localIterator6 = localList2.iterator();
        Region localRegion4;
        do
        {
          boolean bool5 = localIterator6.hasNext();
          localObject2 = null;
          if (!bool5)
            break;
          localRegion4 = (Region)localIterator6.next();
        }
        while (!localRegion4.getValue().equalsIgnoreCase(paramString3));
        localObject2 = localRegion4;
        if (localObject2 == null)
        {
          Iterator localIterator7 = localList2.iterator();
          while (localIterator7.hasNext())
          {
            Region localRegion3 = (Region)localIterator7.next();
            if (localRegion3.isEnabled())
              localObject2 = localRegion3;
          }
        }
        i = 0;
        if (localObject2 == null);
      }
      Language localLanguage2;
      label277: label285: break label615;
    }
    while (true)
    {
      try
      {
        AppConfigManager.i(this.mContext).updateSelcetedRegion(localObject2.getName(), localObject2.getValue(), localObject2);
        i = 1;
        if (!localAppConfigData.getLanguageCode().equalsIgnoreCase(paramString4))
        {
          Iterator localIterator5 = localAppConfigData.getConfig().getLanguages().getLanguage().iterator();
          do
          {
            if (!localIterator5.hasNext())
              break;
            localLanguage2 = (Language)localIterator5.next();
          }
          while (!localLanguage2.getValue().equalsIgnoreCase(paramString4));
        }
      }
      catch (IOException localIOException3)
      {
        try
        {
          AppConfigManager.i(this.mContext).updateSelcetedLanguage(localLanguage2.getName(), paramString4);
          i = 1;
          if (i != 0)
            applyChanges();
          if ((AppConfigManager.i(this).getAppConfigData() != null) && (AppConfigManager.i(this).getAppConfigData().getConfig() != null) && (AppConfigManager.i(this).getAppConfigData().getConfig().ismLoginEnabled()))
          {
            Intent localIntent = getLoginIntent();
            localIntent.putExtra("LaunchedFromCatalogue", this.mLaunchedFromCatalogueURI);
            localIntent.putExtra("LaunchedFromCatalogueuser", paramString1);
            startActivityForResult(localIntent, 2);
            overridePendingTransition(2130968597, 2130968598);
          }
          return;
          localIOException3 = localIOException3;
          localIOException3.printStackTrace();
          i = 0;
        }
        catch (IOException localIOException2)
        {
          localIOException2.printStackTrace();
          break label277;
        }
      }
      Iterator localIterator1 = ConfigService.i(this.mContext).getCachedConfig().getCountry().iterator();
      if (!localIterator1.hasNext())
        continue;
      Country localCountry = (Country)localIterator1.next();
      if (!localCountry.getCountrycode().equalsIgnoreCase(paramString2))
        break label285;
      boolean bool1 = TextUtils.isEmpty(paramString3);
      Object localObject1 = null;
      if (!bool1)
      {
        List localList1 = localCountry.getRegions().getRegions();
        localObject1 = null;
        if (localList1 != null)
        {
          boolean bool2 = localList1.isEmpty();
          localObject1 = null;
          if (!bool2)
          {
            Iterator localIterator3 = localList1.iterator();
            Region localRegion2;
            do
            {
              boolean bool3 = localIterator3.hasNext();
              localObject1 = null;
              if (!bool3)
                break;
              localRegion2 = (Region)localIterator3.next();
            }
            while (!localRegion2.getValue().equalsIgnoreCase(paramString3));
            localObject1 = localRegion2;
            if (localObject1 == null)
            {
              Iterator localIterator4 = localList1.iterator();
              while (localIterator4.hasNext())
              {
                Region localRegion1 = (Region)localIterator4.next();
                if (localRegion1.isEnabled())
                  localObject1 = localRegion1;
              }
            }
          }
        }
      }
      Iterator localIterator2 = localCountry.getLanguages().getLanguage().iterator();
      label615: if (!localIterator2.hasNext())
        continue;
      Language localLanguage1 = (Language)localIterator2.next();
      if (!localLanguage1.getValue().equalsIgnoreCase(paramString4))
        break label285;
      try
      {
        AppConfigManager.i(this.mContext).updateSelectedConfig(localCountry, localObject1, localLanguage1.getName(), paramString4);
        applyChanges();
      }
      catch (IOException localIOException1)
      {
        while (true)
          localIOException1.printStackTrace();
      }
    }
  }

  private class EventHandler
  {
    private EventHandler()
    {
    }

    @Subscribe
    public void findProducts(BrowseProductEvent paramBrowseProductEvent)
    {
      boolean bool1 = true;
      ContentFragment localContentFragment;
      WelcomeActivity localWelcomeActivity;
      boolean bool2;
      if (!(WelcomeActivity.this.getContentFragment() instanceof CategorysBaseFragment))
      {
        UsageTracker.i().addCategoryNavigation(WelcomeActivity.this, "products", "all products", null);
        localContentFragment = CategorysBaseFragment.newInstance(paramBrowseProductEvent.launchedFromTray, paramBrowseProductEvent.launchedFromHome, paramBrowseProductEvent.launchedFromSearch);
        UsageTracker.i().viewTopLevelCategory(WelcomeActivity.this, paramBrowseProductEvent.launchedFromTray, paramBrowseProductEvent.launchedFromHome, paramBrowseProductEvent.launchedFromSearch);
        localWelcomeActivity = WelcomeActivity.this;
        if (paramBrowseProductEvent.launchedFromTray)
          break label101;
        bool2 = bool1;
        if (paramBrowseProductEvent.launchedFromTray)
          break label107;
      }
      while (true)
      {
        localWelcomeActivity.updateContentFragment(localContentFragment, bool2, bool1);
        return;
        label101: bool2 = false;
        break;
        label107: bool1 = false;
      }
    }

    @Subscribe
    public void findProducts(FindProductEvent paramFindProductEvent)
    {
      boolean bool1 = true;
      UsageTracker.i().setClosingSLForAddProduct(bool1);
      WelcomeActivity.this.closeShoppingList();
      if (!(WelcomeActivity.this.getContentFragment() instanceof SearchFragment))
      {
        SearchFragment localSearchFragment = WelcomeActivity.this.getSearchFragment();
        Bundle localBundle = new Bundle();
        boolean bool2 = paramFindProductEvent.fromTray;
        localBundle.putBoolean("LaunchedFromTray", bool2);
        localSearchFragment.setArguments(localBundle);
        UsageTracker.i().viewSearch(WelcomeActivity.this, bool2, paramFindProductEvent.fromSL);
        WelcomeActivity localWelcomeActivity = WelcomeActivity.this;
        boolean bool3;
        if (!bool2)
        {
          bool3 = bool1;
          if (bool2)
            break label121;
        }
        while (true)
        {
          localWelcomeActivity.updateContentFragment(localSearchFragment, bool3, bool1);
          return;
          bool3 = false;
          break;
          label121: bool1 = false;
        }
      }
      WelcomeActivity.this.mHandler.postDelayed(new Runnable()
      {
        public void run()
        {
          UiUtil.showKeyBoard(WelcomeActivity.this, WelcomeActivity.this.getCurrentFocus());
        }
      }
      , 300L);
    }

    @Subscribe
    public void findProducts(GoToSearchEvent paramGoToSearchEvent)
    {
      boolean bool1 = true;
      if (!(WelcomeActivity.this.getContentFragment() instanceof SearchFragment))
      {
        SearchFragment localSearchFragment = WelcomeActivity.this.getSearchFragment();
        Bundle localBundle = new Bundle();
        boolean bool2 = paramGoToSearchEvent.launchedFromTray;
        localBundle.putBoolean("LaunchedFromTray", bool2);
        localSearchFragment.setArguments(localBundle);
        UsageTracker.i().viewSearch(WelcomeActivity.this, bool2, false);
        WelcomeActivity localWelcomeActivity = WelcomeActivity.this;
        boolean bool3;
        if (!bool2)
        {
          bool3 = bool1;
          if (bool2)
            break label104;
        }
        while (true)
        {
          localWelcomeActivity.updateContentFragment(localSearchFragment, bool3, bool1);
          return;
          bool3 = false;
          break;
          label104: bool1 = false;
        }
      }
      WelcomeActivity.this.mHandler.postDelayed(new Runnable()
      {
        public void run()
        {
          UiUtil.showKeyBoard(WelcomeActivity.this, WelcomeActivity.this.getCurrentFocus());
        }
      }
      , 300L);
    }

    @Subscribe
    public void handleLogin(PerformLoginEvent paramPerformLoginEvent)
    {
      int i = 1;
      if ((AppConfigManager.i(WelcomeActivity.this).getAppConfigData() != null) && (AppConfigManager.i(WelcomeActivity.this).getAppConfigData().getConfig() != null) && (AppConfigManager.i(WelcomeActivity.this).getAppConfigData().getConfig().ismLoginEnabled()))
      {
        if (!UiUtil.isTablet(WelcomeActivity.this))
          break label133;
        UsageTracker.i().viewLogin(WelcomeActivity.this, paramPerformLoginEvent.launchedFromTray, paramPerformLoginEvent.launchedFromIKEAFamily);
        Intent localIntent = WelcomeActivity.this.getLoginIntent();
        localIntent.putExtra("LOGIN_FROM_IKEA_FAMILY", paramPerformLoginEvent.launchedFromIKEAFamily);
        localIntent.putExtra("LOGIN_FROM_TRAY", paramPerformLoginEvent.launchedFromTray);
        WelcomeActivity.this.startActivityForResult(localIntent, i);
        WelcomeActivity.this.overridePendingTransition(2130968597, 2130968598);
      }
      label133: 
      do
      {
        do
          return;
        while (!paramPerformLoginEvent.launchedFromTray);
        WelcomeActivity.this.close();
      }
      while ((WelcomeActivity.this.getContentFragment() instanceof LoginBaseFragment));
      UsageTracker.i().viewLogin(WelcomeActivity.this, paramPerformLoginEvent.launchedFromTray, paramPerformLoginEvent.launchedFromIKEAFamily);
      LoginBaseFragment localLoginBaseFragment = LoginBaseFragment.newInstance(paramPerformLoginEvent.launchedFromTray, paramPerformLoginEvent.launchedFromIKEAFamily);
      WelcomeActivity localWelcomeActivity = WelcomeActivity.this;
      int k;
      if (!paramPerformLoginEvent.launchedFromTray)
      {
        k = i;
        if (paramPerformLoginEvent.launchedFromTray)
          break label229;
      }
      while (true)
      {
        localWelcomeActivity.updateContentFragment(localLoginBaseFragment, k, i);
        return;
        int m = 0;
        break;
        label229: int j = 0;
      }
    }

    @Subscribe
    public void handleLoginResult(LoginResultEvent paramLoginResultEvent)
    {
      WelcomeActivity.this.mBus.post(new LoginDoneEvent());
      WelcomeActivity.this.mBus.post(new ShowWelcomeEvent(paramLoginResultEvent.launchedFromTray, true, false));
    }

    @Subscribe
    public void handleLoginSyncFailedEvent(LoginSyncFailedEvent paramLoginSyncFailedEvent)
    {
      UiUtil.showCustomToast(WelcomeActivity.this.getResources().getString(2131165446), WelcomeActivity.this);
    }

    @Subscribe
    public void handleLoginSyncResult(LoginSyncResultEvent paramLoginSyncResultEvent)
    {
      String str = paramLoginSyncResultEvent.syncResult;
      if (!TextUtils.isEmpty(str))
        WelcomeActivity.this.showSyncDialog(str);
    }

    @Subscribe
    public void handleSessionExpiresEvent(SessionExpiredEvent paramSessionExpiredEvent)
    {
      UiUtil.showCustomToast(WelcomeActivity.this.getResources().getString(2131165648), WelcomeActivity.this);
      if ((AppConfigManager.i(WelcomeActivity.this).getAppConfigData() != null) && (AppConfigManager.i(WelcomeActivity.this).getAppConfigData().getConfig() != null) && (AppConfigManager.i(WelcomeActivity.this).getAppConfigData().getConfig().ismLoginEnabled()))
      {
        Intent localIntent = WelcomeActivity.this.getLoginIntent();
        localIntent.putExtra("LaunchedFromCatalogueuser", paramSessionExpiredEvent.userId);
        WelcomeActivity.this.startActivityForResult(localIntent, 1);
        if (!UiUtil.isTablet(WelcomeActivity.this.mContext))
          WelcomeActivity.this.overridePendingTransition(2130968587, 2130968584);
      }
      else
      {
        return;
      }
      WelcomeActivity.this.overridePendingTransition(2130968597, 2130968598);
    }

    @Subscribe
    public void handleStoreLocator(GoToStoreLocatorEvent paramGoToStoreLocatorEvent)
    {
      boolean bool1 = true;
      if (paramGoToStoreLocatorEvent.fromTray)
      {
        StoreBaseFragment localStoreBaseFragment;
        WelcomeActivity localWelcomeActivity;
        boolean bool2;
        if (!(WelcomeActivity.this.getContentFragment() instanceof StoreBaseFragment))
        {
          localStoreBaseFragment = StoreBaseFragment.newInstance(WelcomeActivity.this, false, paramGoToStoreLocatorEvent.fromTray, paramGoToStoreLocatorEvent.fromWelcome, paramGoToStoreLocatorEvent.fromSL, paramGoToStoreLocatorEvent.fromSettings);
          localWelcomeActivity = WelcomeActivity.this;
          if (paramGoToStoreLocatorEvent.fromTray)
            break label82;
          bool2 = bool1;
          if (paramGoToStoreLocatorEvent.fromTray)
            break label88;
        }
        while (true)
        {
          localWelcomeActivity.updateContentFragment(localStoreBaseFragment, bool2, bool1);
          return;
          label82: bool2 = false;
          break;
          label88: bool1 = false;
        }
      }
      Intent localIntent = WelcomeActivity.this.getStoreLocatorIntent();
      localIntent.putExtra("FROM_SETTINGS", paramGoToStoreLocatorEvent.fromSettings);
      localIntent.putExtra("FROM_SL", paramGoToStoreLocatorEvent.fromSL);
      localIntent.putExtra("FROM_WELCOME", paramGoToStoreLocatorEvent.fromWelcome);
      WelcomeActivity.this.startActivity(localIntent);
      WelcomeActivity.this.overridePendingTransition(2130968587, 2130968584);
    }

    @Subscribe
    public void showAbout(ShowSettingsEvent paramShowSettingsEvent)
    {
      boolean bool1 = true;
      SettingFragment localSettingFragment;
      WelcomeActivity localWelcomeActivity;
      boolean bool3;
      if (!(WelcomeActivity.this.getContentFragment() instanceof SettingFragment))
      {
        UsageTracker.i().viewSettings(WelcomeActivity.this.mContext);
        localSettingFragment = new SettingFragment();
        Bundle localBundle = new Bundle();
        boolean bool2 = paramShowSettingsEvent.launchedFromTray;
        localBundle.putBoolean("LaunchedFromTray", bool2);
        localSettingFragment.setArguments(localBundle);
        localWelcomeActivity = WelcomeActivity.this;
        if (bool2)
          break label95;
        bool3 = bool1;
        if (bool2)
          break label101;
      }
      while (true)
      {
        localWelcomeActivity.updateContentFragment(localSettingFragment, bool3, bool1);
        return;
        label95: bool3 = false;
        break;
        label101: bool1 = false;
      }
    }

    @Subscribe
    public void showCampaignList(CampaignListEvent paramCampaignListEvent)
    {
      L.I("CampaignListEvent capture  : " + paramCampaignListEvent);
      UsageTracker.i().viewCampaignList(WelcomeActivity.this);
      CampaignListFragment localCampaignListFragment = new CampaignListFragment();
      localCampaignListFragment.setCampaignList(paramCampaignListEvent.getRootCampaignList());
      WelcomeActivity.this.updateContentFragment(localCampaignListFragment, true, true);
    }

    @Subscribe
    public void showCampaignView(CampaignViewEvent paramCampaignViewEvent)
    {
      L.I("CampaignViewEvent capture  : " + paramCampaignViewEvent.campaign.getImageUrl());
      UsageTracker.i().viewCampaignDetails(WelcomeActivity.this, paramCampaignViewEvent.campaign, paramCampaignViewEvent.fromHome);
      CampaignViewFragment localCampaignViewFragment = new CampaignViewFragment();
      localCampaignViewFragment.setCampaign(paramCampaignViewEvent.campaign);
      WelcomeActivity.this.updateContentFragment(localCampaignViewFragment, true, true);
    }

    @Subscribe
    public void showCart(ShoppingCartMenuButtonClicked paramShoppingCartMenuButtonClicked)
    {
      WelcomeActivity.this.openCart();
    }

    @Subscribe
    public void showIkeaFamily(OpenBaseFamily paramOpenBaseFamily)
    {
      boolean bool1 = true;
      FamilyBaseFragment localFamilyBaseFragment;
      WelcomeActivity localWelcomeActivity;
      boolean bool3;
      if (!(WelcomeActivity.this.getContentFragment() instanceof FamilyBaseFragment))
      {
        localFamilyBaseFragment = new FamilyBaseFragment();
        Bundle localBundle = new Bundle();
        boolean bool2 = paramOpenBaseFamily.launchedFromTray;
        localBundle.putBoolean("LaunchedFromTray", bool2);
        localFamilyBaseFragment.setArguments(localBundle);
        UsageTracker.i().viewIkeaFamily(WelcomeActivity.this, bool2);
        localWelcomeActivity = WelcomeActivity.this;
        if (bool2)
          break label94;
        bool3 = bool1;
        if (bool2)
          break label100;
      }
      while (true)
      {
        localWelcomeActivity.updateContentFragment(localFamilyBaseFragment, bool3, bool1);
        return;
        label94: bool3 = false;
        break;
        label100: bool1 = false;
      }
    }

    @Subscribe
    public void showInformation(ShowInformationEvent paramShowInformationEvent)
    {
      boolean bool1 = true;
      InformationFragment localInformationFragment;
      WelcomeActivity localWelcomeActivity;
      boolean bool3;
      if (!(WelcomeActivity.this.getContentFragment() instanceof InformationFragment))
      {
        UsageTracker.i().viewInformation(WelcomeActivity.this);
        localInformationFragment = new InformationFragment();
        Bundle localBundle = new Bundle();
        boolean bool2 = paramShowInformationEvent.isLaunchedFromTray;
        localBundle.putBoolean("LaunchedFromTray", bool2);
        localInformationFragment.setArguments(localBundle);
        localWelcomeActivity = WelcomeActivity.this;
        if (bool2)
          break label92;
        bool3 = bool1;
        if (bool2)
          break label98;
      }
      while (true)
      {
        localWelcomeActivity.updateContentFragment(localInformationFragment, bool3, bool1);
        return;
        label92: bool3 = false;
        break;
        label98: bool1 = false;
      }
    }

    @Subscribe
    public void showLegalNotice(ShowLegalNoticeEvent paramShowLegalNoticeEvent)
    {
      UsageTracker.i().viewLegalNotice(WelcomeActivity.this);
      WelcomeActivity.this.updateContentFragment(new LegalNoticeFragment(), true);
    }

    @Subscribe
    public void showProduct(SubCategorySelectedEvent paramSubCategorySelectedEvent)
    {
      WelcomeActivity.this.updateContentFragment(ProductListBaseFragment.newInstance(WelcomeActivity.this, paramSubCategorySelectedEvent.parentCategoryId, paramSubCategorySelectedEvent.categoryId, paramSubCategorySelectedEvent.categoryName, paramSubCategorySelectedEvent.catalogElement, paramSubCategorySelectedEvent.isSeasonal), true);
      UsageTracker.i().addCategoryNavigation(WelcomeActivity.this, "products listing", "product finder", paramSubCategorySelectedEvent.categoryId);
    }

    @Subscribe
    public void showProductDetails(ProductSelectedEvent paramProductSelectedEvent)
    {
      WelcomeActivity.this.updateContentFragment(ProductDetailsBaseFragment.newInstance(WelcomeActivity.this, paramProductSelectedEvent.index, paramProductSelectedEvent.productId, paramProductSelectedEvent.productName, paramProductSelectedEvent.gprItemOrigin, false, paramProductSelectedEvent.fromSearch, false), true);
    }

    @Subscribe
    public void showSearchedResult(PerformSearchEvent paramPerformSearchEvent)
    {
      WelcomeActivity.this.updateContentFragment(ProductListBaseFragment.newInstance(WelcomeActivity.this, paramPerformSearchEvent.searchedText, Boolean.valueOf(true)), false, false, true);
    }

    @Subscribe
    public void showSubCategory(CategorySelectedEvent paramCategorySelectedEvent)
    {
      WelcomeActivity.this.updateContentFragment(SubCategoryBaseFragment.newInstance(WelcomeActivity.this, paramCategorySelectedEvent.getCategoryName(), paramCategorySelectedEvent.getCategoryId(), paramCategorySelectedEvent.getCategoryType(), paramCategorySelectedEvent.getCatalogElementTree(), paramCategorySelectedEvent.isSeasonal()), true);
      UsageTracker.i().addCategoryNavigation(WelcomeActivity.this, "products", "product finder", paramCategorySelectedEvent.getCategoryId());
      UsageTracker.i().viewSubCategory(WelcomeActivity.this);
    }

    @Subscribe
    public void showWelcome(ShowWelcomeEvent paramShowWelcomeEvent)
    {
      boolean bool1 = true;
      WelcomeFragment localWelcomeFragment;
      WelcomeActivity localWelcomeActivity;
      boolean bool3;
      if ((paramShowWelcomeEvent.fromTray) && (!(WelcomeActivity.this.getContentFragment() instanceof WelcomeFragment)))
      {
        UsageTracker.i().resetNavigation();
        UsageTracker.i().viewHomePage(WelcomeActivity.this, paramShowWelcomeEvent.fromTray, paramShowWelcomeEvent.fromLogin, paramShowWelcomeEvent.fromLogout);
        WelcomeActivity.this.clearBackStackImmeadiate();
        localWelcomeFragment = new WelcomeFragment();
        Bundle localBundle = new Bundle();
        boolean bool2 = paramShowWelcomeEvent.fromTray;
        localBundle.putBoolean("LaunchedFromTray", bool2);
        localWelcomeFragment.setArguments(localBundle);
        localWelcomeActivity = WelcomeActivity.this;
        if (bool2)
          break label124;
        bool3 = bool1;
        if (bool2)
          break label130;
      }
      while (true)
      {
        localWelcomeActivity.updateContentFragment(localWelcomeFragment, bool3, bool1);
        return;
        label124: bool3 = false;
        break;
        label130: bool1 = false;
      }
    }

    @Subscribe
    public void startScan(ScanEvent paramScanEvent)
    {
      if (UiUtil.hasBackCamera(WelcomeActivity.this))
      {
        WelcomeActivity.this.close();
        UsageTracker.i().viewScan(WelcomeActivity.this, paramScanEvent.launchedFromTray, paramScanEvent.launchedFromWelcome);
        WelcomeActivity.this.startActivityForResult(WelcomeActivity.this.getWelcomeActivityIntent(), 3048);
        if (paramScanEvent.launchedFromPIP)
        {
          WelcomeActivity.this.overridePendingTransition(2130968583, 2130968582);
          return;
        }
        WelcomeActivity.this.overridePendingTransition(2130968587, 2130968584);
        return;
      }
      if ((AppConfigManager.i(WelcomeActivity.this).getAppConfigData() != null) && (!AppConfigManager.i(WelcomeActivity.this).getAppConfigData().getConfig().isBarCodeEnabled()))
      {
        WelcomeActivity.this.showCameraErrorPopUp(WelcomeActivity.this.getString(2131165596));
        return;
      }
      WelcomeActivity.this.showCameraErrorPopUp(WelcomeActivity.this.getString(2131165595));
    }
  }
}

/* Location:           C:\Documents and Settings\Cesar Cabello Cea\Mis documentos\Downloads\apk-downloader\com.ikea.kompis-6_dex2jar.jar
 * Qualified Name:     com.ikea.kompis.WelcomeActivity
 * JD-Core Version:    0.6.2
 */