mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-27 12:05:22 +00:00
Pass MasterSecret into pref fragments
Fixes #2868 Closes #2870 // FREEBIE
This commit is contained in:
parent
c50658a4f5
commit
0c7dba6d43
@ -69,16 +69,7 @@ public class ApplicationPreferencesActivity extends PassphraseRequiredActionBarA
|
||||
@Override
|
||||
protected void onCreate(Bundle icicle, @NonNull MasterSecret masterSecret) {
|
||||
this.getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
Bundle fragmentArgs = new Bundle();
|
||||
Fragment fragment = new ApplicationPreferenceFragment();
|
||||
|
||||
fragmentArgs.putParcelable("master_secret", masterSecret);
|
||||
fragment.setArguments(fragmentArgs);
|
||||
|
||||
getSupportFragmentManager().beginTransaction()
|
||||
.replace(android.R.id.content, fragment)
|
||||
.commit();
|
||||
initFragment(android.R.id.content, new ApplicationPreferenceFragment(), masterSecret);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -185,10 +176,7 @@ public class ApplicationPreferencesActivity extends PassphraseRequiredActionBarA
|
||||
fragment = new NotificationsPreferenceFragment();
|
||||
break;
|
||||
case PREFERENCE_CATEGORY_APP_PROTECTION:
|
||||
Bundle args = new Bundle();
|
||||
args.putParcelable("master_secret", masterSecret);
|
||||
fragment = new AppProtectionPreferenceFragment();
|
||||
fragment.setArguments(args);
|
||||
break;
|
||||
case PREFERENCE_CATEGORY_APPEARANCE:
|
||||
fragment = new AppearancePreferenceFragment();
|
||||
@ -203,6 +191,10 @@ public class ApplicationPreferencesActivity extends PassphraseRequiredActionBarA
|
||||
throw new AssertionError();
|
||||
}
|
||||
|
||||
Bundle args = new Bundle();
|
||||
args.putParcelable("master_secret", masterSecret);
|
||||
fragment.setArguments(args);
|
||||
|
||||
FragmentManager fragmentManager = getActivity().getSupportFragmentManager();
|
||||
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
|
||||
fragmentTransaction.replace(android.R.id.content, fragment);
|
||||
|
@ -22,6 +22,7 @@ import org.thoughtcrime.securesms.R;
|
||||
import org.thoughtcrime.securesms.RegistrationActivity;
|
||||
import org.thoughtcrime.securesms.contacts.ContactAccessor;
|
||||
import org.thoughtcrime.securesms.contacts.ContactIdentityManager;
|
||||
import org.thoughtcrime.securesms.crypto.MasterSecret;
|
||||
import org.thoughtcrime.securesms.push.TextSecureCommunicationFactory;
|
||||
import org.thoughtcrime.securesms.util.ProgressDialogAsyncTask;
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
@ -39,9 +40,12 @@ public class AdvancedPreferenceFragment extends PreferenceFragment {
|
||||
|
||||
private static final int PICK_IDENTITY_CONTACT = 1;
|
||||
|
||||
private MasterSecret masterSecret;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle paramBundle) {
|
||||
super.onCreate(paramBundle);
|
||||
masterSecret = getArguments().getParcelable("master_secret");
|
||||
addPreferencesFromResource(R.xml.preferences_advanced);
|
||||
|
||||
initializePushMessagingToggle();
|
||||
@ -186,12 +190,11 @@ public class AdvancedPreferenceFragment extends PreferenceFragment {
|
||||
builder.show();
|
||||
} else {
|
||||
Intent nextIntent = new Intent(getActivity(), ApplicationPreferencesActivity.class);
|
||||
nextIntent.putExtra("master_secret", getActivity().getIntent().getParcelableExtra("master_secret"));
|
||||
|
||||
Intent intent = new Intent(getActivity(), RegistrationActivity.class);
|
||||
intent.putExtra("cancel_button", true);
|
||||
intent.putExtra("next_intent", nextIntent);
|
||||
intent.putExtra("master_secret", getActivity().getIntent().getParcelableExtra("master_secret"));
|
||||
intent.putExtra("master_secret", masterSecret);
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user