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