Skip to content

Commit

Permalink
Merge pull request nextcloud#11228 from nextcloud/e2eOffline
Browse files Browse the repository at this point in the history
E2E setup is only possible with internet connection
  • Loading branch information
AndyScherzinger authored Jun 8, 2023
2 parents c9efd4e + 3ef9e62 commit 23b9bc9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
import com.nextcloud.client.etm.EtmActivity;
import com.nextcloud.client.logger.ui.LogsActivity;
import com.nextcloud.client.network.ClientFactory;
import com.nextcloud.client.network.ConnectivityService;
import com.nextcloud.client.preferences.AppPreferences;
import com.nextcloud.client.preferences.AppPreferencesImpl;
import com.nextcloud.client.preferences.DarkMode;
Expand Down Expand Up @@ -148,6 +149,7 @@ public class SettingsActivity extends PreferenceActivity
@Inject UserAccountManager accountManager;
@Inject ClientFactory clientFactory;
@Inject ViewThemeUtils viewThemeUtils;
@Inject ConnectivityService connectivityService;


@SuppressWarnings("deprecation")
Expand Down Expand Up @@ -436,10 +438,14 @@ private void setupE2EPreference(PreferenceCategory preferenceCategoryMore) {
preferenceCategoryMore.removePreference(preference);
} else {
preference.setOnPreferenceClickListener(p -> {
Intent i = new Intent(MainApp.getAppContext(), SetupEncryptionActivity.class);
i.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
i.putExtra("EXTRA_USER", user);
startActivityForResult(i, ACTION_E2E);
if (connectivityService.getConnectivity().isConnected()) {
Intent i = new Intent(MainApp.getAppContext(), SetupEncryptionActivity.class);
i.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
i.putExtra("EXTRA_USER", user);
startActivityForResult(i, ACTION_E2E);
} else {
DisplayUtils.showSnackMessage(this, R.string.e2e_offline);
}

return true;
});
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1068,6 +1068,7 @@
<string name="error_showing_encryption_dialog">Error showing encryption setup dialog!</string>
<string name="prefs_keys_exist">Add end-to-end encryption to this client</string>
<string name="add_new_secure_file_drop">Add new secure file drop</string>
<string name="e2e_offline">Not possible without internet connection</string>
<string name="scan_page">Scan page</string>
<string name="done">Done</string>
<string name="document_scan_pdf_generation_in_progress">Generating PDF…</string>
Expand Down

0 comments on commit 23b9bc9

Please sign in to comment.