2016-11-09 17:37:40 +00:00
|
|
|
package org.thoughtcrime.securesms.util;
|
|
|
|
|
|
|
|
import android.content.Context;
|
|
|
|
import android.content.Intent;
|
2020-08-19 00:06:26 +00:00
|
|
|
import androidx.annotation.NonNull;
|
2016-11-09 17:37:40 +00:00
|
|
|
import android.text.style.ClickableSpan;
|
|
|
|
import android.view.View;
|
|
|
|
|
|
|
|
import org.thoughtcrime.securesms.VerifyIdentityActivity;
|
|
|
|
import org.thoughtcrime.securesms.crypto.IdentityKeyParcelable;
|
2017-07-26 16:59:15 +00:00
|
|
|
import org.thoughtcrime.securesms.database.Address;
|
2016-11-09 17:37:40 +00:00
|
|
|
import org.thoughtcrime.securesms.database.documents.IdentityKeyMismatch;
|
|
|
|
import org.whispersystems.libsignal.IdentityKey;
|
|
|
|
|
|
|
|
public class VerifySpan extends ClickableSpan {
|
|
|
|
|
|
|
|
private final Context context;
|
2017-07-26 16:59:15 +00:00
|
|
|
private final Address address;
|
2016-11-09 17:37:40 +00:00
|
|
|
private final IdentityKey identityKey;
|
|
|
|
|
|
|
|
public VerifySpan(@NonNull Context context, @NonNull IdentityKeyMismatch mismatch) {
|
|
|
|
this.context = context;
|
2017-07-26 16:59:15 +00:00
|
|
|
this.address = mismatch.getAddress();
|
2016-11-09 17:37:40 +00:00
|
|
|
this.identityKey = mismatch.getIdentityKey();
|
|
|
|
}
|
|
|
|
|
2017-07-26 16:59:15 +00:00
|
|
|
public VerifySpan(@NonNull Context context, @NonNull Address address, @NonNull IdentityKey identityKey) {
|
2016-11-09 17:37:40 +00:00
|
|
|
this.context = context;
|
2017-07-26 16:59:15 +00:00
|
|
|
this.address = address;
|
2016-11-09 17:37:40 +00:00
|
|
|
this.identityKey = identityKey;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2019-05-22 16:51:56 +00:00
|
|
|
public void onClick(@NonNull View widget) {
|
2016-11-09 17:37:40 +00:00
|
|
|
Intent intent = new Intent(context, VerifyIdentityActivity.class);
|
2017-07-26 16:59:15 +00:00
|
|
|
intent.putExtra(VerifyIdentityActivity.ADDRESS_EXTRA, address);
|
2017-06-07 01:03:09 +00:00
|
|
|
intent.putExtra(VerifyIdentityActivity.IDENTITY_EXTRA, new IdentityKeyParcelable(identityKey));
|
|
|
|
intent.putExtra(VerifyIdentityActivity.VERIFIED_EXTRA, false);
|
2016-11-09 17:37:40 +00:00
|
|
|
context.startActivity(intent);
|
|
|
|
}
|
|
|
|
}
|