mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-24 16:57:50 +00:00
parent
60f4e245e9
commit
50ae2dd1b8
@ -1,5 +1,6 @@
|
|||||||
package org.thoughtcrime.securesms;
|
package org.thoughtcrime.securesms;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
@ -132,6 +133,7 @@ public class DeviceActivity extends PassphraseRequiredActionBarActivity
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("StaticFieldLeak")
|
||||||
@Override
|
@Override
|
||||||
public void onLink(final Uri uri) {
|
public void onLink(final Uri uri) {
|
||||||
new ProgressDialogAsyncTask<Void, Void, Integer>(this,
|
new ProgressDialogAsyncTask<Void, Void, Integer>(this,
|
||||||
@ -147,6 +149,8 @@ public class DeviceActivity extends PassphraseRequiredActionBarActivity
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Integer doInBackground(Void... params) {
|
protected Integer doInBackground(Void... params) {
|
||||||
|
boolean isMultiDevice = TextSecurePreferences.isMultiDevice(DeviceActivity.this);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Context context = DeviceActivity.this;
|
Context context = DeviceActivity.this;
|
||||||
SignalServiceAccountManager accountManager = AccountManagerFactory.createManager(context);
|
SignalServiceAccountManager accountManager = AccountManagerFactory.createManager(context);
|
||||||
@ -163,20 +167,25 @@ public class DeviceActivity extends PassphraseRequiredActionBarActivity
|
|||||||
IdentityKeyPair identityKeyPair = IdentityKeyUtil.getIdentityKeyPair(context);
|
IdentityKeyPair identityKeyPair = IdentityKeyUtil.getIdentityKeyPair(context);
|
||||||
Optional<byte[]> profileKey = Optional.of(ProfileKeyUtil.getProfileKey(getContext()));
|
Optional<byte[]> profileKey = Optional.of(ProfileKeyUtil.getProfileKey(getContext()));
|
||||||
|
|
||||||
|
TextSecurePreferences.setMultiDevice(DeviceActivity.this, true);
|
||||||
accountManager.addDevice(ephemeralId, publicKey, identityKeyPair, profileKey, verificationCode);
|
accountManager.addDevice(ephemeralId, publicKey, identityKeyPair, profileKey, verificationCode);
|
||||||
TextSecurePreferences.setMultiDevice(context, true);
|
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
} catch (NotFoundException e) {
|
} catch (NotFoundException e) {
|
||||||
Log.w(TAG, e);
|
Log.w(TAG, e);
|
||||||
|
TextSecurePreferences.setMultiDevice(DeviceActivity.this, isMultiDevice);
|
||||||
return NO_DEVICE;
|
return NO_DEVICE;
|
||||||
} catch (DeviceLimitExceededException e) {
|
} catch (DeviceLimitExceededException e) {
|
||||||
Log.w(TAG, e);
|
Log.w(TAG, e);
|
||||||
|
TextSecurePreferences.setMultiDevice(DeviceActivity.this, isMultiDevice);
|
||||||
return LIMIT_EXCEEDED;
|
return LIMIT_EXCEEDED;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Log.w(TAG, e);
|
Log.w(TAG, e);
|
||||||
|
TextSecurePreferences.setMultiDevice(DeviceActivity.this, isMultiDevice);
|
||||||
return NETWORK_ERROR;
|
return NETWORK_ERROR;
|
||||||
} catch (InvalidKeyException e) {
|
} catch (InvalidKeyException e) {
|
||||||
Log.w(TAG, e);
|
Log.w(TAG, e);
|
||||||
|
TextSecurePreferences.setMultiDevice(DeviceActivity.this, isMultiDevice);
|
||||||
return KEY_ERROR;
|
return KEY_ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user