handle first time wizard after import from token
This commit is contained in:
parent
0011c5adac
commit
aac5ae3a2c
|
@ -20,9 +20,11 @@ package org.sufficientlysecure.keychain.ui;
|
|||
import android.content.Intent;
|
||||
import android.nfc.NfcAdapter;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
import android.support.v4.app.FragmentTransaction;
|
||||
import android.support.v4.app.TaskStackBuilder;
|
||||
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.pgp.exception.PgpKeyNotFoundException;
|
||||
|
@ -270,11 +272,23 @@ public class CreateKeyActivity extends BaseSecurityTokenActivity {
|
|||
|
||||
@Override
|
||||
public void finish() {
|
||||
finishWithFirstTimeHandling(null);
|
||||
}
|
||||
|
||||
public void finishWithFirstTimeHandling(@Nullable Intent intentToLaunch) {
|
||||
if (mFirstTime) {
|
||||
Preferences prefs = Preferences.getPreferences(this);
|
||||
prefs.setFirstTime(false);
|
||||
Intent intent = new Intent(this, MainActivity.class);
|
||||
startActivity(intent);
|
||||
|
||||
TaskStackBuilder taskStackBuilder = TaskStackBuilder.create(this);
|
||||
Intent mainActivityIntent = new Intent(this, MainActivity.class);
|
||||
taskStackBuilder.addNextIntent(mainActivityIntent);
|
||||
if (intentToLaunch != null) {
|
||||
taskStackBuilder.addNextIntent(intentToLaunch);
|
||||
}
|
||||
taskStackBuilder.startActivities();
|
||||
} else if (intentToLaunch != null) {
|
||||
startActivity(intentToLaunch);
|
||||
}
|
||||
|
||||
super.finish();
|
||||
|
|
|
@ -281,15 +281,20 @@ public class CreateSecurityTokenImportResetFragment
|
|||
// null-protected from Queueing*Fragment
|
||||
Activity activity = getActivity();
|
||||
|
||||
Intent intent = new Intent(activity, ViewKeyActivity.class);
|
||||
Intent viewKeyIntent = new Intent(activity, ViewKeyActivity.class);
|
||||
// use the imported masterKeyId, not the one from the token, because
|
||||
// that one might* just have been a subkey of the imported key
|
||||
intent.setData(KeyRings.buildGenericKeyRingUri(masterKeyIds[0]));
|
||||
intent.putExtra(ViewKeyActivity.EXTRA_DISPLAY_RESULT, result);
|
||||
intent.putExtra(ViewKeyActivity.EXTRA_SECURITY_TOKEN_AID, mTokenAid);
|
||||
intent.putExtra(ViewKeyActivity.EXTRA_SECURITY_TOKEN_USER_ID, mTokenUserId);
|
||||
intent.putExtra(ViewKeyActivity.EXTRA_SECURITY_TOKEN_FINGERPRINTS, mTokenFingerprints);
|
||||
startActivity(intent);
|
||||
activity.finish();
|
||||
viewKeyIntent.setData(KeyRings.buildGenericKeyRingUri(masterKeyIds[0]));
|
||||
viewKeyIntent.putExtra(ViewKeyActivity.EXTRA_DISPLAY_RESULT, result);
|
||||
viewKeyIntent.putExtra(ViewKeyActivity.EXTRA_SECURITY_TOKEN_AID, mTokenAid);
|
||||
viewKeyIntent.putExtra(ViewKeyActivity.EXTRA_SECURITY_TOKEN_USER_ID, mTokenUserId);
|
||||
viewKeyIntent.putExtra(ViewKeyActivity.EXTRA_SECURITY_TOKEN_FINGERPRINTS, mTokenFingerprints);
|
||||
|
||||
if (activity instanceof CreateKeyActivity) {
|
||||
((CreateKeyActivity) activity).finishWithFirstTimeHandling(viewKeyIntent);
|
||||
} else {
|
||||
activity.startActivity(viewKeyIntent);
|
||||
activity.finish();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue