From ec6bbd113adcaca4931130fb789a0694c11bf973 Mon Sep 17 00:00:00 2001 From: Tyler-Larkin Date: Sun, 1 Dec 2024 17:25:27 -0800 Subject: [PATCH 01/11] chore(datastore,analytics,auth,notifications,storage): updated/regenerated pigeon MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -renamed setup to setUp in various locations -added pigeonVar_binaryMessenger and pigeonVar_messageChannelSuffix to AmplifyNativeLegacyWrapper -renamed PigeonLegacyDataProvider to PinpointLegacyDataProvider (API can’t start with Pigeon) -updated signInWithUrl’s return value (this was updated 3 years ago) --- .../pigeons/NativePluginBindings.kt | 533 +++++++++------ .../pigeons/NativePluginBindings.swift | 643 +++++++++++------- .../lib/amplify_datastore.dart | 4 +- .../lib/src/native_plugin.g.dart | 633 ++++++++++------- packages/amplify_datastore/pubspec.yaml | 2 +- .../pigeons/LegacyNativePluginPigeon.kt | 39 +- .../Pigeons/AmplifyNativeLegacyPlugin.swift | 114 +++- .../lib/amplify_native_legacy_plugin.g.dart | 171 +++-- .../lib/amplify_native_legacy_wrapper.dart | 9 + .../pubspec.yaml | 2 +- .../amplify_analytics_pinpoint/Messages.java | 73 +- .../AmplifyAnalyticsPinpointPlugin.kt | 6 +- .../data_provider.android.dart | 5 +- ...pigeon_legacy_data_provider.android.g.dart | 88 ++- .../pigeons/pigeon_config_android.dart | 2 +- .../amplify_analytics_pinpoint/pubspec.yaml | 2 +- .../pigeons/NativeAuthPluginBindingsPigeon.kt | 212 +++--- .../darwin/Classes/pigeons/messages.g.swift | 275 +++++--- .../native_auth_bridge_test.dart | 6 +- .../Flutter/GeneratedPluginRegistrant.swift | 2 - .../lib/src/auth_plugin_impl.dart | 2 +- .../lib/src/native_auth_plugin.g.dart | 476 +++++++------ .../auth/amplify_auth_cognito/pubspec.yaml | 2 +- .../test/hosted_ui_platform_flutter_test.dart | 2 +- .../PushNotificationsHostApiBindings.java | 278 +++++--- .../Classes/PushNotificationsNativePlugin.h | 31 +- .../Classes/PushNotificationsNativePlugin.m | 260 ++++--- .../native_push_notifications_plugin.g.dart | 385 ++++++----- .../src/push_notifications_flutter_api.dart | 4 +- .../amplify_push_notifications/pubspec.yaml | 2 +- .../pigeons/AmplifySecureStoragePigeon.kt | 35 +- .../pigeons/NSUserDefaultsPigeon.swift | 74 +- .../amplify_secure_storage_pigeon.g.dart | 180 +++-- .../pigeons/ns_user_defaults_pigeon.g.dart | 115 ++-- .../pigeons/NSUserDefaultsPigeon.swift | 74 +- .../amplify_secure_storage/pubspec.yaml | 2 +- .../amplify_storage_s3_dart/pubspec.yaml | 4 +- pubspec.yaml | 2 +- 38 files changed, 2829 insertions(+), 1920 deletions(-) diff --git a/packages/amplify_datastore/android/src/main/kotlin/com/amazonaws/amplify/amplify_datastore/pigeons/NativePluginBindings.kt b/packages/amplify_datastore/android/src/main/kotlin/com/amazonaws/amplify/amplify_datastore/pigeons/NativePluginBindings.kt index 6b936216b1..725df140ba 100644 --- a/packages/amplify_datastore/android/src/main/kotlin/com/amazonaws/amplify/amplify_datastore/pigeons/NativePluginBindings.kt +++ b/packages/amplify_datastore/android/src/main/kotlin/com/amazonaws/amplify/amplify_datastore/pigeons/NativePluginBindings.kt @@ -1,8 +1,9 @@ -// +// // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 -// Autogenerated from Pigeon (v11.0.1), do not edit directly. +// Autogenerated from Pigeon (v22.6.2), do not edit directly. // See also: https://pub.dev/packages/pigeon +@file:Suppress("UNCHECKED_CAST", "ArrayInDataClass") package com.amazonaws.amplify.amplify_datastore.pigeons @@ -19,14 +20,14 @@ private fun wrapResult(result: Any?): List { } private fun wrapError(exception: Throwable): List { - if (exception is FlutterError) { - return listOf( + return if (exception is FlutterError) { + listOf( exception.code, exception.message, exception.details ) } else { - return listOf( + listOf( exception.javaClass.simpleName, exception.toString(), "Cause: " + exception.cause + ", Stacktrace: " + Log.getStackTraceString(exception) @@ -34,6 +35,9 @@ private fun wrapError(exception: Throwable): List { } } +private fun createConnectionError(channelName: String): FlutterError { + return FlutterError("channel-error", "Unable to establish connection on channel: '$channelName'.", "")} + /** * Error class for passing custom error details to Flutter via a thrown PlatformException. * @property code The error code. @@ -53,30 +57,25 @@ data class NativeAuthSession ( val userPoolTokens: NativeUserPoolTokens? = null, val identityId: String? = null, val awsCredentials: NativeAWSCredentials? = null - -) { +) + { companion object { - @Suppress("UNCHECKED_CAST") - fun fromList(list: List): NativeAuthSession { - val isSignedIn = list[0] as Boolean - val userSub = list[1] as String? - val userPoolTokens: NativeUserPoolTokens? = (list[2] as List?)?.let { - NativeUserPoolTokens.fromList(it) - } - val identityId = list[3] as String? - val awsCredentials: NativeAWSCredentials? = (list[4] as List?)?.let { - NativeAWSCredentials.fromList(it) - } + fun fromList(pigeonVar_list: List): NativeAuthSession { + val isSignedIn = pigeonVar_list[0] as Boolean + val userSub = pigeonVar_list[1] as String? + val userPoolTokens = pigeonVar_list[2] as NativeUserPoolTokens? + val identityId = pigeonVar_list[3] as String? + val awsCredentials = pigeonVar_list[4] as NativeAWSCredentials? return NativeAuthSession(isSignedIn, userSub, userPoolTokens, identityId, awsCredentials) } } fun toList(): List { - return listOf( + return listOf( isSignedIn, userSub, - userPoolTokens?.toList(), + userPoolTokens, identityId, - awsCredentials?.toList(), + awsCredentials, ) } } @@ -85,18 +84,17 @@ data class NativeAuthSession ( data class NativeAuthUser ( val userId: String, val username: String - -) { +) + { companion object { - @Suppress("UNCHECKED_CAST") - fun fromList(list: List): NativeAuthUser { - val userId = list[0] as String - val username = list[1] as String + fun fromList(pigeonVar_list: List): NativeAuthUser { + val userId = pigeonVar_list[0] as String + val username = pigeonVar_list[1] as String return NativeAuthUser(userId, username) } } fun toList(): List { - return listOf( + return listOf( userId, username, ) @@ -108,19 +106,18 @@ data class NativeUserPoolTokens ( val accessToken: String, val refreshToken: String, val idToken: String - -) { +) + { companion object { - @Suppress("UNCHECKED_CAST") - fun fromList(list: List): NativeUserPoolTokens { - val accessToken = list[0] as String - val refreshToken = list[1] as String - val idToken = list[2] as String + fun fromList(pigeonVar_list: List): NativeUserPoolTokens { + val accessToken = pigeonVar_list[0] as String + val refreshToken = pigeonVar_list[1] as String + val idToken = pigeonVar_list[2] as String return NativeUserPoolTokens(accessToken, refreshToken, idToken) } } fun toList(): List { - return listOf( + return listOf( accessToken, refreshToken, idToken, @@ -134,20 +131,19 @@ data class NativeAWSCredentials ( val secretAccessKey: String, val sessionToken: String? = null, val expirationIso8601Utc: String? = null - -) { +) + { companion object { - @Suppress("UNCHECKED_CAST") - fun fromList(list: List): NativeAWSCredentials { - val accessKeyId = list[0] as String - val secretAccessKey = list[1] as String - val sessionToken = list[2] as String? - val expirationIso8601Utc = list[3] as String? + fun fromList(pigeonVar_list: List): NativeAWSCredentials { + val accessKeyId = pigeonVar_list[0] as String + val secretAccessKey = pigeonVar_list[1] as String + val sessionToken = pigeonVar_list[2] as String? + val expirationIso8601Utc = pigeonVar_list[3] as String? return NativeAWSCredentials(accessKeyId, secretAccessKey, sessionToken, expirationIso8601Utc) } } fun toList(): List { - return listOf( + return listOf( accessKeyId, secretAccessKey, sessionToken, @@ -156,20 +152,58 @@ data class NativeAWSCredentials ( } } +/** Generated class from Pigeon that represents data sent in messages. */ +data class LegacyCredentialStoreData ( + val identityId: String? = null, + val accessKeyId: String? = null, + val secretAccessKey: String? = null, + val sessionToken: String? = null, + val expirationMsSinceEpoch: Long? = null, + val accessToken: String? = null, + val refreshToken: String? = null, + val idToken: String? = null +) + { + companion object { + fun fromList(pigeonVar_list: List): LegacyCredentialStoreData { + val identityId = pigeonVar_list[0] as String? + val accessKeyId = pigeonVar_list[1] as String? + val secretAccessKey = pigeonVar_list[2] as String? + val sessionToken = pigeonVar_list[3] as String? + val expirationMsSinceEpoch = pigeonVar_list[4] as Long? + val accessToken = pigeonVar_list[5] as String? + val refreshToken = pigeonVar_list[6] as String? + val idToken = pigeonVar_list[7] as String? + return LegacyCredentialStoreData(identityId, accessKeyId, secretAccessKey, sessionToken, expirationMsSinceEpoch, accessToken, refreshToken, idToken) + } + } + fun toList(): List { + return listOf( + identityId, + accessKeyId, + secretAccessKey, + sessionToken, + expirationMsSinceEpoch, + accessToken, + refreshToken, + idToken, + ) + } +} + /** Generated class from Pigeon that represents data sent in messages. */ data class NativeGraphQLResponse ( val payloadJson: String? = null - -) { +) + { companion object { - @Suppress("UNCHECKED_CAST") - fun fromList(list: List): NativeGraphQLResponse { - val payloadJson = list[0] as String? + fun fromList(pigeonVar_list: List): NativeGraphQLResponse { + val payloadJson = pigeonVar_list[0] as String? return NativeGraphQLResponse(payloadJson) } } fun toList(): List { - return listOf( + return listOf( payloadJson, ) } @@ -180,19 +214,18 @@ data class NativeGraphQLSubscriptionResponse ( val type: String, val subscriptionId: String, val payloadJson: String? = null - -) { +) + { companion object { - @Suppress("UNCHECKED_CAST") - fun fromList(list: List): NativeGraphQLSubscriptionResponse { - val type = list[0] as String - val subscriptionId = list[1] as String - val payloadJson = list[2] as String? + fun fromList(pigeonVar_list: List): NativeGraphQLSubscriptionResponse { + val type = pigeonVar_list[0] as String + val subscriptionId = pigeonVar_list[1] as String + val payloadJson = pigeonVar_list[2] as String? return NativeGraphQLSubscriptionResponse(type, subscriptionId, payloadJson) } } fun toList(): List { - return listOf( + return listOf( type, subscriptionId, payloadJson, @@ -209,23 +242,22 @@ data class NativeGraphQLRequest ( val decodePath: String? = null, val options: String? = null, val authMode: String? = null - -) { +) + { companion object { - @Suppress("UNCHECKED_CAST") - fun fromList(list: List): NativeGraphQLRequest { - val document = list[0] as String - val apiName = list[1] as String? - val variablesJson = list[2] as String? - val responseType = list[3] as String? - val decodePath = list[4] as String? - val options = list[5] as String? - val authMode = list[6] as String? + fun fromList(pigeonVar_list: List): NativeGraphQLRequest { + val document = pigeonVar_list[0] as String + val apiName = pigeonVar_list[1] as String? + val variablesJson = pigeonVar_list[2] as String? + val responseType = pigeonVar_list[3] as String? + val decodePath = pigeonVar_list[4] as String? + val options = pigeonVar_list[5] as String? + val authMode = pigeonVar_list[6] as String? return NativeGraphQLRequest(document, apiName, variablesJson, responseType, decodePath, options, authMode) } } fun toList(): List { - return listOf( + return listOf( document, apiName, variablesJson, @@ -236,167 +268,264 @@ data class NativeGraphQLRequest ( ) } } - -@Suppress("UNCHECKED_CAST") -private object NativeAuthPluginCodec : StandardMessageCodec() { +private open class NativePluginBindingsPigeonCodec : StandardMessageCodec() { override fun readValueOfType(type: Byte, buffer: ByteBuffer): Any? { return when (type) { - 128.toByte() -> { - return (readValue(buffer) as? List)?.let { - NativeAWSCredentials.fromList(it) - } - } 129.toByte() -> { return (readValue(buffer) as? List)?.let { NativeAuthSession.fromList(it) } } 130.toByte() -> { + return (readValue(buffer) as? List)?.let { + NativeAuthUser.fromList(it) + } + } + 131.toByte() -> { return (readValue(buffer) as? List)?.let { NativeUserPoolTokens.fromList(it) } } + 132.toByte() -> { + return (readValue(buffer) as? List)?.let { + NativeAWSCredentials.fromList(it) + } + } + 133.toByte() -> { + return (readValue(buffer) as? List)?.let { + LegacyCredentialStoreData.fromList(it) + } + } + 134.toByte() -> { + return (readValue(buffer) as? List)?.let { + NativeGraphQLResponse.fromList(it) + } + } + 135.toByte() -> { + return (readValue(buffer) as? List)?.let { + NativeGraphQLSubscriptionResponse.fromList(it) + } + } + 136.toByte() -> { + return (readValue(buffer) as? List)?.let { + NativeGraphQLRequest.fromList(it) + } + } else -> super.readValueOfType(type, buffer) } } override fun writeValue(stream: ByteArrayOutputStream, value: Any?) { when (value) { - is NativeAWSCredentials -> { - stream.write(128) - writeValue(stream, value.toList()) - } is NativeAuthSession -> { stream.write(129) writeValue(stream, value.toList()) } - is NativeUserPoolTokens -> { + is NativeAuthUser -> { stream.write(130) writeValue(stream, value.toList()) } + is NativeUserPoolTokens -> { + stream.write(131) + writeValue(stream, value.toList()) + } + is NativeAWSCredentials -> { + stream.write(132) + writeValue(stream, value.toList()) + } + is LegacyCredentialStoreData -> { + stream.write(133) + writeValue(stream, value.toList()) + } + is NativeGraphQLResponse -> { + stream.write(134) + writeValue(stream, value.toList()) + } + is NativeGraphQLSubscriptionResponse -> { + stream.write(135) + writeValue(stream, value.toList()) + } + is NativeGraphQLRequest -> { + stream.write(136) + writeValue(stream, value.toList()) + } else -> super.writeValue(stream, value) } } } + /** * Bridge for calling Auth from Native into Flutter * * Generated class from Pigeon that represents Flutter messages that can be called from Kotlin. */ -@Suppress("UNCHECKED_CAST") -class NativeAuthPlugin(private val binaryMessenger: BinaryMessenger) { +class NativeAuthPlugin(private val binaryMessenger: BinaryMessenger, private val messageChannelSuffix: String = "") { companion object { /** The codec used by NativeAuthPlugin. */ val codec: MessageCodec by lazy { - NativeAuthPluginCodec + NativePluginBindingsPigeonCodec() } } - fun fetchAuthSession(callback: (NativeAuthSession) -> Unit) { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.amplify_datastore.NativeAuthPlugin.fetchAuthSession", codec) + fun fetchAuthSession(callback: (Result) -> Unit) +{ + val separatedMessageChannelSuffix = if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" + val channelName = "dev.flutter.pigeon.amplify_datastore.NativeAuthPlugin.fetchAuthSession$separatedMessageChannelSuffix" + val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(null) { - val result = it as NativeAuthSession - callback(result) - } - } -} -@Suppress("UNCHECKED_CAST") -private object NativeApiPluginCodec : StandardMessageCodec() { - override fun readValueOfType(type: Byte, buffer: ByteBuffer): Any? { - return when (type) { - 128.toByte() -> { - return (readValue(buffer) as? List)?.let { - NativeGraphQLRequest.fromList(it) - } - } - 129.toByte() -> { - return (readValue(buffer) as? List)?.let { - NativeGraphQLResponse.fromList(it) - } - } - 130.toByte() -> { - return (readValue(buffer) as? List)?.let { - NativeGraphQLSubscriptionResponse.fromList(it) + if (it is List<*>) { + if (it.size > 1) { + callback(Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) + } else if (it[0] == null) { + callback(Result.failure(FlutterError("null-error", "Flutter api returned null value for non-null return value.", ""))) + } else { + val output = it[0] as NativeAuthSession + callback(Result.success(output)) } - } - else -> super.readValueOfType(type, buffer) - } - } - override fun writeValue(stream: ByteArrayOutputStream, value: Any?) { - when (value) { - is NativeGraphQLRequest -> { - stream.write(128) - writeValue(stream, value.toList()) - } - is NativeGraphQLResponse -> { - stream.write(129) - writeValue(stream, value.toList()) - } - is NativeGraphQLSubscriptionResponse -> { - stream.write(130) - writeValue(stream, value.toList()) - } - else -> super.writeValue(stream, value) + } else { + callback(Result.failure(createConnectionError(channelName))) + } } } } - /** * Bridge for calling API plugin from Native into Flutter * * Generated class from Pigeon that represents Flutter messages that can be called from Kotlin. */ -@Suppress("UNCHECKED_CAST") -class NativeApiPlugin(private val binaryMessenger: BinaryMessenger) { +class NativeApiPlugin(private val binaryMessenger: BinaryMessenger, private val messageChannelSuffix: String = "") { companion object { /** The codec used by NativeApiPlugin. */ val codec: MessageCodec by lazy { - NativeApiPluginCodec + NativePluginBindingsPigeonCodec() } } - fun getLatestAuthToken(providerNameArg: String, callback: (String?) -> Unit) { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.amplify_datastore.NativeApiPlugin.getLatestAuthToken", codec) + fun getLatestAuthToken(providerNameArg: String, callback: (Result) -> Unit) +{ + val separatedMessageChannelSuffix = if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" + val channelName = "dev.flutter.pigeon.amplify_datastore.NativeApiPlugin.getLatestAuthToken$separatedMessageChannelSuffix" + val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(providerNameArg)) { - val result = it as String? - callback(result) + if (it is List<*>) { + if (it.size > 1) { + callback(Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) + } else { + val output = it[0] as String? + callback(Result.success(output)) + } + } else { + callback(Result.failure(createConnectionError(channelName))) + } } } - fun mutate(requestArg: NativeGraphQLRequest, callback: (NativeGraphQLResponse) -> Unit) { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.amplify_datastore.NativeApiPlugin.mutate", codec) + fun mutate(requestArg: NativeGraphQLRequest, callback: (Result) -> Unit) +{ + val separatedMessageChannelSuffix = if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" + val channelName = "dev.flutter.pigeon.amplify_datastore.NativeApiPlugin.mutate$separatedMessageChannelSuffix" + val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(requestArg)) { - val result = it as NativeGraphQLResponse - callback(result) + if (it is List<*>) { + if (it.size > 1) { + callback(Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) + } else if (it[0] == null) { + callback(Result.failure(FlutterError("null-error", "Flutter api returned null value for non-null return value.", ""))) + } else { + val output = it[0] as NativeGraphQLResponse + callback(Result.success(output)) + } + } else { + callback(Result.failure(createConnectionError(channelName))) + } } } - fun query(requestArg: NativeGraphQLRequest, callback: (NativeGraphQLResponse) -> Unit) { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.amplify_datastore.NativeApiPlugin.query", codec) + fun query(requestArg: NativeGraphQLRequest, callback: (Result) -> Unit) +{ + val separatedMessageChannelSuffix = if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" + val channelName = "dev.flutter.pigeon.amplify_datastore.NativeApiPlugin.query$separatedMessageChannelSuffix" + val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(requestArg)) { - val result = it as NativeGraphQLResponse - callback(result) + if (it is List<*>) { + if (it.size > 1) { + callback(Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) + } else if (it[0] == null) { + callback(Result.failure(FlutterError("null-error", "Flutter api returned null value for non-null return value.", ""))) + } else { + val output = it[0] as NativeGraphQLResponse + callback(Result.success(output)) + } + } else { + callback(Result.failure(createConnectionError(channelName))) + } } } - fun subscribe(requestArg: NativeGraphQLRequest, callback: (NativeGraphQLSubscriptionResponse) -> Unit) { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.amplify_datastore.NativeApiPlugin.subscribe", codec) + fun subscribe(requestArg: NativeGraphQLRequest, callback: (Result) -> Unit) +{ + val separatedMessageChannelSuffix = if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" + val channelName = "dev.flutter.pigeon.amplify_datastore.NativeApiPlugin.subscribe$separatedMessageChannelSuffix" + val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(requestArg)) { - val result = it as NativeGraphQLSubscriptionResponse - callback(result) + if (it is List<*>) { + if (it.size > 1) { + callback(Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) + } else if (it[0] == null) { + callback(Result.failure(FlutterError("null-error", "Flutter api returned null value for non-null return value.", ""))) + } else { + val output = it[0] as NativeGraphQLSubscriptionResponse + callback(Result.success(output)) + } + } else { + callback(Result.failure(createConnectionError(channelName))) + } } } - fun unsubscribe(subscriptionIdArg: String, callback: () -> Unit) { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.amplify_datastore.NativeApiPlugin.unsubscribe", codec) + fun unsubscribe(subscriptionIdArg: String, callback: (Result) -> Unit) +{ + val separatedMessageChannelSuffix = if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" + val channelName = "dev.flutter.pigeon.amplify_datastore.NativeApiPlugin.unsubscribe$separatedMessageChannelSuffix" + val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(subscriptionIdArg)) { - callback() + if (it is List<*>) { + if (it.size > 1) { + callback(Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) + } else { + callback(Result.success(Unit)) + } + } else { + callback(Result.failure(createConnectionError(channelName))) + } } } - fun deviceOffline(callback: () -> Unit) { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.amplify_datastore.NativeApiPlugin.deviceOffline", codec) + fun deviceOffline(callback: (Result) -> Unit) +{ + val separatedMessageChannelSuffix = if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" + val channelName = "dev.flutter.pigeon.amplify_datastore.NativeApiPlugin.deviceOffline$separatedMessageChannelSuffix" + val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(null) { - callback() + if (it is List<*>) { + if (it.size > 1) { + callback(Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) + } else { + callback(Result.success(Unit)) + } + } else { + callback(Result.failure(createConnectionError(channelName))) + } } } - fun onStop(callback: () -> Unit) { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.amplify_datastore.NativeApiPlugin.onStop", codec) + fun onStop(callback: (Result) -> Unit) +{ + val separatedMessageChannelSuffix = if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" + val channelName = "dev.flutter.pigeon.amplify_datastore.NativeApiPlugin.onStop$separatedMessageChannelSuffix" + val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(null) { - callback() + if (it is List<*>) { + if (it.size > 1) { + callback(Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) + } else { + callback(Result.success(Unit)) + } + } else { + callback(Result.failure(createConnectionError(channelName))) + } } } } @@ -411,13 +540,14 @@ interface NativeAmplifyBridge { companion object { /** The codec used by NativeAmplifyBridge. */ val codec: MessageCodec by lazy { - StandardMessageCodec() + NativePluginBindingsPigeonCodec() } /** Sets up an instance of `NativeAmplifyBridge` to handle messages through the `binaryMessenger`. */ - @Suppress("UNCHECKED_CAST") - fun setUp(binaryMessenger: BinaryMessenger, api: NativeAmplifyBridge?) { + @JvmOverloads + fun setUp(binaryMessenger: BinaryMessenger, api: NativeAmplifyBridge?, messageChannelSuffix: String = "") { + val separatedMessageChannelSuffix = if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.amplify_datastore.NativeAmplifyBridge.configure", codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.amplify_datastore.NativeAmplifyBridge.configure$separatedMessageChannelSuffix", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List @@ -439,29 +569,6 @@ interface NativeAmplifyBridge { } } } -@Suppress("UNCHECKED_CAST") -private object NativeAuthBridgeCodec : StandardMessageCodec() { - override fun readValueOfType(type: Byte, buffer: ByteBuffer): Any? { - return when (type) { - 128.toByte() -> { - return (readValue(buffer) as? List)?.let { - NativeAuthUser.fromList(it) - } - } - else -> super.readValueOfType(type, buffer) - } - } - override fun writeValue(stream: ByteArrayOutputStream, value: Any?) { - when (value) { - is NativeAuthUser -> { - stream.write(128) - writeValue(stream, value.toList()) - } - else -> super.writeValue(stream, value) - } - } -} - /** * Bridge for calling Auth plugin from Flutter into Native * @@ -474,16 +581,17 @@ interface NativeAuthBridge { companion object { /** The codec used by NativeAuthBridge. */ val codec: MessageCodec by lazy { - NativeAuthBridgeCodec + NativePluginBindingsPigeonCodec() } /** Sets up an instance of `NativeAuthBridge` to handle messages through the `binaryMessenger`. */ - @Suppress("UNCHECKED_CAST") - fun setUp(binaryMessenger: BinaryMessenger, api: NativeAuthBridge?) { + @JvmOverloads + fun setUp(binaryMessenger: BinaryMessenger, api: NativeAuthBridge?, messageChannelSuffix: String = "") { + val separatedMessageChannelSuffix = if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.amplify_datastore.NativeAuthBridge.addAuthPlugin", codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.amplify_datastore.NativeAuthBridge.addAuthPlugin$separatedMessageChannelSuffix", codec) if (api != null) { channel.setMessageHandler { _, reply -> - api.addAuthPlugin() { result: Result -> + api.addAuthPlugin{ result: Result -> val error = result.exceptionOrNull() if (error != null) { reply.reply(wrapError(error)) @@ -497,17 +605,16 @@ interface NativeAuthBridge { } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.amplify_datastore.NativeAuthBridge.updateCurrentUser", codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.amplify_datastore.NativeAuthBridge.updateCurrentUser$separatedMessageChannelSuffix", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val userArg = args[0] as NativeAuthUser? - var wrapped: List - try { + val wrapped: List = try { api.updateCurrentUser(userArg) - wrapped = listOf(null) + listOf(null) } catch (exception: Throwable) { - wrapped = wrapError(exception) + wrapError(exception) } reply.reply(wrapped) } @@ -518,29 +625,6 @@ interface NativeAuthBridge { } } } -@Suppress("UNCHECKED_CAST") -private object NativeApiBridgeCodec : StandardMessageCodec() { - override fun readValueOfType(type: Byte, buffer: ByteBuffer): Any? { - return when (type) { - 128.toByte() -> { - return (readValue(buffer) as? List)?.let { - NativeGraphQLSubscriptionResponse.fromList(it) - } - } - else -> super.readValueOfType(type, buffer) - } - } - override fun writeValue(stream: ByteArrayOutputStream, value: Any?) { - when (value) { - is NativeGraphQLSubscriptionResponse -> { - stream.write(128) - writeValue(stream, value.toList()) - } - else -> super.writeValue(stream, value) - } - } -} - /** * Bridge for calling API methods from Flutter into Native * @@ -553,13 +637,14 @@ interface NativeApiBridge { companion object { /** The codec used by NativeApiBridge. */ val codec: MessageCodec by lazy { - NativeApiBridgeCodec + NativePluginBindingsPigeonCodec() } /** Sets up an instance of `NativeApiBridge` to handle messages through the `binaryMessenger`. */ - @Suppress("UNCHECKED_CAST") - fun setUp(binaryMessenger: BinaryMessenger, api: NativeApiBridge?) { + @JvmOverloads + fun setUp(binaryMessenger: BinaryMessenger, api: NativeApiBridge?, messageChannelSuffix: String = "") { + val separatedMessageChannelSuffix = if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.amplify_datastore.NativeApiBridge.addApiPlugin", codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.amplify_datastore.NativeApiBridge.addApiPlugin$separatedMessageChannelSuffix", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List @@ -579,7 +664,7 @@ interface NativeApiBridge { } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.amplify_datastore.NativeApiBridge.sendSubscriptionEvent", codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.amplify_datastore.NativeApiBridge.sendSubscriptionEvent$separatedMessageChannelSuffix", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List diff --git a/packages/amplify_datastore/ios/Classes/pigeons/NativePluginBindings.swift b/packages/amplify_datastore/ios/Classes/pigeons/NativePluginBindings.swift index df1b268a75..cfd8646841 100644 --- a/packages/amplify_datastore/ios/Classes/pigeons/NativePluginBindings.swift +++ b/packages/amplify_datastore/ios/Classes/pigeons/NativePluginBindings.swift @@ -1,20 +1,35 @@ -// +// // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 -// Autogenerated from Pigeon (v11.0.1), do not edit directly. +// Autogenerated from Pigeon (v22.6.2), do not edit directly. // See also: https://pub.dev/packages/pigeon import Foundation + #if os(iOS) -import Flutter + import Flutter #elseif os(macOS) -import FlutterMacOS + import FlutterMacOS #else -#error("Unsupported platform.") + #error("Unsupported platform.") #endif -private func isNullish(_ value: Any?) -> Bool { - return value is NSNull || value == nil +/// Error class for passing custom error details to Dart side. +final class PigeonError: Error { + let code: String + let message: String? + let details: Any? + + init(code: String, message: String?, details: Any?) { + self.code = code + self.message = message + self.details = details + } + + var localizedDescription: String { + return + "PigeonError(code: \(code), message: \(message ?? ""), details: \(details ?? "")" + } } private func wrapResult(_ result: Any?) -> [Any?] { @@ -22,20 +37,35 @@ private func wrapResult(_ result: Any?) -> [Any?] { } private func wrapError(_ error: Any) -> [Any?] { + if let pigeonError = error as? PigeonError { + return [ + pigeonError.code, + pigeonError.message, + pigeonError.details, + ] + } if let flutterError = error as? FlutterError { return [ flutterError.code, flutterError.message, - flutterError.details + flutterError.details, ] } return [ "\(error)", "\(type(of: error))", - "Stacktrace: \(Thread.callStackSymbols)" + "Stacktrace: \(Thread.callStackSymbols)", ] } +private func createConnectionError(withChannelName channelName: String) -> PigeonError { + return PigeonError(code: "channel-error", message: "Unable to establish connection on channel: '\(channelName)'.", details: "") +} + +private func isNullish(_ value: Any?) -> Bool { + return value is NSNull || value == nil +} + private func nilOrValue(_ value: Any?) -> T? { if value is NSNull { return nil } return value as! T? @@ -49,18 +79,15 @@ struct NativeAuthSession { var identityId: String? = nil var awsCredentials: NativeAWSCredentials? = nil - static func fromList(_ list: [Any?]) -> NativeAuthSession? { - let isSignedIn = list[0] as! Bool - let userSub: String? = nilOrValue(list[1]) - var userPoolTokens: NativeUserPoolTokens? = nil - if let userPoolTokensList: [Any?] = nilOrValue(list[2]) { - userPoolTokens = NativeUserPoolTokens.fromList(userPoolTokensList) - } - let identityId: String? = nilOrValue(list[3]) - var awsCredentials: NativeAWSCredentials? = nil - if let awsCredentialsList: [Any?] = nilOrValue(list[4]) { - awsCredentials = NativeAWSCredentials.fromList(awsCredentialsList) - } + + + // swift-format-ignore: AlwaysUseLowerCamelCase + static func fromList(_ pigeonVar_list: [Any?]) -> NativeAuthSession? { + let isSignedIn = pigeonVar_list[0] as! Bool + let userSub: String? = nilOrValue(pigeonVar_list[1]) + let userPoolTokens: NativeUserPoolTokens? = nilOrValue(pigeonVar_list[2]) + let identityId: String? = nilOrValue(pigeonVar_list[3]) + let awsCredentials: NativeAWSCredentials? = nilOrValue(pigeonVar_list[4]) return NativeAuthSession( isSignedIn: isSignedIn, @@ -74,9 +101,9 @@ struct NativeAuthSession { return [ isSignedIn, userSub, - userPoolTokens?.toList(), + userPoolTokens, identityId, - awsCredentials?.toList(), + awsCredentials, ] } } @@ -86,9 +113,12 @@ struct NativeAuthUser { var userId: String var username: String - static func fromList(_ list: [Any?]) -> NativeAuthUser? { - let userId = list[0] as! String - let username = list[1] as! String + + + // swift-format-ignore: AlwaysUseLowerCamelCase + static func fromList(_ pigeonVar_list: [Any?]) -> NativeAuthUser? { + let userId = pigeonVar_list[0] as! String + let username = pigeonVar_list[1] as! String return NativeAuthUser( userId: userId, @@ -109,10 +139,13 @@ struct NativeUserPoolTokens { var refreshToken: String var idToken: String - static func fromList(_ list: [Any?]) -> NativeUserPoolTokens? { - let accessToken = list[0] as! String - let refreshToken = list[1] as! String - let idToken = list[2] as! String + + + // swift-format-ignore: AlwaysUseLowerCamelCase + static func fromList(_ pigeonVar_list: [Any?]) -> NativeUserPoolTokens? { + let accessToken = pigeonVar_list[0] as! String + let refreshToken = pigeonVar_list[1] as! String + let idToken = pigeonVar_list[2] as! String return NativeUserPoolTokens( accessToken: accessToken, @@ -136,11 +169,14 @@ struct NativeAWSCredentials { var sessionToken: String? = nil var expirationIso8601Utc: String? = nil - static func fromList(_ list: [Any?]) -> NativeAWSCredentials? { - let accessKeyId = list[0] as! String - let secretAccessKey = list[1] as! String - let sessionToken: String? = nilOrValue(list[2]) - let expirationIso8601Utc: String? = nilOrValue(list[3]) + + + // swift-format-ignore: AlwaysUseLowerCamelCase + static func fromList(_ pigeonVar_list: [Any?]) -> NativeAWSCredentials? { + let accessKeyId = pigeonVar_list[0] as! String + let secretAccessKey = pigeonVar_list[1] as! String + let sessionToken: String? = nilOrValue(pigeonVar_list[2]) + let expirationIso8601Utc: String? = nilOrValue(pigeonVar_list[3]) return NativeAWSCredentials( accessKeyId: accessKeyId, @@ -159,12 +195,64 @@ struct NativeAWSCredentials { } } +/// Generated class from Pigeon that represents data sent in messages. +struct LegacyCredentialStoreData { + var identityId: String? = nil + var accessKeyId: String? = nil + var secretAccessKey: String? = nil + var sessionToken: String? = nil + var expirationMsSinceEpoch: Int64? = nil + var accessToken: String? = nil + var refreshToken: String? = nil + var idToken: String? = nil + + + + // swift-format-ignore: AlwaysUseLowerCamelCase + static func fromList(_ pigeonVar_list: [Any?]) -> LegacyCredentialStoreData? { + let identityId: String? = nilOrValue(pigeonVar_list[0]) + let accessKeyId: String? = nilOrValue(pigeonVar_list[1]) + let secretAccessKey: String? = nilOrValue(pigeonVar_list[2]) + let sessionToken: String? = nilOrValue(pigeonVar_list[3]) + let expirationMsSinceEpoch: Int64? = nilOrValue(pigeonVar_list[4]) + let accessToken: String? = nilOrValue(pigeonVar_list[5]) + let refreshToken: String? = nilOrValue(pigeonVar_list[6]) + let idToken: String? = nilOrValue(pigeonVar_list[7]) + + return LegacyCredentialStoreData( + identityId: identityId, + accessKeyId: accessKeyId, + secretAccessKey: secretAccessKey, + sessionToken: sessionToken, + expirationMsSinceEpoch: expirationMsSinceEpoch, + accessToken: accessToken, + refreshToken: refreshToken, + idToken: idToken + ) + } + func toList() -> [Any?] { + return [ + identityId, + accessKeyId, + secretAccessKey, + sessionToken, + expirationMsSinceEpoch, + accessToken, + refreshToken, + idToken, + ] + } +} + /// Generated class from Pigeon that represents data sent in messages. struct NativeGraphQLResponse { var payloadJson: String? = nil - static func fromList(_ list: [Any?]) -> NativeGraphQLResponse? { - let payloadJson: String? = nilOrValue(list[0]) + + + // swift-format-ignore: AlwaysUseLowerCamelCase + static func fromList(_ pigeonVar_list: [Any?]) -> NativeGraphQLResponse? { + let payloadJson: String? = nilOrValue(pigeonVar_list[0]) return NativeGraphQLResponse( payloadJson: payloadJson @@ -172,7 +260,7 @@ struct NativeGraphQLResponse { } func toList() -> [Any?] { return [ - payloadJson, + payloadJson ] } } @@ -183,10 +271,13 @@ struct NativeGraphQLSubscriptionResponse { var subscriptionId: String var payloadJson: String? = nil - static func fromList(_ list: [Any?]) -> NativeGraphQLSubscriptionResponse? { - let type = list[0] as! String - let subscriptionId = list[1] as! String - let payloadJson: String? = nilOrValue(list[2]) + + + // swift-format-ignore: AlwaysUseLowerCamelCase + static func fromList(_ pigeonVar_list: [Any?]) -> NativeGraphQLSubscriptionResponse? { + let type = pigeonVar_list[0] as! String + let subscriptionId = pigeonVar_list[1] as! String + let payloadJson: String? = nilOrValue(pigeonVar_list[2]) return NativeGraphQLSubscriptionResponse( type: type, @@ -213,14 +304,17 @@ struct NativeGraphQLRequest { var options: String? = nil var authMode: String? = nil - static func fromList(_ list: [Any?]) -> NativeGraphQLRequest? { - let document = list[0] as! String - let apiName: String? = nilOrValue(list[1]) - let variablesJson: String? = nilOrValue(list[2]) - let responseType: String? = nilOrValue(list[3]) - let decodePath: String? = nilOrValue(list[4]) - let options: String? = nilOrValue(list[5]) - let authMode: String? = nilOrValue(list[6]) + + + // swift-format-ignore: AlwaysUseLowerCamelCase + static func fromList(_ pigeonVar_list: [Any?]) -> NativeGraphQLRequest? { + let document = pigeonVar_list[0] as! String + let apiName: String? = nilOrValue(pigeonVar_list[1]) + let variablesJson: String? = nilOrValue(pigeonVar_list[2]) + let responseType: String? = nilOrValue(pigeonVar_list[3]) + let decodePath: String? = nilOrValue(pigeonVar_list[4]) + let options: String? = nilOrValue(pigeonVar_list[5]) + let authMode: String? = nilOrValue(pigeonVar_list[6]) return NativeGraphQLRequest( document: document, @@ -245,172 +339,272 @@ struct NativeGraphQLRequest { } } -private class NativeAuthPluginCodecReader: FlutterStandardReader { +private class NativePluginBindingsPigeonCodecReader: FlutterStandardReader { override func readValue(ofType type: UInt8) -> Any? { switch type { - case 128: - return NativeAWSCredentials.fromList(self.readValue() as! [Any?]) - case 129: - return NativeAuthSession.fromList(self.readValue() as! [Any?]) - case 130: - return NativeUserPoolTokens.fromList(self.readValue() as! [Any?]) - default: - return super.readValue(ofType: type) + case 129: + return NativeAuthSession.fromList(self.readValue() as! [Any?]) + case 130: + return NativeAuthUser.fromList(self.readValue() as! [Any?]) + case 131: + return NativeUserPoolTokens.fromList(self.readValue() as! [Any?]) + case 132: + return NativeAWSCredentials.fromList(self.readValue() as! [Any?]) + case 133: + return LegacyCredentialStoreData.fromList(self.readValue() as! [Any?]) + case 134: + return NativeGraphQLResponse.fromList(self.readValue() as! [Any?]) + case 135: + return NativeGraphQLSubscriptionResponse.fromList(self.readValue() as! [Any?]) + case 136: + return NativeGraphQLRequest.fromList(self.readValue() as! [Any?]) + default: + return super.readValue(ofType: type) } } } -private class NativeAuthPluginCodecWriter: FlutterStandardWriter { +private class NativePluginBindingsPigeonCodecWriter: FlutterStandardWriter { override func writeValue(_ value: Any) { - if let value = value as? NativeAWSCredentials { - super.writeByte(128) - super.writeValue(value.toList()) - } else if let value = value as? NativeAuthSession { + if let value = value as? NativeAuthSession { super.writeByte(129) super.writeValue(value.toList()) - } else if let value = value as? NativeUserPoolTokens { + } else if let value = value as? NativeAuthUser { super.writeByte(130) super.writeValue(value.toList()) + } else if let value = value as? NativeUserPoolTokens { + super.writeByte(131) + super.writeValue(value.toList()) + } else if let value = value as? NativeAWSCredentials { + super.writeByte(132) + super.writeValue(value.toList()) + } else if let value = value as? LegacyCredentialStoreData { + super.writeByte(133) + super.writeValue(value.toList()) + } else if let value = value as? NativeGraphQLResponse { + super.writeByte(134) + super.writeValue(value.toList()) + } else if let value = value as? NativeGraphQLSubscriptionResponse { + super.writeByte(135) + super.writeValue(value.toList()) + } else if let value = value as? NativeGraphQLRequest { + super.writeByte(136) + super.writeValue(value.toList()) } else { super.writeValue(value) } } } -private class NativeAuthPluginCodecReaderWriter: FlutterStandardReaderWriter { +private class NativePluginBindingsPigeonCodecReaderWriter: FlutterStandardReaderWriter { override func reader(with data: Data) -> FlutterStandardReader { - return NativeAuthPluginCodecReader(data: data) + return NativePluginBindingsPigeonCodecReader(data: data) } override func writer(with data: NSMutableData) -> FlutterStandardWriter { - return NativeAuthPluginCodecWriter(data: data) + return NativePluginBindingsPigeonCodecWriter(data: data) } } -class NativeAuthPluginCodec: FlutterStandardMessageCodec { - static let shared = NativeAuthPluginCodec(readerWriter: NativeAuthPluginCodecReaderWriter()) +class NativePluginBindingsPigeonCodec: FlutterStandardMessageCodec, @unchecked Sendable { + static let shared = NativePluginBindingsPigeonCodec(readerWriter: NativePluginBindingsPigeonCodecReaderWriter()) } + /// Bridge for calling Auth from Native into Flutter /// -/// Generated class from Pigeon that represents Flutter messages that can be called from Swift. -class NativeAuthPlugin { +/// Generated protocol from Pigeon that represents Flutter messages that can be called from Swift. +protocol NativeAuthPluginProtocol { + func fetchAuthSession(completion: @escaping (Result) -> Void) +} +class NativeAuthPlugin: NativeAuthPluginProtocol { private let binaryMessenger: FlutterBinaryMessenger - init(binaryMessenger: FlutterBinaryMessenger){ + private let messageChannelSuffix: String + init(binaryMessenger: FlutterBinaryMessenger, messageChannelSuffix: String = "") { self.binaryMessenger = binaryMessenger + self.messageChannelSuffix = messageChannelSuffix.count > 0 ? ".\(messageChannelSuffix)" : "" } - var codec: FlutterStandardMessageCodec { - return NativeAuthPluginCodec.shared + var codec: NativePluginBindingsPigeonCodec { + return NativePluginBindingsPigeonCodec.shared } - func fetchAuthSession(completion: @escaping (NativeAuthSession) -> Void) { - let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.amplify_datastore.NativeAuthPlugin.fetchAuthSession", binaryMessenger: binaryMessenger, codec: codec) + func fetchAuthSession(completion: @escaping (Result) -> Void) { + let channelName: String = "dev.flutter.pigeon.amplify_datastore.NativeAuthPlugin.fetchAuthSession\(messageChannelSuffix)" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage(nil) { response in - let result = response as! NativeAuthSession - completion(result) - } - } -} -private class NativeApiPluginCodecReader: FlutterStandardReader { - override func readValue(ofType type: UInt8) -> Any? { - switch type { - case 128: - return NativeGraphQLRequest.fromList(self.readValue() as! [Any?]) - case 129: - return NativeGraphQLResponse.fromList(self.readValue() as! [Any?]) - case 130: - return NativeGraphQLSubscriptionResponse.fromList(self.readValue() as! [Any?]) - default: - return super.readValue(ofType: type) - } - } -} - -private class NativeApiPluginCodecWriter: FlutterStandardWriter { - override func writeValue(_ value: Any) { - if let value = value as? NativeGraphQLRequest { - super.writeByte(128) - super.writeValue(value.toList()) - } else if let value = value as? NativeGraphQLResponse { - super.writeByte(129) - super.writeValue(value.toList()) - } else if let value = value as? NativeGraphQLSubscriptionResponse { - super.writeByte(130) - super.writeValue(value.toList()) - } else { - super.writeValue(value) + guard let listResponse = response as? [Any?] else { + completion(.failure(createConnectionError(withChannelName: channelName))) + return + } + if listResponse.count > 1 { + let code: String = listResponse[0] as! String + let message: String? = nilOrValue(listResponse[1]) + let details: String? = nilOrValue(listResponse[2]) + completion(.failure(PigeonError(code: code, message: message, details: details))) + } else if listResponse[0] == nil { + completion(.failure(PigeonError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + } else { + let result = listResponse[0] as! NativeAuthSession + completion(.success(result)) + } } } } - -private class NativeApiPluginCodecReaderWriter: FlutterStandardReaderWriter { - override func reader(with data: Data) -> FlutterStandardReader { - return NativeApiPluginCodecReader(data: data) - } - - override func writer(with data: NSMutableData) -> FlutterStandardWriter { - return NativeApiPluginCodecWriter(data: data) - } -} - -class NativeApiPluginCodec: FlutterStandardMessageCodec { - static let shared = NativeApiPluginCodec(readerWriter: NativeApiPluginCodecReaderWriter()) -} - /// Bridge for calling API plugin from Native into Flutter /// -/// Generated class from Pigeon that represents Flutter messages that can be called from Swift. -class NativeApiPlugin { +/// Generated protocol from Pigeon that represents Flutter messages that can be called from Swift. +protocol NativeApiPluginProtocol { + func getLatestAuthToken(providerName providerNameArg: String, completion: @escaping (Result) -> Void) + func mutate(request requestArg: NativeGraphQLRequest, completion: @escaping (Result) -> Void) + func query(request requestArg: NativeGraphQLRequest, completion: @escaping (Result) -> Void) + func subscribe(request requestArg: NativeGraphQLRequest, completion: @escaping (Result) -> Void) + func unsubscribe(subscriptionId subscriptionIdArg: String, completion: @escaping (Result) -> Void) + func deviceOffline(completion: @escaping (Result) -> Void) + func onStop(completion: @escaping (Result) -> Void) +} +class NativeApiPlugin: NativeApiPluginProtocol { private let binaryMessenger: FlutterBinaryMessenger - init(binaryMessenger: FlutterBinaryMessenger){ + private let messageChannelSuffix: String + init(binaryMessenger: FlutterBinaryMessenger, messageChannelSuffix: String = "") { self.binaryMessenger = binaryMessenger + self.messageChannelSuffix = messageChannelSuffix.count > 0 ? ".\(messageChannelSuffix)" : "" } - var codec: FlutterStandardMessageCodec { - return NativeApiPluginCodec.shared + var codec: NativePluginBindingsPigeonCodec { + return NativePluginBindingsPigeonCodec.shared } - func getLatestAuthToken(providerName providerNameArg: String, completion: @escaping (String?) -> Void) { - let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.amplify_datastore.NativeApiPlugin.getLatestAuthToken", binaryMessenger: binaryMessenger, codec: codec) + func getLatestAuthToken(providerName providerNameArg: String, completion: @escaping (Result) -> Void) { + let channelName: String = "dev.flutter.pigeon.amplify_datastore.NativeApiPlugin.getLatestAuthToken\(messageChannelSuffix)" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([providerNameArg] as [Any?]) { response in - let result: String? = nilOrValue(response) - completion(result) + guard let listResponse = response as? [Any?] else { + completion(.failure(createConnectionError(withChannelName: channelName))) + return + } + if listResponse.count > 1 { + let code: String = listResponse[0] as! String + let message: String? = nilOrValue(listResponse[1]) + let details: String? = nilOrValue(listResponse[2]) + completion(.failure(PigeonError(code: code, message: message, details: details))) + } else { + let result: String? = nilOrValue(listResponse[0]) + completion(.success(result)) + } } } - func mutate(request requestArg: NativeGraphQLRequest, completion: @escaping (NativeGraphQLResponse) -> Void) { - let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.amplify_datastore.NativeApiPlugin.mutate", binaryMessenger: binaryMessenger, codec: codec) + func mutate(request requestArg: NativeGraphQLRequest, completion: @escaping (Result) -> Void) { + let channelName: String = "dev.flutter.pigeon.amplify_datastore.NativeApiPlugin.mutate\(messageChannelSuffix)" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([requestArg] as [Any?]) { response in - let result = response as! NativeGraphQLResponse - completion(result) + guard let listResponse = response as? [Any?] else { + completion(.failure(createConnectionError(withChannelName: channelName))) + return + } + if listResponse.count > 1 { + let code: String = listResponse[0] as! String + let message: String? = nilOrValue(listResponse[1]) + let details: String? = nilOrValue(listResponse[2]) + completion(.failure(PigeonError(code: code, message: message, details: details))) + } else if listResponse[0] == nil { + completion(.failure(PigeonError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + } else { + let result = listResponse[0] as! NativeGraphQLResponse + completion(.success(result)) + } } } - func query(request requestArg: NativeGraphQLRequest, completion: @escaping (NativeGraphQLResponse) -> Void) { - let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.amplify_datastore.NativeApiPlugin.query", binaryMessenger: binaryMessenger, codec: codec) + func query(request requestArg: NativeGraphQLRequest, completion: @escaping (Result) -> Void) { + let channelName: String = "dev.flutter.pigeon.amplify_datastore.NativeApiPlugin.query\(messageChannelSuffix)" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([requestArg] as [Any?]) { response in - let result = response as! NativeGraphQLResponse - completion(result) + guard let listResponse = response as? [Any?] else { + completion(.failure(createConnectionError(withChannelName: channelName))) + return + } + if listResponse.count > 1 { + let code: String = listResponse[0] as! String + let message: String? = nilOrValue(listResponse[1]) + let details: String? = nilOrValue(listResponse[2]) + completion(.failure(PigeonError(code: code, message: message, details: details))) + } else if listResponse[0] == nil { + completion(.failure(PigeonError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + } else { + let result = listResponse[0] as! NativeGraphQLResponse + completion(.success(result)) + } } } - func subscribe(request requestArg: NativeGraphQLRequest, completion: @escaping (NativeGraphQLSubscriptionResponse) -> Void) { - let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.amplify_datastore.NativeApiPlugin.subscribe", binaryMessenger: binaryMessenger, codec: codec) + func subscribe(request requestArg: NativeGraphQLRequest, completion: @escaping (Result) -> Void) { + let channelName: String = "dev.flutter.pigeon.amplify_datastore.NativeApiPlugin.subscribe\(messageChannelSuffix)" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([requestArg] as [Any?]) { response in - let result = response as! NativeGraphQLSubscriptionResponse - completion(result) + guard let listResponse = response as? [Any?] else { + completion(.failure(createConnectionError(withChannelName: channelName))) + return + } + if listResponse.count > 1 { + let code: String = listResponse[0] as! String + let message: String? = nilOrValue(listResponse[1]) + let details: String? = nilOrValue(listResponse[2]) + completion(.failure(PigeonError(code: code, message: message, details: details))) + } else if listResponse[0] == nil { + completion(.failure(PigeonError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + } else { + let result = listResponse[0] as! NativeGraphQLSubscriptionResponse + completion(.success(result)) + } } } - func unsubscribe(subscriptionId subscriptionIdArg: String, completion: @escaping () -> Void) { - let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.amplify_datastore.NativeApiPlugin.unsubscribe", binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([subscriptionIdArg] as [Any?]) { _ in - completion() + func unsubscribe(subscriptionId subscriptionIdArg: String, completion: @escaping (Result) -> Void) { + let channelName: String = "dev.flutter.pigeon.amplify_datastore.NativeApiPlugin.unsubscribe\(messageChannelSuffix)" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([subscriptionIdArg] as [Any?]) { response in + guard let listResponse = response as? [Any?] else { + completion(.failure(createConnectionError(withChannelName: channelName))) + return + } + if listResponse.count > 1 { + let code: String = listResponse[0] as! String + let message: String? = nilOrValue(listResponse[1]) + let details: String? = nilOrValue(listResponse[2]) + completion(.failure(PigeonError(code: code, message: message, details: details))) + } else { + completion(.success(Void())) + } } } - func deviceOffline(completion: @escaping () -> Void) { - let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.amplify_datastore.NativeApiPlugin.deviceOffline", binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage(nil) { _ in - completion() + func deviceOffline(completion: @escaping (Result) -> Void) { + let channelName: String = "dev.flutter.pigeon.amplify_datastore.NativeApiPlugin.deviceOffline\(messageChannelSuffix)" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage(nil) { response in + guard let listResponse = response as? [Any?] else { + completion(.failure(createConnectionError(withChannelName: channelName))) + return + } + if listResponse.count > 1 { + let code: String = listResponse[0] as! String + let message: String? = nilOrValue(listResponse[1]) + let details: String? = nilOrValue(listResponse[2]) + completion(.failure(PigeonError(code: code, message: message, details: details))) + } else { + completion(.success(Void())) + } } } - func onStop(completion: @escaping () -> Void) { - let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.amplify_datastore.NativeApiPlugin.onStop", binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage(nil) { _ in - completion() + func onStop(completion: @escaping (Result) -> Void) { + let channelName: String = "dev.flutter.pigeon.amplify_datastore.NativeApiPlugin.onStop\(messageChannelSuffix)" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage(nil) { response in + guard let listResponse = response as? [Any?] else { + completion(.failure(createConnectionError(withChannelName: channelName))) + return + } + if listResponse.count > 1 { + let code: String = listResponse[0] as! String + let message: String? = nilOrValue(listResponse[1]) + let details: String? = nilOrValue(listResponse[2]) + completion(.failure(PigeonError(code: code, message: message, details: details))) + } else { + completion(.success(Void())) + } } } } @@ -423,10 +617,11 @@ protocol NativeAmplifyBridge { /// Generated setup class from Pigeon to handle messages through the `binaryMessenger`. class NativeAmplifyBridgeSetup { - /// The codec used by NativeAmplifyBridge. + static var codec: FlutterStandardMessageCodec { NativePluginBindingsPigeonCodec.shared } /// Sets up an instance of `NativeAmplifyBridge` to handle messages through the `binaryMessenger`. - static func setUp(binaryMessenger: FlutterBinaryMessenger, api: NativeAmplifyBridge?) { - let configureChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.amplify_datastore.NativeAmplifyBridge.configure", binaryMessenger: binaryMessenger) + static func setUp(binaryMessenger: FlutterBinaryMessenger, api: NativeAmplifyBridge?, messageChannelSuffix: String = "") { + let channelSuffix = messageChannelSuffix.count > 0 ? ".\(messageChannelSuffix)" : "" + let configureChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.amplify_datastore.NativeAmplifyBridge.configure\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) if let api = api { configureChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -434,10 +629,10 @@ class NativeAmplifyBridgeSetup { let configArg = args[1] as! String api.configure(version: versionArg, config: configArg) { result in switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -446,42 +641,6 @@ class NativeAmplifyBridgeSetup { } } } -private class NativeAuthBridgeCodecReader: FlutterStandardReader { - override func readValue(ofType type: UInt8) -> Any? { - switch type { - case 128: - return NativeAuthUser.fromList(self.readValue() as! [Any?]) - default: - return super.readValue(ofType: type) - } - } -} - -private class NativeAuthBridgeCodecWriter: FlutterStandardWriter { - override func writeValue(_ value: Any) { - if let value = value as? NativeAuthUser { - super.writeByte(128) - super.writeValue(value.toList()) - } else { - super.writeValue(value) - } - } -} - -private class NativeAuthBridgeCodecReaderWriter: FlutterStandardReaderWriter { - override func reader(with data: Data) -> FlutterStandardReader { - return NativeAuthBridgeCodecReader(data: data) - } - - override func writer(with data: NSMutableData) -> FlutterStandardWriter { - return NativeAuthBridgeCodecWriter(data: data) - } -} - -class NativeAuthBridgeCodec: FlutterStandardMessageCodec { - static let shared = NativeAuthBridgeCodec(readerWriter: NativeAuthBridgeCodecReaderWriter()) -} - /// Bridge for calling Auth plugin from Flutter into Native /// /// Generated protocol from Pigeon that represents a handler of messages from Flutter. @@ -492,26 +651,26 @@ protocol NativeAuthBridge { /// Generated setup class from Pigeon to handle messages through the `binaryMessenger`. class NativeAuthBridgeSetup { - /// The codec used by NativeAuthBridge. - static var codec: FlutterStandardMessageCodec { NativeAuthBridgeCodec.shared } + static var codec: FlutterStandardMessageCodec { NativePluginBindingsPigeonCodec.shared } /// Sets up an instance of `NativeAuthBridge` to handle messages through the `binaryMessenger`. - static func setUp(binaryMessenger: FlutterBinaryMessenger, api: NativeAuthBridge?) { - let addAuthPluginChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.amplify_datastore.NativeAuthBridge.addAuthPlugin", binaryMessenger: binaryMessenger, codec: codec) + static func setUp(binaryMessenger: FlutterBinaryMessenger, api: NativeAuthBridge?, messageChannelSuffix: String = "") { + let channelSuffix = messageChannelSuffix.count > 0 ? ".\(messageChannelSuffix)" : "" + let addAuthPluginChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.amplify_datastore.NativeAuthBridge.addAuthPlugin\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) if let api = api { addAuthPluginChannel.setMessageHandler { _, reply in - api.addAuthPlugin() { result in + api.addAuthPlugin { result in switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) } } } } else { addAuthPluginChannel.setMessageHandler(nil) } - let updateCurrentUserChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.amplify_datastore.NativeAuthBridge.updateCurrentUser", binaryMessenger: binaryMessenger, codec: codec) + let updateCurrentUserChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.amplify_datastore.NativeAuthBridge.updateCurrentUser\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) if let api = api { updateCurrentUserChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -528,42 +687,6 @@ class NativeAuthBridgeSetup { } } } -private class NativeApiBridgeCodecReader: FlutterStandardReader { - override func readValue(ofType type: UInt8) -> Any? { - switch type { - case 128: - return NativeGraphQLSubscriptionResponse.fromList(self.readValue() as! [Any?]) - default: - return super.readValue(ofType: type) - } - } -} - -private class NativeApiBridgeCodecWriter: FlutterStandardWriter { - override func writeValue(_ value: Any) { - if let value = value as? NativeGraphQLSubscriptionResponse { - super.writeByte(128) - super.writeValue(value.toList()) - } else { - super.writeValue(value) - } - } -} - -private class NativeApiBridgeCodecReaderWriter: FlutterStandardReaderWriter { - override func reader(with data: Data) -> FlutterStandardReader { - return NativeApiBridgeCodecReader(data: data) - } - - override func writer(with data: NSMutableData) -> FlutterStandardWriter { - return NativeApiBridgeCodecWriter(data: data) - } -} - -class NativeApiBridgeCodec: FlutterStandardMessageCodec { - static let shared = NativeApiBridgeCodec(readerWriter: NativeApiBridgeCodecReaderWriter()) -} - /// Bridge for calling API methods from Flutter into Native /// /// Generated protocol from Pigeon that represents a handler of messages from Flutter. @@ -574,11 +697,11 @@ protocol NativeApiBridge { /// Generated setup class from Pigeon to handle messages through the `binaryMessenger`. class NativeApiBridgeSetup { - /// The codec used by NativeApiBridge. - static var codec: FlutterStandardMessageCodec { NativeApiBridgeCodec.shared } + static var codec: FlutterStandardMessageCodec { NativePluginBindingsPigeonCodec.shared } /// Sets up an instance of `NativeApiBridge` to handle messages through the `binaryMessenger`. - static func setUp(binaryMessenger: FlutterBinaryMessenger, api: NativeApiBridge?) { - let addApiPluginChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.amplify_datastore.NativeApiBridge.addApiPlugin", binaryMessenger: binaryMessenger, codec: codec) + static func setUp(binaryMessenger: FlutterBinaryMessenger, api: NativeApiBridge?, messageChannelSuffix: String = "") { + let channelSuffix = messageChannelSuffix.count > 0 ? ".\(messageChannelSuffix)" : "" + let addApiPluginChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.amplify_datastore.NativeApiBridge.addApiPlugin\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) if let api = api { addApiPluginChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -586,27 +709,27 @@ class NativeApiBridgeSetup { let endpointsArg = args[1] as! [String: String] api.addApiPlugin(authProvidersList: authProvidersListArg, endpoints: endpointsArg) { result in switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) } } } } else { addApiPluginChannel.setMessageHandler(nil) } - let sendSubscriptionEventChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.amplify_datastore.NativeApiBridge.sendSubscriptionEvent", binaryMessenger: binaryMessenger, codec: codec) + let sendSubscriptionEventChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.amplify_datastore.NativeApiBridge.sendSubscriptionEvent\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) if let api = api { sendSubscriptionEventChannel.setMessageHandler { message, reply in let args = message as! [Any?] let eventArg = args[0] as! NativeGraphQLSubscriptionResponse api.sendSubscriptionEvent(event: eventArg) { result in switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) } } } diff --git a/packages/amplify_datastore/lib/amplify_datastore.dart b/packages/amplify_datastore/lib/amplify_datastore.dart index b71231d95c..f94384ed6a 100644 --- a/packages/amplify_datastore/lib/amplify_datastore.dart +++ b/packages/amplify_datastore/lib/amplify_datastore.dart @@ -61,7 +61,7 @@ class AmplifyDataStore extends DataStorePluginInterface if (authPlugin != null) { // Configure this plugin to act as a native iOS/Android plugin. final nativePlugin = _NativeAmplifyAuthCognito(); - NativeAuthPlugin.setup(nativePlugin); + NativeAuthPlugin.setUp(nativePlugin); final nativeBridge = NativeAuthBridge(); try { await nativeBridge.addAuthPlugin(); @@ -109,7 +109,7 @@ class AmplifyDataStore extends DataStorePluginInterface endpoints[e.key] = e.value.defaultAuthorizationType.name; }); final nativePlugin = NativeAmplifyApi(authProviders); - NativeApiPlugin.setup(nativePlugin); + NativeApiPlugin.setUp(nativePlugin); final nativeBridge = NativeApiBridge(); try { diff --git a/packages/amplify_datastore/lib/src/native_plugin.g.dart b/packages/amplify_datastore/lib/src/native_plugin.g.dart index c87f9b9994..f385d6c848 100644 --- a/packages/amplify_datastore/lib/src/native_plugin.g.dart +++ b/packages/amplify_datastore/lib/src/native_plugin.g.dart @@ -1,9 +1,9 @@ // // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 -// Autogenerated from Pigeon (v11.0.1), do not edit directly. +// Autogenerated from Pigeon (v22.6.2), do not edit directly. // See also: https://pub.dev/packages/pigeon -// ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import +// ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import, no_leading_underscores_for_local_identifiers import 'dart:async'; import 'dart:typed_data' show Float64List, Int32List, Int64List, Uint8List; @@ -11,6 +11,24 @@ import 'dart:typed_data' show Float64List, Int32List, Int64List, Uint8List; import 'package:flutter/foundation.dart' show ReadBuffer, WriteBuffer; import 'package:flutter/services.dart'; +PlatformException _createConnectionError(String channelName) { + return PlatformException( + code: 'channel-error', + message: 'Unable to establish connection on channel: "$channelName".', + ); +} + +List wrapResponse( + {Object? result, PlatformException? error, bool empty = false}) { + if (empty) { + return []; + } + if (error == null) { + return [result]; + } + return [error.code, error.message, error.details]; +} + class NativeAuthSession { NativeAuthSession({ required this.isSignedIn, @@ -34,9 +52,9 @@ class NativeAuthSession { return [ isSignedIn, userSub, - userPoolTokens?.encode(), + userPoolTokens, identityId, - awsCredentials?.encode(), + awsCredentials, ]; } @@ -45,13 +63,9 @@ class NativeAuthSession { return NativeAuthSession( isSignedIn: result[0]! as bool, userSub: result[1] as String?, - userPoolTokens: result[2] != null - ? NativeUserPoolTokens.decode(result[2]! as List) - : null, + userPoolTokens: result[2] as NativeUserPoolTokens?, identityId: result[3] as String?, - awsCredentials: result[4] != null - ? NativeAWSCredentials.decode(result[4]! as List) - : null, + awsCredentials: result[4] as NativeAWSCredentials?, ); } } @@ -149,6 +163,62 @@ class NativeAWSCredentials { } } +class LegacyCredentialStoreData { + LegacyCredentialStoreData({ + this.identityId, + this.accessKeyId, + this.secretAccessKey, + this.sessionToken, + this.expirationMsSinceEpoch, + this.accessToken, + this.refreshToken, + this.idToken, + }); + + String? identityId; + + String? accessKeyId; + + String? secretAccessKey; + + String? sessionToken; + + int? expirationMsSinceEpoch; + + String? accessToken; + + String? refreshToken; + + String? idToken; + + Object encode() { + return [ + identityId, + accessKeyId, + secretAccessKey, + sessionToken, + expirationMsSinceEpoch, + accessToken, + refreshToken, + idToken, + ]; + } + + static LegacyCredentialStoreData decode(Object result) { + result as List; + return LegacyCredentialStoreData( + identityId: result[0] as String?, + accessKeyId: result[1] as String?, + secretAccessKey: result[2] as String?, + sessionToken: result[3] as String?, + expirationMsSinceEpoch: result[4] as int?, + accessToken: result[5] as String?, + refreshToken: result[6] as String?, + idToken: result[7] as String?, + ); + } +} + class NativeGraphQLResponse { NativeGraphQLResponse({ this.payloadJson, @@ -252,19 +322,37 @@ class NativeGraphQLRequest { } } -class _NativeAuthPluginCodec extends StandardMessageCodec { - const _NativeAuthPluginCodec(); +class _PigeonCodec extends StandardMessageCodec { + const _PigeonCodec(); @override void writeValue(WriteBuffer buffer, Object? value) { - if (value is NativeAWSCredentials) { - buffer.putUint8(128); - writeValue(buffer, value.encode()); + if (value is int) { + buffer.putUint8(4); + buffer.putInt64(value); } else if (value is NativeAuthSession) { buffer.putUint8(129); writeValue(buffer, value.encode()); - } else if (value is NativeUserPoolTokens) { + } else if (value is NativeAuthUser) { buffer.putUint8(130); writeValue(buffer, value.encode()); + } else if (value is NativeUserPoolTokens) { + buffer.putUint8(131); + writeValue(buffer, value.encode()); + } else if (value is NativeAWSCredentials) { + buffer.putUint8(132); + writeValue(buffer, value.encode()); + } else if (value is LegacyCredentialStoreData) { + buffer.putUint8(133); + writeValue(buffer, value.encode()); + } else if (value is NativeGraphQLResponse) { + buffer.putUint8(134); + writeValue(buffer, value.encode()); + } else if (value is NativeGraphQLSubscriptionResponse) { + buffer.putUint8(135); + writeValue(buffer, value.encode()); + } else if (value is NativeGraphQLRequest) { + buffer.putUint8(136); + writeValue(buffer, value.encode()); } else { super.writeValue(buffer, value); } @@ -273,12 +361,22 @@ class _NativeAuthPluginCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: - return NativeAWSCredentials.decode(readValue(buffer)!); case 129: return NativeAuthSession.decode(readValue(buffer)!); case 130: + return NativeAuthUser.decode(readValue(buffer)!); + case 131: return NativeUserPoolTokens.decode(readValue(buffer)!); + case 132: + return NativeAWSCredentials.decode(readValue(buffer)!); + case 133: + return LegacyCredentialStoreData.decode(readValue(buffer)!); + case 134: + return NativeGraphQLResponse.decode(readValue(buffer)!); + case 135: + return NativeGraphQLSubscriptionResponse.decode(readValue(buffer)!); + case 136: + return NativeGraphQLRequest.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); } @@ -287,65 +385,46 @@ class _NativeAuthPluginCodec extends StandardMessageCodec { /// Bridge for calling Auth from Native into Flutter abstract class NativeAuthPlugin { - static const MessageCodec codec = _NativeAuthPluginCodec(); + static const MessageCodec pigeonChannelCodec = _PigeonCodec(); Future fetchAuthSession(); - static void setup(NativeAuthPlugin? api, {BinaryMessenger? binaryMessenger}) { + static void setUp( + NativeAuthPlugin? api, { + BinaryMessenger? binaryMessenger, + String messageChannelSuffix = '', + }) { + messageChannelSuffix = + messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.amplify_datastore.NativeAuthPlugin.fetchAuthSession', - codec, + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< + Object?>( + 'dev.flutter.pigeon.amplify_datastore.NativeAuthPlugin.fetchAuthSession$messageChannelSuffix', + pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { - channel.setMessageHandler(null); + pigeonVar_channel.setMessageHandler(null); } else { - channel.setMessageHandler((Object? message) async { - // ignore message - final NativeAuthSession output = await api.fetchAuthSession(); - return output; + pigeonVar_channel.setMessageHandler((Object? message) async { + try { + final NativeAuthSession output = await api.fetchAuthSession(); + return wrapResponse(result: output); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } } } -class _NativeApiPluginCodec extends StandardMessageCodec { - const _NativeApiPluginCodec(); - @override - void writeValue(WriteBuffer buffer, Object? value) { - if (value is NativeGraphQLRequest) { - buffer.putUint8(128); - writeValue(buffer, value.encode()); - } else if (value is NativeGraphQLResponse) { - buffer.putUint8(129); - writeValue(buffer, value.encode()); - } else if (value is NativeGraphQLSubscriptionResponse) { - buffer.putUint8(130); - writeValue(buffer, value.encode()); - } else { - super.writeValue(buffer, value); - } - } - - @override - Object? readValueOfType(int type, ReadBuffer buffer) { - switch (type) { - case 128: - return NativeGraphQLRequest.decode(readValue(buffer)!); - case 129: - return NativeGraphQLResponse.decode(readValue(buffer)!); - case 130: - return NativeGraphQLSubscriptionResponse.decode(readValue(buffer)!); - default: - return super.readValueOfType(type, buffer); - } - } -} - /// Bridge for calling API plugin from Native into Flutter abstract class NativeApiPlugin { - static const MessageCodec codec = _NativeApiPluginCodec(); + static const MessageCodec pigeonChannelCodec = _PigeonCodec(); Future getLatestAuthToken(String providerName); @@ -362,36 +441,54 @@ abstract class NativeApiPlugin { Future onStop(); - static void setup(NativeApiPlugin? api, {BinaryMessenger? binaryMessenger}) { + static void setUp( + NativeApiPlugin? api, { + BinaryMessenger? binaryMessenger, + String messageChannelSuffix = '', + }) { + messageChannelSuffix = + messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.amplify_datastore.NativeApiPlugin.getLatestAuthToken', - codec, + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< + Object?>( + 'dev.flutter.pigeon.amplify_datastore.NativeApiPlugin.getLatestAuthToken$messageChannelSuffix', + pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { - channel.setMessageHandler(null); + pigeonVar_channel.setMessageHandler(null); } else { - channel.setMessageHandler((Object? message) async { + pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.amplify_datastore.NativeApiPlugin.getLatestAuthToken was null.'); final List args = (message as List?)!; final String? arg_providerName = (args[0] as String?); assert(arg_providerName != null, 'Argument for dev.flutter.pigeon.amplify_datastore.NativeApiPlugin.getLatestAuthToken was null, expected non-null String.'); - final String? output = - await api.getLatestAuthToken(arg_providerName!); - return output; + try { + final String? output = + await api.getLatestAuthToken(arg_providerName!); + return wrapResponse(result: output); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.amplify_datastore.NativeApiPlugin.mutate', codec, + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< + Object?>( + 'dev.flutter.pigeon.amplify_datastore.NativeApiPlugin.mutate$messageChannelSuffix', + pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { - channel.setMessageHandler(null); + pigeonVar_channel.setMessageHandler(null); } else { - channel.setMessageHandler((Object? message) async { + pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.amplify_datastore.NativeApiPlugin.mutate was null.'); final List args = (message as List?)!; @@ -399,19 +496,29 @@ abstract class NativeApiPlugin { (args[0] as NativeGraphQLRequest?); assert(arg_request != null, 'Argument for dev.flutter.pigeon.amplify_datastore.NativeApiPlugin.mutate was null, expected non-null NativeGraphQLRequest.'); - final NativeGraphQLResponse output = await api.mutate(arg_request!); - return output; + try { + final NativeGraphQLResponse output = await api.mutate(arg_request!); + return wrapResponse(result: output); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.amplify_datastore.NativeApiPlugin.query', codec, + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< + Object?>( + 'dev.flutter.pigeon.amplify_datastore.NativeApiPlugin.query$messageChannelSuffix', + pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { - channel.setMessageHandler(null); + pigeonVar_channel.setMessageHandler(null); } else { - channel.setMessageHandler((Object? message) async { + pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.amplify_datastore.NativeApiPlugin.query was null.'); final List args = (message as List?)!; @@ -419,20 +526,29 @@ abstract class NativeApiPlugin { (args[0] as NativeGraphQLRequest?); assert(arg_request != null, 'Argument for dev.flutter.pigeon.amplify_datastore.NativeApiPlugin.query was null, expected non-null NativeGraphQLRequest.'); - final NativeGraphQLResponse output = await api.query(arg_request!); - return output; + try { + final NativeGraphQLResponse output = await api.query(arg_request!); + return wrapResponse(result: output); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.amplify_datastore.NativeApiPlugin.subscribe', - codec, + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< + Object?>( + 'dev.flutter.pigeon.amplify_datastore.NativeApiPlugin.subscribe$messageChannelSuffix', + pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { - channel.setMessageHandler(null); + pigeonVar_channel.setMessageHandler(null); } else { - channel.setMessageHandler((Object? message) async { + pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.amplify_datastore.NativeApiPlugin.subscribe was null.'); final List args = (message as List?)!; @@ -440,58 +556,91 @@ abstract class NativeApiPlugin { (args[0] as NativeGraphQLRequest?); assert(arg_request != null, 'Argument for dev.flutter.pigeon.amplify_datastore.NativeApiPlugin.subscribe was null, expected non-null NativeGraphQLRequest.'); - final NativeGraphQLSubscriptionResponse output = - await api.subscribe(arg_request!); - return output; + try { + final NativeGraphQLSubscriptionResponse output = + await api.subscribe(arg_request!); + return wrapResponse(result: output); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.amplify_datastore.NativeApiPlugin.unsubscribe', - codec, + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< + Object?>( + 'dev.flutter.pigeon.amplify_datastore.NativeApiPlugin.unsubscribe$messageChannelSuffix', + pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { - channel.setMessageHandler(null); + pigeonVar_channel.setMessageHandler(null); } else { - channel.setMessageHandler((Object? message) async { + pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.amplify_datastore.NativeApiPlugin.unsubscribe was null.'); final List args = (message as List?)!; final String? arg_subscriptionId = (args[0] as String?); assert(arg_subscriptionId != null, 'Argument for dev.flutter.pigeon.amplify_datastore.NativeApiPlugin.unsubscribe was null, expected non-null String.'); - await api.unsubscribe(arg_subscriptionId!); - return; + try { + await api.unsubscribe(arg_subscriptionId!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.amplify_datastore.NativeApiPlugin.deviceOffline', - codec, + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< + Object?>( + 'dev.flutter.pigeon.amplify_datastore.NativeApiPlugin.deviceOffline$messageChannelSuffix', + pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { - channel.setMessageHandler(null); + pigeonVar_channel.setMessageHandler(null); } else { - channel.setMessageHandler((Object? message) async { - // ignore message - await api.deviceOffline(); - return; + pigeonVar_channel.setMessageHandler((Object? message) async { + try { + await api.deviceOffline(); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.amplify_datastore.NativeApiPlugin.onStop', codec, + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< + Object?>( + 'dev.flutter.pigeon.amplify_datastore.NativeApiPlugin.onStop$messageChannelSuffix', + pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { - channel.setMessageHandler(null); + pigeonVar_channel.setMessageHandler(null); } else { - channel.setMessageHandler((Object? message) async { - // ignore message - await api.onStop(); - return; + pigeonVar_channel.setMessageHandler((Object? message) async { + try { + await api.onStop(); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -503,29 +652,35 @@ class NativeAmplifyBridge { /// Constructor for [NativeAmplifyBridge]. The [binaryMessenger] named argument is /// available for dependency injection. If it is left null, the default /// BinaryMessenger will be used which routes to the host platform. - NativeAmplifyBridge({BinaryMessenger? binaryMessenger}) - : _binaryMessenger = binaryMessenger; - final BinaryMessenger? _binaryMessenger; - - static const MessageCodec codec = StandardMessageCodec(); - - Future configure(String arg_version, String arg_config) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.amplify_datastore.NativeAmplifyBridge.configure', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_version, arg_config]) as List?; - if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); - } else if (replyList.length > 1) { + NativeAmplifyBridge( + {BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) + : pigeonVar_binaryMessenger = binaryMessenger, + pigeonVar_messageChannelSuffix = + messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; + final BinaryMessenger? pigeonVar_binaryMessenger; + + static const MessageCodec pigeonChannelCodec = _PigeonCodec(); + + final String pigeonVar_messageChannelSuffix; + + Future configure(String version, String config) async { + final String pigeonVar_channelName = + 'dev.flutter.pigeon.amplify_datastore.NativeAmplifyBridge.configure$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final List? pigeonVar_replyList = await pigeonVar_channel + .send([version, config]) as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { throw PlatformException( - code: replyList[0]! as String, - message: replyList[1] as String?, - details: replyList[2], + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], ); } else { return; @@ -533,79 +688,64 @@ class NativeAmplifyBridge { } } -class _NativeAuthBridgeCodec extends StandardMessageCodec { - const _NativeAuthBridgeCodec(); - @override - void writeValue(WriteBuffer buffer, Object? value) { - if (value is NativeAuthUser) { - buffer.putUint8(128); - writeValue(buffer, value.encode()); - } else { - super.writeValue(buffer, value); - } - } - - @override - Object? readValueOfType(int type, ReadBuffer buffer) { - switch (type) { - case 128: - return NativeAuthUser.decode(readValue(buffer)!); - default: - return super.readValueOfType(type, buffer); - } - } -} - /// Bridge for calling Auth plugin from Flutter into Native class NativeAuthBridge { /// Constructor for [NativeAuthBridge]. The [binaryMessenger] named argument is /// available for dependency injection. If it is left null, the default /// BinaryMessenger will be used which routes to the host platform. - NativeAuthBridge({BinaryMessenger? binaryMessenger}) - : _binaryMessenger = binaryMessenger; - final BinaryMessenger? _binaryMessenger; + NativeAuthBridge( + {BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) + : pigeonVar_binaryMessenger = binaryMessenger, + pigeonVar_messageChannelSuffix = + messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; + final BinaryMessenger? pigeonVar_binaryMessenger; + + static const MessageCodec pigeonChannelCodec = _PigeonCodec(); - static const MessageCodec codec = _NativeAuthBridgeCodec(); + final String pigeonVar_messageChannelSuffix; Future addAuthPlugin() async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.amplify_datastore.NativeAuthBridge.addAuthPlugin', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = await channel.send(null) as List?; - if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); - } else if (replyList.length > 1) { + final String pigeonVar_channelName = + 'dev.flutter.pigeon.amplify_datastore.NativeAuthBridge.addAuthPlugin$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final List? pigeonVar_replyList = + await pigeonVar_channel.send(null) as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { throw PlatformException( - code: replyList[0]! as String, - message: replyList[1] as String?, - details: replyList[2], + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], ); } else { return; } } - Future updateCurrentUser(NativeAuthUser? arg_user) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.amplify_datastore.NativeAuthBridge.updateCurrentUser', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_user]) as List?; - if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); - } else if (replyList.length > 1) { + Future updateCurrentUser(NativeAuthUser? user) async { + final String pigeonVar_channelName = + 'dev.flutter.pigeon.amplify_datastore.NativeAuthBridge.updateCurrentUser$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final List? pigeonVar_replyList = + await pigeonVar_channel.send([user]) as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { throw PlatformException( - code: replyList[0]! as String, - message: replyList[1] as String?, - details: replyList[2], + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], ); } else { return; @@ -613,59 +753,41 @@ class NativeAuthBridge { } } -class _NativeApiBridgeCodec extends StandardMessageCodec { - const _NativeApiBridgeCodec(); - @override - void writeValue(WriteBuffer buffer, Object? value) { - if (value is NativeGraphQLSubscriptionResponse) { - buffer.putUint8(128); - writeValue(buffer, value.encode()); - } else { - super.writeValue(buffer, value); - } - } - - @override - Object? readValueOfType(int type, ReadBuffer buffer) { - switch (type) { - case 128: - return NativeGraphQLSubscriptionResponse.decode(readValue(buffer)!); - default: - return super.readValueOfType(type, buffer); - } - } -} - /// Bridge for calling API methods from Flutter into Native class NativeApiBridge { /// Constructor for [NativeApiBridge]. The [binaryMessenger] named argument is /// available for dependency injection. If it is left null, the default /// BinaryMessenger will be used which routes to the host platform. - NativeApiBridge({BinaryMessenger? binaryMessenger}) - : _binaryMessenger = binaryMessenger; - final BinaryMessenger? _binaryMessenger; - - static const MessageCodec codec = _NativeApiBridgeCodec(); - - Future addApiPlugin(List arg_authProvidersList, - Map arg_endpoints) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.amplify_datastore.NativeApiBridge.addApiPlugin', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_authProvidersList, arg_endpoints]) - as List?; - if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); - } else if (replyList.length > 1) { + NativeApiBridge( + {BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) + : pigeonVar_binaryMessenger = binaryMessenger, + pigeonVar_messageChannelSuffix = + messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; + final BinaryMessenger? pigeonVar_binaryMessenger; + + static const MessageCodec pigeonChannelCodec = _PigeonCodec(); + + final String pigeonVar_messageChannelSuffix; + + Future addApiPlugin( + List authProvidersList, Map endpoints) async { + final String pigeonVar_channelName = + 'dev.flutter.pigeon.amplify_datastore.NativeApiBridge.addApiPlugin$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final List? pigeonVar_replyList = await pigeonVar_channel + .send([authProvidersList, endpoints]) as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { throw PlatformException( - code: replyList[0]! as String, - message: replyList[1] as String?, - details: replyList[2], + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], ); } else { return; @@ -673,23 +795,24 @@ class NativeApiBridge { } Future sendSubscriptionEvent( - NativeGraphQLSubscriptionResponse arg_event) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.amplify_datastore.NativeApiBridge.sendSubscriptionEvent', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_event]) as List?; - if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); - } else if (replyList.length > 1) { + NativeGraphQLSubscriptionResponse event) async { + final String pigeonVar_channelName = + 'dev.flutter.pigeon.amplify_datastore.NativeApiBridge.sendSubscriptionEvent$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final List? pigeonVar_replyList = + await pigeonVar_channel.send([event]) as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { throw PlatformException( - code: replyList[0]! as String, - message: replyList[1] as String?, - details: replyList[2], + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], ); } else { return; diff --git a/packages/amplify_datastore/pubspec.yaml b/packages/amplify_datastore/pubspec.yaml index 9664299fd5..725360770d 100644 --- a/packages/amplify_datastore/pubspec.yaml +++ b/packages/amplify_datastore/pubspec.yaml @@ -25,7 +25,7 @@ dev_dependencies: flutter_test: sdk: flutter fake_async: ^1.2.0 - pigeon: ^11.0.0 + pigeon: ^22.6.2 # The following section is specific to Flutter. flutter: diff --git a/packages/amplify_native_legacy_wrapper/android/src/main/kotlin/com/amazonaws/amplify/amplify_native_legacy_wrapper/pigeons/LegacyNativePluginPigeon.kt b/packages/amplify_native_legacy_wrapper/android/src/main/kotlin/com/amazonaws/amplify/amplify_native_legacy_wrapper/pigeons/LegacyNativePluginPigeon.kt index f6035accd1..f4b6a8668f 100644 --- a/packages/amplify_native_legacy_wrapper/android/src/main/kotlin/com/amazonaws/amplify/amplify_native_legacy_wrapper/pigeons/LegacyNativePluginPigeon.kt +++ b/packages/amplify_native_legacy_wrapper/android/src/main/kotlin/com/amazonaws/amplify/amplify_native_legacy_wrapper/pigeons/LegacyNativePluginPigeon.kt @@ -1,8 +1,9 @@ -// +// // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 -// Autogenerated from Pigeon (v11.0.1), do not edit directly. +// Autogenerated from Pigeon (v22.6.2), do not edit directly. // See also: https://pub.dev/packages/pigeon +@file:Suppress("UNCHECKED_CAST", "ArrayInDataClass") package com.amazonaws.amplify.amplify_native_legacy_wrapper.pigeons @@ -19,14 +20,14 @@ private fun wrapResult(result: Any?): List { } private fun wrapError(exception: Throwable): List { - if (exception is FlutterError) { - return listOf( + return if (exception is FlutterError) { + listOf( exception.code, exception.message, exception.details ) } else { - return listOf( + listOf( exception.javaClass.simpleName, exception.toString(), "Cause: " + exception.cause + ", Stacktrace: " + Log.getStackTraceString(exception) @@ -45,6 +46,15 @@ class FlutterError ( override val message: String? = null, val details: Any? = null ) : Throwable() +private open class LegacyNativePluginPigeonPigeonCodec : StandardMessageCodec() { + override fun readValueOfType(type: Byte, buffer: ByteBuffer): Any? { + return super.readValueOfType(type, buffer) + } + override fun writeValue(stream: ByteArrayOutputStream, value: Any?) { + super.writeValue(stream, value) + } +} + /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ interface LegacyNativePlugin { @@ -56,13 +66,14 @@ interface LegacyNativePlugin { companion object { /** The codec used by LegacyNativePlugin. */ val codec: MessageCodec by lazy { - StandardMessageCodec() + LegacyNativePluginPigeonPigeonCodec() } /** Sets up an instance of `LegacyNativePlugin` to handle messages through the `binaryMessenger`. */ - @Suppress("UNCHECKED_CAST") - fun setUp(binaryMessenger: BinaryMessenger, api: LegacyNativePlugin?) { + @JvmOverloads + fun setUp(binaryMessenger: BinaryMessenger, api: LegacyNativePlugin?, messageChannelSuffix: String = "") { + val separatedMessageChannelSuffix = if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.amplify_native_legacy_wrapper.LegacyNativePlugin.configure", codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.amplify_native_legacy_wrapper.LegacyNativePlugin.configure$separatedMessageChannelSuffix", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List @@ -81,10 +92,10 @@ interface LegacyNativePlugin { } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.amplify_native_legacy_wrapper.LegacyNativePlugin.signOut", codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.amplify_native_legacy_wrapper.LegacyNativePlugin.signOut$separatedMessageChannelSuffix", codec) if (api != null) { channel.setMessageHandler { _, reply -> - api.signOut() { result: Result -> + api.signOut{ result: Result -> val error = result.exceptionOrNull() if (error != null) { reply.reply(wrapError(error)) @@ -98,7 +109,7 @@ interface LegacyNativePlugin { } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.amplify_native_legacy_wrapper.LegacyNativePlugin.signIn", codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.amplify_native_legacy_wrapper.LegacyNativePlugin.signIn$separatedMessageChannelSuffix", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List @@ -118,10 +129,10 @@ interface LegacyNativePlugin { } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.amplify_native_legacy_wrapper.LegacyNativePlugin.rememberDevice", codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.amplify_native_legacy_wrapper.LegacyNativePlugin.rememberDevice$separatedMessageChannelSuffix", codec) if (api != null) { channel.setMessageHandler { _, reply -> - api.rememberDevice() { result: Result -> + api.rememberDevice{ result: Result -> val error = result.exceptionOrNull() if (error != null) { reply.reply(wrapError(error)) diff --git a/packages/amplify_native_legacy_wrapper/ios/Classes/Pigeons/AmplifyNativeLegacyPlugin.swift b/packages/amplify_native_legacy_wrapper/ios/Classes/Pigeons/AmplifyNativeLegacyPlugin.swift index dd47b3f22d..8933534d7c 100644 --- a/packages/amplify_native_legacy_wrapper/ios/Classes/Pigeons/AmplifyNativeLegacyPlugin.swift +++ b/packages/amplify_native_legacy_wrapper/ios/Classes/Pigeons/AmplifyNativeLegacyPlugin.swift @@ -1,20 +1,35 @@ -// +// // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 -// Autogenerated from Pigeon (v11.0.1), do not edit directly. +// Autogenerated from Pigeon (v22.6.2), do not edit directly. // See also: https://pub.dev/packages/pigeon import Foundation + #if os(iOS) -import Flutter + import Flutter #elseif os(macOS) -import FlutterMacOS + import FlutterMacOS #else -#error("Unsupported platform.") + #error("Unsupported platform.") #endif -private func isNullish(_ value: Any?) -> Bool { - return value is NSNull || value == nil +/// Error class for passing custom error details to Dart side. +final class PigeonError: Error { + let code: String + let message: String? + let details: Any? + + init(code: String, message: String?, details: Any?) { + self.code = code + self.message = message + self.details = details + } + + var localizedDescription: String { + return + "PigeonError(code: \(code), message: \(message ?? ""), details: \(details ?? "")" + } } private func wrapResult(_ result: Any?) -> [Any?] { @@ -22,25 +37,57 @@ private func wrapResult(_ result: Any?) -> [Any?] { } private func wrapError(_ error: Any) -> [Any?] { + if let pigeonError = error as? PigeonError { + return [ + pigeonError.code, + pigeonError.message, + pigeonError.details, + ] + } if let flutterError = error as? FlutterError { return [ flutterError.code, flutterError.message, - flutterError.details + flutterError.details, ] } return [ "\(error)", "\(type(of: error))", - "Stacktrace: \(Thread.callStackSymbols)" + "Stacktrace: \(Thread.callStackSymbols)", ] } +private func isNullish(_ value: Any?) -> Bool { + return value is NSNull || value == nil +} + private func nilOrValue(_ value: Any?) -> T? { if value is NSNull { return nil } return value as! T? } +private class AmplifyNativeLegacyPluginPigeonCodecReader: FlutterStandardReader { +} + +private class AmplifyNativeLegacyPluginPigeonCodecWriter: FlutterStandardWriter { +} + +private class AmplifyNativeLegacyPluginPigeonCodecReaderWriter: FlutterStandardReaderWriter { + override func reader(with data: Data) -> FlutterStandardReader { + return AmplifyNativeLegacyPluginPigeonCodecReader(data: data) + } + + override func writer(with data: NSMutableData) -> FlutterStandardWriter { + return AmplifyNativeLegacyPluginPigeonCodecWriter(data: data) + } +} + +class AmplifyNativeLegacyPluginPigeonCodec: FlutterStandardMessageCodec, @unchecked Sendable { + static let shared = AmplifyNativeLegacyPluginPigeonCodec(readerWriter: AmplifyNativeLegacyPluginPigeonCodecReaderWriter()) +} + + /// Generated protocol from Pigeon that represents a handler of messages from Flutter. protocol LegacyNativePlugin { func configure(config: String, completion: @escaping (Result) -> Void) @@ -51,42 +98,43 @@ protocol LegacyNativePlugin { /// Generated setup class from Pigeon to handle messages through the `binaryMessenger`. class LegacyNativePluginSetup { - /// The codec used by LegacyNativePlugin. + static var codec: FlutterStandardMessageCodec { AmplifyNativeLegacyPluginPigeonCodec.shared } /// Sets up an instance of `LegacyNativePlugin` to handle messages through the `binaryMessenger`. - static func setUp(binaryMessenger: FlutterBinaryMessenger, api: LegacyNativePlugin?) { - let configureChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.amplify_native_legacy_wrapper.LegacyNativePlugin.configure", binaryMessenger: binaryMessenger) + static func setUp(binaryMessenger: FlutterBinaryMessenger, api: LegacyNativePlugin?, messageChannelSuffix: String = "") { + let channelSuffix = messageChannelSuffix.count > 0 ? ".\(messageChannelSuffix)" : "" + let configureChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.amplify_native_legacy_wrapper.LegacyNativePlugin.configure\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) if let api = api { configureChannel.setMessageHandler { message, reply in let args = message as! [Any?] let configArg = args[0] as! String api.configure(config: configArg) { result in switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) } } } } else { configureChannel.setMessageHandler(nil) } - let signOutChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.amplify_native_legacy_wrapper.LegacyNativePlugin.signOut", binaryMessenger: binaryMessenger) + let signOutChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.amplify_native_legacy_wrapper.LegacyNativePlugin.signOut\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) if let api = api { signOutChannel.setMessageHandler { _, reply in - api.signOut() { result in + api.signOut { result in switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) } } } } else { signOutChannel.setMessageHandler(nil) } - let signInChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.amplify_native_legacy_wrapper.LegacyNativePlugin.signIn", binaryMessenger: binaryMessenger) + let signInChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.amplify_native_legacy_wrapper.LegacyNativePlugin.signIn\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) if let api = api { signInChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -94,25 +142,25 @@ class LegacyNativePluginSetup { let passwordArg = args[1] as! String api.signIn(username: usernameArg, password: passwordArg) { result in switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) } } } } else { signInChannel.setMessageHandler(nil) } - let rememberDeviceChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.amplify_native_legacy_wrapper.LegacyNativePlugin.rememberDevice", binaryMessenger: binaryMessenger) + let rememberDeviceChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.amplify_native_legacy_wrapper.LegacyNativePlugin.rememberDevice\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) if let api = api { rememberDeviceChannel.setMessageHandler { _, reply in - api.rememberDevice() { result in + api.rememberDevice { result in switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) } } } diff --git a/packages/amplify_native_legacy_wrapper/lib/amplify_native_legacy_plugin.g.dart b/packages/amplify_native_legacy_wrapper/lib/amplify_native_legacy_plugin.g.dart index 06dce1ea3c..4990c442e9 100644 --- a/packages/amplify_native_legacy_wrapper/lib/amplify_native_legacy_plugin.g.dart +++ b/packages/amplify_native_legacy_wrapper/lib/amplify_native_legacy_plugin.g.dart @@ -1,9 +1,9 @@ // // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 -// Autogenerated from Pigeon (v11.0.1), do not edit directly. +// Autogenerated from Pigeon (v22.6.2), do not edit directly. // See also: https://pub.dev/packages/pigeon -// ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import +// ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import, no_leading_underscores_for_local_identifiers import 'dart:async'; import 'dart:typed_data' show Float64List, Int32List, Int64List, Uint8List; @@ -11,33 +11,67 @@ import 'dart:typed_data' show Float64List, Int32List, Int64List, Uint8List; import 'package:flutter/foundation.dart' show ReadBuffer, WriteBuffer; import 'package:flutter/services.dart'; +PlatformException _createConnectionError(String channelName) { + return PlatformException( + code: 'channel-error', + message: 'Unable to establish connection on channel: "$channelName".', + ); +} + +class _PigeonCodec extends StandardMessageCodec { + const _PigeonCodec(); + @override + void writeValue(WriteBuffer buffer, Object? value) { + if (value is int) { + buffer.putUint8(4); + buffer.putInt64(value); + } else { + super.writeValue(buffer, value); + } + } + + @override + Object? readValueOfType(int type, ReadBuffer buffer) { + switch (type) { + default: + return super.readValueOfType(type, buffer); + } + } +} + class LegacyNativePlugin { /// Constructor for [LegacyNativePlugin]. The [binaryMessenger] named argument is /// available for dependency injection. If it is left null, the default /// BinaryMessenger will be used which routes to the host platform. - LegacyNativePlugin({BinaryMessenger? binaryMessenger}) - : _binaryMessenger = binaryMessenger; - final BinaryMessenger? _binaryMessenger; + LegacyNativePlugin( + {BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) + : pigeonVar_binaryMessenger = binaryMessenger, + pigeonVar_messageChannelSuffix = + messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; + final BinaryMessenger? pigeonVar_binaryMessenger; - static const MessageCodec codec = StandardMessageCodec(); + static const MessageCodec pigeonChannelCodec = _PigeonCodec(); - Future configure(String arg_config) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.amplify_native_legacy_wrapper.LegacyNativePlugin.configure', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_config]) as List?; - if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); - } else if (replyList.length > 1) { + final String pigeonVar_messageChannelSuffix; + + Future configure(String config) async { + final String pigeonVar_channelName = + 'dev.flutter.pigeon.amplify_native_legacy_wrapper.LegacyNativePlugin.configure$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final List? pigeonVar_replyList = + await pigeonVar_channel.send([config]) as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { throw PlatformException( - code: replyList[0]! as String, - message: replyList[1] as String?, - details: replyList[2], + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], ); } else { return; @@ -45,44 +79,47 @@ class LegacyNativePlugin { } Future signOut() async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.amplify_native_legacy_wrapper.LegacyNativePlugin.signOut', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = await channel.send(null) as List?; - if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); - } else if (replyList.length > 1) { + final String pigeonVar_channelName = + 'dev.flutter.pigeon.amplify_native_legacy_wrapper.LegacyNativePlugin.signOut$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final List? pigeonVar_replyList = + await pigeonVar_channel.send(null) as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { throw PlatformException( - code: replyList[0]! as String, - message: replyList[1] as String?, - details: replyList[2], + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], ); } else { return; } } - Future signIn(String arg_username, String arg_password) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.amplify_native_legacy_wrapper.LegacyNativePlugin.signIn', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_username, arg_password]) as List?; - if (replyList == null) { + Future signIn(String username, String password) async { + final String pigeonVar_channelName = + 'dev.flutter.pigeon.amplify_native_legacy_wrapper.LegacyNativePlugin.signIn$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final List? pigeonVar_replyList = await pigeonVar_channel + .send([username, password]) as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); - } else if (replyList.length > 1) { - throw PlatformException( - code: replyList[0]! as String, - message: replyList[1] as String?, - details: replyList[2], + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], ); } else { return; @@ -90,21 +127,23 @@ class LegacyNativePlugin { } Future rememberDevice() async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.amplify_native_legacy_wrapper.LegacyNativePlugin.rememberDevice', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = await channel.send(null) as List?; - if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); - } else if (replyList.length > 1) { + final String pigeonVar_channelName = + 'dev.flutter.pigeon.amplify_native_legacy_wrapper.LegacyNativePlugin.rememberDevice$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final List? pigeonVar_replyList = + await pigeonVar_channel.send(null) as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { throw PlatformException( - code: replyList[0]! as String, - message: replyList[1] as String?, - details: replyList[2], + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], ); } else { return; diff --git a/packages/amplify_native_legacy_wrapper/lib/amplify_native_legacy_wrapper.dart b/packages/amplify_native_legacy_wrapper/lib/amplify_native_legacy_wrapper.dart index 38bacdd158..253e8d38b9 100644 --- a/packages/amplify_native_legacy_wrapper/lib/amplify_native_legacy_wrapper.dart +++ b/packages/amplify_native_legacy_wrapper/lib/amplify_native_legacy_wrapper.dart @@ -1,7 +1,10 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 +// ignore_for_file: non_constant_identifier_names + import 'package:amplify_native_legacy_wrapper/amplify_native_legacy_plugin.g.dart'; +import 'package:flutter/services.dart'; /// A wrapper around the Native v1 Amplify plugins and the legacy SDKs. /// @@ -30,4 +33,10 @@ class AmplifyNativeLegacyWrapper implements LegacyNativePlugin { Future rememberDevice() { return _plugin.rememberDevice(); } + + @override + BinaryMessenger? get pigeonVar_binaryMessenger => _plugin.pigeonVar_binaryMessenger; + + @override + String get pigeonVar_messageChannelSuffix => _plugin.pigeonVar_messageChannelSuffix; } diff --git a/packages/amplify_native_legacy_wrapper/pubspec.yaml b/packages/amplify_native_legacy_wrapper/pubspec.yaml index 1727efaa84..65d7dd62db 100644 --- a/packages/amplify_native_legacy_wrapper/pubspec.yaml +++ b/packages/amplify_native_legacy_wrapper/pubspec.yaml @@ -15,7 +15,7 @@ dev_dependencies: amplify_lints: ">=2.0.2 <2.1.0" flutter_test: sdk: flutter - pigeon: ^11.0.0 + pigeon: ^22.6.2 flutter: plugin: diff --git a/packages/analytics/amplify_analytics_pinpoint/android/src/main/java/com/amazonaws/amplify/amplify_analytics_pinpoint/Messages.java b/packages/analytics/amplify_analytics_pinpoint/android/src/main/java/com/amazonaws/amplify/amplify_analytics_pinpoint/Messages.java index b237532d82..d5123cb027 100644 --- a/packages/analytics/amplify_analytics_pinpoint/android/src/main/java/com/amazonaws/amplify/amplify_analytics_pinpoint/Messages.java +++ b/packages/analytics/amplify_analytics_pinpoint/android/src/main/java/com/amazonaws/amplify/amplify_analytics_pinpoint/Messages.java @@ -1,6 +1,6 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 -// Autogenerated from Pigeon (v11.0.0), do not edit directly. +// Autogenerated from Pigeon (v22.6.2), do not edit directly. // See also: https://pub.dev/packages/pigeon package com.amazonaws.amplify.amplify_analytics_pinpoint; @@ -20,6 +20,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Objects; /** Generated class from Pigeon. */ @SuppressWarnings({"unused", "unchecked", "CodeBlock2Expr", "RedundantSuppression", "serial"}) @@ -44,7 +45,7 @@ public FlutterError(@NonNull String code, @Nullable String message, @Nullable Ob @NonNull protected static ArrayList wrapError(@NonNull Throwable exception) { - ArrayList errorList = new ArrayList(3); + ArrayList errorList = new ArrayList<>(3); if (exception instanceof FlutterError) { FlutterError error = (FlutterError) exception; errorList.add(error.code); @@ -59,35 +60,79 @@ protected static ArrayList wrapError(@NonNull Throwable exception) { return errorList; } + private static class PigeonCodec extends StandardMessageCodec { + public static final PigeonCodec INSTANCE = new PigeonCodec(); + + private PigeonCodec() {} + + @Override + protected Object readValueOfType(byte type, @NonNull ByteBuffer buffer) { + switch (type) { + default: + return super.readValueOfType(type, buffer); + } + } + + @Override + protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) { + { + super.writeValue(stream, value); + } + } + } + + + /** Asynchronous error handling return type for non-nullable API method returns. */ public interface Result { - @SuppressWarnings("UnknownNullness") - void success(T result); + /** Success case callback method for handling returns. */ + void success(@NonNull T result); + + /** Failure case callback method for handling errors. */ + void error(@NonNull Throwable error); + } + /** Asynchronous error handling return type for nullable API method returns. */ + public interface NullableResult { + /** Success case callback method for handling returns. */ + void success(@Nullable T result); + /** Failure case callback method for handling errors. */ + void error(@NonNull Throwable error); + } + /** Asynchronous error handling return type for void API method returns. */ + public interface VoidResult { + /** Success case callback method for handling returns. */ + void success(); + + /** Failure case callback method for handling errors. */ void error(@NonNull Throwable error); } /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ - public interface PigeonLegacyDataProvider { + public interface PinpointLegacyDataProvider { - void getEndpointId(@NonNull String pinpointAppId, @NonNull Result result); + void getEndpointId(@NonNull String pinpointAppId, @NonNull NullableResult result); - /** The codec used by PigeonLegacyDataProvider. */ + /** The codec used by PinpointLegacyDataProvider. */ static @NonNull MessageCodec getCodec() { - return new StandardMessageCodec(); + return PigeonCodec.INSTANCE; + } + /**Sets up an instance of `PinpointLegacyDataProvider` to handle messages through the `binaryMessenger`. */ + static void setUp(@NonNull BinaryMessenger binaryMessenger, @Nullable PinpointLegacyDataProvider api) { + setUp(binaryMessenger, "", api); } - /**Sets up an instance of `PigeonLegacyDataProvider` to handle messages through the `binaryMessenger`. */ - static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable PigeonLegacyDataProvider api) { + static void setUp(@NonNull BinaryMessenger binaryMessenger, @NonNull String messageChannelSuffix, @Nullable PinpointLegacyDataProvider api) { + messageChannelSuffix = messageChannelSuffix.isEmpty() ? "" : "." + messageChannelSuffix; { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.amplify_analytics_pinpoint.PigeonLegacyDataProvider.getEndpointId", getCodec()); + binaryMessenger, "dev.flutter.pigeon.amplify_analytics_pinpoint.PinpointLegacyDataProvider.getEndpointId" + messageChannelSuffix, getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); ArrayList args = (ArrayList) message; String pinpointAppIdArg = (String) args.get(0); - Result resultCallback = - new Result() { + NullableResult resultCallback = + new NullableResult() { public void success(String result) { wrapped.add(0, result); reply.reply(wrapped); diff --git a/packages/analytics/amplify_analytics_pinpoint/android/src/main/kotlin/com/amazonaws/amplify/amplify_analytics_pinpoint/AmplifyAnalyticsPinpointPlugin.kt b/packages/analytics/amplify_analytics_pinpoint/android/src/main/kotlin/com/amazonaws/amplify/amplify_analytics_pinpoint/AmplifyAnalyticsPinpointPlugin.kt index d1068b90c2..8edcab6d05 100644 --- a/packages/analytics/amplify_analytics_pinpoint/android/src/main/kotlin/com/amazonaws/amplify/amplify_analytics_pinpoint/AmplifyAnalyticsPinpointPlugin.kt +++ b/packages/analytics/amplify_analytics_pinpoint/android/src/main/kotlin/com/amazonaws/amplify/amplify_analytics_pinpoint/AmplifyAnalyticsPinpointPlugin.kt @@ -7,7 +7,7 @@ import android.content.Context import android.content.SharedPreferences import io.flutter.embedding.engine.plugins.FlutterPlugin -class AmplifyAnalyticsPinpointPlugin: FlutterPlugin, Messages.PigeonLegacyDataProvider { +class AmplifyAnalyticsPinpointPlugin: FlutterPlugin, Messages.PinpointLegacyDataProvider { private var context: Context? = null private var sharedPrefs: SharedPreferences? = null @@ -19,11 +19,11 @@ class AmplifyAnalyticsPinpointPlugin: FlutterPlugin, Messages.PigeonLegacyDataPr override fun onAttachedToEngine(binding: FlutterPlugin.FlutterPluginBinding) { context = binding.applicationContext - Messages.PigeonLegacyDataProvider.setup(binding.binaryMessenger, this) + Messages.PinpointLegacyDataProvider.setup(binding.binaryMessenger, this) } override fun onDetachedFromEngine(binding: FlutterPlugin.FlutterPluginBinding) { - Messages.PigeonLegacyDataProvider.setup(binding.binaryMessenger, null) + Messages.PinpointLegacyDataProvider.setup(binding.binaryMessenger, null) context = null } diff --git a/packages/analytics/amplify_analytics_pinpoint/lib/src/legacy_native_data_provider/data_provider.android.dart b/packages/analytics/amplify_analytics_pinpoint/lib/src/legacy_native_data_provider/data_provider.android.dart index 3808dd6201..6c49805036 100644 --- a/packages/analytics/amplify_analytics_pinpoint/lib/src/legacy_native_data_provider/data_provider.android.dart +++ b/packages/analytics/amplify_analytics_pinpoint/lib/src/legacy_native_data_provider/data_provider.android.dart @@ -4,16 +4,15 @@ import 'dart:async'; import 'package:amplify_analytics_pinpoint/src/legacy_native_data_provider/pigeon_legacy_data_provider.android.g.dart'; - // ignore: implementation_imports import 'package:amplify_analytics_pinpoint_dart/src/impl/flutter_provider_interfaces/legacy_native_data_provider.dart'; /// {@macro amplify_analytics_pinpoint.flutter_legacy_native_data_provider} class DataProviderAndroid implements LegacyNativeDataProvider { /// {@macro amplify_analytics_pinpoint.flutter_legacy_native_data_provider} - DataProviderAndroid() : _pigeonDataProvider = PigeonLegacyDataProvider(); + DataProviderAndroid() : _pigeonDataProvider = PinpointLegacyDataProvider(); - final PigeonLegacyDataProvider _pigeonDataProvider; + final PinpointLegacyDataProvider _pigeonDataProvider; @override Future getEndpointId(String pinpointAppId) { diff --git a/packages/analytics/amplify_analytics_pinpoint/lib/src/legacy_native_data_provider/pigeon_legacy_data_provider.android.g.dart b/packages/analytics/amplify_analytics_pinpoint/lib/src/legacy_native_data_provider/pigeon_legacy_data_provider.android.g.dart index 8d0fcb92e3..aa21b12551 100644 --- a/packages/analytics/amplify_analytics_pinpoint/lib/src/legacy_native_data_provider/pigeon_legacy_data_provider.android.g.dart +++ b/packages/analytics/amplify_analytics_pinpoint/lib/src/legacy_native_data_provider/pigeon_legacy_data_provider.android.g.dart @@ -1,8 +1,8 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 -// Autogenerated from Pigeon (v11.0.0), do not edit directly. +// Autogenerated from Pigeon (v22.6.2), do not edit directly. // See also: https://pub.dev/packages/pigeon -// ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import +// ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import, no_leading_underscores_for_local_identifiers import 'dart:async'; import 'dart:typed_data' show Float64List, Int32List, Int64List, Uint8List; @@ -10,36 +10,70 @@ import 'dart:typed_data' show Float64List, Int32List, Int64List, Uint8List; import 'package:flutter/foundation.dart' show ReadBuffer, WriteBuffer; import 'package:flutter/services.dart'; -class PigeonLegacyDataProvider { - /// Constructor for [PigeonLegacyDataProvider]. The [binaryMessenger] named argument is +PlatformException _createConnectionError(String channelName) { + return PlatformException( + code: 'channel-error', + message: 'Unable to establish connection on channel: "$channelName".', + ); +} + +class _PigeonCodec extends StandardMessageCodec { + const _PigeonCodec(); + @override + void writeValue(WriteBuffer buffer, Object? value) { + if (value is int) { + buffer.putUint8(4); + buffer.putInt64(value); + } else { + super.writeValue(buffer, value); + } + } + + @override + Object? readValueOfType(int type, ReadBuffer buffer) { + switch (type) { + default: + return super.readValueOfType(type, buffer); + } + } +} + +class PinpointLegacyDataProvider { + /// Constructor for [PinpointLegacyDataProvider]. The [binaryMessenger] named argument is /// available for dependency injection. If it is left null, the default /// BinaryMessenger will be used which routes to the host platform. - PigeonLegacyDataProvider({BinaryMessenger? binaryMessenger}) - : _binaryMessenger = binaryMessenger; - final BinaryMessenger? _binaryMessenger; - - static const MessageCodec codec = StandardMessageCodec(); - - Future getEndpointId(String arg_pinpointAppId) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.amplify_analytics_pinpoint.PigeonLegacyDataProvider.getEndpointId', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_pinpointAppId]) as List?; - if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); - } else if (replyList.length > 1) { + PinpointLegacyDataProvider( + {BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) + : pigeonVar_binaryMessenger = binaryMessenger, + pigeonVar_messageChannelSuffix = + messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; + final BinaryMessenger? pigeonVar_binaryMessenger; + + static const MessageCodec pigeonChannelCodec = _PigeonCodec(); + + final String pigeonVar_messageChannelSuffix; + + Future getEndpointId(String pinpointAppId) async { + final String pigeonVar_channelName = + 'dev.flutter.pigeon.amplify_analytics_pinpoint.PinpointLegacyDataProvider.getEndpointId$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final List? pigeonVar_replyList = await pigeonVar_channel + .send([pinpointAppId]) as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { throw PlatformException( - code: replyList[0]! as String, - message: replyList[1] as String?, - details: replyList[2], + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], ); } else { - return (replyList[0] as String?); + return (pigeonVar_replyList[0] as String?); } } } diff --git a/packages/analytics/amplify_analytics_pinpoint/pigeons/pigeon_config_android.dart b/packages/analytics/amplify_analytics_pinpoint/pigeons/pigeon_config_android.dart index 52426d6e6c..48162f217a 100644 --- a/packages/analytics/amplify_analytics_pinpoint/pigeons/pigeon_config_android.dart +++ b/packages/analytics/amplify_analytics_pinpoint/pigeons/pigeon_config_android.dart @@ -19,7 +19,7 @@ import 'package:pigeon/pigeon.dart'; ), ) @HostApi() -abstract class PigeonLegacyDataProvider { +abstract class PinpointLegacyDataProvider { @async String? getEndpointId(String pinpointAppId); } diff --git a/packages/analytics/amplify_analytics_pinpoint/pubspec.yaml b/packages/analytics/amplify_analytics_pinpoint/pubspec.yaml index cfd338508a..2ba1ce2f3c 100644 --- a/packages/analytics/amplify_analytics_pinpoint/pubspec.yaml +++ b/packages/analytics/amplify_analytics_pinpoint/pubspec.yaml @@ -35,7 +35,7 @@ dev_dependencies: amplify_lints: ">=3.1.0 <3.2.0" flutter_test: sdk: flutter - pigeon: ^11.0.0 + pigeon: ^22.6.2 flutter: plugin: diff --git a/packages/auth/amplify_auth_cognito/android/src/main/kotlin/com/amazonaws/amplify/amplify_auth_cognito/pigeons/NativeAuthPluginBindingsPigeon.kt b/packages/auth/amplify_auth_cognito/android/src/main/kotlin/com/amazonaws/amplify/amplify_auth_cognito/pigeons/NativeAuthPluginBindingsPigeon.kt index adb9547218..00be62a8d1 100644 --- a/packages/auth/amplify_auth_cognito/android/src/main/kotlin/com/amazonaws/amplify/amplify_auth_cognito/pigeons/NativeAuthPluginBindingsPigeon.kt +++ b/packages/auth/amplify_auth_cognito/android/src/main/kotlin/com/amazonaws/amplify/amplify_auth_cognito/pigeons/NativeAuthPluginBindingsPigeon.kt @@ -1,8 +1,9 @@ -// +// // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 -// Autogenerated from Pigeon (v11.0.1), do not edit directly. +// Autogenerated from Pigeon (v22.6.2), do not edit directly. // See also: https://pub.dev/packages/pigeon +@file:Suppress("UNCHECKED_CAST", "ArrayInDataClass") package com.amazonaws.amplify.amplify_auth_cognito @@ -19,14 +20,14 @@ private fun wrapResult(result: Any?): List { } private fun wrapError(exception: Throwable): List { - if (exception is FlutterError) { - return listOf( + return if (exception is FlutterError) { + listOf( exception.code, exception.message, exception.details ) } else { - return listOf( + listOf( exception.javaClass.simpleName, exception.toString(), "Cause: " + exception.cause + ", Stacktrace: " + Log.getStackTraceString(exception) @@ -34,6 +35,9 @@ private fun wrapError(exception: Throwable): List { } } +private fun createConnectionError(channelName: String): FlutterError { + return FlutterError("channel-error", "Unable to establish connection on channel: '$channelName'.", "")} + /** * Error class for passing custom error details to Flutter via a thrown PlatformException. * @property code The error code. @@ -57,25 +61,24 @@ data class NativeUserContextData ( val deviceOsReleaseVersion: String? = null, val screenHeightPixels: Long? = null, val screenWidthPixels: Long? = null - -) { +) + { companion object { - @Suppress("UNCHECKED_CAST") - fun fromList(list: List): NativeUserContextData { - val deviceName = list[0] as String? - val thirdPartyDeviceId = list[1] as String? - val deviceFingerprint = list[2] as String? - val applicationName = list[3] as String? - val applicationVersion = list[4] as String? - val deviceLanguage = list[5] as String? - val deviceOsReleaseVersion = list[6] as String? - val screenHeightPixels = list[7].let { if (it is Int) it.toLong() else it as Long? } - val screenWidthPixels = list[8].let { if (it is Int) it.toLong() else it as Long? } + fun fromList(pigeonVar_list: List): NativeUserContextData { + val deviceName = pigeonVar_list[0] as String? + val thirdPartyDeviceId = pigeonVar_list[1] as String? + val deviceFingerprint = pigeonVar_list[2] as String? + val applicationName = pigeonVar_list[3] as String? + val applicationVersion = pigeonVar_list[4] as String? + val deviceLanguage = pigeonVar_list[5] as String? + val deviceOsReleaseVersion = pigeonVar_list[6] as String? + val screenHeightPixels = pigeonVar_list[7] as Long? + val screenWidthPixels = pigeonVar_list[8] as Long? return NativeUserContextData(deviceName, thirdPartyDeviceId, deviceFingerprint, applicationName, applicationVersion, deviceLanguage, deviceOsReleaseVersion, screenHeightPixels, screenWidthPixels) } } fun toList(): List { - return listOf( + return listOf( deviceName, thirdPartyDeviceId, deviceFingerprint, @@ -99,24 +102,23 @@ data class LegacyCredentialStoreData ( val accessToken: String? = null, val refreshToken: String? = null, val idToken: String? = null - -) { +) + { companion object { - @Suppress("UNCHECKED_CAST") - fun fromList(list: List): LegacyCredentialStoreData { - val identityId = list[0] as String? - val accessKeyId = list[1] as String? - val secretAccessKey = list[2] as String? - val sessionToken = list[3] as String? - val expirationMsSinceEpoch = list[4].let { if (it is Int) it.toLong() else it as Long? } - val accessToken = list[5] as String? - val refreshToken = list[6] as String? - val idToken = list[7] as String? + fun fromList(pigeonVar_list: List): LegacyCredentialStoreData { + val identityId = pigeonVar_list[0] as String? + val accessKeyId = pigeonVar_list[1] as String? + val secretAccessKey = pigeonVar_list[2] as String? + val sessionToken = pigeonVar_list[3] as String? + val expirationMsSinceEpoch = pigeonVar_list[4] as Long? + val accessToken = pigeonVar_list[5] as String? + val refreshToken = pigeonVar_list[6] as String? + val idToken = pigeonVar_list[7] as String? return LegacyCredentialStoreData(identityId, accessKeyId, secretAccessKey, sessionToken, expirationMsSinceEpoch, accessToken, refreshToken, idToken) } } fun toList(): List { - return listOf( + return listOf( identityId, accessKeyId, secretAccessKey, @@ -135,20 +137,19 @@ data class LegacyDeviceDetailsSecret ( val deviceGroupKey: String? = null, val devicePassword: String? = null, val asfDeviceId: String? = null - -) { +) + { companion object { - @Suppress("UNCHECKED_CAST") - fun fromList(list: List): LegacyDeviceDetailsSecret { - val deviceKey = list[0] as String? - val deviceGroupKey = list[1] as String? - val devicePassword = list[2] as String? - val asfDeviceId = list[3] as String? + fun fromList(pigeonVar_list: List): LegacyDeviceDetailsSecret { + val deviceKey = pigeonVar_list[0] as String? + val deviceGroupKey = pigeonVar_list[1] as String? + val devicePassword = pigeonVar_list[2] as String? + val asfDeviceId = pigeonVar_list[3] as String? return LegacyDeviceDetailsSecret(deviceKey, deviceGroupKey, devicePassword, asfDeviceId) } } fun toList(): List { - return listOf( + return listOf( deviceKey, deviceGroupKey, devicePassword, @@ -156,45 +157,22 @@ data class LegacyDeviceDetailsSecret ( ) } } - -/** Generated class from Pigeon that represents Flutter messages that can be called from Kotlin. */ -@Suppress("UNCHECKED_CAST") -class NativeAuthPlugin(private val binaryMessenger: BinaryMessenger) { - companion object { - /** The codec used by NativeAuthPlugin. */ - val codec: MessageCodec by lazy { - StandardMessageCodec() - } - } - /** - * Exchanges the route parameters used to launch the app, i.e. if the app - * was closed and a redirect happened to the custom URI scheme (iOS) or an - * intent was launched with the redirect parameters (Android). - */ - fun exchange(paramsArg: Map, callback: () -> Unit) { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.amplify_auth_cognito.NativeAuthPlugin.exchange", codec) - channel.send(listOf(paramsArg)) { - callback() - } - } -} -@Suppress("UNCHECKED_CAST") -private object NativeAuthBridgeCodec : StandardMessageCodec() { +private open class NativeAuthPluginBindingsPigeonPigeonCodec : StandardMessageCodec() { override fun readValueOfType(type: Byte, buffer: ByteBuffer): Any? { return when (type) { - 128.toByte() -> { + 129.toByte() -> { return (readValue(buffer) as? List)?.let { - LegacyCredentialStoreData.fromList(it) + NativeUserContextData.fromList(it) } } - 129.toByte() -> { + 130.toByte() -> { return (readValue(buffer) as? List)?.let { - LegacyDeviceDetailsSecret.fromList(it) + LegacyCredentialStoreData.fromList(it) } } - 130.toByte() -> { + 131.toByte() -> { return (readValue(buffer) as? List)?.let { - NativeUserContextData.fromList(it) + LegacyDeviceDetailsSecret.fromList(it) } } else -> super.readValueOfType(type, buffer) @@ -202,23 +180,55 @@ private object NativeAuthBridgeCodec : StandardMessageCodec() { } override fun writeValue(stream: ByteArrayOutputStream, value: Any?) { when (value) { - is LegacyCredentialStoreData -> { - stream.write(128) - writeValue(stream, value.toList()) - } - is LegacyDeviceDetailsSecret -> { + is NativeUserContextData -> { stream.write(129) writeValue(stream, value.toList()) } - is NativeUserContextData -> { + is LegacyCredentialStoreData -> { stream.write(130) writeValue(stream, value.toList()) } + is LegacyDeviceDetailsSecret -> { + stream.write(131) + writeValue(stream, value.toList()) + } else -> super.writeValue(stream, value) } } } + +/** Generated class from Pigeon that represents Flutter messages that can be called from Kotlin. */ +class NativeAuthPlugin(private val binaryMessenger: BinaryMessenger, private val messageChannelSuffix: String = "") { + companion object { + /** The codec used by NativeAuthPlugin. */ + val codec: MessageCodec by lazy { + NativeAuthPluginBindingsPigeonPigeonCodec() + } + } + /** + * Exchanges the route parameters used to launch the app, i.e. if the app + * was closed and a redirect happened to the custom URI scheme (iOS) or an + * intent was launched with the redirect parameters (Android). + */ + fun exchange(paramsArg: Map, callback: (Result) -> Unit) +{ + val separatedMessageChannelSuffix = if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" + val channelName = "dev.flutter.pigeon.amplify_auth_cognito.NativeAuthPlugin.exchange$separatedMessageChannelSuffix" + val channel = BasicMessageChannel(binaryMessenger, channelName, codec) + channel.send(listOf(paramsArg)) { + if (it is List<*>) { + if (it.size > 1) { + callback(Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) + } else { + callback(Result.success(Unit)) + } + } else { + callback(Result.failure(createConnectionError(channelName))) + } + } + } +} /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ interface NativeAuthBridge { /** @@ -250,13 +260,14 @@ interface NativeAuthBridge { companion object { /** The codec used by NativeAuthBridge. */ val codec: MessageCodec by lazy { - NativeAuthBridgeCodec + NativeAuthPluginBindingsPigeonPigeonCodec() } /** Sets up an instance of `NativeAuthBridge` to handle messages through the `binaryMessenger`. */ - @Suppress("UNCHECKED_CAST") - fun setUp(binaryMessenger: BinaryMessenger, api: NativeAuthBridge?) { + @JvmOverloads + fun setUp(binaryMessenger: BinaryMessenger, api: NativeAuthBridge?, messageChannelSuffix: String = "") { + val separatedMessageChannelSuffix = if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.amplify_auth_cognito.NativeAuthBridge.signInWithUrl", codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.amplify_auth_cognito.NativeAuthBridge.signInWithUrl$separatedMessageChannelSuffix", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List @@ -279,7 +290,7 @@ interface NativeAuthBridge { } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.amplify_auth_cognito.NativeAuthBridge.signOutWithUrl", codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.amplify_auth_cognito.NativeAuthBridge.signOutWithUrl$separatedMessageChannelSuffix", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List @@ -301,14 +312,13 @@ interface NativeAuthBridge { } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.amplify_auth_cognito.NativeAuthBridge.getValidationData", codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.amplify_auth_cognito.NativeAuthBridge.getValidationData$separatedMessageChannelSuffix", codec) if (api != null) { channel.setMessageHandler { _, reply -> - var wrapped: List - try { - wrapped = listOf(api.getValidationData()) + val wrapped: List = try { + listOf(api.getValidationData()) } catch (exception: Throwable) { - wrapped = wrapError(exception) + wrapError(exception) } reply.reply(wrapped) } @@ -317,14 +327,13 @@ interface NativeAuthBridge { } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.amplify_auth_cognito.NativeAuthBridge.getContextData", codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.amplify_auth_cognito.NativeAuthBridge.getContextData$separatedMessageChannelSuffix", codec) if (api != null) { channel.setMessageHandler { _, reply -> - var wrapped: List - try { - wrapped = listOf(api.getContextData()) + val wrapped: List = try { + listOf(api.getContextData()) } catch (exception: Throwable) { - wrapped = wrapError(exception) + wrapError(exception) } reply.reply(wrapped) } @@ -333,14 +342,13 @@ interface NativeAuthBridge { } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.amplify_auth_cognito.NativeAuthBridge.getBundleId", codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.amplify_auth_cognito.NativeAuthBridge.getBundleId$separatedMessageChannelSuffix", codec) if (api != null) { channel.setMessageHandler { _, reply -> - var wrapped: List - try { - wrapped = listOf(api.getBundleId()) + val wrapped: List = try { + listOf(api.getBundleId()) } catch (exception: Throwable) { - wrapped = wrapError(exception) + wrapError(exception) } reply.reply(wrapped) } @@ -349,7 +357,7 @@ interface NativeAuthBridge { } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.amplify_auth_cognito.NativeAuthBridge.getLegacyCredentials", codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.amplify_auth_cognito.NativeAuthBridge.getLegacyCredentials$separatedMessageChannelSuffix", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List @@ -370,10 +378,10 @@ interface NativeAuthBridge { } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.amplify_auth_cognito.NativeAuthBridge.clearLegacyCredentials", codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.amplify_auth_cognito.NativeAuthBridge.clearLegacyCredentials$separatedMessageChannelSuffix", codec) if (api != null) { channel.setMessageHandler { _, reply -> - api.clearLegacyCredentials() { result: Result -> + api.clearLegacyCredentials{ result: Result -> val error = result.exceptionOrNull() if (error != null) { reply.reply(wrapError(error)) @@ -387,7 +395,7 @@ interface NativeAuthBridge { } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.amplify_auth_cognito.NativeAuthBridge.fetchLegacyDeviceSecrets", codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.amplify_auth_cognito.NativeAuthBridge.fetchLegacyDeviceSecrets$separatedMessageChannelSuffix", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List @@ -408,7 +416,7 @@ interface NativeAuthBridge { } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.amplify_auth_cognito.NativeAuthBridge.deleteLegacyDeviceSecrets", codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.amplify_auth_cognito.NativeAuthBridge.deleteLegacyDeviceSecrets$separatedMessageChannelSuffix", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List diff --git a/packages/auth/amplify_auth_cognito/darwin/Classes/pigeons/messages.g.swift b/packages/auth/amplify_auth_cognito/darwin/Classes/pigeons/messages.g.swift index a029d4fe45..5ad64a8343 100644 --- a/packages/auth/amplify_auth_cognito/darwin/Classes/pigeons/messages.g.swift +++ b/packages/auth/amplify_auth_cognito/darwin/Classes/pigeons/messages.g.swift @@ -1,20 +1,35 @@ -// +// // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 -// Autogenerated from Pigeon (v11.0.1), do not edit directly. +// Autogenerated from Pigeon (v22.6.2), do not edit directly. // See also: https://pub.dev/packages/pigeon import Foundation + #if os(iOS) -import Flutter + import Flutter #elseif os(macOS) -import FlutterMacOS + import FlutterMacOS #else -#error("Unsupported platform.") + #error("Unsupported platform.") #endif -private func isNullish(_ value: Any?) -> Bool { - return value is NSNull || value == nil +/// Error class for passing custom error details to Dart side. +final class PigeonError: Error { + let code: String + let message: String? + let details: Any? + + init(code: String, message: String?, details: Any?) { + self.code = code + self.message = message + self.details = details + } + + var localizedDescription: String { + return + "PigeonError(code: \(code), message: \(message ?? ""), details: \(details ?? "")" + } } private func wrapResult(_ result: Any?) -> [Any?] { @@ -22,20 +37,35 @@ private func wrapResult(_ result: Any?) -> [Any?] { } private func wrapError(_ error: Any) -> [Any?] { + if let pigeonError = error as? PigeonError { + return [ + pigeonError.code, + pigeonError.message, + pigeonError.details, + ] + } if let flutterError = error as? FlutterError { return [ flutterError.code, flutterError.message, - flutterError.details + flutterError.details, ] } return [ "\(error)", "\(type(of: error))", - "Stacktrace: \(Thread.callStackSymbols)" + "Stacktrace: \(Thread.callStackSymbols)", ] } +private func createConnectionError(withChannelName channelName: String) -> PigeonError { + return PigeonError(code: "channel-error", message: "Unable to establish connection on channel: '\(channelName)'.", details: "") +} + +private func isNullish(_ value: Any?) -> Bool { + return value is NSNull || value == nil +} + private func nilOrValue(_ value: Any?) -> T? { if value is NSNull { return nil } return value as! T? @@ -53,16 +83,19 @@ struct NativeUserContextData { var screenHeightPixels: Int64? = nil var screenWidthPixels: Int64? = nil - static func fromList(_ list: [Any?]) -> NativeUserContextData? { - let deviceName: String? = nilOrValue(list[0]) - let thirdPartyDeviceId: String? = nilOrValue(list[1]) - let deviceFingerprint: String? = nilOrValue(list[2]) - let applicationName: String? = nilOrValue(list[3]) - let applicationVersion: String? = nilOrValue(list[4]) - let deviceLanguage: String? = nilOrValue(list[5]) - let deviceOsReleaseVersion: String? = nilOrValue(list[6]) - let screenHeightPixels: Int64? = isNullish(list[7]) ? nil : (list[7] is Int64? ? list[7] as! Int64? : Int64(list[7] as! Int32)) - let screenWidthPixels: Int64? = isNullish(list[8]) ? nil : (list[8] is Int64? ? list[8] as! Int64? : Int64(list[8] as! Int32)) + + + // swift-format-ignore: AlwaysUseLowerCamelCase + static func fromList(_ pigeonVar_list: [Any?]) -> NativeUserContextData? { + let deviceName: String? = nilOrValue(pigeonVar_list[0]) + let thirdPartyDeviceId: String? = nilOrValue(pigeonVar_list[1]) + let deviceFingerprint: String? = nilOrValue(pigeonVar_list[2]) + let applicationName: String? = nilOrValue(pigeonVar_list[3]) + let applicationVersion: String? = nilOrValue(pigeonVar_list[4]) + let deviceLanguage: String? = nilOrValue(pigeonVar_list[5]) + let deviceOsReleaseVersion: String? = nilOrValue(pigeonVar_list[6]) + let screenHeightPixels: Int64? = nilOrValue(pigeonVar_list[7]) + let screenWidthPixels: Int64? = nilOrValue(pigeonVar_list[8]) return NativeUserContextData( deviceName: deviceName, @@ -102,15 +135,18 @@ struct LegacyCredentialStoreData { var refreshToken: String? = nil var idToken: String? = nil - static func fromList(_ list: [Any?]) -> LegacyCredentialStoreData? { - let identityId: String? = nilOrValue(list[0]) - let accessKeyId: String? = nilOrValue(list[1]) - let secretAccessKey: String? = nilOrValue(list[2]) - let sessionToken: String? = nilOrValue(list[3]) - let expirationMsSinceEpoch: Int64? = isNullish(list[4]) ? nil : (list[4] is Int64? ? list[4] as! Int64? : Int64(list[4] as! Int32)) - let accessToken: String? = nilOrValue(list[5]) - let refreshToken: String? = nilOrValue(list[6]) - let idToken: String? = nilOrValue(list[7]) + + + // swift-format-ignore: AlwaysUseLowerCamelCase + static func fromList(_ pigeonVar_list: [Any?]) -> LegacyCredentialStoreData? { + let identityId: String? = nilOrValue(pigeonVar_list[0]) + let accessKeyId: String? = nilOrValue(pigeonVar_list[1]) + let secretAccessKey: String? = nilOrValue(pigeonVar_list[2]) + let sessionToken: String? = nilOrValue(pigeonVar_list[3]) + let expirationMsSinceEpoch: Int64? = nilOrValue(pigeonVar_list[4]) + let accessToken: String? = nilOrValue(pigeonVar_list[5]) + let refreshToken: String? = nilOrValue(pigeonVar_list[6]) + let idToken: String? = nilOrValue(pigeonVar_list[7]) return LegacyCredentialStoreData( identityId: identityId, @@ -144,11 +180,14 @@ struct LegacyDeviceDetailsSecret { var devicePassword: String? = nil var asfDeviceId: String? = nil - static func fromList(_ list: [Any?]) -> LegacyDeviceDetailsSecret? { - let deviceKey: String? = nilOrValue(list[0]) - let deviceGroupKey: String? = nilOrValue(list[1]) - let devicePassword: String? = nilOrValue(list[2]) - let asfDeviceId: String? = nilOrValue(list[3]) + + + // swift-format-ignore: AlwaysUseLowerCamelCase + static func fromList(_ pigeonVar_list: [Any?]) -> LegacyDeviceDetailsSecret? { + let deviceKey: String? = nilOrValue(pigeonVar_list[0]) + let deviceGroupKey: String? = nilOrValue(pigeonVar_list[1]) + let devicePassword: String? = nilOrValue(pigeonVar_list[2]) + let asfDeviceId: String? = nilOrValue(pigeonVar_list[3]) return LegacyDeviceDetailsSecret( deviceKey: deviceKey, @@ -167,68 +206,92 @@ struct LegacyDeviceDetailsSecret { } } -/// Generated class from Pigeon that represents Flutter messages that can be called from Swift. -class NativeAuthPlugin { - private let binaryMessenger: FlutterBinaryMessenger - init(binaryMessenger: FlutterBinaryMessenger){ - self.binaryMessenger = binaryMessenger - } - /// Exchanges the route parameters used to launch the app, i.e. if the app - /// was closed and a redirect happened to the custom URI scheme (iOS) or an - /// intent was launched with the redirect parameters (Android). - func exchange(params paramsArg: [String: String], completion: @escaping () -> Void) { - let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.amplify_auth_cognito.NativeAuthPlugin.exchange", binaryMessenger: binaryMessenger) - channel.sendMessage([paramsArg] as [Any?]) { _ in - completion() - } - } -} -private class NativeAuthBridgeCodecReader: FlutterStandardReader { +private class messagesPigeonCodecReader: FlutterStandardReader { override func readValue(ofType type: UInt8) -> Any? { switch type { - case 128: - return LegacyCredentialStoreData.fromList(self.readValue() as! [Any?]) - case 129: - return LegacyDeviceDetailsSecret.fromList(self.readValue() as! [Any?]) - case 130: - return NativeUserContextData.fromList(self.readValue() as! [Any?]) - default: - return super.readValue(ofType: type) + case 129: + return NativeUserContextData.fromList(self.readValue() as! [Any?]) + case 130: + return LegacyCredentialStoreData.fromList(self.readValue() as! [Any?]) + case 131: + return LegacyDeviceDetailsSecret.fromList(self.readValue() as! [Any?]) + default: + return super.readValue(ofType: type) } } } -private class NativeAuthBridgeCodecWriter: FlutterStandardWriter { +private class messagesPigeonCodecWriter: FlutterStandardWriter { override func writeValue(_ value: Any) { - if let value = value as? LegacyCredentialStoreData { - super.writeByte(128) - super.writeValue(value.toList()) - } else if let value = value as? LegacyDeviceDetailsSecret { + if let value = value as? NativeUserContextData { super.writeByte(129) super.writeValue(value.toList()) - } else if let value = value as? NativeUserContextData { + } else if let value = value as? LegacyCredentialStoreData { super.writeByte(130) super.writeValue(value.toList()) + } else if let value = value as? LegacyDeviceDetailsSecret { + super.writeByte(131) + super.writeValue(value.toList()) } else { super.writeValue(value) } } } -private class NativeAuthBridgeCodecReaderWriter: FlutterStandardReaderWriter { +private class messagesPigeonCodecReaderWriter: FlutterStandardReaderWriter { override func reader(with data: Data) -> FlutterStandardReader { - return NativeAuthBridgeCodecReader(data: data) + return messagesPigeonCodecReader(data: data) } override func writer(with data: NSMutableData) -> FlutterStandardWriter { - return NativeAuthBridgeCodecWriter(data: data) + return messagesPigeonCodecWriter(data: data) } } -class NativeAuthBridgeCodec: FlutterStandardMessageCodec { - static let shared = NativeAuthBridgeCodec(readerWriter: NativeAuthBridgeCodecReaderWriter()) +class messagesPigeonCodec: FlutterStandardMessageCodec, @unchecked Sendable { + static let shared = messagesPigeonCodec(readerWriter: messagesPigeonCodecReaderWriter()) } + +/// Generated protocol from Pigeon that represents Flutter messages that can be called from Swift. +protocol NativeAuthPluginProtocol { + /// Exchanges the route parameters used to launch the app, i.e. if the app + /// was closed and a redirect happened to the custom URI scheme (iOS) or an + /// intent was launched with the redirect parameters (Android). + func exchange(params paramsArg: [String: String], completion: @escaping (Result) -> Void) +} +class NativeAuthPlugin: NativeAuthPluginProtocol { + private let binaryMessenger: FlutterBinaryMessenger + private let messageChannelSuffix: String + init(binaryMessenger: FlutterBinaryMessenger, messageChannelSuffix: String = "") { + self.binaryMessenger = binaryMessenger + self.messageChannelSuffix = messageChannelSuffix.count > 0 ? ".\(messageChannelSuffix)" : "" + } + var codec: messagesPigeonCodec { + return messagesPigeonCodec.shared + } + /// Exchanges the route parameters used to launch the app, i.e. if the app + /// was closed and a redirect happened to the custom URI scheme (iOS) or an + /// intent was launched with the redirect parameters (Android). + func exchange(params paramsArg: [String: String], completion: @escaping (Result) -> Void) { + let channelName: String = "dev.flutter.pigeon.amplify_auth_cognito.NativeAuthPlugin.exchange\(messageChannelSuffix)" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([paramsArg] as [Any?]) { response in + guard let listResponse = response as? [Any?] else { + completion(.failure(createConnectionError(withChannelName: channelName))) + return + } + if listResponse.count > 1 { + let code: String = listResponse[0] as! String + let message: String? = nilOrValue(listResponse[1]) + let details: String? = nilOrValue(listResponse[2]) + completion(.failure(PigeonError(code: code, message: message, details: details))) + } else { + completion(.success(Void())) + } + } + } +} /// Generated protocol from Pigeon that represents a handler of messages from Flutter. protocol NativeAuthBridge { /// Sign in by presenting [url] and waiting for a response to a URL with @@ -256,15 +319,15 @@ protocol NativeAuthBridge { /// Generated setup class from Pigeon to handle messages through the `binaryMessenger`. class NativeAuthBridgeSetup { - /// The codec used by NativeAuthBridge. - static var codec: FlutterStandardMessageCodec { NativeAuthBridgeCodec.shared } + static var codec: FlutterStandardMessageCodec { messagesPigeonCodec.shared } /// Sets up an instance of `NativeAuthBridge` to handle messages through the `binaryMessenger`. - static func setUp(binaryMessenger: FlutterBinaryMessenger, api: NativeAuthBridge?) { + static func setUp(binaryMessenger: FlutterBinaryMessenger, api: NativeAuthBridge?, messageChannelSuffix: String = "") { + let channelSuffix = messageChannelSuffix.count > 0 ? ".\(messageChannelSuffix)" : "" /// Sign in by presenting [url] and waiting for a response to a URL with /// [callbackUrlScheme]. /// /// If [preferPrivateSession] is `true`, do not persist session cookies. - let signInWithUrlChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.amplify_auth_cognito.NativeAuthBridge.signInWithUrl", binaryMessenger: binaryMessenger, codec: codec) + let signInWithUrlChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.amplify_auth_cognito.NativeAuthBridge.signInWithUrl\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) if let api = api { signInWithUrlChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -274,10 +337,10 @@ class NativeAuthBridgeSetup { let browserPackageNameArg: String? = nilOrValue(args[3]) api.signInWithUrl(url: urlArg, callbackUrlScheme: callbackUrlSchemeArg, preferPrivateSession: preferPrivateSessionArg, browserPackageName: browserPackageNameArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -286,7 +349,7 @@ class NativeAuthBridgeSetup { } /// Sign out by presenting [url] and waiting for a response to a URL with /// [callbackUrlScheme]. - let signOutWithUrlChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.amplify_auth_cognito.NativeAuthBridge.signOutWithUrl", binaryMessenger: binaryMessenger, codec: codec) + let signOutWithUrlChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.amplify_auth_cognito.NativeAuthBridge.signOutWithUrl\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) if let api = api { signOutWithUrlChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -296,10 +359,10 @@ class NativeAuthBridgeSetup { let browserPackageNameArg: String? = nilOrValue(args[3]) api.signOutWithUrl(url: urlArg, callbackUrlScheme: callbackUrlSchemeArg, preferPrivateSession: preferPrivateSessionArg, browserPackageName: browserPackageNameArg) { result in switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -307,7 +370,7 @@ class NativeAuthBridgeSetup { signOutWithUrlChannel.setMessageHandler(nil) } /// Retrieves the validation data for the current iOS/Android device. - let getValidationDataChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.amplify_auth_cognito.NativeAuthBridge.getValidationData", binaryMessenger: binaryMessenger, codec: codec) + let getValidationDataChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.amplify_auth_cognito.NativeAuthBridge.getValidationData\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) if let api = api { getValidationDataChannel.setMessageHandler { _, reply in do { @@ -321,7 +384,7 @@ class NativeAuthBridgeSetup { getValidationDataChannel.setMessageHandler(nil) } /// Retrieves context data as required for advanced security features (ASF). - let getContextDataChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.amplify_auth_cognito.NativeAuthBridge.getContextData", binaryMessenger: binaryMessenger, codec: codec) + let getContextDataChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.amplify_auth_cognito.NativeAuthBridge.getContextData\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) if let api = api { getContextDataChannel.setMessageHandler { _, reply in do { @@ -334,7 +397,7 @@ class NativeAuthBridgeSetup { } else { getContextDataChannel.setMessageHandler(nil) } - let getBundleIdChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.amplify_auth_cognito.NativeAuthBridge.getBundleId", binaryMessenger: binaryMessenger, codec: codec) + let getBundleIdChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.amplify_auth_cognito.NativeAuthBridge.getBundleId\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) if let api = api { getBundleIdChannel.setMessageHandler { _, reply in do { @@ -348,7 +411,7 @@ class NativeAuthBridgeSetup { getBundleIdChannel.setMessageHandler(nil) } /// Fetch legacy credentials stored by native SDKs. - let getLegacyCredentialsChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.amplify_auth_cognito.NativeAuthBridge.getLegacyCredentials", binaryMessenger: binaryMessenger, codec: codec) + let getLegacyCredentialsChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.amplify_auth_cognito.NativeAuthBridge.getLegacyCredentials\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) if let api = api { getLegacyCredentialsChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -356,10 +419,10 @@ class NativeAuthBridgeSetup { let appClientIdArg: String? = nilOrValue(args[1]) api.getLegacyCredentials(identityPoolId: identityPoolIdArg, appClientId: appClientIdArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -367,15 +430,15 @@ class NativeAuthBridgeSetup { getLegacyCredentialsChannel.setMessageHandler(nil) } /// Clears the legacy credential store data. - let clearLegacyCredentialsChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.amplify_auth_cognito.NativeAuthBridge.clearLegacyCredentials", binaryMessenger: binaryMessenger, codec: codec) + let clearLegacyCredentialsChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.amplify_auth_cognito.NativeAuthBridge.clearLegacyCredentials\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) if let api = api { clearLegacyCredentialsChannel.setMessageHandler { _, reply in - api.clearLegacyCredentials() { result in + api.clearLegacyCredentials { result in switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -383,7 +446,7 @@ class NativeAuthBridgeSetup { clearLegacyCredentialsChannel.setMessageHandler(nil) } /// Fetch legacy device secrets stored by native SDKs. - let fetchLegacyDeviceSecretsChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.amplify_auth_cognito.NativeAuthBridge.fetchLegacyDeviceSecrets", binaryMessenger: binaryMessenger, codec: codec) + let fetchLegacyDeviceSecretsChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.amplify_auth_cognito.NativeAuthBridge.fetchLegacyDeviceSecrets\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) if let api = api { fetchLegacyDeviceSecretsChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -391,10 +454,10 @@ class NativeAuthBridgeSetup { let userPoolIdArg = args[1] as! String api.fetchLegacyDeviceSecrets(username: usernameArg, userPoolId: userPoolIdArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -402,7 +465,7 @@ class NativeAuthBridgeSetup { fetchLegacyDeviceSecretsChannel.setMessageHandler(nil) } /// Clears the legacy device secrets. - let deleteLegacyDeviceSecretsChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.amplify_auth_cognito.NativeAuthBridge.deleteLegacyDeviceSecrets", binaryMessenger: binaryMessenger, codec: codec) + let deleteLegacyDeviceSecretsChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.amplify_auth_cognito.NativeAuthBridge.deleteLegacyDeviceSecrets\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) if let api = api { deleteLegacyDeviceSecretsChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -410,10 +473,10 @@ class NativeAuthBridgeSetup { let userPoolIdArg = args[1] as! String api.deleteLegacyDeviceSecrets(username: usernameArg, userPoolId: userPoolIdArg) { result in switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) } } } diff --git a/packages/auth/amplify_auth_cognito/example/integration_test/native_auth_bridge_test.dart b/packages/auth/amplify_auth_cognito/example/integration_test/native_auth_bridge_test.dart index 7ff9a0ca6c..5bee21a3e3 100644 --- a/packages/auth/amplify_auth_cognito/example/integration_test/native_auth_bridge_test.dart +++ b/packages/auth/amplify_auth_cognito/example/integration_test/native_auth_bridge_test.dart @@ -114,16 +114,16 @@ typedef SignInOutFn = Future Function( class MockNativeAuthBridge extends Fake implements NativeAuthBridge { MockNativeAuthBridge({ - SignInOutFn>? signInWithUrl, + SignInOutFn>? signInWithUrl, SignInOutFn? signOutWithUrl, }) : _signInWithUrl = signInWithUrl, _signOutWithUrl = signOutWithUrl; - final SignInOutFn>? _signInWithUrl; + final SignInOutFn>? _signInWithUrl; final SignInOutFn? _signOutWithUrl; @override - Future> signInWithUrl( + Future> signInWithUrl( String argUrl, String argCallbackurlscheme, bool argPreferprivatesession, diff --git a/packages/auth/amplify_auth_cognito/example/macos/Flutter/GeneratedPluginRegistrant.swift b/packages/auth/amplify_auth_cognito/example/macos/Flutter/GeneratedPluginRegistrant.swift index 0845788d3d..723ec8543e 100644 --- a/packages/auth/amplify_auth_cognito/example/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/packages/auth/amplify_auth_cognito/example/macos/Flutter/GeneratedPluginRegistrant.swift @@ -12,7 +12,6 @@ import device_info_plus import package_info_plus import path_provider_foundation import url_launcher_macos -import webview_flutter_wkwebview func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { AmplifyAuthCognitoPlugin.register(with: registry.registrar(forPlugin: "AmplifyAuthCognitoPlugin")) @@ -22,5 +21,4 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin")) PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin")) - FLTWebViewFlutterPlugin.register(with: registry.registrar(forPlugin: "FLTWebViewFlutterPlugin")) } diff --git a/packages/auth/amplify_auth_cognito/lib/src/auth_plugin_impl.dart b/packages/auth/amplify_auth_cognito/lib/src/auth_plugin_impl.dart index 7b9889f309..15cb606344 100644 --- a/packages/auth/amplify_auth_cognito/lib/src/auth_plugin_impl.dart +++ b/packages/auth/amplify_auth_cognito/lib/src/auth_plugin_impl.dart @@ -60,7 +60,7 @@ class AmplifyAuthCognito extends AmplifyAuthCognitoDart with AWSDebuggable { // Configure this plugin to act as a native iOS/Android plugin. final nativePlugin = _NativeAmplifyAuthCognito(stateMachine); - NativeAuthPlugin.setup(nativePlugin); + NativeAuthPlugin.setUp(nativePlugin); final nativeBridge = NativeAuthBridge(); stateMachine diff --git a/packages/auth/amplify_auth_cognito/lib/src/native_auth_plugin.g.dart b/packages/auth/amplify_auth_cognito/lib/src/native_auth_plugin.g.dart index 0cde16746c..9cd7791034 100644 --- a/packages/auth/amplify_auth_cognito/lib/src/native_auth_plugin.g.dart +++ b/packages/auth/amplify_auth_cognito/lib/src/native_auth_plugin.g.dart @@ -1,9 +1,9 @@ // // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 -// Autogenerated from Pigeon (v11.0.1), do not edit directly. +// Autogenerated from Pigeon (v22.6.2), do not edit directly. // See also: https://pub.dev/packages/pigeon -// ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import +// ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import, no_leading_underscores_for_local_identifiers import 'dart:async'; import 'dart:typed_data' show Float64List, Int32List, Int64List, Uint8List; @@ -11,6 +11,24 @@ import 'dart:typed_data' show Float64List, Int32List, Int64List, Uint8List; import 'package:flutter/foundation.dart' show ReadBuffer, WriteBuffer; import 'package:flutter/services.dart'; +PlatformException _createConnectionError(String channelName) { + return PlatformException( + code: 'channel-error', + message: 'Unable to establish connection on channel: "$channelName".', + ); +} + +List wrapResponse( + {Object? result, PlatformException? error, bool empty = false}) { + if (empty) { + return []; + } + if (error == null) { + return [result]; + } + return [error.code, error.message, error.details]; +} + class NativeUserContextData { NativeUserContextData({ this.deviceName, @@ -164,52 +182,22 @@ class LegacyDeviceDetailsSecret { } } -abstract class NativeAuthPlugin { - static const MessageCodec codec = StandardMessageCodec(); - - /// Exchanges the route parameters used to launch the app, i.e. if the app - /// was closed and a redirect happened to the custom URI scheme (iOS) or an - /// intent was launched with the redirect parameters (Android). - void exchange(Map params); - - static void setup(NativeAuthPlugin? api, {BinaryMessenger? binaryMessenger}) { - { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.amplify_auth_cognito.NativeAuthPlugin.exchange', - codec, - binaryMessenger: binaryMessenger); - if (api == null) { - channel.setMessageHandler(null); - } else { - channel.setMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.amplify_auth_cognito.NativeAuthPlugin.exchange was null.'); - final List args = (message as List?)!; - final Map? arg_params = - (args[0] as Map?)?.cast(); - assert(arg_params != null, - 'Argument for dev.flutter.pigeon.amplify_auth_cognito.NativeAuthPlugin.exchange was null, expected non-null Map.'); - api.exchange(arg_params!); - return; - }); - } - } - } -} - -class _NativeAuthBridgeCodec extends StandardMessageCodec { - const _NativeAuthBridgeCodec(); +class _PigeonCodec extends StandardMessageCodec { + const _PigeonCodec(); @override void writeValue(WriteBuffer buffer, Object? value) { - if (value is LegacyCredentialStoreData) { - buffer.putUint8(128); - writeValue(buffer, value.encode()); - } else if (value is LegacyDeviceDetailsSecret) { + if (value is int) { + buffer.putUint8(4); + buffer.putInt64(value); + } else if (value is NativeUserContextData) { buffer.putUint8(129); writeValue(buffer, value.encode()); - } else if (value is NativeUserContextData) { + } else if (value is LegacyCredentialStoreData) { buffer.putUint8(130); writeValue(buffer, value.encode()); + } else if (value is LegacyDeviceDetailsSecret) { + buffer.putUint8(131); + writeValue(buffer, value.encode()); } else { super.writeValue(buffer, value); } @@ -218,92 +206,150 @@ class _NativeAuthBridgeCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: - return LegacyCredentialStoreData.decode(readValue(buffer)!); case 129: - return LegacyDeviceDetailsSecret.decode(readValue(buffer)!); - case 130: return NativeUserContextData.decode(readValue(buffer)!); + case 130: + return LegacyCredentialStoreData.decode(readValue(buffer)!); + case 131: + return LegacyDeviceDetailsSecret.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); } } } +abstract class NativeAuthPlugin { + static const MessageCodec pigeonChannelCodec = _PigeonCodec(); + + /// Exchanges the route parameters used to launch the app, i.e. if the app + /// was closed and a redirect happened to the custom URI scheme (iOS) or an + /// intent was launched with the redirect parameters (Android). + void exchange(Map params); + + static void setUp( + NativeAuthPlugin? api, { + BinaryMessenger? binaryMessenger, + String messageChannelSuffix = '', + }) { + messageChannelSuffix = + messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; + { + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< + Object?>( + 'dev.flutter.pigeon.amplify_auth_cognito.NativeAuthPlugin.exchange$messageChannelSuffix', + pigeonChannelCodec, + binaryMessenger: binaryMessenger); + if (api == null) { + pigeonVar_channel.setMessageHandler(null); + } else { + pigeonVar_channel.setMessageHandler((Object? message) async { + assert(message != null, + 'Argument for dev.flutter.pigeon.amplify_auth_cognito.NativeAuthPlugin.exchange was null.'); + final List args = (message as List?)!; + final Map? arg_params = + (args[0] as Map?)?.cast(); + assert(arg_params != null, + 'Argument for dev.flutter.pigeon.amplify_auth_cognito.NativeAuthPlugin.exchange was null, expected non-null Map.'); + try { + api.exchange(arg_params!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } + }); + } + } + } +} + class NativeAuthBridge { /// Constructor for [NativeAuthBridge]. The [binaryMessenger] named argument is /// available for dependency injection. If it is left null, the default /// BinaryMessenger will be used which routes to the host platform. - NativeAuthBridge({BinaryMessenger? binaryMessenger}) - : _binaryMessenger = binaryMessenger; - final BinaryMessenger? _binaryMessenger; + NativeAuthBridge( + {BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) + : pigeonVar_binaryMessenger = binaryMessenger, + pigeonVar_messageChannelSuffix = + messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; + final BinaryMessenger? pigeonVar_binaryMessenger; - static const MessageCodec codec = _NativeAuthBridgeCodec(); + static const MessageCodec pigeonChannelCodec = _PigeonCodec(); + + final String pigeonVar_messageChannelSuffix; /// Sign in by presenting [url] and waiting for a response to a URL with /// [callbackUrlScheme]. /// /// If [preferPrivateSession] is `true`, do not persist session cookies. - Future> signInWithUrl( - String arg_url, - String arg_callbackUrlScheme, - bool arg_preferPrivateSession, - String? arg_browserPackageName) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.amplify_auth_cognito.NativeAuthBridge.signInWithUrl', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = await channel.send([ - arg_url, - arg_callbackUrlScheme, - arg_preferPrivateSession, - arg_browserPackageName + Future> signInWithUrl( + String url, + String callbackUrlScheme, + bool preferPrivateSession, + String? browserPackageName) async { + final String pigeonVar_channelName = + 'dev.flutter.pigeon.amplify_auth_cognito.NativeAuthBridge.signInWithUrl$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final List? pigeonVar_replyList = await pigeonVar_channel + .send([ + url, + callbackUrlScheme, + preferPrivateSession, + browserPackageName ]) as List?; - if (replyList == null) { + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], ); - } else if (replyList.length > 1) { - throw PlatformException( - code: replyList[0]! as String, - message: replyList[1] as String?, - details: replyList[2], - ); - } else if (replyList[0] == null) { + } else if (pigeonVar_replyList[0] == null) { throw PlatformException( code: 'null-error', message: 'Host platform returned null value for non-null return value.', ); } else { - return (replyList[0] as Map?)!.cast(); + return (pigeonVar_replyList[0] as Map?)! + .cast(); } } /// Sign out by presenting [url] and waiting for a response to a URL with /// [callbackUrlScheme]. - Future signOutWithUrl(String arg_url, String arg_callbackUrlScheme, - bool arg_preferPrivateSession, String? arg_browserPackageName) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.amplify_auth_cognito.NativeAuthBridge.signOutWithUrl', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = await channel.send([ - arg_url, - arg_callbackUrlScheme, - arg_preferPrivateSession, - arg_browserPackageName + Future signOutWithUrl(String url, String callbackUrlScheme, + bool preferPrivateSession, String? browserPackageName) async { + final String pigeonVar_channelName = + 'dev.flutter.pigeon.amplify_auth_cognito.NativeAuthBridge.signOutWithUrl$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final List? pigeonVar_replyList = await pigeonVar_channel + .send([ + url, + callbackUrlScheme, + preferPrivateSession, + browserPackageName ]) as List?; - if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); - } else if (replyList.length > 1) { + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { throw PlatformException( - code: replyList[0]! as String, - message: replyList[1] as String?, - details: replyList[2], + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], ); } else { return; @@ -311,135 +357,145 @@ class NativeAuthBridge { } /// Retrieves the validation data for the current iOS/Android device. - Future> getValidationData() async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.amplify_auth_cognito.NativeAuthBridge.getValidationData', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = await channel.send(null) as List?; - if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); - } else if (replyList.length > 1) { + Future> getValidationData() async { + final String pigeonVar_channelName = + 'dev.flutter.pigeon.amplify_auth_cognito.NativeAuthBridge.getValidationData$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final List? pigeonVar_replyList = + await pigeonVar_channel.send(null) as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { throw PlatformException( - code: replyList[0]! as String, - message: replyList[1] as String?, - details: replyList[2], + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], ); - } else if (replyList[0] == null) { + } else if (pigeonVar_replyList[0] == null) { throw PlatformException( code: 'null-error', message: 'Host platform returned null value for non-null return value.', ); } else { - return (replyList[0] as Map?)!.cast(); + return (pigeonVar_replyList[0] as Map?)! + .cast(); } } /// Retrieves context data as required for advanced security features (ASF). Future getContextData() async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.amplify_auth_cognito.NativeAuthBridge.getContextData', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = await channel.send(null) as List?; - if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); - } else if (replyList.length > 1) { + final String pigeonVar_channelName = + 'dev.flutter.pigeon.amplify_auth_cognito.NativeAuthBridge.getContextData$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final List? pigeonVar_replyList = + await pigeonVar_channel.send(null) as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { throw PlatformException( - code: replyList[0]! as String, - message: replyList[1] as String?, - details: replyList[2], + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], ); - } else if (replyList[0] == null) { + } else if (pigeonVar_replyList[0] == null) { throw PlatformException( code: 'null-error', message: 'Host platform returned null value for non-null return value.', ); } else { - return (replyList[0] as NativeUserContextData?)!; + return (pigeonVar_replyList[0] as NativeUserContextData?)!; } } Future getBundleId() async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.amplify_auth_cognito.NativeAuthBridge.getBundleId', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = await channel.send(null) as List?; - if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); - } else if (replyList.length > 1) { + final String pigeonVar_channelName = + 'dev.flutter.pigeon.amplify_auth_cognito.NativeAuthBridge.getBundleId$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final List? pigeonVar_replyList = + await pigeonVar_channel.send(null) as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { throw PlatformException( - code: replyList[0]! as String, - message: replyList[1] as String?, - details: replyList[2], + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], ); - } else if (replyList[0] == null) { + } else if (pigeonVar_replyList[0] == null) { throw PlatformException( code: 'null-error', message: 'Host platform returned null value for non-null return value.', ); } else { - return (replyList[0] as String?)!; + return (pigeonVar_replyList[0] as String?)!; } } /// Fetch legacy credentials stored by native SDKs. Future getLegacyCredentials( - String? arg_identityPoolId, String? arg_appClientId) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.amplify_auth_cognito.NativeAuthBridge.getLegacyCredentials', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_identityPoolId, arg_appClientId]) as List?; - if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); - } else if (replyList.length > 1) { + String? identityPoolId, String? appClientId) async { + final String pigeonVar_channelName = + 'dev.flutter.pigeon.amplify_auth_cognito.NativeAuthBridge.getLegacyCredentials$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final List? pigeonVar_replyList = await pigeonVar_channel + .send([identityPoolId, appClientId]) as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { throw PlatformException( - code: replyList[0]! as String, - message: replyList[1] as String?, - details: replyList[2], + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], ); - } else if (replyList[0] == null) { + } else if (pigeonVar_replyList[0] == null) { throw PlatformException( code: 'null-error', message: 'Host platform returned null value for non-null return value.', ); } else { - return (replyList[0] as LegacyCredentialStoreData?)!; + return (pigeonVar_replyList[0] as LegacyCredentialStoreData?)!; } } /// Clears the legacy credential store data. Future clearLegacyCredentials() async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.amplify_auth_cognito.NativeAuthBridge.clearLegacyCredentials', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = await channel.send(null) as List?; - if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); - } else if (replyList.length > 1) { + final String pigeonVar_channelName = + 'dev.flutter.pigeon.amplify_auth_cognito.NativeAuthBridge.clearLegacyCredentials$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final List? pigeonVar_replyList = + await pigeonVar_channel.send(null) as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { throw PlatformException( - code: replyList[0]! as String, - message: replyList[1] as String?, - details: replyList[2], + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], ); } else { return; @@ -448,48 +504,50 @@ class NativeAuthBridge { /// Fetch legacy device secrets stored by native SDKs. Future fetchLegacyDeviceSecrets( - String arg_username, String arg_userPoolId) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.amplify_auth_cognito.NativeAuthBridge.fetchLegacyDeviceSecrets', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_username, arg_userPoolId]) as List?; - if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); - } else if (replyList.length > 1) { + String username, String userPoolId) async { + final String pigeonVar_channelName = + 'dev.flutter.pigeon.amplify_auth_cognito.NativeAuthBridge.fetchLegacyDeviceSecrets$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final List? pigeonVar_replyList = await pigeonVar_channel + .send([username, userPoolId]) as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { throw PlatformException( - code: replyList[0]! as String, - message: replyList[1] as String?, - details: replyList[2], + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], ); } else { - return (replyList[0] as LegacyDeviceDetailsSecret?); + return (pigeonVar_replyList[0] as LegacyDeviceDetailsSecret?); } } /// Clears the legacy device secrets. Future deleteLegacyDeviceSecrets( - String arg_username, String arg_userPoolId) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.amplify_auth_cognito.NativeAuthBridge.deleteLegacyDeviceSecrets', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_username, arg_userPoolId]) as List?; - if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); - } else if (replyList.length > 1) { + String username, String userPoolId) async { + final String pigeonVar_channelName = + 'dev.flutter.pigeon.amplify_auth_cognito.NativeAuthBridge.deleteLegacyDeviceSecrets$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final List? pigeonVar_replyList = await pigeonVar_channel + .send([username, userPoolId]) as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { throw PlatformException( - code: replyList[0]! as String, - message: replyList[1] as String?, - details: replyList[2], + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], ); } else { return; diff --git a/packages/auth/amplify_auth_cognito/pubspec.yaml b/packages/auth/amplify_auth_cognito/pubspec.yaml index 56f739c698..6a0a6948d7 100644 --- a/packages/auth/amplify_auth_cognito/pubspec.yaml +++ b/packages/auth/amplify_auth_cognito/pubspec.yaml @@ -38,7 +38,7 @@ dev_dependencies: amplify_lints: ">=3.1.0 <3.2.0" flutter_test: sdk: flutter - pigeon: ^11.0.0 + pigeon: ^22.6.2 flutter: plugin: diff --git a/packages/auth/amplify_auth_cognito/test/hosted_ui_platform_flutter_test.dart b/packages/auth/amplify_auth_cognito/test/hosted_ui_platform_flutter_test.dart index 92546d2163..3ee187f4f9 100644 --- a/packages/auth/amplify_auth_cognito/test/hosted_ui_platform_flutter_test.dart +++ b/packages/auth/amplify_auth_cognito/test/hosted_ui_platform_flutter_test.dart @@ -79,7 +79,7 @@ void main() { final class ThrowingNativeBridge extends Fake implements NativeAuthBridge { @override - Future> signInWithUrl( + Future> signInWithUrl( String arg_url, String arg_callbackUrlScheme, bool arg_preferPrivateSession, diff --git a/packages/notifications/push/amplify_push_notifications/android/src/main/kotlin/com/amazonaws/amplify/amplify_push_notifications/PushNotificationsHostApiBindings.java b/packages/notifications/push/amplify_push_notifications/android/src/main/kotlin/com/amazonaws/amplify/amplify_push_notifications/PushNotificationsHostApiBindings.java index e39bfea8bb..7404beee51 100644 --- a/packages/notifications/push/amplify_push_notifications/android/src/main/kotlin/com/amazonaws/amplify/amplify_push_notifications/PushNotificationsHostApiBindings.java +++ b/packages/notifications/push/amplify_push_notifications/android/src/main/kotlin/com/amazonaws/amplify/amplify_push_notifications/PushNotificationsHostApiBindings.java @@ -1,11 +1,14 @@ -// +// // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 -// Autogenerated from Pigeon (v11.0.0), do not edit directly. +// Autogenerated from Pigeon (v22.6.2), do not edit directly. // See also: https://pub.dev/packages/pigeon package com.amazonaws.amplify.amplify_push_notifications; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.RetentionPolicy.CLASS; + import android.util.Log; import androidx.annotation.NonNull; import androidx.annotation.Nullable; @@ -14,6 +17,8 @@ import io.flutter.plugin.common.MessageCodec; import io.flutter.plugin.common.StandardMessageCodec; import java.io.ByteArrayOutputStream; +import java.lang.annotation.Retention; +import java.lang.annotation.Target; import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.Arrays; @@ -21,6 +26,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Objects; /** Generated class from Pigeon. */ @SuppressWarnings({"unused", "unchecked", "CodeBlock2Expr", "RedundantSuppression", "serial"}) @@ -45,7 +51,7 @@ public FlutterError(@NonNull String code, @Nullable String message, @Nullable Ob @NonNull protected static ArrayList wrapError(@NonNull Throwable exception) { - ArrayList errorList = new ArrayList(3); + ArrayList errorList = new ArrayList<>(3); if (exception instanceof FlutterError) { FlutterError error = (FlutterError) exception; errorList.add(error.code); @@ -60,6 +66,15 @@ protected static ArrayList wrapError(@NonNull Throwable exception) { return errorList; } + @NonNull + protected static FlutterError createConnectionError(@NonNull String channelName) { + return new FlutterError("channel-error", "Unable to establish connection on channel: " + channelName + ".", ""); + } + + @Target(METHOD) + @Retention(CLASS) + @interface CanIgnoreReturnValue {} + public enum PermissionStatus { SHOULD_REQUEST(0), SHOULD_EXPLAIN_THEN_REQUEST(1), @@ -68,7 +83,7 @@ public enum PermissionStatus { final int index; - private PermissionStatus(final int index) { + PermissionStatus(final int index) { this.index = index; } } @@ -117,10 +132,24 @@ public void setBadge(@NonNull Boolean setterArg) { /** Constructor is non-public to enforce null safety; use Builder. */ PermissionsOptions() {} + @Override + public boolean equals(Object o) { + if (this == o) { return true; } + if (o == null || getClass() != o.getClass()) { return false; } + PermissionsOptions that = (PermissionsOptions) o; + return alert.equals(that.alert) && sound.equals(that.sound) && badge.equals(that.badge); + } + + @Override + public int hashCode() { + return Objects.hash(alert, sound, badge); + } + public static final class Builder { private @Nullable Boolean alert; + @CanIgnoreReturnValue public @NonNull Builder setAlert(@NonNull Boolean setterArg) { this.alert = setterArg; return this; @@ -128,6 +157,7 @@ public static final class Builder { private @Nullable Boolean sound; + @CanIgnoreReturnValue public @NonNull Builder setSound(@NonNull Boolean setterArg) { this.sound = setterArg; return this; @@ -135,6 +165,7 @@ public static final class Builder { private @Nullable Boolean badge; + @CanIgnoreReturnValue public @NonNull Builder setBadge(@NonNull Boolean setterArg) { this.badge = setterArg; return this; @@ -151,20 +182,20 @@ public static final class Builder { @NonNull ArrayList toList() { - ArrayList toListResult = new ArrayList(3); + ArrayList toListResult = new ArrayList<>(3); toListResult.add(alert); toListResult.add(sound); toListResult.add(badge); return toListResult; } - static @NonNull PermissionsOptions fromList(@NonNull ArrayList list) { + static @NonNull PermissionsOptions fromList(@NonNull ArrayList pigeonVar_list) { PermissionsOptions pigeonResult = new PermissionsOptions(); - Object alert = list.get(0); + Object alert = pigeonVar_list.get(0); pigeonResult.setAlert((Boolean) alert); - Object sound = list.get(1); + Object sound = pigeonVar_list.get(1); pigeonResult.setSound((Boolean) sound); - Object badge = list.get(2); + Object badge = pigeonVar_list.get(2); pigeonResult.setBadge((Boolean) badge); return pigeonResult; } @@ -188,10 +219,24 @@ public void setStatus(@NonNull PermissionStatus setterArg) { /** Constructor is non-public to enforce null safety; use Builder. */ GetPermissionStatusResult() {} + @Override + public boolean equals(Object o) { + if (this == o) { return true; } + if (o == null || getClass() != o.getClass()) { return false; } + GetPermissionStatusResult that = (GetPermissionStatusResult) o; + return status.equals(that.status); + } + + @Override + public int hashCode() { + return Objects.hash(status); + } + public static final class Builder { private @Nullable PermissionStatus status; + @CanIgnoreReturnValue public @NonNull Builder setStatus(@NonNull PermissionStatus setterArg) { this.status = setterArg; return this; @@ -206,38 +251,35 @@ public static final class Builder { @NonNull ArrayList toList() { - ArrayList toListResult = new ArrayList(1); - toListResult.add(status == null ? null : status.index); + ArrayList toListResult = new ArrayList<>(1); + toListResult.add(status); return toListResult; } - static @NonNull GetPermissionStatusResult fromList(@NonNull ArrayList list) { + static @NonNull GetPermissionStatusResult fromList(@NonNull ArrayList pigeonVar_list) { GetPermissionStatusResult pigeonResult = new GetPermissionStatusResult(); - Object status = list.get(0); - pigeonResult.setStatus(PermissionStatus.values()[(int) status]); + Object status = pigeonVar_list.get(0); + pigeonResult.setStatus((PermissionStatus) status); return pigeonResult; } } - public interface Result { - @SuppressWarnings("UnknownNullness") - void success(T result); - - void error(@NonNull Throwable error); - } - - private static class PushNotificationsFlutterApiCodec extends StandardMessageCodec { - public static final PushNotificationsFlutterApiCodec INSTANCE = new PushNotificationsFlutterApiCodec(); + private static class PigeonCodec extends StandardMessageCodec { + public static final PigeonCodec INSTANCE = new PigeonCodec(); - private PushNotificationsFlutterApiCodec() {} + private PigeonCodec() {} @Override protected Object readValueOfType(byte type, @NonNull ByteBuffer buffer) { switch (type) { - case (byte) 128: - return GetPermissionStatusResult.fromList((ArrayList) readValue(buffer)); - case (byte) 129: + case (byte) 129: { + Object value = readValue(buffer); + return value == null ? null : PermissionStatus.values()[((Long) value).intValue()]; + } + case (byte) 130: return PermissionsOptions.fromList((ArrayList) readValue(buffer)); + case (byte) 131: + return GetPermissionStatusResult.fromList((ArrayList) readValue(buffer)); default: return super.readValueOfType(type, buffer); } @@ -245,84 +287,107 @@ protected Object readValueOfType(byte type, @NonNull ByteBuffer buffer) { @Override protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) { - if (value instanceof GetPermissionStatusResult) { - stream.write(128); - writeValue(stream, ((GetPermissionStatusResult) value).toList()); - } else if (value instanceof PermissionsOptions) { + if (value instanceof PermissionStatus) { stream.write(129); + writeValue(stream, value == null ? null : ((PermissionStatus) value).index); + } else if (value instanceof PermissionsOptions) { + stream.write(130); writeValue(stream, ((PermissionsOptions) value).toList()); + } else if (value instanceof GetPermissionStatusResult) { + stream.write(131); + writeValue(stream, ((GetPermissionStatusResult) value).toList()); } else { super.writeValue(stream, value); } } } + + /** Asynchronous error handling return type for non-nullable API method returns. */ + public interface Result { + /** Success case callback method for handling returns. */ + void success(@NonNull T result); + + /** Failure case callback method for handling errors. */ + void error(@NonNull Throwable error); + } + /** Asynchronous error handling return type for nullable API method returns. */ + public interface NullableResult { + /** Success case callback method for handling returns. */ + void success(@Nullable T result); + + /** Failure case callback method for handling errors. */ + void error(@NonNull Throwable error); + } + /** Asynchronous error handling return type for void API method returns. */ + public interface VoidResult { + /** Success case callback method for handling returns. */ + void success(); + + /** Failure case callback method for handling errors. */ + void error(@NonNull Throwable error); + } /** Generated class from Pigeon that represents Flutter messages that can be called from Java. */ public static class PushNotificationsFlutterApi { private final @NonNull BinaryMessenger binaryMessenger; + private final String messageChannelSuffix; public PushNotificationsFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { + this(argBinaryMessenger, ""); + } + public PushNotificationsFlutterApi(@NonNull BinaryMessenger argBinaryMessenger, @NonNull String messageChannelSuffix) { this.binaryMessenger = argBinaryMessenger; + this.messageChannelSuffix = messageChannelSuffix.isEmpty() ? "" : "." + messageChannelSuffix; } - /** Public interface for sending reply. */ - @SuppressWarnings("UnknownNullness") - public interface Reply { - void reply(T reply); - } - /** The codec used by PushNotificationsFlutterApi. */ + /** + * Public interface for sending reply. + * The codec used by PushNotificationsFlutterApi. + */ static @NonNull MessageCodec getCodec() { - return PushNotificationsFlutterApiCodec.INSTANCE; + return PigeonCodec.INSTANCE; } - public void onNotificationReceivedInBackground(@NonNull Map withPayloadArg, @NonNull Reply callback) { + public void onNotificationReceivedInBackground(@NonNull Map withPayloadArg, @NonNull VoidResult result) { + final String channelName = "dev.flutter.pigeon.amplify_push_notifications.PushNotificationsFlutterApi.onNotificationReceivedInBackground" + messageChannelSuffix; BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.amplify_push_notifications.PushNotificationsFlutterApi.onNotificationReceivedInBackground", getCodec()); + binaryMessenger, channelName, getCodec()); channel.send( - new ArrayList(Collections.singletonList(withPayloadArg)), - channelReply -> callback.reply(null)); + new ArrayList<>(Collections.singletonList(withPayloadArg)), + channelReply -> { + if (channelReply instanceof List) { + List listReply = (List) channelReply; + if (listReply.size() > 1) { + result.error(new FlutterError((String) listReply.get(0), (String) listReply.get(1), listReply.get(2))); + } else { + result.success(); + } + } else { + result.error(createConnectionError(channelName)); + } + }); } - public void nullifyLaunchNotification(@NonNull Reply callback) { + public void nullifyLaunchNotification(@NonNull VoidResult result) { + final String channelName = "dev.flutter.pigeon.amplify_push_notifications.PushNotificationsFlutterApi.nullifyLaunchNotification" + messageChannelSuffix; BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.amplify_push_notifications.PushNotificationsFlutterApi.nullifyLaunchNotification", getCodec()); + binaryMessenger, channelName, getCodec()); channel.send( null, - channelReply -> callback.reply(null)); - } - } - - private static class PushNotificationsHostApiCodec extends StandardMessageCodec { - public static final PushNotificationsHostApiCodec INSTANCE = new PushNotificationsHostApiCodec(); - - private PushNotificationsHostApiCodec() {} - - @Override - protected Object readValueOfType(byte type, @NonNull ByteBuffer buffer) { - switch (type) { - case (byte) 128: - return GetPermissionStatusResult.fromList((ArrayList) readValue(buffer)); - case (byte) 129: - return PermissionsOptions.fromList((ArrayList) readValue(buffer)); - default: - return super.readValueOfType(type, buffer); - } - } - - @Override - protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) { - if (value instanceof GetPermissionStatusResult) { - stream.write(128); - writeValue(stream, ((GetPermissionStatusResult) value).toList()); - } else if (value instanceof PermissionsOptions) { - stream.write(129); - writeValue(stream, ((PermissionsOptions) value).toList()); - } else { - super.writeValue(stream, value); - } + channelReply -> { + if (channelReply instanceof List) { + List listReply = (List) channelReply; + if (listReply.size() > 1) { + result.error(new FlutterError((String) listReply.get(0), (String) listReply.get(1), listReply.get(2))); + } else { + result.success(); + } + } else { + result.error(createConnectionError(channelName)); + } + }); } } - /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface PushNotificationsHostApi { @@ -344,25 +409,28 @@ public interface PushNotificationsHostApi { /** The codec used by PushNotificationsHostApi. */ static @NonNull MessageCodec getCodec() { - return PushNotificationsHostApiCodec.INSTANCE; + return PigeonCodec.INSTANCE; } /**Sets up an instance of `PushNotificationsHostApi` to handle messages through the `binaryMessenger`. */ - static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable PushNotificationsHostApi api) { + static void setUp(@NonNull BinaryMessenger binaryMessenger, @Nullable PushNotificationsHostApi api) { + setUp(binaryMessenger, "", api); + } + static void setUp(@NonNull BinaryMessenger binaryMessenger, @NonNull String messageChannelSuffix, @Nullable PushNotificationsHostApi api) { + messageChannelSuffix = messageChannelSuffix.isEmpty() ? "" : "." + messageChannelSuffix; { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.amplify_push_notifications.PushNotificationsHostApi.requestInitialToken", getCodec()); + binaryMessenger, "dev.flutter.pigeon.amplify_push_notifications.PushNotificationsHostApi.requestInitialToken" + messageChannelSuffix, getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); try { api.requestInitialToken(); wrapped.add(0, null); } catch (Throwable exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; + wrapped = wrapError(exception); } reply.reply(wrapped); }); @@ -373,11 +441,11 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable PushNotifi { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.amplify_push_notifications.PushNotificationsHostApi.getPermissionStatus", getCodec()); + binaryMessenger, "dev.flutter.pigeon.amplify_push_notifications.PushNotificationsHostApi.getPermissionStatus" + messageChannelSuffix, getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); Result resultCallback = new Result() { public void success(GetPermissionStatusResult result) { @@ -400,11 +468,11 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.amplify_push_notifications.PushNotificationsHostApi.requestPermissions", getCodec()); + binaryMessenger, "dev.flutter.pigeon.amplify_push_notifications.PushNotificationsHostApi.requestPermissions" + messageChannelSuffix, getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); ArrayList args = (ArrayList) message; PermissionsOptions withPermissionOptionsArg = (PermissionsOptions) args.get(0); Result resultCallback = @@ -429,18 +497,17 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.amplify_push_notifications.PushNotificationsHostApi.getLaunchNotification", getCodec()); + binaryMessenger, "dev.flutter.pigeon.amplify_push_notifications.PushNotificationsHostApi.getLaunchNotification" + messageChannelSuffix, getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); try { Map output = api.getLaunchNotification(); wrapped.add(0, output); } catch (Throwable exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; + wrapped = wrapError(exception); } reply.reply(wrapped); }); @@ -451,18 +518,17 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.amplify_push_notifications.PushNotificationsHostApi.getBadgeCount", getCodec()); + binaryMessenger, "dev.flutter.pigeon.amplify_push_notifications.PushNotificationsHostApi.getBadgeCount" + messageChannelSuffix, getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); try { Long output = api.getBadgeCount(); wrapped.add(0, output); } catch (Throwable exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; + wrapped = wrapError(exception); } reply.reply(wrapped); }); @@ -473,20 +539,19 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.amplify_push_notifications.PushNotificationsHostApi.setBadgeCount", getCodec()); + binaryMessenger, "dev.flutter.pigeon.amplify_push_notifications.PushNotificationsHostApi.setBadgeCount" + messageChannelSuffix, getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); ArrayList args = (ArrayList) message; - Number withBadgeCountArg = (Number) args.get(0); + Long withBadgeCountArg = (Long) args.get(0); try { - api.setBadgeCount((withBadgeCountArg == null) ? null : withBadgeCountArg.longValue()); + api.setBadgeCount(withBadgeCountArg); wrapped.add(0, null); } catch (Throwable exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; + wrapped = wrapError(exception); } reply.reply(wrapped); }); @@ -497,20 +562,19 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.amplify_push_notifications.PushNotificationsHostApi.registerCallbackFunction", getCodec()); + binaryMessenger, "dev.flutter.pigeon.amplify_push_notifications.PushNotificationsHostApi.registerCallbackFunction" + messageChannelSuffix, getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); ArrayList args = (ArrayList) message; - Number callbackHandleArg = (Number) args.get(0); + Long callbackHandleArg = (Long) args.get(0); try { - api.registerCallbackFunction((callbackHandleArg == null) ? null : callbackHandleArg.longValue()); + api.registerCallbackFunction(callbackHandleArg); wrapped.add(0, null); } catch (Throwable exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; + wrapped = wrapError(exception); } reply.reply(wrapped); }); diff --git a/packages/notifications/push/amplify_push_notifications/ios/Classes/PushNotificationsNativePlugin.h b/packages/notifications/push/amplify_push_notifications/ios/Classes/PushNotificationsNativePlugin.h index 20fb8b270b..599480018a 100644 --- a/packages/notifications/push/amplify_push_notifications/ios/Classes/PushNotificationsNativePlugin.h +++ b/packages/notifications/push/amplify_push_notifications/ios/Classes/PushNotificationsNativePlugin.h @@ -1,7 +1,7 @@ -// +// // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 -// Autogenerated from Pigeon (v11.0.0), do not edit directly. +// Autogenerated from Pigeon (v22.6.2), do not edit directly. // See also: https://pub.dev/packages/pigeon #import @@ -32,12 +32,12 @@ typedef NS_ENUM(NSUInteger, PermissionStatus) { @interface PermissionsOptions : NSObject /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; -+ (instancetype)makeWithAlert:(NSNumber *)alert - sound:(NSNumber *)sound - badge:(NSNumber *)badge; -@property(nonatomic, strong) NSNumber * alert; -@property(nonatomic, strong) NSNumber * sound; -@property(nonatomic, strong) NSNumber * badge; ++ (instancetype)makeWithAlert:(BOOL )alert + sound:(BOOL )sound + badge:(BOOL )badge; +@property(nonatomic, assign) BOOL alert; +@property(nonatomic, assign) BOOL sound; +@property(nonatomic, assign) BOOL badge; @end @interface GetPermissionStatusResult : NSObject @@ -47,17 +47,16 @@ typedef NS_ENUM(NSUInteger, PermissionStatus) { @property(nonatomic, assign) PermissionStatus status; @end -/// The codec used by PushNotificationsFlutterApi. -NSObject *PushNotificationsFlutterApiGetCodec(void); +/// The codec used by all APIs. +NSObject *nullGetPushNotificationsNativePluginCodec(void); @interface PushNotificationsFlutterApi : NSObject - (instancetype)initWithBinaryMessenger:(id)binaryMessenger; +- (instancetype)initWithBinaryMessenger:(id)binaryMessenger messageChannelSuffix:(nullable NSString *)messageChannelSuffix; - (void)onNotificationReceivedInBackgroundWithPayload:(NSDictionary *)withPayload completion:(void (^)(FlutterError *_Nullable))completion; - (void)nullifyLaunchNotificationWithCompletion:(void (^)(FlutterError *_Nullable))completion; @end -/// The codec used by PushNotificationsHostApi. -NSObject *PushNotificationsHostApiGetCodec(void); @protocol PushNotificationsHostApi - (void)requestInitialTokenWithError:(FlutterError *_Nullable *_Nonnull)error; @@ -66,10 +65,12 @@ NSObject *PushNotificationsHostApiGetCodec(void); - (nullable NSDictionary *)getLaunchNotificationWithError:(FlutterError *_Nullable *_Nonnull)error; /// @return `nil` only when `error != nil`. - (nullable NSNumber *)getBadgeCountWithError:(FlutterError *_Nullable *_Nonnull)error; -- (void)setBadgeCountWithBadgeCount:(NSNumber *)withBadgeCount error:(FlutterError *_Nullable *_Nonnull)error; -- (void)registerCallbackFunctionCallbackHandle:(NSNumber *)callbackHandle error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setBadgeCountWithBadgeCount:(NSInteger)withBadgeCount error:(FlutterError *_Nullable *_Nonnull)error; +- (void)registerCallbackFunctionCallbackHandle:(NSInteger)callbackHandle error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void PushNotificationsHostApiSetup(id binaryMessenger, NSObject *_Nullable api); +extern void SetUpPushNotificationsHostApi(id binaryMessenger, NSObject *_Nullable api); + +extern void SetUpPushNotificationsHostApiWithSuffix(id binaryMessenger, NSObject *_Nullable api, NSString *messageChannelSuffix); NS_ASSUME_NONNULL_END diff --git a/packages/notifications/push/amplify_push_notifications/ios/Classes/PushNotificationsNativePlugin.m b/packages/notifications/push/amplify_push_notifications/ios/Classes/PushNotificationsNativePlugin.m index 7222a7f689..a518a7a119 100644 --- a/packages/notifications/push/amplify_push_notifications/ios/Classes/PushNotificationsNativePlugin.m +++ b/packages/notifications/push/amplify_push_notifications/ios/Classes/PushNotificationsNativePlugin.m @@ -1,7 +1,7 @@ -// +// // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 -// Autogenerated from Pigeon (v11.0.0), do not edit directly. +// Autogenerated from Pigeon (v22.6.2), do not edit directly. // See also: https://pub.dev/packages/pigeon #import "PushNotificationsNativePlugin.h" @@ -16,17 +16,7 @@ #error File requires ARC to be enabled. #endif -@implementation PermissionStatusBox -- (instancetype)initWithValue:(PermissionStatus)value { - self = [super init]; - if (self) { - _value = value; - } - return self; -} -@end - -static NSArray *wrapResult(id result, FlutterError *error) { +static NSArray *wrapResult(id result, FlutterError *error) { if (error) { return @[ error.code ?: [NSNull null], error.message ?: [NSNull null], error.details ?: [NSNull null] @@ -34,51 +24,63 @@ - (instancetype)initWithValue:(PermissionStatus)value { } return @[ result ?: [NSNull null] ]; } -static id GetNullableObjectAtIndex(NSArray *array, NSInteger key) { + +static FlutterError *createConnectionError(NSString *channelName) { + return [FlutterError errorWithCode:@"channel-error" message:[NSString stringWithFormat:@"%@/%@/%@", @"Unable to establish connection on channel: '", channelName, @"'."] details:@""]; +} + +static id GetNullableObjectAtIndex(NSArray *array, NSInteger key) { id result = array[key]; return (result == [NSNull null]) ? nil : result; } +@implementation PermissionStatusBox +- (instancetype)initWithValue:(PermissionStatus)value { + self = [super init]; + if (self) { + _value = value; + } + return self; +} +@end + @interface PermissionsOptions () -+ (PermissionsOptions *)fromList:(NSArray *)list; -+ (nullable PermissionsOptions *)nullableFromList:(NSArray *)list; -- (NSArray *)toList; ++ (PermissionsOptions *)fromList:(NSArray *)list; ++ (nullable PermissionsOptions *)nullableFromList:(NSArray *)list; +- (NSArray *)toList; @end @interface GetPermissionStatusResult () -+ (GetPermissionStatusResult *)fromList:(NSArray *)list; -+ (nullable GetPermissionStatusResult *)nullableFromList:(NSArray *)list; -- (NSArray *)toList; ++ (GetPermissionStatusResult *)fromList:(NSArray *)list; ++ (nullable GetPermissionStatusResult *)nullableFromList:(NSArray *)list; +- (NSArray *)toList; @end @implementation PermissionsOptions -+ (instancetype)makeWithAlert:(NSNumber *)alert - sound:(NSNumber *)sound - badge:(NSNumber *)badge { ++ (instancetype)makeWithAlert:(BOOL )alert + sound:(BOOL )sound + badge:(BOOL )badge { PermissionsOptions* pigeonResult = [[PermissionsOptions alloc] init]; pigeonResult.alert = alert; pigeonResult.sound = sound; pigeonResult.badge = badge; return pigeonResult; } -+ (PermissionsOptions *)fromList:(NSArray *)list { ++ (PermissionsOptions *)fromList:(NSArray *)list { PermissionsOptions *pigeonResult = [[PermissionsOptions alloc] init]; - pigeonResult.alert = GetNullableObjectAtIndex(list, 0); - NSAssert(pigeonResult.alert != nil, @""); - pigeonResult.sound = GetNullableObjectAtIndex(list, 1); - NSAssert(pigeonResult.sound != nil, @""); - pigeonResult.badge = GetNullableObjectAtIndex(list, 2); - NSAssert(pigeonResult.badge != nil, @""); + pigeonResult.alert = [GetNullableObjectAtIndex(list, 0) boolValue]; + pigeonResult.sound = [GetNullableObjectAtIndex(list, 1) boolValue]; + pigeonResult.badge = [GetNullableObjectAtIndex(list, 2) boolValue]; return pigeonResult; } -+ (nullable PermissionsOptions *)nullableFromList:(NSArray *)list { ++ (nullable PermissionsOptions *)nullableFromList:(NSArray *)list { return (list) ? [PermissionsOptions fromList:list] : nil; } -- (NSArray *)toList { +- (NSArray *)toList { return @[ - (self.alert ?: [NSNull null]), - (self.sound ?: [NSNull null]), - (self.badge ?: [NSNull null]), + @(self.alert), + @(self.sound), + @(self.badge), ]; } @end @@ -89,45 +91,54 @@ + (instancetype)makeWithStatus:(PermissionStatus)status { pigeonResult.status = status; return pigeonResult; } -+ (GetPermissionStatusResult *)fromList:(NSArray *)list { ++ (GetPermissionStatusResult *)fromList:(NSArray *)list { GetPermissionStatusResult *pigeonResult = [[GetPermissionStatusResult alloc] init]; - pigeonResult.status = [GetNullableObjectAtIndex(list, 0) integerValue]; + PermissionStatusBox *boxedPermissionStatus = GetNullableObjectAtIndex(list, 0); + pigeonResult.status = boxedPermissionStatus.value; return pigeonResult; } -+ (nullable GetPermissionStatusResult *)nullableFromList:(NSArray *)list { ++ (nullable GetPermissionStatusResult *)nullableFromList:(NSArray *)list { return (list) ? [GetPermissionStatusResult fromList:list] : nil; } -- (NSArray *)toList { +- (NSArray *)toList { return @[ - @(self.status), + [[PermissionStatusBox alloc] initWithValue:self.status], ]; } @end -@interface PushNotificationsFlutterApiCodecReader : FlutterStandardReader +@interface nullPushNotificationsNativePluginPigeonCodecReader : FlutterStandardReader @end -@implementation PushNotificationsFlutterApiCodecReader +@implementation nullPushNotificationsNativePluginPigeonCodecReader - (nullable id)readValueOfType:(UInt8)type { switch (type) { - case 128: - return [GetPermissionStatusResult fromList:[self readValue]]; - case 129: + case 129: { + NSNumber *enumAsNumber = [self readValue]; + return enumAsNumber == nil ? nil : [[PermissionStatusBox alloc] initWithValue:[enumAsNumber integerValue]]; + } + case 130: return [PermissionsOptions fromList:[self readValue]]; + case 131: + return [GetPermissionStatusResult fromList:[self readValue]]; default: return [super readValueOfType:type]; } } @end -@interface PushNotificationsFlutterApiCodecWriter : FlutterStandardWriter +@interface nullPushNotificationsNativePluginPigeonCodecWriter : FlutterStandardWriter @end -@implementation PushNotificationsFlutterApiCodecWriter +@implementation nullPushNotificationsNativePluginPigeonCodecWriter - (void)writeValue:(id)value { - if ([value isKindOfClass:[GetPermissionStatusResult class]]) { - [self writeByte:128]; - [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[PermissionsOptions class]]) { + if ([value isKindOfClass:[PermissionStatusBox class]]) { + PermissionStatusBox *box = (PermissionStatusBox *)value; [self writeByte:129]; + [self writeValue:(value == nil ? [NSNull null] : [NSNumber numberWithInteger:box.value])]; + } else if ([value isKindOfClass:[PermissionsOptions class]]) { + [self writeByte:130]; + [self writeValue:[value toList]]; + } else if ([value isKindOfClass:[GetPermissionStatusResult class]]) { + [self writeByte:131]; [self writeValue:[value toList]]; } else { [super writeValue:value]; @@ -135,121 +146,96 @@ - (void)writeValue:(id)value { } @end -@interface PushNotificationsFlutterApiCodecReaderWriter : FlutterStandardReaderWriter +@interface nullPushNotificationsNativePluginPigeonCodecReaderWriter : FlutterStandardReaderWriter @end -@implementation PushNotificationsFlutterApiCodecReaderWriter +@implementation nullPushNotificationsNativePluginPigeonCodecReaderWriter - (FlutterStandardWriter *)writerWithData:(NSMutableData *)data { - return [[PushNotificationsFlutterApiCodecWriter alloc] initWithData:data]; + return [[nullPushNotificationsNativePluginPigeonCodecWriter alloc] initWithData:data]; } - (FlutterStandardReader *)readerWithData:(NSData *)data { - return [[PushNotificationsFlutterApiCodecReader alloc] initWithData:data]; + return [[nullPushNotificationsNativePluginPigeonCodecReader alloc] initWithData:data]; } @end -NSObject *PushNotificationsFlutterApiGetCodec(void) { +NSObject *nullGetPushNotificationsNativePluginCodec(void) { static FlutterStandardMessageCodec *sSharedObject = nil; static dispatch_once_t sPred = 0; dispatch_once(&sPred, ^{ - PushNotificationsFlutterApiCodecReaderWriter *readerWriter = [[PushNotificationsFlutterApiCodecReaderWriter alloc] init]; + nullPushNotificationsNativePluginPigeonCodecReaderWriter *readerWriter = [[nullPushNotificationsNativePluginPigeonCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } - @interface PushNotificationsFlutterApi () @property(nonatomic, strong) NSObject *binaryMessenger; +@property(nonatomic, strong) NSString *messageChannelSuffix; @end @implementation PushNotificationsFlutterApi - (instancetype)initWithBinaryMessenger:(NSObject *)binaryMessenger { - self = [super init]; + return [self initWithBinaryMessenger:binaryMessenger messageChannelSuffix:@""]; +} +- (instancetype)initWithBinaryMessenger:(NSObject *)binaryMessenger messageChannelSuffix:(nullable NSString*)messageChannelSuffix{ + self = [self init]; if (self) { _binaryMessenger = binaryMessenger; + _messageChannelSuffix = [messageChannelSuffix length] == 0 ? @"" : [NSString stringWithFormat: @".%@", messageChannelSuffix]; } return self; } - (void)onNotificationReceivedInBackgroundWithPayload:(NSDictionary *)arg_withPayload completion:(void (^)(FlutterError *_Nullable))completion { + NSString *channelName = [NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.amplify_push_notifications.PushNotificationsFlutterApi.onNotificationReceivedInBackground", _messageChannelSuffix]; FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel - messageChannelWithName:@"dev.flutter.pigeon.amplify_push_notifications.PushNotificationsFlutterApi.onNotificationReceivedInBackground" + messageChannelWithName:channelName binaryMessenger:self.binaryMessenger - codec:PushNotificationsFlutterApiGetCodec()]; - [channel sendMessage:@[arg_withPayload ?: [NSNull null]] reply:^(id reply) { - completion(nil); + codec:nullGetPushNotificationsNativePluginCodec()]; + [channel sendMessage:@[arg_withPayload ?: [NSNull null]] reply:^(NSArray *reply) { + if (reply != nil) { + if (reply.count > 1) { + completion([FlutterError errorWithCode:reply[0] message:reply[1] details:reply[2]]); + } else { + completion(nil); + } + } else { + completion(createConnectionError(channelName)); + } }]; } - (void)nullifyLaunchNotificationWithCompletion:(void (^)(FlutterError *_Nullable))completion { + NSString *channelName = [NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.amplify_push_notifications.PushNotificationsFlutterApi.nullifyLaunchNotification", _messageChannelSuffix]; FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel - messageChannelWithName:@"dev.flutter.pigeon.amplify_push_notifications.PushNotificationsFlutterApi.nullifyLaunchNotification" + messageChannelWithName:channelName binaryMessenger:self.binaryMessenger - codec:PushNotificationsFlutterApiGetCodec()]; - [channel sendMessage:nil reply:^(id reply) { - completion(nil); + codec:nullGetPushNotificationsNativePluginCodec()]; + [channel sendMessage:nil reply:^(NSArray *reply) { + if (reply != nil) { + if (reply.count > 1) { + completion([FlutterError errorWithCode:reply[0] message:reply[1] details:reply[2]]); + } else { + completion(nil); + } + } else { + completion(createConnectionError(channelName)); + } }]; } @end -@interface PushNotificationsHostApiCodecReader : FlutterStandardReader -@end -@implementation PushNotificationsHostApiCodecReader -- (nullable id)readValueOfType:(UInt8)type { - switch (type) { - case 128: - return [GetPermissionStatusResult fromList:[self readValue]]; - case 129: - return [PermissionsOptions fromList:[self readValue]]; - default: - return [super readValueOfType:type]; - } -} -@end - -@interface PushNotificationsHostApiCodecWriter : FlutterStandardWriter -@end -@implementation PushNotificationsHostApiCodecWriter -- (void)writeValue:(id)value { - if ([value isKindOfClass:[GetPermissionStatusResult class]]) { - [self writeByte:128]; - [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[PermissionsOptions class]]) { - [self writeByte:129]; - [self writeValue:[value toList]]; - } else { - [super writeValue:value]; - } -} -@end - -@interface PushNotificationsHostApiCodecReaderWriter : FlutterStandardReaderWriter -@end -@implementation PushNotificationsHostApiCodecReaderWriter -- (FlutterStandardWriter *)writerWithData:(NSMutableData *)data { - return [[PushNotificationsHostApiCodecWriter alloc] initWithData:data]; -} -- (FlutterStandardReader *)readerWithData:(NSData *)data { - return [[PushNotificationsHostApiCodecReader alloc] initWithData:data]; -} -@end - -NSObject *PushNotificationsHostApiGetCodec(void) { - static FlutterStandardMessageCodec *sSharedObject = nil; - static dispatch_once_t sPred = 0; - dispatch_once(&sPred, ^{ - PushNotificationsHostApiCodecReaderWriter *readerWriter = [[PushNotificationsHostApiCodecReaderWriter alloc] init]; - sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; - }); - return sSharedObject; +void SetUpPushNotificationsHostApi(id binaryMessenger, NSObject *api) { + SetUpPushNotificationsHostApiWithSuffix(binaryMessenger, api, @""); } -void PushNotificationsHostApiSetup(id binaryMessenger, NSObject *api) { +void SetUpPushNotificationsHostApiWithSuffix(id binaryMessenger, NSObject *api, NSString *messageChannelSuffix) { + messageChannelSuffix = messageChannelSuffix.length > 0 ? [NSString stringWithFormat: @".%@", messageChannelSuffix] : @""; { FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.amplify_push_notifications.PushNotificationsHostApi.requestInitialToken" + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.amplify_push_notifications.PushNotificationsHostApi.requestInitialToken", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:PushNotificationsHostApiGetCodec()]; + codec:nullGetPushNotificationsNativePluginCodec()]; if (api) { NSCAssert([api respondsToSelector:@selector(requestInitialTokenWithError:)], @"PushNotificationsHostApi api (%@) doesn't respond to @selector(requestInitialTokenWithError:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { @@ -264,9 +250,9 @@ void PushNotificationsHostApiSetup(id binaryMessenger, N { FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.amplify_push_notifications.PushNotificationsHostApi.getPermissionStatus" + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.amplify_push_notifications.PushNotificationsHostApi.getPermissionStatus", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:PushNotificationsHostApiGetCodec()]; + codec:nullGetPushNotificationsNativePluginCodec()]; if (api) { NSCAssert([api respondsToSelector:@selector(getPermissionStatusWithCompletion:)], @"PushNotificationsHostApi api (%@) doesn't respond to @selector(getPermissionStatusWithCompletion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { @@ -281,13 +267,13 @@ void PushNotificationsHostApiSetup(id binaryMessenger, N { FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.amplify_push_notifications.PushNotificationsHostApi.requestPermissions" + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.amplify_push_notifications.PushNotificationsHostApi.requestPermissions", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:PushNotificationsHostApiGetCodec()]; + codec:nullGetPushNotificationsNativePluginCodec()]; if (api) { NSCAssert([api respondsToSelector:@selector(requestPermissionsWithPermissionOptions:completion:)], @"PushNotificationsHostApi api (%@) doesn't respond to @selector(requestPermissionsWithPermissionOptions:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; + NSArray *args = message; PermissionsOptions *arg_withPermissionOptions = GetNullableObjectAtIndex(args, 0); [api requestPermissionsWithPermissionOptions:arg_withPermissionOptions completion:^(NSNumber *_Nullable output, FlutterError *_Nullable error) { callback(wrapResult(output, error)); @@ -300,9 +286,9 @@ void PushNotificationsHostApiSetup(id binaryMessenger, N { FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.amplify_push_notifications.PushNotificationsHostApi.getLaunchNotification" + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.amplify_push_notifications.PushNotificationsHostApi.getLaunchNotification", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:PushNotificationsHostApiGetCodec()]; + codec:nullGetPushNotificationsNativePluginCodec()]; if (api) { NSCAssert([api respondsToSelector:@selector(getLaunchNotificationWithError:)], @"PushNotificationsHostApi api (%@) doesn't respond to @selector(getLaunchNotificationWithError:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { @@ -317,9 +303,9 @@ void PushNotificationsHostApiSetup(id binaryMessenger, N { FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.amplify_push_notifications.PushNotificationsHostApi.getBadgeCount" + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.amplify_push_notifications.PushNotificationsHostApi.getBadgeCount", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:PushNotificationsHostApiGetCodec()]; + codec:nullGetPushNotificationsNativePluginCodec()]; if (api) { NSCAssert([api respondsToSelector:@selector(getBadgeCountWithError:)], @"PushNotificationsHostApi api (%@) doesn't respond to @selector(getBadgeCountWithError:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { @@ -334,14 +320,14 @@ void PushNotificationsHostApiSetup(id binaryMessenger, N { FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.amplify_push_notifications.PushNotificationsHostApi.setBadgeCount" + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.amplify_push_notifications.PushNotificationsHostApi.setBadgeCount", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:PushNotificationsHostApiGetCodec()]; + codec:nullGetPushNotificationsNativePluginCodec()]; if (api) { NSCAssert([api respondsToSelector:@selector(setBadgeCountWithBadgeCount:error:)], @"PushNotificationsHostApi api (%@) doesn't respond to @selector(setBadgeCountWithBadgeCount:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSNumber *arg_withBadgeCount = GetNullableObjectAtIndex(args, 0); + NSArray *args = message; + NSInteger arg_withBadgeCount = [GetNullableObjectAtIndex(args, 0) integerValue]; FlutterError *error; [api setBadgeCountWithBadgeCount:arg_withBadgeCount error:&error]; callback(wrapResult(nil, error)); @@ -353,14 +339,14 @@ void PushNotificationsHostApiSetup(id binaryMessenger, N { FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.amplify_push_notifications.PushNotificationsHostApi.registerCallbackFunction" + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.amplify_push_notifications.PushNotificationsHostApi.registerCallbackFunction", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:PushNotificationsHostApiGetCodec()]; + codec:nullGetPushNotificationsNativePluginCodec()]; if (api) { NSCAssert([api respondsToSelector:@selector(registerCallbackFunctionCallbackHandle:error:)], @"PushNotificationsHostApi api (%@) doesn't respond to @selector(registerCallbackFunctionCallbackHandle:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSNumber *arg_callbackHandle = GetNullableObjectAtIndex(args, 0); + NSArray *args = message; + NSInteger arg_callbackHandle = [GetNullableObjectAtIndex(args, 0) integerValue]; FlutterError *error; [api registerCallbackFunctionCallbackHandle:arg_callbackHandle error:&error]; callback(wrapResult(nil, error)); diff --git a/packages/notifications/push/amplify_push_notifications/lib/src/native_push_notifications_plugin.g.dart b/packages/notifications/push/amplify_push_notifications/lib/src/native_push_notifications_plugin.g.dart index 9893eed5a2..6b416d1b3a 100644 --- a/packages/notifications/push/amplify_push_notifications/lib/src/native_push_notifications_plugin.g.dart +++ b/packages/notifications/push/amplify_push_notifications/lib/src/native_push_notifications_plugin.g.dart @@ -1,9 +1,9 @@ // // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 -// Autogenerated from Pigeon (v11.0.0), do not edit directly. +// Autogenerated from Pigeon (v22.6.2), do not edit directly. // See also: https://pub.dev/packages/pigeon -// ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import +// ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import, no_leading_underscores_for_local_identifiers import 'dart:async'; import 'dart:typed_data' show Float64List, Int32List, Int64List, Uint8List; @@ -11,6 +11,24 @@ import 'dart:typed_data' show Float64List, Int32List, Int64List, Uint8List; import 'package:flutter/foundation.dart' show ReadBuffer, WriteBuffer; import 'package:flutter/services.dart'; +PlatformException _createConnectionError(String channelName) { + return PlatformException( + code: 'channel-error', + message: 'Unable to establish connection on channel: "$channelName".', + ); +} + +List wrapResponse( + {Object? result, PlatformException? error, bool empty = false}) { + if (empty) { + return []; + } + if (error == null) { + return [result]; + } + return [error.code, error.message, error.details]; +} + enum PermissionStatus { shouldRequest, shouldExplainThenRequest, @@ -58,27 +76,33 @@ class GetPermissionStatusResult { Object encode() { return [ - status.index, + status, ]; } static GetPermissionStatusResult decode(Object result) { result as List; return GetPermissionStatusResult( - status: PermissionStatus.values[result[0]! as int], + status: result[0]! as PermissionStatus, ); } } -class _PushNotificationsFlutterApiCodec extends StandardMessageCodec { - const _PushNotificationsFlutterApiCodec(); +class _PigeonCodec extends StandardMessageCodec { + const _PigeonCodec(); @override void writeValue(WriteBuffer buffer, Object? value) { - if (value is GetPermissionStatusResult) { - buffer.putUint8(128); - writeValue(buffer, value.encode()); - } else if (value is PermissionsOptions) { + if (value is int) { + buffer.putUint8(4); + buffer.putInt64(value); + } else if (value is PermissionStatus) { buffer.putUint8(129); + writeValue(buffer, value.index); + } else if (value is PermissionsOptions) { + buffer.putUint8(130); + writeValue(buffer, value.encode()); + } else if (value is GetPermissionStatusResult) { + buffer.putUint8(131); writeValue(buffer, value.encode()); } else { super.writeValue(buffer, value); @@ -88,10 +112,13 @@ class _PushNotificationsFlutterApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: - return GetPermissionStatusResult.decode(readValue(buffer)!); case 129: + final int? value = readValue(buffer) as int?; + return value == null ? null : PermissionStatus.values[value]; + case 130: return PermissionsOptions.decode(readValue(buffer)!); + case 131: + return GetPermissionStatusResult.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); } @@ -99,25 +126,31 @@ class _PushNotificationsFlutterApiCodec extends StandardMessageCodec { } abstract class PushNotificationsFlutterApi { - static const MessageCodec codec = - _PushNotificationsFlutterApiCodec(); + static const MessageCodec pigeonChannelCodec = _PigeonCodec(); Future onNotificationReceivedInBackground( Map withPayload); void nullifyLaunchNotification(); - static void setup(PushNotificationsFlutterApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setUp( + PushNotificationsFlutterApi? api, { + BinaryMessenger? binaryMessenger, + String messageChannelSuffix = '', + }) { + messageChannelSuffix = + messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.amplify_push_notifications.PushNotificationsFlutterApi.onNotificationReceivedInBackground', - codec, + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< + Object?>( + 'dev.flutter.pigeon.amplify_push_notifications.PushNotificationsFlutterApi.onNotificationReceivedInBackground$messageChannelSuffix', + pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { - channel.setMessageHandler(null); + pigeonVar_channel.setMessageHandler(null); } else { - channel.setMessageHandler((Object? message) async { + pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.amplify_push_notifications.PushNotificationsFlutterApi.onNotificationReceivedInBackground was null.'); final List args = (message as List?)!; @@ -125,83 +158,77 @@ abstract class PushNotificationsFlutterApi { (args[0] as Map?)?.cast(); assert(arg_withPayload != null, 'Argument for dev.flutter.pigeon.amplify_push_notifications.PushNotificationsFlutterApi.onNotificationReceivedInBackground was null, expected non-null Map.'); - await api.onNotificationReceivedInBackground(arg_withPayload!); - return; + try { + await api.onNotificationReceivedInBackground(arg_withPayload!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.amplify_push_notifications.PushNotificationsFlutterApi.nullifyLaunchNotification', - codec, + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< + Object?>( + 'dev.flutter.pigeon.amplify_push_notifications.PushNotificationsFlutterApi.nullifyLaunchNotification$messageChannelSuffix', + pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { - channel.setMessageHandler(null); + pigeonVar_channel.setMessageHandler(null); } else { - channel.setMessageHandler((Object? message) async { - // ignore message - api.nullifyLaunchNotification(); - return; + pigeonVar_channel.setMessageHandler((Object? message) async { + try { + api.nullifyLaunchNotification(); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } } } -class _PushNotificationsHostApiCodec extends StandardMessageCodec { - const _PushNotificationsHostApiCodec(); - @override - void writeValue(WriteBuffer buffer, Object? value) { - if (value is GetPermissionStatusResult) { - buffer.putUint8(128); - writeValue(buffer, value.encode()); - } else if (value is PermissionsOptions) { - buffer.putUint8(129); - writeValue(buffer, value.encode()); - } else { - super.writeValue(buffer, value); - } - } - - @override - Object? readValueOfType(int type, ReadBuffer buffer) { - switch (type) { - case 128: - return GetPermissionStatusResult.decode(readValue(buffer)!); - case 129: - return PermissionsOptions.decode(readValue(buffer)!); - default: - return super.readValueOfType(type, buffer); - } - } -} - class PushNotificationsHostApi { /// Constructor for [PushNotificationsHostApi]. The [binaryMessenger] named argument is /// available for dependency injection. If it is left null, the default /// BinaryMessenger will be used which routes to the host platform. - PushNotificationsHostApi({BinaryMessenger? binaryMessenger}) - : _binaryMessenger = binaryMessenger; - final BinaryMessenger? _binaryMessenger; + PushNotificationsHostApi( + {BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) + : pigeonVar_binaryMessenger = binaryMessenger, + pigeonVar_messageChannelSuffix = + messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; + final BinaryMessenger? pigeonVar_binaryMessenger; + + static const MessageCodec pigeonChannelCodec = _PigeonCodec(); - static const MessageCodec codec = _PushNotificationsHostApiCodec(); + final String pigeonVar_messageChannelSuffix; Future requestInitialToken() async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.amplify_push_notifications.PushNotificationsHostApi.requestInitialToken', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = await channel.send(null) as List?; - if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); - } else if (replyList.length > 1) { + final String pigeonVar_channelName = + 'dev.flutter.pigeon.amplify_push_notifications.PushNotificationsHostApi.requestInitialToken$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final List? pigeonVar_replyList = + await pigeonVar_channel.send(null) as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { throw PlatformException( - code: replyList[0]! as String, - message: replyList[1] as String?, - details: replyList[2], + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], ); } else { return; @@ -209,150 +236,160 @@ class PushNotificationsHostApi { } Future getPermissionStatus() async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.amplify_push_notifications.PushNotificationsHostApi.getPermissionStatus', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = await channel.send(null) as List?; - if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); - } else if (replyList.length > 1) { + final String pigeonVar_channelName = + 'dev.flutter.pigeon.amplify_push_notifications.PushNotificationsHostApi.getPermissionStatus$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final List? pigeonVar_replyList = + await pigeonVar_channel.send(null) as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { throw PlatformException( - code: replyList[0]! as String, - message: replyList[1] as String?, - details: replyList[2], + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], ); - } else if (replyList[0] == null) { + } else if (pigeonVar_replyList[0] == null) { throw PlatformException( code: 'null-error', message: 'Host platform returned null value for non-null return value.', ); } else { - return (replyList[0] as GetPermissionStatusResult?)!; + return (pigeonVar_replyList[0] as GetPermissionStatusResult?)!; } } Future requestPermissions( - PermissionsOptions arg_withPermissionOptions) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.amplify_push_notifications.PushNotificationsHostApi.requestPermissions', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_withPermissionOptions]) as List?; - if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); - } else if (replyList.length > 1) { + PermissionsOptions withPermissionOptions) async { + final String pigeonVar_channelName = + 'dev.flutter.pigeon.amplify_push_notifications.PushNotificationsHostApi.requestPermissions$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final List? pigeonVar_replyList = await pigeonVar_channel + .send([withPermissionOptions]) as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { throw PlatformException( - code: replyList[0]! as String, - message: replyList[1] as String?, - details: replyList[2], + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], ); - } else if (replyList[0] == null) { + } else if (pigeonVar_replyList[0] == null) { throw PlatformException( code: 'null-error', message: 'Host platform returned null value for non-null return value.', ); } else { - return (replyList[0] as bool?)!; + return (pigeonVar_replyList[0] as bool?)!; } } Future?> getLaunchNotification() async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.amplify_push_notifications.PushNotificationsHostApi.getLaunchNotification', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = await channel.send(null) as List?; - if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); - } else if (replyList.length > 1) { + final String pigeonVar_channelName = + 'dev.flutter.pigeon.amplify_push_notifications.PushNotificationsHostApi.getLaunchNotification$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final List? pigeonVar_replyList = + await pigeonVar_channel.send(null) as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { throw PlatformException( - code: replyList[0]! as String, - message: replyList[1] as String?, - details: replyList[2], + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], ); } else { - return (replyList[0] as Map?)?.cast(); + return (pigeonVar_replyList[0] as Map?) + ?.cast(); } } Future getBadgeCount() async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.amplify_push_notifications.PushNotificationsHostApi.getBadgeCount', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = await channel.send(null) as List?; - if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); - } else if (replyList.length > 1) { + final String pigeonVar_channelName = + 'dev.flutter.pigeon.amplify_push_notifications.PushNotificationsHostApi.getBadgeCount$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final List? pigeonVar_replyList = + await pigeonVar_channel.send(null) as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { throw PlatformException( - code: replyList[0]! as String, - message: replyList[1] as String?, - details: replyList[2], + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], ); - } else if (replyList[0] == null) { + } else if (pigeonVar_replyList[0] == null) { throw PlatformException( code: 'null-error', message: 'Host platform returned null value for non-null return value.', ); } else { - return (replyList[0] as int?)!; + return (pigeonVar_replyList[0] as int?)!; } } - Future setBadgeCount(int arg_withBadgeCount) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.amplify_push_notifications.PushNotificationsHostApi.setBadgeCount', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_withBadgeCount]) as List?; - if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); - } else if (replyList.length > 1) { + Future setBadgeCount(int withBadgeCount) async { + final String pigeonVar_channelName = + 'dev.flutter.pigeon.amplify_push_notifications.PushNotificationsHostApi.setBadgeCount$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final List? pigeonVar_replyList = await pigeonVar_channel + .send([withBadgeCount]) as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { throw PlatformException( - code: replyList[0]! as String, - message: replyList[1] as String?, - details: replyList[2], + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], ); } else { return; } } - Future registerCallbackFunction(int arg_callbackHandle) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.amplify_push_notifications.PushNotificationsHostApi.registerCallbackFunction', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_callbackHandle]) as List?; - if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); - } else if (replyList.length > 1) { + Future registerCallbackFunction(int callbackHandle) async { + final String pigeonVar_channelName = + 'dev.flutter.pigeon.amplify_push_notifications.PushNotificationsHostApi.registerCallbackFunction$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final List? pigeonVar_replyList = await pigeonVar_channel + .send([callbackHandle]) as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { throw PlatformException( - code: replyList[0]! as String, - message: replyList[1] as String?, - details: replyList[2], + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], ); } else { return; diff --git a/packages/notifications/push/amplify_push_notifications/lib/src/push_notifications_flutter_api.dart b/packages/notifications/push/amplify_push_notifications/lib/src/push_notifications_flutter_api.dart index 0bd7a970cb..c58dba4a5e 100644 --- a/packages/notifications/push/amplify_push_notifications/lib/src/push_notifications_flutter_api.dart +++ b/packages/notifications/push/amplify_push_notifications/lib/src/push_notifications_flutter_api.dart @@ -21,14 +21,14 @@ class AmplifyPushNotificationsFlutterApi implements PushNotificationsFlutterApi { /// {@macro amplify_push_notifications.amplify_push_notifications_flutter_api} AmplifyPushNotificationsFlutterApi._constructor() { - PushNotificationsFlutterApi.setup(this); + PushNotificationsFlutterApi.setUp(this); } /// {@template amplify_push_notifications.amplify_push_notifications_flutter_api.reset} /// Ability to reset the singleton only used for resetting between tests. /// {@endtemplate} static void reset() { - PushNotificationsFlutterApi.setup(null); + PushNotificationsFlutterApi.setUp(null); _instance = AmplifyPushNotificationsFlutterApi._constructor(); } diff --git a/packages/notifications/push/amplify_push_notifications/pubspec.yaml b/packages/notifications/push/amplify_push_notifications/pubspec.yaml index 46ae170af5..ae3259ced6 100644 --- a/packages/notifications/push/amplify_push_notifications/pubspec.yaml +++ b/packages/notifications/push/amplify_push_notifications/pubspec.yaml @@ -29,7 +29,7 @@ dev_dependencies: flutter_test: sdk: flutter mockito: ^5.0.0 - pigeon: ^11.0.0 + pigeon: ^22.6.2 test: ^1.22.1 flutter: diff --git a/packages/secure_storage/amplify_secure_storage/android/src/main/kotlin/com/amazonaws/amplify/amplify_secure_storage/pigeons/AmplifySecureStoragePigeon.kt b/packages/secure_storage/amplify_secure_storage/android/src/main/kotlin/com/amazonaws/amplify/amplify_secure_storage/pigeons/AmplifySecureStoragePigeon.kt index 7905f901cc..74c5cbd050 100644 --- a/packages/secure_storage/amplify_secure_storage/android/src/main/kotlin/com/amazonaws/amplify/amplify_secure_storage/pigeons/AmplifySecureStoragePigeon.kt +++ b/packages/secure_storage/amplify_secure_storage/android/src/main/kotlin/com/amazonaws/amplify/amplify_secure_storage/pigeons/AmplifySecureStoragePigeon.kt @@ -1,8 +1,9 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 -// -// Autogenerated from Pigeon (v11.0.0), do not edit directly. +// +// Autogenerated from Pigeon (v22.6.2), do not edit directly. // See also: https://pub.dev/packages/pigeon +@file:Suppress("UNCHECKED_CAST", "ArrayInDataClass") package com.amazonaws.amplify.amplify_secure_storage.pigeons @@ -19,14 +20,14 @@ private fun wrapResult(result: Any?): List { } private fun wrapError(exception: Throwable): List { - if (exception is FlutterError) { - return listOf( + return if (exception is FlutterError) { + listOf( exception.code, exception.message, exception.details ) } else { - return listOf( + listOf( exception.javaClass.simpleName, exception.toString(), "Cause: " + exception.cause + ", Stacktrace: " + Log.getStackTraceString(exception) @@ -45,6 +46,15 @@ class FlutterError ( override val message: String? = null, val details: Any? = null ) : Throwable() +private open class AmplifySecureStoragePigeonPigeonCodec : StandardMessageCodec() { + override fun readValueOfType(type: Byte, buffer: ByteBuffer): Any? { + return super.readValueOfType(type, buffer) + } + override fun writeValue(stream: ByteArrayOutputStream, value: Any?) { + super.writeValue(stream, value) + } +} + /** * A pigeon for interacting with the native AmplifySecureStorage implementation @@ -61,14 +71,15 @@ interface AmplifySecureStoragePigeon { companion object { /** The codec used by AmplifySecureStoragePigeon. */ val codec: MessageCodec by lazy { - StandardMessageCodec() + AmplifySecureStoragePigeonPigeonCodec() } /** Sets up an instance of `AmplifySecureStoragePigeon` to handle messages through the `binaryMessenger`. */ - @Suppress("UNCHECKED_CAST") - fun setUp(binaryMessenger: BinaryMessenger, api: AmplifySecureStoragePigeon?) { + @JvmOverloads + fun setUp(binaryMessenger: BinaryMessenger, api: AmplifySecureStoragePigeon?, messageChannelSuffix: String = "") { + val separatedMessageChannelSuffix = if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" run { val taskQueue = binaryMessenger.makeBackgroundTaskQueue() - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.amplify_secure_storage.AmplifySecureStoragePigeon.read", codec, taskQueue) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.amplify_secure_storage.AmplifySecureStoragePigeon.read$separatedMessageChannelSuffix", codec, taskQueue) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List @@ -90,7 +101,7 @@ interface AmplifySecureStoragePigeon { } run { val taskQueue = binaryMessenger.makeBackgroundTaskQueue() - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.amplify_secure_storage.AmplifySecureStoragePigeon.write", codec, taskQueue) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.amplify_secure_storage.AmplifySecureStoragePigeon.write$separatedMessageChannelSuffix", codec, taskQueue) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List @@ -112,7 +123,7 @@ interface AmplifySecureStoragePigeon { } run { val taskQueue = binaryMessenger.makeBackgroundTaskQueue() - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.amplify_secure_storage.AmplifySecureStoragePigeon.delete", codec, taskQueue) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.amplify_secure_storage.AmplifySecureStoragePigeon.delete$separatedMessageChannelSuffix", codec, taskQueue) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List @@ -133,7 +144,7 @@ interface AmplifySecureStoragePigeon { } run { val taskQueue = binaryMessenger.makeBackgroundTaskQueue() - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.amplify_secure_storage.AmplifySecureStoragePigeon.removeAll", codec, taskQueue) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.amplify_secure_storage.AmplifySecureStoragePigeon.removeAll$separatedMessageChannelSuffix", codec, taskQueue) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List diff --git a/packages/secure_storage/amplify_secure_storage/ios/Classes/pigeons/NSUserDefaultsPigeon.swift b/packages/secure_storage/amplify_secure_storage/ios/Classes/pigeons/NSUserDefaultsPigeon.swift index f546fbe25d..d6cfe5e204 100644 --- a/packages/secure_storage/amplify_secure_storage/ios/Classes/pigeons/NSUserDefaultsPigeon.swift +++ b/packages/secure_storage/amplify_secure_storage/ios/Classes/pigeons/NSUserDefaultsPigeon.swift @@ -1,20 +1,35 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 -// -// Autogenerated from Pigeon (v11.0.0), do not edit directly. +// +// Autogenerated from Pigeon (v22.6.2), do not edit directly. // See also: https://pub.dev/packages/pigeon import Foundation + #if os(iOS) -import Flutter + import Flutter #elseif os(macOS) -import FlutterMacOS + import FlutterMacOS #else -#error("Unsupported platform.") + #error("Unsupported platform.") #endif -private func isNullish(_ value: Any?) -> Bool { - return value is NSNull || value == nil +/// Error class for passing custom error details to Dart side. +final class PigeonError: Error { + let code: String + let message: String? + let details: Any? + + init(code: String, message: String?, details: Any?) { + self.code = code + self.message = message + self.details = details + } + + var localizedDescription: String { + return + "PigeonError(code: \(code), message: \(message ?? ""), details: \(details ?? "")" + } } private func wrapResult(_ result: Any?) -> [Any?] { @@ -22,24 +37,56 @@ private func wrapResult(_ result: Any?) -> [Any?] { } private func wrapError(_ error: Any) -> [Any?] { + if let pigeonError = error as? PigeonError { + return [ + pigeonError.code, + pigeonError.message, + pigeonError.details, + ] + } if let flutterError = error as? FlutterError { return [ flutterError.code, flutterError.message, - flutterError.details + flutterError.details, ] } return [ "\(error)", "\(type(of: error))", - "Stacktrace: \(Thread.callStackSymbols)" + "Stacktrace: \(Thread.callStackSymbols)", ] } +private func isNullish(_ value: Any?) -> Bool { + return value is NSNull || value == nil +} + private func nilOrValue(_ value: Any?) -> T? { if value is NSNull { return nil } return value as! T? } + +private class NSUserDefaultsPigeonPigeonCodecReader: FlutterStandardReader { +} + +private class NSUserDefaultsPigeonPigeonCodecWriter: FlutterStandardWriter { +} + +private class NSUserDefaultsPigeonPigeonCodecReaderWriter: FlutterStandardReaderWriter { + override func reader(with data: Data) -> FlutterStandardReader { + return NSUserDefaultsPigeonPigeonCodecReader(data: data) + } + + override func writer(with data: NSMutableData) -> FlutterStandardWriter { + return NSUserDefaultsPigeonPigeonCodecWriter(data: data) + } +} + +class NSUserDefaultsPigeonPigeonCodec: FlutterStandardMessageCodec, @unchecked Sendable { + static let shared = NSUserDefaultsPigeonPigeonCodec(readerWriter: NSUserDefaultsPigeonPigeonCodecReaderWriter()) +} + /// A pigeon for interacting with the NSUserDefaults API on iOS and macOS. /// /// Generated protocol from Pigeon that represents a handler of messages from Flutter. @@ -50,10 +97,11 @@ protocol NSUserDefaultsPigeon { /// Generated setup class from Pigeon to handle messages through the `binaryMessenger`. class NSUserDefaultsPigeonSetup { - /// The codec used by NSUserDefaultsPigeon. + static var codec: FlutterStandardMessageCodec { NSUserDefaultsPigeonPigeonCodec.shared } /// Sets up an instance of `NSUserDefaultsPigeon` to handle messages through the `binaryMessenger`. - static func setUp(binaryMessenger: FlutterBinaryMessenger, api: NSUserDefaultsPigeon?) { - let setBoolChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.amplify_secure_storage.NSUserDefaultsPigeon.setBool", binaryMessenger: binaryMessenger) + static func setUp(binaryMessenger: FlutterBinaryMessenger, api: NSUserDefaultsPigeon?, messageChannelSuffix: String = "") { + let channelSuffix = messageChannelSuffix.count > 0 ? ".\(messageChannelSuffix)" : "" + let setBoolChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.amplify_secure_storage.NSUserDefaultsPigeon.setBool\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) if let api = api { setBoolChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -69,7 +117,7 @@ class NSUserDefaultsPigeonSetup { } else { setBoolChannel.setMessageHandler(nil) } - let boolForChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.amplify_secure_storage.NSUserDefaultsPigeon.boolFor", binaryMessenger: binaryMessenger) + let boolForChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.amplify_secure_storage.NSUserDefaultsPigeon.boolFor\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) if let api = api { boolForChannel.setMessageHandler { message, reply in let args = message as! [Any?] diff --git a/packages/secure_storage/amplify_secure_storage/lib/src/pigeons/amplify_secure_storage_pigeon.g.dart b/packages/secure_storage/amplify_secure_storage/lib/src/pigeons/amplify_secure_storage_pigeon.g.dart index 6d632294bf..ab1fa4ef77 100644 --- a/packages/secure_storage/amplify_secure_storage/lib/src/pigeons/amplify_secure_storage_pigeon.g.dart +++ b/packages/secure_storage/amplify_secure_storage/lib/src/pigeons/amplify_secure_storage_pigeon.g.dart @@ -1,9 +1,9 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 // -// Autogenerated from Pigeon (v11.0.0), do not edit directly. +// Autogenerated from Pigeon (v22.6.2), do not edit directly. // See also: https://pub.dev/packages/pigeon -// ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import +// ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import, no_leading_underscores_for_local_identifiers import 'dart:async'; import 'dart:typed_data' show Float64List, Int32List, Int64List, Uint8List; @@ -11,105 +11,141 @@ import 'dart:typed_data' show Float64List, Int32List, Int64List, Uint8List; import 'package:flutter/foundation.dart' show ReadBuffer, WriteBuffer; import 'package:flutter/services.dart'; +PlatformException _createConnectionError(String channelName) { + return PlatformException( + code: 'channel-error', + message: 'Unable to establish connection on channel: "$channelName".', + ); +} + +class _PigeonCodec extends StandardMessageCodec { + const _PigeonCodec(); + @override + void writeValue(WriteBuffer buffer, Object? value) { + if (value is int) { + buffer.putUint8(4); + buffer.putInt64(value); + } else { + super.writeValue(buffer, value); + } + } + + @override + Object? readValueOfType(int type, ReadBuffer buffer) { + switch (type) { + default: + return super.readValueOfType(type, buffer); + } + } +} + /// A pigeon for interacting with the native AmplifySecureStorage implementation /// on Android. class AmplifySecureStoragePigeon { /// Constructor for [AmplifySecureStoragePigeon]. The [binaryMessenger] named argument is /// available for dependency injection. If it is left null, the default /// BinaryMessenger will be used which routes to the host platform. - AmplifySecureStoragePigeon({BinaryMessenger? binaryMessenger}) - : _binaryMessenger = binaryMessenger; - final BinaryMessenger? _binaryMessenger; + AmplifySecureStoragePigeon( + {BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) + : pigeonVar_binaryMessenger = binaryMessenger, + pigeonVar_messageChannelSuffix = + messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; + final BinaryMessenger? pigeonVar_binaryMessenger; - static const MessageCodec codec = StandardMessageCodec(); + static const MessageCodec pigeonChannelCodec = _PigeonCodec(); - Future read(String arg_namespace, String arg_key) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.amplify_secure_storage.AmplifySecureStoragePigeon.read', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_namespace, arg_key]) as List?; - if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); - } else if (replyList.length > 1) { + final String pigeonVar_messageChannelSuffix; + + Future read(String namespace, String key) async { + final String pigeonVar_channelName = + 'dev.flutter.pigeon.amplify_secure_storage.AmplifySecureStoragePigeon.read$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final List? pigeonVar_replyList = await pigeonVar_channel + .send([namespace, key]) as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { throw PlatformException( - code: replyList[0]! as String, - message: replyList[1] as String?, - details: replyList[2], + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], ); } else { - return (replyList[0] as String?); + return (pigeonVar_replyList[0] as String?); } } - Future write( - String arg_namespace, String arg_key, String? arg_value) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.amplify_secure_storage.AmplifySecureStoragePigeon.write', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_namespace, arg_key, arg_value]) as List?; - if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); - } else if (replyList.length > 1) { + Future write(String namespace, String key, String? value) async { + final String pigeonVar_channelName = + 'dev.flutter.pigeon.amplify_secure_storage.AmplifySecureStoragePigeon.write$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final List? pigeonVar_replyList = await pigeonVar_channel + .send([namespace, key, value]) as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { throw PlatformException( - code: replyList[0]! as String, - message: replyList[1] as String?, - details: replyList[2], + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], ); } else { return; } } - Future delete(String arg_namespace, String arg_key) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.amplify_secure_storage.AmplifySecureStoragePigeon.delete', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_namespace, arg_key]) as List?; - if (replyList == null) { + Future delete(String namespace, String key) async { + final String pigeonVar_channelName = + 'dev.flutter.pigeon.amplify_secure_storage.AmplifySecureStoragePigeon.delete$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final List? pigeonVar_replyList = await pigeonVar_channel + .send([namespace, key]) as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); - } else if (replyList.length > 1) { - throw PlatformException( - code: replyList[0]! as String, - message: replyList[1] as String?, - details: replyList[2], + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], ); } else { return; } } - Future removeAll(String arg_namespace) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.amplify_secure_storage.AmplifySecureStoragePigeon.removeAll', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_namespace]) as List?; - if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); - } else if (replyList.length > 1) { + Future removeAll(String namespace) async { + final String pigeonVar_channelName = + 'dev.flutter.pigeon.amplify_secure_storage.AmplifySecureStoragePigeon.removeAll$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final List? pigeonVar_replyList = + await pigeonVar_channel.send([namespace]) as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { throw PlatformException( - code: replyList[0]! as String, - message: replyList[1] as String?, - details: replyList[2], + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], ); } else { return; diff --git a/packages/secure_storage/amplify_secure_storage/lib/src/pigeons/ns_user_defaults_pigeon.g.dart b/packages/secure_storage/amplify_secure_storage/lib/src/pigeons/ns_user_defaults_pigeon.g.dart index 94f386adf1..c0493f9b47 100644 --- a/packages/secure_storage/amplify_secure_storage/lib/src/pigeons/ns_user_defaults_pigeon.g.dart +++ b/packages/secure_storage/amplify_secure_storage/lib/src/pigeons/ns_user_defaults_pigeon.g.dart @@ -1,9 +1,9 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 // -// Autogenerated from Pigeon (v11.0.0), do not edit directly. +// Autogenerated from Pigeon (v22.6.2), do not edit directly. // See also: https://pub.dev/packages/pigeon -// ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import +// ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import, no_leading_underscores_for_local_identifiers import 'dart:async'; import 'dart:typed_data' show Float64List, Int32List, Int64List, Uint8List; @@ -11,65 +11,100 @@ import 'dart:typed_data' show Float64List, Int32List, Int64List, Uint8List; import 'package:flutter/foundation.dart' show ReadBuffer, WriteBuffer; import 'package:flutter/services.dart'; +PlatformException _createConnectionError(String channelName) { + return PlatformException( + code: 'channel-error', + message: 'Unable to establish connection on channel: "$channelName".', + ); +} + +class _PigeonCodec extends StandardMessageCodec { + const _PigeonCodec(); + @override + void writeValue(WriteBuffer buffer, Object? value) { + if (value is int) { + buffer.putUint8(4); + buffer.putInt64(value); + } else { + super.writeValue(buffer, value); + } + } + + @override + Object? readValueOfType(int type, ReadBuffer buffer) { + switch (type) { + default: + return super.readValueOfType(type, buffer); + } + } +} + /// A pigeon for interacting with the NSUserDefaults API on iOS and macOS. class NSUserDefaultsPigeon { /// Constructor for [NSUserDefaultsPigeon]. The [binaryMessenger] named argument is /// available for dependency injection. If it is left null, the default /// BinaryMessenger will be used which routes to the host platform. - NSUserDefaultsPigeon({BinaryMessenger? binaryMessenger}) - : _binaryMessenger = binaryMessenger; - final BinaryMessenger? _binaryMessenger; + NSUserDefaultsPigeon( + {BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) + : pigeonVar_binaryMessenger = binaryMessenger, + pigeonVar_messageChannelSuffix = + messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; + final BinaryMessenger? pigeonVar_binaryMessenger; - static const MessageCodec codec = StandardMessageCodec(); + static const MessageCodec pigeonChannelCodec = _PigeonCodec(); - Future setBool(String arg_key, bool arg_value) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.amplify_secure_storage.NSUserDefaultsPigeon.setBool', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_key, arg_value]) as List?; - if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); - } else if (replyList.length > 1) { + final String pigeonVar_messageChannelSuffix; + + Future setBool(String key, bool value) async { + final String pigeonVar_channelName = + 'dev.flutter.pigeon.amplify_secure_storage.NSUserDefaultsPigeon.setBool$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final List? pigeonVar_replyList = + await pigeonVar_channel.send([key, value]) as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { throw PlatformException( - code: replyList[0]! as String, - message: replyList[1] as String?, - details: replyList[2], + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], ); } else { return; } } - Future boolFor(String arg_key) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.amplify_secure_storage.NSUserDefaultsPigeon.boolFor', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_key]) as List?; - if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); - } else if (replyList.length > 1) { + Future boolFor(String key) async { + final String pigeonVar_channelName = + 'dev.flutter.pigeon.amplify_secure_storage.NSUserDefaultsPigeon.boolFor$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final List? pigeonVar_replyList = + await pigeonVar_channel.send([key]) as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { throw PlatformException( - code: replyList[0]! as String, - message: replyList[1] as String?, - details: replyList[2], + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], ); - } else if (replyList[0] == null) { + } else if (pigeonVar_replyList[0] == null) { throw PlatformException( code: 'null-error', message: 'Host platform returned null value for non-null return value.', ); } else { - return (replyList[0] as bool?)!; + return (pigeonVar_replyList[0] as bool?)!; } } } diff --git a/packages/secure_storage/amplify_secure_storage/macos/Classes/pigeons/NSUserDefaultsPigeon.swift b/packages/secure_storage/amplify_secure_storage/macos/Classes/pigeons/NSUserDefaultsPigeon.swift index f546fbe25d..d6cfe5e204 100644 --- a/packages/secure_storage/amplify_secure_storage/macos/Classes/pigeons/NSUserDefaultsPigeon.swift +++ b/packages/secure_storage/amplify_secure_storage/macos/Classes/pigeons/NSUserDefaultsPigeon.swift @@ -1,20 +1,35 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 -// -// Autogenerated from Pigeon (v11.0.0), do not edit directly. +// +// Autogenerated from Pigeon (v22.6.2), do not edit directly. // See also: https://pub.dev/packages/pigeon import Foundation + #if os(iOS) -import Flutter + import Flutter #elseif os(macOS) -import FlutterMacOS + import FlutterMacOS #else -#error("Unsupported platform.") + #error("Unsupported platform.") #endif -private func isNullish(_ value: Any?) -> Bool { - return value is NSNull || value == nil +/// Error class for passing custom error details to Dart side. +final class PigeonError: Error { + let code: String + let message: String? + let details: Any? + + init(code: String, message: String?, details: Any?) { + self.code = code + self.message = message + self.details = details + } + + var localizedDescription: String { + return + "PigeonError(code: \(code), message: \(message ?? ""), details: \(details ?? "")" + } } private func wrapResult(_ result: Any?) -> [Any?] { @@ -22,24 +37,56 @@ private func wrapResult(_ result: Any?) -> [Any?] { } private func wrapError(_ error: Any) -> [Any?] { + if let pigeonError = error as? PigeonError { + return [ + pigeonError.code, + pigeonError.message, + pigeonError.details, + ] + } if let flutterError = error as? FlutterError { return [ flutterError.code, flutterError.message, - flutterError.details + flutterError.details, ] } return [ "\(error)", "\(type(of: error))", - "Stacktrace: \(Thread.callStackSymbols)" + "Stacktrace: \(Thread.callStackSymbols)", ] } +private func isNullish(_ value: Any?) -> Bool { + return value is NSNull || value == nil +} + private func nilOrValue(_ value: Any?) -> T? { if value is NSNull { return nil } return value as! T? } + +private class NSUserDefaultsPigeonPigeonCodecReader: FlutterStandardReader { +} + +private class NSUserDefaultsPigeonPigeonCodecWriter: FlutterStandardWriter { +} + +private class NSUserDefaultsPigeonPigeonCodecReaderWriter: FlutterStandardReaderWriter { + override func reader(with data: Data) -> FlutterStandardReader { + return NSUserDefaultsPigeonPigeonCodecReader(data: data) + } + + override func writer(with data: NSMutableData) -> FlutterStandardWriter { + return NSUserDefaultsPigeonPigeonCodecWriter(data: data) + } +} + +class NSUserDefaultsPigeonPigeonCodec: FlutterStandardMessageCodec, @unchecked Sendable { + static let shared = NSUserDefaultsPigeonPigeonCodec(readerWriter: NSUserDefaultsPigeonPigeonCodecReaderWriter()) +} + /// A pigeon for interacting with the NSUserDefaults API on iOS and macOS. /// /// Generated protocol from Pigeon that represents a handler of messages from Flutter. @@ -50,10 +97,11 @@ protocol NSUserDefaultsPigeon { /// Generated setup class from Pigeon to handle messages through the `binaryMessenger`. class NSUserDefaultsPigeonSetup { - /// The codec used by NSUserDefaultsPigeon. + static var codec: FlutterStandardMessageCodec { NSUserDefaultsPigeonPigeonCodec.shared } /// Sets up an instance of `NSUserDefaultsPigeon` to handle messages through the `binaryMessenger`. - static func setUp(binaryMessenger: FlutterBinaryMessenger, api: NSUserDefaultsPigeon?) { - let setBoolChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.amplify_secure_storage.NSUserDefaultsPigeon.setBool", binaryMessenger: binaryMessenger) + static func setUp(binaryMessenger: FlutterBinaryMessenger, api: NSUserDefaultsPigeon?, messageChannelSuffix: String = "") { + let channelSuffix = messageChannelSuffix.count > 0 ? ".\(messageChannelSuffix)" : "" + let setBoolChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.amplify_secure_storage.NSUserDefaultsPigeon.setBool\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) if let api = api { setBoolChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -69,7 +117,7 @@ class NSUserDefaultsPigeonSetup { } else { setBoolChannel.setMessageHandler(nil) } - let boolForChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.amplify_secure_storage.NSUserDefaultsPigeon.boolFor", binaryMessenger: binaryMessenger) + let boolForChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.amplify_secure_storage.NSUserDefaultsPigeon.boolFor\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) if let api = api { boolForChannel.setMessageHandler { message, reply in let args = message as! [Any?] diff --git a/packages/secure_storage/amplify_secure_storage/pubspec.yaml b/packages/secure_storage/amplify_secure_storage/pubspec.yaml index 1d9b76ecb3..ee694165c1 100644 --- a/packages/secure_storage/amplify_secure_storage/pubspec.yaml +++ b/packages/secure_storage/amplify_secure_storage/pubspec.yaml @@ -26,7 +26,7 @@ dev_dependencies: amplify_lints: ">=3.1.0 <3.2.0" flutter_test: sdk: flutter - pigeon: ^11.0.0 + pigeon: ^22.6.2 flutter: plugin: diff --git a/packages/storage/amplify_storage_s3_dart/pubspec.yaml b/packages/storage/amplify_storage_s3_dart/pubspec.yaml index 275c2b3318..dd8b78c78c 100644 --- a/packages/storage/amplify_storage_s3_dart/pubspec.yaml +++ b/packages/storage/amplify_storage_s3_dart/pubspec.yaml @@ -16,7 +16,7 @@ dependencies: aws_signature_v4: ">=0.6.3 <0.7.0" built_collection: ^5.0.0 built_value: ^8.6.0 - drift: ">=2.18.0 <2.19.0" + drift: ">=2.22.0 <2.23.0" fixnum: ^1.0.0 json_annotation: ">=4.9.0 <4.10.0" meta: ^1.7.0 @@ -29,7 +29,7 @@ dev_dependencies: build_runner: ^2.4.9 build_verify: ^3.0.0 built_value_generator: 8.8.1 - drift_dev: ">=2.18.0 <2.19.0" + drift_dev: ">=2.22.0 <2.23.0" json_serializable: 6.8.0 mocktail: ^1.0.0 test: ^1.22.1 diff --git a/pubspec.yaml b/pubspec.yaml index 298afd11e2..018b561b32 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -38,7 +38,7 @@ dependencies: mime: ">=1.0.0 <3.0.0" oauth2: ^2.0.2 package_info_plus: ^8.0.0 - pigeon: ^11.0.0 + pigeon: ^22.6.2 sqlite3: ">=2.0.0 <2.4.7" source_gen: ^1.3.2 stack_trace: ^1.10.0 From c369cff57d9a4fa762ee45b2203f171cae1d97ec Mon Sep 17 00:00:00 2001 From: Tyler-Larkin Date: Sun, 1 Dec 2024 17:32:58 -0800 Subject: [PATCH 02/11] chore(analytics,db,storage): Updated Drift Version --- .../analytics/amplify_analytics_pinpoint_dart/pubspec.yaml | 4 ++-- packages/common/amplify_db_common/example/pubspec.yaml | 4 ++-- packages/common/amplify_db_common/pubspec.yaml | 2 +- packages/common/amplify_db_common_dart/example/pubspec.yaml | 4 ++-- packages/common/amplify_db_common_dart/pubspec.yaml | 4 ++-- packages/storage/amplify_storage_s3/example/pubspec.yaml | 2 +- packages/test/pub_server/pubspec.yaml | 4 ++-- pubspec.yaml | 4 ++-- 8 files changed, 14 insertions(+), 14 deletions(-) diff --git a/packages/analytics/amplify_analytics_pinpoint_dart/pubspec.yaml b/packages/analytics/amplify_analytics_pinpoint_dart/pubspec.yaml index 94a5792d65..0f4a774436 100644 --- a/packages/analytics/amplify_analytics_pinpoint_dart/pubspec.yaml +++ b/packages/analytics/amplify_analytics_pinpoint_dart/pubspec.yaml @@ -17,7 +17,7 @@ dependencies: built_collection: ^5.0.0 built_value: ^8.6.0 collection: ^1.15.0 - drift: ">=2.18.0 <2.19.0" + drift: ">=2.22.0 <2.23.0" intl: ">=0.18.0 <1.0.0" meta: ^1.7.0 path: ">=1.8.0 <2.0.0" @@ -33,7 +33,7 @@ dev_dependencies: build_version: ^2.0.0 build_web_compilers: ^4.0.0 built_value_generator: 8.8.1 - drift_dev: ">=2.18.0 <2.19.0" + drift_dev: ">=2.22.0 <2.23.0" mocktail: ^1.0.0 test: ^1.22.1 diff --git a/packages/common/amplify_db_common/example/pubspec.yaml b/packages/common/amplify_db_common/example/pubspec.yaml index a5b6ab272c..8b9ad22412 100644 --- a/packages/common/amplify_db_common/example/pubspec.yaml +++ b/packages/common/amplify_db_common/example/pubspec.yaml @@ -8,7 +8,7 @@ environment: dependencies: amplify_db_common: ">=0.4.5 <0.5.0" - drift: ">=2.18.0 <2.19.0" + drift: ">=2.22.0 <2.23.0" flutter: sdk: flutter # Included to validate windows app will build when there is a downstream @@ -19,7 +19,7 @@ dependencies: dev_dependencies: amplify_lints: ^2.0.0 - drift_dev: ">=2.18.0 <2.19.0" + drift_dev: ">=2.22.0 <2.23.0" build_runner: ^2.4.9 flutter_test: sdk: flutter diff --git a/packages/common/amplify_db_common/pubspec.yaml b/packages/common/amplify_db_common/pubspec.yaml index 2cfec1a9f1..59d4e67b76 100644 --- a/packages/common/amplify_db_common/pubspec.yaml +++ b/packages/common/amplify_db_common/pubspec.yaml @@ -11,7 +11,7 @@ environment: dependencies: amplify_db_common_dart: ">=0.4.7 <0.5.0" - drift: ">=2.18.0 <2.19.0" + drift: ">=2.22.0 <2.23.0" flutter: sdk: flutter path: ">=1.8.0 <2.0.0" diff --git a/packages/common/amplify_db_common_dart/example/pubspec.yaml b/packages/common/amplify_db_common_dart/example/pubspec.yaml index db1a3ff203..5397d83724 100644 --- a/packages/common/amplify_db_common_dart/example/pubspec.yaml +++ b/packages/common/amplify_db_common_dart/example/pubspec.yaml @@ -11,7 +11,7 @@ environment: dependencies: amplify_db_common_dart: ">=0.4.0 <0.5.0" - drift: ">=2.18.0 <2.19.0" + drift: ">=2.22.0 <2.23.0" example_common: path: ../../../example_common @@ -20,4 +20,4 @@ dev_dependencies: path: ../../../amplify_lints build_runner: ^2.4.9 build_web_compilers: ^4.0.0 - drift_dev: ">=2.18.0 <2.19.0" + drift_dev: ">=2.22.0 <2.23.0" diff --git a/packages/common/amplify_db_common_dart/pubspec.yaml b/packages/common/amplify_db_common_dart/pubspec.yaml index e43cf60061..a724f04cd9 100644 --- a/packages/common/amplify_db_common_dart/pubspec.yaml +++ b/packages/common/amplify_db_common_dart/pubspec.yaml @@ -12,7 +12,7 @@ dependencies: amplify_core: ">=2.5.0 <2.6.0" async: ^2.10.0 aws_common: ">=0.7.3 <0.8.0" - drift: ">=2.18.0 <2.19.0" + drift: ">=2.22.0 <2.23.0" meta: ^1.7.0 path: ">=1.8.0 <2.0.0" sqlite3: ">=2.0.0 <2.4.7" @@ -22,5 +22,5 @@ dev_dependencies: build_runner: ^2.4.9 build_test: ^2.0.0 build_web_compilers: ^4.0.0 - drift_dev: ">=2.18.0 <2.19.0" + drift_dev: ">=2.22.0 <2.23.0" test: ^1.22.1 diff --git a/packages/storage/amplify_storage_s3/example/pubspec.yaml b/packages/storage/amplify_storage_s3/example/pubspec.yaml index f92cc97767..22e74ed75e 100644 --- a/packages/storage/amplify_storage_s3/example/pubspec.yaml +++ b/packages/storage/amplify_storage_s3/example/pubspec.yaml @@ -28,7 +28,7 @@ dev_dependencies: amplify_test: path: ../../../test/amplify_test aws_common: any - drift: ">=2.18.0 <2.19.0" + drift: ">=2.22.0 <2.23.0" flutter_driver: sdk: flutter flutter_test: diff --git a/packages/test/pub_server/pubspec.yaml b/packages/test/pub_server/pubspec.yaml index b29627fbb2..86b99d7c54 100644 --- a/packages/test/pub_server/pubspec.yaml +++ b/packages/test/pub_server/pubspec.yaml @@ -14,7 +14,7 @@ dependencies: async: ^2.10.0 aws_common: any collection: ^1.15.0 - drift: ">=2.18.0 <2.19.0" + drift: ">=2.22.0 <2.23.0" file: ">=6.0.0 <8.0.0" git: ^2.2.0 graphs: ^2.1.0 @@ -31,7 +31,7 @@ dependencies: dev_dependencies: amplify_lints: ">=2.0.3 <2.1.0" build_runner: ^2.4.9 - drift_dev: ">=2.18.0 <2.19.0" + drift_dev: ">=2.22.0 <2.23.0" json_serializable: 6.8.0 pub_api_client: ">=2.4.0 <2.7.0" # v2.7.0 introduces a new required field - archive_sha256 shelf_router_generator: ^1.0.5 diff --git a/pubspec.yaml b/pubspec.yaml index 018b561b32..bdaf845f81 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -25,8 +25,8 @@ dependencies: # on stable so that CI checks pass for generated code. dart_style: ^2.3.2 device_info_plus: ^10.0.1 - drift: ">=2.18.0 <2.19.0" - drift_dev: ">=2.18.0 <2.19.0" + drift: ">=2.22.0 <2.23.0" + drift_dev: ">=2.22.0 <2.23.0" ffigen: ^9.0.0 file: ">=6.0.0 <8.0.0" flutter_plugin_android_lifecycle: ^2.0.9 From 24d3125bef6ca8fa9f440203f39d7c0055810dbe Mon Sep 17 00:00:00 2001 From: Tyler-Larkin Date: Sun, 1 Dec 2024 17:53:23 -0800 Subject: [PATCH 03/11] chore(db,storage): regenerated Drift databases and tables --- .../example/bin/database.g.dart | 284 ++++++++++++++ .../example/web/database.g.dart | 284 ++++++++++++++ .../test/database.g.dart | 299 ++++++++------ .../transfer/database/database_io.drift.dart | 1 + .../transfer/database/tables.drift.dart | 291 ++++++++------ .../test/pub_server/lib/src/database.g.dart | 368 +++++++++++------- 6 files changed, 1143 insertions(+), 384 deletions(-) diff --git a/packages/common/amplify_db_common_dart/example/bin/database.g.dart b/packages/common/amplify_db_common_dart/example/bin/database.g.dart index 3f9bc53dbb..42fcfa9428 100644 --- a/packages/common/amplify_db_common_dart/example/bin/database.g.dart +++ b/packages/common/amplify_db_common_dart/example/bin/database.g.dart @@ -159,6 +159,15 @@ class Todo extends DataClass implements Insertable { content: content ?? this.content, category: category.present ? category.value : this.category, ); + Todo copyWithCompanion(TodosCompanion data) { + return Todo( + id: data.id.present ? data.id.value : this.id, + title: data.title.present ? data.title.value : this.title, + content: data.content.present ? data.content.value : this.content, + category: data.category.present ? data.category.value : this.category, + ); + } + @override String toString() { return (StringBuffer('Todo(') @@ -363,6 +372,14 @@ class Category extends DataClass implements Insertable { id: id ?? this.id, description: description ?? this.description, ); + Category copyWithCompanion(CategoriesCompanion data) { + return Category( + id: data.id.present ? data.id.value : this.id, + description: + data.description.present ? data.description.value : this.description, + ); + } + @override String toString() { return (StringBuffer('Category(') @@ -434,6 +451,7 @@ class CategoriesCompanion extends UpdateCompanion { abstract class _$MyDatabase extends GeneratedDatabase { _$MyDatabase(QueryExecutor e) : super(e); + $MyDatabaseManager get managers => $MyDatabaseManager(this); late final $TodosTable todos = $TodosTable(this); late final $CategoriesTable categories = $CategoriesTable(this); @override @@ -442,3 +460,269 @@ abstract class _$MyDatabase extends GeneratedDatabase { @override List get allSchemaEntities => [todos, categories]; } + +typedef $$TodosTableCreateCompanionBuilder = TodosCompanion Function({ + Value id, + required String title, + required String content, + Value category, +}); +typedef $$TodosTableUpdateCompanionBuilder = TodosCompanion Function({ + Value id, + Value title, + Value content, + Value category, +}); + +class $$TodosTableFilterComposer extends Composer<_$MyDatabase, $TodosTable> { + $$TodosTableFilterComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + ColumnFilters get id => $composableBuilder( + column: $table.id, builder: (column) => ColumnFilters(column)); + + ColumnFilters get title => $composableBuilder( + column: $table.title, builder: (column) => ColumnFilters(column)); + + ColumnFilters get content => $composableBuilder( + column: $table.content, builder: (column) => ColumnFilters(column)); + + ColumnFilters get category => $composableBuilder( + column: $table.category, builder: (column) => ColumnFilters(column)); +} + +class $$TodosTableOrderingComposer extends Composer<_$MyDatabase, $TodosTable> { + $$TodosTableOrderingComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + ColumnOrderings get id => $composableBuilder( + column: $table.id, builder: (column) => ColumnOrderings(column)); + + ColumnOrderings get title => $composableBuilder( + column: $table.title, builder: (column) => ColumnOrderings(column)); + + ColumnOrderings get content => $composableBuilder( + column: $table.content, builder: (column) => ColumnOrderings(column)); + + ColumnOrderings get category => $composableBuilder( + column: $table.category, builder: (column) => ColumnOrderings(column)); +} + +class $$TodosTableAnnotationComposer + extends Composer<_$MyDatabase, $TodosTable> { + $$TodosTableAnnotationComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + GeneratedColumn get id => + $composableBuilder(column: $table.id, builder: (column) => column); + + GeneratedColumn get title => + $composableBuilder(column: $table.title, builder: (column) => column); + + GeneratedColumn get content => + $composableBuilder(column: $table.content, builder: (column) => column); + + GeneratedColumn get category => + $composableBuilder(column: $table.category, builder: (column) => column); +} + +class $$TodosTableTableManager extends RootTableManager< + _$MyDatabase, + $TodosTable, + Todo, + $$TodosTableFilterComposer, + $$TodosTableOrderingComposer, + $$TodosTableAnnotationComposer, + $$TodosTableCreateCompanionBuilder, + $$TodosTableUpdateCompanionBuilder, + (Todo, BaseReferences<_$MyDatabase, $TodosTable, Todo>), + Todo, + PrefetchHooks Function()> { + $$TodosTableTableManager(_$MyDatabase db, $TodosTable table) + : super(TableManagerState( + db: db, + table: table, + createFilteringComposer: () => + $$TodosTableFilterComposer($db: db, $table: table), + createOrderingComposer: () => + $$TodosTableOrderingComposer($db: db, $table: table), + createComputedFieldComposer: () => + $$TodosTableAnnotationComposer($db: db, $table: table), + updateCompanionCallback: ({ + Value id = const Value.absent(), + Value title = const Value.absent(), + Value content = const Value.absent(), + Value category = const Value.absent(), + }) => + TodosCompanion( + id: id, + title: title, + content: content, + category: category, + ), + createCompanionCallback: ({ + Value id = const Value.absent(), + required String title, + required String content, + Value category = const Value.absent(), + }) => + TodosCompanion.insert( + id: id, + title: title, + content: content, + category: category, + ), + withReferenceMapper: (p0) => p0 + .map((e) => (e.readTable(table), BaseReferences(db, table, e))) + .toList(), + prefetchHooksCallback: null, + )); +} + +typedef $$TodosTableProcessedTableManager = ProcessedTableManager< + _$MyDatabase, + $TodosTable, + Todo, + $$TodosTableFilterComposer, + $$TodosTableOrderingComposer, + $$TodosTableAnnotationComposer, + $$TodosTableCreateCompanionBuilder, + $$TodosTableUpdateCompanionBuilder, + (Todo, BaseReferences<_$MyDatabase, $TodosTable, Todo>), + Todo, + PrefetchHooks Function()>; +typedef $$CategoriesTableCreateCompanionBuilder = CategoriesCompanion Function({ + Value id, + required String description, +}); +typedef $$CategoriesTableUpdateCompanionBuilder = CategoriesCompanion Function({ + Value id, + Value description, +}); + +class $$CategoriesTableFilterComposer + extends Composer<_$MyDatabase, $CategoriesTable> { + $$CategoriesTableFilterComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + ColumnFilters get id => $composableBuilder( + column: $table.id, builder: (column) => ColumnFilters(column)); + + ColumnFilters get description => $composableBuilder( + column: $table.description, builder: (column) => ColumnFilters(column)); +} + +class $$CategoriesTableOrderingComposer + extends Composer<_$MyDatabase, $CategoriesTable> { + $$CategoriesTableOrderingComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + ColumnOrderings get id => $composableBuilder( + column: $table.id, builder: (column) => ColumnOrderings(column)); + + ColumnOrderings get description => $composableBuilder( + column: $table.description, builder: (column) => ColumnOrderings(column)); +} + +class $$CategoriesTableAnnotationComposer + extends Composer<_$MyDatabase, $CategoriesTable> { + $$CategoriesTableAnnotationComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + GeneratedColumn get id => + $composableBuilder(column: $table.id, builder: (column) => column); + + GeneratedColumn get description => $composableBuilder( + column: $table.description, builder: (column) => column); +} + +class $$CategoriesTableTableManager extends RootTableManager< + _$MyDatabase, + $CategoriesTable, + Category, + $$CategoriesTableFilterComposer, + $$CategoriesTableOrderingComposer, + $$CategoriesTableAnnotationComposer, + $$CategoriesTableCreateCompanionBuilder, + $$CategoriesTableUpdateCompanionBuilder, + (Category, BaseReferences<_$MyDatabase, $CategoriesTable, Category>), + Category, + PrefetchHooks Function()> { + $$CategoriesTableTableManager(_$MyDatabase db, $CategoriesTable table) + : super(TableManagerState( + db: db, + table: table, + createFilteringComposer: () => + $$CategoriesTableFilterComposer($db: db, $table: table), + createOrderingComposer: () => + $$CategoriesTableOrderingComposer($db: db, $table: table), + createComputedFieldComposer: () => + $$CategoriesTableAnnotationComposer($db: db, $table: table), + updateCompanionCallback: ({ + Value id = const Value.absent(), + Value description = const Value.absent(), + }) => + CategoriesCompanion( + id: id, + description: description, + ), + createCompanionCallback: ({ + Value id = const Value.absent(), + required String description, + }) => + CategoriesCompanion.insert( + id: id, + description: description, + ), + withReferenceMapper: (p0) => p0 + .map((e) => (e.readTable(table), BaseReferences(db, table, e))) + .toList(), + prefetchHooksCallback: null, + )); +} + +typedef $$CategoriesTableProcessedTableManager = ProcessedTableManager< + _$MyDatabase, + $CategoriesTable, + Category, + $$CategoriesTableFilterComposer, + $$CategoriesTableOrderingComposer, + $$CategoriesTableAnnotationComposer, + $$CategoriesTableCreateCompanionBuilder, + $$CategoriesTableUpdateCompanionBuilder, + (Category, BaseReferences<_$MyDatabase, $CategoriesTable, Category>), + Category, + PrefetchHooks Function()>; + +class $MyDatabaseManager { + final _$MyDatabase _db; + $MyDatabaseManager(this._db); + $$TodosTableTableManager get todos => + $$TodosTableTableManager(_db, _db.todos); + $$CategoriesTableTableManager get categories => + $$CategoriesTableTableManager(_db, _db.categories); +} diff --git a/packages/common/amplify_db_common_dart/example/web/database.g.dart b/packages/common/amplify_db_common_dart/example/web/database.g.dart index 3f9bc53dbb..42fcfa9428 100644 --- a/packages/common/amplify_db_common_dart/example/web/database.g.dart +++ b/packages/common/amplify_db_common_dart/example/web/database.g.dart @@ -159,6 +159,15 @@ class Todo extends DataClass implements Insertable { content: content ?? this.content, category: category.present ? category.value : this.category, ); + Todo copyWithCompanion(TodosCompanion data) { + return Todo( + id: data.id.present ? data.id.value : this.id, + title: data.title.present ? data.title.value : this.title, + content: data.content.present ? data.content.value : this.content, + category: data.category.present ? data.category.value : this.category, + ); + } + @override String toString() { return (StringBuffer('Todo(') @@ -363,6 +372,14 @@ class Category extends DataClass implements Insertable { id: id ?? this.id, description: description ?? this.description, ); + Category copyWithCompanion(CategoriesCompanion data) { + return Category( + id: data.id.present ? data.id.value : this.id, + description: + data.description.present ? data.description.value : this.description, + ); + } + @override String toString() { return (StringBuffer('Category(') @@ -434,6 +451,7 @@ class CategoriesCompanion extends UpdateCompanion { abstract class _$MyDatabase extends GeneratedDatabase { _$MyDatabase(QueryExecutor e) : super(e); + $MyDatabaseManager get managers => $MyDatabaseManager(this); late final $TodosTable todos = $TodosTable(this); late final $CategoriesTable categories = $CategoriesTable(this); @override @@ -442,3 +460,269 @@ abstract class _$MyDatabase extends GeneratedDatabase { @override List get allSchemaEntities => [todos, categories]; } + +typedef $$TodosTableCreateCompanionBuilder = TodosCompanion Function({ + Value id, + required String title, + required String content, + Value category, +}); +typedef $$TodosTableUpdateCompanionBuilder = TodosCompanion Function({ + Value id, + Value title, + Value content, + Value category, +}); + +class $$TodosTableFilterComposer extends Composer<_$MyDatabase, $TodosTable> { + $$TodosTableFilterComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + ColumnFilters get id => $composableBuilder( + column: $table.id, builder: (column) => ColumnFilters(column)); + + ColumnFilters get title => $composableBuilder( + column: $table.title, builder: (column) => ColumnFilters(column)); + + ColumnFilters get content => $composableBuilder( + column: $table.content, builder: (column) => ColumnFilters(column)); + + ColumnFilters get category => $composableBuilder( + column: $table.category, builder: (column) => ColumnFilters(column)); +} + +class $$TodosTableOrderingComposer extends Composer<_$MyDatabase, $TodosTable> { + $$TodosTableOrderingComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + ColumnOrderings get id => $composableBuilder( + column: $table.id, builder: (column) => ColumnOrderings(column)); + + ColumnOrderings get title => $composableBuilder( + column: $table.title, builder: (column) => ColumnOrderings(column)); + + ColumnOrderings get content => $composableBuilder( + column: $table.content, builder: (column) => ColumnOrderings(column)); + + ColumnOrderings get category => $composableBuilder( + column: $table.category, builder: (column) => ColumnOrderings(column)); +} + +class $$TodosTableAnnotationComposer + extends Composer<_$MyDatabase, $TodosTable> { + $$TodosTableAnnotationComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + GeneratedColumn get id => + $composableBuilder(column: $table.id, builder: (column) => column); + + GeneratedColumn get title => + $composableBuilder(column: $table.title, builder: (column) => column); + + GeneratedColumn get content => + $composableBuilder(column: $table.content, builder: (column) => column); + + GeneratedColumn get category => + $composableBuilder(column: $table.category, builder: (column) => column); +} + +class $$TodosTableTableManager extends RootTableManager< + _$MyDatabase, + $TodosTable, + Todo, + $$TodosTableFilterComposer, + $$TodosTableOrderingComposer, + $$TodosTableAnnotationComposer, + $$TodosTableCreateCompanionBuilder, + $$TodosTableUpdateCompanionBuilder, + (Todo, BaseReferences<_$MyDatabase, $TodosTable, Todo>), + Todo, + PrefetchHooks Function()> { + $$TodosTableTableManager(_$MyDatabase db, $TodosTable table) + : super(TableManagerState( + db: db, + table: table, + createFilteringComposer: () => + $$TodosTableFilterComposer($db: db, $table: table), + createOrderingComposer: () => + $$TodosTableOrderingComposer($db: db, $table: table), + createComputedFieldComposer: () => + $$TodosTableAnnotationComposer($db: db, $table: table), + updateCompanionCallback: ({ + Value id = const Value.absent(), + Value title = const Value.absent(), + Value content = const Value.absent(), + Value category = const Value.absent(), + }) => + TodosCompanion( + id: id, + title: title, + content: content, + category: category, + ), + createCompanionCallback: ({ + Value id = const Value.absent(), + required String title, + required String content, + Value category = const Value.absent(), + }) => + TodosCompanion.insert( + id: id, + title: title, + content: content, + category: category, + ), + withReferenceMapper: (p0) => p0 + .map((e) => (e.readTable(table), BaseReferences(db, table, e))) + .toList(), + prefetchHooksCallback: null, + )); +} + +typedef $$TodosTableProcessedTableManager = ProcessedTableManager< + _$MyDatabase, + $TodosTable, + Todo, + $$TodosTableFilterComposer, + $$TodosTableOrderingComposer, + $$TodosTableAnnotationComposer, + $$TodosTableCreateCompanionBuilder, + $$TodosTableUpdateCompanionBuilder, + (Todo, BaseReferences<_$MyDatabase, $TodosTable, Todo>), + Todo, + PrefetchHooks Function()>; +typedef $$CategoriesTableCreateCompanionBuilder = CategoriesCompanion Function({ + Value id, + required String description, +}); +typedef $$CategoriesTableUpdateCompanionBuilder = CategoriesCompanion Function({ + Value id, + Value description, +}); + +class $$CategoriesTableFilterComposer + extends Composer<_$MyDatabase, $CategoriesTable> { + $$CategoriesTableFilterComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + ColumnFilters get id => $composableBuilder( + column: $table.id, builder: (column) => ColumnFilters(column)); + + ColumnFilters get description => $composableBuilder( + column: $table.description, builder: (column) => ColumnFilters(column)); +} + +class $$CategoriesTableOrderingComposer + extends Composer<_$MyDatabase, $CategoriesTable> { + $$CategoriesTableOrderingComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + ColumnOrderings get id => $composableBuilder( + column: $table.id, builder: (column) => ColumnOrderings(column)); + + ColumnOrderings get description => $composableBuilder( + column: $table.description, builder: (column) => ColumnOrderings(column)); +} + +class $$CategoriesTableAnnotationComposer + extends Composer<_$MyDatabase, $CategoriesTable> { + $$CategoriesTableAnnotationComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + GeneratedColumn get id => + $composableBuilder(column: $table.id, builder: (column) => column); + + GeneratedColumn get description => $composableBuilder( + column: $table.description, builder: (column) => column); +} + +class $$CategoriesTableTableManager extends RootTableManager< + _$MyDatabase, + $CategoriesTable, + Category, + $$CategoriesTableFilterComposer, + $$CategoriesTableOrderingComposer, + $$CategoriesTableAnnotationComposer, + $$CategoriesTableCreateCompanionBuilder, + $$CategoriesTableUpdateCompanionBuilder, + (Category, BaseReferences<_$MyDatabase, $CategoriesTable, Category>), + Category, + PrefetchHooks Function()> { + $$CategoriesTableTableManager(_$MyDatabase db, $CategoriesTable table) + : super(TableManagerState( + db: db, + table: table, + createFilteringComposer: () => + $$CategoriesTableFilterComposer($db: db, $table: table), + createOrderingComposer: () => + $$CategoriesTableOrderingComposer($db: db, $table: table), + createComputedFieldComposer: () => + $$CategoriesTableAnnotationComposer($db: db, $table: table), + updateCompanionCallback: ({ + Value id = const Value.absent(), + Value description = const Value.absent(), + }) => + CategoriesCompanion( + id: id, + description: description, + ), + createCompanionCallback: ({ + Value id = const Value.absent(), + required String description, + }) => + CategoriesCompanion.insert( + id: id, + description: description, + ), + withReferenceMapper: (p0) => p0 + .map((e) => (e.readTable(table), BaseReferences(db, table, e))) + .toList(), + prefetchHooksCallback: null, + )); +} + +typedef $$CategoriesTableProcessedTableManager = ProcessedTableManager< + _$MyDatabase, + $CategoriesTable, + Category, + $$CategoriesTableFilterComposer, + $$CategoriesTableOrderingComposer, + $$CategoriesTableAnnotationComposer, + $$CategoriesTableCreateCompanionBuilder, + $$CategoriesTableUpdateCompanionBuilder, + (Category, BaseReferences<_$MyDatabase, $CategoriesTable, Category>), + Category, + PrefetchHooks Function()>; + +class $MyDatabaseManager { + final _$MyDatabase _db; + $MyDatabaseManager(this._db); + $$TodosTableTableManager get todos => + $$TodosTableTableManager(_db, _db.todos); + $$CategoriesTableTableManager get categories => + $$CategoriesTableTableManager(_db, _db.categories); +} diff --git a/packages/common/amplify_db_common_dart/test/database.g.dart b/packages/common/amplify_db_common_dart/test/database.g.dart index 92b53f4d0b..42fcfa9428 100644 --- a/packages/common/amplify_db_common_dart/test/database.g.dart +++ b/packages/common/amplify_db_common_dart/test/database.g.dart @@ -159,6 +159,15 @@ class Todo extends DataClass implements Insertable { content: content ?? this.content, category: category.present ? category.value : this.category, ); + Todo copyWithCompanion(TodosCompanion data) { + return Todo( + id: data.id.present ? data.id.value : this.id, + title: data.title.present ? data.title.value : this.title, + content: data.content.present ? data.content.value : this.content, + category: data.category.present ? data.category.value : this.category, + ); + } + @override String toString() { return (StringBuffer('Todo(') @@ -363,6 +372,14 @@ class Category extends DataClass implements Insertable { id: id ?? this.id, description: description ?? this.description, ); + Category copyWithCompanion(CategoriesCompanion data) { + return Category( + id: data.id.present ? data.id.value : this.id, + description: + data.description.present ? data.description.value : this.description, + ); + } + @override String toString() { return (StringBuffer('Category(') @@ -434,7 +451,7 @@ class CategoriesCompanion extends UpdateCompanion { abstract class _$MyDatabase extends GeneratedDatabase { _$MyDatabase(QueryExecutor e) : super(e); - _$MyDatabaseManager get managers => _$MyDatabaseManager(this); + $MyDatabaseManager get managers => $MyDatabaseManager(this); late final $TodosTable todos = $TodosTable(this); late final $CategoriesTable categories = $CategoriesTable(this); @override @@ -444,7 +461,7 @@ abstract class _$MyDatabase extends GeneratedDatabase { List get allSchemaEntities => [todos, categories]; } -typedef $$TodosTableInsertCompanionBuilder = TodosCompanion Function({ +typedef $$TodosTableCreateCompanionBuilder = TodosCompanion Function({ Value id, required String title, required String content, @@ -457,25 +474,93 @@ typedef $$TodosTableUpdateCompanionBuilder = TodosCompanion Function({ Value category, }); +class $$TodosTableFilterComposer extends Composer<_$MyDatabase, $TodosTable> { + $$TodosTableFilterComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + ColumnFilters get id => $composableBuilder( + column: $table.id, builder: (column) => ColumnFilters(column)); + + ColumnFilters get title => $composableBuilder( + column: $table.title, builder: (column) => ColumnFilters(column)); + + ColumnFilters get content => $composableBuilder( + column: $table.content, builder: (column) => ColumnFilters(column)); + + ColumnFilters get category => $composableBuilder( + column: $table.category, builder: (column) => ColumnFilters(column)); +} + +class $$TodosTableOrderingComposer extends Composer<_$MyDatabase, $TodosTable> { + $$TodosTableOrderingComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + ColumnOrderings get id => $composableBuilder( + column: $table.id, builder: (column) => ColumnOrderings(column)); + + ColumnOrderings get title => $composableBuilder( + column: $table.title, builder: (column) => ColumnOrderings(column)); + + ColumnOrderings get content => $composableBuilder( + column: $table.content, builder: (column) => ColumnOrderings(column)); + + ColumnOrderings get category => $composableBuilder( + column: $table.category, builder: (column) => ColumnOrderings(column)); +} + +class $$TodosTableAnnotationComposer + extends Composer<_$MyDatabase, $TodosTable> { + $$TodosTableAnnotationComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + GeneratedColumn get id => + $composableBuilder(column: $table.id, builder: (column) => column); + + GeneratedColumn get title => + $composableBuilder(column: $table.title, builder: (column) => column); + + GeneratedColumn get content => + $composableBuilder(column: $table.content, builder: (column) => column); + + GeneratedColumn get category => + $composableBuilder(column: $table.category, builder: (column) => column); +} + class $$TodosTableTableManager extends RootTableManager< _$MyDatabase, $TodosTable, Todo, $$TodosTableFilterComposer, $$TodosTableOrderingComposer, - $$TodosTableProcessedTableManager, - $$TodosTableInsertCompanionBuilder, - $$TodosTableUpdateCompanionBuilder> { + $$TodosTableAnnotationComposer, + $$TodosTableCreateCompanionBuilder, + $$TodosTableUpdateCompanionBuilder, + (Todo, BaseReferences<_$MyDatabase, $TodosTable, Todo>), + Todo, + PrefetchHooks Function()> { $$TodosTableTableManager(_$MyDatabase db, $TodosTable table) : super(TableManagerState( db: db, table: table, - filteringComposer: - $$TodosTableFilterComposer(ComposerState(db, table)), - orderingComposer: - $$TodosTableOrderingComposer(ComposerState(db, table)), - getChildManagerBuilder: (p) => $$TodosTableProcessedTableManager(p), - getUpdateCompanionBuilder: ({ + createFilteringComposer: () => + $$TodosTableFilterComposer($db: db, $table: table), + createOrderingComposer: () => + $$TodosTableOrderingComposer($db: db, $table: table), + createComputedFieldComposer: () => + $$TodosTableAnnotationComposer($db: db, $table: table), + updateCompanionCallback: ({ Value id = const Value.absent(), Value title = const Value.absent(), Value content = const Value.absent(), @@ -487,7 +572,7 @@ class $$TodosTableTableManager extends RootTableManager< content: content, category: category, ), - getInsertCompanionBuilder: ({ + createCompanionCallback: ({ Value id = const Value.absent(), required String title, required String content, @@ -499,70 +584,26 @@ class $$TodosTableTableManager extends RootTableManager< content: content, category: category, ), + withReferenceMapper: (p0) => p0 + .map((e) => (e.readTable(table), BaseReferences(db, table, e))) + .toList(), + prefetchHooksCallback: null, )); } -class $$TodosTableProcessedTableManager extends ProcessedTableManager< +typedef $$TodosTableProcessedTableManager = ProcessedTableManager< _$MyDatabase, $TodosTable, Todo, $$TodosTableFilterComposer, $$TodosTableOrderingComposer, - $$TodosTableProcessedTableManager, - $$TodosTableInsertCompanionBuilder, - $$TodosTableUpdateCompanionBuilder> { - $$TodosTableProcessedTableManager(super.$state); -} - -class $$TodosTableFilterComposer - extends FilterComposer<_$MyDatabase, $TodosTable> { - $$TodosTableFilterComposer(super.$state); - ColumnFilters get id => $state.composableBuilder( - column: $state.table.id, - builder: (column, joinBuilders) => - ColumnFilters(column, joinBuilders: joinBuilders)); - - ColumnFilters get title => $state.composableBuilder( - column: $state.table.title, - builder: (column, joinBuilders) => - ColumnFilters(column, joinBuilders: joinBuilders)); - - ColumnFilters get content => $state.composableBuilder( - column: $state.table.content, - builder: (column, joinBuilders) => - ColumnFilters(column, joinBuilders: joinBuilders)); - - ColumnFilters get category => $state.composableBuilder( - column: $state.table.category, - builder: (column, joinBuilders) => - ColumnFilters(column, joinBuilders: joinBuilders)); -} - -class $$TodosTableOrderingComposer - extends OrderingComposer<_$MyDatabase, $TodosTable> { - $$TodosTableOrderingComposer(super.$state); - ColumnOrderings get id => $state.composableBuilder( - column: $state.table.id, - builder: (column, joinBuilders) => - ColumnOrderings(column, joinBuilders: joinBuilders)); - - ColumnOrderings get title => $state.composableBuilder( - column: $state.table.title, - builder: (column, joinBuilders) => - ColumnOrderings(column, joinBuilders: joinBuilders)); - - ColumnOrderings get content => $state.composableBuilder( - column: $state.table.content, - builder: (column, joinBuilders) => - ColumnOrderings(column, joinBuilders: joinBuilders)); - - ColumnOrderings get category => $state.composableBuilder( - column: $state.table.category, - builder: (column, joinBuilders) => - ColumnOrderings(column, joinBuilders: joinBuilders)); -} - -typedef $$CategoriesTableInsertCompanionBuilder = CategoriesCompanion Function({ + $$TodosTableAnnotationComposer, + $$TodosTableCreateCompanionBuilder, + $$TodosTableUpdateCompanionBuilder, + (Todo, BaseReferences<_$MyDatabase, $TodosTable, Todo>), + Todo, + PrefetchHooks Function()>; +typedef $$CategoriesTableCreateCompanionBuilder = CategoriesCompanion Function({ Value id, required String description, }); @@ -571,26 +612,77 @@ typedef $$CategoriesTableUpdateCompanionBuilder = CategoriesCompanion Function({ Value description, }); +class $$CategoriesTableFilterComposer + extends Composer<_$MyDatabase, $CategoriesTable> { + $$CategoriesTableFilterComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + ColumnFilters get id => $composableBuilder( + column: $table.id, builder: (column) => ColumnFilters(column)); + + ColumnFilters get description => $composableBuilder( + column: $table.description, builder: (column) => ColumnFilters(column)); +} + +class $$CategoriesTableOrderingComposer + extends Composer<_$MyDatabase, $CategoriesTable> { + $$CategoriesTableOrderingComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + ColumnOrderings get id => $composableBuilder( + column: $table.id, builder: (column) => ColumnOrderings(column)); + + ColumnOrderings get description => $composableBuilder( + column: $table.description, builder: (column) => ColumnOrderings(column)); +} + +class $$CategoriesTableAnnotationComposer + extends Composer<_$MyDatabase, $CategoriesTable> { + $$CategoriesTableAnnotationComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + GeneratedColumn get id => + $composableBuilder(column: $table.id, builder: (column) => column); + + GeneratedColumn get description => $composableBuilder( + column: $table.description, builder: (column) => column); +} + class $$CategoriesTableTableManager extends RootTableManager< _$MyDatabase, $CategoriesTable, Category, $$CategoriesTableFilterComposer, $$CategoriesTableOrderingComposer, - $$CategoriesTableProcessedTableManager, - $$CategoriesTableInsertCompanionBuilder, - $$CategoriesTableUpdateCompanionBuilder> { + $$CategoriesTableAnnotationComposer, + $$CategoriesTableCreateCompanionBuilder, + $$CategoriesTableUpdateCompanionBuilder, + (Category, BaseReferences<_$MyDatabase, $CategoriesTable, Category>), + Category, + PrefetchHooks Function()> { $$CategoriesTableTableManager(_$MyDatabase db, $CategoriesTable table) : super(TableManagerState( db: db, table: table, - filteringComposer: - $$CategoriesTableFilterComposer(ComposerState(db, table)), - orderingComposer: - $$CategoriesTableOrderingComposer(ComposerState(db, table)), - getChildManagerBuilder: (p) => - $$CategoriesTableProcessedTableManager(p), - getUpdateCompanionBuilder: ({ + createFilteringComposer: () => + $$CategoriesTableFilterComposer($db: db, $table: table), + createOrderingComposer: () => + $$CategoriesTableOrderingComposer($db: db, $table: table), + createComputedFieldComposer: () => + $$CategoriesTableAnnotationComposer($db: db, $table: table), + updateCompanionCallback: ({ Value id = const Value.absent(), Value description = const Value.absent(), }) => @@ -598,7 +690,7 @@ class $$CategoriesTableTableManager extends RootTableManager< id: id, description: description, ), - getInsertCompanionBuilder: ({ + createCompanionCallback: ({ Value id = const Value.absent(), required String description, }) => @@ -606,52 +698,29 @@ class $$CategoriesTableTableManager extends RootTableManager< id: id, description: description, ), + withReferenceMapper: (p0) => p0 + .map((e) => (e.readTable(table), BaseReferences(db, table, e))) + .toList(), + prefetchHooksCallback: null, )); } -class $$CategoriesTableProcessedTableManager extends ProcessedTableManager< +typedef $$CategoriesTableProcessedTableManager = ProcessedTableManager< _$MyDatabase, $CategoriesTable, Category, $$CategoriesTableFilterComposer, $$CategoriesTableOrderingComposer, - $$CategoriesTableProcessedTableManager, - $$CategoriesTableInsertCompanionBuilder, - $$CategoriesTableUpdateCompanionBuilder> { - $$CategoriesTableProcessedTableManager(super.$state); -} - -class $$CategoriesTableFilterComposer - extends FilterComposer<_$MyDatabase, $CategoriesTable> { - $$CategoriesTableFilterComposer(super.$state); - ColumnFilters get id => $state.composableBuilder( - column: $state.table.id, - builder: (column, joinBuilders) => - ColumnFilters(column, joinBuilders: joinBuilders)); - - ColumnFilters get description => $state.composableBuilder( - column: $state.table.description, - builder: (column, joinBuilders) => - ColumnFilters(column, joinBuilders: joinBuilders)); -} - -class $$CategoriesTableOrderingComposer - extends OrderingComposer<_$MyDatabase, $CategoriesTable> { - $$CategoriesTableOrderingComposer(super.$state); - ColumnOrderings get id => $state.composableBuilder( - column: $state.table.id, - builder: (column, joinBuilders) => - ColumnOrderings(column, joinBuilders: joinBuilders)); - - ColumnOrderings get description => $state.composableBuilder( - column: $state.table.description, - builder: (column, joinBuilders) => - ColumnOrderings(column, joinBuilders: joinBuilders)); -} + $$CategoriesTableAnnotationComposer, + $$CategoriesTableCreateCompanionBuilder, + $$CategoriesTableUpdateCompanionBuilder, + (Category, BaseReferences<_$MyDatabase, $CategoriesTable, Category>), + Category, + PrefetchHooks Function()>; -class _$MyDatabaseManager { +class $MyDatabaseManager { final _$MyDatabase _db; - _$MyDatabaseManager(this._db); + $MyDatabaseManager(this._db); $$TodosTableTableManager get todos => $$TodosTableTableManager(_db, _db.todos); $$CategoriesTableTableManager get categories => diff --git a/packages/storage/amplify_storage_s3_dart/lib/src/storage_s3_service/transfer/database/database_io.drift.dart b/packages/storage/amplify_storage_s3_dart/lib/src/storage_s3_service/transfer/database/database_io.drift.dart index 9c87dfc276..071cd83deb 100644 --- a/packages/storage/amplify_storage_s3_dart/lib/src/storage_s3_service/transfer/database/database_io.drift.dart +++ b/packages/storage/amplify_storage_s3_dart/lib/src/storage_s3_service/transfer/database/database_io.drift.dart @@ -1,3 +1,4 @@ +// dart format width=80 // ignore_for_file: type=lint import 'package:drift/drift.dart' as i0; import 'package:amplify_storage_s3_dart/src/storage_s3_service/transfer/database/tables.drift.dart' diff --git a/packages/storage/amplify_storage_s3_dart/lib/src/storage_s3_service/transfer/database/tables.drift.dart b/packages/storage/amplify_storage_s3_dart/lib/src/storage_s3_service/transfer/database/tables.drift.dart index 30ebd91612..7d9037e154 100644 --- a/packages/storage/amplify_storage_s3_dart/lib/src/storage_s3_service/transfer/database/tables.drift.dart +++ b/packages/storage/amplify_storage_s3_dart/lib/src/storage_s3_service/transfer/database/tables.drift.dart @@ -1,3 +1,4 @@ +// dart format width=80 // ignore_for_file: type=lint import 'package:drift/drift.dart' as i0; import 'package:amplify_storage_s3_dart/src/storage_s3_service/transfer/database/tables.drift.dart' @@ -5,6 +6,164 @@ import 'package:amplify_storage_s3_dart/src/storage_s3_service/transfer/database import 'package:amplify_storage_s3_dart/src/storage_s3_service/transfer/database/tables.dart' as i2; +typedef $$TransferRecordsTableCreateCompanionBuilder + = i1.TransferRecordsCompanion Function({ + i0.Value id, + required String uploadId, + required String objectKey, + required String createdAt, +}); +typedef $$TransferRecordsTableUpdateCompanionBuilder + = i1.TransferRecordsCompanion Function({ + i0.Value id, + i0.Value uploadId, + i0.Value objectKey, + i0.Value createdAt, +}); + +class $$TransferRecordsTableFilterComposer + extends i0.Composer { + $$TransferRecordsTableFilterComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + i0.ColumnFilters get id => $composableBuilder( + column: $table.id, builder: (column) => i0.ColumnFilters(column)); + + i0.ColumnFilters get uploadId => $composableBuilder( + column: $table.uploadId, builder: (column) => i0.ColumnFilters(column)); + + i0.ColumnFilters get objectKey => $composableBuilder( + column: $table.objectKey, builder: (column) => i0.ColumnFilters(column)); + + i0.ColumnFilters get createdAt => $composableBuilder( + column: $table.createdAt, builder: (column) => i0.ColumnFilters(column)); +} + +class $$TransferRecordsTableOrderingComposer + extends i0.Composer { + $$TransferRecordsTableOrderingComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + i0.ColumnOrderings get id => $composableBuilder( + column: $table.id, builder: (column) => i0.ColumnOrderings(column)); + + i0.ColumnOrderings get uploadId => $composableBuilder( + column: $table.uploadId, builder: (column) => i0.ColumnOrderings(column)); + + i0.ColumnOrderings get objectKey => $composableBuilder( + column: $table.objectKey, + builder: (column) => i0.ColumnOrderings(column)); + + i0.ColumnOrderings get createdAt => $composableBuilder( + column: $table.createdAt, + builder: (column) => i0.ColumnOrderings(column)); +} + +class $$TransferRecordsTableAnnotationComposer + extends i0.Composer { + $$TransferRecordsTableAnnotationComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + i0.GeneratedColumn get id => + $composableBuilder(column: $table.id, builder: (column) => column); + + i0.GeneratedColumn get uploadId => + $composableBuilder(column: $table.uploadId, builder: (column) => column); + + i0.GeneratedColumn get objectKey => + $composableBuilder(column: $table.objectKey, builder: (column) => column); + + i0.GeneratedColumn get createdAt => + $composableBuilder(column: $table.createdAt, builder: (column) => column); +} + +class $$TransferRecordsTableTableManager extends i0.RootTableManager< + i0.GeneratedDatabase, + i1.$TransferRecordsTable, + i1.TransferRecord, + i1.$$TransferRecordsTableFilterComposer, + i1.$$TransferRecordsTableOrderingComposer, + i1.$$TransferRecordsTableAnnotationComposer, + $$TransferRecordsTableCreateCompanionBuilder, + $$TransferRecordsTableUpdateCompanionBuilder, + ( + i1.TransferRecord, + i0.BaseReferences + ), + i1.TransferRecord, + i0.PrefetchHooks Function()> { + $$TransferRecordsTableTableManager( + i0.GeneratedDatabase db, i1.$TransferRecordsTable table) + : super(i0.TableManagerState( + db: db, + table: table, + createFilteringComposer: () => + i1.$$TransferRecordsTableFilterComposer($db: db, $table: table), + createOrderingComposer: () => + i1.$$TransferRecordsTableOrderingComposer($db: db, $table: table), + createComputedFieldComposer: () => i1 + .$$TransferRecordsTableAnnotationComposer($db: db, $table: table), + updateCompanionCallback: ({ + i0.Value id = const i0.Value.absent(), + i0.Value uploadId = const i0.Value.absent(), + i0.Value objectKey = const i0.Value.absent(), + i0.Value createdAt = const i0.Value.absent(), + }) => + i1.TransferRecordsCompanion( + id: id, + uploadId: uploadId, + objectKey: objectKey, + createdAt: createdAt, + ), + createCompanionCallback: ({ + i0.Value id = const i0.Value.absent(), + required String uploadId, + required String objectKey, + required String createdAt, + }) => + i1.TransferRecordsCompanion.insert( + id: id, + uploadId: uploadId, + objectKey: objectKey, + createdAt: createdAt, + ), + withReferenceMapper: (p0) => p0 + .map((e) => (e.readTable(table), i0.BaseReferences(db, table, e))) + .toList(), + prefetchHooksCallback: null, + )); +} + +typedef $$TransferRecordsTableProcessedTableManager = i0.ProcessedTableManager< + i0.GeneratedDatabase, + i1.$TransferRecordsTable, + i1.TransferRecord, + i1.$$TransferRecordsTableFilterComposer, + i1.$$TransferRecordsTableOrderingComposer, + i1.$$TransferRecordsTableAnnotationComposer, + $$TransferRecordsTableCreateCompanionBuilder, + $$TransferRecordsTableUpdateCompanionBuilder, + ( + i1.TransferRecord, + i0.BaseReferences + ), + i1.TransferRecord, + i0.PrefetchHooks Function()>; + class $TransferRecordsTable extends i2.TransferRecords with i0.TableInfo<$TransferRecordsTable, i1.TransferRecord> { @override @@ -164,6 +323,15 @@ class TransferRecord extends i0.DataClass objectKey: objectKey ?? this.objectKey, createdAt: createdAt ?? this.createdAt, ); + TransferRecord copyWithCompanion(i1.TransferRecordsCompanion data) { + return TransferRecord( + id: data.id.present ? data.id.value : this.id, + uploadId: data.uploadId.present ? data.uploadId.value : this.uploadId, + objectKey: data.objectKey.present ? data.objectKey.value : this.objectKey, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + ); + } + @override String toString() { return (StringBuffer('TransferRecord(') @@ -262,126 +430,3 @@ class TransferRecordsCompanion extends i0.UpdateCompanion { .toString(); } } - -typedef $$TransferRecordsTableInsertCompanionBuilder - = i1.TransferRecordsCompanion Function({ - i0.Value id, - required String uploadId, - required String objectKey, - required String createdAt, -}); -typedef $$TransferRecordsTableUpdateCompanionBuilder - = i1.TransferRecordsCompanion Function({ - i0.Value id, - i0.Value uploadId, - i0.Value objectKey, - i0.Value createdAt, -}); - -class $$TransferRecordsTableTableManager extends i0.RootTableManager< - i0.GeneratedDatabase, - i1.$TransferRecordsTable, - i1.TransferRecord, - i1.$$TransferRecordsTableFilterComposer, - i1.$$TransferRecordsTableOrderingComposer, - $$TransferRecordsTableProcessedTableManager, - $$TransferRecordsTableInsertCompanionBuilder, - $$TransferRecordsTableUpdateCompanionBuilder> { - $$TransferRecordsTableTableManager( - i0.GeneratedDatabase db, i1.$TransferRecordsTable table) - : super(i0.TableManagerState( - db: db, - table: table, - filteringComposer: i1.$$TransferRecordsTableFilterComposer( - i0.ComposerState(db, table)), - orderingComposer: i1.$$TransferRecordsTableOrderingComposer( - i0.ComposerState(db, table)), - getChildManagerBuilder: (p) => - $$TransferRecordsTableProcessedTableManager(p), - getUpdateCompanionBuilder: ({ - i0.Value id = const i0.Value.absent(), - i0.Value uploadId = const i0.Value.absent(), - i0.Value objectKey = const i0.Value.absent(), - i0.Value createdAt = const i0.Value.absent(), - }) => - i1.TransferRecordsCompanion( - id: id, - uploadId: uploadId, - objectKey: objectKey, - createdAt: createdAt, - ), - getInsertCompanionBuilder: ({ - i0.Value id = const i0.Value.absent(), - required String uploadId, - required String objectKey, - required String createdAt, - }) => - i1.TransferRecordsCompanion.insert( - id: id, - uploadId: uploadId, - objectKey: objectKey, - createdAt: createdAt, - ), - )); -} - -class $$TransferRecordsTableProcessedTableManager - extends i0.ProcessedTableManager< - i0.GeneratedDatabase, - i1.$TransferRecordsTable, - i1.TransferRecord, - i1.$$TransferRecordsTableFilterComposer, - i1.$$TransferRecordsTableOrderingComposer, - $$TransferRecordsTableProcessedTableManager, - $$TransferRecordsTableInsertCompanionBuilder, - $$TransferRecordsTableUpdateCompanionBuilder> { - $$TransferRecordsTableProcessedTableManager(super.$state); -} - -class $$TransferRecordsTableFilterComposer - extends i0.FilterComposer { - $$TransferRecordsTableFilterComposer(super.$state); - i0.ColumnFilters get id => $state.composableBuilder( - column: $state.table.id, - builder: (column, joinBuilders) => - i0.ColumnFilters(column, joinBuilders: joinBuilders)); - - i0.ColumnFilters get uploadId => $state.composableBuilder( - column: $state.table.uploadId, - builder: (column, joinBuilders) => - i0.ColumnFilters(column, joinBuilders: joinBuilders)); - - i0.ColumnFilters get objectKey => $state.composableBuilder( - column: $state.table.objectKey, - builder: (column, joinBuilders) => - i0.ColumnFilters(column, joinBuilders: joinBuilders)); - - i0.ColumnFilters get createdAt => $state.composableBuilder( - column: $state.table.createdAt, - builder: (column, joinBuilders) => - i0.ColumnFilters(column, joinBuilders: joinBuilders)); -} - -class $$TransferRecordsTableOrderingComposer extends i0 - .OrderingComposer { - $$TransferRecordsTableOrderingComposer(super.$state); - i0.ColumnOrderings get id => $state.composableBuilder( - column: $state.table.id, - builder: (column, joinBuilders) => - i0.ColumnOrderings(column, joinBuilders: joinBuilders)); - - i0.ColumnOrderings get uploadId => $state.composableBuilder( - column: $state.table.uploadId, - builder: (column, joinBuilders) => - i0.ColumnOrderings(column, joinBuilders: joinBuilders)); - - i0.ColumnOrderings get objectKey => $state.composableBuilder( - column: $state.table.objectKey, - builder: (column, joinBuilders) => - i0.ColumnOrderings(column, joinBuilders: joinBuilders)); - - i0.ColumnOrderings get createdAt => $state.composableBuilder( - column: $state.table.createdAt, - builder: (column, joinBuilders) => - i0.ColumnOrderings(column, joinBuilders: joinBuilders)); -} diff --git a/packages/test/pub_server/lib/src/database.g.dart b/packages/test/pub_server/lib/src/database.g.dart index 6387001704..09672a7945 100644 --- a/packages/test/pub_server/lib/src/database.g.dart +++ b/packages/test/pub_server/lib/src/database.g.dart @@ -104,6 +104,13 @@ class Package extends DataClass implements Insertable { name: name ?? this.name, latest: latest ?? this.latest, ); + Package copyWithCompanion(PackagesCompanion data) { + return Package( + name: data.name.present ? data.name.value : this.name, + latest: data.latest.present ? data.latest.value : this.latest, + ); + } + @override String toString() { return (StringBuffer('Package(') @@ -406,6 +413,19 @@ class PackageVersion extends DataClass implements Insertable { changelog: changelog ?? this.changelog, published: published ?? this.published, ); + PackageVersion copyWithCompanion(PackageVersionsCompanion data) { + return PackageVersion( + package: data.package.present ? data.package.value : this.package, + version: data.version.present ? data.version.value : this.version, + archiveUrl: + data.archiveUrl.present ? data.archiveUrl.value : this.archiveUrl, + pubspec: data.pubspec.present ? data.pubspec.value : this.pubspec, + readme: data.readme.present ? data.readme.value : this.readme, + changelog: data.changelog.present ? data.changelog.value : this.changelog, + published: data.published.present ? data.published.value : this.published, + ); + } + @override String toString() { return (StringBuffer('PackageVersion(') @@ -562,7 +582,7 @@ class PackageVersionsCompanion extends UpdateCompanion { abstract class _$PubDatabase extends GeneratedDatabase { _$PubDatabase(QueryExecutor e) : super(e); - _$PubDatabaseManager get managers => _$PubDatabaseManager(this); + $PubDatabaseManager get managers => $PubDatabaseManager(this); late final $PackagesTable packages = $PackagesTable(this); late final $PackageVersionsTable packageVersions = $PackageVersionsTable(this); @@ -574,7 +594,7 @@ abstract class _$PubDatabase extends GeneratedDatabase { [packages, packageVersions]; } -typedef $$PackagesTableInsertCompanionBuilder = PackagesCompanion Function({ +typedef $$PackagesTableCreateCompanionBuilder = PackagesCompanion Function({ required String name, required String latest, Value rowid, @@ -585,26 +605,77 @@ typedef $$PackagesTableUpdateCompanionBuilder = PackagesCompanion Function({ Value rowid, }); +class $$PackagesTableFilterComposer + extends Composer<_$PubDatabase, $PackagesTable> { + $$PackagesTableFilterComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + ColumnFilters get name => $composableBuilder( + column: $table.name, builder: (column) => ColumnFilters(column)); + + ColumnFilters get latest => $composableBuilder( + column: $table.latest, builder: (column) => ColumnFilters(column)); +} + +class $$PackagesTableOrderingComposer + extends Composer<_$PubDatabase, $PackagesTable> { + $$PackagesTableOrderingComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + ColumnOrderings get name => $composableBuilder( + column: $table.name, builder: (column) => ColumnOrderings(column)); + + ColumnOrderings get latest => $composableBuilder( + column: $table.latest, builder: (column) => ColumnOrderings(column)); +} + +class $$PackagesTableAnnotationComposer + extends Composer<_$PubDatabase, $PackagesTable> { + $$PackagesTableAnnotationComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + GeneratedColumn get name => + $composableBuilder(column: $table.name, builder: (column) => column); + + GeneratedColumn get latest => + $composableBuilder(column: $table.latest, builder: (column) => column); +} + class $$PackagesTableTableManager extends RootTableManager< _$PubDatabase, $PackagesTable, Package, $$PackagesTableFilterComposer, $$PackagesTableOrderingComposer, - $$PackagesTableProcessedTableManager, - $$PackagesTableInsertCompanionBuilder, - $$PackagesTableUpdateCompanionBuilder> { + $$PackagesTableAnnotationComposer, + $$PackagesTableCreateCompanionBuilder, + $$PackagesTableUpdateCompanionBuilder, + (Package, BaseReferences<_$PubDatabase, $PackagesTable, Package>), + Package, + PrefetchHooks Function()> { $$PackagesTableTableManager(_$PubDatabase db, $PackagesTable table) : super(TableManagerState( db: db, table: table, - filteringComposer: - $$PackagesTableFilterComposer(ComposerState(db, table)), - orderingComposer: - $$PackagesTableOrderingComposer(ComposerState(db, table)), - getChildManagerBuilder: (p) => - $$PackagesTableProcessedTableManager(p), - getUpdateCompanionBuilder: ({ + createFilteringComposer: () => + $$PackagesTableFilterComposer($db: db, $table: table), + createOrderingComposer: () => + $$PackagesTableOrderingComposer($db: db, $table: table), + createComputedFieldComposer: () => + $$PackagesTableAnnotationComposer($db: db, $table: table), + updateCompanionCallback: ({ Value name = const Value.absent(), Value latest = const Value.absent(), Value rowid = const Value.absent(), @@ -614,7 +685,7 @@ class $$PackagesTableTableManager extends RootTableManager< latest: latest, rowid: rowid, ), - getInsertCompanionBuilder: ({ + createCompanionCallback: ({ required String name, required String latest, Value rowid = const Value.absent(), @@ -624,50 +695,26 @@ class $$PackagesTableTableManager extends RootTableManager< latest: latest, rowid: rowid, ), + withReferenceMapper: (p0) => p0 + .map((e) => (e.readTable(table), BaseReferences(db, table, e))) + .toList(), + prefetchHooksCallback: null, )); } -class $$PackagesTableProcessedTableManager extends ProcessedTableManager< +typedef $$PackagesTableProcessedTableManager = ProcessedTableManager< _$PubDatabase, $PackagesTable, Package, $$PackagesTableFilterComposer, $$PackagesTableOrderingComposer, - $$PackagesTableProcessedTableManager, - $$PackagesTableInsertCompanionBuilder, - $$PackagesTableUpdateCompanionBuilder> { - $$PackagesTableProcessedTableManager(super.$state); -} - -class $$PackagesTableFilterComposer - extends FilterComposer<_$PubDatabase, $PackagesTable> { - $$PackagesTableFilterComposer(super.$state); - ColumnFilters get name => $state.composableBuilder( - column: $state.table.name, - builder: (column, joinBuilders) => - ColumnFilters(column, joinBuilders: joinBuilders)); - - ColumnFilters get latest => $state.composableBuilder( - column: $state.table.latest, - builder: (column, joinBuilders) => - ColumnFilters(column, joinBuilders: joinBuilders)); -} - -class $$PackagesTableOrderingComposer - extends OrderingComposer<_$PubDatabase, $PackagesTable> { - $$PackagesTableOrderingComposer(super.$state); - ColumnOrderings get name => $state.composableBuilder( - column: $state.table.name, - builder: (column, joinBuilders) => - ColumnOrderings(column, joinBuilders: joinBuilders)); - - ColumnOrderings get latest => $state.composableBuilder( - column: $state.table.latest, - builder: (column, joinBuilders) => - ColumnOrderings(column, joinBuilders: joinBuilders)); -} - -typedef $$PackageVersionsTableInsertCompanionBuilder = PackageVersionsCompanion + $$PackagesTableAnnotationComposer, + $$PackagesTableCreateCompanionBuilder, + $$PackagesTableUpdateCompanionBuilder, + (Package, BaseReferences<_$PubDatabase, $PackagesTable, Package>), + Package, + PrefetchHooks Function()>; +typedef $$PackageVersionsTableCreateCompanionBuilder = PackageVersionsCompanion Function({ required String package, required String version, @@ -690,27 +737,126 @@ typedef $$PackageVersionsTableUpdateCompanionBuilder = PackageVersionsCompanion Value rowid, }); +class $$PackageVersionsTableFilterComposer + extends Composer<_$PubDatabase, $PackageVersionsTable> { + $$PackageVersionsTableFilterComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + ColumnFilters get package => $composableBuilder( + column: $table.package, builder: (column) => ColumnFilters(column)); + + ColumnFilters get version => $composableBuilder( + column: $table.version, builder: (column) => ColumnFilters(column)); + + ColumnFilters get archiveUrl => $composableBuilder( + column: $table.archiveUrl, builder: (column) => ColumnFilters(column)); + + ColumnFilters get pubspec => $composableBuilder( + column: $table.pubspec, builder: (column) => ColumnFilters(column)); + + ColumnFilters get readme => $composableBuilder( + column: $table.readme, builder: (column) => ColumnFilters(column)); + + ColumnFilters get changelog => $composableBuilder( + column: $table.changelog, builder: (column) => ColumnFilters(column)); + + ColumnFilters get published => $composableBuilder( + column: $table.published, builder: (column) => ColumnFilters(column)); +} + +class $$PackageVersionsTableOrderingComposer + extends Composer<_$PubDatabase, $PackageVersionsTable> { + $$PackageVersionsTableOrderingComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + ColumnOrderings get package => $composableBuilder( + column: $table.package, builder: (column) => ColumnOrderings(column)); + + ColumnOrderings get version => $composableBuilder( + column: $table.version, builder: (column) => ColumnOrderings(column)); + + ColumnOrderings get archiveUrl => $composableBuilder( + column: $table.archiveUrl, builder: (column) => ColumnOrderings(column)); + + ColumnOrderings get pubspec => $composableBuilder( + column: $table.pubspec, builder: (column) => ColumnOrderings(column)); + + ColumnOrderings get readme => $composableBuilder( + column: $table.readme, builder: (column) => ColumnOrderings(column)); + + ColumnOrderings get changelog => $composableBuilder( + column: $table.changelog, builder: (column) => ColumnOrderings(column)); + + ColumnOrderings get published => $composableBuilder( + column: $table.published, builder: (column) => ColumnOrderings(column)); +} + +class $$PackageVersionsTableAnnotationComposer + extends Composer<_$PubDatabase, $PackageVersionsTable> { + $$PackageVersionsTableAnnotationComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + GeneratedColumn get package => + $composableBuilder(column: $table.package, builder: (column) => column); + + GeneratedColumn get version => + $composableBuilder(column: $table.version, builder: (column) => column); + + GeneratedColumn get archiveUrl => $composableBuilder( + column: $table.archiveUrl, builder: (column) => column); + + GeneratedColumn get pubspec => + $composableBuilder(column: $table.pubspec, builder: (column) => column); + + GeneratedColumn get readme => + $composableBuilder(column: $table.readme, builder: (column) => column); + + GeneratedColumn get changelog => + $composableBuilder(column: $table.changelog, builder: (column) => column); + + GeneratedColumn get published => + $composableBuilder(column: $table.published, builder: (column) => column); +} + class $$PackageVersionsTableTableManager extends RootTableManager< _$PubDatabase, $PackageVersionsTable, PackageVersion, $$PackageVersionsTableFilterComposer, $$PackageVersionsTableOrderingComposer, - $$PackageVersionsTableProcessedTableManager, - $$PackageVersionsTableInsertCompanionBuilder, - $$PackageVersionsTableUpdateCompanionBuilder> { + $$PackageVersionsTableAnnotationComposer, + $$PackageVersionsTableCreateCompanionBuilder, + $$PackageVersionsTableUpdateCompanionBuilder, + ( + PackageVersion, + BaseReferences<_$PubDatabase, $PackageVersionsTable, PackageVersion> + ), + PackageVersion, + PrefetchHooks Function()> { $$PackageVersionsTableTableManager( _$PubDatabase db, $PackageVersionsTable table) : super(TableManagerState( db: db, table: table, - filteringComposer: - $$PackageVersionsTableFilterComposer(ComposerState(db, table)), - orderingComposer: - $$PackageVersionsTableOrderingComposer(ComposerState(db, table)), - getChildManagerBuilder: (p) => - $$PackageVersionsTableProcessedTableManager(p), - getUpdateCompanionBuilder: ({ + createFilteringComposer: () => + $$PackageVersionsTableFilterComposer($db: db, $table: table), + createOrderingComposer: () => + $$PackageVersionsTableOrderingComposer($db: db, $table: table), + createComputedFieldComposer: () => + $$PackageVersionsTableAnnotationComposer($db: db, $table: table), + updateCompanionCallback: ({ Value package = const Value.absent(), Value version = const Value.absent(), Value archiveUrl = const Value.absent(), @@ -730,7 +876,7 @@ class $$PackageVersionsTableTableManager extends RootTableManager< published: published, rowid: rowid, ), - getInsertCompanionBuilder: ({ + createCompanionCallback: ({ required String package, required String version, required String archiveUrl, @@ -750,102 +896,32 @@ class $$PackageVersionsTableTableManager extends RootTableManager< published: published, rowid: rowid, ), + withReferenceMapper: (p0) => p0 + .map((e) => (e.readTable(table), BaseReferences(db, table, e))) + .toList(), + prefetchHooksCallback: null, )); } -class $$PackageVersionsTableProcessedTableManager extends ProcessedTableManager< +typedef $$PackageVersionsTableProcessedTableManager = ProcessedTableManager< _$PubDatabase, $PackageVersionsTable, PackageVersion, $$PackageVersionsTableFilterComposer, $$PackageVersionsTableOrderingComposer, - $$PackageVersionsTableProcessedTableManager, - $$PackageVersionsTableInsertCompanionBuilder, - $$PackageVersionsTableUpdateCompanionBuilder> { - $$PackageVersionsTableProcessedTableManager(super.$state); -} - -class $$PackageVersionsTableFilterComposer - extends FilterComposer<_$PubDatabase, $PackageVersionsTable> { - $$PackageVersionsTableFilterComposer(super.$state); - ColumnFilters get package => $state.composableBuilder( - column: $state.table.package, - builder: (column, joinBuilders) => - ColumnFilters(column, joinBuilders: joinBuilders)); - - ColumnFilters get version => $state.composableBuilder( - column: $state.table.version, - builder: (column, joinBuilders) => - ColumnFilters(column, joinBuilders: joinBuilders)); - - ColumnFilters get archiveUrl => $state.composableBuilder( - column: $state.table.archiveUrl, - builder: (column, joinBuilders) => - ColumnFilters(column, joinBuilders: joinBuilders)); - - ColumnFilters get pubspec => $state.composableBuilder( - column: $state.table.pubspec, - builder: (column, joinBuilders) => - ColumnFilters(column, joinBuilders: joinBuilders)); - - ColumnFilters get readme => $state.composableBuilder( - column: $state.table.readme, - builder: (column, joinBuilders) => - ColumnFilters(column, joinBuilders: joinBuilders)); - - ColumnFilters get changelog => $state.composableBuilder( - column: $state.table.changelog, - builder: (column, joinBuilders) => - ColumnFilters(column, joinBuilders: joinBuilders)); - - ColumnFilters get published => $state.composableBuilder( - column: $state.table.published, - builder: (column, joinBuilders) => - ColumnFilters(column, joinBuilders: joinBuilders)); -} - -class $$PackageVersionsTableOrderingComposer - extends OrderingComposer<_$PubDatabase, $PackageVersionsTable> { - $$PackageVersionsTableOrderingComposer(super.$state); - ColumnOrderings get package => $state.composableBuilder( - column: $state.table.package, - builder: (column, joinBuilders) => - ColumnOrderings(column, joinBuilders: joinBuilders)); - - ColumnOrderings get version => $state.composableBuilder( - column: $state.table.version, - builder: (column, joinBuilders) => - ColumnOrderings(column, joinBuilders: joinBuilders)); - - ColumnOrderings get archiveUrl => $state.composableBuilder( - column: $state.table.archiveUrl, - builder: (column, joinBuilders) => - ColumnOrderings(column, joinBuilders: joinBuilders)); - - ColumnOrderings get pubspec => $state.composableBuilder( - column: $state.table.pubspec, - builder: (column, joinBuilders) => - ColumnOrderings(column, joinBuilders: joinBuilders)); - - ColumnOrderings get readme => $state.composableBuilder( - column: $state.table.readme, - builder: (column, joinBuilders) => - ColumnOrderings(column, joinBuilders: joinBuilders)); - - ColumnOrderings get changelog => $state.composableBuilder( - column: $state.table.changelog, - builder: (column, joinBuilders) => - ColumnOrderings(column, joinBuilders: joinBuilders)); - - ColumnOrderings get published => $state.composableBuilder( - column: $state.table.published, - builder: (column, joinBuilders) => - ColumnOrderings(column, joinBuilders: joinBuilders)); -} + $$PackageVersionsTableAnnotationComposer, + $$PackageVersionsTableCreateCompanionBuilder, + $$PackageVersionsTableUpdateCompanionBuilder, + ( + PackageVersion, + BaseReferences<_$PubDatabase, $PackageVersionsTable, PackageVersion> + ), + PackageVersion, + PrefetchHooks Function()>; -class _$PubDatabaseManager { +class $PubDatabaseManager { final _$PubDatabase _db; - _$PubDatabaseManager(this._db); + $PubDatabaseManager(this._db); $$PackagesTableTableManager get packages => $$PackagesTableTableManager(_db, _db.packages); $$PackageVersionsTableTableManager get packageVersions => From 69c359e103e4faa257869f18d65ee99fbed15e1d Mon Sep 17 00:00:00 2001 From: Tyler-Larkin Date: Sun, 1 Dec 2024 18:04:39 -0800 Subject: [PATCH 04/11] chore(): Updated Dart SDK to 3.4.0 --- actions/pubspec.yaml | 2 +- canaries/pubspec.yaml | 2 +- infra-gen2/pubspec.yaml | 2 +- infra/pubspec.yaml | 2 +- packages/aft/pubspec.yaml | 2 +- packages/amplify/amplify_flutter/example/pubspec.yaml | 2 +- packages/amplify/amplify_flutter/pubspec.yaml | 2 +- packages/amplify_core/doc/pubspec.yaml | 2 +- packages/amplify_core/pubspec.yaml | 2 +- packages/amplify_datastore/example/pubspec.yaml | 2 +- packages/amplify_datastore/pubspec.yaml | 2 +- packages/amplify_datastore_plugin_interface/pubspec.yaml | 2 +- packages/amplify_lints/pubspec.yaml | 2 +- packages/amplify_native_legacy_wrapper/example/pubspec.yaml | 2 +- packages/amplify_native_legacy_wrapper/pubspec.yaml | 2 +- .../analytics/amplify_analytics_pinpoint/example/pubspec.yaml | 2 +- packages/analytics/amplify_analytics_pinpoint/pubspec.yaml | 2 +- packages/analytics/amplify_analytics_pinpoint_dart/pubspec.yaml | 2 +- packages/api/amplify_api/example/pubspec.yaml | 2 +- packages/api/amplify_api/pubspec.yaml | 2 +- packages/api/amplify_api_dart/pubspec.yaml | 2 +- packages/auth/amplify_auth_cognito/example/pubspec.yaml | 2 +- packages/auth/amplify_auth_cognito/pubspec.yaml | 2 +- packages/auth/amplify_auth_cognito_dart/example/pubspec.yaml | 2 +- packages/auth/amplify_auth_cognito_dart/pubspec.yaml | 2 +- packages/auth/amplify_auth_cognito_test/pubspec.yaml | 2 +- .../authenticator/amplify_authenticator/example/pubspec.yaml | 2 +- packages/authenticator/amplify_authenticator/pubspec.yaml | 2 +- .../amplify_authenticator_test/example/pubspec.yaml | 2 +- packages/authenticator/amplify_authenticator_test/pubspec.yaml | 2 +- packages/aws_common/pubspec.yaml | 2 +- packages/aws_signature_v4/example/pubspec.yaml | 2 +- packages/aws_signature_v4/pubspec.yaml | 2 +- packages/common/amplify_db_common/example/pubspec.yaml | 2 +- packages/common/amplify_db_common/pubspec.yaml | 2 +- packages/common/amplify_db_common_dart/example/pubspec.yaml | 2 +- packages/common/amplify_db_common_dart/pubspec.yaml | 2 +- packages/example_common/example/pubspec.yaml | 2 +- packages/example_common/pubspec.yaml | 2 +- .../push/amplify_push_notifications/example/pubspec.yaml | 2 +- .../notifications/push/amplify_push_notifications/pubspec.yaml | 2 +- .../amplify_push_notifications_pinpoint/example/pubspec.yaml | 2 +- .../push/amplify_push_notifications_pinpoint/pubspec.yaml | 2 +- .../secure_storage/amplify_secure_storage/example/pubspec.yaml | 2 +- packages/secure_storage/amplify_secure_storage/pubspec.yaml | 2 +- .../amplify_secure_storage_dart/example/pubspec.yaml | 2 +- .../secure_storage/amplify_secure_storage_dart/pubspec.yaml | 2 +- .../secure_storage/amplify_secure_storage_test/pubspec.yaml | 2 +- packages/smithy/goldens/lib/awsJson1_0/pubspec.yaml | 2 +- packages/smithy/goldens/lib/awsJson1_1/pubspec.yaml | 2 +- packages/smithy/goldens/lib/awsQuery/pubspec.yaml | 2 +- packages/smithy/goldens/lib/ec2Query/pubspec.yaml | 2 +- packages/smithy/goldens/lib/restJson1/pubspec.yaml | 2 +- packages/smithy/goldens/lib/restXml/pubspec.yaml | 2 +- packages/smithy/goldens/lib/restXmlWithNamespace/pubspec.yaml | 2 +- packages/smithy/goldens/lib2/awsJson1_0/pubspec.yaml | 2 +- packages/smithy/goldens/lib2/awsJson1_1/pubspec.yaml | 2 +- packages/smithy/goldens/lib2/awsQuery/pubspec.yaml | 2 +- packages/smithy/goldens/lib2/custom/pubspec.yaml | 2 +- packages/smithy/goldens/lib2/ec2Query/pubspec.yaml | 2 +- packages/smithy/goldens/lib2/restJson1/pubspec.yaml | 2 +- packages/smithy/goldens/lib2/restXml/pubspec.yaml | 2 +- packages/smithy/goldens/lib2/restXmlWithNamespace/pubspec.yaml | 2 +- packages/smithy/goldens/pubspec.yaml | 2 +- packages/smithy/smithy/pubspec.yaml | 2 +- packages/smithy/smithy_aws/pubspec.yaml | 2 +- packages/smithy/smithy_codegen/pubspec.yaml | 2 +- packages/smithy/smithy_test/pubspec.yaml | 2 +- packages/storage/amplify_storage_s3/example/pubspec.yaml | 2 +- packages/storage/amplify_storage_s3/pubspec.yaml | 2 +- packages/storage/amplify_storage_s3_dart/example/pubspec.yaml | 2 +- packages/storage/amplify_storage_s3_dart/pubspec.yaml | 2 +- packages/test/amplify_auth_integration_test/pubspec.yaml | 2 +- packages/test/amplify_integration_test/pubspec.yaml | 2 +- packages/test/amplify_test/pubspec.yaml | 2 +- packages/test/pub_server/pubspec.yaml | 2 +- packages/worker_bee/e2e/pubspec.yaml | 2 +- packages/worker_bee/e2e_flutter_test/pubspec.yaml | 2 +- packages/worker_bee/e2e_test/pubspec.yaml | 2 +- packages/worker_bee/worker_bee/pubspec.yaml | 2 +- packages/worker_bee/worker_bee_builder/pubspec.yaml | 2 +- pubspec.yaml | 2 +- templates/dart-package/hooks/pubspec.yaml | 2 +- templates/flutter-package/hooks/pubspec.yaml | 2 +- 84 files changed, 84 insertions(+), 84 deletions(-) diff --git a/actions/pubspec.yaml b/actions/pubspec.yaml index f4b560a372..724d4d02e7 100644 --- a/actions/pubspec.yaml +++ b/actions/pubspec.yaml @@ -4,7 +4,7 @@ version: 1.0.0 publish_to: none environment: - sdk: ^3.3.0 + sdk: ^3.4.0 dependencies: aws_common: ^0.6.1 diff --git a/canaries/pubspec.yaml b/canaries/pubspec.yaml index ef6d237fa9..5ba604736a 100644 --- a/canaries/pubspec.yaml +++ b/canaries/pubspec.yaml @@ -2,7 +2,7 @@ name: amplified_todo publish_to: none environment: - sdk: ^3.3.0 + sdk: ^3.4.0 flutter: ">=3.19.0" dependencies: diff --git a/infra-gen2/pubspec.yaml b/infra-gen2/pubspec.yaml index ec07ffb1ce..39c0ddf08f 100644 --- a/infra-gen2/pubspec.yaml +++ b/infra-gen2/pubspec.yaml @@ -2,7 +2,7 @@ name: infra_gen2 publish_to: none environment: - sdk: ^3.3.0 + sdk: ^3.4.0 dependencies: amplify_core: any diff --git a/infra/pubspec.yaml b/infra/pubspec.yaml index 64ebda6602..dc1306338e 100644 --- a/infra/pubspec.yaml +++ b/infra/pubspec.yaml @@ -2,7 +2,7 @@ name: infra publish_to: none environment: - sdk: ^3.3.0 + sdk: ^3.4.0 dependencies: amplify_core: any diff --git a/packages/aft/pubspec.yaml b/packages/aft/pubspec.yaml index e1198cc79c..dacc48d92e 100644 --- a/packages/aft/pubspec.yaml +++ b/packages/aft/pubspec.yaml @@ -4,7 +4,7 @@ version: 0.1.1 publish_to: none environment: - sdk: ^3.3.0 + sdk: ^3.4.0 dependencies: args: ^2.3.0 diff --git a/packages/amplify/amplify_flutter/example/pubspec.yaml b/packages/amplify/amplify_flutter/example/pubspec.yaml index 9b7a8cdc9e..4071afec47 100644 --- a/packages/amplify/amplify_flutter/example/pubspec.yaml +++ b/packages/amplify/amplify_flutter/example/pubspec.yaml @@ -4,7 +4,7 @@ publish_to: none environment: flutter: ">=3.19.0" - sdk: ^3.3.0 + sdk: ^3.4.0 dependencies: amplify_analytics_pinpoint: ">=1.0.0-next.8 <1.0.0-next.9" diff --git a/packages/amplify/amplify_flutter/pubspec.yaml b/packages/amplify/amplify_flutter/pubspec.yaml index 8d7064ccad..9338feac2a 100644 --- a/packages/amplify/amplify_flutter/pubspec.yaml +++ b/packages/amplify/amplify_flutter/pubspec.yaml @@ -6,7 +6,7 @@ repository: https://github.com/aws-amplify/amplify-flutter/tree/main/packages/am issue_tracker: https://github.com/aws-amplify/amplify-flutter/issues environment: - sdk: ^3.3.0 + sdk: ^3.4.0 flutter: ">=3.19.0" # Helps `pana` since we do not use Flutter plugins for most platforms diff --git a/packages/amplify_core/doc/pubspec.yaml b/packages/amplify_core/doc/pubspec.yaml index 976fc1dd59..812eac231c 100644 --- a/packages/amplify_core/doc/pubspec.yaml +++ b/packages/amplify_core/doc/pubspec.yaml @@ -7,7 +7,7 @@ issue_tracker: https://github.com/aws-amplify/amplify-flutter/issues publish_to: none environment: - sdk: ^3.3.0 + sdk: ^3.4.0 flutter: ">=3.19.0" dependencies: diff --git a/packages/amplify_core/pubspec.yaml b/packages/amplify_core/pubspec.yaml index 66e8e537c6..00483ae16d 100644 --- a/packages/amplify_core/pubspec.yaml +++ b/packages/amplify_core/pubspec.yaml @@ -6,7 +6,7 @@ repository: https://github.com/aws-amplify/amplify-flutter/tree/main/packages/am issue_tracker: https://github.com/aws-amplify/amplify-flutter/issues environment: - sdk: ^3.3.0 + sdk: ^3.4.0 dependencies: async: ^2.10.0 diff --git a/packages/amplify_datastore/example/pubspec.yaml b/packages/amplify_datastore/example/pubspec.yaml index bbfd9f218b..97e004e8cd 100644 --- a/packages/amplify_datastore/example/pubspec.yaml +++ b/packages/amplify_datastore/example/pubspec.yaml @@ -6,7 +6,7 @@ description: Demonstrates how to use the amplify_datastore plugin. publish_to: "none" # Remove this line if you wish to publish to pub.dev environment: - sdk: ^3.3.0 + sdk: ^3.4.0 flutter: ">=3.19.0" dependencies: diff --git a/packages/amplify_datastore/pubspec.yaml b/packages/amplify_datastore/pubspec.yaml index 725360770d..a942d1aa7b 100644 --- a/packages/amplify_datastore/pubspec.yaml +++ b/packages/amplify_datastore/pubspec.yaml @@ -6,7 +6,7 @@ repository: https://github.com/aws-amplify/amplify-flutter/tree/main/packages/am issue_tracker: https://github.com/aws-amplify/amplify-flutter/issues environment: - sdk: ^3.3.0 + sdk: ^3.4.0 flutter: ">=3.19.0" dependencies: diff --git a/packages/amplify_datastore_plugin_interface/pubspec.yaml b/packages/amplify_datastore_plugin_interface/pubspec.yaml index dfceee6803..da9e16493e 100644 --- a/packages/amplify_datastore_plugin_interface/pubspec.yaml +++ b/packages/amplify_datastore_plugin_interface/pubspec.yaml @@ -6,7 +6,7 @@ repository: https://github.com/aws-amplify/amplify-flutter/tree/main/packages/am issue_tracker: https://github.com/aws-amplify/amplify-flutter/issues environment: - sdk: ^3.3.0 + sdk: ^3.4.0 flutter: ">=3.19.0" dependencies: diff --git a/packages/amplify_lints/pubspec.yaml b/packages/amplify_lints/pubspec.yaml index 01d83766c0..76200df6c0 100644 --- a/packages/amplify_lints/pubspec.yaml +++ b/packages/amplify_lints/pubspec.yaml @@ -6,7 +6,7 @@ repository: https://github.com/aws-amplify/amplify-flutter/tree/main/packages/am issue_tracker: https://github.com/aws-amplify/amplify-flutter/issues environment: - sdk: ^3.3.0 + sdk: ^3.4.0 dependencies: flutter_lints: ^3.0.0 diff --git a/packages/amplify_native_legacy_wrapper/example/pubspec.yaml b/packages/amplify_native_legacy_wrapper/example/pubspec.yaml index 7a3d57263d..0fb7618141 100644 --- a/packages/amplify_native_legacy_wrapper/example/pubspec.yaml +++ b/packages/amplify_native_legacy_wrapper/example/pubspec.yaml @@ -4,7 +4,7 @@ version: 0.1.0 publish_to: "none" environment: - sdk: ^3.3.0 + sdk: ^3.4.0 flutter: ">=3.19.0" dependencies: diff --git a/packages/amplify_native_legacy_wrapper/pubspec.yaml b/packages/amplify_native_legacy_wrapper/pubspec.yaml index 65d7dd62db..10c4a05556 100644 --- a/packages/amplify_native_legacy_wrapper/pubspec.yaml +++ b/packages/amplify_native_legacy_wrapper/pubspec.yaml @@ -4,7 +4,7 @@ version: 0.0.1 publish_to: none environment: - sdk: ^3.3.0 + sdk: ^3.4.0 flutter: ">=3.19.0" dependencies: diff --git a/packages/analytics/amplify_analytics_pinpoint/example/pubspec.yaml b/packages/analytics/amplify_analytics_pinpoint/example/pubspec.yaml index a1954ecb47..c9e447ae5b 100644 --- a/packages/analytics/amplify_analytics_pinpoint/example/pubspec.yaml +++ b/packages/analytics/amplify_analytics_pinpoint/example/pubspec.yaml @@ -7,7 +7,7 @@ version: 0.1.0 publish_to: "none" # Remove this line if you wish to publish to pub.dev environment: - sdk: ^3.3.0 + sdk: ^3.4.0 flutter: ">=3.19.0" dependencies: diff --git a/packages/analytics/amplify_analytics_pinpoint/pubspec.yaml b/packages/analytics/amplify_analytics_pinpoint/pubspec.yaml index 2ba1ce2f3c..07f08593b8 100644 --- a/packages/analytics/amplify_analytics_pinpoint/pubspec.yaml +++ b/packages/analytics/amplify_analytics_pinpoint/pubspec.yaml @@ -6,7 +6,7 @@ repository: https://github.com/aws-amplify/amplify-flutter/tree/main/packages/an issue_tracker: https://github.com/aws-amplify/amplify-flutter/issues environment: - sdk: ^3.3.0 + sdk: ^3.4.0 flutter: ">=3.19.0" # Helps `pana` since we do not use Flutter plugins for most platforms diff --git a/packages/analytics/amplify_analytics_pinpoint_dart/pubspec.yaml b/packages/analytics/amplify_analytics_pinpoint_dart/pubspec.yaml index 0f4a774436..f02bd6c0ab 100644 --- a/packages/analytics/amplify_analytics_pinpoint_dart/pubspec.yaml +++ b/packages/analytics/amplify_analytics_pinpoint_dart/pubspec.yaml @@ -6,7 +6,7 @@ repository: https://github.com/aws-amplify/amplify-flutter/tree/main/packages/an issue_tracker: https://github.com/aws-amplify/amplify-flutter/issues environment: - sdk: ^3.3.0 + sdk: ^3.4.0 dependencies: amplify_core: ">=2.5.0 <2.6.0" diff --git a/packages/api/amplify_api/example/pubspec.yaml b/packages/api/amplify_api/example/pubspec.yaml index 1137e6ed07..6bf16de029 100644 --- a/packages/api/amplify_api/example/pubspec.yaml +++ b/packages/api/amplify_api/example/pubspec.yaml @@ -6,7 +6,7 @@ description: Demonstrates how to use the amplify_api plugin. publish_to: "none" # Remove this line if you wish to publish to pub.dev environment: - sdk: ^3.3.0 + sdk: ^3.4.0 flutter: ">=3.19.0" dependencies: diff --git a/packages/api/amplify_api/pubspec.yaml b/packages/api/amplify_api/pubspec.yaml index 2125cf6a54..fb4b1899c4 100644 --- a/packages/api/amplify_api/pubspec.yaml +++ b/packages/api/amplify_api/pubspec.yaml @@ -6,7 +6,7 @@ repository: https://github.com/aws-amplify/amplify-flutter/tree/main/packages/ap issue_tracker: https://github.com/aws-amplify/amplify-flutter/issues environment: - sdk: ^3.3.0 + sdk: ^3.4.0 flutter: ">=3.19.0" # Helps `pana` since we do not use Flutter plugins for most platforms diff --git a/packages/api/amplify_api_dart/pubspec.yaml b/packages/api/amplify_api_dart/pubspec.yaml index 43ff663a6b..57563b6956 100644 --- a/packages/api/amplify_api_dart/pubspec.yaml +++ b/packages/api/amplify_api_dart/pubspec.yaml @@ -6,7 +6,7 @@ repository: https://github.com/aws-amplify/amplify-flutter/tree/main/packages/ap issue_tracker: https://github.com/aws-amplify/amplify-flutter/issues environment: - sdk: ^3.3.0 + sdk: ^3.4.0 dependencies: amplify_core: ">=2.5.0 <2.6.0" diff --git a/packages/auth/amplify_auth_cognito/example/pubspec.yaml b/packages/auth/amplify_auth_cognito/example/pubspec.yaml index e2da1c1162..6a1c6a6dcd 100644 --- a/packages/auth/amplify_auth_cognito/example/pubspec.yaml +++ b/packages/auth/amplify_auth_cognito/example/pubspec.yaml @@ -4,7 +4,7 @@ version: 0.1.0 publish_to: none environment: - sdk: ^3.3.0 + sdk: ^3.4.0 flutter: ">=3.19.0" dependencies: diff --git a/packages/auth/amplify_auth_cognito/pubspec.yaml b/packages/auth/amplify_auth_cognito/pubspec.yaml index 6a0a6948d7..4f2821e9e1 100644 --- a/packages/auth/amplify_auth_cognito/pubspec.yaml +++ b/packages/auth/amplify_auth_cognito/pubspec.yaml @@ -6,7 +6,7 @@ repository: https://github.com/aws-amplify/amplify-flutter/tree/main/packages/au issue_tracker: https://github.com/aws-amplify/amplify-flutter/issues environment: - sdk: ^3.3.0 + sdk: ^3.4.0 flutter: ">=3.19.0" # Helps `pana` since we do not use Flutter plugins for most platforms diff --git a/packages/auth/amplify_auth_cognito_dart/example/pubspec.yaml b/packages/auth/amplify_auth_cognito_dart/example/pubspec.yaml index 98b9611bce..81fa66937b 100644 --- a/packages/auth/amplify_auth_cognito_dart/example/pubspec.yaml +++ b/packages/auth/amplify_auth_cognito_dart/example/pubspec.yaml @@ -4,7 +4,7 @@ version: 1.0.0 publish_to: none environment: - sdk: ^3.3.0 + sdk: ^3.4.0 dependencies: amplify_auth_cognito_dart: any diff --git a/packages/auth/amplify_auth_cognito_dart/pubspec.yaml b/packages/auth/amplify_auth_cognito_dart/pubspec.yaml index de771d1de6..3c23363328 100644 --- a/packages/auth/amplify_auth_cognito_dart/pubspec.yaml +++ b/packages/auth/amplify_auth_cognito_dart/pubspec.yaml @@ -6,7 +6,7 @@ repository: https://github.com/aws-amplify/amplify-flutter/tree/next/packages/au issue_tracker: https://github.com/aws-amplify/amplify-flutter/issues environment: - sdk: ^3.3.0 + sdk: ^3.4.0 dependencies: amplify_analytics_pinpoint_dart: ">=0.4.6 <0.5.0" diff --git a/packages/auth/amplify_auth_cognito_test/pubspec.yaml b/packages/auth/amplify_auth_cognito_test/pubspec.yaml index 39d313e991..be25f0589f 100644 --- a/packages/auth/amplify_auth_cognito_test/pubspec.yaml +++ b/packages/auth/amplify_auth_cognito_test/pubspec.yaml @@ -3,7 +3,7 @@ description: Tests for the amplify_auth_cognito_dart package. publish_to: none environment: - sdk: ^3.3.0 + sdk: ^3.4.0 dependencies: amplify_analytics_pinpoint_dart: any diff --git a/packages/authenticator/amplify_authenticator/example/pubspec.yaml b/packages/authenticator/amplify_authenticator/example/pubspec.yaml index 07e4c3db45..e09a91932d 100644 --- a/packages/authenticator/amplify_authenticator/example/pubspec.yaml +++ b/packages/authenticator/amplify_authenticator/example/pubspec.yaml @@ -18,7 +18,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev version: 1.0.0+1 environment: - sdk: ^3.3.0 + sdk: ^3.4.0 flutter: ">=3.19.0" dependencies: diff --git a/packages/authenticator/amplify_authenticator/pubspec.yaml b/packages/authenticator/amplify_authenticator/pubspec.yaml index c72d807aeb..7c265d81a0 100644 --- a/packages/authenticator/amplify_authenticator/pubspec.yaml +++ b/packages/authenticator/amplify_authenticator/pubspec.yaml @@ -6,7 +6,7 @@ repository: https://github.com/aws-amplify/amplify-flutter/tree/main/packages/au issue_tracker: https://github.com/aws-amplify/amplify-flutter/issues environment: - sdk: ^3.3.0 + sdk: ^3.4.0 flutter: ">=3.19.0" dependencies: diff --git a/packages/authenticator/amplify_authenticator_test/example/pubspec.yaml b/packages/authenticator/amplify_authenticator_test/example/pubspec.yaml index 39d1b058f5..01a184ceb5 100644 --- a/packages/authenticator/amplify_authenticator_test/example/pubspec.yaml +++ b/packages/authenticator/amplify_authenticator_test/example/pubspec.yaml @@ -4,7 +4,7 @@ publish_to: "none" version: 0.1.0 environment: - sdk: ^3.3.0 + sdk: ^3.4.0 flutter: ">=3.19.0" dependencies: diff --git a/packages/authenticator/amplify_authenticator_test/pubspec.yaml b/packages/authenticator/amplify_authenticator_test/pubspec.yaml index cdc8d6c250..918935bdb9 100644 --- a/packages/authenticator/amplify_authenticator_test/pubspec.yaml +++ b/packages/authenticator/amplify_authenticator_test/pubspec.yaml @@ -4,7 +4,7 @@ version: 0.1.0 publish_to: none environment: - sdk: ^3.3.0 + sdk: ^3.4.0 flutter: ">=3.19.0" dependencies: diff --git a/packages/aws_common/pubspec.yaml b/packages/aws_common/pubspec.yaml index 47ffbf3839..72a29a9975 100644 --- a/packages/aws_common/pubspec.yaml +++ b/packages/aws_common/pubspec.yaml @@ -6,7 +6,7 @@ repository: https://github.com/aws-amplify/amplify-flutter/tree/main/packages/aw issue_tracker: https://github.com/aws-amplify/amplify-flutter/issues environment: - sdk: ^3.3.0 + sdk: ^3.4.0 dependencies: async: ^2.10.0 diff --git a/packages/aws_signature_v4/example/pubspec.yaml b/packages/aws_signature_v4/example/pubspec.yaml index 4c42b59dab..84fa08f413 100644 --- a/packages/aws_signature_v4/example/pubspec.yaml +++ b/packages/aws_signature_v4/example/pubspec.yaml @@ -2,7 +2,7 @@ name: example publish_to: none environment: - sdk: ^3.3.0 + sdk: ^3.4.0 dependencies: args: ^2.3.0 diff --git a/packages/aws_signature_v4/pubspec.yaml b/packages/aws_signature_v4/pubspec.yaml index 47eaca6968..58ec4c5077 100644 --- a/packages/aws_signature_v4/pubspec.yaml +++ b/packages/aws_signature_v4/pubspec.yaml @@ -6,7 +6,7 @@ repository: https://github.com/aws-amplify/amplify-flutter/tree/main/packages/aw issue_tracker: https://github.com/aws-amplify/amplify-flutter/issues environment: - sdk: ^3.3.0 + sdk: ^3.4.0 dependencies: async: ^2.10.0 diff --git a/packages/common/amplify_db_common/example/pubspec.yaml b/packages/common/amplify_db_common/example/pubspec.yaml index 8b9ad22412..f75c6118ec 100644 --- a/packages/common/amplify_db_common/example/pubspec.yaml +++ b/packages/common/amplify_db_common/example/pubspec.yaml @@ -4,7 +4,7 @@ publish_to: "none" environment: flutter: ">=3.19.0" - sdk: ^3.3.0 + sdk: ^3.4.0 dependencies: amplify_db_common: ">=0.4.5 <0.5.0" diff --git a/packages/common/amplify_db_common/pubspec.yaml b/packages/common/amplify_db_common/pubspec.yaml index 59d4e67b76..ec59d13eb8 100644 --- a/packages/common/amplify_db_common/pubspec.yaml +++ b/packages/common/amplify_db_common/pubspec.yaml @@ -6,7 +6,7 @@ repository: https://github.com/aws-amplify/amplify-flutter/tree/main/packages/co issue_tracker: https://github.com/aws-amplify/amplify-flutter/issues environment: - sdk: ^3.3.0 + sdk: ^3.4.0 flutter: ">=3.19.0" dependencies: diff --git a/packages/common/amplify_db_common_dart/example/pubspec.yaml b/packages/common/amplify_db_common_dart/example/pubspec.yaml index 5397d83724..3633d32b26 100644 --- a/packages/common/amplify_db_common_dart/example/pubspec.yaml +++ b/packages/common/amplify_db_common_dart/example/pubspec.yaml @@ -7,7 +7,7 @@ version: 0.1.0 publish_to: none environment: - sdk: ^3.3.0 + sdk: ^3.4.0 dependencies: amplify_db_common_dart: ">=0.4.0 <0.5.0" diff --git a/packages/common/amplify_db_common_dart/pubspec.yaml b/packages/common/amplify_db_common_dart/pubspec.yaml index a724f04cd9..2ff29398ce 100644 --- a/packages/common/amplify_db_common_dart/pubspec.yaml +++ b/packages/common/amplify_db_common_dart/pubspec.yaml @@ -6,7 +6,7 @@ repository: https://github.com/aws-amplify/amplify-flutter/tree/main/packages/co issue_tracker: https://github.com/aws-amplify/amplify-flutter/issues environment: - sdk: ^3.3.0 + sdk: ^3.4.0 dependencies: amplify_core: ">=2.5.0 <2.6.0" diff --git a/packages/example_common/example/pubspec.yaml b/packages/example_common/example/pubspec.yaml index 127f6b7456..f50c948067 100644 --- a/packages/example_common/example/pubspec.yaml +++ b/packages/example_common/example/pubspec.yaml @@ -4,7 +4,7 @@ version: 1.0.0 publish_to: none environment: - sdk: ^3.3.0 + sdk: ^3.4.0 dependencies: example_common: diff --git a/packages/example_common/pubspec.yaml b/packages/example_common/pubspec.yaml index e21fa2f0f0..3d88d3bda9 100644 --- a/packages/example_common/pubspec.yaml +++ b/packages/example_common/pubspec.yaml @@ -4,7 +4,7 @@ version: 1.0.0 publish_to: none environment: - sdk: ^3.3.0 + sdk: ^3.4.0 dependencies: meta: ^1.7.0 diff --git a/packages/notifications/push/amplify_push_notifications/example/pubspec.yaml b/packages/notifications/push/amplify_push_notifications/example/pubspec.yaml index bb4b2eddd4..0c63718b02 100644 --- a/packages/notifications/push/amplify_push_notifications/example/pubspec.yaml +++ b/packages/notifications/push/amplify_push_notifications/example/pubspec.yaml @@ -5,7 +5,7 @@ version: 0.1.0 environment: flutter: ">=3.19.0" - sdk: ^3.3.0 + sdk: ^3.4.0 dependencies: amplify_push_notifications: diff --git a/packages/notifications/push/amplify_push_notifications/pubspec.yaml b/packages/notifications/push/amplify_push_notifications/pubspec.yaml index ae3259ced6..817da2329c 100644 --- a/packages/notifications/push/amplify_push_notifications/pubspec.yaml +++ b/packages/notifications/push/amplify_push_notifications/pubspec.yaml @@ -5,7 +5,7 @@ homepage: https://docs.amplify.aws/lib/q/platform/flutter/ issue_tracker: https://github.com/aws-amplify/amplify-flutter/issues environment: - sdk: ^3.3.0 + sdk: ^3.4.0 flutter: ">=3.19.0" dependencies: diff --git a/packages/notifications/push/amplify_push_notifications_pinpoint/example/pubspec.yaml b/packages/notifications/push/amplify_push_notifications_pinpoint/example/pubspec.yaml index 0982354afe..9be2c1f383 100644 --- a/packages/notifications/push/amplify_push_notifications_pinpoint/example/pubspec.yaml +++ b/packages/notifications/push/amplify_push_notifications_pinpoint/example/pubspec.yaml @@ -3,7 +3,7 @@ description: Demonstrates how to use the amplify_push_notifications_pinpoint plu publish_to: "none" # Remove this line if you wish to publish to pub.dev environment: - sdk: ^3.3.0 + sdk: ^3.4.0 flutter: ">=3.19.0" dependencies: diff --git a/packages/notifications/push/amplify_push_notifications_pinpoint/pubspec.yaml b/packages/notifications/push/amplify_push_notifications_pinpoint/pubspec.yaml index db98957000..3cffdf7155 100644 --- a/packages/notifications/push/amplify_push_notifications_pinpoint/pubspec.yaml +++ b/packages/notifications/push/amplify_push_notifications_pinpoint/pubspec.yaml @@ -5,7 +5,7 @@ homepage: https://docs.amplify.aws/lib/q/platform/flutter/ issue_tracker: https://github.com/aws-amplify/amplify-flutter/issues environment: - sdk: ^3.3.0 + sdk: ^3.4.0 flutter: ">=3.19.0" # Helps `pana` since it does not detect Android support. diff --git a/packages/secure_storage/amplify_secure_storage/example/pubspec.yaml b/packages/secure_storage/amplify_secure_storage/example/pubspec.yaml index 3d50c7024d..e1f2c9ad45 100644 --- a/packages/secure_storage/amplify_secure_storage/example/pubspec.yaml +++ b/packages/secure_storage/amplify_secure_storage/example/pubspec.yaml @@ -4,7 +4,7 @@ description: Demonstrates how to use the amplify_secure_storage plugin and house publish_to: "none" environment: - sdk: ^3.3.0 + sdk: ^3.4.0 flutter: ">=3.19.0" dependencies: diff --git a/packages/secure_storage/amplify_secure_storage/pubspec.yaml b/packages/secure_storage/amplify_secure_storage/pubspec.yaml index ee694165c1..e2052a2c75 100644 --- a/packages/secure_storage/amplify_secure_storage/pubspec.yaml +++ b/packages/secure_storage/amplify_secure_storage/pubspec.yaml @@ -6,7 +6,7 @@ repository: https://github.com/aws-amplify/amplify-flutter/tree/main/packages/se issue_tracker: https://github.com/aws-amplify/amplify-flutter/issues environment: - sdk: ^3.3.0 + sdk: ^3.4.0 flutter: ">=3.19.0" dependencies: diff --git a/packages/secure_storage/amplify_secure_storage_dart/example/pubspec.yaml b/packages/secure_storage/amplify_secure_storage_dart/example/pubspec.yaml index f54f976ff2..e7e79c81c8 100644 --- a/packages/secure_storage/amplify_secure_storage_dart/example/pubspec.yaml +++ b/packages/secure_storage/amplify_secure_storage_dart/example/pubspec.yaml @@ -7,7 +7,7 @@ version: 1.0.0 publish_to: none environment: - sdk: ^3.3.0 + sdk: ^3.4.0 dependencies: amplify_secure_storage_dart: ">=0.5.3 <0.6.0" diff --git a/packages/secure_storage/amplify_secure_storage_dart/pubspec.yaml b/packages/secure_storage/amplify_secure_storage_dart/pubspec.yaml index 5d2bf3a6bf..c58e6e3df5 100644 --- a/packages/secure_storage/amplify_secure_storage_dart/pubspec.yaml +++ b/packages/secure_storage/amplify_secure_storage_dart/pubspec.yaml @@ -6,7 +6,7 @@ repository: https://github.com/aws-amplify/amplify-flutter/tree/main/packages/se issue_tracker: https://github.com/aws-amplify/amplify-flutter/issues environment: - sdk: ^3.3.0 + sdk: ^3.4.0 # Explicitly declare platform support to help `pana` platforms: diff --git a/packages/secure_storage/amplify_secure_storage_test/pubspec.yaml b/packages/secure_storage/amplify_secure_storage_test/pubspec.yaml index ec163256e9..ffba2fc209 100644 --- a/packages/secure_storage/amplify_secure_storage_test/pubspec.yaml +++ b/packages/secure_storage/amplify_secure_storage_test/pubspec.yaml @@ -4,7 +4,7 @@ version: 0.1.0 publish_to: none environment: - sdk: ^3.3.0 + sdk: ^3.4.0 dependencies: amplify_secure_storage_dart: any diff --git a/packages/smithy/goldens/lib/awsJson1_0/pubspec.yaml b/packages/smithy/goldens/lib/awsJson1_0/pubspec.yaml index 905d1d643a..25567bf41e 100644 --- a/packages/smithy/goldens/lib/awsJson1_0/pubspec.yaml +++ b/packages/smithy/goldens/lib/awsJson1_0/pubspec.yaml @@ -4,7 +4,7 @@ version: 0.1.0 publish_to: none environment: - sdk: ^3.3.0 + sdk: ^3.4.0 dependencies: smithy: diff --git a/packages/smithy/goldens/lib/awsJson1_1/pubspec.yaml b/packages/smithy/goldens/lib/awsJson1_1/pubspec.yaml index 1fef27249e..602c16484c 100644 --- a/packages/smithy/goldens/lib/awsJson1_1/pubspec.yaml +++ b/packages/smithy/goldens/lib/awsJson1_1/pubspec.yaml @@ -4,7 +4,7 @@ version: 0.1.0 publish_to: none environment: - sdk: ^3.3.0 + sdk: ^3.4.0 dependencies: smithy: diff --git a/packages/smithy/goldens/lib/awsQuery/pubspec.yaml b/packages/smithy/goldens/lib/awsQuery/pubspec.yaml index be869b521b..ed480fb544 100644 --- a/packages/smithy/goldens/lib/awsQuery/pubspec.yaml +++ b/packages/smithy/goldens/lib/awsQuery/pubspec.yaml @@ -4,7 +4,7 @@ version: 0.1.0 publish_to: none environment: - sdk: ^3.3.0 + sdk: ^3.4.0 dependencies: smithy: diff --git a/packages/smithy/goldens/lib/ec2Query/pubspec.yaml b/packages/smithy/goldens/lib/ec2Query/pubspec.yaml index 9bfb7a07c7..70a81c4ad3 100644 --- a/packages/smithy/goldens/lib/ec2Query/pubspec.yaml +++ b/packages/smithy/goldens/lib/ec2Query/pubspec.yaml @@ -4,7 +4,7 @@ version: 0.1.0 publish_to: none environment: - sdk: ^3.3.0 + sdk: ^3.4.0 dependencies: smithy: diff --git a/packages/smithy/goldens/lib/restJson1/pubspec.yaml b/packages/smithy/goldens/lib/restJson1/pubspec.yaml index f9c4d8edb3..588017fbef 100644 --- a/packages/smithy/goldens/lib/restJson1/pubspec.yaml +++ b/packages/smithy/goldens/lib/restJson1/pubspec.yaml @@ -4,7 +4,7 @@ version: 0.1.0 publish_to: none environment: - sdk: ^3.3.0 + sdk: ^3.4.0 dependencies: smithy: diff --git a/packages/smithy/goldens/lib/restXml/pubspec.yaml b/packages/smithy/goldens/lib/restXml/pubspec.yaml index 73a99018eb..8ae76ce6e3 100644 --- a/packages/smithy/goldens/lib/restXml/pubspec.yaml +++ b/packages/smithy/goldens/lib/restXml/pubspec.yaml @@ -4,7 +4,7 @@ version: 0.1.0 publish_to: none environment: - sdk: ^3.3.0 + sdk: ^3.4.0 dependencies: smithy: diff --git a/packages/smithy/goldens/lib/restXmlWithNamespace/pubspec.yaml b/packages/smithy/goldens/lib/restXmlWithNamespace/pubspec.yaml index d539d821e9..148914b627 100644 --- a/packages/smithy/goldens/lib/restXmlWithNamespace/pubspec.yaml +++ b/packages/smithy/goldens/lib/restXmlWithNamespace/pubspec.yaml @@ -4,7 +4,7 @@ version: 0.1.0 publish_to: none environment: - sdk: ^3.3.0 + sdk: ^3.4.0 dependencies: smithy: diff --git a/packages/smithy/goldens/lib2/awsJson1_0/pubspec.yaml b/packages/smithy/goldens/lib2/awsJson1_0/pubspec.yaml index ffdb760ffb..21493c5214 100644 --- a/packages/smithy/goldens/lib2/awsJson1_0/pubspec.yaml +++ b/packages/smithy/goldens/lib2/awsJson1_0/pubspec.yaml @@ -4,7 +4,7 @@ version: 0.1.0 publish_to: none environment: - sdk: ^3.3.0 + sdk: ^3.4.0 dependencies: smithy: diff --git a/packages/smithy/goldens/lib2/awsJson1_1/pubspec.yaml b/packages/smithy/goldens/lib2/awsJson1_1/pubspec.yaml index bb645a2e26..c306ddf774 100644 --- a/packages/smithy/goldens/lib2/awsJson1_1/pubspec.yaml +++ b/packages/smithy/goldens/lib2/awsJson1_1/pubspec.yaml @@ -4,7 +4,7 @@ version: 0.1.0 publish_to: none environment: - sdk: ^3.3.0 + sdk: ^3.4.0 dependencies: smithy: diff --git a/packages/smithy/goldens/lib2/awsQuery/pubspec.yaml b/packages/smithy/goldens/lib2/awsQuery/pubspec.yaml index 0b16bbded3..48ca68f30a 100644 --- a/packages/smithy/goldens/lib2/awsQuery/pubspec.yaml +++ b/packages/smithy/goldens/lib2/awsQuery/pubspec.yaml @@ -4,7 +4,7 @@ version: 0.1.0 publish_to: none environment: - sdk: ^3.3.0 + sdk: ^3.4.0 dependencies: smithy: diff --git a/packages/smithy/goldens/lib2/custom/pubspec.yaml b/packages/smithy/goldens/lib2/custom/pubspec.yaml index 0b76615793..a8b261db3a 100644 --- a/packages/smithy/goldens/lib2/custom/pubspec.yaml +++ b/packages/smithy/goldens/lib2/custom/pubspec.yaml @@ -4,7 +4,7 @@ version: 0.1.0 publish_to: none environment: - sdk: ^3.3.0 + sdk: ^3.4.0 dependencies: smithy: diff --git a/packages/smithy/goldens/lib2/ec2Query/pubspec.yaml b/packages/smithy/goldens/lib2/ec2Query/pubspec.yaml index 3c017aaa8c..7ea65be341 100644 --- a/packages/smithy/goldens/lib2/ec2Query/pubspec.yaml +++ b/packages/smithy/goldens/lib2/ec2Query/pubspec.yaml @@ -4,7 +4,7 @@ version: 0.1.0 publish_to: none environment: - sdk: ^3.3.0 + sdk: ^3.4.0 dependencies: smithy: diff --git a/packages/smithy/goldens/lib2/restJson1/pubspec.yaml b/packages/smithy/goldens/lib2/restJson1/pubspec.yaml index 7826a674cb..a5cad030d2 100644 --- a/packages/smithy/goldens/lib2/restJson1/pubspec.yaml +++ b/packages/smithy/goldens/lib2/restJson1/pubspec.yaml @@ -4,7 +4,7 @@ version: 0.1.0 publish_to: none environment: - sdk: ^3.3.0 + sdk: ^3.4.0 dependencies: smithy: diff --git a/packages/smithy/goldens/lib2/restXml/pubspec.yaml b/packages/smithy/goldens/lib2/restXml/pubspec.yaml index a67dc37406..6a8af6a8c5 100644 --- a/packages/smithy/goldens/lib2/restXml/pubspec.yaml +++ b/packages/smithy/goldens/lib2/restXml/pubspec.yaml @@ -4,7 +4,7 @@ version: 0.1.0 publish_to: none environment: - sdk: ^3.3.0 + sdk: ^3.4.0 dependencies: smithy: diff --git a/packages/smithy/goldens/lib2/restXmlWithNamespace/pubspec.yaml b/packages/smithy/goldens/lib2/restXmlWithNamespace/pubspec.yaml index 68953aa86c..65ab9dcdfa 100644 --- a/packages/smithy/goldens/lib2/restXmlWithNamespace/pubspec.yaml +++ b/packages/smithy/goldens/lib2/restXmlWithNamespace/pubspec.yaml @@ -4,7 +4,7 @@ version: 0.1.0 publish_to: none environment: - sdk: ^3.3.0 + sdk: ^3.4.0 dependencies: smithy: diff --git a/packages/smithy/goldens/pubspec.yaml b/packages/smithy/goldens/pubspec.yaml index 56af310902..08994522a0 100644 --- a/packages/smithy/goldens/pubspec.yaml +++ b/packages/smithy/goldens/pubspec.yaml @@ -4,7 +4,7 @@ version: 1.0.0 publish_to: none environment: - sdk: ^3.3.0 + sdk: ^3.4.0 dependencies: aws_common: ^0.5.0+2 diff --git a/packages/smithy/smithy/pubspec.yaml b/packages/smithy/smithy/pubspec.yaml index 79af956b55..0602adba1a 100644 --- a/packages/smithy/smithy/pubspec.yaml +++ b/packages/smithy/smithy/pubspec.yaml @@ -6,7 +6,7 @@ repository: https://github.com/aws-amplify/amplify-flutter/tree/main/packages/sm issue_tracker: https://github.com/aws-amplify/amplify-flutter/issues environment: - sdk: ^3.3.0 + sdk: ^3.4.0 dependencies: async: ^2.10.0 diff --git a/packages/smithy/smithy_aws/pubspec.yaml b/packages/smithy/smithy_aws/pubspec.yaml index b81cbd666c..389a6f0677 100644 --- a/packages/smithy/smithy_aws/pubspec.yaml +++ b/packages/smithy/smithy_aws/pubspec.yaml @@ -6,7 +6,7 @@ repository: https://github.com/aws-amplify/amplify-flutter/tree/main/packages/sm issue_tracker: https://github.com/aws-amplify/amplify-flutter/issues environment: - sdk: ^3.3.0 + sdk: ^3.4.0 dependencies: aws_common: ">=0.7.3 <0.8.0" diff --git a/packages/smithy/smithy_codegen/pubspec.yaml b/packages/smithy/smithy_codegen/pubspec.yaml index c0c4bb702d..7dc8513333 100644 --- a/packages/smithy/smithy_codegen/pubspec.yaml +++ b/packages/smithy/smithy_codegen/pubspec.yaml @@ -5,7 +5,7 @@ repository: https://github.com/aws-amplify/amplify-flutter/tree/main/packages/sm publish_to: none environment: - sdk: ^3.3.0 + sdk: ^3.4.0 dependencies: args: ^2.3.0 diff --git a/packages/smithy/smithy_test/pubspec.yaml b/packages/smithy/smithy_test/pubspec.yaml index 360d062482..88d531d5d2 100644 --- a/packages/smithy/smithy_test/pubspec.yaml +++ b/packages/smithy/smithy_test/pubspec.yaml @@ -5,7 +5,7 @@ repository: https://github.com/aws-amplify/amplify-flutter/tree/main/packages/sm publish_to: none environment: - sdk: ^3.3.0 + sdk: ^3.4.0 dependencies: async: ^2.10.0 diff --git a/packages/storage/amplify_storage_s3/example/pubspec.yaml b/packages/storage/amplify_storage_s3/example/pubspec.yaml index 22e74ed75e..20bb6decb1 100644 --- a/packages/storage/amplify_storage_s3/example/pubspec.yaml +++ b/packages/storage/amplify_storage_s3/example/pubspec.yaml @@ -4,7 +4,7 @@ version: 0.1.0 publish_to: none environment: - sdk: ^3.3.0 + sdk: ^3.4.0 flutter: ">=3.19.0" dependencies: diff --git a/packages/storage/amplify_storage_s3/pubspec.yaml b/packages/storage/amplify_storage_s3/pubspec.yaml index 3f5f03c6d2..1c34acc060 100644 --- a/packages/storage/amplify_storage_s3/pubspec.yaml +++ b/packages/storage/amplify_storage_s3/pubspec.yaml @@ -6,7 +6,7 @@ repository: https://github.com/aws-amplify/amplify-flutter/tree/main/packages/st issue_tracker: https://github.com/aws-amplify/amplify-flutter/issues environment: - sdk: ^3.3.0 + sdk: ^3.4.0 flutter: ">=3.19.0" # Helps `pana` since we do not use Flutter plugins for most platforms diff --git a/packages/storage/amplify_storage_s3_dart/example/pubspec.yaml b/packages/storage/amplify_storage_s3_dart/example/pubspec.yaml index 9d7e303a9f..c0d5e9e10f 100644 --- a/packages/storage/amplify_storage_s3_dart/example/pubspec.yaml +++ b/packages/storage/amplify_storage_s3_dart/example/pubspec.yaml @@ -4,7 +4,7 @@ version: 1.0.0 publish_to: none environment: - sdk: ^3.3.0 + sdk: ^3.4.0 dependencies: amplify_auth_cognito_dart: any diff --git a/packages/storage/amplify_storage_s3_dart/pubspec.yaml b/packages/storage/amplify_storage_s3_dart/pubspec.yaml index dd8b78c78c..b4410651f1 100644 --- a/packages/storage/amplify_storage_s3_dart/pubspec.yaml +++ b/packages/storage/amplify_storage_s3_dart/pubspec.yaml @@ -6,7 +6,7 @@ repository: https://github.com/aws-amplify/amplify-flutter/tree/main/packages/st issue_tracker: https://github.com/aws-amplify/amplify-flutter/issues environment: - sdk: ^3.3.0 + sdk: ^3.4.0 dependencies: amplify_core: ">=2.5.0 <2.6.0" diff --git a/packages/test/amplify_auth_integration_test/pubspec.yaml b/packages/test/amplify_auth_integration_test/pubspec.yaml index 8053f46d9a..e33111f565 100644 --- a/packages/test/amplify_auth_integration_test/pubspec.yaml +++ b/packages/test/amplify_auth_integration_test/pubspec.yaml @@ -6,7 +6,7 @@ issue_tracker: https://github.com/aws-amplify/amplify-flutter/issues publish_to: none environment: - sdk: ^3.3.0 + sdk: ^3.4.0 flutter: ">=3.19.0" dependencies: diff --git a/packages/test/amplify_integration_test/pubspec.yaml b/packages/test/amplify_integration_test/pubspec.yaml index 480620077b..53a42df6fb 100644 --- a/packages/test/amplify_integration_test/pubspec.yaml +++ b/packages/test/amplify_integration_test/pubspec.yaml @@ -4,7 +4,7 @@ homepage: https://github.com/aws-amplify/amplify-flutter publish_to: none environment: - sdk: ^3.3.0 + sdk: ^3.4.0 dependencies: amplify_auth_cognito_dart: any diff --git a/packages/test/amplify_test/pubspec.yaml b/packages/test/amplify_test/pubspec.yaml index c8acefaff6..a6f5ae648f 100644 --- a/packages/test/amplify_test/pubspec.yaml +++ b/packages/test/amplify_test/pubspec.yaml @@ -4,7 +4,7 @@ homepage: https://github.com/aws-amplify/amplify-flutter publish_to: none environment: - sdk: ^3.3.0 + sdk: ^3.4.0 dependencies: amplify_core: any diff --git a/packages/test/pub_server/pubspec.yaml b/packages/test/pub_server/pubspec.yaml index 86b99d7c54..04a622a671 100644 --- a/packages/test/pub_server/pubspec.yaml +++ b/packages/test/pub_server/pubspec.yaml @@ -6,7 +6,7 @@ issue_tracker: https://github.com/aws-amplify/amplify-flutter/issues publish_to: none environment: - sdk: ^3.3.0 + sdk: ^3.4.0 dependencies: archive: ^3.3.7 diff --git a/packages/worker_bee/e2e/pubspec.yaml b/packages/worker_bee/e2e/pubspec.yaml index 020eec93f2..4817c6181e 100644 --- a/packages/worker_bee/e2e/pubspec.yaml +++ b/packages/worker_bee/e2e/pubspec.yaml @@ -3,7 +3,7 @@ description: E2E tests for the worker_bee package. publish_to: none environment: - sdk: ^3.3.0 + sdk: ^3.4.0 dependencies: aws_common: ">=0.4.0 <0.5.0" diff --git a/packages/worker_bee/e2e_flutter_test/pubspec.yaml b/packages/worker_bee/e2e_flutter_test/pubspec.yaml index 8e8e0e49f5..284036723a 100644 --- a/packages/worker_bee/e2e_flutter_test/pubspec.yaml +++ b/packages/worker_bee/e2e_flutter_test/pubspec.yaml @@ -5,7 +5,7 @@ version: 1.0.0+1 environment: flutter: ">=3.19.0" - sdk: ^3.3.0 + sdk: ^3.4.0 dependencies: e2e: diff --git a/packages/worker_bee/e2e_test/pubspec.yaml b/packages/worker_bee/e2e_test/pubspec.yaml index 8babfa1565..c6a7f34e24 100644 --- a/packages/worker_bee/e2e_test/pubspec.yaml +++ b/packages/worker_bee/e2e_test/pubspec.yaml @@ -3,7 +3,7 @@ description: E2E tests for the worker_bee package. publish_to: none environment: - sdk: ^3.3.0 + sdk: ^3.4.0 dependency_overrides: aws_common: diff --git a/packages/worker_bee/worker_bee/pubspec.yaml b/packages/worker_bee/worker_bee/pubspec.yaml index 14996fe026..b9c4200a8a 100644 --- a/packages/worker_bee/worker_bee/pubspec.yaml +++ b/packages/worker_bee/worker_bee/pubspec.yaml @@ -6,7 +6,7 @@ repository: https://github.com/aws-amplify/amplify-flutter/tree/main/packages/wo issue_tracker: https://github.com/aws-amplify/amplify-flutter/issues environment: - sdk: ^3.3.0 + sdk: ^3.4.0 dependencies: async: ^2.10.0 diff --git a/packages/worker_bee/worker_bee_builder/pubspec.yaml b/packages/worker_bee/worker_bee_builder/pubspec.yaml index 71d6560ee2..ae95b79a35 100644 --- a/packages/worker_bee/worker_bee_builder/pubspec.yaml +++ b/packages/worker_bee/worker_bee_builder/pubspec.yaml @@ -6,7 +6,7 @@ repository: https://github.com/aws-amplify/amplify-flutter/tree/main/packages/wo issue_tracker: https://github.com/aws-amplify/amplify-flutter/issues environment: - sdk: ^3.3.0 + sdk: ^3.4.0 dependencies: analyzer: ">=5.1.0 <7.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index bdaf845f81..b9a7634f51 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -3,7 +3,7 @@ publish_to: none # The current constraints for Dart and Flutter SDKs. environment: - sdk: ^3.3.0 + sdk: ^3.4.0 flutter: ">=3.19.0" # Global dependency versions for third-party dependencies of diff --git a/templates/dart-package/hooks/pubspec.yaml b/templates/dart-package/hooks/pubspec.yaml index ac5f43be57..d2d361c6db 100644 --- a/templates/dart-package/hooks/pubspec.yaml +++ b/templates/dart-package/hooks/pubspec.yaml @@ -2,7 +2,7 @@ name: dart_package_hooks publish_to: none environment: - sdk: ^3.3.0 + sdk: ^3.4.0 dependencies: mason: ">=0.1.0-dev.40 <0.1.0" diff --git a/templates/flutter-package/hooks/pubspec.yaml b/templates/flutter-package/hooks/pubspec.yaml index 2a154749c9..e523c6f82e 100644 --- a/templates/flutter-package/hooks/pubspec.yaml +++ b/templates/flutter-package/hooks/pubspec.yaml @@ -2,7 +2,7 @@ name: flutter_package_hooks publish_to: none environment: - sdk: ^3.3.0 + sdk: ^3.4.0 dependencies: mason: ">=0.1.0-dev.40 <0.1.0" From 843d17ba22fc113c3452c2cda67a8576abb57763 Mon Sep 17 00:00:00 2001 From: Tyler-Larkin Date: Sun, 1 Dec 2024 18:08:44 -0800 Subject: [PATCH 05/11] chore(): Updated Github Actions to use Dart SDK to 3.4.0 --- .github/workflows/actions.yaml | 4 ++-- .github/workflows/dart_dart2js.yaml | 2 +- .github/workflows/dart_ddc.yaml | 2 +- .github/workflows/dart_vm.yaml | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/actions.yaml b/.github/workflows/actions.yaml index aa443c3a4b..2d9ed3a1eb 100644 --- a/.github/workflows/actions.yaml +++ b/.github/workflows/actions.yaml @@ -32,7 +32,7 @@ jobs: - name: Setup Dart uses: dart-lang/setup-dart@e58aeb62aef51dcc4d0ba8eada7c08092aad5314 # main with: - sdk: 3.3.0 + sdk: 3.4.0 - name: Setup pnpm uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # 4.0.0 @@ -64,7 +64,7 @@ jobs: - name: Setup Dart uses: dart-lang/setup-dart@e58aeb62aef51dcc4d0ba8eada7c08092aad5314 # main with: - sdk: 3.3.0 + sdk: 3.4.0 - name: Setup aft shell: bash # Run in bash regardless of platform diff --git a/.github/workflows/dart_dart2js.yaml b/.github/workflows/dart_dart2js.yaml index 95d3896109..4fa0271d0f 100644 --- a/.github/workflows/dart_dart2js.yaml +++ b/.github/workflows/dart_dart2js.yaml @@ -22,7 +22,7 @@ jobs: matrix: sdk: # Minimum supported Dart version - - "3.3.0" + - "3.4.0" - stable - beta browser: diff --git a/.github/workflows/dart_ddc.yaml b/.github/workflows/dart_ddc.yaml index 5827e1ad1c..3383e9b9c1 100644 --- a/.github/workflows/dart_ddc.yaml +++ b/.github/workflows/dart_ddc.yaml @@ -22,7 +22,7 @@ jobs: matrix: sdk: # Minimum supported Dart version - - "3.3.0" + - "3.4.0" - stable - beta browser: diff --git a/.github/workflows/dart_vm.yaml b/.github/workflows/dart_vm.yaml index 88830b5d68..6da68295b0 100644 --- a/.github/workflows/dart_vm.yaml +++ b/.github/workflows/dart_vm.yaml @@ -21,7 +21,7 @@ jobs: matrix: sdk: # Minimum supported Dart version - - "3.3.0" + - "3.4.0" - stable - beta # Skips 'beta' tests on PRs From 0d8a5001d043db90241edf81f10d102d3ed374fb Mon Sep 17 00:00:00 2001 From: Tyler-Larkin Date: Sun, 1 Dec 2024 18:16:07 -0800 Subject: [PATCH 06/11] chore(): updated Flutter to 3.22.0 --- .github/workflows/amplify_canaries.yaml | 6 +++--- .github/workflows/flutter_vm.yaml | 2 +- canaries/pubspec.yaml | 2 +- packages/amplify/amplify_flutter/CHANGELOG.md | 2 +- packages/amplify/amplify_flutter/example/pubspec.yaml | 2 +- packages/amplify/amplify_flutter/pubspec.yaml | 2 +- packages/amplify_core/doc/pubspec.yaml | 2 +- packages/amplify_datastore/example/pubspec.yaml | 2 +- packages/amplify_datastore/pubspec.yaml | 2 +- packages/amplify_datastore_plugin_interface/pubspec.yaml | 2 +- packages/amplify_native_legacy_wrapper/example/pubspec.yaml | 2 +- packages/amplify_native_legacy_wrapper/pubspec.yaml | 2 +- .../amplify_analytics_pinpoint/example/pubspec.yaml | 2 +- packages/analytics/amplify_analytics_pinpoint/pubspec.yaml | 2 +- packages/api/amplify_api/example/pubspec.yaml | 2 +- packages/api/amplify_api/pubspec.yaml | 2 +- packages/auth/amplify_auth_cognito/example/pubspec.yaml | 2 +- packages/auth/amplify_auth_cognito/pubspec.yaml | 2 +- .../amplify_authenticator/example/pubspec.yaml | 2 +- packages/authenticator/amplify_authenticator/pubspec.yaml | 2 +- .../amplify_authenticator_test/example/pubspec.yaml | 2 +- .../authenticator/amplify_authenticator_test/pubspec.yaml | 2 +- packages/common/amplify_db_common/example/pubspec.yaml | 2 +- packages/common/amplify_db_common/pubspec.yaml | 2 +- .../push/amplify_push_notifications/example/pubspec.yaml | 2 +- .../push/amplify_push_notifications/pubspec.yaml | 2 +- .../example/pubspec.yaml | 2 +- .../push/amplify_push_notifications_pinpoint/pubspec.yaml | 2 +- .../amplify_secure_storage/example/pubspec.yaml | 2 +- packages/secure_storage/amplify_secure_storage/pubspec.yaml | 2 +- packages/storage/amplify_storage_s3/example/pubspec.yaml | 2 +- packages/storage/amplify_storage_s3/pubspec.yaml | 2 +- packages/test/amplify_auth_integration_test/pubspec.yaml | 2 +- packages/worker_bee/e2e_flutter_test/pubspec.yaml | 2 +- pubspec.yaml | 2 +- 35 files changed, 37 insertions(+), 37 deletions(-) diff --git a/.github/workflows/amplify_canaries.yaml b/.github/workflows/amplify_canaries.yaml index 5884a5b0f4..fa07e192a6 100644 --- a/.github/workflows/amplify_canaries.yaml +++ b/.github/workflows/amplify_canaries.yaml @@ -32,7 +32,7 @@ jobs: - "any" # latest include: - channel: "stable" - flutter-version: "3.19.0" + flutter-version: "3.22.0" steps: - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # 3.6.0 with: @@ -88,7 +88,7 @@ jobs: - "any" # latest include: - channel: "stable" - flutter-version: "3.19.0" + flutter-version: "3.22.0" steps: - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # 3.6.0 with: @@ -162,7 +162,7 @@ jobs: - "any" # latest include: - channel: "stable" - flutter-version: "3.19.0" + flutter-version: "3.22.0" ios-version: - "15.0" - "17.5" diff --git a/.github/workflows/flutter_vm.yaml b/.github/workflows/flutter_vm.yaml index e733ab32f6..a8c1a022c6 100644 --- a/.github/workflows/flutter_vm.yaml +++ b/.github/workflows/flutter_vm.yaml @@ -31,7 +31,7 @@ jobs: - "any" # latest include: - channel: "stable" - flutter-version: "3.19.0" + flutter-version: "3.22.0" # Skips 'beta' tests on PRs exclude: - channel: ${{ (github.event_name == 'pull_request') && 'beta' || 'NONE' }} diff --git a/canaries/pubspec.yaml b/canaries/pubspec.yaml index 5ba604736a..e3f33f5856 100644 --- a/canaries/pubspec.yaml +++ b/canaries/pubspec.yaml @@ -3,7 +3,7 @@ publish_to: none environment: sdk: ^3.4.0 - flutter: ">=3.19.0" + flutter: ">=3.22.0" dependencies: amplify_analytics_pinpoint: ^2.0.0 diff --git a/packages/amplify/amplify_flutter/CHANGELOG.md b/packages/amplify/amplify_flutter/CHANGELOG.md index 590ee854ad..bf0f2700b3 100644 --- a/packages/amplify/amplify_flutter/CHANGELOG.md +++ b/packages/amplify/amplify_flutter/CHANGELOG.md @@ -84,7 +84,7 @@ As always, you can find us on [GitHub](https://github.com/aws-amplify/amplify-fl ## 1.8.0 NOTE: This version has been updated to: -- Flutter: ">=3.19.0" +- flutter: ">=3.22.0" - Dart ^3.3.0 - Java 17, Kotlin 1.9.10 and Gradle 8.1 for Android projects diff --git a/packages/amplify/amplify_flutter/example/pubspec.yaml b/packages/amplify/amplify_flutter/example/pubspec.yaml index 4071afec47..3b8289f36c 100644 --- a/packages/amplify/amplify_flutter/example/pubspec.yaml +++ b/packages/amplify/amplify_flutter/example/pubspec.yaml @@ -3,7 +3,7 @@ description: Demonstrates how to use the Amplify Flutter client libraries. publish_to: none environment: - flutter: ">=3.19.0" + flutter: ">=3.22.0" sdk: ^3.4.0 dependencies: diff --git a/packages/amplify/amplify_flutter/pubspec.yaml b/packages/amplify/amplify_flutter/pubspec.yaml index 9338feac2a..6840e7a653 100644 --- a/packages/amplify/amplify_flutter/pubspec.yaml +++ b/packages/amplify/amplify_flutter/pubspec.yaml @@ -7,7 +7,7 @@ issue_tracker: https://github.com/aws-amplify/amplify-flutter/issues environment: sdk: ^3.4.0 - flutter: ">=3.19.0" + flutter: ">=3.22.0" # Helps `pana` since we do not use Flutter plugins for most platforms platforms: diff --git a/packages/amplify_core/doc/pubspec.yaml b/packages/amplify_core/doc/pubspec.yaml index 812eac231c..e858369ab2 100644 --- a/packages/amplify_core/doc/pubspec.yaml +++ b/packages/amplify_core/doc/pubspec.yaml @@ -8,7 +8,7 @@ publish_to: none environment: sdk: ^3.4.0 - flutter: ">=3.19.0" + flutter: ">=3.22.0" dependencies: amplify_analytics_pinpoint: any diff --git a/packages/amplify_datastore/example/pubspec.yaml b/packages/amplify_datastore/example/pubspec.yaml index 97e004e8cd..fb25f06302 100644 --- a/packages/amplify_datastore/example/pubspec.yaml +++ b/packages/amplify_datastore/example/pubspec.yaml @@ -7,7 +7,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev environment: sdk: ^3.4.0 - flutter: ">=3.19.0" + flutter: ">=3.22.0" dependencies: flutter: diff --git a/packages/amplify_datastore/pubspec.yaml b/packages/amplify_datastore/pubspec.yaml index a942d1aa7b..03b27b9f8d 100644 --- a/packages/amplify_datastore/pubspec.yaml +++ b/packages/amplify_datastore/pubspec.yaml @@ -7,7 +7,7 @@ issue_tracker: https://github.com/aws-amplify/amplify-flutter/issues environment: sdk: ^3.4.0 - flutter: ">=3.19.0" + flutter: ">=3.22.0" dependencies: flutter: diff --git a/packages/amplify_datastore_plugin_interface/pubspec.yaml b/packages/amplify_datastore_plugin_interface/pubspec.yaml index da9e16493e..3d17d4abc5 100644 --- a/packages/amplify_datastore_plugin_interface/pubspec.yaml +++ b/packages/amplify_datastore_plugin_interface/pubspec.yaml @@ -7,7 +7,7 @@ issue_tracker: https://github.com/aws-amplify/amplify-flutter/issues environment: sdk: ^3.4.0 - flutter: ">=3.19.0" + flutter: ">=3.22.0" dependencies: amplify_core: ">=2.5.0 <2.6.0" diff --git a/packages/amplify_native_legacy_wrapper/example/pubspec.yaml b/packages/amplify_native_legacy_wrapper/example/pubspec.yaml index 0fb7618141..b77e8d3950 100644 --- a/packages/amplify_native_legacy_wrapper/example/pubspec.yaml +++ b/packages/amplify_native_legacy_wrapper/example/pubspec.yaml @@ -5,7 +5,7 @@ publish_to: "none" environment: sdk: ^3.4.0 - flutter: ">=3.19.0" + flutter: ">=3.22.0" dependencies: amplify_native_legacy_wrapper: ^0.1.0 diff --git a/packages/amplify_native_legacy_wrapper/pubspec.yaml b/packages/amplify_native_legacy_wrapper/pubspec.yaml index 10c4a05556..3bb6a5eed2 100644 --- a/packages/amplify_native_legacy_wrapper/pubspec.yaml +++ b/packages/amplify_native_legacy_wrapper/pubspec.yaml @@ -5,7 +5,7 @@ publish_to: none environment: sdk: ^3.4.0 - flutter: ">=3.19.0" + flutter: ">=3.22.0" dependencies: flutter: diff --git a/packages/analytics/amplify_analytics_pinpoint/example/pubspec.yaml b/packages/analytics/amplify_analytics_pinpoint/example/pubspec.yaml index c9e447ae5b..c3b152fae3 100644 --- a/packages/analytics/amplify_analytics_pinpoint/example/pubspec.yaml +++ b/packages/analytics/amplify_analytics_pinpoint/example/pubspec.yaml @@ -8,7 +8,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev environment: sdk: ^3.4.0 - flutter: ">=3.19.0" + flutter: ">=3.22.0" dependencies: amplify_analytics_pinpoint: ">=1.0.0-next.8 <1.0.0-next.9" diff --git a/packages/analytics/amplify_analytics_pinpoint/pubspec.yaml b/packages/analytics/amplify_analytics_pinpoint/pubspec.yaml index 07f08593b8..574c2e24a0 100644 --- a/packages/analytics/amplify_analytics_pinpoint/pubspec.yaml +++ b/packages/analytics/amplify_analytics_pinpoint/pubspec.yaml @@ -7,7 +7,7 @@ issue_tracker: https://github.com/aws-amplify/amplify-flutter/issues environment: sdk: ^3.4.0 - flutter: ">=3.19.0" + flutter: ">=3.22.0" # Helps `pana` since we do not use Flutter plugins for most platforms platforms: diff --git a/packages/api/amplify_api/example/pubspec.yaml b/packages/api/amplify_api/example/pubspec.yaml index 6bf16de029..fdabcde437 100644 --- a/packages/api/amplify_api/example/pubspec.yaml +++ b/packages/api/amplify_api/example/pubspec.yaml @@ -7,7 +7,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev environment: sdk: ^3.4.0 - flutter: ">=3.19.0" + flutter: ">=3.22.0" dependencies: amplify_api: ">=1.0.0-next.8 <1.0.0-next.9" diff --git a/packages/api/amplify_api/pubspec.yaml b/packages/api/amplify_api/pubspec.yaml index fb4b1899c4..03826da1bf 100644 --- a/packages/api/amplify_api/pubspec.yaml +++ b/packages/api/amplify_api/pubspec.yaml @@ -7,7 +7,7 @@ issue_tracker: https://github.com/aws-amplify/amplify-flutter/issues environment: sdk: ^3.4.0 - flutter: ">=3.19.0" + flutter: ">=3.22.0" # Helps `pana` since we do not use Flutter plugins for most platforms platforms: diff --git a/packages/auth/amplify_auth_cognito/example/pubspec.yaml b/packages/auth/amplify_auth_cognito/example/pubspec.yaml index 6a1c6a6dcd..cc3761bec2 100644 --- a/packages/auth/amplify_auth_cognito/example/pubspec.yaml +++ b/packages/auth/amplify_auth_cognito/example/pubspec.yaml @@ -5,7 +5,7 @@ publish_to: none environment: sdk: ^3.4.0 - flutter: ">=3.19.0" + flutter: ">=3.22.0" dependencies: amplify_api: any diff --git a/packages/auth/amplify_auth_cognito/pubspec.yaml b/packages/auth/amplify_auth_cognito/pubspec.yaml index 4f2821e9e1..98275618cc 100644 --- a/packages/auth/amplify_auth_cognito/pubspec.yaml +++ b/packages/auth/amplify_auth_cognito/pubspec.yaml @@ -7,7 +7,7 @@ issue_tracker: https://github.com/aws-amplify/amplify-flutter/issues environment: sdk: ^3.4.0 - flutter: ">=3.19.0" + flutter: ">=3.22.0" # Helps `pana` since we do not use Flutter plugins for most platforms platforms: diff --git a/packages/authenticator/amplify_authenticator/example/pubspec.yaml b/packages/authenticator/amplify_authenticator/example/pubspec.yaml index e09a91932d..c903755a37 100644 --- a/packages/authenticator/amplify_authenticator/example/pubspec.yaml +++ b/packages/authenticator/amplify_authenticator/example/pubspec.yaml @@ -19,7 +19,7 @@ version: 1.0.0+1 environment: sdk: ^3.4.0 - flutter: ">=3.19.0" + flutter: ">=3.22.0" dependencies: amplify_auth_cognito: ">=1.0.0-next.8 <1.0.0-next.9" diff --git a/packages/authenticator/amplify_authenticator/pubspec.yaml b/packages/authenticator/amplify_authenticator/pubspec.yaml index 7c265d81a0..448bf1ddd6 100644 --- a/packages/authenticator/amplify_authenticator/pubspec.yaml +++ b/packages/authenticator/amplify_authenticator/pubspec.yaml @@ -7,7 +7,7 @@ issue_tracker: https://github.com/aws-amplify/amplify-flutter/issues environment: sdk: ^3.4.0 - flutter: ">=3.19.0" + flutter: ">=3.22.0" dependencies: amplify_auth_cognito: ">=2.5.0 <2.6.0" diff --git a/packages/authenticator/amplify_authenticator_test/example/pubspec.yaml b/packages/authenticator/amplify_authenticator_test/example/pubspec.yaml index 01a184ceb5..085d598ed3 100644 --- a/packages/authenticator/amplify_authenticator_test/example/pubspec.yaml +++ b/packages/authenticator/amplify_authenticator_test/example/pubspec.yaml @@ -5,7 +5,7 @@ version: 0.1.0 environment: sdk: ^3.4.0 - flutter: ">=3.19.0" + flutter: ">=3.22.0" dependencies: amplify_authenticator: any diff --git a/packages/authenticator/amplify_authenticator_test/pubspec.yaml b/packages/authenticator/amplify_authenticator_test/pubspec.yaml index 918935bdb9..362738206b 100644 --- a/packages/authenticator/amplify_authenticator_test/pubspec.yaml +++ b/packages/authenticator/amplify_authenticator_test/pubspec.yaml @@ -5,7 +5,7 @@ publish_to: none environment: sdk: ^3.4.0 - flutter: ">=3.19.0" + flutter: ">=3.22.0" dependencies: amplify_authenticator: any diff --git a/packages/common/amplify_db_common/example/pubspec.yaml b/packages/common/amplify_db_common/example/pubspec.yaml index f75c6118ec..128fba2be3 100644 --- a/packages/common/amplify_db_common/example/pubspec.yaml +++ b/packages/common/amplify_db_common/example/pubspec.yaml @@ -3,7 +3,7 @@ description: Demonstrates how to use the amplify_db_common plugin. publish_to: "none" environment: - flutter: ">=3.19.0" + flutter: ">=3.22.0" sdk: ^3.4.0 dependencies: diff --git a/packages/common/amplify_db_common/pubspec.yaml b/packages/common/amplify_db_common/pubspec.yaml index ec59d13eb8..8510a2c140 100644 --- a/packages/common/amplify_db_common/pubspec.yaml +++ b/packages/common/amplify_db_common/pubspec.yaml @@ -7,7 +7,7 @@ issue_tracker: https://github.com/aws-amplify/amplify-flutter/issues environment: sdk: ^3.4.0 - flutter: ">=3.19.0" + flutter: ">=3.22.0" dependencies: amplify_db_common_dart: ">=0.4.7 <0.5.0" diff --git a/packages/notifications/push/amplify_push_notifications/example/pubspec.yaml b/packages/notifications/push/amplify_push_notifications/example/pubspec.yaml index 0c63718b02..5c6c58c399 100644 --- a/packages/notifications/push/amplify_push_notifications/example/pubspec.yaml +++ b/packages/notifications/push/amplify_push_notifications/example/pubspec.yaml @@ -4,7 +4,7 @@ publish_to: "none" version: 0.1.0 environment: - flutter: ">=3.19.0" + flutter: ">=3.22.0" sdk: ^3.4.0 dependencies: diff --git a/packages/notifications/push/amplify_push_notifications/pubspec.yaml b/packages/notifications/push/amplify_push_notifications/pubspec.yaml index 817da2329c..bc59b7af82 100644 --- a/packages/notifications/push/amplify_push_notifications/pubspec.yaml +++ b/packages/notifications/push/amplify_push_notifications/pubspec.yaml @@ -6,7 +6,7 @@ issue_tracker: https://github.com/aws-amplify/amplify-flutter/issues environment: sdk: ^3.4.0 - flutter: ">=3.19.0" + flutter: ">=3.22.0" dependencies: amplify_core: ">=2.5.0 <2.6.0" diff --git a/packages/notifications/push/amplify_push_notifications_pinpoint/example/pubspec.yaml b/packages/notifications/push/amplify_push_notifications_pinpoint/example/pubspec.yaml index 9be2c1f383..7984ec2536 100644 --- a/packages/notifications/push/amplify_push_notifications_pinpoint/example/pubspec.yaml +++ b/packages/notifications/push/amplify_push_notifications_pinpoint/example/pubspec.yaml @@ -4,7 +4,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev environment: sdk: ^3.4.0 - flutter: ">=3.19.0" + flutter: ">=3.22.0" dependencies: amplify_auth_cognito: ">=1.0.0-next.8 <1.0.0-next.9" diff --git a/packages/notifications/push/amplify_push_notifications_pinpoint/pubspec.yaml b/packages/notifications/push/amplify_push_notifications_pinpoint/pubspec.yaml index 3cffdf7155..f44443aef6 100644 --- a/packages/notifications/push/amplify_push_notifications_pinpoint/pubspec.yaml +++ b/packages/notifications/push/amplify_push_notifications_pinpoint/pubspec.yaml @@ -6,7 +6,7 @@ issue_tracker: https://github.com/aws-amplify/amplify-flutter/issues environment: sdk: ^3.4.0 - flutter: ">=3.19.0" + flutter: ">=3.22.0" # Helps `pana` since it does not detect Android support. platforms: diff --git a/packages/secure_storage/amplify_secure_storage/example/pubspec.yaml b/packages/secure_storage/amplify_secure_storage/example/pubspec.yaml index e1f2c9ad45..058372015d 100644 --- a/packages/secure_storage/amplify_secure_storage/example/pubspec.yaml +++ b/packages/secure_storage/amplify_secure_storage/example/pubspec.yaml @@ -5,7 +5,7 @@ publish_to: "none" environment: sdk: ^3.4.0 - flutter: ">=3.19.0" + flutter: ">=3.22.0" dependencies: amplify_secure_storage: ">=0.3.0 <0.4.0" diff --git a/packages/secure_storage/amplify_secure_storage/pubspec.yaml b/packages/secure_storage/amplify_secure_storage/pubspec.yaml index e2052a2c75..a468072e55 100644 --- a/packages/secure_storage/amplify_secure_storage/pubspec.yaml +++ b/packages/secure_storage/amplify_secure_storage/pubspec.yaml @@ -7,7 +7,7 @@ issue_tracker: https://github.com/aws-amplify/amplify-flutter/issues environment: sdk: ^3.4.0 - flutter: ">=3.19.0" + flutter: ">=3.22.0" dependencies: amplify_secure_storage_dart: ">=0.5.3 <0.6.0" diff --git a/packages/storage/amplify_storage_s3/example/pubspec.yaml b/packages/storage/amplify_storage_s3/example/pubspec.yaml index 20bb6decb1..8eaad034e3 100644 --- a/packages/storage/amplify_storage_s3/example/pubspec.yaml +++ b/packages/storage/amplify_storage_s3/example/pubspec.yaml @@ -5,7 +5,7 @@ publish_to: none environment: sdk: ^3.4.0 - flutter: ">=3.19.0" + flutter: ">=3.22.0" dependencies: amplify_auth_cognito: any diff --git a/packages/storage/amplify_storage_s3/pubspec.yaml b/packages/storage/amplify_storage_s3/pubspec.yaml index 1c34acc060..5ef3ef34da 100644 --- a/packages/storage/amplify_storage_s3/pubspec.yaml +++ b/packages/storage/amplify_storage_s3/pubspec.yaml @@ -7,7 +7,7 @@ issue_tracker: https://github.com/aws-amplify/amplify-flutter/issues environment: sdk: ^3.4.0 - flutter: ">=3.19.0" + flutter: ">=3.22.0" # Helps `pana` since we do not use Flutter plugins for most platforms platforms: diff --git a/packages/test/amplify_auth_integration_test/pubspec.yaml b/packages/test/amplify_auth_integration_test/pubspec.yaml index e33111f565..e8e101ec85 100644 --- a/packages/test/amplify_auth_integration_test/pubspec.yaml +++ b/packages/test/amplify_auth_integration_test/pubspec.yaml @@ -7,7 +7,7 @@ publish_to: none environment: sdk: ^3.4.0 - flutter: ">=3.19.0" + flutter: ">=3.22.0" dependencies: amplify_api: any diff --git a/packages/worker_bee/e2e_flutter_test/pubspec.yaml b/packages/worker_bee/e2e_flutter_test/pubspec.yaml index 284036723a..efebc0ab52 100644 --- a/packages/worker_bee/e2e_flutter_test/pubspec.yaml +++ b/packages/worker_bee/e2e_flutter_test/pubspec.yaml @@ -4,7 +4,7 @@ publish_to: 'none' version: 1.0.0+1 environment: - flutter: ">=3.19.0" + flutter: ">=3.22.0" sdk: ^3.4.0 dependencies: diff --git a/pubspec.yaml b/pubspec.yaml index b9a7634f51..3b8963f421 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -4,7 +4,7 @@ publish_to: none # The current constraints for Dart and Flutter SDKs. environment: sdk: ^3.4.0 - flutter: ">=3.19.0" + flutter: ">=3.22.0" # Global dependency versions for third-party dependencies of # Amplify Flutter projects. These represent the values which From 83f8fa3188fe06c434f2e642297e24026bf3603d Mon Sep 17 00:00:00 2001 From: Tyler-Larkin Date: Tue, 3 Dec 2024 13:13:00 -0800 Subject: [PATCH 07/11] chore(): updated Flutter to 3.24.0 and dart sdk to 3.5.0 --- .github/workflows/actions.yaml | 4 ++-- .github/workflows/amplify_canaries.yaml | 6 +++--- .github/workflows/dart_dart2js.yaml | 2 +- .github/workflows/dart_ddc.yaml | 2 +- .github/workflows/dart_vm.yaml | 2 +- .github/workflows/flutter_vm.yaml | 2 +- actions/pubspec.yaml | 2 +- canaries/pubspec.yaml | 4 ++-- infra-gen2/pubspec.yaml | 2 +- infra/pubspec.yaml | 2 +- packages/aft/pubspec.yaml | 2 +- packages/amplify/amplify_flutter/CHANGELOG.md | 2 +- packages/amplify/amplify_flutter/example/pubspec.yaml | 4 ++-- packages/amplify/amplify_flutter/pubspec.yaml | 4 ++-- packages/amplify_core/doc/pubspec.yaml | 4 ++-- packages/amplify_core/pubspec.yaml | 2 +- packages/amplify_datastore/example/pubspec.yaml | 4 ++-- packages/amplify_datastore/pubspec.yaml | 4 ++-- packages/amplify_datastore_plugin_interface/pubspec.yaml | 4 ++-- packages/amplify_lints/pubspec.yaml | 2 +- packages/amplify_native_legacy_wrapper/example/pubspec.yaml | 4 ++-- packages/amplify_native_legacy_wrapper/pubspec.yaml | 4 ++-- .../amplify_analytics_pinpoint/example/pubspec.yaml | 4 ++-- packages/analytics/amplify_analytics_pinpoint/pubspec.yaml | 4 ++-- .../analytics/amplify_analytics_pinpoint_dart/pubspec.yaml | 2 +- packages/api/amplify_api/example/pubspec.yaml | 4 ++-- packages/api/amplify_api/pubspec.yaml | 4 ++-- packages/api/amplify_api_dart/pubspec.yaml | 2 +- packages/auth/amplify_auth_cognito/example/pubspec.yaml | 4 ++-- packages/auth/amplify_auth_cognito/pubspec.yaml | 4 ++-- .../auth/amplify_auth_cognito_dart/example/pubspec.yaml | 2 +- packages/auth/amplify_auth_cognito_dart/pubspec.yaml | 2 +- packages/auth/amplify_auth_cognito_test/pubspec.yaml | 2 +- .../amplify_authenticator/example/pubspec.yaml | 4 ++-- packages/authenticator/amplify_authenticator/pubspec.yaml | 4 ++-- .../amplify_authenticator_test/example/pubspec.yaml | 4 ++-- .../authenticator/amplify_authenticator_test/pubspec.yaml | 4 ++-- packages/aws_common/pubspec.yaml | 2 +- packages/aws_signature_v4/example/pubspec.yaml | 2 +- packages/aws_signature_v4/pubspec.yaml | 2 +- packages/common/amplify_db_common/example/pubspec.yaml | 4 ++-- packages/common/amplify_db_common/pubspec.yaml | 4 ++-- packages/common/amplify_db_common_dart/example/pubspec.yaml | 2 +- packages/common/amplify_db_common_dart/pubspec.yaml | 2 +- packages/example_common/example/pubspec.yaml | 2 +- packages/example_common/pubspec.yaml | 2 +- .../push/amplify_push_notifications/example/pubspec.yaml | 4 ++-- .../push/amplify_push_notifications/pubspec.yaml | 4 ++-- .../example/pubspec.yaml | 4 ++-- .../push/amplify_push_notifications_pinpoint/pubspec.yaml | 4 ++-- .../amplify_secure_storage/example/pubspec.yaml | 4 ++-- packages/secure_storage/amplify_secure_storage/pubspec.yaml | 4 ++-- .../amplify_secure_storage_dart/example/pubspec.yaml | 2 +- .../secure_storage/amplify_secure_storage_dart/pubspec.yaml | 2 +- .../secure_storage/amplify_secure_storage_test/pubspec.yaml | 2 +- packages/smithy/goldens/lib/awsJson1_0/pubspec.yaml | 2 +- packages/smithy/goldens/lib/awsJson1_1/pubspec.yaml | 2 +- packages/smithy/goldens/lib/awsQuery/pubspec.yaml | 2 +- packages/smithy/goldens/lib/ec2Query/pubspec.yaml | 2 +- packages/smithy/goldens/lib/restJson1/pubspec.yaml | 2 +- packages/smithy/goldens/lib/restXml/pubspec.yaml | 2 +- .../smithy/goldens/lib/restXmlWithNamespace/pubspec.yaml | 2 +- packages/smithy/goldens/lib2/awsJson1_0/pubspec.yaml | 2 +- packages/smithy/goldens/lib2/awsJson1_1/pubspec.yaml | 2 +- packages/smithy/goldens/lib2/awsQuery/pubspec.yaml | 2 +- packages/smithy/goldens/lib2/custom/pubspec.yaml | 2 +- packages/smithy/goldens/lib2/ec2Query/pubspec.yaml | 2 +- packages/smithy/goldens/lib2/restJson1/pubspec.yaml | 2 +- packages/smithy/goldens/lib2/restXml/pubspec.yaml | 2 +- .../smithy/goldens/lib2/restXmlWithNamespace/pubspec.yaml | 2 +- packages/smithy/goldens/pubspec.yaml | 2 +- packages/smithy/smithy/pubspec.yaml | 2 +- packages/smithy/smithy_aws/pubspec.yaml | 2 +- packages/smithy/smithy_codegen/pubspec.yaml | 2 +- packages/smithy/smithy_test/pubspec.yaml | 2 +- packages/storage/amplify_storage_s3/example/pubspec.yaml | 4 ++-- packages/storage/amplify_storage_s3/pubspec.yaml | 4 ++-- .../storage/amplify_storage_s3_dart/example/pubspec.yaml | 2 +- packages/storage/amplify_storage_s3_dart/pubspec.yaml | 2 +- packages/test/amplify_auth_integration_test/pubspec.yaml | 4 ++-- packages/test/amplify_integration_test/pubspec.yaml | 2 +- packages/test/amplify_test/pubspec.yaml | 2 +- packages/test/pub_server/pubspec.yaml | 2 +- packages/worker_bee/e2e/pubspec.yaml | 2 +- packages/worker_bee/e2e_flutter_test/pubspec.yaml | 4 ++-- packages/worker_bee/e2e_test/pubspec.yaml | 2 +- packages/worker_bee/worker_bee/pubspec.yaml | 2 +- packages/worker_bee/worker_bee_builder/pubspec.yaml | 2 +- pubspec.yaml | 4 ++-- templates/dart-package/hooks/pubspec.yaml | 2 +- templates/flutter-package/hooks/pubspec.yaml | 2 +- 91 files changed, 126 insertions(+), 126 deletions(-) diff --git a/.github/workflows/actions.yaml b/.github/workflows/actions.yaml index 2d9ed3a1eb..2668f37a3b 100644 --- a/.github/workflows/actions.yaml +++ b/.github/workflows/actions.yaml @@ -32,7 +32,7 @@ jobs: - name: Setup Dart uses: dart-lang/setup-dart@e58aeb62aef51dcc4d0ba8eada7c08092aad5314 # main with: - sdk: 3.4.0 + sdk: 3.5.0 - name: Setup pnpm uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # 4.0.0 @@ -64,7 +64,7 @@ jobs: - name: Setup Dart uses: dart-lang/setup-dart@e58aeb62aef51dcc4d0ba8eada7c08092aad5314 # main with: - sdk: 3.4.0 + sdk: 3.5.0 - name: Setup aft shell: bash # Run in bash regardless of platform diff --git a/.github/workflows/amplify_canaries.yaml b/.github/workflows/amplify_canaries.yaml index fa07e192a6..4df0035109 100644 --- a/.github/workflows/amplify_canaries.yaml +++ b/.github/workflows/amplify_canaries.yaml @@ -32,7 +32,7 @@ jobs: - "any" # latest include: - channel: "stable" - flutter-version: "3.22.0" + flutter-version: "3.24.0" steps: - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # 3.6.0 with: @@ -88,7 +88,7 @@ jobs: - "any" # latest include: - channel: "stable" - flutter-version: "3.22.0" + flutter-version: "3.24.0" steps: - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # 3.6.0 with: @@ -162,7 +162,7 @@ jobs: - "any" # latest include: - channel: "stable" - flutter-version: "3.22.0" + flutter-version: "3.24.0" ios-version: - "15.0" - "17.5" diff --git a/.github/workflows/dart_dart2js.yaml b/.github/workflows/dart_dart2js.yaml index 4fa0271d0f..f627b9eb14 100644 --- a/.github/workflows/dart_dart2js.yaml +++ b/.github/workflows/dart_dart2js.yaml @@ -22,7 +22,7 @@ jobs: matrix: sdk: # Minimum supported Dart version - - "3.4.0" + - "3.5.0" - stable - beta browser: diff --git a/.github/workflows/dart_ddc.yaml b/.github/workflows/dart_ddc.yaml index 3383e9b9c1..afd4e50eb3 100644 --- a/.github/workflows/dart_ddc.yaml +++ b/.github/workflows/dart_ddc.yaml @@ -22,7 +22,7 @@ jobs: matrix: sdk: # Minimum supported Dart version - - "3.4.0" + - "3.5.0" - stable - beta browser: diff --git a/.github/workflows/dart_vm.yaml b/.github/workflows/dart_vm.yaml index 6da68295b0..08cbe919ea 100644 --- a/.github/workflows/dart_vm.yaml +++ b/.github/workflows/dart_vm.yaml @@ -21,7 +21,7 @@ jobs: matrix: sdk: # Minimum supported Dart version - - "3.4.0" + - "3.5.0" - stable - beta # Skips 'beta' tests on PRs diff --git a/.github/workflows/flutter_vm.yaml b/.github/workflows/flutter_vm.yaml index a8c1a022c6..b77fa35f22 100644 --- a/.github/workflows/flutter_vm.yaml +++ b/.github/workflows/flutter_vm.yaml @@ -31,7 +31,7 @@ jobs: - "any" # latest include: - channel: "stable" - flutter-version: "3.22.0" + flutter-version: "3.24.0" # Skips 'beta' tests on PRs exclude: - channel: ${{ (github.event_name == 'pull_request') && 'beta' || 'NONE' }} diff --git a/actions/pubspec.yaml b/actions/pubspec.yaml index 724d4d02e7..26bdfe6767 100644 --- a/actions/pubspec.yaml +++ b/actions/pubspec.yaml @@ -4,7 +4,7 @@ version: 1.0.0 publish_to: none environment: - sdk: ^3.4.0 + sdk: ^3.5.0 dependencies: aws_common: ^0.6.1 diff --git a/canaries/pubspec.yaml b/canaries/pubspec.yaml index e3f33f5856..fe6cc9ef5b 100644 --- a/canaries/pubspec.yaml +++ b/canaries/pubspec.yaml @@ -2,8 +2,8 @@ name: amplified_todo publish_to: none environment: - sdk: ^3.4.0 - flutter: ">=3.22.0" + sdk: ^3.5.0 + flutter: ">=3.24.0" dependencies: amplify_analytics_pinpoint: ^2.0.0 diff --git a/infra-gen2/pubspec.yaml b/infra-gen2/pubspec.yaml index 39c0ddf08f..d19a7105a1 100644 --- a/infra-gen2/pubspec.yaml +++ b/infra-gen2/pubspec.yaml @@ -2,7 +2,7 @@ name: infra_gen2 publish_to: none environment: - sdk: ^3.4.0 + sdk: ^3.5.0 dependencies: amplify_core: any diff --git a/infra/pubspec.yaml b/infra/pubspec.yaml index dc1306338e..d3a880397e 100644 --- a/infra/pubspec.yaml +++ b/infra/pubspec.yaml @@ -2,7 +2,7 @@ name: infra publish_to: none environment: - sdk: ^3.4.0 + sdk: ^3.5.0 dependencies: amplify_core: any diff --git a/packages/aft/pubspec.yaml b/packages/aft/pubspec.yaml index dacc48d92e..a3f1dd30ce 100644 --- a/packages/aft/pubspec.yaml +++ b/packages/aft/pubspec.yaml @@ -4,7 +4,7 @@ version: 0.1.1 publish_to: none environment: - sdk: ^3.4.0 + sdk: ^3.5.0 dependencies: args: ^2.3.0 diff --git a/packages/amplify/amplify_flutter/CHANGELOG.md b/packages/amplify/amplify_flutter/CHANGELOG.md index bf0f2700b3..345b2a77b9 100644 --- a/packages/amplify/amplify_flutter/CHANGELOG.md +++ b/packages/amplify/amplify_flutter/CHANGELOG.md @@ -84,7 +84,7 @@ As always, you can find us on [GitHub](https://github.com/aws-amplify/amplify-fl ## 1.8.0 NOTE: This version has been updated to: -- flutter: ">=3.22.0" +- flutter: ">=3.24.0" - Dart ^3.3.0 - Java 17, Kotlin 1.9.10 and Gradle 8.1 for Android projects diff --git a/packages/amplify/amplify_flutter/example/pubspec.yaml b/packages/amplify/amplify_flutter/example/pubspec.yaml index 3b8289f36c..fef3c576f7 100644 --- a/packages/amplify/amplify_flutter/example/pubspec.yaml +++ b/packages/amplify/amplify_flutter/example/pubspec.yaml @@ -3,8 +3,8 @@ description: Demonstrates how to use the Amplify Flutter client libraries. publish_to: none environment: - flutter: ">=3.22.0" - sdk: ^3.4.0 + flutter: ">=3.24.0" + sdk: ^3.5.0 dependencies: amplify_analytics_pinpoint: ">=1.0.0-next.8 <1.0.0-next.9" diff --git a/packages/amplify/amplify_flutter/pubspec.yaml b/packages/amplify/amplify_flutter/pubspec.yaml index 6840e7a653..738192e53c 100644 --- a/packages/amplify/amplify_flutter/pubspec.yaml +++ b/packages/amplify/amplify_flutter/pubspec.yaml @@ -6,8 +6,8 @@ repository: https://github.com/aws-amplify/amplify-flutter/tree/main/packages/am issue_tracker: https://github.com/aws-amplify/amplify-flutter/issues environment: - sdk: ^3.4.0 - flutter: ">=3.22.0" + sdk: ^3.5.0 + flutter: ">=3.24.0" # Helps `pana` since we do not use Flutter plugins for most platforms platforms: diff --git a/packages/amplify_core/doc/pubspec.yaml b/packages/amplify_core/doc/pubspec.yaml index e858369ab2..e297cc290c 100644 --- a/packages/amplify_core/doc/pubspec.yaml +++ b/packages/amplify_core/doc/pubspec.yaml @@ -7,8 +7,8 @@ issue_tracker: https://github.com/aws-amplify/amplify-flutter/issues publish_to: none environment: - sdk: ^3.4.0 - flutter: ">=3.22.0" + sdk: ^3.5.0 + flutter: ">=3.24.0" dependencies: amplify_analytics_pinpoint: any diff --git a/packages/amplify_core/pubspec.yaml b/packages/amplify_core/pubspec.yaml index 00483ae16d..f6f0d4195e 100644 --- a/packages/amplify_core/pubspec.yaml +++ b/packages/amplify_core/pubspec.yaml @@ -6,7 +6,7 @@ repository: https://github.com/aws-amplify/amplify-flutter/tree/main/packages/am issue_tracker: https://github.com/aws-amplify/amplify-flutter/issues environment: - sdk: ^3.4.0 + sdk: ^3.5.0 dependencies: async: ^2.10.0 diff --git a/packages/amplify_datastore/example/pubspec.yaml b/packages/amplify_datastore/example/pubspec.yaml index fb25f06302..b8a3b04be9 100644 --- a/packages/amplify_datastore/example/pubspec.yaml +++ b/packages/amplify_datastore/example/pubspec.yaml @@ -6,8 +6,8 @@ description: Demonstrates how to use the amplify_datastore plugin. publish_to: "none" # Remove this line if you wish to publish to pub.dev environment: - sdk: ^3.4.0 - flutter: ">=3.22.0" + sdk: ^3.5.0 + flutter: ">=3.24.0" dependencies: flutter: diff --git a/packages/amplify_datastore/pubspec.yaml b/packages/amplify_datastore/pubspec.yaml index 03b27b9f8d..5d5ddc8948 100644 --- a/packages/amplify_datastore/pubspec.yaml +++ b/packages/amplify_datastore/pubspec.yaml @@ -6,8 +6,8 @@ repository: https://github.com/aws-amplify/amplify-flutter/tree/main/packages/am issue_tracker: https://github.com/aws-amplify/amplify-flutter/issues environment: - sdk: ^3.4.0 - flutter: ">=3.22.0" + sdk: ^3.5.0 + flutter: ">=3.24.0" dependencies: flutter: diff --git a/packages/amplify_datastore_plugin_interface/pubspec.yaml b/packages/amplify_datastore_plugin_interface/pubspec.yaml index 3d17d4abc5..82ea1e8838 100644 --- a/packages/amplify_datastore_plugin_interface/pubspec.yaml +++ b/packages/amplify_datastore_plugin_interface/pubspec.yaml @@ -6,8 +6,8 @@ repository: https://github.com/aws-amplify/amplify-flutter/tree/main/packages/am issue_tracker: https://github.com/aws-amplify/amplify-flutter/issues environment: - sdk: ^3.4.0 - flutter: ">=3.22.0" + sdk: ^3.5.0 + flutter: ">=3.24.0" dependencies: amplify_core: ">=2.5.0 <2.6.0" diff --git a/packages/amplify_lints/pubspec.yaml b/packages/amplify_lints/pubspec.yaml index 76200df6c0..c5b2ee2252 100644 --- a/packages/amplify_lints/pubspec.yaml +++ b/packages/amplify_lints/pubspec.yaml @@ -6,7 +6,7 @@ repository: https://github.com/aws-amplify/amplify-flutter/tree/main/packages/am issue_tracker: https://github.com/aws-amplify/amplify-flutter/issues environment: - sdk: ^3.4.0 + sdk: ^3.5.0 dependencies: flutter_lints: ^3.0.0 diff --git a/packages/amplify_native_legacy_wrapper/example/pubspec.yaml b/packages/amplify_native_legacy_wrapper/example/pubspec.yaml index b77e8d3950..66965da377 100644 --- a/packages/amplify_native_legacy_wrapper/example/pubspec.yaml +++ b/packages/amplify_native_legacy_wrapper/example/pubspec.yaml @@ -4,8 +4,8 @@ version: 0.1.0 publish_to: "none" environment: - sdk: ^3.4.0 - flutter: ">=3.22.0" + sdk: ^3.5.0 + flutter: ">=3.24.0" dependencies: amplify_native_legacy_wrapper: ^0.1.0 diff --git a/packages/amplify_native_legacy_wrapper/pubspec.yaml b/packages/amplify_native_legacy_wrapper/pubspec.yaml index 3bb6a5eed2..a2e7e6fbd6 100644 --- a/packages/amplify_native_legacy_wrapper/pubspec.yaml +++ b/packages/amplify_native_legacy_wrapper/pubspec.yaml @@ -4,8 +4,8 @@ version: 0.0.1 publish_to: none environment: - sdk: ^3.4.0 - flutter: ">=3.22.0" + sdk: ^3.5.0 + flutter: ">=3.24.0" dependencies: flutter: diff --git a/packages/analytics/amplify_analytics_pinpoint/example/pubspec.yaml b/packages/analytics/amplify_analytics_pinpoint/example/pubspec.yaml index c3b152fae3..bb41f54e09 100644 --- a/packages/analytics/amplify_analytics_pinpoint/example/pubspec.yaml +++ b/packages/analytics/amplify_analytics_pinpoint/example/pubspec.yaml @@ -7,8 +7,8 @@ version: 0.1.0 publish_to: "none" # Remove this line if you wish to publish to pub.dev environment: - sdk: ^3.4.0 - flutter: ">=3.22.0" + sdk: ^3.5.0 + flutter: ">=3.24.0" dependencies: amplify_analytics_pinpoint: ">=1.0.0-next.8 <1.0.0-next.9" diff --git a/packages/analytics/amplify_analytics_pinpoint/pubspec.yaml b/packages/analytics/amplify_analytics_pinpoint/pubspec.yaml index 574c2e24a0..04219169f4 100644 --- a/packages/analytics/amplify_analytics_pinpoint/pubspec.yaml +++ b/packages/analytics/amplify_analytics_pinpoint/pubspec.yaml @@ -6,8 +6,8 @@ repository: https://github.com/aws-amplify/amplify-flutter/tree/main/packages/an issue_tracker: https://github.com/aws-amplify/amplify-flutter/issues environment: - sdk: ^3.4.0 - flutter: ">=3.22.0" + sdk: ^3.5.0 + flutter: ">=3.24.0" # Helps `pana` since we do not use Flutter plugins for most platforms platforms: diff --git a/packages/analytics/amplify_analytics_pinpoint_dart/pubspec.yaml b/packages/analytics/amplify_analytics_pinpoint_dart/pubspec.yaml index f02bd6c0ab..5547a81898 100644 --- a/packages/analytics/amplify_analytics_pinpoint_dart/pubspec.yaml +++ b/packages/analytics/amplify_analytics_pinpoint_dart/pubspec.yaml @@ -6,7 +6,7 @@ repository: https://github.com/aws-amplify/amplify-flutter/tree/main/packages/an issue_tracker: https://github.com/aws-amplify/amplify-flutter/issues environment: - sdk: ^3.4.0 + sdk: ^3.5.0 dependencies: amplify_core: ">=2.5.0 <2.6.0" diff --git a/packages/api/amplify_api/example/pubspec.yaml b/packages/api/amplify_api/example/pubspec.yaml index fdabcde437..1639636cb7 100644 --- a/packages/api/amplify_api/example/pubspec.yaml +++ b/packages/api/amplify_api/example/pubspec.yaml @@ -6,8 +6,8 @@ description: Demonstrates how to use the amplify_api plugin. publish_to: "none" # Remove this line if you wish to publish to pub.dev environment: - sdk: ^3.4.0 - flutter: ">=3.22.0" + sdk: ^3.5.0 + flutter: ">=3.24.0" dependencies: amplify_api: ">=1.0.0-next.8 <1.0.0-next.9" diff --git a/packages/api/amplify_api/pubspec.yaml b/packages/api/amplify_api/pubspec.yaml index 03826da1bf..1b93bdaeba 100644 --- a/packages/api/amplify_api/pubspec.yaml +++ b/packages/api/amplify_api/pubspec.yaml @@ -6,8 +6,8 @@ repository: https://github.com/aws-amplify/amplify-flutter/tree/main/packages/ap issue_tracker: https://github.com/aws-amplify/amplify-flutter/issues environment: - sdk: ^3.4.0 - flutter: ">=3.22.0" + sdk: ^3.5.0 + flutter: ">=3.24.0" # Helps `pana` since we do not use Flutter plugins for most platforms platforms: diff --git a/packages/api/amplify_api_dart/pubspec.yaml b/packages/api/amplify_api_dart/pubspec.yaml index 57563b6956..83d0042101 100644 --- a/packages/api/amplify_api_dart/pubspec.yaml +++ b/packages/api/amplify_api_dart/pubspec.yaml @@ -6,7 +6,7 @@ repository: https://github.com/aws-amplify/amplify-flutter/tree/main/packages/ap issue_tracker: https://github.com/aws-amplify/amplify-flutter/issues environment: - sdk: ^3.4.0 + sdk: ^3.5.0 dependencies: amplify_core: ">=2.5.0 <2.6.0" diff --git a/packages/auth/amplify_auth_cognito/example/pubspec.yaml b/packages/auth/amplify_auth_cognito/example/pubspec.yaml index cc3761bec2..1ec269e852 100644 --- a/packages/auth/amplify_auth_cognito/example/pubspec.yaml +++ b/packages/auth/amplify_auth_cognito/example/pubspec.yaml @@ -4,8 +4,8 @@ version: 0.1.0 publish_to: none environment: - sdk: ^3.4.0 - flutter: ">=3.22.0" + sdk: ^3.5.0 + flutter: ">=3.24.0" dependencies: amplify_api: any diff --git a/packages/auth/amplify_auth_cognito/pubspec.yaml b/packages/auth/amplify_auth_cognito/pubspec.yaml index 98275618cc..d592e21bbb 100644 --- a/packages/auth/amplify_auth_cognito/pubspec.yaml +++ b/packages/auth/amplify_auth_cognito/pubspec.yaml @@ -6,8 +6,8 @@ repository: https://github.com/aws-amplify/amplify-flutter/tree/main/packages/au issue_tracker: https://github.com/aws-amplify/amplify-flutter/issues environment: - sdk: ^3.4.0 - flutter: ">=3.22.0" + sdk: ^3.5.0 + flutter: ">=3.24.0" # Helps `pana` since we do not use Flutter plugins for most platforms platforms: diff --git a/packages/auth/amplify_auth_cognito_dart/example/pubspec.yaml b/packages/auth/amplify_auth_cognito_dart/example/pubspec.yaml index 81fa66937b..82a7c7f3e8 100644 --- a/packages/auth/amplify_auth_cognito_dart/example/pubspec.yaml +++ b/packages/auth/amplify_auth_cognito_dart/example/pubspec.yaml @@ -4,7 +4,7 @@ version: 1.0.0 publish_to: none environment: - sdk: ^3.4.0 + sdk: ^3.5.0 dependencies: amplify_auth_cognito_dart: any diff --git a/packages/auth/amplify_auth_cognito_dart/pubspec.yaml b/packages/auth/amplify_auth_cognito_dart/pubspec.yaml index 3c23363328..31599ee8d6 100644 --- a/packages/auth/amplify_auth_cognito_dart/pubspec.yaml +++ b/packages/auth/amplify_auth_cognito_dart/pubspec.yaml @@ -6,7 +6,7 @@ repository: https://github.com/aws-amplify/amplify-flutter/tree/next/packages/au issue_tracker: https://github.com/aws-amplify/amplify-flutter/issues environment: - sdk: ^3.4.0 + sdk: ^3.5.0 dependencies: amplify_analytics_pinpoint_dart: ">=0.4.6 <0.5.0" diff --git a/packages/auth/amplify_auth_cognito_test/pubspec.yaml b/packages/auth/amplify_auth_cognito_test/pubspec.yaml index be25f0589f..b83923c63b 100644 --- a/packages/auth/amplify_auth_cognito_test/pubspec.yaml +++ b/packages/auth/amplify_auth_cognito_test/pubspec.yaml @@ -3,7 +3,7 @@ description: Tests for the amplify_auth_cognito_dart package. publish_to: none environment: - sdk: ^3.4.0 + sdk: ^3.5.0 dependencies: amplify_analytics_pinpoint_dart: any diff --git a/packages/authenticator/amplify_authenticator/example/pubspec.yaml b/packages/authenticator/amplify_authenticator/example/pubspec.yaml index c903755a37..27f8a03d82 100644 --- a/packages/authenticator/amplify_authenticator/example/pubspec.yaml +++ b/packages/authenticator/amplify_authenticator/example/pubspec.yaml @@ -18,8 +18,8 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev version: 1.0.0+1 environment: - sdk: ^3.4.0 - flutter: ">=3.22.0" + sdk: ^3.5.0 + flutter: ">=3.24.0" dependencies: amplify_auth_cognito: ">=1.0.0-next.8 <1.0.0-next.9" diff --git a/packages/authenticator/amplify_authenticator/pubspec.yaml b/packages/authenticator/amplify_authenticator/pubspec.yaml index 448bf1ddd6..bfe53ff22e 100644 --- a/packages/authenticator/amplify_authenticator/pubspec.yaml +++ b/packages/authenticator/amplify_authenticator/pubspec.yaml @@ -6,8 +6,8 @@ repository: https://github.com/aws-amplify/amplify-flutter/tree/main/packages/au issue_tracker: https://github.com/aws-amplify/amplify-flutter/issues environment: - sdk: ^3.4.0 - flutter: ">=3.22.0" + sdk: ^3.5.0 + flutter: ">=3.24.0" dependencies: amplify_auth_cognito: ">=2.5.0 <2.6.0" diff --git a/packages/authenticator/amplify_authenticator_test/example/pubspec.yaml b/packages/authenticator/amplify_authenticator_test/example/pubspec.yaml index 085d598ed3..d374325ae5 100644 --- a/packages/authenticator/amplify_authenticator_test/example/pubspec.yaml +++ b/packages/authenticator/amplify_authenticator_test/example/pubspec.yaml @@ -4,8 +4,8 @@ publish_to: "none" version: 0.1.0 environment: - sdk: ^3.4.0 - flutter: ">=3.22.0" + sdk: ^3.5.0 + flutter: ">=3.24.0" dependencies: amplify_authenticator: any diff --git a/packages/authenticator/amplify_authenticator_test/pubspec.yaml b/packages/authenticator/amplify_authenticator_test/pubspec.yaml index 362738206b..f70c1b150e 100644 --- a/packages/authenticator/amplify_authenticator_test/pubspec.yaml +++ b/packages/authenticator/amplify_authenticator_test/pubspec.yaml @@ -4,8 +4,8 @@ version: 0.1.0 publish_to: none environment: - sdk: ^3.4.0 - flutter: ">=3.22.0" + sdk: ^3.5.0 + flutter: ">=3.24.0" dependencies: amplify_authenticator: any diff --git a/packages/aws_common/pubspec.yaml b/packages/aws_common/pubspec.yaml index 72a29a9975..ef4117323f 100644 --- a/packages/aws_common/pubspec.yaml +++ b/packages/aws_common/pubspec.yaml @@ -6,7 +6,7 @@ repository: https://github.com/aws-amplify/amplify-flutter/tree/main/packages/aw issue_tracker: https://github.com/aws-amplify/amplify-flutter/issues environment: - sdk: ^3.4.0 + sdk: ^3.5.0 dependencies: async: ^2.10.0 diff --git a/packages/aws_signature_v4/example/pubspec.yaml b/packages/aws_signature_v4/example/pubspec.yaml index 84fa08f413..4e72002439 100644 --- a/packages/aws_signature_v4/example/pubspec.yaml +++ b/packages/aws_signature_v4/example/pubspec.yaml @@ -2,7 +2,7 @@ name: example publish_to: none environment: - sdk: ^3.4.0 + sdk: ^3.5.0 dependencies: args: ^2.3.0 diff --git a/packages/aws_signature_v4/pubspec.yaml b/packages/aws_signature_v4/pubspec.yaml index 58ec4c5077..74667cd704 100644 --- a/packages/aws_signature_v4/pubspec.yaml +++ b/packages/aws_signature_v4/pubspec.yaml @@ -6,7 +6,7 @@ repository: https://github.com/aws-amplify/amplify-flutter/tree/main/packages/aw issue_tracker: https://github.com/aws-amplify/amplify-flutter/issues environment: - sdk: ^3.4.0 + sdk: ^3.5.0 dependencies: async: ^2.10.0 diff --git a/packages/common/amplify_db_common/example/pubspec.yaml b/packages/common/amplify_db_common/example/pubspec.yaml index 128fba2be3..e4c4963457 100644 --- a/packages/common/amplify_db_common/example/pubspec.yaml +++ b/packages/common/amplify_db_common/example/pubspec.yaml @@ -3,8 +3,8 @@ description: Demonstrates how to use the amplify_db_common plugin. publish_to: "none" environment: - flutter: ">=3.22.0" - sdk: ^3.4.0 + flutter: ">=3.24.0" + sdk: ^3.5.0 dependencies: amplify_db_common: ">=0.4.5 <0.5.0" diff --git a/packages/common/amplify_db_common/pubspec.yaml b/packages/common/amplify_db_common/pubspec.yaml index 8510a2c140..65a5d47065 100644 --- a/packages/common/amplify_db_common/pubspec.yaml +++ b/packages/common/amplify_db_common/pubspec.yaml @@ -6,8 +6,8 @@ repository: https://github.com/aws-amplify/amplify-flutter/tree/main/packages/co issue_tracker: https://github.com/aws-amplify/amplify-flutter/issues environment: - sdk: ^3.4.0 - flutter: ">=3.22.0" + sdk: ^3.5.0 + flutter: ">=3.24.0" dependencies: amplify_db_common_dart: ">=0.4.7 <0.5.0" diff --git a/packages/common/amplify_db_common_dart/example/pubspec.yaml b/packages/common/amplify_db_common_dart/example/pubspec.yaml index 3633d32b26..a604c6ec64 100644 --- a/packages/common/amplify_db_common_dart/example/pubspec.yaml +++ b/packages/common/amplify_db_common_dart/example/pubspec.yaml @@ -7,7 +7,7 @@ version: 0.1.0 publish_to: none environment: - sdk: ^3.4.0 + sdk: ^3.5.0 dependencies: amplify_db_common_dart: ">=0.4.0 <0.5.0" diff --git a/packages/common/amplify_db_common_dart/pubspec.yaml b/packages/common/amplify_db_common_dart/pubspec.yaml index 2ff29398ce..0e9e660bf3 100644 --- a/packages/common/amplify_db_common_dart/pubspec.yaml +++ b/packages/common/amplify_db_common_dart/pubspec.yaml @@ -6,7 +6,7 @@ repository: https://github.com/aws-amplify/amplify-flutter/tree/main/packages/co issue_tracker: https://github.com/aws-amplify/amplify-flutter/issues environment: - sdk: ^3.4.0 + sdk: ^3.5.0 dependencies: amplify_core: ">=2.5.0 <2.6.0" diff --git a/packages/example_common/example/pubspec.yaml b/packages/example_common/example/pubspec.yaml index f50c948067..3f71f5d73a 100644 --- a/packages/example_common/example/pubspec.yaml +++ b/packages/example_common/example/pubspec.yaml @@ -4,7 +4,7 @@ version: 1.0.0 publish_to: none environment: - sdk: ^3.4.0 + sdk: ^3.5.0 dependencies: example_common: diff --git a/packages/example_common/pubspec.yaml b/packages/example_common/pubspec.yaml index 3d88d3bda9..0408c26e4d 100644 --- a/packages/example_common/pubspec.yaml +++ b/packages/example_common/pubspec.yaml @@ -4,7 +4,7 @@ version: 1.0.0 publish_to: none environment: - sdk: ^3.4.0 + sdk: ^3.5.0 dependencies: meta: ^1.7.0 diff --git a/packages/notifications/push/amplify_push_notifications/example/pubspec.yaml b/packages/notifications/push/amplify_push_notifications/example/pubspec.yaml index 5c6c58c399..e73def57d2 100644 --- a/packages/notifications/push/amplify_push_notifications/example/pubspec.yaml +++ b/packages/notifications/push/amplify_push_notifications/example/pubspec.yaml @@ -4,8 +4,8 @@ publish_to: "none" version: 0.1.0 environment: - flutter: ">=3.22.0" - sdk: ^3.4.0 + flutter: ">=3.24.0" + sdk: ^3.5.0 dependencies: amplify_push_notifications: diff --git a/packages/notifications/push/amplify_push_notifications/pubspec.yaml b/packages/notifications/push/amplify_push_notifications/pubspec.yaml index bc59b7af82..c52ee74aab 100644 --- a/packages/notifications/push/amplify_push_notifications/pubspec.yaml +++ b/packages/notifications/push/amplify_push_notifications/pubspec.yaml @@ -5,8 +5,8 @@ homepage: https://docs.amplify.aws/lib/q/platform/flutter/ issue_tracker: https://github.com/aws-amplify/amplify-flutter/issues environment: - sdk: ^3.4.0 - flutter: ">=3.22.0" + sdk: ^3.5.0 + flutter: ">=3.24.0" dependencies: amplify_core: ">=2.5.0 <2.6.0" diff --git a/packages/notifications/push/amplify_push_notifications_pinpoint/example/pubspec.yaml b/packages/notifications/push/amplify_push_notifications_pinpoint/example/pubspec.yaml index 7984ec2536..60e8d56751 100644 --- a/packages/notifications/push/amplify_push_notifications_pinpoint/example/pubspec.yaml +++ b/packages/notifications/push/amplify_push_notifications_pinpoint/example/pubspec.yaml @@ -3,8 +3,8 @@ description: Demonstrates how to use the amplify_push_notifications_pinpoint plu publish_to: "none" # Remove this line if you wish to publish to pub.dev environment: - sdk: ^3.4.0 - flutter: ">=3.22.0" + sdk: ^3.5.0 + flutter: ">=3.24.0" dependencies: amplify_auth_cognito: ">=1.0.0-next.8 <1.0.0-next.9" diff --git a/packages/notifications/push/amplify_push_notifications_pinpoint/pubspec.yaml b/packages/notifications/push/amplify_push_notifications_pinpoint/pubspec.yaml index f44443aef6..318fe21eeb 100644 --- a/packages/notifications/push/amplify_push_notifications_pinpoint/pubspec.yaml +++ b/packages/notifications/push/amplify_push_notifications_pinpoint/pubspec.yaml @@ -5,8 +5,8 @@ homepage: https://docs.amplify.aws/lib/q/platform/flutter/ issue_tracker: https://github.com/aws-amplify/amplify-flutter/issues environment: - sdk: ^3.4.0 - flutter: ">=3.22.0" + sdk: ^3.5.0 + flutter: ">=3.24.0" # Helps `pana` since it does not detect Android support. platforms: diff --git a/packages/secure_storage/amplify_secure_storage/example/pubspec.yaml b/packages/secure_storage/amplify_secure_storage/example/pubspec.yaml index 058372015d..d97a636dba 100644 --- a/packages/secure_storage/amplify_secure_storage/example/pubspec.yaml +++ b/packages/secure_storage/amplify_secure_storage/example/pubspec.yaml @@ -4,8 +4,8 @@ description: Demonstrates how to use the amplify_secure_storage plugin and house publish_to: "none" environment: - sdk: ^3.4.0 - flutter: ">=3.22.0" + sdk: ^3.5.0 + flutter: ">=3.24.0" dependencies: amplify_secure_storage: ">=0.3.0 <0.4.0" diff --git a/packages/secure_storage/amplify_secure_storage/pubspec.yaml b/packages/secure_storage/amplify_secure_storage/pubspec.yaml index a468072e55..3904e2497b 100644 --- a/packages/secure_storage/amplify_secure_storage/pubspec.yaml +++ b/packages/secure_storage/amplify_secure_storage/pubspec.yaml @@ -6,8 +6,8 @@ repository: https://github.com/aws-amplify/amplify-flutter/tree/main/packages/se issue_tracker: https://github.com/aws-amplify/amplify-flutter/issues environment: - sdk: ^3.4.0 - flutter: ">=3.22.0" + sdk: ^3.5.0 + flutter: ">=3.24.0" dependencies: amplify_secure_storage_dart: ">=0.5.3 <0.6.0" diff --git a/packages/secure_storage/amplify_secure_storage_dart/example/pubspec.yaml b/packages/secure_storage/amplify_secure_storage_dart/example/pubspec.yaml index e7e79c81c8..0554022373 100644 --- a/packages/secure_storage/amplify_secure_storage_dart/example/pubspec.yaml +++ b/packages/secure_storage/amplify_secure_storage_dart/example/pubspec.yaml @@ -7,7 +7,7 @@ version: 1.0.0 publish_to: none environment: - sdk: ^3.4.0 + sdk: ^3.5.0 dependencies: amplify_secure_storage_dart: ">=0.5.3 <0.6.0" diff --git a/packages/secure_storage/amplify_secure_storage_dart/pubspec.yaml b/packages/secure_storage/amplify_secure_storage_dart/pubspec.yaml index c58e6e3df5..33663cdfa1 100644 --- a/packages/secure_storage/amplify_secure_storage_dart/pubspec.yaml +++ b/packages/secure_storage/amplify_secure_storage_dart/pubspec.yaml @@ -6,7 +6,7 @@ repository: https://github.com/aws-amplify/amplify-flutter/tree/main/packages/se issue_tracker: https://github.com/aws-amplify/amplify-flutter/issues environment: - sdk: ^3.4.0 + sdk: ^3.5.0 # Explicitly declare platform support to help `pana` platforms: diff --git a/packages/secure_storage/amplify_secure_storage_test/pubspec.yaml b/packages/secure_storage/amplify_secure_storage_test/pubspec.yaml index ffba2fc209..e245d78794 100644 --- a/packages/secure_storage/amplify_secure_storage_test/pubspec.yaml +++ b/packages/secure_storage/amplify_secure_storage_test/pubspec.yaml @@ -4,7 +4,7 @@ version: 0.1.0 publish_to: none environment: - sdk: ^3.4.0 + sdk: ^3.5.0 dependencies: amplify_secure_storage_dart: any diff --git a/packages/smithy/goldens/lib/awsJson1_0/pubspec.yaml b/packages/smithy/goldens/lib/awsJson1_0/pubspec.yaml index 25567bf41e..acff67936b 100644 --- a/packages/smithy/goldens/lib/awsJson1_0/pubspec.yaml +++ b/packages/smithy/goldens/lib/awsJson1_0/pubspec.yaml @@ -4,7 +4,7 @@ version: 0.1.0 publish_to: none environment: - sdk: ^3.4.0 + sdk: ^3.5.0 dependencies: smithy: diff --git a/packages/smithy/goldens/lib/awsJson1_1/pubspec.yaml b/packages/smithy/goldens/lib/awsJson1_1/pubspec.yaml index 602c16484c..7dbbb6cc50 100644 --- a/packages/smithy/goldens/lib/awsJson1_1/pubspec.yaml +++ b/packages/smithy/goldens/lib/awsJson1_1/pubspec.yaml @@ -4,7 +4,7 @@ version: 0.1.0 publish_to: none environment: - sdk: ^3.4.0 + sdk: ^3.5.0 dependencies: smithy: diff --git a/packages/smithy/goldens/lib/awsQuery/pubspec.yaml b/packages/smithy/goldens/lib/awsQuery/pubspec.yaml index ed480fb544..f2c4772480 100644 --- a/packages/smithy/goldens/lib/awsQuery/pubspec.yaml +++ b/packages/smithy/goldens/lib/awsQuery/pubspec.yaml @@ -4,7 +4,7 @@ version: 0.1.0 publish_to: none environment: - sdk: ^3.4.0 + sdk: ^3.5.0 dependencies: smithy: diff --git a/packages/smithy/goldens/lib/ec2Query/pubspec.yaml b/packages/smithy/goldens/lib/ec2Query/pubspec.yaml index 70a81c4ad3..42d1905aba 100644 --- a/packages/smithy/goldens/lib/ec2Query/pubspec.yaml +++ b/packages/smithy/goldens/lib/ec2Query/pubspec.yaml @@ -4,7 +4,7 @@ version: 0.1.0 publish_to: none environment: - sdk: ^3.4.0 + sdk: ^3.5.0 dependencies: smithy: diff --git a/packages/smithy/goldens/lib/restJson1/pubspec.yaml b/packages/smithy/goldens/lib/restJson1/pubspec.yaml index 588017fbef..0015d66d73 100644 --- a/packages/smithy/goldens/lib/restJson1/pubspec.yaml +++ b/packages/smithy/goldens/lib/restJson1/pubspec.yaml @@ -4,7 +4,7 @@ version: 0.1.0 publish_to: none environment: - sdk: ^3.4.0 + sdk: ^3.5.0 dependencies: smithy: diff --git a/packages/smithy/goldens/lib/restXml/pubspec.yaml b/packages/smithy/goldens/lib/restXml/pubspec.yaml index 8ae76ce6e3..65897ecf23 100644 --- a/packages/smithy/goldens/lib/restXml/pubspec.yaml +++ b/packages/smithy/goldens/lib/restXml/pubspec.yaml @@ -4,7 +4,7 @@ version: 0.1.0 publish_to: none environment: - sdk: ^3.4.0 + sdk: ^3.5.0 dependencies: smithy: diff --git a/packages/smithy/goldens/lib/restXmlWithNamespace/pubspec.yaml b/packages/smithy/goldens/lib/restXmlWithNamespace/pubspec.yaml index 148914b627..5b6306fb00 100644 --- a/packages/smithy/goldens/lib/restXmlWithNamespace/pubspec.yaml +++ b/packages/smithy/goldens/lib/restXmlWithNamespace/pubspec.yaml @@ -4,7 +4,7 @@ version: 0.1.0 publish_to: none environment: - sdk: ^3.4.0 + sdk: ^3.5.0 dependencies: smithy: diff --git a/packages/smithy/goldens/lib2/awsJson1_0/pubspec.yaml b/packages/smithy/goldens/lib2/awsJson1_0/pubspec.yaml index 21493c5214..d5f2403f37 100644 --- a/packages/smithy/goldens/lib2/awsJson1_0/pubspec.yaml +++ b/packages/smithy/goldens/lib2/awsJson1_0/pubspec.yaml @@ -4,7 +4,7 @@ version: 0.1.0 publish_to: none environment: - sdk: ^3.4.0 + sdk: ^3.5.0 dependencies: smithy: diff --git a/packages/smithy/goldens/lib2/awsJson1_1/pubspec.yaml b/packages/smithy/goldens/lib2/awsJson1_1/pubspec.yaml index c306ddf774..51cf732a6c 100644 --- a/packages/smithy/goldens/lib2/awsJson1_1/pubspec.yaml +++ b/packages/smithy/goldens/lib2/awsJson1_1/pubspec.yaml @@ -4,7 +4,7 @@ version: 0.1.0 publish_to: none environment: - sdk: ^3.4.0 + sdk: ^3.5.0 dependencies: smithy: diff --git a/packages/smithy/goldens/lib2/awsQuery/pubspec.yaml b/packages/smithy/goldens/lib2/awsQuery/pubspec.yaml index 48ca68f30a..9ef236dba2 100644 --- a/packages/smithy/goldens/lib2/awsQuery/pubspec.yaml +++ b/packages/smithy/goldens/lib2/awsQuery/pubspec.yaml @@ -4,7 +4,7 @@ version: 0.1.0 publish_to: none environment: - sdk: ^3.4.0 + sdk: ^3.5.0 dependencies: smithy: diff --git a/packages/smithy/goldens/lib2/custom/pubspec.yaml b/packages/smithy/goldens/lib2/custom/pubspec.yaml index a8b261db3a..33fa3635ed 100644 --- a/packages/smithy/goldens/lib2/custom/pubspec.yaml +++ b/packages/smithy/goldens/lib2/custom/pubspec.yaml @@ -4,7 +4,7 @@ version: 0.1.0 publish_to: none environment: - sdk: ^3.4.0 + sdk: ^3.5.0 dependencies: smithy: diff --git a/packages/smithy/goldens/lib2/ec2Query/pubspec.yaml b/packages/smithy/goldens/lib2/ec2Query/pubspec.yaml index 7ea65be341..46c7b17ae7 100644 --- a/packages/smithy/goldens/lib2/ec2Query/pubspec.yaml +++ b/packages/smithy/goldens/lib2/ec2Query/pubspec.yaml @@ -4,7 +4,7 @@ version: 0.1.0 publish_to: none environment: - sdk: ^3.4.0 + sdk: ^3.5.0 dependencies: smithy: diff --git a/packages/smithy/goldens/lib2/restJson1/pubspec.yaml b/packages/smithy/goldens/lib2/restJson1/pubspec.yaml index a5cad030d2..7dec58883b 100644 --- a/packages/smithy/goldens/lib2/restJson1/pubspec.yaml +++ b/packages/smithy/goldens/lib2/restJson1/pubspec.yaml @@ -4,7 +4,7 @@ version: 0.1.0 publish_to: none environment: - sdk: ^3.4.0 + sdk: ^3.5.0 dependencies: smithy: diff --git a/packages/smithy/goldens/lib2/restXml/pubspec.yaml b/packages/smithy/goldens/lib2/restXml/pubspec.yaml index 6a8af6a8c5..7af3871076 100644 --- a/packages/smithy/goldens/lib2/restXml/pubspec.yaml +++ b/packages/smithy/goldens/lib2/restXml/pubspec.yaml @@ -4,7 +4,7 @@ version: 0.1.0 publish_to: none environment: - sdk: ^3.4.0 + sdk: ^3.5.0 dependencies: smithy: diff --git a/packages/smithy/goldens/lib2/restXmlWithNamespace/pubspec.yaml b/packages/smithy/goldens/lib2/restXmlWithNamespace/pubspec.yaml index 65ab9dcdfa..2f8d53c4fe 100644 --- a/packages/smithy/goldens/lib2/restXmlWithNamespace/pubspec.yaml +++ b/packages/smithy/goldens/lib2/restXmlWithNamespace/pubspec.yaml @@ -4,7 +4,7 @@ version: 0.1.0 publish_to: none environment: - sdk: ^3.4.0 + sdk: ^3.5.0 dependencies: smithy: diff --git a/packages/smithy/goldens/pubspec.yaml b/packages/smithy/goldens/pubspec.yaml index 08994522a0..aec8955bb7 100644 --- a/packages/smithy/goldens/pubspec.yaml +++ b/packages/smithy/goldens/pubspec.yaml @@ -4,7 +4,7 @@ version: 1.0.0 publish_to: none environment: - sdk: ^3.4.0 + sdk: ^3.5.0 dependencies: aws_common: ^0.5.0+2 diff --git a/packages/smithy/smithy/pubspec.yaml b/packages/smithy/smithy/pubspec.yaml index 0602adba1a..217585bece 100644 --- a/packages/smithy/smithy/pubspec.yaml +++ b/packages/smithy/smithy/pubspec.yaml @@ -6,7 +6,7 @@ repository: https://github.com/aws-amplify/amplify-flutter/tree/main/packages/sm issue_tracker: https://github.com/aws-amplify/amplify-flutter/issues environment: - sdk: ^3.4.0 + sdk: ^3.5.0 dependencies: async: ^2.10.0 diff --git a/packages/smithy/smithy_aws/pubspec.yaml b/packages/smithy/smithy_aws/pubspec.yaml index 389a6f0677..164553b0f7 100644 --- a/packages/smithy/smithy_aws/pubspec.yaml +++ b/packages/smithy/smithy_aws/pubspec.yaml @@ -6,7 +6,7 @@ repository: https://github.com/aws-amplify/amplify-flutter/tree/main/packages/sm issue_tracker: https://github.com/aws-amplify/amplify-flutter/issues environment: - sdk: ^3.4.0 + sdk: ^3.5.0 dependencies: aws_common: ">=0.7.3 <0.8.0" diff --git a/packages/smithy/smithy_codegen/pubspec.yaml b/packages/smithy/smithy_codegen/pubspec.yaml index 7dc8513333..2464b0b94f 100644 --- a/packages/smithy/smithy_codegen/pubspec.yaml +++ b/packages/smithy/smithy_codegen/pubspec.yaml @@ -5,7 +5,7 @@ repository: https://github.com/aws-amplify/amplify-flutter/tree/main/packages/sm publish_to: none environment: - sdk: ^3.4.0 + sdk: ^3.5.0 dependencies: args: ^2.3.0 diff --git a/packages/smithy/smithy_test/pubspec.yaml b/packages/smithy/smithy_test/pubspec.yaml index 88d531d5d2..8b10eb2b0b 100644 --- a/packages/smithy/smithy_test/pubspec.yaml +++ b/packages/smithy/smithy_test/pubspec.yaml @@ -5,7 +5,7 @@ repository: https://github.com/aws-amplify/amplify-flutter/tree/main/packages/sm publish_to: none environment: - sdk: ^3.4.0 + sdk: ^3.5.0 dependencies: async: ^2.10.0 diff --git a/packages/storage/amplify_storage_s3/example/pubspec.yaml b/packages/storage/amplify_storage_s3/example/pubspec.yaml index 8eaad034e3..0ae6c7bfbf 100644 --- a/packages/storage/amplify_storage_s3/example/pubspec.yaml +++ b/packages/storage/amplify_storage_s3/example/pubspec.yaml @@ -4,8 +4,8 @@ version: 0.1.0 publish_to: none environment: - sdk: ^3.4.0 - flutter: ">=3.22.0" + sdk: ^3.5.0 + flutter: ">=3.24.0" dependencies: amplify_auth_cognito: any diff --git a/packages/storage/amplify_storage_s3/pubspec.yaml b/packages/storage/amplify_storage_s3/pubspec.yaml index 5ef3ef34da..836aa4c9cc 100644 --- a/packages/storage/amplify_storage_s3/pubspec.yaml +++ b/packages/storage/amplify_storage_s3/pubspec.yaml @@ -6,8 +6,8 @@ repository: https://github.com/aws-amplify/amplify-flutter/tree/main/packages/st issue_tracker: https://github.com/aws-amplify/amplify-flutter/issues environment: - sdk: ^3.4.0 - flutter: ">=3.22.0" + sdk: ^3.5.0 + flutter: ">=3.24.0" # Helps `pana` since we do not use Flutter plugins for most platforms platforms: diff --git a/packages/storage/amplify_storage_s3_dart/example/pubspec.yaml b/packages/storage/amplify_storage_s3_dart/example/pubspec.yaml index c0d5e9e10f..5ae843fd23 100644 --- a/packages/storage/amplify_storage_s3_dart/example/pubspec.yaml +++ b/packages/storage/amplify_storage_s3_dart/example/pubspec.yaml @@ -4,7 +4,7 @@ version: 1.0.0 publish_to: none environment: - sdk: ^3.4.0 + sdk: ^3.5.0 dependencies: amplify_auth_cognito_dart: any diff --git a/packages/storage/amplify_storage_s3_dart/pubspec.yaml b/packages/storage/amplify_storage_s3_dart/pubspec.yaml index b4410651f1..ba60653254 100644 --- a/packages/storage/amplify_storage_s3_dart/pubspec.yaml +++ b/packages/storage/amplify_storage_s3_dart/pubspec.yaml @@ -6,7 +6,7 @@ repository: https://github.com/aws-amplify/amplify-flutter/tree/main/packages/st issue_tracker: https://github.com/aws-amplify/amplify-flutter/issues environment: - sdk: ^3.4.0 + sdk: ^3.5.0 dependencies: amplify_core: ">=2.5.0 <2.6.0" diff --git a/packages/test/amplify_auth_integration_test/pubspec.yaml b/packages/test/amplify_auth_integration_test/pubspec.yaml index e8e101ec85..cf293d627e 100644 --- a/packages/test/amplify_auth_integration_test/pubspec.yaml +++ b/packages/test/amplify_auth_integration_test/pubspec.yaml @@ -6,8 +6,8 @@ issue_tracker: https://github.com/aws-amplify/amplify-flutter/issues publish_to: none environment: - sdk: ^3.4.0 - flutter: ">=3.22.0" + sdk: ^3.5.0 + flutter: ">=3.24.0" dependencies: amplify_api: any diff --git a/packages/test/amplify_integration_test/pubspec.yaml b/packages/test/amplify_integration_test/pubspec.yaml index 53a42df6fb..ed25e384b9 100644 --- a/packages/test/amplify_integration_test/pubspec.yaml +++ b/packages/test/amplify_integration_test/pubspec.yaml @@ -4,7 +4,7 @@ homepage: https://github.com/aws-amplify/amplify-flutter publish_to: none environment: - sdk: ^3.4.0 + sdk: ^3.5.0 dependencies: amplify_auth_cognito_dart: any diff --git a/packages/test/amplify_test/pubspec.yaml b/packages/test/amplify_test/pubspec.yaml index a6f5ae648f..2ed2a05aca 100644 --- a/packages/test/amplify_test/pubspec.yaml +++ b/packages/test/amplify_test/pubspec.yaml @@ -4,7 +4,7 @@ homepage: https://github.com/aws-amplify/amplify-flutter publish_to: none environment: - sdk: ^3.4.0 + sdk: ^3.5.0 dependencies: amplify_core: any diff --git a/packages/test/pub_server/pubspec.yaml b/packages/test/pub_server/pubspec.yaml index 04a622a671..f935e3406c 100644 --- a/packages/test/pub_server/pubspec.yaml +++ b/packages/test/pub_server/pubspec.yaml @@ -6,7 +6,7 @@ issue_tracker: https://github.com/aws-amplify/amplify-flutter/issues publish_to: none environment: - sdk: ^3.4.0 + sdk: ^3.5.0 dependencies: archive: ^3.3.7 diff --git a/packages/worker_bee/e2e/pubspec.yaml b/packages/worker_bee/e2e/pubspec.yaml index 4817c6181e..620cf134d5 100644 --- a/packages/worker_bee/e2e/pubspec.yaml +++ b/packages/worker_bee/e2e/pubspec.yaml @@ -3,7 +3,7 @@ description: E2E tests for the worker_bee package. publish_to: none environment: - sdk: ^3.4.0 + sdk: ^3.5.0 dependencies: aws_common: ">=0.4.0 <0.5.0" diff --git a/packages/worker_bee/e2e_flutter_test/pubspec.yaml b/packages/worker_bee/e2e_flutter_test/pubspec.yaml index efebc0ab52..82e703d099 100644 --- a/packages/worker_bee/e2e_flutter_test/pubspec.yaml +++ b/packages/worker_bee/e2e_flutter_test/pubspec.yaml @@ -4,8 +4,8 @@ publish_to: 'none' version: 1.0.0+1 environment: - flutter: ">=3.22.0" - sdk: ^3.4.0 + flutter: ">=3.24.0" + sdk: ^3.5.0 dependencies: e2e: diff --git a/packages/worker_bee/e2e_test/pubspec.yaml b/packages/worker_bee/e2e_test/pubspec.yaml index c6a7f34e24..a8dd17998c 100644 --- a/packages/worker_bee/e2e_test/pubspec.yaml +++ b/packages/worker_bee/e2e_test/pubspec.yaml @@ -3,7 +3,7 @@ description: E2E tests for the worker_bee package. publish_to: none environment: - sdk: ^3.4.0 + sdk: ^3.5.0 dependency_overrides: aws_common: diff --git a/packages/worker_bee/worker_bee/pubspec.yaml b/packages/worker_bee/worker_bee/pubspec.yaml index b9c4200a8a..ea3b583bc4 100644 --- a/packages/worker_bee/worker_bee/pubspec.yaml +++ b/packages/worker_bee/worker_bee/pubspec.yaml @@ -6,7 +6,7 @@ repository: https://github.com/aws-amplify/amplify-flutter/tree/main/packages/wo issue_tracker: https://github.com/aws-amplify/amplify-flutter/issues environment: - sdk: ^3.4.0 + sdk: ^3.5.0 dependencies: async: ^2.10.0 diff --git a/packages/worker_bee/worker_bee_builder/pubspec.yaml b/packages/worker_bee/worker_bee_builder/pubspec.yaml index ae95b79a35..8fd8a0d71f 100644 --- a/packages/worker_bee/worker_bee_builder/pubspec.yaml +++ b/packages/worker_bee/worker_bee_builder/pubspec.yaml @@ -6,7 +6,7 @@ repository: https://github.com/aws-amplify/amplify-flutter/tree/main/packages/wo issue_tracker: https://github.com/aws-amplify/amplify-flutter/issues environment: - sdk: ^3.4.0 + sdk: ^3.5.0 dependencies: analyzer: ">=5.1.0 <7.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index 3b8963f421..0fab0250ca 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -3,8 +3,8 @@ publish_to: none # The current constraints for Dart and Flutter SDKs. environment: - sdk: ^3.4.0 - flutter: ">=3.22.0" + sdk: ^3.5.0 + flutter: ">=3.24.0" # Global dependency versions for third-party dependencies of # Amplify Flutter projects. These represent the values which diff --git a/templates/dart-package/hooks/pubspec.yaml b/templates/dart-package/hooks/pubspec.yaml index d2d361c6db..10efac4bc1 100644 --- a/templates/dart-package/hooks/pubspec.yaml +++ b/templates/dart-package/hooks/pubspec.yaml @@ -2,7 +2,7 @@ name: dart_package_hooks publish_to: none environment: - sdk: ^3.4.0 + sdk: ^3.5.0 dependencies: mason: ">=0.1.0-dev.40 <0.1.0" diff --git a/templates/flutter-package/hooks/pubspec.yaml b/templates/flutter-package/hooks/pubspec.yaml index e523c6f82e..56ab088968 100644 --- a/templates/flutter-package/hooks/pubspec.yaml +++ b/templates/flutter-package/hooks/pubspec.yaml @@ -2,7 +2,7 @@ name: flutter_package_hooks publish_to: none environment: - sdk: ^3.4.0 + sdk: ^3.5.0 dependencies: mason: ">=0.1.0-dev.40 <0.1.0" From e46de3815e43cfc6c782a274453c90e3cac8e76b Mon Sep 17 00:00:00 2001 From: Tyler-Larkin Date: Wed, 4 Dec 2024 14:06:05 -0800 Subject: [PATCH 08/11] chore(analytics): regenerated Drift databases and tables --- .../drift/drift_queued_item_store.g.dart | 154 +++++++++++------- .../lib/src/version.dart | 2 +- 2 files changed, 99 insertions(+), 57 deletions(-) diff --git a/packages/analytics/amplify_analytics_pinpoint_dart/lib/src/impl/analytics_client/event_client/queued_item_store/drift/drift_queued_item_store.g.dart b/packages/analytics/amplify_analytics_pinpoint_dart/lib/src/impl/analytics_client/event_client/queued_item_store/drift/drift_queued_item_store.g.dart index 6b83c0e9a9..05eb825427 100644 --- a/packages/analytics/amplify_analytics_pinpoint_dart/lib/src/impl/analytics_client/event_client/queued_item_store/drift/drift_queued_item_store.g.dart +++ b/packages/analytics/amplify_analytics_pinpoint_dart/lib/src/impl/analytics_client/event_client/queued_item_store/drift/drift_queued_item_store.g.dart @@ -109,6 +109,13 @@ class DriftQueuedItem extends DataClass implements Insertable { id: id ?? this.id, value: value ?? this.value, ); + DriftQueuedItem copyWithCompanion(DriftQueuedItemsCompanion data) { + return DriftQueuedItem( + id: data.id.present ? data.id.value : this.id, + value: data.value.present ? data.value.value : this.value, + ); + } + @override String toString() { return (StringBuffer('DriftQueuedItem(') @@ -180,8 +187,8 @@ class DriftQueuedItemsCompanion extends UpdateCompanion { abstract class _$DriftQueuedItemStore extends GeneratedDatabase { _$DriftQueuedItemStore(QueryExecutor e) : super(e); - _$DriftQueuedItemStoreManager get managers => - _$DriftQueuedItemStoreManager(this); + $DriftQueuedItemStoreManager get managers => + $DriftQueuedItemStoreManager(this); late final $DriftQueuedItemsTable driftQueuedItems = $DriftQueuedItemsTable(this); @override @@ -191,7 +198,7 @@ abstract class _$DriftQueuedItemStore extends GeneratedDatabase { List get allSchemaEntities => [driftQueuedItems]; } -typedef $$DriftQueuedItemsTableInsertCompanionBuilder +typedef $$DriftQueuedItemsTableCreateCompanionBuilder = DriftQueuedItemsCompanion Function({ Value id, required String value, @@ -202,27 +209,82 @@ typedef $$DriftQueuedItemsTableUpdateCompanionBuilder Value value, }); +class $$DriftQueuedItemsTableFilterComposer + extends Composer<_$DriftQueuedItemStore, $DriftQueuedItemsTable> { + $$DriftQueuedItemsTableFilterComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + ColumnFilters get id => $composableBuilder( + column: $table.id, builder: (column) => ColumnFilters(column)); + + ColumnFilters get value => $composableBuilder( + column: $table.value, builder: (column) => ColumnFilters(column)); +} + +class $$DriftQueuedItemsTableOrderingComposer + extends Composer<_$DriftQueuedItemStore, $DriftQueuedItemsTable> { + $$DriftQueuedItemsTableOrderingComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + ColumnOrderings get id => $composableBuilder( + column: $table.id, builder: (column) => ColumnOrderings(column)); + + ColumnOrderings get value => $composableBuilder( + column: $table.value, builder: (column) => ColumnOrderings(column)); +} + +class $$DriftQueuedItemsTableAnnotationComposer + extends Composer<_$DriftQueuedItemStore, $DriftQueuedItemsTable> { + $$DriftQueuedItemsTableAnnotationComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + GeneratedColumn get id => + $composableBuilder(column: $table.id, builder: (column) => column); + + GeneratedColumn get value => + $composableBuilder(column: $table.value, builder: (column) => column); +} + class $$DriftQueuedItemsTableTableManager extends RootTableManager< _$DriftQueuedItemStore, $DriftQueuedItemsTable, DriftQueuedItem, $$DriftQueuedItemsTableFilterComposer, $$DriftQueuedItemsTableOrderingComposer, - $$DriftQueuedItemsTableProcessedTableManager, - $$DriftQueuedItemsTableInsertCompanionBuilder, - $$DriftQueuedItemsTableUpdateCompanionBuilder> { + $$DriftQueuedItemsTableAnnotationComposer, + $$DriftQueuedItemsTableCreateCompanionBuilder, + $$DriftQueuedItemsTableUpdateCompanionBuilder, + ( + DriftQueuedItem, + BaseReferences<_$DriftQueuedItemStore, $DriftQueuedItemsTable, + DriftQueuedItem> + ), + DriftQueuedItem, + PrefetchHooks Function()> { $$DriftQueuedItemsTableTableManager( _$DriftQueuedItemStore db, $DriftQueuedItemsTable table) : super(TableManagerState( db: db, table: table, - filteringComposer: - $$DriftQueuedItemsTableFilterComposer(ComposerState(db, table)), - orderingComposer: - $$DriftQueuedItemsTableOrderingComposer(ComposerState(db, table)), - getChildManagerBuilder: (p) => - $$DriftQueuedItemsTableProcessedTableManager(p), - getUpdateCompanionBuilder: ({ + createFilteringComposer: () => + $$DriftQueuedItemsTableFilterComposer($db: db, $table: table), + createOrderingComposer: () => + $$DriftQueuedItemsTableOrderingComposer($db: db, $table: table), + createComputedFieldComposer: () => + $$DriftQueuedItemsTableAnnotationComposer($db: db, $table: table), + updateCompanionCallback: ({ Value id = const Value.absent(), Value value = const Value.absent(), }) => @@ -230,7 +292,7 @@ class $$DriftQueuedItemsTableTableManager extends RootTableManager< id: id, value: value, ), - getInsertCompanionBuilder: ({ + createCompanionCallback: ({ Value id = const Value.absent(), required String value, }) => @@ -238,53 +300,33 @@ class $$DriftQueuedItemsTableTableManager extends RootTableManager< id: id, value: value, ), + withReferenceMapper: (p0) => p0 + .map((e) => (e.readTable(table), BaseReferences(db, table, e))) + .toList(), + prefetchHooksCallback: null, )); } -class $$DriftQueuedItemsTableProcessedTableManager - extends ProcessedTableManager< - _$DriftQueuedItemStore, - $DriftQueuedItemsTable, - DriftQueuedItem, - $$DriftQueuedItemsTableFilterComposer, - $$DriftQueuedItemsTableOrderingComposer, - $$DriftQueuedItemsTableProcessedTableManager, - $$DriftQueuedItemsTableInsertCompanionBuilder, - $$DriftQueuedItemsTableUpdateCompanionBuilder> { - $$DriftQueuedItemsTableProcessedTableManager(super.$state); -} - -class $$DriftQueuedItemsTableFilterComposer - extends FilterComposer<_$DriftQueuedItemStore, $DriftQueuedItemsTable> { - $$DriftQueuedItemsTableFilterComposer(super.$state); - ColumnFilters get id => $state.composableBuilder( - column: $state.table.id, - builder: (column, joinBuilders) => - ColumnFilters(column, joinBuilders: joinBuilders)); - - ColumnFilters get value => $state.composableBuilder( - column: $state.table.value, - builder: (column, joinBuilders) => - ColumnFilters(column, joinBuilders: joinBuilders)); -} - -class $$DriftQueuedItemsTableOrderingComposer - extends OrderingComposer<_$DriftQueuedItemStore, $DriftQueuedItemsTable> { - $$DriftQueuedItemsTableOrderingComposer(super.$state); - ColumnOrderings get id => $state.composableBuilder( - column: $state.table.id, - builder: (column, joinBuilders) => - ColumnOrderings(column, joinBuilders: joinBuilders)); - - ColumnOrderings get value => $state.composableBuilder( - column: $state.table.value, - builder: (column, joinBuilders) => - ColumnOrderings(column, joinBuilders: joinBuilders)); -} +typedef $$DriftQueuedItemsTableProcessedTableManager = ProcessedTableManager< + _$DriftQueuedItemStore, + $DriftQueuedItemsTable, + DriftQueuedItem, + $$DriftQueuedItemsTableFilterComposer, + $$DriftQueuedItemsTableOrderingComposer, + $$DriftQueuedItemsTableAnnotationComposer, + $$DriftQueuedItemsTableCreateCompanionBuilder, + $$DriftQueuedItemsTableUpdateCompanionBuilder, + ( + DriftQueuedItem, + BaseReferences<_$DriftQueuedItemStore, $DriftQueuedItemsTable, + DriftQueuedItem> + ), + DriftQueuedItem, + PrefetchHooks Function()>; -class _$DriftQueuedItemStoreManager { +class $DriftQueuedItemStoreManager { final _$DriftQueuedItemStore _db; - _$DriftQueuedItemStoreManager(this._db); + $DriftQueuedItemStoreManager(this._db); $$DriftQueuedItemsTableTableManager get driftQueuedItems => $$DriftQueuedItemsTableTableManager(_db, _db.driftQueuedItems); } diff --git a/packages/analytics/amplify_analytics_pinpoint_dart/lib/src/version.dart b/packages/analytics/amplify_analytics_pinpoint_dart/lib/src/version.dart index 8193e3ca48..43354d9825 100644 --- a/packages/analytics/amplify_analytics_pinpoint_dart/lib/src/version.dart +++ b/packages/analytics/amplify_analytics_pinpoint_dart/lib/src/version.dart @@ -1,2 +1,2 @@ // Generated code. Do not modify. -const packageVersion = '0.4.5'; +const packageVersion = '0.4.6'; From 4033a702e60fa74ef4ef3fec23885f58d7f9b5b6 Mon Sep 17 00:00:00 2001 From: Tyler-Larkin Date: Wed, 4 Dec 2024 14:06:57 -0800 Subject: [PATCH 09/11] chore(analytics): updated pinpoint native pigeon breaking changes --- .../AmplifyAnalyticsPinpointPlugin.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/analytics/amplify_analytics_pinpoint/android/src/main/kotlin/com/amazonaws/amplify/amplify_analytics_pinpoint/AmplifyAnalyticsPinpointPlugin.kt b/packages/analytics/amplify_analytics_pinpoint/android/src/main/kotlin/com/amazonaws/amplify/amplify_analytics_pinpoint/AmplifyAnalyticsPinpointPlugin.kt index 8edcab6d05..0a090706ca 100644 --- a/packages/analytics/amplify_analytics_pinpoint/android/src/main/kotlin/com/amazonaws/amplify/amplify_analytics_pinpoint/AmplifyAnalyticsPinpointPlugin.kt +++ b/packages/analytics/amplify_analytics_pinpoint/android/src/main/kotlin/com/amazonaws/amplify/amplify_analytics_pinpoint/AmplifyAnalyticsPinpointPlugin.kt @@ -19,15 +19,15 @@ class AmplifyAnalyticsPinpointPlugin: FlutterPlugin, Messages.PinpointLegacyData override fun onAttachedToEngine(binding: FlutterPlugin.FlutterPluginBinding) { context = binding.applicationContext - Messages.PinpointLegacyDataProvider.setup(binding.binaryMessenger, this) + Messages.PinpointLegacyDataProvider.setUp(binding.binaryMessenger, this) } override fun onDetachedFromEngine(binding: FlutterPlugin.FlutterPluginBinding) { - Messages.PinpointLegacyDataProvider.setup(binding.binaryMessenger, null) + Messages.PinpointLegacyDataProvider.setUp(binding.binaryMessenger, null) context = null } - override fun getEndpointId(pinpointAppId: String, result: Messages.Result){ + override fun getEndpointId(pinpointAppId: String, result: Messages.NullableResult){ if (context == null) { result.error(Exception("Application context is null")) return From ae55ce72cc2f84956993282ac1e72be945f2bc55 Mon Sep 17 00:00:00 2001 From: Tyler-Larkin Date: Wed, 4 Dec 2024 14:07:58 -0800 Subject: [PATCH 10/11] chore(notifications): updated native pigeon breaking changes --- .../AmplifyLifecycleObserver.kt | 2 +- .../AmplifyPushNotificationsPlugin.kt | 4 ++-- .../amplify_push_notifications/NoOpVoidResult.kt | 10 ++++++++++ .../PushNotificationBackgroundService.kt | 5 +++-- .../PushNotificationFirebaseMessagingService.kt | 5 +++-- 5 files changed, 19 insertions(+), 7 deletions(-) create mode 100644 packages/notifications/push/amplify_push_notifications/android/src/main/kotlin/com/amazonaws/amplify/amplify_push_notifications/NoOpVoidResult.kt diff --git a/packages/notifications/push/amplify_push_notifications/android/src/main/kotlin/com/amazonaws/amplify/amplify_push_notifications/AmplifyLifecycleObserver.kt b/packages/notifications/push/amplify_push_notifications/android/src/main/kotlin/com/amazonaws/amplify/amplify_push_notifications/AmplifyLifecycleObserver.kt index 8a750e6bd7..1faae83bdc 100644 --- a/packages/notifications/push/amplify_push_notifications/android/src/main/kotlin/com/amazonaws/amplify/amplify_push_notifications/AmplifyLifecycleObserver.kt +++ b/packages/notifications/push/amplify_push_notifications/android/src/main/kotlin/com/amazonaws/amplify/amplify_push_notifications/AmplifyLifecycleObserver.kt @@ -17,7 +17,7 @@ class AmplifyLifecycleObserver : DefaultLifecycleObserver { // Only set launchNotification to null when app resumes from background. if (!isAppLaunch) { AmplifyPushNotificationsPlugin.launchNotification = null - AmplifyPushNotificationsPlugin.flutterApi!!.nullifyLaunchNotification { } + AmplifyPushNotificationsPlugin.flutterApi!!.nullifyLaunchNotification(NoOpVoidResult()) } refreshToken() isAppLaunch = false diff --git a/packages/notifications/push/amplify_push_notifications/android/src/main/kotlin/com/amazonaws/amplify/amplify_push_notifications/AmplifyPushNotificationsPlugin.kt b/packages/notifications/push/amplify_push_notifications/android/src/main/kotlin/com/amazonaws/amplify/amplify_push_notifications/AmplifyPushNotificationsPlugin.kt index 731d93fd50..dfc4b3e4e0 100644 --- a/packages/notifications/push/amplify_push_notifications/android/src/main/kotlin/com/amazonaws/amplify/amplify_push_notifications/AmplifyPushNotificationsPlugin.kt +++ b/packages/notifications/push/amplify_push_notifications/android/src/main/kotlin/com/amazonaws/amplify/amplify_push_notifications/AmplifyPushNotificationsPlugin.kt @@ -104,7 +104,7 @@ class AmplifyPushNotificationsPlugin( // Force init stream handlers when the app is opened from killed state so old handlers are removed. StreamHandlers.initStreamHandlers(true) StreamHandlers.initEventChannels(mainBinaryMessenger!!) - PushNotificationsHostApi.setup(mainBinaryMessenger!!, this) + PushNotificationsHostApi.setUp(mainBinaryMessenger!!, this) flutterApi = PushNotificationsFlutterApi(mainBinaryMessenger!!) applicationContext = flutterPluginBinding.applicationContext sharedPreferences = applicationContext.getSharedPreferences( @@ -117,7 +117,7 @@ class AmplifyPushNotificationsPlugin( mainBinaryMessenger = null _flutterEngineCache.clear() StreamHandlers.deInit() - PushNotificationsHostApi.setup(binding.binaryMessenger, null) + PushNotificationsHostApi.setUp(binding.binaryMessenger, null) flutterApi = null } diff --git a/packages/notifications/push/amplify_push_notifications/android/src/main/kotlin/com/amazonaws/amplify/amplify_push_notifications/NoOpVoidResult.kt b/packages/notifications/push/amplify_push_notifications/android/src/main/kotlin/com/amazonaws/amplify/amplify_push_notifications/NoOpVoidResult.kt new file mode 100644 index 0000000000..1f64b0c8db --- /dev/null +++ b/packages/notifications/push/amplify_push_notifications/android/src/main/kotlin/com/amazonaws/amplify/amplify_push_notifications/NoOpVoidResult.kt @@ -0,0 +1,10 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +package com.amazonaws.amplify.amplify_push_notifications + +class NoOpVoidResult : PushNotificationsHostApiBindings.VoidResult { + override fun success() {} + + override fun error(error: Throwable) {} +} diff --git a/packages/notifications/push/amplify_push_notifications/android/src/main/kotlin/com/amazonaws/amplify/amplify_push_notifications/PushNotificationBackgroundService.kt b/packages/notifications/push/amplify_push_notifications/android/src/main/kotlin/com/amazonaws/amplify/amplify_push_notifications/PushNotificationBackgroundService.kt index f4a73b1984..c4ce14bfa8 100644 --- a/packages/notifications/push/amplify_push_notifications/android/src/main/kotlin/com/amazonaws/amplify/amplify_push_notifications/PushNotificationBackgroundService.kt +++ b/packages/notifications/push/amplify_push_notifications/android/src/main/kotlin/com/amazonaws/amplify/amplify_push_notifications/PushNotificationBackgroundService.kt @@ -134,8 +134,9 @@ class PushNotificationBackgroundService : JobIntentService(), MethodChannel.Meth intent.extras?.let { bundle -> bundle.getNotificationPayload()?.let { AmplifyPushNotificationsPlugin.flutterApi!!.onNotificationReceivedInBackground( - it.toWritableMap() - ) {} + it.toWritableMap(), + NoOpVoidResult() + ) } } } diff --git a/packages/notifications/push/amplify_push_notifications/android/src/main/kotlin/com/amazonaws/amplify/amplify_push_notifications/PushNotificationFirebaseMessagingService.kt b/packages/notifications/push/amplify_push_notifications/android/src/main/kotlin/com/amazonaws/amplify/amplify_push_notifications/PushNotificationFirebaseMessagingService.kt index 24f7501c58..caef8f7124 100644 --- a/packages/notifications/push/amplify_push_notifications/android/src/main/kotlin/com/amazonaws/amplify/amplify_push_notifications/PushNotificationFirebaseMessagingService.kt +++ b/packages/notifications/push/amplify_push_notifications/android/src/main/kotlin/com/amazonaws/amplify/amplify_push_notifications/PushNotificationFirebaseMessagingService.kt @@ -100,8 +100,9 @@ class PushNotificationFirebaseMessagingService : FirebaseMessagingService() { } else { val notificationPayload = payload.toWritableMap() AmplifyPushNotificationsPlugin.flutterApi!!.onNotificationReceivedInBackground( - notificationPayload - ) {} + notificationPayload, + NoOpVoidResult() + ) } } From a7489f07da9957bc5f1381c078561393d5f05d65 Mon Sep 17 00:00:00 2001 From: Tyler-Larkin Date: Thu, 12 Dec 2024 12:18:05 -0800 Subject: [PATCH 11/11] chore: updated native code --- .../NativeAuthPluginWrapper.kt | 73 ++++++++++--------- .../ios/Classes/CognitoPlugin.swift | 11 ++- .../ios/Classes/FlutterApiPlugin.swift | 35 +++++++-- .../Classes/SwiftAmplifyDataStorePlugin.swift | 4 +- .../Classes/auth/FlutterAuthProviders.swift | 29 +++++--- .../lib/amplify_native_legacy_wrapper.dart | 6 +- .../Flutter/GeneratedPluginRegistrant.swift | 2 + .../AmplifyPushNotificationsPlugin.swift | 14 ++-- 8 files changed, 106 insertions(+), 68 deletions(-) diff --git a/packages/amplify_datastore/android/src/main/kotlin/com/amazonaws/amplify/amplify_datastore/NativeAuthPluginWrapper.kt b/packages/amplify_datastore/android/src/main/kotlin/com/amazonaws/amplify/amplify_datastore/NativeAuthPluginWrapper.kt index 33e638babf..c6a7184323 100644 --- a/packages/amplify_datastore/android/src/main/kotlin/com/amazonaws/amplify/amplify_datastore/NativeAuthPluginWrapper.kt +++ b/packages/amplify_datastore/android/src/main/kotlin/com/amazonaws/amplify/amplify_datastore/NativeAuthPluginWrapper.kt @@ -85,45 +85,48 @@ class NativeAuthPluginWrapper( return } MainScope().launch { - nativePlugin.fetchAuthSession() { session -> - val couldNotFetchException = UnknownException("Could not fetch") - val userPoolTokens = if (session.userPoolTokens != null) { - val tokens = FlutterFactory.createAWSCognitoUserPoolTokens( - session.userPoolTokens!!.accessToken, - session.userPoolTokens!!.idToken, - session.userPoolTokens!!.refreshToken - ) - AuthSessionResult.success(tokens) - } else { - AuthSessionResult.failure(couldNotFetchException) - } - val awsCredentials: AuthSessionResult = - if (session.awsCredentials != null) { - val sessionCredentials = session.awsCredentials!! - val credentials = AWSCredentials.createAWSCredentials( - sessionCredentials.accessKeyId, - sessionCredentials.secretAccessKey, - sessionCredentials.sessionToken, - if (sessionCredentials.expirationIso8601Utc != null) { - Instant.fromIso8601( - sessionCredentials.expirationIso8601Utc!! - ).epochSeconds - } else { - null - } + nativePlugin.fetchAuthSession() { result -> + val session = result.getOrNull() + if(session != null) { + val couldNotFetchException = UnknownException("Could not fetch") + val userPoolTokens = if (session.userPoolTokens != null) { + val tokens = FlutterFactory.createAWSCognitoUserPoolTokens( + session.userPoolTokens!!.accessToken, + session.userPoolTokens!!.idToken, + session.userPoolTokens!!.refreshToken ) - AuthSessionResult.success(credentials) + AuthSessionResult.success(tokens) } else { AuthSessionResult.failure(couldNotFetchException) } - val authSession = FlutterFactory.createAWSCognitoAuthSession( - session.isSignedIn, - AuthSessionResult.success(session.identityId), - awsCredentials, - AuthSessionResult.success(session.userSub), - userPoolTokens - ) - onSuccess.accept(authSession) + val awsCredentials: AuthSessionResult = + if (session.awsCredentials != null) { + val sessionCredentials = session.awsCredentials!! + val credentials = AWSCredentials.createAWSCredentials( + sessionCredentials.accessKeyId, + sessionCredentials.secretAccessKey, + sessionCredentials.sessionToken, + if (sessionCredentials.expirationIso8601Utc != null) { + Instant.fromIso8601( + sessionCredentials.expirationIso8601Utc!! + ).epochSeconds + } else { + null + } + ) + AuthSessionResult.success(credentials) + } else { + AuthSessionResult.failure(couldNotFetchException) + } + val authSession = FlutterFactory.createAWSCognitoAuthSession( + session.isSignedIn, + AuthSessionResult.success(session.identityId), + awsCredentials, + AuthSessionResult.success(session.userSub), + userPoolTokens + ) + onSuccess.accept(authSession) + } } } } diff --git a/packages/amplify_datastore/ios/Classes/CognitoPlugin.swift b/packages/amplify_datastore/ios/Classes/CognitoPlugin.swift index 377fab8181..ce43f49071 100644 --- a/packages/amplify_datastore/ios/Classes/CognitoPlugin.swift +++ b/packages/amplify_datastore/ios/Classes/CognitoPlugin.swift @@ -29,9 +29,14 @@ public class CognitoPlugin: AuthCategoryPlugin { public func fetchAuthSession(options: AuthFetchSessionRequest.Options?) async throws -> any AuthSession { await withCheckedContinuation { continuation in DispatchQueue.main.async { - self.nativeAuthPlugin.fetchAuthSession { session in - let result = NativeAWSAuthCognitoSession(from: session) - continuation.resume(returning: result) + self.nativeAuthPlugin.fetchAuthSession { result in + switch result { + case .success(let session): + let returning = NativeAWSAuthCognitoSession(from: session) + continuation.resume(returning: returning) + case .failure(let error): + break //NoOp + } } } } diff --git a/packages/amplify_datastore/ios/Classes/FlutterApiPlugin.swift b/packages/amplify_datastore/ios/Classes/FlutterApiPlugin.swift index 3443e244ce..ddfb864fdc 100644 --- a/packages/amplify_datastore/ios/Classes/FlutterApiPlugin.swift +++ b/packages/amplify_datastore/ios/Classes/FlutterApiPlugin.swift @@ -30,7 +30,9 @@ public class FlutterApiPlugin: APICategoryPlugin, AWSAPIAuthInformation let cancellable = try reachabilityPublisher()?.sink(receiveValue: { reachabilityUpdate in if !reachabilityUpdate.isOnline { DispatchQueue.main.async { - self.nativeApiPlugin.deviceOffline {} + self.nativeApiPlugin.deviceOffline { result in + //NoOp + } } } }) @@ -94,7 +96,9 @@ public class FlutterApiPlugin: APICategoryPlugin, AWSAPIAuthInformation func unsubscribe(subscriptionId: String?){ if let subscriptionId { DispatchQueue.main.async { - self.nativeApiPlugin.unsubscribe(subscriptionId: subscriptionId) {} + self.nativeApiPlugin.unsubscribe(subscriptionId: subscriptionId) { result in + //NoOp + } } } } @@ -154,8 +158,13 @@ public class FlutterApiPlugin: APICategoryPlugin, AWSAPIAuthInformation sequence.send(.connection(.connecting)) DispatchQueue.main.async { - self.nativeApiPlugin.subscribe(request: request.toNativeGraphQLRequest()) { response in - subscriptionId = response.subscriptionId + self.nativeApiPlugin.subscribe(request: request.toNativeGraphQLRequest()) { result in + switch result { + case .success(let response): + subscriptionId = response.subscriptionId + case .failure(let error): + break //NoOp + } } } return sequence @@ -216,8 +225,13 @@ public class FlutterApiPlugin: APICategoryPlugin, AWSAPIAuthInformation func asyncQuery(nativeRequest: NativeGraphQLRequest) async -> NativeGraphQLResponse { await withCheckedContinuation { continuation in DispatchQueue.main.async { - self.nativeApiPlugin.query(request: nativeRequest) { response in - continuation.resume(returning: response) + self.nativeApiPlugin.query(request: nativeRequest) { result in + switch result { + case .success(let response): + continuation.resume(returning: response) + case .failure(let error): + break //NoOp + } } } } @@ -226,8 +240,13 @@ public class FlutterApiPlugin: APICategoryPlugin, AWSAPIAuthInformation func asyncMutate(nativeRequest: NativeGraphQLRequest) async -> NativeGraphQLResponse{ await withCheckedContinuation { continuation in DispatchQueue.main.async { - self.nativeApiPlugin.mutate(request: nativeRequest) { response in - continuation.resume(returning: response) + self.nativeApiPlugin.mutate(request: nativeRequest) { result in + switch result { + case .success(let response): + continuation.resume(returning: response) + case .failure(let error): + break //NoOp + } } } } diff --git a/packages/amplify_datastore/ios/Classes/SwiftAmplifyDataStorePlugin.swift b/packages/amplify_datastore/ios/Classes/SwiftAmplifyDataStorePlugin.swift index c3775556a2..2e3006e89e 100644 --- a/packages/amplify_datastore/ios/Classes/SwiftAmplifyDataStorePlugin.swift +++ b/packages/amplify_datastore/ios/Classes/SwiftAmplifyDataStorePlugin.swift @@ -233,7 +233,9 @@ public class SwiftAmplifyDataStorePlugin: NSObject, FlutterPlugin, NativeAmplify case "stop": onStop(flutterResult: result) DispatchQueue.main.async { - self.nativeApiPlugin.onStop {} + self.nativeApiPlugin.onStop { result in + //NoOp + } } default: result(FlutterMethodNotImplemented) diff --git a/packages/amplify_datastore/ios/Classes/auth/FlutterAuthProviders.swift b/packages/amplify_datastore/ios/Classes/auth/FlutterAuthProviders.swift index 53be119532..78b17de383 100644 --- a/packages/amplify_datastore/ios/Classes/auth/FlutterAuthProviders.swift +++ b/packages/amplify_datastore/ios/Classes/auth/FlutterAuthProviders.swift @@ -30,19 +30,24 @@ class FlutterAuthProviders: APIAuthProviderFactory { let completer = DispatchSemaphore(value: 0) DispatchQueue.main.async { - self.nativeApiPlugin.getLatestAuthToken(providerName: type.rawValue) { resultToken in - defer { completer.signal() } + self.nativeApiPlugin.getLatestAuthToken(providerName: type.rawValue) { result in + switch result { + case .success(let resultToken): + defer { completer.signal() } - if let resultToken = resultToken { - token = .success(resultToken) - } else { - token = .failure(APIError.operationError( - "Unable to retrieve token for \(type)", - """ - Make sure you register your auth providers in the addPlugin call and \ - that getLatestAuthToken returns a value. - """ - )) + if let resultToken = resultToken { + token = .success(resultToken) + } else { + token = .failure(APIError.operationError( + "Unable to retrieve token for \(type)", + """ + Make sure you register your auth providers in the addPlugin call and \ + that getLatestAuthToken returns a value. + """ + )) + } + case .failure(let error): + break //NoOp } } } diff --git a/packages/amplify_native_legacy_wrapper/lib/amplify_native_legacy_wrapper.dart b/packages/amplify_native_legacy_wrapper/lib/amplify_native_legacy_wrapper.dart index 253e8d38b9..091eea04e0 100644 --- a/packages/amplify_native_legacy_wrapper/lib/amplify_native_legacy_wrapper.dart +++ b/packages/amplify_native_legacy_wrapper/lib/amplify_native_legacy_wrapper.dart @@ -35,8 +35,10 @@ class AmplifyNativeLegacyWrapper implements LegacyNativePlugin { } @override - BinaryMessenger? get pigeonVar_binaryMessenger => _plugin.pigeonVar_binaryMessenger; + BinaryMessenger? get pigeonVar_binaryMessenger => + _plugin.pigeonVar_binaryMessenger; @override - String get pigeonVar_messageChannelSuffix => _plugin.pigeonVar_messageChannelSuffix; + String get pigeonVar_messageChannelSuffix => + _plugin.pigeonVar_messageChannelSuffix; } diff --git a/packages/auth/amplify_auth_cognito/example/macos/Flutter/GeneratedPluginRegistrant.swift b/packages/auth/amplify_auth_cognito/example/macos/Flutter/GeneratedPluginRegistrant.swift index 723ec8543e..0845788d3d 100644 --- a/packages/auth/amplify_auth_cognito/example/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/packages/auth/amplify_auth_cognito/example/macos/Flutter/GeneratedPluginRegistrant.swift @@ -12,6 +12,7 @@ import device_info_plus import package_info_plus import path_provider_foundation import url_launcher_macos +import webview_flutter_wkwebview func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { AmplifyAuthCognitoPlugin.register(with: registry.registrar(forPlugin: "AmplifyAuthCognitoPlugin")) @@ -21,4 +22,5 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin")) PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin")) + FLTWebViewFlutterPlugin.register(with: registry.registrar(forPlugin: "FLTWebViewFlutterPlugin")) } diff --git a/packages/notifications/push/amplify_push_notifications/ios/Classes/AmplifyPushNotificationsPlugin.swift b/packages/notifications/push/amplify_push_notifications/ios/Classes/AmplifyPushNotificationsPlugin.swift index 42a7435510..bee3a69a85 100644 --- a/packages/notifications/push/amplify_push_notifications/ios/Classes/AmplifyPushNotificationsPlugin.swift +++ b/packages/notifications/push/amplify_push_notifications/ios/Classes/AmplifyPushNotificationsPlugin.swift @@ -27,7 +27,7 @@ public class AmplifyPushNotificationsPlugin: NSObject, FlutterPlugin, PushNotifi flutterApi: PushNotificationsFlutterApi(binaryMessenger: messenger) ) - PushNotificationsHostApiSetup(messenger, pluginInstance) + SetUpPushNotificationsHostApi(messenger, pluginInstance) registrar.addApplicationDelegate(pluginInstance) } @@ -57,15 +57,15 @@ public class AmplifyPushNotificationsPlugin: NSObject, FlutterPlugin, PushNotifi Task { var options: UNAuthorizationOptions = [] - if withPermissionOptions.alert.boolValue { + if withPermissionOptions.alert { options.insert(.alert) } - if withPermissionOptions.badge.boolValue { + if withPermissionOptions.badge { options.insert(.badge) } - if withPermissionOptions.sound.boolValue { + if withPermissionOptions.sound { options.insert(.sound) } @@ -95,11 +95,11 @@ public class AmplifyPushNotificationsPlugin: NSObject, FlutterPlugin, PushNotifi return UIApplication.shared.applicationIconBadgeNumber as NSNumber } - public func setBadgeCountWithBadgeCount(_ withBadgeCount: NSNumber, error: AutoreleasingUnsafeMutablePointer) { - UIApplication.shared.applicationIconBadgeNumber = withBadgeCount.intValue + public func setBadgeCountWithBadgeCount(_ withBadgeCount: NSInteger, error: AutoreleasingUnsafeMutablePointer) { + UIApplication.shared.applicationIconBadgeNumber = withBadgeCount } - public func registerCallbackFunctionCallbackHandle(_ callbackHandle: NSNumber, error: AutoreleasingUnsafeMutablePointer) { + public func registerCallbackFunctionCallbackHandle(_ callbackHandle: NSInteger, error: AutoreleasingUnsafeMutablePointer) { // noop on iOS since this method is used to register callbacks on Android } }