@Override protected void onPostExecute(Exception e) { Log.i(TAG, "Finished loading DescriptionStore and IdemixKeyStore"); if (e != null) throw new RuntimeException(e); else setState(State.KEY_STORE_LOADED); for (SchemeManager manager : DescriptionStore.getInstance().getSchemeManagers()) { if (manager.hasKeyshareServer() && !CredentialManager.isEnrolledToKeyshareServer(manager.getName())) { final SchemeManager m = manager; SchemeManagerHandler.getKeyserverEnrollInput( MainActivity.this, new SchemeManagerHandler.KeyserverInputHandler() { @Override public void done(String email, String pin) { SchemeManagerHandler.enrollCloudServer( m.getName(), m.getKeyshareServer(), email, pin, MainActivity.this, null); } }); } } }
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == EnrollSelectActivity.ACTIVITY_CODE && resultCode == RESULT_OK) { updateCredentialList(); } else if (requestCode == CredentialDetailActivity.ACTIVITY_CODE && resultCode == CredentialDetailActivity.RESULT_DELETE) { int hashCode = data.getIntExtra(CredentialDetailActivity.ARG_RESULT_DELETE, 0); if (hashCode != 0) tryDeleteCredential(hashCode); } else if (requestCode == IRMAPreferenceActivity.ACTIVITY_CODE) { if (PreferenceManager.getDefaultSharedPreferences(this) .getBoolean("allow_screenshots", false)) getWindow().clearFlags(WindowManager.LayoutParams.FLAG_SECURE); else getWindow() .setFlags( WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE); } else { // Must be from the QR scanner MetricsReporter.getInstance() .reportAggregrateMeasurement( "qr_scan_time", System.currentTimeMillis() - qrScanStartTime); IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, data); // Process the results from the QR-scanning activity if (scanResult == null) return; String contents = scanResult.getContents(); if (contents == null) return; IrmaQr qr; try { qr = GsonUtil.getGson().fromJson(contents, IrmaQr.class); } catch (Exception e) { irmaClientHandler.onFailure( IrmaClient.Action.UNKNOWN, "Not an IRMA session", null, "Content: " + contents); return; } String qrType = qr.getType(); if (qrType == null) qrType = ""; switch (qrType) { case "schememanager": Log.i(TAG, "Adding new scheme manager from qr code!"); SchemeManagerHandler.confirmAndDownloadManager( GsonUtil.getGson().fromJson(contents, SchemeManagerQr.class).getUrl(), this, new Runnable() { @Override public void run() { updateCredentialList(false); } }); break; case "disclosing": case "signing": case "issuing": default: launchedFromBrowser = false; onlineEnrolling = false; IrmaClient.NewSession(contents, irmaClientHandler); break; } } }