Skip to content
This repository has been archived by the owner on Oct 5, 2024. It is now read-only.

Commit

Permalink
- Dependencies updated
Browse files Browse the repository at this point in the history
- Renamed Claims.Full_Name to Claims.FULL_NAME
- Added an extra logging information.
  • Loading branch information
stevdza-san committed Jul 21, 2024
1 parent 1e38adf commit 3872ac2
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 55 deletions.
18 changes: 8 additions & 10 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id 'org.jetbrains.kotlin.plugin.compose'
}

android {
Expand Down Expand Up @@ -36,9 +37,6 @@ android {
buildFeatures {
compose true
}
composeOptions {
kotlinCompilerExtensionVersion '1.5.5'
}
packagingOptions {
resources {
excludes += '/META-INF/{AL2.0,LGPL2.1}'
Expand All @@ -47,17 +45,17 @@ android {
}

dependencies {
implementation platform('androidx.compose:compose-bom:2023.10.01')
implementation platform('androidx.compose:compose-bom:2024.06.00')

implementation 'androidx.core:core-ktx:1.12.0'
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.6.2'
implementation 'androidx.activity:activity-compose:1.8.1'
implementation 'androidx.core:core-ktx:1.13.1'
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.8.3'
implementation 'androidx.activity:activity-compose:1.9.0'
implementation "androidx.compose.ui:ui"
implementation "androidx.compose.ui:ui-tooling-preview"
implementation 'androidx.compose.material3:material3:1.2.0-beta01'
implementation 'androidx.compose.material3:material3:1.2.1'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
androidTestImplementation 'androidx.test.ext:junit:1.2.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1'
androidTestImplementation "androidx.compose.ui:ui-test-junit4"
debugImplementation "androidx.compose.ui:ui-tooling"
debugImplementation "androidx.compose.ui:ui-test-manifest"
Expand Down
7 changes: 4 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
plugins {
id 'com.android.application' version '8.2.0' apply false
id 'com.android.library' version '8.2.0' apply false
id 'org.jetbrains.kotlin.android' version '1.9.20' apply false
id 'com.android.application' version '8.2.2' apply false
id 'com.android.library' version '8.2.2' apply false
id 'org.jetbrains.kotlin.android' version '2.0.0' apply false
id 'org.jetbrains.kotlin.plugin.compose' version '2.0.0' apply false
}
22 changes: 10 additions & 12 deletions onetap/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
plugins {
id 'com.android.library'
id 'org.jetbrains.kotlin.android'
id 'org.jetbrains.kotlin.plugin.compose'
id 'maven-publish'
}

Expand Down Expand Up @@ -32,9 +33,6 @@ android {
buildFeatures {
compose true
}
composeOptions {
kotlinCompilerExtensionVersion '1.5.5'
}
publishing {
singleVariant("release") {
withSourcesJar()
Expand All @@ -45,21 +43,21 @@ android {

dependencies {
// Compose
implementation 'androidx.activity:activity-compose:1.8.2'
implementation("androidx.compose.material3:material3:1.1.2")
debugImplementation("androidx.compose.ui:ui-tooling:1.5.4")
implementation("androidx.compose.ui:ui-tooling-preview:1.5.4")
implementation 'androidx.activity:activity-compose:1.9.0'
implementation("androidx.compose.material3:material3:1.2.1")
debugImplementation("androidx.compose.ui:ui-tooling:1.6.8")
implementation("androidx.compose.ui:ui-tooling-preview:1.6.8")

// Contains the core Credential Manager functionalities including password
// and passkey support.
implementation("androidx.credentials:credentials:1.3.0-alpha01")
implementation("androidx.credentials:credentials:1.3.0-rc01")
// Provides support from Google Play services for Credential Manager,
// which lets you use the APIs on older devices.
implementation("androidx.credentials:credentials-play-services-auth:1.3.0-alpha01")
implementation("com.google.android.libraries.identity.googleid:googleid:1.1.0")
implementation("androidx.credentials:credentials-play-services-auth:1.3.0-rc01")
implementation("com.google.android.libraries.identity.googleid:googleid:1.1.1")

// Google Auth
implementation("com.google.android.gms:play-services-auth:20.6.0")
implementation("com.google.android.gms:play-services-auth:21.2.0")

// JWT Decoder
implementation("com.auth0.android:jwtdecode:2.0.2")
Expand All @@ -74,7 +72,7 @@ publishing {
release(MavenPublication) {
groupId = 'com.github.stevdza-san'
artifactId = 'OneTapCompose'
version = '1.0.12'
version = '1.0.13'

afterEvaluate {
from components.release
Expand Down
2 changes: 1 addition & 1 deletion onetap/src/main/java/com/stevdzasan/onetap/Claims.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ object Claims {
const val SUB = "sub"
const val EMAIL = "email"
const val EMAIL_VERIFIED = "email_verified"
const val FUll_NAME = "name"
const val FULL_NAME = "name"
const val GIVEN_NAME = "given_name"
const val FAMILY_NAME = "family_name"
const val PICTURE = "picture"
Expand Down
2 changes: 1 addition & 1 deletion onetap/src/main/java/com/stevdzasan/onetap/GoogleUser.kt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ fun getUserFromTokenId(tokenId: String): GoogleUser? {
sub = jwt.claims[Claims.SUB]?.asString(),
email = jwt.claims[Claims.EMAIL]?.asString(),
emailVerified = jwt.claims[Claims.EMAIL_VERIFIED]?.asBoolean(),
fullName = jwt.claims[Claims.FUll_NAME]?.asString(),
fullName = jwt.claims[Claims.FULL_NAME]?.asString(),
givenName = jwt.claims[Claims.GIVEN_NAME]?.asString(),
familyName = jwt.claims[Claims.FAMILY_NAME]?.asString(),
picture = jwt.claims[Claims.PICTURE]?.asString(),
Expand Down
54 changes: 26 additions & 28 deletions onetap/src/main/java/com/stevdzasan/onetap/OneTapCompose.kt
Original file line number Diff line number Diff line change
Expand Up @@ -105,26 +105,24 @@ fun OneTapSignInWithGoogle(
onTokenIdReceived = onTokenIdReceived,
onDialogDismissed = onDialogDismissed
)
}
} else {
try {
val errorMessage = if (e.message != null) {
if (e.message!!.contains("activity is cancelled by the user.")) {
"Dialog Closed."
} else if (e.message!!.contains("Caller has been temporarily blocked")) {
"Sign in has been Temporarily Blocked due to too many Closed Prompts."
} else {
e.message.toString()
}
} else "Unknown Error."
Log.e(TAG, errorMessage)
onDialogDismissed(errorMessage)
state.close()
} catch (e: Exception) {
Log.e(TAG, "${e.message}")
} else {
Log.e(TAG, "GetCredentialException: $e")
onDialogDismissed("${e.message}")
state.close()
}
} else {
val errorMessage = if (e.message != null) {
if (e.message!!.contains("activity is cancelled by the user.")) {
"Dialog Closed."
} else if (e.message!!.contains("Caller has been temporarily blocked")) {
"Sign in has been Temporarily Blocked due to too many Closed Prompts."
} else {
e.message.toString()
}
} else "Unknown Error."
Log.e(TAG, "Message null: $errorMessage")
onDialogDismissed(errorMessage)
state.close()
}
} catch (e: Exception) {
if (e.message != null) {
Expand All @@ -138,9 +136,13 @@ fun OneTapSignInWithGoogle(
onTokenIdReceived = onTokenIdReceived,
onDialogDismissed = onDialogDismissed
)
} else {
Log.e(TAG, "handleSignIn() Error: $e")
onDialogDismissed("${e.message}")
state.close()
}
} else {
Log.e(TAG, "${e.message}")
Log.e(TAG, "Message null: $e")
onDialogDismissed("${e.message}")
state.close()
}
Expand Down Expand Up @@ -226,30 +228,26 @@ private suspend fun handleCredentialsNotAvailable(
e.message.toString()
}
} else "Unknown Error."
Log.e(TAG, errorMessage)
Log.e(TAG, "GetCredentialException Error $errorMessage")
onDialogDismissed(errorMessage)
state.close()
} catch (e: Exception) {
Log.e(TAG, "${e.message}")
Log.e(TAG, "HandleCredentialNotAvailable Error: $e")
onDialogDismissed("${e.message}")
state.close()
}
} catch (e: Exception) {
Log.e(TAG, "${e.message}")
Log.e(TAG, "HandleCredentialNotAvailable Error 2: $e")
onDialogDismissed("${e.message}")
state.close()
}
}

fun openGoogleAccountSettings(context: Context) {
try {
val addAccountIntent = Intent(Settings.ACTION_ADD_ACCOUNT).apply {
putExtra(Settings.EXTRA_ACCOUNT_TYPES, arrayOf("com.google"))
}
context.startActivity(addAccountIntent)
} catch (e: Exception) {
Log.e(TAG, "openGoogleAccountSettings Error: $e")
val addAccountIntent = Intent(Settings.ACTION_ADD_ACCOUNT).apply {
putExtra(Settings.EXTRA_ACCOUNT_TYPES, arrayOf("com.google"))
}
context.startActivity(addAccountIntent)
}

//@Composable
Expand Down

0 comments on commit 3872ac2

Please sign in to comment.