2016-11-09 09:37:40 -08:00
|
|
|
package org.thoughtcrime.securesms.util;
|
|
|
|
|
|
|
|
import android.content.Context;
|
|
|
|
import android.content.Intent;
|
|
|
|
import android.support.annotation.NonNull;
|
|
|
|
import android.text.style.ClickableSpan;
|
|
|
|
import android.view.View;
|
|
|
|
|
|
|
|
import org.thoughtcrime.securesms.VerifyIdentityActivity;
|
|
|
|
import org.thoughtcrime.securesms.crypto.IdentityKeyParcelable;
|
2017-07-26 09:59:15 -07:00
|
|
|
import org.thoughtcrime.securesms.database.Address;
|
2016-11-09 09:37:40 -08: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 09:59:15 -07:00
|
|
|
private final Address address;
|
2016-11-09 09:37:40 -08:00
|
|
|
private final IdentityKey identityKey;
|
|
|
|
|
|
|
|
public VerifySpan(@NonNull Context context, @NonNull IdentityKeyMismatch mismatch) {
|
|
|
|
this.context = context;
|
2017-07-26 09:59:15 -07:00
|
|
|
this.address = mismatch.getAddress();
|
2016-11-09 09:37:40 -08:00
|
|
|
this.identityKey = mismatch.getIdentityKey();
|
|
|
|
}
|
|
|
|
|
2017-07-26 09:59:15 -07:00
|
|
|
public VerifySpan(@NonNull Context context, @NonNull Address address, @NonNull IdentityKey identityKey) {
|
2016-11-09 09:37:40 -08:00
|
|
|
this.context = context;
|
2017-07-26 09:59:15 -07:00
|
|
|
this.address = address;
|
2016-11-09 09:37:40 -08:00
|
|
|
this.identityKey = identityKey;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onClick(View widget) {
|
|
|
|
Intent intent = new Intent(context, VerifyIdentityActivity.class);
|
2017-07-26 09:59:15 -07:00
|
|
|
intent.putExtra(VerifyIdentityActivity.ADDRESS_EXTRA, address);
|
2017-06-06 18:03:09 -07:00
|
|
|
intent.putExtra(VerifyIdentityActivity.IDENTITY_EXTRA, new IdentityKeyParcelable(identityKey));
|
|
|
|
intent.putExtra(VerifyIdentityActivity.VERIFIED_EXTRA, false);
|
2016-11-09 09:37:40 -08:00
|
|
|
context.startActivity(intent);
|
|
|
|
}
|
|
|
|
}
|