changeset 372:1481f09c9175

settings (android): don't expose autoconnect parameters: autoconnection parameters are used on Android to reconnect automatically any profile connected, so we use the new `extra` parameter to ignore them, avoiding an accidental change by the user which would be confusing.
author Goffi <goffi@goffi.org>
date Mon, 27 Jan 2020 21:17:08 +0100
parents 080b6cc17f53
children 5d994be1161b
files cagou/core/platform_/android.py cagou/core/platform_/base.py cagou/plugins/plugin_wid_settings.py
diffstat 3 files changed, 26 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/cagou/core/platform_/android.py	Mon Jan 27 21:17:08 2020 +0100
+++ b/cagou/core/platform_/android.py	Mon Jan 27 21:17:08 2020 +0100
@@ -134,6 +134,19 @@
         PythonActivity.moveTaskToBack(True)
         return True
 
+    def updateParamsExtra(self, extra):
+        # on Android, we handle autoconnection automatically,
+        # user must not modify those parameters
+        extra.update(
+            {
+                "ignore": [
+                    ["Connection", "autoconnect_backend"],
+                    ["Connection", "autoconnect"],
+                    ["Connection", "autodisconnect"],
+                ],
+            }
+        )
+
     def getPathFromUri(self, uri):
         cursor = mActivity.getContentResolver().query(uri, None, None, None, None)
         if cursor is None:
--- a/cagou/core/platform_/base.py	Mon Jan 27 21:17:08 2020 +0100
+++ b/cagou/core/platform_/base.py	Mon Jan 27 21:17:08 2020 +0100
@@ -69,6 +69,9 @@
         share_widget.close()
         return True
 
+    def updateParamsExtra(self, extra):
+        pass
+
     def open_url(self, url, wid=None):
         """Open an URL in the way appropriate for the platform
 
--- a/cagou/plugins/plugin_wid_settings.py	Mon Jan 27 21:17:08 2020 +0100
+++ b/cagou/plugins/plugin_wid_settings.py	Mon Jan 27 21:17:08 2020 +0100
@@ -19,9 +19,9 @@
 
 
 from sat.core import log as logging
-log = logging.getLogger(__name__)
 from sat.core.i18n import _
 from sat.core.constants import Const as C
+from sat.tools.common import data_format
 from sat_frontends.quick_frontend import quick_widgets
 from kivy.uix.label import Label
 from kivy.uix.widget import Widget
@@ -29,6 +29,9 @@
 from cagou import G
 
 
+log = logging.getLogger(__name__)
+
+
 PLUGIN_INFO = {
     "name": _("settings"),
     "main": "CagouSettings",
@@ -48,7 +51,12 @@
         # then up when the UI is loaded
         self.loading_widget = Widget()
         self.add_widget(self.loading_widget)
-        G.host.bridge.getParamsUI(-1, C.APP_NAME, self.profile, callback=self.getParamsUICb, errback=self.getParamsUIEb)
+        extra = {}
+        G.local_platform.updateParamsExtra(extra)
+        G.host.bridge.getParamsUI(
+            -1, C.APP_NAME, data_format.serialise(extra), self.profile,
+            callback=self.getParamsUICb,
+            errback=self.getParamsUIEb)
 
     def changeWidget(self, widget):
         self.clear_widgets([self.loading_widget])