Skip to content

Commit

Permalink
Fix deeplink
Browse files Browse the repository at this point in the history
  • Loading branch information
imashnake0 committed Mar 26, 2024
1 parent 4d31a4b commit d227568
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:scheme="jinnah"
android:scheme="app"
android:host="animite" />
</intent-filter>
</activity>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ import com.ramcosta.composedestinations.annotation.Destination
import com.ramcosta.composedestinations.annotation.RootNavGraph
import com.imashnake.animite.core.R as coreR

@Suppress("LongMethod")
@Suppress("LongMethod", "UNUSED_PARAMETER")
@Destination(
route = "user",
deepLinks = [
Expand All @@ -60,15 +60,20 @@ import com.imashnake.animite.core.R as coreR
@Composable
fun ProfileScreen(
viewModel: ProfileViewModel = hiltViewModel(),
accessToken: String? = null
accessToken: String? = null,
tokenType: String? = null,
// TODO: Log user out if token expires.
expiresIn: Int? = null
) {
accessToken?.let { viewModel.setAccessToken(it) }
val isLoggedIn by viewModel.isLoggedIn.collectAsState(initial = false)
val viewer by viewModel.viewer.collectAsState()

Box(
contentAlignment = Alignment.Center,
modifier = Modifier.fillMaxSize().background(MaterialTheme.colorScheme.background)
modifier = Modifier
.fillMaxSize()
.background(MaterialTheme.colorScheme.background)
) {
when {
isLoggedIn -> viewer.data?.run {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.imashnake.animite.profile.dev.internal

const val ANILIST_AUTH_DEEPLINK = "app://animite#access_token={accessToken}&token_type=Bearer&expires_in=31622400"
const val ANILIST_AUTH_URL = "https://anilist.co/api/v2/oauth/authorize?client_id=17347&response_type=token"
const val ANILIST_AUTH_DEEPLINK = "app://animite#access_token={accessToken}&token_type={tokenType}&expires_in={expiresIn}"
const val ANILIST_AUTH_URL = "https://anilist.co/api/v2/oauth/authorize?client_id=17716&response_type=token"

0 comments on commit d227568

Please sign in to comment.