Consider unregister successfull on 401 from RP server.

Fixes #4362
// FREEBIE
This commit is contained in:
Moxie Marlinspike 2015-11-03 14:45:49 -08:00
parent 004a87eba9
commit 58406d6b37

View File

@ -21,6 +21,7 @@ import com.google.android.gms.gcm.GoogleCloudMessaging;
import org.thoughtcrime.redphone.signaling.RedPhoneAccountManager;
import org.thoughtcrime.redphone.signaling.RedPhoneTrustStore;
import org.thoughtcrime.redphone.signaling.UnauthorizedException;
import org.thoughtcrime.securesms.ApplicationPreferencesActivity;
import org.thoughtcrime.securesms.BuildConfig;
import org.thoughtcrime.securesms.LogSubmitActivity;
@ -184,13 +185,20 @@ public class AdvancedPreferenceFragment extends PreferenceFragment {
TextSecurePreferences.getLocalNumber(context),
TextSecurePreferences.getPushServerPassword(context));
try {
accountManager.setGcmId(Optional.<String>absent());
} catch (AuthorizationFailedException e) {
Log.w(TAG, e);
}
try {
redPhoneAccountManager.setGcmId(Optional.<String>absent());
} catch (UnauthorizedException e) {
Log.w(TAG, e);
}
GoogleCloudMessaging.getInstance(context).unregister();
return SUCCESS;
} catch (AuthorizationFailedException afe) {
Log.w(TAG, afe);
return SUCCESS;
} catch (IOException ioe) {
Log.w(TAG, ioe);