|
67 | 67 | import com.nextcloud.operations.PostMethod; |
68 | 68 | import com.nextcloud.utils.extensions.BundleExtensionsKt; |
69 | 69 | import com.nextcloud.utils.mdm.MDMConfig; |
70 | | -import com.owncloud.android.BuildConfig; |
71 | 70 | import com.owncloud.android.MainApp; |
72 | 71 | import com.owncloud.android.R; |
73 | 72 | import com.owncloud.android.databinding.AccountSetupBinding; |
|
128 | 127 | import androidx.annotation.Nullable; |
129 | 128 | import androidx.annotation.VisibleForTesting; |
130 | 129 | import androidx.appcompat.app.ActionBar; |
131 | | -import androidx.browser.customtabs.CustomTabColorSchemeParams; |
132 | | -import androidx.browser.customtabs.CustomTabsIntent; |
| 130 | +import androidx.browser.auth.AuthTabIntent; |
133 | 131 | import androidx.core.content.ContextCompat; |
134 | 132 | import androidx.core.graphics.Insets; |
135 | 133 | import androidx.core.view.ViewCompat; |
@@ -496,22 +494,15 @@ private void launchDefaultWebBrowser(String url) { |
496 | 494 | } |
497 | 495 |
|
498 | 496 | Uri uri = Uri.parse(url); |
| 497 | + String loginScheme = getString(R.string.login_data_own_scheme); |
499 | 498 |
|
500 | 499 | try { |
501 | 500 | int toolbarColor = ContextCompat.getColor(this, R.color.primary); |
502 | | - CustomTabColorSchemeParams colorParams = new CustomTabColorSchemeParams.Builder() |
503 | | - .setToolbarColor(toolbarColor) |
504 | | - .build(); |
505 | | - CustomTabsIntent customTabsIntent = new CustomTabsIntent.Builder() |
506 | | - .setDefaultColorSchemeParams(colorParams) |
507 | | - .setColorScheme(CustomTabsIntent.COLOR_SCHEME_SYSTEM) |
508 | | - .setShowTitle(true) |
509 | | - .setShareState(CustomTabsIntent.SHARE_STATE_OFF) |
510 | | - .build(); |
511 | | - customTabsIntent.launchUrl(this, uri); |
| 501 | + AuthTabIntent authTabIntent = new AuthTabIntent.Builder().setColorScheme(toolbarColor).build(); |
| 502 | + authTabIntent.launch(authTabResultLauncher, uri, loginScheme); |
512 | 503 | return; |
513 | 504 | } catch (Exception e) { |
514 | | - Log_OC.e(TAG, "Custom Tab login URL launch failed: " + e); |
| 505 | + Log_OC.e(TAG, "Auth Tab login URL launch failed: " + e); |
515 | 506 | } |
516 | 507 |
|
517 | 508 | try { |
@@ -1578,6 +1569,11 @@ private void startQRScanner() { |
1578 | 1569 | qrScanResultLauncher.launch(intent); |
1579 | 1570 | } |
1580 | 1571 |
|
| 1572 | + private final ActivityResultLauncher<Intent> authTabResultLauncher = AuthTabIntent.registerActivityResultLauncher( |
| 1573 | + this, |
| 1574 | + result -> Log_OC.d(TAG, "Auth Tab result code: " + result.resultCode) |
| 1575 | + ); |
| 1576 | + |
1581 | 1577 | private final ActivityResultLauncher<Intent> qrScanResultLauncher = registerForActivityResult( |
1582 | 1578 | new ActivityResultContracts.StartActivityForResult(), |
1583 | 1579 | result -> { |
|
0 commit comments