Skip to content

Commit 3972a8e

Browse files
committed
Fix deprecation
1 parent 7ed2c3d commit 3972a8e

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

flutter_web_auth_2/android/src/main/kotlin/com/linusu/flutter_web_auth_2/AuthenticationManagementActivity.kt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import android.app.Activity
44
import android.content.Context
55
import android.content.Intent
66
import android.net.Uri
7+
import android.os.Build
78
import android.os.Bundle
89
import androidx.browser.customtabs.CustomTabsIntent
910

@@ -78,8 +79,13 @@ class AuthenticationManagementActivity(
7879
return
7980
}
8081
authStarted = state.getBoolean(KEY_AUTH_STARTED, false)
81-
authenticationUri = state.getParcelable(KEY_AUTH_URI)!!
82+
authenticationUri = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
83+
state.getParcelable(KEY_AUTH_URI, Uri::class.java)
84+
} else {
85+
@Suppress("deprecation")
86+
state.getParcelable(KEY_AUTH_URI)
87+
} ?: throw IllegalStateException("Authentication URI is null")
8288
intentFlags = state.getInt(KEY_AUTH_OPTION_INTENT_FLAGS, 0)
8389
targetPackage = state.getString(KEY_AUTH_OPTION_TARGET_PACKAGE)
8490
}
85-
}
91+
}

0 commit comments

Comments
 (0)