Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions packages/google_sign_in/google_sign_in_android/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
## NEXT
## 7.0.4

* Adds support for `hostedDomain` when authenticating.
* Updates minimum supported SDK version to Flutter 3.29/Dart 3.7.

## 7.0.3

* Updates kotlin version to 2.2.0 to enable gradle 8.11 support.

## 7.0.3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,16 +231,22 @@ public void getCredential(
}

String nonce = params.getNonce();
String hostedDomain = params.getHostedDomain();
GetCredentialRequest.Builder requestBuilder = new GetCredentialRequest.Builder();
if (params.getUseButtonFlow()) {
GetSignInWithGoogleOption.Builder optionBuilder =
new GetSignInWithGoogleOption.Builder(serverClientId);
if (hostedDomain != null) {
optionBuilder.setHostedDomainFilter(hostedDomain);
}
if (nonce != null) {
optionBuilder.setNonce(nonce);
}
requestBuilder.addCredentialOption(optionBuilder.build());
} else {
GetCredentialRequestGoogleIdOptionParams optionParams = params.getGoogleIdOptionParams();
// TODO(stuartmorgan): Add a hosted domain filter here if hosted
// domain support is added to GetGoogleIdOption in the future.
GetGoogleIdOption.Builder optionBuilder =
new GetGoogleIdOption.Builder()
.setFilterByAuthorizedAccounts(optionParams.getFilterToAuthorized())
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Autogenerated from Pigeon (v24.2.2), do not edit directly.
// Autogenerated from Pigeon (v26.0.1), do not edit directly.
// See also: https://pub.dev/packages/pigeon
@file:Suppress("UNCHECKED_CAST", "ArrayInDataClass")

Expand All @@ -15,18 +15,47 @@ import io.flutter.plugin.common.StandardMessageCodec
import java.io.ByteArrayOutputStream
import java.nio.ByteBuffer

private fun wrapResult(result: Any?): List<Any?> {
return listOf(result)
}
private object MessagesPigeonUtils {

fun wrapResult(result: Any?): List<Any?> {
return listOf(result)
}

private fun wrapError(exception: Throwable): List<Any?> {
return if (exception is FlutterError) {
listOf(exception.code, exception.message, exception.details)
} else {
listOf(
exception.javaClass.simpleName,
exception.toString(),
"Cause: " + exception.cause + ", Stacktrace: " + Log.getStackTraceString(exception))
fun wrapError(exception: Throwable): List<Any?> {
return if (exception is FlutterError) {
listOf(exception.code, exception.message, exception.details)
} else {
listOf(
exception.javaClass.simpleName,
exception.toString(),
"Cause: " + exception.cause + ", Stacktrace: " + Log.getStackTraceString(exception))
}
}

fun deepEquals(a: Any?, b: Any?): Boolean {
if (a is ByteArray && b is ByteArray) {
return a.contentEquals(b)
}
if (a is IntArray && b is IntArray) {
return a.contentEquals(b)
}
if (a is LongArray && b is LongArray) {
return a.contentEquals(b)
}
if (a is DoubleArray && b is DoubleArray) {
return a.contentEquals(b)
}
if (a is Array<*> && b is Array<*>) {
return a.size == b.size && a.indices.all { deepEquals(a[it], b[it]) }
}
if (a is List<*> && b is List<*>) {
return a.size == b.size && a.indices.all { deepEquals(a[it], b[it]) }
}
if (a is Map<*, *> && b is Map<*, *>) {
return a.size == b.size &&
a.all { (b as Map<Any?, Any?>).containsKey(it.key) && deepEquals(it.value, b[it.key]) }
}
return a == b
}
}

Expand Down Expand Up @@ -106,7 +135,7 @@ enum class AuthorizeFailureType(val raw: Int) {
}

/**
* The information necessary to build a an authorization request.
* The information necessary to build an authorization request.
*
* Corresponds to the native AuthorizationRequest object, but only contains the fields used by this
* plugin.
Expand Down Expand Up @@ -139,6 +168,18 @@ data class PlatformAuthorizationRequest(
serverClientIdForForcedRefreshToken,
)
}

override fun equals(other: Any?): Boolean {
if (other !is PlatformAuthorizationRequest) {
return false
}
if (this === other) {
return true
}
return MessagesPigeonUtils.deepEquals(toList(), other.toList())
}

override fun hashCode(): Int = toList().hashCode()
}

/**
Expand All @@ -163,15 +204,18 @@ data class GetCredentialRequestParams(
*/
val googleIdOptionParams: GetCredentialRequestGoogleIdOptionParams,
val serverClientId: String? = null,
val hostedDomain: String? = null,
val nonce: String? = null
) {
companion object {
fun fromList(pigeonVar_list: List<Any?>): GetCredentialRequestParams {
val useButtonFlow = pigeonVar_list[0] as Boolean
val googleIdOptionParams = pigeonVar_list[1] as GetCredentialRequestGoogleIdOptionParams
val serverClientId = pigeonVar_list[2] as String?
val nonce = pigeonVar_list[3] as String?
return GetCredentialRequestParams(useButtonFlow, googleIdOptionParams, serverClientId, nonce)
val hostedDomain = pigeonVar_list[3] as String?
val nonce = pigeonVar_list[4] as String?
return GetCredentialRequestParams(
useButtonFlow, googleIdOptionParams, serverClientId, hostedDomain, nonce)
}
}

Expand All @@ -180,9 +224,22 @@ data class GetCredentialRequestParams(
useButtonFlow,
googleIdOptionParams,
serverClientId,
hostedDomain,
nonce,
)
}

override fun equals(other: Any?): Boolean {
if (other !is GetCredentialRequestParams) {
return false
}
if (this === other) {
return true
}
return MessagesPigeonUtils.deepEquals(toList(), other.toList())
}

override fun hashCode(): Int = toList().hashCode()
}

/** Generated class from Pigeon that represents data sent in messages. */
Expand All @@ -204,6 +261,18 @@ data class GetCredentialRequestGoogleIdOptionParams(
autoSelectEnabled,
)
}

override fun equals(other: Any?): Boolean {
if (other !is GetCredentialRequestGoogleIdOptionParams) {
return false
}
if (this === other) {
return true
}
return MessagesPigeonUtils.deepEquals(toList(), other.toList())
}

override fun hashCode(): Int = toList().hashCode()
}

/**
Expand Down Expand Up @@ -242,6 +311,18 @@ data class PlatformGoogleIdTokenCredential(
profilePictureUri,
)
}

override fun equals(other: Any?): Boolean {
if (other !is PlatformGoogleIdTokenCredential) {
return false
}
if (this === other) {
return true
}
return MessagesPigeonUtils.deepEquals(toList(), other.toList())
}

override fun hashCode(): Int = toList().hashCode()
}

/**
Expand Down Expand Up @@ -284,6 +365,18 @@ data class GetCredentialFailure(
details,
)
}

override fun equals(other: Any?): Boolean {
if (other !is GetCredentialFailure) {
return false
}
if (this === other) {
return true
}
return MessagesPigeonUtils.deepEquals(toList(), other.toList())
}

override fun hashCode(): Int = toList().hashCode()
}

/**
Expand All @@ -305,6 +398,18 @@ data class GetCredentialSuccess(val credential: PlatformGoogleIdTokenCredential)
credential,
)
}

override fun equals(other: Any?): Boolean {
if (other !is GetCredentialSuccess) {
return false
}
if (this === other) {
return true
}
return MessagesPigeonUtils.deepEquals(toList(), other.toList())
}

override fun hashCode(): Int = toList().hashCode()
}

/**
Expand Down Expand Up @@ -343,6 +448,18 @@ data class AuthorizeFailure(
details,
)
}

override fun equals(other: Any?): Boolean {
if (other !is AuthorizeFailure) {
return false
}
if (this === other) {
return true
}
return MessagesPigeonUtils.deepEquals(toList(), other.toList())
}

override fun hashCode(): Int = toList().hashCode()
}

/**
Expand Down Expand Up @@ -373,6 +490,18 @@ data class PlatformAuthorizationResult(
grantedScopes,
)
}

override fun equals(other: Any?): Boolean {
if (other !is PlatformAuthorizationResult) {
return false
}
if (this === other) {
return true
}
return MessagesPigeonUtils.deepEquals(toList(), other.toList())
}

override fun hashCode(): Int = toList().hashCode()
}

private open class MessagesPigeonCodec : StandardMessageCodec() {
Expand Down Expand Up @@ -510,7 +639,7 @@ interface GoogleSignInApi {
try {
listOf(api.getGoogleServicesJsonServerClientId())
} catch (exception: Throwable) {
wrapError(exception)
MessagesPigeonUtils.wrapError(exception)
}
reply.reply(wrapped)
}
Expand All @@ -531,10 +660,10 @@ interface GoogleSignInApi {
api.getCredential(paramsArg) { result: Result<GetCredentialResult> ->
val error = result.exceptionOrNull()
if (error != null) {
reply.reply(wrapError(error))
reply.reply(MessagesPigeonUtils.wrapError(error))
} else {
val data = result.getOrNull()
reply.reply(wrapResult(data))
reply.reply(MessagesPigeonUtils.wrapResult(data))
}
}
}
Expand All @@ -553,9 +682,9 @@ interface GoogleSignInApi {
api.clearCredentialState { result: Result<Unit> ->
val error = result.exceptionOrNull()
if (error != null) {
reply.reply(wrapError(error))
reply.reply(MessagesPigeonUtils.wrapError(error))
} else {
reply.reply(wrapResult(null))
reply.reply(MessagesPigeonUtils.wrapResult(null))
}
}
}
Expand All @@ -577,10 +706,10 @@ interface GoogleSignInApi {
api.authorize(paramsArg, promptIfUnauthorizedArg) { result: Result<AuthorizeResult> ->
val error = result.exceptionOrNull()
if (error != null) {
reply.reply(wrapError(error))
reply.reply(MessagesPigeonUtils.wrapError(error))
} else {
val data = result.getOrNull()
reply.reply(wrapResult(data))
reply.reply(MessagesPigeonUtils.wrapResult(data))
}
}
}
Expand Down
Loading