mirror of
https://github.com/oxen-io/session-android.git
synced 2025-12-29 01:18:31 +00:00
Support for device management, limits, and contact requests.
// FREEBIE
This commit is contained in:
@@ -6,13 +6,11 @@ import android.content.DialogInterface.OnDismissListener;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.text.SpannableString;
|
||||
import android.text.SpannableStringBuilder;
|
||||
import android.util.Log;
|
||||
import android.view.Window;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.afollestad.materialdialogs.DialogAction;
|
||||
import com.afollestad.materialdialogs.MaterialDialog;
|
||||
import com.afollestad.materialdialogs.MaterialDialog.Builder;
|
||||
import com.afollestad.materialdialogs.MaterialDialog.ButtonCallback;
|
||||
@@ -28,6 +26,7 @@ import org.whispersystems.libaxolotl.ecc.Curve;
|
||||
import org.whispersystems.libaxolotl.ecc.ECPublicKey;
|
||||
import org.whispersystems.textsecure.api.TextSecureAccountManager;
|
||||
import org.whispersystems.textsecure.api.push.exceptions.NotFoundException;
|
||||
import org.whispersystems.textsecure.internal.push.DeviceLimitExceededException;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@@ -94,10 +93,11 @@ public class DeviceProvisioningActivity extends PassphraseRequiredActionBarActiv
|
||||
R.string.DeviceProvisioningActivity_content_progress_title,
|
||||
R.string.DeviceProvisioningActivity_content_progress_content)
|
||||
{
|
||||
private static final int SUCCESS = 0;
|
||||
private static final int NO_DEVICE = 1;
|
||||
private static final int NETWORK_ERROR = 2;
|
||||
private static final int KEY_ERROR = 3;
|
||||
private static final int SUCCESS = 0;
|
||||
private static final int NO_DEVICE = 1;
|
||||
private static final int NETWORK_ERROR = 2;
|
||||
private static final int KEY_ERROR = 3;
|
||||
private static final int LIMIT_EXCEEDED = 4;
|
||||
|
||||
@Override
|
||||
protected Integer doInBackground(Void... params) {
|
||||
@@ -113,9 +113,13 @@ public class DeviceProvisioningActivity extends PassphraseRequiredActionBarActiv
|
||||
accountManager.addDevice(ephemeralId, publicKey, identityKeyPair, verificationCode);
|
||||
return SUCCESS;
|
||||
|
||||
|
||||
} catch (NotFoundException e) {
|
||||
Log.w(TAG, e);
|
||||
return NO_DEVICE;
|
||||
} catch (DeviceLimitExceededException e) {
|
||||
Log.w(TAG, e);
|
||||
return LIMIT_EXCEEDED;
|
||||
} catch (IOException e) {
|
||||
Log.w(TAG, e);
|
||||
return NETWORK_ERROR;
|
||||
@@ -144,6 +148,9 @@ public class DeviceProvisioningActivity extends PassphraseRequiredActionBarActiv
|
||||
case KEY_ERROR:
|
||||
Toast.makeText(context, R.string.DeviceProvisioningActivity_content_progress_key_error, Toast.LENGTH_LONG).show();
|
||||
break;
|
||||
case LIMIT_EXCEEDED:
|
||||
Toast.makeText(context, R.string.DeviceProvisioningActivity_sorry_you_have_too_many_devices_registered_already, Toast.LENGTH_LONG).show();
|
||||
break;
|
||||
}
|
||||
dialog.dismiss();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user