From 04de5cab62a77c18d51532aafe3eafdc0f36265d Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Tue, 13 Feb 2018 10:56:13 +0100 Subject: [PATCH] delete public key if storage of private key did not worked --- .../android/ui/dialog/SetupEncryptionDialogFragment.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/owncloud/android/ui/dialog/SetupEncryptionDialogFragment.java b/src/main/java/com/owncloud/android/ui/dialog/SetupEncryptionDialogFragment.java index 7589782438..0f2a210098 100644 --- a/src/main/java/com/owncloud/android/ui/dialog/SetupEncryptionDialogFragment.java +++ b/src/main/java/com/owncloud/android/ui/dialog/SetupEncryptionDialogFragment.java @@ -41,6 +41,7 @@ import com.owncloud.android.datamodel.ArbitraryDataProvider; import com.owncloud.android.lib.common.UserInfo; import com.owncloud.android.lib.common.operations.RemoteOperationResult; import com.owncloud.android.lib.common.utils.Log_OC; +import com.owncloud.android.lib.resources.users.DeletePublicKeyOperation; import com.owncloud.android.lib.resources.users.GetPrivateKeyOperation; import com.owncloud.android.lib.resources.users.GetPublicKeyOperation; import com.owncloud.android.lib.resources.users.GetRemoteUserInfoOperation; @@ -346,8 +347,7 @@ public class SetupEncryptionDialogFragment extends DialogFragment { // get user id String userID; - GetRemoteUserInfoOperation remoteUserNameOperation = - new GetRemoteUserInfoOperation(); + GetRemoteUserInfoOperation remoteUserNameOperation = new GetRemoteUserInfoOperation(); RemoteOperationResult remoteUserNameOperationResult = remoteUserNameOperation .execute(account, getContext(), true); @@ -398,8 +398,10 @@ public class SetupEncryptionDialogFragment extends DialogFragment { keyResult = KEY_CREATED; return (String) storePrivateKeyResult.getData().get(0); + } else { + DeletePublicKeyOperation deletePublicKeyOperation = new DeletePublicKeyOperation(); + deletePublicKeyOperation.execute(account, getContext(), true); } - } catch (Exception e) { Log_OC.e(TAG, e.getMessage()); }