mirror of
https://github.com/nextcloud/talk-android
synced 2025-07-25 21:55:25 +01:00
linter
Signed-off-by: rapterjet2004 <juliuslinus1@gmail.com>
This commit is contained in:
parent
e643039488
commit
1918349c93
@ -150,7 +150,8 @@ class BrowserLoginActivity : BaseActivity() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private val qrScanResultLauncher = registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { result ->
|
private val qrScanResultLauncher =
|
||||||
|
registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { result ->
|
||||||
if (result.resultCode == RESULT_OK) {
|
if (result.resultCode == RESULT_OK) {
|
||||||
val data = result.data
|
val data = result.data
|
||||||
|
|
||||||
@ -276,13 +277,13 @@ class BrowserLoginActivity : BaseActivity() {
|
|||||||
*/
|
*/
|
||||||
fun parseLoginDataUrl(dataString: String) {
|
fun parseLoginDataUrl(dataString: String) {
|
||||||
if (!dataString.startsWith(PREFIX)) {
|
if (!dataString.startsWith(PREFIX)) {
|
||||||
throw IllegalArgumentException("Invalid login URL detected" )
|
throw IllegalArgumentException("Invalid login URL detected")
|
||||||
}
|
}
|
||||||
|
|
||||||
val data = dataString.removePrefix(PREFIX)
|
val data = dataString.removePrefix(PREFIX)
|
||||||
val values = data.split('&')
|
val values = data.split('&')
|
||||||
|
|
||||||
if(values.size !in 1..3) {
|
if (values.size !in 1..MAX_ARGS) {
|
||||||
throw IllegalArgumentException("Illegal number of login URL elements detected: ${values.size}")
|
throw IllegalArgumentException("Illegal number of login URL elements detected: ${values.size}")
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -293,9 +294,11 @@ class BrowserLoginActivity : BaseActivity() {
|
|||||||
value.startsWith(USER_KEY) -> {
|
value.startsWith(USER_KEY) -> {
|
||||||
loginData.username = URLDecoder.decode(value.removePrefix(USER_KEY), "UTF-8")
|
loginData.username = URLDecoder.decode(value.removePrefix(USER_KEY), "UTF-8")
|
||||||
}
|
}
|
||||||
|
|
||||||
value.startsWith(PASS_KEY) -> {
|
value.startsWith(PASS_KEY) -> {
|
||||||
loginData.token = URLDecoder.decode(value.removePrefix(PASS_KEY), "UTF-8")
|
loginData.token = URLDecoder.decode(value.removePrefix(PASS_KEY), "UTF-8")
|
||||||
}
|
}
|
||||||
|
|
||||||
value.startsWith(SERVER_KEY) -> {
|
value.startsWith(SERVER_KEY) -> {
|
||||||
loginData.serverUrl = URLDecoder.decode(value.removePrefix(SERVER_KEY), "UTF-8")
|
loginData.serverUrl = URLDecoder.decode(value.removePrefix(SERVER_KEY), "UTF-8")
|
||||||
baseUrl = loginData.serverUrl
|
baseUrl = loginData.serverUrl
|
||||||
@ -431,5 +434,6 @@ class BrowserLoginActivity : BaseActivity() {
|
|||||||
private const val SERVER_KEY = "server:"
|
private const val SERVER_KEY = "server:"
|
||||||
private const val PASS_KEY = "password:"
|
private const val PASS_KEY = "password:"
|
||||||
private const val PREFIX = "nc://login/"
|
private const val PREFIX = "nc://login/"
|
||||||
|
private const val MAX_ARGS = 3
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -396,7 +396,8 @@ class ServerSelectionActivity : BaseActivity() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private val requestCameraPermissionLauncher = registerForActivityResult(ActivityResultContracts.RequestPermission()) { isGranted: Boolean ->
|
private val requestCameraPermissionLauncher =
|
||||||
|
registerForActivityResult(ActivityResultContracts.RequestPermission()) { isGranted: Boolean ->
|
||||||
if (isGranted) {
|
if (isGranted) {
|
||||||
// Permission was granted
|
// Permission was granted
|
||||||
startQRScanner()
|
startQRScanner()
|
||||||
|
Loading…
Reference in New Issue
Block a user