mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
Removed androidx.browser
This commit is contained in:
parent
9e85359ad3
commit
09f0a1b0b6
3 changed files with 8 additions and 13 deletions
|
@ -283,7 +283,6 @@ dependencies {
|
|||
implementation("androidx.palette:palette-ktx:1.0.0")
|
||||
|
||||
implementation("org.skyscreamer:jsonassert:1.2.3")
|
||||
implementation("androidx.browser:browser:1.4.0")
|
||||
implementation("com.google.api-client:google-api-client:2.0.0") {
|
||||
exclude(
|
||||
group = "org.apache.httpcomponents",
|
||||
|
|
|
@ -3,7 +3,6 @@ package com.lagradost.cloudstream3.syncproviders.providers
|
|||
import android.content.Context
|
||||
import android.net.Uri
|
||||
import android.util.Log
|
||||
import androidx.browser.customtabs.CustomTabsIntent
|
||||
import androidx.fragment.app.FragmentActivity
|
||||
import com.google.api.client.auth.oauth2.AuthorizationCodeFlow
|
||||
import com.google.api.client.auth.oauth2.Credential
|
||||
|
@ -19,6 +18,7 @@ import com.google.api.services.drive.DriveScopes
|
|||
import com.google.api.services.drive.model.File
|
||||
import com.lagradost.cloudstream3.AcraApplication
|
||||
import com.lagradost.cloudstream3.AcraApplication.Companion.getKey
|
||||
import com.lagradost.cloudstream3.AcraApplication.Companion.openBrowser
|
||||
import com.lagradost.cloudstream3.AcraApplication.Companion.removeKey
|
||||
import com.lagradost.cloudstream3.AcraApplication.Companion.setKey
|
||||
import com.lagradost.cloudstream3.CommonActivity
|
||||
|
@ -133,6 +133,7 @@ class GoogleDriveApi(index: Int) :
|
|||
data.clientId
|
||||
)
|
||||
|
||||
registerAccount()
|
||||
storeValue(K.TOKEN, googleTokenResponse)
|
||||
storeValue(K.IS_READY, true)
|
||||
|
||||
|
@ -202,7 +203,8 @@ class GoogleDriveApi(index: Int) :
|
|||
data: InAppOAuth2API.LoginData
|
||||
) {
|
||||
val credential = loginInfo()
|
||||
if (credential != null) {
|
||||
// Repeated attempts will not switch account because IS_READY is false
|
||||
if (credential != null && getValue<Boolean>(K.IS_READY) != false) {
|
||||
switchToNewAccount()
|
||||
}
|
||||
|
||||
|
@ -213,13 +215,9 @@ class GoogleDriveApi(index: Int) :
|
|||
this.tempAuthFlow = authFlow
|
||||
|
||||
try {
|
||||
registerAccount()
|
||||
|
||||
val url = authFlow.newAuthorizationUrl().setRedirectUri(data.redirectUrl).build()
|
||||
val customTabIntent = CustomTabsIntent.Builder().setShowTitle(true).build()
|
||||
customTabIntent.launchUrl(activity, Uri.parse(url))
|
||||
} catch (e: Exception) {
|
||||
switchToOldAccount()
|
||||
openBrowser(url)
|
||||
} catch (e: Throwable) {
|
||||
CommonActivity.showToast(
|
||||
activity,
|
||||
activity.getString(R.string.authenticated_user_fail).format(name)
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
package com.lagradost.cloudstream3.ui.settings.helpers.settings.account
|
||||
|
||||
import android.net.Uri
|
||||
import android.view.View
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.browser.customtabs.CustomTabsIntent
|
||||
import androidx.core.view.isGone
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.fragment.app.FragmentActivity
|
||||
import com.lagradost.cloudstream3.AcraApplication.Companion.openBrowser
|
||||
import com.lagradost.cloudstream3.R
|
||||
import com.lagradost.cloudstream3.databinding.AddAccountInputOauthBinding
|
||||
import com.lagradost.cloudstream3.syncproviders.InAppOAuth2API
|
||||
|
@ -40,8 +39,7 @@ class InAppOAuth2DialogBuilder(
|
|||
|
||||
infoButton.isGone = api.infoUrl.isNullOrBlank()
|
||||
infoButton.setOnClickListener {
|
||||
val customTabIntent = CustomTabsIntent.Builder().setShowTitle(true).build()
|
||||
customTabIntent.launchUrl(binding.root.context, Uri.parse(api.infoUrl))
|
||||
api.infoUrl?.let { url -> openBrowser(url) }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue