From f877bb5fb9492f42fc885133e5bb859ffdc0ffa1 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Fri, 20 Jan 2023 22:55:48 +0100 Subject: [PATCH] NSCv3: split preference xml --- .../plugins/sync/nsclient/NSClientPlugin.kt | 1 - .../sync/nsclientV3/NSClientV3Plugin.kt | 3 +- .../sync/src/main/res/xml/pref_ns_client.xml | 9 - .../src/main/res/xml/pref_ns_client_v3.xml | 217 ++++++++++++++++++ 4 files changed, 218 insertions(+), 12 deletions(-) create mode 100644 plugins/sync/src/main/res/xml/pref_ns_client_v3.xml diff --git a/plugins/sync/src/main/java/info/nightscout/plugins/sync/nsclient/NSClientPlugin.kt b/plugins/sync/src/main/java/info/nightscout/plugins/sync/nsclient/NSClientPlugin.kt index 4109d3b24c..53ca1d3e73 100644 --- a/plugins/sync/src/main/java/info/nightscout/plugins/sync/nsclient/NSClientPlugin.kt +++ b/plugins/sync/src/main/java/info/nightscout/plugins/sync/nsclient/NSClientPlugin.kt @@ -156,7 +156,6 @@ class NSClientPlugin @Inject constructor( if (activePlugin.activeBgSource is DoingOwnUploadSource) { preferenceFragment.findPreference(rh.gs(info.nightscout.core.utils.R.string.key_do_ns_upload))?.isVisible = false } - preferenceFragment.findPreference(rh.gs(R.string.key_ns_client_token))?.isVisible = false } override val hasWritePermission: Boolean get() = nsClientService?.hasWriteAuth ?: false diff --git a/plugins/sync/src/main/java/info/nightscout/plugins/sync/nsclientV3/NSClientV3Plugin.kt b/plugins/sync/src/main/java/info/nightscout/plugins/sync/nsclientV3/NSClientV3Plugin.kt index c450cd9c6d..2860acccbb 100644 --- a/plugins/sync/src/main/java/info/nightscout/plugins/sync/nsclientV3/NSClientV3Plugin.kt +++ b/plugins/sync/src/main/java/info/nightscout/plugins/sync/nsclientV3/NSClientV3Plugin.kt @@ -111,7 +111,7 @@ class NSClientV3Plugin @Inject constructor( .pluginIcon(info.nightscout.core.ui.R.drawable.ic_nightscout_syncs) .pluginName(R.string.ns_client_v3) .shortName(R.string.ns_client_v3_short_name) - .preferencesId(R.xml.pref_ns_client) + .preferencesId(R.xml.pref_ns_client_v3) .description(R.string.description_ns_client_v3), aapsLogger, rh, injector ) { @@ -239,7 +239,6 @@ class NSClientV3Plugin @Inject constructor( preferenceFragment.findPreference(rh.gs(info.nightscout.core.utils.R.string.key_ns_create_announcements_from_carbs_req))?.isVisible = false } preferenceFragment.findPreference(rh.gs(R.string.key_ns_receive_tbr_eb))?.isVisible = config.isEngineeringMode() - preferenceFragment.findPreference(rh.gs(info.nightscout.core.utils.R.string.key_nsclientinternal_api_secret))?.isVisible = false } override val hasWritePermission: Boolean get() = nsAndroidClient?.lastStatus?.apiPermissions?.isFull() ?: false diff --git a/plugins/sync/src/main/res/xml/pref_ns_client.xml b/plugins/sync/src/main/res/xml/pref_ns_client.xml index 9f2739ee68..c6f9cdb768 100644 --- a/plugins/sync/src/main/res/xml/pref_ns_client.xml +++ b/plugins/sync/src/main/res/xml/pref_ns_client.xml @@ -26,15 +26,6 @@ validate:minLength="12" validate:testType="minLength"/> - - diff --git a/plugins/sync/src/main/res/xml/pref_ns_client_v3.xml b/plugins/sync/src/main/res/xml/pref_ns_client_v3.xml new file mode 100644 index 0000000000..79f5b522af --- /dev/null +++ b/plugins/sync/src/main/res/xml/pref_ns_client_v3.xml @@ -0,0 +1,217 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + > + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file