if e2e app is disabled, show info

Signed-off-by: tobiaskaminsky <tobias@kaminsky.me>
This commit is contained in:
tobiaskaminsky 2018-03-19 11:45:20 +01:00 committed by tobiasKaminsky
parent c1c0a4b5ae
commit 530b545d2e
No known key found for this signature in database
GPG key ID: 0E00D4D47D0C5AF7
2 changed files with 15 additions and 1 deletions

View file

@ -75,6 +75,8 @@ import com.owncloud.android.lib.resources.files.SearchOperation;
import com.owncloud.android.lib.resources.files.ToggleEncryptionOperation;
import com.owncloud.android.lib.resources.files.ToggleFavoriteOperation;
import com.owncloud.android.lib.resources.shares.GetRemoteSharesOperation;
import com.owncloud.android.lib.resources.status.OCCapability;
import com.owncloud.android.lib.resources.status.OwnCloudVersion;
import com.owncloud.android.ui.activity.FileActivity;
import com.owncloud.android.ui.activity.FileDisplayActivity;
import com.owncloud.android.ui.activity.FolderPickerActivity;
@ -887,11 +889,22 @@ public class OCFileListFragment extends ExtendedListFragment implements OCFileLi
return;
}
Account account = ((FileActivity) mContainerActivity).getAccount();
// check if e2e app is enabled
OCCapability ocCapability = mContainerActivity.getStorageManager().getCapability(account.name);
if (ocCapability.getEndToEndEncryption().isFalse() ||
ocCapability.getEndToEndEncryption().isUnknown()) {
Snackbar.make(mCurrentListView, R.string.end_to_end_encryption_not_enabled,
Snackbar.LENGTH_LONG).show();
return;
}
// check if keys are stored
ArbitraryDataProvider arbitraryDataProvider = new ArbitraryDataProvider(
getContext().getContentResolver());
Account account = ((FileActivity) mContainerActivity).getAccount();
String publicKey = arbitraryDataProvider.getValue(account, EncryptionUtils.PUBLIC_KEY);
String privateKey = arbitraryDataProvider.getValue(account, EncryptionUtils.PRIVATE_KEY);

View file

@ -763,6 +763,7 @@
<string name="end_to_end_encryption_title">Set up encryption</string>
<string name="end_to_end_encryption_passphrase_title">Make note of your 12 word encryption password</string>
<string name="end_to_end_encryption_not_supported">Encryption only works on KitKat(4.4) and beyond.</string>
<string name="end_to_end_encryption_not_enabled">End to end encryption not enabled on server.</string>
<string name="end_to_end_encryption_confirm_button">Set up encryption</string>
<string name="end_to_end_encryption_password">Password&#8230;</string>
<string name="end_to_end_encryption_unsuccessful">Could not save keys, please try again.</string>