token-import: change package structure a bit
This commit is contained in:
@@ -38,6 +38,7 @@ import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings;
|
|||||||
import org.sufficientlysecure.keychain.securitytoken.KeyFormat;
|
import org.sufficientlysecure.keychain.securitytoken.KeyFormat;
|
||||||
import org.sufficientlysecure.keychain.ui.base.BaseSecurityTokenActivity;
|
import org.sufficientlysecure.keychain.ui.base.BaseSecurityTokenActivity;
|
||||||
import org.sufficientlysecure.keychain.ui.keyview.ViewKeyActivity;
|
import org.sufficientlysecure.keychain.ui.keyview.ViewKeyActivity;
|
||||||
|
import org.sufficientlysecure.keychain.ui.token.ManageSecurityTokenFragment;
|
||||||
import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils;
|
import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils;
|
||||||
import org.sufficientlysecure.keychain.util.Passphrase;
|
import org.sufficientlysecure.keychain.util.Passphrase;
|
||||||
import org.sufficientlysecure.keychain.util.Preferences;
|
import org.sufficientlysecure.keychain.util.Preferences;
|
||||||
@@ -196,7 +197,7 @@ public class CreateKeyActivity extends BaseSecurityTokenActivity {
|
|||||||
finish();
|
finish();
|
||||||
|
|
||||||
} catch (PgpKeyNotFoundException e) {
|
} catch (PgpKeyNotFoundException e) {
|
||||||
Fragment frag = CreateSecurityTokenImportFragment.newInstance(
|
Fragment frag = ManageSecurityTokenFragment.newInstance(
|
||||||
mScannedFingerprints, mSecurityTokenAid, mSecurityTokenUserId, mSecurityTokenUrl);
|
mScannedFingerprints, mSecurityTokenAid, mSecurityTokenUserId, mSecurityTokenUrl);
|
||||||
loadFragment(frag, FragAction.TO_RIGHT);
|
loadFragment(frag, FragAction.TO_RIGHT);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,74 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2017 Vincent Breitmoser <look@my.amazin.horse>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.sufficientlysecure.keychain.ui.token;
|
||||||
|
|
||||||
|
|
||||||
|
import android.net.Uri;
|
||||||
|
|
||||||
|
import org.sufficientlysecure.keychain.operations.results.OperationResult;
|
||||||
|
import org.sufficientlysecure.keychain.ui.token.ManageSecurityTokenFragment.StatusLine;
|
||||||
|
|
||||||
|
|
||||||
|
class ManageSecurityTokenContract {
|
||||||
|
interface ManageSecurityTokenMvpPresenter {
|
||||||
|
void setView(ManageSecurityTokenMvpView createSecurityTokenImportFragment);
|
||||||
|
void onActivityCreated();
|
||||||
|
|
||||||
|
void onClickRetry();
|
||||||
|
void onClickViewKey();
|
||||||
|
void onClickViewLog();
|
||||||
|
|
||||||
|
void onClickImport();
|
||||||
|
void onImportSuccess(OperationResult result);
|
||||||
|
void onImportError(OperationResult result);
|
||||||
|
|
||||||
|
void onPromoteSuccess(OperationResult result);
|
||||||
|
void onPromoteError(OperationResult result);
|
||||||
|
|
||||||
|
|
||||||
|
void onClickLoadFile();
|
||||||
|
void onFileSelected(Uri fileUri);
|
||||||
|
|
||||||
|
void onClickResetToken();
|
||||||
|
void onClickConfirmReset();
|
||||||
|
void onSecurityTokenResetSuccess();
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ManageSecurityTokenMvpView {
|
||||||
|
void statusLineAdd(StatusLine statusLine);
|
||||||
|
void statusLineOk();
|
||||||
|
void statusLineError();
|
||||||
|
void resetStatusLines();
|
||||||
|
|
||||||
|
void showActionImport();
|
||||||
|
void showActionViewKey();
|
||||||
|
void showActionRetryOrFromFile();
|
||||||
|
void hideAction();
|
||||||
|
|
||||||
|
void operationImportKey(byte[] importKeyData);
|
||||||
|
void operationPromote(long masterKeyId, byte[] cardAid);
|
||||||
|
void operationResetSecurityToken();
|
||||||
|
|
||||||
|
void finishAndShowKey(long masterKeyId);
|
||||||
|
|
||||||
|
void showFileSelectDialog();
|
||||||
|
void showConfirmResetDialog();
|
||||||
|
|
||||||
|
void showDisplayLogActivity(OperationResult result);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.sufficientlysecure.keychain.ui;
|
package org.sufficientlysecure.keychain.ui.token;
|
||||||
|
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
@@ -47,10 +47,15 @@ import org.sufficientlysecure.keychain.service.ImportKeyringParcel;
|
|||||||
import org.sufficientlysecure.keychain.service.PromoteKeyringParcel;
|
import org.sufficientlysecure.keychain.service.PromoteKeyringParcel;
|
||||||
import org.sufficientlysecure.keychain.service.input.CryptoInputParcel;
|
import org.sufficientlysecure.keychain.service.input.CryptoInputParcel;
|
||||||
import org.sufficientlysecure.keychain.service.input.RequiredInputParcel;
|
import org.sufficientlysecure.keychain.service.input.RequiredInputParcel;
|
||||||
import org.sufficientlysecure.keychain.ui.CreateSecurityTokenImportPresenter.CreateSecurityTokenImportMvpView;
|
import org.sufficientlysecure.keychain.ui.CreateKeyActivity;
|
||||||
|
import org.sufficientlysecure.keychain.ui.LogDisplayActivity;
|
||||||
|
import org.sufficientlysecure.keychain.ui.LogDisplayFragment;
|
||||||
|
import org.sufficientlysecure.keychain.ui.SecurityTokenOperationActivity;
|
||||||
import org.sufficientlysecure.keychain.ui.base.CryptoOperationHelper;
|
import org.sufficientlysecure.keychain.ui.base.CryptoOperationHelper;
|
||||||
import org.sufficientlysecure.keychain.ui.base.CryptoOperationHelper.AbstractCallback;
|
import org.sufficientlysecure.keychain.ui.base.CryptoOperationHelper.AbstractCallback;
|
||||||
import org.sufficientlysecure.keychain.ui.keyview.ViewKeyActivity;
|
import org.sufficientlysecure.keychain.ui.keyview.ViewKeyActivity;
|
||||||
|
import org.sufficientlysecure.keychain.ui.token.ManageSecurityTokenContract.ManageSecurityTokenMvpPresenter;
|
||||||
|
import org.sufficientlysecure.keychain.ui.token.ManageSecurityTokenContract.ManageSecurityTokenMvpView;
|
||||||
import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils;
|
import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils;
|
||||||
import org.sufficientlysecure.keychain.ui.util.ThemeChanger;
|
import org.sufficientlysecure.keychain.ui.util.ThemeChanger;
|
||||||
import org.sufficientlysecure.keychain.ui.widget.StatusIndicator;
|
import org.sufficientlysecure.keychain.ui.widget.StatusIndicator;
|
||||||
@@ -59,7 +64,7 @@ import org.sufficientlysecure.keychain.ui.widget.ToolableViewAnimator;
|
|||||||
import org.sufficientlysecure.keychain.util.FileHelper;
|
import org.sufficientlysecure.keychain.util.FileHelper;
|
||||||
|
|
||||||
|
|
||||||
public class CreateSecurityTokenImportFragment extends Fragment implements CreateSecurityTokenImportMvpView,
|
public class ManageSecurityTokenFragment extends Fragment implements ManageSecurityTokenMvpView,
|
||||||
OnClickListener {
|
OnClickListener {
|
||||||
private static final String ARG_FINGERPRINTS = "fingerprint";
|
private static final String ARG_FINGERPRINTS = "fingerprint";
|
||||||
private static final String ARG_AID = "aid";
|
private static final String ARG_AID = "aid";
|
||||||
@@ -68,7 +73,7 @@ public class CreateSecurityTokenImportFragment extends Fragment implements Creat
|
|||||||
public static final int REQUEST_CODE_OPEN_FILE = 0;
|
public static final int REQUEST_CODE_OPEN_FILE = 0;
|
||||||
public static final int REQUEST_CODE_RESET = 1;
|
public static final int REQUEST_CODE_RESET = 1;
|
||||||
|
|
||||||
CreateSecurityTokenImportPresenter presenter;
|
ManageSecurityTokenMvpPresenter presenter;
|
||||||
private ViewGroup statusLayoutGroup;
|
private ViewGroup statusLayoutGroup;
|
||||||
private ToolableViewAnimator actionAnimator;
|
private ToolableViewAnimator actionAnimator;
|
||||||
|
|
||||||
@@ -84,7 +89,7 @@ public class CreateSecurityTokenImportFragment extends Fragment implements Creat
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static Fragment newInstance(byte[] scannedFingerprints, byte[] nfcAid, String userId, String tokenUrl) {
|
public static Fragment newInstance(byte[] scannedFingerprints, byte[] nfcAid, String userId, String tokenUrl) {
|
||||||
CreateSecurityTokenImportFragment frag = new CreateSecurityTokenImportFragment();
|
ManageSecurityTokenFragment frag = new ManageSecurityTokenFragment();
|
||||||
|
|
||||||
Bundle args = new Bundle();
|
Bundle args = new Bundle();
|
||||||
args.putByteArray(ARG_FINGERPRINTS, scannedFingerprints);
|
args.putByteArray(ARG_FINGERPRINTS, scannedFingerprints);
|
||||||
@@ -107,7 +112,7 @@ public class CreateSecurityTokenImportFragment extends Fragment implements Creat
|
|||||||
String tokenUserId = args.getString(ARG_USER_ID);
|
String tokenUserId = args.getString(ARG_USER_ID);
|
||||||
String tokenUrl = args.getString(ARG_URL);
|
String tokenUrl = args.getString(ARG_URL);
|
||||||
|
|
||||||
presenter = new CreateSecurityTokenImportPresenter(
|
presenter = new ManageSecurityTokenPresenter(
|
||||||
getContext(), tokenFingerprints, tokenAid, tokenUserId, tokenUrl, getLoaderManager());
|
getContext(), tokenFingerprints, tokenAid, tokenUserId, tokenUrl, getLoaderManager());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.sufficientlysecure.keychain.ui;
|
package org.sufficientlysecure.keychain.ui.token;
|
||||||
|
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@@ -28,31 +28,35 @@ import android.support.v4.content.Loader;
|
|||||||
import org.sufficientlysecure.keychain.operations.results.GenericOperationResult;
|
import org.sufficientlysecure.keychain.operations.results.GenericOperationResult;
|
||||||
import org.sufficientlysecure.keychain.operations.results.OperationResult;
|
import org.sufficientlysecure.keychain.operations.results.OperationResult;
|
||||||
import org.sufficientlysecure.keychain.operations.results.OperationResult.OperationLog;
|
import org.sufficientlysecure.keychain.operations.results.OperationResult.OperationLog;
|
||||||
import org.sufficientlysecure.keychain.ui.CreateSecurityTokenImportFragment.StatusLine;
|
import org.sufficientlysecure.keychain.ui.token.ManageSecurityTokenContract.ManageSecurityTokenMvpPresenter;
|
||||||
import org.sufficientlysecure.keychain.ui.PublicKeyRetrievalLoader.ContentUriRetrievalLoader;
|
import org.sufficientlysecure.keychain.ui.token.ManageSecurityTokenContract.ManageSecurityTokenMvpView;
|
||||||
import org.sufficientlysecure.keychain.ui.PublicKeyRetrievalLoader.KeyRetrievalResult;
|
import org.sufficientlysecure.keychain.ui.token.ManageSecurityTokenFragment.StatusLine;
|
||||||
import org.sufficientlysecure.keychain.ui.PublicKeyRetrievalLoader.KeyserverRetrievalLoader;
|
import org.sufficientlysecure.keychain.ui.token.PublicKeyRetrievalLoader.ContentUriRetrievalLoader;
|
||||||
import org.sufficientlysecure.keychain.ui.PublicKeyRetrievalLoader.LocalKeyLookupLoader;
|
import org.sufficientlysecure.keychain.ui.token.PublicKeyRetrievalLoader.KeyRetrievalResult;
|
||||||
import org.sufficientlysecure.keychain.ui.PublicKeyRetrievalLoader.UriKeyRetrievalLoader;
|
import org.sufficientlysecure.keychain.ui.token.PublicKeyRetrievalLoader.KeyserverRetrievalLoader;
|
||||||
|
import org.sufficientlysecure.keychain.ui.token.PublicKeyRetrievalLoader.LocalKeyLookupLoader;
|
||||||
|
import org.sufficientlysecure.keychain.ui.token.PublicKeyRetrievalLoader.UriKeyRetrievalLoader;
|
||||||
|
|
||||||
|
|
||||||
class CreateSecurityTokenImportPresenter {
|
class ManageSecurityTokenPresenter implements ManageSecurityTokenMvpPresenter {
|
||||||
private static final int LOADER_LOCAL = 0;
|
private static final int LOADER_LOCAL = 0;
|
||||||
private static final int LOADER_URI = 1;
|
private static final int LOADER_URI = 1;
|
||||||
private static final int LOADER_KEYSERVER = 2;
|
private static final int LOADER_KEYSERVER = 2;
|
||||||
private static final int LOADER_CONTENT_URI = 3;
|
private static final int LOADER_CONTENT_URI = 3;
|
||||||
private static final String ARG_CONTENT_URI = "content_uri";
|
private static final String ARG_CONTENT_URI = "content_uri";
|
||||||
|
|
||||||
private Context context;
|
|
||||||
|
|
||||||
private byte[][] tokenFingerprints;
|
private final Context context;
|
||||||
private byte[] tokenAid;
|
private final LoaderManager loaderManager;
|
||||||
private double tokenVersion;
|
|
||||||
private String tokenUserId;
|
private final byte[][] tokenFingerprints;
|
||||||
|
private final byte[] tokenAid;
|
||||||
|
private final String tokenUserId;
|
||||||
private final String tokenUrl;
|
private final String tokenUrl;
|
||||||
|
|
||||||
private LoaderManager loaderManager;
|
|
||||||
private CreateSecurityTokenImportMvpView view;
|
private ManageSecurityTokenMvpView view;
|
||||||
|
|
||||||
private boolean searchedLocally;
|
private boolean searchedLocally;
|
||||||
private boolean searchedAtUri;
|
private boolean searchedAtUri;
|
||||||
private boolean searchedKeyservers;
|
private boolean searchedKeyservers;
|
||||||
@@ -62,7 +66,7 @@ class CreateSecurityTokenImportPresenter {
|
|||||||
|
|
||||||
private OperationLog log;
|
private OperationLog log;
|
||||||
|
|
||||||
CreateSecurityTokenImportPresenter(Context context, byte[] tokenFingerprints, byte[] tokenAid,
|
ManageSecurityTokenPresenter(Context context, byte[] tokenFingerprints, byte[] tokenAid,
|
||||||
String tokenUserId, String tokenUrl, LoaderManager loaderManager) {
|
String tokenUserId, String tokenUrl, LoaderManager loaderManager) {
|
||||||
this.context = context.getApplicationContext();
|
this.context = context.getApplicationContext();
|
||||||
|
|
||||||
@@ -83,10 +87,12 @@ class CreateSecurityTokenImportPresenter {
|
|||||||
this.log = new OperationLog();
|
this.log = new OperationLog();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setView(CreateSecurityTokenImportMvpView view) {
|
@Override
|
||||||
|
public void setView(ManageSecurityTokenMvpView view) {
|
||||||
this.view = view;
|
this.view = view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void onActivityCreated() {
|
public void onActivityCreated() {
|
||||||
continueSearch();
|
continueSearch();
|
||||||
}
|
}
|
||||||
@@ -196,13 +202,15 @@ class CreateSecurityTokenImportPresenter {
|
|||||||
throw new IllegalArgumentException("Method can only be called with successful result!");
|
throw new IllegalArgumentException("Method can only be called with successful result!");
|
||||||
}
|
}
|
||||||
|
|
||||||
void onClickImport() {
|
@Override
|
||||||
|
public void onClickImport() {
|
||||||
view.statusLineAdd(StatusLine.IMPORT);
|
view.statusLineAdd(StatusLine.IMPORT);
|
||||||
view.hideAction();
|
view.hideAction();
|
||||||
view.operationImportKey(importKeyData);
|
view.operationImportKey(importKeyData);
|
||||||
}
|
}
|
||||||
|
|
||||||
void onImportSuccess(OperationResult result) {
|
@Override
|
||||||
|
public void onImportSuccess(OperationResult result) {
|
||||||
log.add(result, 0);
|
log.add(result, 0);
|
||||||
|
|
||||||
view.statusLineOk();
|
view.statusLineOk();
|
||||||
@@ -210,26 +218,30 @@ class CreateSecurityTokenImportPresenter {
|
|||||||
view.operationPromote(masterKeyId, tokenAid);
|
view.operationPromote(masterKeyId, tokenAid);
|
||||||
}
|
}
|
||||||
|
|
||||||
void onImportError(OperationResult result) {
|
@Override
|
||||||
|
public void onImportError(OperationResult result) {
|
||||||
log.add(result, 0);
|
log.add(result, 0);
|
||||||
|
|
||||||
view.statusLineError();
|
view.statusLineError();
|
||||||
}
|
}
|
||||||
|
|
||||||
void onPromoteSuccess(OperationResult result) {
|
@Override
|
||||||
|
public void onPromoteSuccess(OperationResult result) {
|
||||||
log.add(result, 0);
|
log.add(result, 0);
|
||||||
|
|
||||||
view.statusLineOk();
|
view.statusLineOk();
|
||||||
view.showActionViewKey();
|
view.showActionViewKey();
|
||||||
}
|
}
|
||||||
|
|
||||||
void onPromoteError(OperationResult result) {
|
@Override
|
||||||
|
public void onPromoteError(OperationResult result) {
|
||||||
log.add(result, 0);
|
log.add(result, 0);
|
||||||
|
|
||||||
view.statusLineError();
|
view.statusLineError();
|
||||||
}
|
}
|
||||||
|
|
||||||
void onClickRetry() {
|
@Override
|
||||||
|
public void onClickRetry() {
|
||||||
searchedLocally = false;
|
searchedLocally = false;
|
||||||
searchedAtUri = false;
|
searchedAtUri = false;
|
||||||
searchedKeyservers = false;
|
searchedKeyservers = false;
|
||||||
@@ -239,27 +251,33 @@ class CreateSecurityTokenImportPresenter {
|
|||||||
continueSearch();
|
continueSearch();
|
||||||
}
|
}
|
||||||
|
|
||||||
void onClickViewKey() {
|
@Override
|
||||||
|
public void onClickViewKey() {
|
||||||
view.finishAndShowKey(masterKeyId);
|
view.finishAndShowKey(masterKeyId);
|
||||||
}
|
}
|
||||||
|
|
||||||
void onClickResetToken() {
|
@Override
|
||||||
|
public void onClickResetToken() {
|
||||||
view.showConfirmResetDialog();
|
view.showConfirmResetDialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
void onClickConfirmReset() {
|
@Override
|
||||||
|
public void onClickConfirmReset() {
|
||||||
view.operationResetSecurityToken();
|
view.operationResetSecurityToken();
|
||||||
}
|
}
|
||||||
|
|
||||||
void onSecurityTokenResetSuccess() {
|
@Override
|
||||||
|
public void onSecurityTokenResetSuccess() {
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
void onClickLoadFile() {
|
@Override
|
||||||
|
public void onClickLoadFile() {
|
||||||
view.showFileSelectDialog();
|
view.showFileSelectDialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
void onFileSelected(Uri contentUri) {
|
@Override
|
||||||
|
public void onFileSelected(Uri contentUri) {
|
||||||
view.resetStatusLines();
|
view.resetStatusLines();
|
||||||
view.statusLineAdd(StatusLine.SEARCH_CONTENT_URI);
|
view.statusLineAdd(StatusLine.SEARCH_CONTENT_URI);
|
||||||
|
|
||||||
@@ -268,31 +286,9 @@ class CreateSecurityTokenImportPresenter {
|
|||||||
loaderManager.restartLoader(LOADER_CONTENT_URI, args, loaderCallbacks);
|
loaderManager.restartLoader(LOADER_CONTENT_URI, args, loaderCallbacks);
|
||||||
}
|
}
|
||||||
|
|
||||||
void onClickViewLog() {
|
@Override
|
||||||
|
public void onClickViewLog() {
|
||||||
OperationResult result = new GenericOperationResult(GenericOperationResult.RESULT_OK, log);
|
OperationResult result = new GenericOperationResult(GenericOperationResult.RESULT_OK, log);
|
||||||
view.showDisplayLogActivity(result);
|
view.showDisplayLogActivity(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
interface CreateSecurityTokenImportMvpView {
|
|
||||||
void statusLineAdd(StatusLine statusLine);
|
|
||||||
void statusLineOk();
|
|
||||||
void statusLineError();
|
|
||||||
void resetStatusLines();
|
|
||||||
|
|
||||||
void showActionImport();
|
|
||||||
void showActionViewKey();
|
|
||||||
void showActionRetryOrFromFile();
|
|
||||||
void hideAction();
|
|
||||||
|
|
||||||
void operationImportKey(byte[] importKeyData);
|
|
||||||
void operationPromote(long masterKeyId, byte[] cardAid);
|
|
||||||
void operationResetSecurityToken();
|
|
||||||
|
|
||||||
void finishAndShowKey(long masterKeyId);
|
|
||||||
|
|
||||||
void showFileSelectDialog();
|
|
||||||
void showConfirmResetDialog();
|
|
||||||
|
|
||||||
void showDisplayLogActivity(OperationResult result);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.sufficientlysecure.keychain.ui;
|
package org.sufficientlysecure.keychain.ui.token;
|
||||||
|
|
||||||
|
|
||||||
import java.io.BufferedInputStream;
|
import java.io.BufferedInputStream;
|
||||||
@@ -52,7 +52,7 @@ import org.sufficientlysecure.keychain.pgp.exception.PgpKeyNotFoundException;
|
|||||||
import org.sufficientlysecure.keychain.provider.CachedPublicKeyRing;
|
import org.sufficientlysecure.keychain.provider.CachedPublicKeyRing;
|
||||||
import org.sufficientlysecure.keychain.provider.KeyRepository;
|
import org.sufficientlysecure.keychain.provider.KeyRepository;
|
||||||
import org.sufficientlysecure.keychain.provider.KeyRepository.NotFoundException;
|
import org.sufficientlysecure.keychain.provider.KeyRepository.NotFoundException;
|
||||||
import org.sufficientlysecure.keychain.ui.PublicKeyRetrievalLoader.KeyRetrievalResult;
|
import org.sufficientlysecure.keychain.ui.token.PublicKeyRetrievalLoader.KeyRetrievalResult;
|
||||||
import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils;
|
import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils;
|
||||||
import org.sufficientlysecure.keychain.util.ParcelableProxy;
|
import org.sufficientlysecure.keychain.util.ParcelableProxy;
|
||||||
import org.sufficientlysecure.keychain.util.Preferences;
|
import org.sufficientlysecure.keychain.util.Preferences;
|
||||||
@@ -65,7 +65,7 @@ public abstract class PublicKeyRetrievalLoader extends AsyncTaskLoader<KeyRetrie
|
|||||||
private KeyRetrievalResult cachedResult;
|
private KeyRetrievalResult cachedResult;
|
||||||
|
|
||||||
|
|
||||||
public PublicKeyRetrievalLoader(Context context) {
|
private PublicKeyRetrievalLoader(Context context) {
|
||||||
super(context);
|
super(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -87,11 +87,11 @@ public abstract class PublicKeyRetrievalLoader extends AsyncTaskLoader<KeyRetrie
|
|||||||
return keyRetrievalResult;
|
return keyRetrievalResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class LocalKeyLookupLoader extends PublicKeyRetrievalLoader {
|
static class LocalKeyLookupLoader extends PublicKeyRetrievalLoader {
|
||||||
private final KeyRepository keyRepository;
|
private final KeyRepository keyRepository;
|
||||||
private final byte[][] fingerprints;
|
private final byte[][] fingerprints;
|
||||||
|
|
||||||
public LocalKeyLookupLoader(Context context, byte[][] fingerprints) {
|
LocalKeyLookupLoader(Context context, byte[][] fingerprints) {
|
||||||
super(context);
|
super(context);
|
||||||
|
|
||||||
this.fingerprints = fingerprints;
|
this.fingerprints = fingerprints;
|
||||||
@@ -142,11 +142,11 @@ public abstract class PublicKeyRetrievalLoader extends AsyncTaskLoader<KeyRetrie
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class UriKeyRetrievalLoader extends PublicKeyRetrievalLoader {
|
static class UriKeyRetrievalLoader extends PublicKeyRetrievalLoader {
|
||||||
byte[][] fingerprints;
|
private final byte[][] fingerprints;
|
||||||
String tokenUri;
|
private final String tokenUri;
|
||||||
|
|
||||||
public UriKeyRetrievalLoader(Context context, String tokenUri, byte[][] fingerprints) {
|
UriKeyRetrievalLoader(Context context, String tokenUri, byte[][] fingerprints) {
|
||||||
super(context);
|
super(context);
|
||||||
|
|
||||||
this.tokenUri = tokenUri;
|
this.tokenUri = tokenUri;
|
||||||
@@ -199,10 +199,10 @@ public abstract class PublicKeyRetrievalLoader extends AsyncTaskLoader<KeyRetrie
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class KeyserverRetrievalLoader extends PublicKeyRetrievalLoader {
|
static class KeyserverRetrievalLoader extends PublicKeyRetrievalLoader {
|
||||||
byte[] fingerprint;
|
private final byte[] fingerprint;
|
||||||
|
|
||||||
public KeyserverRetrievalLoader(Context context, byte[] fingerprint) {
|
KeyserverRetrievalLoader(Context context, byte[] fingerprint) {
|
||||||
super(context);
|
super(context);
|
||||||
|
|
||||||
this.fingerprint = fingerprint;
|
this.fingerprint = fingerprint;
|
||||||
@@ -244,12 +244,12 @@ public abstract class PublicKeyRetrievalLoader extends AsyncTaskLoader<KeyRetrie
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class ContentUriRetrievalLoader extends PublicKeyRetrievalLoader {
|
static class ContentUriRetrievalLoader extends PublicKeyRetrievalLoader {
|
||||||
private final ContentResolver contentResolver;
|
private final ContentResolver contentResolver;
|
||||||
private final byte[] fingerprint;
|
private final byte[] fingerprint;
|
||||||
private final Uri uri;
|
private final Uri uri;
|
||||||
|
|
||||||
public ContentUriRetrievalLoader(Context context, byte[] fingerprint, Uri uri) {
|
ContentUriRetrievalLoader(Context context, byte[] fingerprint, Uri uri) {
|
||||||
super(context);
|
super(context);
|
||||||
|
|
||||||
this.fingerprint = fingerprint;
|
this.fingerprint = fingerprint;
|
||||||
Reference in New Issue
Block a user