Skip to content

Commit

Permalink
Added delete account menu under settings.
Browse files Browse the repository at this point in the history
NMC-3041
  • Loading branch information
surinder-tsys committed Nov 25, 2024
1 parent 36f791c commit 9f550ef
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ public void onCreate(Bundle savedInstanceState) {

// About
// Not required in NMC
//setupAboutCategory(appVersion);
// setupAboutCategory(appVersion);

// Data Privacy
setupDataPrivacyCategory(titleColor);
Expand Down Expand Up @@ -364,9 +364,10 @@ public void onBackPressed() {

private void setupSyncCategory(int titleColor) {
final PreferenceCategory preferenceCategorySync = (PreferenceCategory) findPreference("sync");

preferenceCategorySync.setTitle(StringUtils.getColorSpan(getString(R.string.prefs_category_sync),
titleColor));
setupAutoUploadPreference(preferenceCategorySync, titleColor);
setupInternalTwoWaySyncPreference(titleColor);
// setupInternalTwoWaySyncPreference(titleColor);
}

/**
Expand Down Expand Up @@ -413,7 +414,6 @@ private void setupDataPrivacyCategory(int titleColor) {
getResources().getString(R.string.privacy_policy));
intent.putExtra(ExternalSiteWebView.EXTRA_URL, privacyUrl.toString());
intent.putExtra(ExternalSiteWebView.EXTRA_SHOW_SIDEBAR, false);
intent.putExtra(ExternalSiteWebView.EXTRA_MENU_ITEM_ID, -1);
}

startActivity(intent);
Expand All @@ -440,7 +440,6 @@ private void setupDataPrivacyCategory(int titleColor) {
getResources().getString(R.string.prefs_open_source));
intent.putExtra(ExternalSiteWebView.EXTRA_URL, getResources().getString(R.string.sourcecode_url));
intent.putExtra(ExternalSiteWebView.EXTRA_SHOW_SIDEBAR, false);
intent.putExtra(ExternalSiteWebView.EXTRA_MENU_ITEM_ID, -1);
startActivity(intent);
return true;
});
Expand All @@ -461,7 +460,7 @@ private void setupMoreCategory(int titleColor) {
preferenceCategoryMore.setTitle(StringUtils.getColorSpan(getString(R.string.prefs_category_more),
titleColor));

setupCalendarPreference(preferenceCategoryMore);
setupCalendarPreference(preferenceCategoryMore);

setupBackupPreference(titleColor);

Expand Down Expand Up @@ -659,7 +658,7 @@ private void setupAutoUploadPreference(PreferenceCategory preferenceCategoryMore

private void setupInternalTwoWaySyncPreference(int titleColor) {
Preference twoWaySync = findPreference("internal_two_way_sync");
twoWaySync.setTitle(StringUtils.getColorSpan(getString(R.string.drawer_synced_folders),
twoWaySync.setTitle(StringUtils.getColorSpan(getString(R.string.internal_two_way_sync),
titleColor));

twoWaySync.setOnPreferenceClickListener(preference -> {
Expand All @@ -673,7 +672,7 @@ private void setupBackupPreference(int titleColor) {
Preference pContactsBackup = findPreference("backup");
if (pContactsBackup != null) {
boolean showCalendarBackup = getResources().getBoolean(R.bool.show_calendar_backup);
//NMC Customization
// NMC Customization
pContactsBackup.setTitle(StringUtils.getColorSpan(getString(R.string.actionbar_contacts), titleColor));
pContactsBackup.setSummary(showCalendarBackup
? getString(R.string.prefs_daily_backup_summary)
Expand Down Expand Up @@ -737,7 +736,7 @@ private void setupDetailsCategory(int titleColor, PreferenceScreen preferenceScr
private void setupShowMediaScanNotifications(PreferenceCategory preferenceCategoryDetails,
boolean fShowMediaScanNotifications, int titleColor) {
SwitchPreference mShowMediaScanNotifications = (SwitchPreference) findPreference(PREFERENCE_SHOW_MEDIA_SCAN_NOTIFICATIONS);
mShowMediaScanNotifications.setTitle(StringUtils.getColorSpan(getString(R.string.prefs_storage_path),
mShowMediaScanNotifications.setTitle(StringUtils.getColorSpan(getString(R.string.prefs_enable_media_scan_notifications),
titleColor));
if (fShowMediaScanNotifications) {
preferenceCategoryDetails.removePreference(mShowMediaScanNotifications);
Expand Down Expand Up @@ -835,7 +834,7 @@ private void setupLockPreference(PreferenceCategory preferenceCategoryDetails,
}

private void setupAutoUploadCategory(int titleColor, PreferenceScreen preferenceScreen) {
PreferenceCategory preferenceCategorySyncedFolders =
final PreferenceCategory preferenceCategorySyncedFolders =
(PreferenceCategory) findPreference("synced_folders_category");
preferenceCategorySyncedFolders.setTitle(StringUtils.getColorSpan(getString(R.string.drawer_synced_folders),
titleColor));
Expand Down Expand Up @@ -879,6 +878,7 @@ private void setUpServiceCategory(int titleColor) {
preferenceCategoryService.setTitle(StringUtils.getColorSpan(getString(R.string.prefs_category_service),
titleColor));
setupHelpPreference(titleColor);
setupDeleteAccountPreference(titleColor);
setupImprintPreference(titleColor);
}

Expand All @@ -898,6 +898,22 @@ private void setupHelpPreference(int titleColor) {
}
}

private void setupDeleteAccountPreference(int titleColor) {
Preference pHelp = findPreference("delete_account");
if (pHelp != null) {
pHelp.setTitle(StringUtils.getColorSpan(getString(R.string.prefs_delete_account),
titleColor));
pHelp.setOnPreferenceClickListener(preference -> {
String helpWeb = getString(R.string.url_delete_account);
if (!helpWeb.isEmpty()) {
openLinkInWebView(helpWeb, R.string.prefs_delete_account);
}
return true;
});

}
}

private void setupImprintPreference(int titleColor) {
Preference pImprint = findPreference("imprint");
if (pImprint != null) {
Expand All @@ -921,7 +937,6 @@ private void openLinkInWebView(String url, @StringRes int title) {
getResources().getString(title));
externalWebViewIntent.putExtra(ExternalSiteWebView.EXTRA_URL, url);
externalWebViewIntent.putExtra(ExternalSiteWebView.EXTRA_SHOW_SIDEBAR, false);
externalWebViewIntent.putExtra(ExternalSiteWebView.EXTRA_MENU_ITEM_ID, -1);
startActivity(externalWebViewIntent);
}

Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1016,6 +1016,7 @@
<string name="prefs_category_data_privacy">Datenschutz</string>
<string name="privacy_settings">Datenschutz</string>
<string name="privacy_policy">Datenschutzbestimmungen</string>
<string name="prefs_delete_account">Konto endgültig löschen</string>
<string name="prefs_open_source">Verwendete OpenSource Software</string>
<string name="prefs_category_info">Info</string>
<string name="prefs_category_service">Bedienung</string>
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/setup.xml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@
<string name="url_imprint"></string>
<string name="url_app_download">"https://play.google.com/store/apps/details?id=com.nextcloud.client"</string>
<string name="url_server_install">https://nextcloud.com/install</string>
<string name="url_delete_account">https://www.telekom.de/hilfe/vertrag-rechnung/login-daten-passwoerter/telekom-login-loeschen</string>
<!-- using different key as existing url_imprint will be duplicated during the merge process
because url_app_download will be changed in branding -->
<string name="url_imprint_nmc">https://www.telekom.de/impressum</string>
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 @@ -1220,6 +1220,7 @@
<string name="prefs_category_data_privacy">Data Privacy</string>
<string name="privacy_settings">Privacy Settings</string>
<string name="privacy_policy">Privacy Policy</string>
<string name="prefs_delete_account">Delete account permanently</string>
<string name="prefs_open_source">Used OpenSource Software</string>
<string name="prefs_category_service">Service</string>
<string name="document_scan_pdf_generation_in_progress">Generating PDF…</string>
Expand Down
46 changes: 23 additions & 23 deletions app/src/main/res/xml/preferences.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
<?xml version="1.0" encoding="utf-8"?><!--
~ Nextcloud - Android Client
~
~ SPDX-FileCopyrightText: 2017-2022 Tobias Kaminsky <[email protected]>
Expand Down Expand Up @@ -27,14 +26,11 @@
<com.owncloud.android.ui.PreferenceCustomCategory
android:key="general"
android:title="@string/prefs_category_general">
<ListPreference
android:key="storage_path"
<Preference
android:key="data_storage_location"
android:layout="@layout/custom_preference_layout"
android:title="@string/prefs_storage_path" />
<!-- <ListPreference
android:title="@string/prefs_theme_title"
android:key="darkMode"
android:summary="%s" />-->
android:summary="@string/prefs_data_storage_location_summary"
android:title="@string/prefs_data_storage_location" />
</com.owncloud.android.ui.PreferenceCustomCategory>

<com.owncloud.android.ui.PreferenceCustomCategory
Expand All @@ -54,7 +50,7 @@
<com.owncloud.android.ui.PreferenceCustomCategory
android:key="details"
android:title="@string/prefs_category_details">
<ListPreference
<com.owncloud.android.ui.ListPreferenceDialog
android:defaultValue="none"
android:dialogTitle="@string/prefs_lock_title"
android:key="lock"
Expand All @@ -66,10 +62,10 @@
android:title="@string/prefs_show_hidden_files" />
<com.owncloud.android.ui.ThemeableSwitchPreference
android:defaultValue="true"
android:title="@string/prefs_show_ecosystem_apps"
android:key="show_ecosystem_apps"
android:layout="@layout/custom_preference_layout"
android:summary="@string/prefs_show_ecosystem_apps_summary"/>
android:summary="@string/prefs_show_ecosystem_apps_summary"
android:title="@string/prefs_show_ecosystem_apps" />
<com.owncloud.android.ui.ThemeableSwitchPreference
android:key="show_media_scan_notifications"
android:layout="@layout/custom_preference_layout"
Expand All @@ -78,24 +74,24 @@
</com.owncloud.android.ui.PreferenceCustomCategory>

<com.owncloud.android.ui.PreferenceCustomCategory
android:title="@string/prefs_category_sync"
android:key="sync">
android:key="sync"
android:title="@string/prefs_category_sync">
<Preference
android:title="@string/drawer_synced_folders"
android:key="syncedFolders"
android:layout="@layout/custom_preference_layout"
android:summary="@string/prefs_sycned_folders_summary" />
android:summary="@string/prefs_sycned_folders_summary"
android:title="@string/drawer_synced_folders" />

<Preference
android:title="@string/internal_two_way_sync"
android:key="internal_two_way_sync"
android:layout="@layout/custom_preference_layout"
android:summary="@string/prefs_two_way_sync_summary" />
<!-- <Preference
android:title="@string/internal_two_way_sync"
android:key="internal_two_way_sync"
android:layout="@layout/custom_preference_layout"
android:summary="@string/prefs_two_way_sync_summary" />-->
</com.owncloud.android.ui.PreferenceCustomCategory>

<com.owncloud.android.ui.PreferenceCustomCategory
android:title="@string/prefs_category_more"
android:key="more">
android:key="more"
android:title="@string/prefs_category_more">
<Preference
android:key="backup"
android:layout="@layout/custom_preference_layout"
Expand Down Expand Up @@ -160,6 +156,10 @@
android:key="help"
android:layout="@layout/custom_preference_layout"
android:title="@string/prefs_help" />
<Preference
android:key="delete_account"
android:layout="@layout/custom_preference_layout"
android:title="@string/prefs_help" />
<Preference
android:key="imprint"
android:layout="@layout/custom_preference_layout"
Expand Down

0 comments on commit 9f550ef

Please sign in to comment.