Exemple #1
0
  private FermatSession createOrCallWalletSession() {
    FermatSession walletSession = null;
    try {
      Bundle bundle = getIntent().getExtras();
      if (bundle != null) {
        if (bundle.containsKey(INSTALLED_WALLET)) {
          lastWallet = (InstalledWallet) bundle.getSerializable(INSTALLED_WALLET);
        } else if (bundle.containsKey(WALLET_PUBLIC_KEY)) {
          String walletPublicKey = (String) bundle.get(WALLET_PUBLIC_KEY);
          lastWallet = getWalletManager().getInstalledWallet(walletPublicKey);
        }
        String publicKey = lastWallet.getAppPublicKey();

        //                AppConnections fermatAppConnection =
        // FermatAppConnectionManager.getFermatAppConnection(publicKey, this,
        // getIntraUserModuleManager().getActiveIntraUserIdentity(),
        // getAssetIssuerWalletModuleManager().getActiveAssetIssuerIdentity(),
        // getAssetUserWalletModuleManager().getActiveAssetUserIdentity(),
        // getAssetRedeemPointWalletModuleManager().getActiveAssetRedeemPointIdentity());

        AppConnections fermatAppConnection =
            FermatAppConnectionManager.getFermatAppConnection(publicKey, this);

        ModuleManager moduleManager =
            getModuleManager(fermatAppConnection.getPluginVersionReference());
        if (getWalletSessionManager().isWalletOpen(lastWallet.getWalletPublicKey())) {
          walletSession =
              getWalletSessionManager().getWalletSession(lastWallet.getWalletPublicKey());
        } else {
          walletSession =
              getWalletSessionManager()
                  .openWalletSession(
                      lastWallet, getErrorManager(), moduleManager, fermatAppConnection);
        }
      }
    } catch (Exception e) {
      getErrorManager()
          .reportUnexpectedUIException(
              UISource.ACTIVITY,
              UnexpectedUIExceptionSeverity.UNSTABLE,
              FermatException.wrapException(e));
      Toast.makeText(
              getApplicationContext(), "Oooops! recovering from system error", Toast.LENGTH_LONG)
          .show();
    }

    return walletSession;
  }
Exemple #2
0
  /** Method that loads the UI */
  protected void loadUI(FermatSession walletSession) {

    try {

      WalletNavigationStructure wallet = getWalletRuntimeManager().getLastWallet();

      //            FermatAppConnection fermatAppConnection =
      // FermatAppConnectionManager.getFermatAppConnection(wallet.getPublicKey(), this,
      // getIntraUserModuleManager().getActiveIntraUserIdentity(),
      // getAssetIssuerWalletModuleManager().getActiveAssetIssuerIdentity(),
      // getAssetUserWalletModuleManager().getActiveAssetUserIdentity(),
      // getAssetRedeemPointWalletModuleManager().getActiveAssetRedeemPointIdentity());

      AppConnections fermatAppConnection =
          FermatAppConnectionManager.getFermatAppConnection(
              wallet.getPublicKey(), this, walletSession);

      FermatFragmentFactory fermatFragmentFactory = fermatAppConnection.getFragmentFactory();
      Activity activity = wallet.getLastActivity();

      loadBasicUI(activity, fermatAppConnection);

      hideBottonIcons();

      paintScreen(activity);

      if (activity.getTabStrip() == null && activity.getFragments().size() > 1) {
        initialisePaging();
      }
      if (activity.getTabStrip() != null) {
        setPagerTabs(activity.getTabStrip(), walletSession, fermatFragmentFactory);
      }
      if (activity.getFragments().size() == 1) {
        setOneFragmentInScreen(fermatFragmentFactory);
      }
    } catch (Exception e) {
      getErrorManager()
          .reportUnexpectedUIException(
              UISource.ACTIVITY,
              UnexpectedUIExceptionSeverity.UNSTABLE,
              FermatException.wrapException(e));
      Toast.makeText(
              getApplicationContext(), "Oooops! recovering from system error", Toast.LENGTH_LONG)
          .show();
    }
  }
Exemple #3
0
  @Override
  public void changeWalletFragment(
      String walletCategory, String walletType, String walletPublicKey, String fragmentType) {
    try {
      getWalletRuntimeManager().getLastWallet().getLastActivity().getFragment(fragmentType);

      //            FermatAppConnection fermatAppConnection =
      // FermatAppConnectionManager.getFermatAppConnection(walletPublicKey,this,getIntraUserModuleManager().getActiveIntraUserIdentity(), getAssetIssuerWalletModuleManager().getActiveAssetIssuerIdentity(), getAssetUserWalletModuleManager().getActiveAssetUserIdentity(), getAssetRedeemPointWalletModuleManager().getActiveAssetRedeemPointIdentity());

      FermatAppConnection fermatAppConnection =
          FermatAppConnectionManager.getFermatAppConnection(
              walletPublicKey, this, getWalletSessionManager().getWalletSession(walletPublicKey));

      FermatFragmentFactory walletFragmentFactory =
          fermatAppConnection
              .getFragmentFactory(); // com.bitdubai.android_core.app.common.version_1.fragment_factory.WalletFragmentFactory.getFragmentFactoryByWalletType(walletCategory, walletType, walletPublicKey);
      Fragment fragment =
          walletFragmentFactory.getFragment(
              fragmentType,
              getWalletSessionManager()
                  .getWalletSession(getWalletRuntimeManager().getLastWallet().getPublicKey()),
              getWalletResourcesProviderManager());
      FragmentTransaction FT = this.getFragmentManager().beginTransaction();
      FT.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
      FT.replace(R.id.fragment_container2, fragment);
      FT.commit();
    } catch (Exception e) {
      getErrorManager()
          .reportUnexpectedUIException(
              UISource.ACTIVITY,
              UnexpectedUIExceptionSeverity.UNSTABLE,
              new IllegalArgumentException("Error in changeWalletFragment"));
      Toast.makeText(
              getApplicationContext(), "Oooops! recovering from system error", Toast.LENGTH_LONG)
          .show();
    }
  }