/**
   * Crea una nueva identidad para un crypto broker
   *
   * @return key con el resultado de la operacion:<br>
   *     <br>
   *     <code>CREATE_IDENTITY_SUCCESS</code>: Se creo exitosamente una identidad <br>
   *     <code>CREATE_IDENTITY_FAIL_MODULE_EXCEPTION</code>: Se genero una excepcion cuando se
   *     ejecuto el metodo para crear la identidad en el Module Manager <br>
   *     <code>CREATE_IDENTITY_FAIL_MODULE_IS_NULL</code>: No se tiene una referencia al Module
   *     Manager <br>
   *     <code>CREATE_IDENTITY_FAIL_NO_VALID_DATA</code>: Los datos ingresados para crear la
   *     identidad no son validos (faltan datos, no tiene el formato correcto, etc) <br>
   */
  private int createNewIdentity() {

    String brokerNameText = mIdentityName.getText().toString();
    boolean dataIsValid = validateIdentityData(brokerNameText, brokerImageByteArray);

    if (dataIsValid) {
      if (moduleManager != null) {
        try {
          if (!isUpdate)
            moduleManager.createNewRedeemPoint(
                brokerNameText,
                (brokerImageByteArray == null)
                    ? convertImage(R.drawable.ic_profile_male)
                    : brokerImageByteArray);
          else
            moduleManager.updateIdentityRedeemPoint(
                identitySelected.getPublicKey(), brokerNameText, brokerImageByteArray);
        } catch (CantCreateNewRedeemPointException e) {
          errorManager.reportUnexpectedUIException(
              UISource.VIEW, UnexpectedUIExceptionSeverity.UNSTABLE, e);
        } catch (CantUpdateIdentityRedeemPointException e) {
          errorManager.reportUnexpectedUIException(
              UISource.VIEW, UnexpectedUIExceptionSeverity.UNSTABLE, e);
        }
        return CREATE_IDENTITY_SUCCESS;
      }
      return CREATE_IDENTITY_FAIL_MODULE_IS_NULL;
    }
    return CREATE_IDENTITY_FAIL_NO_VALID_DATA;
  }
Exemplo n.º 2
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    try {

      setHasOptionsMenu(true);
      // setting up  module
      moduleManager = appSession.getModuleManager();
      errorManager = appSession.getErrorManager();

      mNotificationsCount =
          moduleManager
              .listCryptoBrokersPendingLocalAction(
                  moduleManager.getSelectedActorIdentity(), MAX, offset)
              .size();

      // TODO: display unread notifications.
      new FetchCountTask().execute();

    } catch (Exception ex) {
      CommonLogger.exception(TAG, ex.getMessage(), ex);
      errorManager.reportUnexpectedUIException(
          UISource.ACTIVITY, UnexpectedUIExceptionSeverity.CRASH, ex);
    }
  }
Exemplo n.º 3
0
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    try {
      int id = item.getItemId();

      if (id == SessionConstantsAssetUser.IC_ACTION_USER_HELP_REDEEM) {
        setUpHelpAssetRedeem(
            settingsManager
                .loadAndGetSettings(appSession.getAppPublicKey())
                .isPresentationHelpEnabled());
        return true;
      }

    } catch (Exception e) {
      errorManager.reportUnexpectedUIException(
          UISource.ACTIVITY,
          UnexpectedUIExceptionSeverity.UNSTABLE,
          FermatException.wrapException(e));
      makeText(
              getActivity(),
              getResources().getString(R.string.dap_user_wallet_system_error),
              Toast.LENGTH_SHORT)
          .show();
    }
    return super.onOptionsItemSelected(item);
  }
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    try {

      if (item.getItemId() == R.id.action_identity_redeem_help) {
        setUpPresentation(
            settingsManager
                .loadAndGetSettings(appSession.getAppPublicKey())
                .isPresentationHelpEnabled());
        return true;
      }

    } catch (Exception e) {
      errorManager.reportUnexpectedUIException(
          UISource.ACTIVITY,
          UnexpectedUIExceptionSeverity.UNSTABLE,
          FermatException.wrapException(e));
      makeText(getActivity(), "Identity User system error", Toast.LENGTH_SHORT).show();
    }
    return super.onOptionsItemSelected(item);
  }
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    try {
      int id = item.getItemId();

      if (id == SessionConstantsAssetIssuer.IC_ACTION_ISSUER_HELP_HISTORY) {
        setUpHelpAssetHistory(
            settingsManager
                .loadAndGetSettings(appSession.getAppPublicKey())
                .isPresentationHelpEnabled());
        return true;
      }

    } catch (Exception e) {
      errorManager.reportUnexpectedUIException(
          UISource.ACTIVITY,
          UnexpectedUIExceptionSeverity.UNSTABLE,
          FermatException.wrapException(e));
      makeText(getActivity(), "Asset Issuer system error", Toast.LENGTH_SHORT).show();
    }
    return super.onOptionsItemSelected(item);
  }
Exemplo n.º 6
0
  /** Fragment Class implementation. */
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    try {
      rootView = inflater.inflate(R.layout.fragment_connections_world, container, false);
      setUpScreen(inflater);
      recyclerView = (RecyclerView) rootView.findViewById(R.id.gridView);
      recyclerView.setHasFixedSize(true);
      layoutManager = new GridLayoutManager(getActivity(), 3, LinearLayoutManager.VERTICAL, false);
      recyclerView.setLayoutManager(layoutManager);
      adapter = new AppListAdapter(getActivity(), cryptoBrokerCommunityInformationList);
      recyclerView.setAdapter(adapter);
      adapter.setFermatListEventListener(this);

      swipeRefresh = (SwipeRefreshLayout) rootView.findViewById(R.id.swipe);
      swipeRefresh.setOnRefreshListener(this);
      swipeRefresh.setColorSchemeColors(Color.BLUE, Color.BLUE);

      rootView.setBackgroundColor(Color.parseColor("#000b12"));
      emptyView = (LinearLayout) rootView.findViewById(R.id.empty_view);
      onRefresh();

    } catch (Exception ex) {
      errorManager.reportUnexpectedUIException(
          UISource.ACTIVITY,
          UnexpectedUIExceptionSeverity.CRASH,
          FermatException.wrapException(ex));
      Toast.makeText(
              getActivity().getApplicationContext(),
              "Oooops! recovering from system error",
              Toast.LENGTH_SHORT)
          .show();
    }

    return rootView;
  }
Exemplo n.º 7
0
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    try {

      int id = item.getItemId();

      if (id == Constants.SELECT_IDENTITY) {
        final ListIdentitiesDialog progressDialog =
            new ListIdentitiesDialog(getActivity(), appSession, appResourcesProviderManager);
        progressDialog.setTitle("Select an Identity");
        progressDialog.setCancelable(false);
        progressDialog.show();
        return true;
      }

    } catch (Exception e) {
      errorManager.reportUnexpectedUIException(
          UISource.ACTIVITY,
          UnexpectedUIExceptionSeverity.UNSTABLE,
          FermatException.wrapException(e));
      makeText(getActivity(), "Oooops! recovering from system error", Toast.LENGTH_SHORT).show();
    }
    return super.onOptionsItemSelected(item);
  }