diff --git a/android/app/src/main/res/values/strings.xml b/android/app/src/main/res/values/strings.xml index d3a95fa69..e14e36d44 100644 --- a/android/app/src/main/res/values/strings.xml +++ b/android/app/src/main/res/values/strings.xml @@ -14,6 +14,8 @@ Allow the user to change the above server URL. Default Username Set the username or email address to use to authenticate against the Mattermost Server. + Default Request Timeout + How long in milliseconds the mobile app should wait for the server to respond. EMM Vendor or Company Name Name of the EMM vendor or company deploying the app. Used in help text when prompting for passcodes so users are aware why the app is being protected. diff --git a/android/app/src/main/res/xml/app_restrictions.xml b/android/app/src/main/res/xml/app_restrictions.xml index fda826002..27a0e9e2e 100644 --- a/android/app/src/main/res/xml/app_restrictions.xml +++ b/android/app/src/main/res/xml/app_restrictions.xml @@ -43,6 +43,12 @@ android:description="@string/username_description" android:restrictionType="string" android:defaultValue="" /> + { + if (config.timeout !== managedConfig?.timeout) { + initFetchConfig(); + return; + } + managedConfig = config; }); @@ -150,11 +156,16 @@ Client4.doFetchWithResponse = async (url, options) => { const initFetchConfig = async () => { const fetchConfig = { auto: true, - timeout: 5000, // Set the base timeout for every request to 5s + timeout: DEFAULT_TIMEOUT, // Set the base timeout for every request to 5s }; try { managedConfig = await mattermostManaged.getConfig(); + + if (managedConfig?.timeout) { + const timeout = parseInt(managedConfig.timeout, 10); + fetchConfig.timeout = timeout || DEFAULT_TIMEOUT; + } } catch { // no managed config }