Revert "Fix re-registering missing MasterSecret"

This reverts commit beceee846a.
This commit is contained in:
Jake McGinty 2015-04-02 17:14:08 -07:00 committed by Moxie Marlinspike
parent afd6ab75f8
commit c50658a4f5
4 changed files with 16 additions and 11 deletions

View File

@ -103,7 +103,7 @@ public abstract class PassphraseRequiredActionBarActivity extends BaseActionBarA
case STATE_CREATE_PASSPHRASE: return getCreatePassphraseIntent();
case STATE_PROMPT_PASSPHRASE: return getPromptPassphraseIntent();
case STATE_UPGRADE_DATABASE: return getUpgradeDatabaseIntent(masterSecret);
case STATE_PROMPT_PUSH_REGISTRATION: return getPushRegistrationIntent();
case STATE_PROMPT_PUSH_REGISTRATION: return getPushRegistrationIntent(masterSecret);
default: return null;
}
}
@ -134,12 +134,12 @@ public abstract class PassphraseRequiredActionBarActivity extends BaseActionBarA
return getRoutedIntent(DatabaseUpgradeActivity.class,
TextSecurePreferences.hasPromptedPushRegistration(this)
? getConversationListIntent()
: getPushRegistrationIntent(),
: getPushRegistrationIntent(masterSecret),
masterSecret);
}
private Intent getPushRegistrationIntent() {
return getRoutedIntent(RegistrationActivity.class, getConversationListIntent(), null);
private Intent getPushRegistrationIntent(MasterSecret masterSecret) {
return getRoutedIntent(RegistrationActivity.class, getConversationListIntent(), masterSecret);
}
private Intent getRoutedIntent(Class<?> destination, @Nullable Intent nextIntent, @Nullable MasterSecret masterSecret) {

View File

@ -4,7 +4,6 @@ import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.telephony.TelephonyManager;
import android.text.Editable;
import android.text.TextUtils;
@ -39,7 +38,7 @@ import org.whispersystems.textsecure.api.util.PhoneNumberFormatter;
* @author Moxie Marlinspike
*
*/
public class RegistrationActivity extends PassphraseRequiredActionBarActivity {
public class RegistrationActivity extends BaseActionBarActivity {
private static final int PICK_COUNTRY = 1;
@ -54,8 +53,8 @@ public class RegistrationActivity extends PassphraseRequiredActionBarActivity {
private MasterSecret masterSecret;
@Override
protected void onCreate(Bundle icicle, @NonNull MasterSecret masterSecret) {
this.masterSecret = masterSecret;
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.registration_activity);
getSupportActionBar().setTitle(getString(R.string.RegistrationActivity_connect_with_textsecure));
@ -75,6 +74,7 @@ public class RegistrationActivity extends PassphraseRequiredActionBarActivity {
}
private void initializeResources() {
this.masterSecret = getIntent().getParcelableExtra("master_secret");
this.countrySpinner = (Spinner)findViewById(R.id.country_spinner);
this.countryCode = (TextView)findViewById(R.id.country_code);
this.number = (TextView)findViewById(R.id.number);

View File

@ -13,7 +13,7 @@ import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
import android.os.Message;
import android.support.annotation.NonNull;
import android.support.v7.app.ActionBarActivity;
import android.text.SpannableString;
import android.text.Spanned;
import android.text.TextUtils;
@ -30,8 +30,10 @@ import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import org.thoughtcrime.securesms.crypto.MasterSecret;
import org.thoughtcrime.securesms.push.TextSecureCommunicationFactory;
import org.thoughtcrime.securesms.service.KeyCachingService;
import org.thoughtcrime.securesms.service.RegistrationService;
import org.thoughtcrime.securesms.util.Dialogs;
import org.thoughtcrime.securesms.util.TextSecurePreferences;
@ -45,7 +47,7 @@ import java.io.IOException;
import static org.thoughtcrime.securesms.service.RegistrationService.RegistrationState;
public class RegistrationProgressActivity extends PassphraseRequiredActionBarActivity {
public class RegistrationProgressActivity extends BaseActionBarActivity {
private static final int FOCUSED_COLOR = Color.parseColor("#ff333333");
private static final int UNFOCUSED_COLOR = Color.parseColor("#ff808080");
@ -90,7 +92,8 @@ public class RegistrationProgressActivity extends PassphraseRequiredActionBarAct
private volatile boolean visible;
@Override
protected void onCreate(Bundle bundle, @NonNull MasterSecret masterSecret) {
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
getSupportActionBar().setTitle(getString(R.string.RegistrationProgressActivity_verifying_number));
setContentView(R.layout.registration_progress_activity);

View File

@ -186,10 +186,12 @@ 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"));
startActivity(intent);
}