@Override protected void initViews(View layout) { super.initViews(layout); // Initialize settings settingsManager = appSession.getModuleManager().getSettingsManager(); AssetIssuerSettings settings = null; try { settings = settingsManager.loadAndGetSettings(appSession.getAppPublicKey()); } catch (Exception e) { settings = null; } if (settings == null) { settings = new AssetIssuerSettings(); settings.setIsContactsHelpEnabled(true); settings.setNotificationEnabled(true); settings.setIsPresentationHelpEnabled(true); try { settingsManager.persistSettings(appSession.getAppPublicKey(), settings); moduleManager.setAppPublicKey(appSession.getAppPublicKey()); moduleManager.changeNetworkType( settings.getBlockchainNetwork().get(settings.getBlockchainNetworkPosition())); } catch (CantPersistSettingsException e) { e.printStackTrace(); } } else { moduleManager.changeNetworkType( settings.getBlockchainNetwork().get(settings.getBlockchainNetworkPosition())); } final AssetIssuerSettings assetIssuerSettingsTemp = settings; Handler handlerTimer = new Handler(); handlerTimer.postDelayed( new Runnable() { public void run() { if (assetIssuerSettingsTemp.isPresentationHelpEnabled()) { setUpPresentation(false); } } }, 500); setupBackgroundBitmap(layout); configureToolbar(); noAssetsView = layout.findViewById(R.id.dap_wallet_no_assets); digitalAssets = (List) getMoreDataAsync(FermatRefreshTypes.NEW, 0); showOrHideNoAssetsView(digitalAssets.isEmpty()); onRefresh(); }
private void setUpPresentation(boolean checkButton) { try { PresentationDialog presentationDialog = new PresentationDialog.Builder(getActivity(), appSession) .setBannerRes(R.drawable.banner_asset_issuer_wallet) .setIconRes(R.drawable.asset_issuer) .setImageLeft(R.drawable.asset_issuer_identity) .setVIewColor(R.color.dap_issuer_view_color) .setTitleTextColor(R.color.dap_issuer_view_color) .setTextNameLeft(R.string.dap_issuer_wallet_welcome_name_left) .setSubTitle(R.string.dap_issuer_wallet_welcome_subTitle) .setBody(R.string.dap_issuer_wallet_welcome_body) .setTextFooter(R.string.dap_issuer_wallet_welcome_Footer) .setTemplateType( (moduleManager.getActiveAssetIssuerIdentity() == null) ? PresentationDialog.TemplateType.DAP_TYPE_PRESENTATION : PresentationDialog.TemplateType.TYPE_PRESENTATION_WITHOUT_IDENTITIES) .setIsCheckEnabled(checkButton) .build(); presentationDialog.setOnDismissListener( new DialogInterface.OnDismissListener() { @Override public void onDismiss(DialogInterface dialog) { Object o = appSession.getData(SessionConstantsAssetIssuer.PRESENTATION_IDENTITY_CREATED); if (o != null) { if ((Boolean) (o)) { // invalidate(); appSession.removeData(SessionConstantsAssetIssuer.PRESENTATION_IDENTITY_CREATED); } } try { IdentityAssetIssuer identityAssetIssuer = moduleManager.getActiveAssetIssuerIdentity(); if (identityAssetIssuer == null) { getActivity().onBackPressed(); } else { invalidate(); } } catch (CantGetIdentityAssetIssuerException e) { e.printStackTrace(); } } }); presentationDialog.show(); } catch (CantGetIdentityAssetIssuerException e) { e.printStackTrace(); } }
@Override public boolean onOptionsItemSelected(MenuItem item) { try { int id = item.getItemId(); if (id == SessionConstantsAssetIssuer.IC_ACTION_ISSUER_HELP_DELIVER) { setUpHelpAssetDeliveryList( moduleManager .loadAndGetSettings(appSession.getAppPublicKey()) .isPresentationHelpEnabled()); return true; } } catch (Exception e) { errorManager.reportUnexpectedUIException( UISource.ACTIVITY, UnexpectedUIExceptionSeverity.UNSTABLE, FermatException.wrapException(e)); makeText(getActivity(), R.string.dap_issuer_wallet_system_error, Toast.LENGTH_SHORT).show(); } return super.onOptionsItemSelected(item); }