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