Open Kitsu auth activity
This commit is contained in:
@@ -158,13 +158,21 @@
|
||||
<data android:host="shikimori-auth" />
|
||||
<data android:host="anilist-auth" />
|
||||
<data android:host="mal-auth" />
|
||||
<data android:host="kitsu-auth" />
|
||||
</intent-filter>
|
||||
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".scrobbling.kitsu.ui.KitsuAuthActivity"
|
||||
android:exported="false"
|
||||
android:label="@string/kitsu" />
|
||||
android:label="@string/kitsu"
|
||||
tools:ignore="AppLinkUrlError">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<data android:scheme="kotatsu+kitsu" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<service
|
||||
android:name="org.koitharu.kotatsu.download.ui.service.DownloadService"
|
||||
|
||||
@@ -29,7 +29,7 @@ class KitsuRepository(
|
||||
private val clientId = context.getString(R.string.kitsu_clientId)
|
||||
private val clientSecret = context.getString(R.string.kitsu_clientSecret)
|
||||
|
||||
override val oauthUrl: String = ""
|
||||
override val oauthUrl: String = "kotatsu+kitsu://auth"
|
||||
|
||||
override val isAuthorized: Boolean
|
||||
get() = storage.accessToken != null
|
||||
|
||||
@@ -15,10 +15,10 @@ import org.koitharu.kotatsu.R
|
||||
import org.koitharu.kotatsu.base.ui.BasePreferenceFragment
|
||||
import org.koitharu.kotatsu.core.prefs.AppSettings
|
||||
import org.koitharu.kotatsu.scrobbling.anilist.data.AniListRepository
|
||||
import org.koitharu.kotatsu.scrobbling.common.data.ScrobblerRepository
|
||||
import org.koitharu.kotatsu.scrobbling.common.domain.model.ScrobblerService
|
||||
import org.koitharu.kotatsu.scrobbling.common.ui.config.ScrobblerConfigActivity
|
||||
import org.koitharu.kotatsu.scrobbling.kitsu.data.KitsuRepository
|
||||
import org.koitharu.kotatsu.scrobbling.kitsu.ui.KitsuAuthActivity
|
||||
import org.koitharu.kotatsu.scrobbling.mal.data.MALRepository
|
||||
import org.koitharu.kotatsu.scrobbling.shikimori.data.ShikimoriRepository
|
||||
import org.koitharu.kotatsu.sync.domain.SyncController
|
||||
@@ -119,7 +119,7 @@ class ServicesSettingsFragment : BasePreferenceFragment(R.string.services) {
|
||||
|
||||
private fun bindScrobblerSummary(
|
||||
key: String,
|
||||
repository: org.koitharu.kotatsu.scrobbling.common.data.ScrobblerRepository
|
||||
repository: ScrobblerRepository
|
||||
) {
|
||||
val pref = findPreference<Preference>(key) ?: return
|
||||
if (!repository.isAuthorized) {
|
||||
@@ -145,11 +145,8 @@ class ServicesSettingsFragment : BasePreferenceFragment(R.string.services) {
|
||||
}
|
||||
}
|
||||
|
||||
private fun launchScrobblerAuth(repository: org.koitharu.kotatsu.scrobbling.common.data.ScrobblerRepository) {
|
||||
private fun launchScrobblerAuth(repository: ScrobblerRepository) {
|
||||
runCatching {
|
||||
if (repository.oauthUrl.isBlank()) {
|
||||
startActivity(KitsuAuthActivity.newIntent(requireContext()))
|
||||
}
|
||||
val intent = Intent(Intent.ACTION_VIEW)
|
||||
intent.data = Uri.parse(repository.oauthUrl)
|
||||
startActivity(intent)
|
||||
|
||||
Reference in New Issue
Block a user