mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-25 01:07:47 +00:00
Show device unlink message on startup.
This commit is contained in:
parent
733ab06e70
commit
27c8b45ae3
@ -1647,5 +1647,8 @@
|
||||
<!-- Device list bottom sheet fragment -->
|
||||
<string name="fragment_device_list_edit_device_name_title">Edit device name</string>
|
||||
<string name="fragment_device_list_unlink_device_title">Unlink device</string>
|
||||
<!-- Device unlink dialog -->
|
||||
<string name="dialog_device_unlink_title">Device unlinked</string>
|
||||
<string name="dialog_device_unlink_message">This device has been successfully unlinked.</string>
|
||||
|
||||
</resources>
|
||||
|
@ -607,12 +607,12 @@ public class ApplicationContext extends MultiDexApplication implements Dependenc
|
||||
if (TextSecurePreferences.resetDatabase(this)) {
|
||||
boolean wasUnlinked = TextSecurePreferences.databaseResetFromUnpair(this);
|
||||
TextSecurePreferences.clearAll(this);
|
||||
TextSecurePreferences.setDatabaseResetFromUnpair(this, wasUnlinked); // Loki - Re-set the preference so we can use it in the starting screen to determine whether device was unlinked or not
|
||||
MasterSecretUtil.clear(this);
|
||||
if (this.deleteDatabase("signal.db")) {
|
||||
Log.d("Loki", "Deleted database");
|
||||
}
|
||||
// Loki - Re-set the preference so we can use it in the starting screen to determine whether device was unlinked or not
|
||||
TextSecurePreferences.setDatabaseResetFromUnpair(this, wasUnlinked);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -335,6 +335,7 @@ public class PushDecryptJob extends BaseJob implements InjectableType {
|
||||
// Make sure we got the request from our primary device
|
||||
String ourPrimaryDevice = TextSecurePreferences.getMasterHexEncodedPublicKey(context);
|
||||
if (ourPrimaryDevice != null && ourPrimaryDevice.equals(content.getSender())) {
|
||||
TextSecurePreferences.setDatabaseResetFromUnpair(context, true);
|
||||
MultiDeviceUtilities.checkForRevocation(context);
|
||||
}
|
||||
} else {
|
||||
|
@ -24,6 +24,7 @@ import org.whispersystems.signalservice.api.push.SignalServiceAddress
|
||||
import org.whispersystems.signalservice.loki.api.LokiStorageAPI
|
||||
import org.whispersystems.signalservice.loki.api.PairingAuthorisation
|
||||
import org.whispersystems.signalservice.loki.messaging.LokiThreadFriendRequestStatus
|
||||
import org.whispersystems.signalservice.loki.utilities.Analytics
|
||||
import org.whispersystems.signalservice.loki.utilities.recover
|
||||
import org.whispersystems.signalservice.loki.utilities.retryIfNeeded
|
||||
import java.util.*
|
||||
@ -40,6 +41,7 @@ fun checkForRevocation(context: Context) {
|
||||
DatabaseFactory.getLokiAPIDatabase(context).removePairingAuthorisations(ourDevice)
|
||||
LokiStorageAPI.shared.updateUserDeviceMappings()
|
||||
}.successUi {
|
||||
Analytics.shared.track("Secondary Device Unlinked")
|
||||
TextSecurePreferences.setNeedsRevocationCheck(context, false)
|
||||
ApplicationContext.getInstance(context).clearData()
|
||||
}.fail { error ->
|
||||
|
@ -1,6 +1,8 @@
|
||||
package org.thoughtcrime.securesms.registration;
|
||||
|
||||
import android.Manifest;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
@ -8,6 +10,7 @@ import android.support.annotation.NonNull;
|
||||
import org.thoughtcrime.securesms.BaseActionBarActivity;
|
||||
import org.thoughtcrime.securesms.permissions.Permissions;
|
||||
import org.thoughtcrime.securesms.util.CommunicationActions;
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
import org.whispersystems.signalservice.loki.utilities.Analytics;
|
||||
|
||||
import network.loki.messenger.R;
|
||||
@ -23,6 +26,24 @@ public class WelcomeActivity extends BaseActionBarActivity {
|
||||
Analytics.Companion.getShared().track("Landing Screen Viewed");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
if (TextSecurePreferences.databaseResetFromUnpair(this)) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
builder.setTitle(R.string.dialog_device_unlink_title);
|
||||
builder.setMessage(R.string.dialog_device_unlink_message);
|
||||
builder.setPositiveButton(R.string.ok, null);
|
||||
builder.setOnDismissListener(new DialogInterface.OnDismissListener() {
|
||||
@Override
|
||||
public void onDismiss(DialogInterface dialog) {
|
||||
TextSecurePreferences.setDatabaseResetFromUnpair(getBaseContext(), false);
|
||||
}
|
||||
});
|
||||
builder.show();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
|
||||
Permissions.onRequestPermissionsResult(this, requestCode, permissions, grantResults);
|
||||
|
Loading…
x
Reference in New Issue
Block a user