mirror of
https://github.com/moparisthebest/open-keychain
synced 2025-02-23 23:12:06 -05:00
prepare superclass extraction for final linked id creation fragment
This commit is contained in:
parent
6e17d5244d
commit
a3ac2738ea
@ -62,7 +62,7 @@ public abstract class LinkedCookieResource extends LinkedResource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static String generate (Context context, byte[] fingerprint, int nonce) {
|
public static String generate (Context context, byte[] fingerprint, int nonce) {
|
||||||
return String.format("\"[Verifying my PGP key: openpgp4fpr:%s#%08x]\"",
|
return String.format("[Verifying my PGP key: openpgp4fpr:%s#%08x]",
|
||||||
KeyFormattingUtils.convertFingerprintToHex(fingerprint), nonce);
|
KeyFormattingUtils.convertFingerprintToHex(fingerprint), nonce);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ public class RawLinkedIdentity {
|
|||||||
// return Hex.toHexString(data);
|
// return Hex.toHexString(data);
|
||||||
|
|
||||||
// debug for now
|
// debug for now
|
||||||
return 1234567;
|
return 0x8a9bad32;
|
||||||
}
|
}
|
||||||
|
|
||||||
public @DrawableRes int getDisplayIcon() {
|
public @DrawableRes int getDisplayIcon() {
|
||||||
|
@ -88,9 +88,9 @@ public class GenericHttpsResource extends LinkedCookieResource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static GenericHttpsResource createNew (URI uri) {
|
public static GenericHttpsResource createNew (URI uri) {
|
||||||
HashSet<String> flags = new HashSet<String>();
|
HashSet<String> flags = new HashSet<>();
|
||||||
flags.add("generic");
|
flags.add("generic");
|
||||||
HashMap<String,String> params = new HashMap<String,String>();
|
HashMap<String,String> params = new HashMap<>();
|
||||||
return create(flags, params, uri);
|
return create(flags, params, uri);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,6 +42,7 @@ import org.sufficientlysecure.keychain.R;
|
|||||||
import org.sufficientlysecure.keychain.operations.results.LinkedVerifyResult;
|
import org.sufficientlysecure.keychain.operations.results.LinkedVerifyResult;
|
||||||
import org.sufficientlysecure.keychain.operations.results.OperationResult;
|
import org.sufficientlysecure.keychain.operations.results.OperationResult;
|
||||||
import org.sufficientlysecure.keychain.pgp.WrappedUserAttribute;
|
import org.sufficientlysecure.keychain.pgp.WrappedUserAttribute;
|
||||||
|
import org.sufficientlysecure.keychain.pgp.linked.LinkedCookieResource;
|
||||||
import org.sufficientlysecure.keychain.pgp.linked.LinkedIdentity;
|
import org.sufficientlysecure.keychain.pgp.linked.LinkedIdentity;
|
||||||
import org.sufficientlysecure.keychain.pgp.linked.RawLinkedIdentity;
|
import org.sufficientlysecure.keychain.pgp.linked.RawLinkedIdentity;
|
||||||
import org.sufficientlysecure.keychain.pgp.linked.resources.GenericHttpsResource;
|
import org.sufficientlysecure.keychain.pgp.linked.resources.GenericHttpsResource;
|
||||||
@ -73,12 +74,12 @@ public class LinkedIdCreateHttpsStep2Fragment extends Fragment {
|
|||||||
View mVerifyProgress;
|
View mVerifyProgress;
|
||||||
TextView mVerifyStatus;
|
TextView mVerifyStatus;
|
||||||
|
|
||||||
String mResourceUri;
|
|
||||||
int mResourceNonce;
|
int mResourceNonce;
|
||||||
|
URI mResourceUri;
|
||||||
String mResourceString;
|
String mResourceString;
|
||||||
|
|
||||||
// This is a resource, set AFTER it has been verified
|
// This is a resource, set AFTER it has been verified
|
||||||
GenericHttpsResource mVerifiedResource = null;
|
LinkedCookieResource mVerifiedResource = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates new instance of this fragment
|
* Creates new instance of this fragment
|
||||||
@ -97,13 +98,15 @@ public class LinkedIdCreateHttpsStep2Fragment extends Fragment {
|
|||||||
return frag;
|
return frag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GenericHttpsResource getResource() {
|
||||||
|
return GenericHttpsResource.createNew(mResourceUri);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
final View view = inflater.inflate(R.layout.linked_create_https_fragment_step2, container, false);
|
final View view = inflater.inflate(R.layout.linked_create_https_fragment_step2, container, false);
|
||||||
|
|
||||||
mResourceUri = getArguments().getString(URI);
|
|
||||||
mResourceNonce = getArguments().getInt(NONCE);
|
mResourceNonce = getArguments().getInt(NONCE);
|
||||||
mResourceString = getArguments().getString(TEXT);
|
|
||||||
|
|
||||||
view.findViewById(R.id.next_button).setOnClickListener(new OnClickListener() {
|
view.findViewById(R.id.next_button).setOnClickListener(new OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
@ -144,8 +147,10 @@ public class LinkedIdCreateHttpsStep2Fragment extends Fragment {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
mResourceString = getArguments().getString(TEXT);
|
||||||
|
|
||||||
mEditUri = (EditText) view.findViewById(R.id.linked_create_https_uri);
|
mEditUri = (EditText) view.findViewById(R.id.linked_create_https_uri);
|
||||||
mEditUri.setText(mResourceUri);
|
mEditUri.setText(mResourceUri.toString());
|
||||||
|
|
||||||
setVerifyProgress(false, null);
|
setVerifyProgress(false, null);
|
||||||
mVerifyStatus.setText(R.string.linked_verify_pending);
|
mVerifyStatus.setText(R.string.linked_verify_pending);
|
||||||
@ -224,8 +229,7 @@ public class LinkedIdCreateHttpsStep2Fragment extends Fragment {
|
|||||||
public void proofVerify() {
|
public void proofVerify() {
|
||||||
setVerifyProgress(true, null);
|
setVerifyProgress(true, null);
|
||||||
|
|
||||||
try {
|
final LinkedCookieResource resource = getResource();
|
||||||
final GenericHttpsResource resource = GenericHttpsResource.createNew(new URI(mResourceUri));
|
|
||||||
|
|
||||||
new AsyncTask<Void,Void,LinkedVerifyResult>() {
|
new AsyncTask<Void,Void,LinkedVerifyResult>() {
|
||||||
|
|
||||||
@ -247,9 +251,6 @@ public class LinkedIdCreateHttpsStep2Fragment extends Fragment {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}.execute();
|
}.execute();
|
||||||
} catch (URISyntaxException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -202,7 +202,14 @@ public class LinkedIdViewFragment extends Fragment {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void verifyResource() {
|
void showButton(int which) {
|
||||||
|
if (mButtonSwitcher.getDisplayedChild() == which) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
mButtonSwitcher.setDisplayedChild(which);
|
||||||
|
}
|
||||||
|
|
||||||
|
void verifyResource() {
|
||||||
|
|
||||||
// only one at a time
|
// only one at a time
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
@ -241,10 +248,10 @@ public class LinkedIdViewFragment extends Fragment {
|
|||||||
protected void onPostExecute(LinkedVerifyResult result) {
|
protected void onPostExecute(LinkedVerifyResult result) {
|
||||||
holder.setShowProgress(false);
|
holder.setShowProgress(false);
|
||||||
if (result.success()) {
|
if (result.success()) {
|
||||||
mButtonSwitcher.setDisplayedChild(2);
|
showButton(2);
|
||||||
holder.vText.setText("Ok");
|
holder.vText.setText("Ok");
|
||||||
} else {
|
} else {
|
||||||
mButtonSwitcher.setDisplayedChild(1);
|
showButton(1);
|
||||||
holder.vText.setText("Error");
|
holder.vText.setText("Error");
|
||||||
}
|
}
|
||||||
mInProgress = false;
|
mInProgress = false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user