diff --git a/.vscode/settings.json b/.vscode/settings.json
new file mode 100644
index 00000000000..c5f3f6b9c75
--- /dev/null
+++ b/.vscode/settings.json
@@ -0,0 +1,3 @@
+{
+ "java.configuration.updateBuildConfiguration": "interactive"
+}
\ No newline at end of file
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index c2f38f22d26..ba7b26d5e80 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -97,6 +97,10 @@
tools:ignore="UnusedAttribute"
tools:replace="label, icon, theme, name, allowBackup">
+
+
diff --git a/app/src/main/java/com/nextcloud/talk/account/ServerSelectionActivity.kt b/app/src/main/java/com/nextcloud/talk/account/ServerSelectionActivity.kt
index 35d2c1e1ffd..297b900d791 100644
--- a/app/src/main/java/com/nextcloud/talk/account/ServerSelectionActivity.kt
+++ b/app/src/main/java/com/nextcloud/talk/account/ServerSelectionActivity.kt
@@ -30,7 +30,11 @@ import com.blikoon.qrcodescanner.QrCodeActivity
import com.github.dhaval2404.imagepicker.util.PermissionUtil
import com.google.android.material.snackbar.Snackbar
import com.nextcloud.talk.R
+import com.nextcloud.talk.account.data.LoginRepository
+import com.nextcloud.talk.account.data.model.LoginCompletion
import com.nextcloud.talk.activities.BaseActivity
+import com.nextcloud.talk.account.AccountVerificationActivity
+import com.nextcloud.talk.appconfig.AppConfigManager
import com.nextcloud.talk.api.NcApi
import com.nextcloud.talk.application.NextcloudTalkApplication
import com.nextcloud.talk.application.NextcloudTalkApplication.Companion.sharedApplication
@@ -44,6 +48,7 @@ import com.nextcloud.talk.utils.ApiUtils
import com.nextcloud.talk.utils.CapabilitiesUtil
import com.nextcloud.talk.utils.UriUtils
import com.nextcloud.talk.utils.bundle.BundleKeys
+import java.net.HttpURLConnection
import com.nextcloud.talk.utils.bundle.BundleKeys.ADD_ADDITIONAL_ACCOUNT
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_IS_ACCOUNT_IMPORT
import com.nextcloud.talk.utils.singletons.ApplicationWideMessageHolder
@@ -69,6 +74,12 @@ class ServerSelectionActivity : BaseActivity() {
@Inject
lateinit var networkMonitor: NetworkMonitor
+ @Inject
+ lateinit var appConfigManager: AppConfigManager
+
+ @Inject
+ lateinit var loginRepository: LoginRepository
+
private var statusQueryDisposable: Disposable? = null
private val onBackPressedCallback = object : OnBackPressedCallback(true) {
@@ -92,6 +103,21 @@ class ServerSelectionActivity : BaseActivity() {
initSystemBars()
onBackPressedDispatcher.addCallback(this, onBackPressedCallback)
+
+ if (savedInstanceState == null) {
+ val managedBaseUrl = appConfigManager.getServerBaseUrl()
+ when {
+ !managedBaseUrl.isNullOrBlank() -> {
+ binding.serverEntryTextInputEditText.setText(managedBaseUrl)
+ checkServerAndProceed()
+ }
+
+ !TextUtils.isEmpty(resources!!.getString(R.string.weblogin_url)) -> {
+ binding.serverEntryTextInputEditText.setText(resources!!.getString(R.string.weblogin_url))
+ checkServerAndProceed()
+ }
+ }
+ }
}
override fun onResume() {
@@ -127,10 +153,7 @@ class ServerSelectionActivity : BaseActivity() {
}
binding.serverEntryTextInputEditText.requestFocus()
- if (!TextUtils.isEmpty(resources!!.getString(R.string.weblogin_url))) {
- binding.serverEntryTextInputEditText.setText(resources!!.getString(R.string.weblogin_url))
- checkServerAndProceed()
- }
+
binding.serverEntryTextInputEditText.setOnEditorActionListener { _: TextView?, i: Int, _: KeyEvent? ->
if (i == EditorInfo.IME_ACTION_DONE) {
checkServerAndProceed()
@@ -349,8 +372,27 @@ class ServerSelectionActivity : BaseActivity() {
}
}
} else {
+ val baseUrl = queryUrl.replace("/status.php", "")
+ val managedUsername = appConfigManager.getUsername()
+ val managedPassword = appConfigManager.getAppPassword()
+ if (!managedUsername.isNullOrBlank() && !managedPassword.isNullOrBlank()) {
+ val loginCompletion = LoginCompletion(
+ HttpURLConnection.HTTP_OK,
+ baseUrl,
+ managedUsername,
+ managedPassword
+ )
+ val managedBundle = loginRepository.parseAndLogin(loginCompletion)
+ if (managedBundle != null) {
+ val intent = Intent(context, AccountVerificationActivity::class.java)
+ intent.putExtras(managedBundle)
+ startActivity(intent)
+ return@runOnUiThread
+ }
+ }
+
val bundle = Bundle()
- bundle.putString(BundleKeys.KEY_BASE_URL, queryUrl.replace("/status.php", ""))
+ bundle.putString(BundleKeys.KEY_BASE_URL, baseUrl)
val intent = Intent(context, BrowserLoginActivity::class.java)
intent.putExtras(bundle)
diff --git a/app/src/main/java/com/nextcloud/talk/appconfig/AppConfigManager.kt b/app/src/main/java/com/nextcloud/talk/appconfig/AppConfigManager.kt
new file mode 100644
index 00000000000..63cbd3fe6e6
--- /dev/null
+++ b/app/src/main/java/com/nextcloud/talk/appconfig/AppConfigManager.kt
@@ -0,0 +1,37 @@
+/*
+ * Nextcloud Talk - Android Client
+ *
+ * SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ */
+package com.nextcloud.talk.appconfig
+
+import android.content.RestrictionsManager
+import android.content.Context
+import androidx.annotation.VisibleForTesting
+import javax.inject.Inject
+import javax.inject.Singleton
+
+@Singleton
+class AppConfigManager @Inject constructor(private val context: Context) {
+
+ fun getServerBaseUrl(): String? = getString(KEY_SERVER_BASE_URL)?.takeIf { it.isNotBlank() }
+
+ fun getUsername(): String? = getString(KEY_USERNAME)?.takeIf { it.isNotBlank() }
+
+ fun getAppPassword(): String? = getString(KEY_APP_PASSWORD)?.takeIf { it.isNotBlank() }
+
+ @VisibleForTesting
+ internal fun getString(key: String): String? {
+ val restrictionsManager = context.getSystemService(Context.RESTRICTIONS_SERVICE) as? RestrictionsManager
+ ?: return null
+ val restrictions = restrictionsManager.applicationRestrictions
+ return restrictions?.getString(key)
+ }
+
+ companion object {
+ const val KEY_SERVER_BASE_URL = "nextcloud_url"
+ const val KEY_USERNAME = "nextcloud_username"
+ const val KEY_APP_PASSWORD = "nextcloud_password"
+ }
+}
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 7df21e1e56c..016b107f287 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -1032,4 +1032,12 @@ How to translate with transifex:
Turn on background blur
Turn off background blur
Account not found
+
+
+ Server URL
+ Nextcloud server address that should be used by default.
+ Username
+ Username that should be used by default.
+ App password
+ App-specific password or token for the user.
diff --git a/app/src/main/res/xml/app_restrictions.xml b/app/src/main/res/xml/app_restrictions.xml
new file mode 100644
index 00000000000..5d03a22f721
--- /dev/null
+++ b/app/src/main/res/xml/app_restrictions.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
diff --git a/gradle/verification-metadata.xml b/gradle/verification-metadata.xml
index 39ab26e5c29..b8da9cae87e 100644
--- a/gradle/verification-metadata.xml
+++ b/gradle/verification-metadata.xml
@@ -118,7 +118,10 @@
-
+
+
+
+
@@ -1077,6 +1080,14 @@
+
+
+
+
+
+
+
+
@@ -1085,6 +1096,14 @@
+
+
+
+
+
+
+
+
@@ -1133,6 +1152,14 @@
+
+
+
+
+
+
+
+
@@ -1181,6 +1208,14 @@
+
+
+
+
+
+
+
+
@@ -1229,6 +1264,14 @@
+
+
+
+
+
+
+
+
@@ -1277,6 +1320,14 @@
+
+
+
+
+
+
+
+
@@ -1309,6 +1360,14 @@
+
+
+
+
+
+
+
+
@@ -1606,11 +1665,21 @@
+
+
+
+
+
+
+
+
+
+
@@ -1639,6 +1708,11 @@
+
+
+
+
+
@@ -1724,6 +1798,14 @@
+
+
+
+
+
+
+
+
@@ -1797,6 +1879,11 @@
+
+
+
+
+
@@ -1887,6 +1974,14 @@
+
+
+
+
+
+
+
+
@@ -1960,6 +2055,11 @@
+
+
+
+
+
@@ -2048,6 +2148,14 @@
+
+
+
+
+
+
+
+
@@ -2124,6 +2232,11 @@
+
+
+
+
+
@@ -2212,6 +2325,14 @@
+
+
+
+
+
+
+
+
@@ -2492,6 +2613,11 @@
+
+
+
+
+
@@ -2572,6 +2698,14 @@
+
+
+
+
+
+
+
+
@@ -2693,6 +2827,11 @@
+
+
+
+
+
@@ -2781,6 +2920,14 @@
+
+
+
+
+
+
+
+
@@ -2857,6 +3004,11 @@
+
+
+
+
+
@@ -2913,6 +3065,14 @@
+
+
+
+
+
+
+
+
@@ -2957,6 +3117,11 @@
+
+
+
+
+
@@ -2997,6 +3162,14 @@
+
+
+
+
+
+
+
+
@@ -3030,6 +3203,11 @@
+
+
+
+
+
@@ -3128,6 +3306,14 @@
+
+
+
+
+
+
+
+
@@ -3212,6 +3398,11 @@
+
+
+
+
+
@@ -3305,6 +3496,14 @@
+
+
+
+
+
+
+
+
@@ -3386,6 +3585,11 @@
+
+
+
+
+
@@ -3474,6 +3678,14 @@
+
+
+
+
+
+
+
+
@@ -3550,6 +3762,11 @@
+
+
+
+
+
@@ -3643,6 +3860,14 @@
+
+
+
+
+
+
+
+
@@ -3724,6 +3949,11 @@
+
+
+
+
+
@@ -3812,6 +4042,14 @@
+
+
+
+
+
+
+
+
@@ -3888,6 +4126,11 @@
+
+
+
+
+
@@ -3976,6 +4219,14 @@
+
+
+
+
+
+
+
+
@@ -4064,6 +4315,14 @@
+
+
+
+
+
+
+
+
@@ -4145,6 +4404,11 @@
+
+
+
+
+
@@ -4238,6 +4502,14 @@
+
+
+
+
+
+
+
+
@@ -4316,6 +4588,11 @@
+
+
+
+
+
@@ -4391,6 +4668,14 @@
+
+
+
+
+
+
+
+
@@ -4469,6 +4754,11 @@
+
+
+
+
+
@@ -4544,6 +4834,14 @@
+
+
+
+
+
+
+
+
@@ -4625,6 +4923,11 @@
+
+
+
+
+
@@ -4718,6 +5021,14 @@
+
+
+
+
+
+
+
+
@@ -4799,6 +5110,11 @@
+
+
+
+
+
@@ -4887,6 +5203,14 @@
+
+
+
+
+
+
+
+
@@ -4963,6 +5287,11 @@
+
+
+
+
+
@@ -5051,6 +5380,14 @@
+
+
+
+
+
+
+
+
@@ -5548,6 +5885,14 @@
+
+
+
+
+
+
+
+
@@ -5684,6 +6029,14 @@
+
+
+
+
+
+
+
+
@@ -5820,6 +6173,14 @@
+
+
+
+
+
+
+
+
@@ -7966,6 +8327,14 @@
+
+
+
+
+
+
+
+
@@ -8054,6 +8423,14 @@
+
+
+
+
+
+
+
+
@@ -8142,6 +8519,14 @@
+
+
+
+
+
+
+
+
@@ -8230,6 +8615,14 @@
+
+
+
+
+
+
+
+
@@ -8318,6 +8711,14 @@
+
+
+
+
+
+
+
+
@@ -8406,6 +8807,14 @@
+
+
+
+
+
+
+
+
@@ -8494,6 +8903,14 @@
+
+
+
+
+
+
+
+
@@ -8582,6 +8999,14 @@
+
+
+
+
+
+
+
+
@@ -8595,6 +9020,14 @@
+
+
+
+
+
+
+
+
@@ -10832,6 +11265,14 @@
+
+
+
+
+
+
+
+
@@ -10968,6 +11409,14 @@
+
+
+
+
+
+
+
+
@@ -11104,11 +11553,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -11341,6 +11803,14 @@
+
+
+
+
+
+
+
+
@@ -11477,6 +11947,14 @@
+
+
+
+
+
+
+
+
@@ -11613,6 +12091,14 @@
+
+
+
+
+
+
+
+
@@ -11653,6 +12139,14 @@
+
+
+
+
+
+
+
+
@@ -11789,6 +12283,14 @@
+
+
+
+
+
+
+
+
@@ -11925,6 +12427,14 @@
+
+
+
+
+
+
+
+
@@ -12061,6 +12571,14 @@
+
+
+
+
+
+
+
+
@@ -12197,6 +12715,14 @@
+
+
+
+
+
+
+
+
@@ -12333,6 +12859,14 @@
+
+
+
+
+
+
+
+
@@ -12469,6 +13003,14 @@
+
+
+
+
+
+
+
+
@@ -12605,6 +13147,14 @@
+
+
+
+
+
+
+
+
@@ -12845,6 +13395,14 @@
+
+
+
+
+
+
+
+
@@ -12981,6 +13539,14 @@
+
+
+
+
+
+
+
+
@@ -13117,6 +13683,14 @@
+
+
+
+
+
+
+
+
@@ -13253,6 +13827,14 @@
+
+
+
+
+
+
+
+
@@ -13389,6 +13971,14 @@
+
+
+
+
+
+
+
+
@@ -13525,6 +14115,14 @@
+
+
+
+
+
+
+
+
@@ -13661,6 +14259,14 @@
+
+
+
+
+
+
+
+
@@ -13877,6 +14483,14 @@
+
+
+
+
+
+
+
+
@@ -14029,6 +14643,14 @@
+
+
+
+
+
+
+
+
@@ -14053,6 +14675,14 @@
+
+
+
+
+
+
+
+
@@ -14061,6 +14691,14 @@
+
+
+
+
+
+
+
+
@@ -14213,6 +14851,14 @@
+
+
+
+
+
+
+
+
@@ -14365,6 +15011,14 @@
+
+
+
+
+
+
+
+
@@ -14525,6 +15179,14 @@
+
+
+
+
+
+
+
+
@@ -14661,6 +15323,14 @@
+
+
+
+
+
+
+
+
@@ -14701,6 +15371,14 @@
+
+
+
+
+
+
+
+
@@ -14741,6 +15419,14 @@
+
+
+
+
+
+
+
+
@@ -14781,6 +15467,14 @@
+
+
+
+
+
+
+
+
@@ -14917,6 +15611,14 @@
+
+
+
+
+
+
+
+
@@ -14957,6 +15659,14 @@
+
+
+
+
+
+
+
+
@@ -14997,6 +15707,14 @@
+
+
+
+
+
+
+
+
@@ -15037,6 +15755,14 @@
+
+
+
+
+
+
+
+
@@ -15077,6 +15803,14 @@
+
+
+
+
+
+
+
+
@@ -15213,6 +15947,14 @@
+
+
+
+
+
+
+
+
@@ -15349,6 +16091,14 @@
+
+
+
+
+
+
+
+
@@ -15485,6 +16235,14 @@
+
+
+
+
+
+
+
+
@@ -15621,6 +16379,14 @@
+
+
+
+
+
+
+
+
@@ -16173,6 +16939,14 @@
+
+
+
+
+
+
+
+
@@ -16309,6 +17083,14 @@
+
+
+
+
+
+
+
+
@@ -16445,6 +17227,14 @@
+
+
+
+
+
+
+
+
@@ -16581,6 +17371,14 @@
+
+
+
+
+
+
+
+
@@ -16717,6 +17515,14 @@
+
+
+
+
+
+
+
+
@@ -16853,6 +17659,14 @@
+
+
+
+
+
+
+
+
@@ -16989,6 +17803,14 @@
+
+
+
+
+
+
+
+
@@ -17125,6 +17947,14 @@
+
+
+
+
+
+
+
+
@@ -17261,6 +18091,14 @@
+
+
+
+
+
+
+
+
@@ -17397,6 +18235,14 @@
+
+
+
+
+
+
+
+
@@ -17533,6 +18379,14 @@
+
+
+
+
+
+
+
+
@@ -17669,6 +18523,14 @@
+
+
+
+
+
+
+
+
@@ -17949,6 +18811,14 @@
+
+
+
+
+
+
+
+
@@ -18085,6 +18955,14 @@
+
+
+
+
+
+
+
+
@@ -18093,6 +18971,14 @@
+
+
+
+
+
+
+
+
@@ -18101,6 +18987,14 @@
+
+
+
+
+
+
+
+
@@ -18237,6 +19131,14 @@
+
+
+
+
+
+
+
+
@@ -18340,6 +19242,11 @@
+
+
+
+
+
@@ -19340,6 +20247,14 @@
+
+
+
+
+
+
+
+
@@ -19606,6 +20521,14 @@
+
+
+
+
+
+
+
+
@@ -19901,6 +20824,14 @@
+
+
+
+
+
+
+
+
@@ -19957,6 +20888,11 @@
+
+
+
+
+
@@ -19980,6 +20916,14 @@
+
+
+
+
+
+
+
+
@@ -20058,6 +21002,11 @@
+
+
+
+
+
@@ -20376,6 +21325,14 @@
+
+
+
+
+
+
+
+
@@ -20560,6 +21517,14 @@
+
+
+
+
+
+
+
+
@@ -20672,6 +21637,14 @@
+
+
+
+
+
+
+
+
@@ -21102,6 +22075,14 @@
+
+
+
+
+
+
+
+
@@ -21115,6 +22096,14 @@
+
+
+
+
+
+
+
+
@@ -21195,6 +22184,14 @@
+
+
+
+
+
+
+
+
@@ -21287,6 +22284,11 @@
+
+
+
+
+
@@ -21382,6 +22384,11 @@
+
+
+
+
+
@@ -21397,6 +22404,16 @@
+
+
+
+
+
+
+
+
+
+
@@ -21407,6 +22424,11 @@
+
+
+
+
+
@@ -21532,6 +22554,11 @@
+
+
+
+
+
@@ -21574,6 +22601,14 @@
+
+
+
+
+
+
+
+
@@ -21678,6 +22713,11 @@
+
+
+
+
+
@@ -24163,6 +25203,14 @@
+
+
+
+
+
+
+
+
@@ -24399,6 +25447,14 @@
+
+
+
+
+
+
+
+
@@ -25295,6 +26351,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -25690,6 +26759,14 @@
+
+
+
+
+
+
+
+
@@ -25754,6 +26831,14 @@
+
+
+
+
+
+
+
+
@@ -25778,6 +26863,14 @@
+
+
+
+
+
+
+
+
@@ -25834,6 +26927,14 @@
+
+
+
+
+
+
+
+
@@ -25946,6 +27047,14 @@
+
+
+
+
+
+
+
+
@@ -26044,6 +27153,14 @@
+
+
+
+
+
+
+
+
@@ -26162,6 +27279,9 @@
+
+
+
@@ -26190,6 +27310,14 @@
+
+
+
+
+
+
+
+
@@ -26198,6 +27326,14 @@
+
+
+
+
+
+
+
+
@@ -26270,6 +27406,14 @@
+
+
+
+
+
+
+
+
@@ -26391,6 +27535,14 @@
+
+
+
+
+
+
+
+
@@ -26509,6 +27661,9 @@
+
+
+
@@ -26585,6 +27740,14 @@
+
+
+
+
+
+
+
+
@@ -26703,6 +27866,9 @@
+
+
+
@@ -26828,6 +27994,14 @@
+
+
+
+
+
+
+
+
@@ -26900,6 +28074,14 @@
+
+
+
+
+
+
+
+
@@ -26972,6 +28154,14 @@
+
+
+
+
+
+
+
+
@@ -27062,6 +28252,14 @@
+
+
+
+
+
+
+
+
@@ -27134,6 +28332,14 @@
+
+
+
+
+
+
+
+
@@ -27206,6 +28412,14 @@
+
+
+
+
+
+
+
+
@@ -27357,6 +28571,9 @@
+
+
+
@@ -27449,6 +28666,14 @@
+
+
+
+
+
+
+
+
@@ -27569,6 +28794,14 @@
+
+
+
+
+
+
+
+
@@ -27641,6 +28874,14 @@
+
+
+
+
+
+
+
+
@@ -27713,6 +28954,14 @@
+
+
+
+
+
+
+
+
@@ -27785,6 +29034,14 @@
+
+
+
+
+
+
+
+
@@ -27966,6 +29223,14 @@
+
+
+
+
+
+
+
+
@@ -28230,6 +29495,14 @@
+
+
+
+
+
+
+
+
@@ -28302,6 +29575,14 @@
+
+
+
+
+
+
+
+
@@ -28510,6 +29791,14 @@
+
+
+
+
+
+
+
+
@@ -28627,6 +29916,11 @@
+
+
+
+
+
@@ -28918,6 +30212,9 @@
+
+
+
@@ -28994,6 +30291,14 @@
+
+
+
+
+
+
+
+
@@ -29066,6 +30371,14 @@
+
+
+
+
+
+
+
+
@@ -29138,6 +30451,14 @@
+
+
+
+
+
+
+
+
@@ -29302,6 +30623,14 @@
+
+
+
+
+
+
+
+
@@ -29352,6 +30681,11 @@
+
+
+
+
+
@@ -29372,6 +30706,11 @@
+
+
+
+
+
@@ -29398,6 +30737,11 @@
+
+
+
+
+
@@ -29448,6 +30792,14 @@
+
+
+
+
+
+
+
+
@@ -29530,6 +30882,14 @@
+
+
+
+
+
+
+
+
@@ -29567,6 +30927,14 @@
+
+
+
+
+
+
+
+
@@ -29596,6 +30964,14 @@
+
+
+
+
+
+
+
+
@@ -29633,6 +31009,11 @@
+
+
+
+
+
@@ -29649,6 +31030,14 @@
+
+
+
+
+
+
+
+
@@ -29662,6 +31051,11 @@
+
+
+
+
+
@@ -29692,6 +31086,11 @@
+
+
+
+
+
@@ -29742,6 +31141,14 @@
+
+
+
+
+
+
+
+
@@ -29795,6 +31202,11 @@
+
+
+
+
+
@@ -29837,6 +31249,14 @@
+
+
+
+
+
+
+
+
@@ -30151,6 +31571,14 @@
+
+
+
+
+
+
+
+
@@ -30247,6 +31675,14 @@
+
+
+
+
+
+
+
+
@@ -30343,6 +31779,14 @@
+
+
+
+
+
+
+
+
@@ -30375,6 +31819,14 @@
+
+
+
+
+
+
+
+
@@ -30471,6 +31923,14 @@
+
+
+
+
+
+
+
+
@@ -31671,6 +33131,14 @@
+
+
+
+
+
+
+
+
diff --git a/settings.gradle b/settings.gradle
index b3d00a20971..e6330043daf 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -1,4 +1,6 @@
-/*
+plugins {
+ id 'org.gradle.toolchains.foojay-resolver-convention' version '1.0.0'
+}/*
* Nextcloud Talk - Android Client
*
* SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors