diff --git a/example/ios/Runner/AppDelegate.swift b/example/ios/Runner/AppDelegate.swift index 70693e4a8c..db74139c8c 100644 --- a/example/ios/Runner/AppDelegate.swift +++ b/example/ios/Runner/AppDelegate.swift @@ -1,3 +1,18 @@ +// +// Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"). +// You may not use this file except in compliance with the License. +// A copy of the License is located at +// +// http://aws.amazon.com/apache2.0 +// +// or in the "license" file accompanying this file. This file is distributed +// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either +// express or implied. See the License for the specific language governing +// permissions and limitations under the License. +// + import UIKit import Flutter diff --git a/example/lib/Views/ImageLineItem.dart b/example/lib/Views/ImageLineItem.dart index dcbeab0106..101882d9f3 100644 --- a/example/lib/Views/ImageLineItem.dart +++ b/example/lib/Views/ImageLineItem.dart @@ -1,3 +1,18 @@ +// +// Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"). +// You may not use this file except in compliance with the License. +// A copy of the License is located at +// +// http://aws.amazon.com/apache2.0 +// +// or in the "license" file accompanying this file. This file is distributed +// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either +// express or implied. See the License for the specific language governing +// permissions and limitations under the License. +// + import 'package:flutter/material.dart'; import 'ImagePreview.dart'; diff --git a/example/lib/Views/ImagePreview.dart b/example/lib/Views/ImagePreview.dart index da6fdf5595..a10d3ddcf1 100644 --- a/example/lib/Views/ImagePreview.dart +++ b/example/lib/Views/ImagePreview.dart @@ -1,3 +1,18 @@ +// +// Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"). +// You may not use this file except in compliance with the License. +// A copy of the License is located at +// +// http://aws.amazon.com/apache2.0 +// +// or in the "license" file accompanying this file. This file is distributed +// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either +// express or implied. See the License for the specific language governing +// permissions and limitations under the License. +// + import 'package:amplify_analytics_pinpoint/amplify_analytics_pinpoint.dart'; import 'package:amplify_flutter/amplify.dart'; import 'package:amplify_storage_s3/amplify_storage_s3.dart'; diff --git a/example/lib/Views/ImageUploader.dart b/example/lib/Views/ImageUploader.dart index 75c3a2f81c..5b0a9f7e2f 100644 --- a/example/lib/Views/ImageUploader.dart +++ b/example/lib/Views/ImageUploader.dart @@ -1,3 +1,18 @@ +// +// Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"). +// You may not use this file except in compliance with the License. +// A copy of the License is located at +// +// http://aws.amazon.com/apache2.0 +// +// or in the "license" file accompanying this file. This file is distributed +// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either +// express or implied. See the License for the specific language governing +// permissions and limitations under the License. +// + import 'package:flutter/material.dart'; import 'dart:io'; import 'package:file_picker/file_picker.dart'; diff --git a/packages/amplify_analytics_pinpoint/android/build.gradle b/packages/amplify_analytics_pinpoint/android/build.gradle index f743e50154..29e23e87f3 100644 --- a/packages/amplify_analytics_pinpoint/android/build.gradle +++ b/packages/amplify_analytics_pinpoint/android/build.gradle @@ -67,8 +67,8 @@ dependencies { api amplifyCore implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" - implementation 'com.amplifyframework:aws-analytics-pinpoint:1.28.3-rc' - implementation 'com.amplifyframework:aws-auth-cognito:1.28.3-rc' + implementation 'com.amplifyframework:aws-analytics-pinpoint:1.29.1' + implementation 'com.amplifyframework:aws-auth-cognito:1.29.1' testImplementation 'junit:junit:4.13.2' testImplementation 'org.mockito:mockito-core:3.10.0' testImplementation 'org.mockito:mockito-inline:3.10.0' diff --git a/packages/amplify_analytics_pinpoint/android/src/main/kotlin/com/amazonaws/amplify/amplify_analytics_pinpoint/EmptyActivity.kt b/packages/amplify_analytics_pinpoint/android/src/main/kotlin/com/amazonaws/amplify/amplify_analytics_pinpoint/EmptyActivity.kt index c8c6c7a6b4..05559d30e0 100644 --- a/packages/amplify_analytics_pinpoint/android/src/main/kotlin/com/amazonaws/amplify/amplify_analytics_pinpoint/EmptyActivity.kt +++ b/packages/amplify_analytics_pinpoint/android/src/main/kotlin/com/amazonaws/amplify/amplify_analytics_pinpoint/EmptyActivity.kt @@ -1,3 +1,20 @@ +/* + * + * Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"). + * You may not use this file except in compliance with the License. + * A copy of the License is located at + * + * http://aws.amazon.com/apache2.0 + * + * or in the "license" file accompanying this file. This file is distributed + * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing + * permissions and limitations under the License. + * + */ + package com.amazonaws.amplify.amplify_analytics_pinpoint import android.app.Activity diff --git a/packages/amplify_analytics_pinpoint/example/ios/Runner/AppDelegate.swift b/packages/amplify_analytics_pinpoint/example/ios/Runner/AppDelegate.swift index 70693e4a8c..db74139c8c 100644 --- a/packages/amplify_analytics_pinpoint/example/ios/Runner/AppDelegate.swift +++ b/packages/amplify_analytics_pinpoint/example/ios/Runner/AppDelegate.swift @@ -1,3 +1,18 @@ +// +// Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"). +// You may not use this file except in compliance with the License. +// A copy of the License is located at +// +// http://aws.amazon.com/apache2.0 +// +// or in the "license" file accompanying this file. This file is distributed +// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either +// express or implied. See the License for the specific language governing +// permissions and limitations under the License. +// + import UIKit import Flutter diff --git a/packages/amplify_analytics_pinpoint/example/lib/main.dart b/packages/amplify_analytics_pinpoint/example/lib/main.dart index 78a8f2b9d6..1eb5982e06 100644 --- a/packages/amplify_analytics_pinpoint/example/lib/main.dart +++ b/packages/amplify_analytics_pinpoint/example/lib/main.dart @@ -1,3 +1,18 @@ +// +// Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"). +// You may not use this file except in compliance with the License. +// A copy of the License is located at +// +// http://aws.amazon.com/apache2.0 +// +// or in the "license" file accompanying this file. This file is distributed +// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either +// express or implied. See the License for the specific language governing +// permissions and limitations under the License. +// + import 'package:amplify_analytics_pinpoint/amplify_analytics_pinpoint.dart'; import 'package:amplify_auth_cognito/amplify_auth_cognito.dart'; import 'package:amplify_flutter/amplify.dart'; diff --git a/packages/amplify_analytics_pinpoint/ios/amplify_analytics_pinpoint.podspec b/packages/amplify_analytics_pinpoint/ios/amplify_analytics_pinpoint.podspec index 64ef0feb13..590a853299 100644 --- a/packages/amplify_analytics_pinpoint/ios/amplify_analytics_pinpoint.podspec +++ b/packages/amplify_analytics_pinpoint/ios/amplify_analytics_pinpoint.podspec @@ -17,8 +17,8 @@ This code is the iOS part of the Amplify Flutter Pinpoint Analytics Plugin. The s.source = { :path => '.' } s.source_files = 'Classes/**/*' s.dependency 'Flutter' - s.dependency 'Amplify', '~> 1.15.5' - s.dependency 'AmplifyPlugins/AWSPinpointAnalyticsPlugin', '~> 1.15.5' + s.dependency 'Amplify', '1.15.6' + s.dependency 'AmplifyPlugins/AWSPinpointAnalyticsPlugin', '1.15.6' s.dependency 'amplify_core' s.dependency 'SwiftLint' s.dependency 'SwiftFormat/CLI' diff --git a/packages/amplify_api/android/build.gradle b/packages/amplify_api/android/build.gradle index 1435cb64b6..06289f9483 100644 --- a/packages/amplify_api/android/build.gradle +++ b/packages/amplify_api/android/build.gradle @@ -65,9 +65,9 @@ dependencies { api amplifyCore implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" - implementation "com.amplifyframework:aws-api:1.28.3-rc" - implementation "com.amplifyframework:aws-api-appsync:1.28.3-rc" - implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9' + implementation "com.amplifyframework:aws-api:1.29.1" + implementation "com.amplifyframework:aws-api-appsync:1.29.1" + implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.9' testImplementation 'junit:junit:4.13.2' testImplementation 'org.mockito:mockito-core:3.10.0' diff --git a/packages/amplify_api/android/src/main/kotlin/com/amazonaws/amplify/amplify_api/AmplifyApiPlugin.kt b/packages/amplify_api/android/src/main/kotlin/com/amazonaws/amplify/amplify_api/AmplifyApiPlugin.kt index f8ec1a580d..284251be75 100644 --- a/packages/amplify_api/android/src/main/kotlin/com/amazonaws/amplify/amplify_api/AmplifyApiPlugin.kt +++ b/packages/amplify_api/android/src/main/kotlin/com/amazonaws/amplify/amplify_api/AmplifyApiPlugin.kt @@ -23,10 +23,12 @@ import androidx.annotation.VisibleForTesting import com.amazonaws.amplify.amplify_api.auth.FlutterAuthProviders import com.amazonaws.amplify.amplify_api.rest_api.FlutterRestApi import com.amazonaws.amplify.amplify_core.AtomicResult +import com.amazonaws.amplify.amplify_core.cast import com.amazonaws.amplify.amplify_core.exception.ExceptionUtil.Companion.createSerializedUnrecognizedError import com.amazonaws.amplify.amplify_core.exception.ExceptionUtil.Companion.handleAddPluginException import com.amazonaws.amplify.amplify_core.exception.ExceptionUtil.Companion.postExceptionToFlutterChannel import com.amplifyframework.api.aws.AWSApiPlugin +import com.amplifyframework.api.aws.AuthorizationType import com.amplifyframework.core.Amplify import io.flutter.embedding.engine.plugins.FlutterPlugin import io.flutter.plugin.common.EventChannel @@ -78,16 +80,20 @@ class AmplifyApiPlugin : FlutterPlugin, MethodCallHandler { override fun onMethodCall(call: MethodCall, _result: Result) { val methodName = call.method val result = AtomicResult(_result, call.method) + val arguments: Map = (call.arguments as? Map<*, *>)?.cast() ?: mapOf() if (methodName == "cancel") { onCancel(result, (call.arguments as String)) return } else if (methodName == "addPlugin") { try { + val authProvidersList: List = + (arguments["authProviders"] as List<*>?)?.cast() ?: listOf() + val authProviders = authProvidersList.map { AuthorizationType.valueOf(it) } Amplify.addPlugin( AWSApiPlugin .builder() - .apiAuthProviders(FlutterAuthProviders(channel).factory) + .apiAuthProviders(FlutterAuthProviders(authProviders, channel).factory) .build() ) logger.info("Added API plugin") @@ -99,7 +105,7 @@ class AmplifyApiPlugin : FlutterPlugin, MethodCallHandler { } try { - val arguments: Map = call.arguments as Map + when (call.method) { "get" -> FlutterRestApi.get(result, arguments) diff --git a/packages/amplify_api/android/src/main/kotlin/com/amazonaws/amplify/amplify_api/auth/FlutterAuthProvider.kt b/packages/amplify_api/android/src/main/kotlin/com/amazonaws/amplify/amplify_api/auth/FlutterAuthProvider.kt index 533f2419b8..f039c6a4f0 100644 --- a/packages/amplify_api/android/src/main/kotlin/com/amazonaws/amplify/amplify_api/auth/FlutterAuthProvider.kt +++ b/packages/amplify_api/android/src/main/kotlin/com/amazonaws/amplify/amplify_api/auth/FlutterAuthProvider.kt @@ -28,7 +28,10 @@ import kotlinx.coroutines.* /** * Manages the shared state of all [FlutterAuthProvider] instances. */ -class FlutterAuthProviders(private val methodChannel: MethodChannel) { +class FlutterAuthProviders( + private val authProviders: List, + private val methodChannel: MethodChannel +) { private companion object { /** @@ -51,11 +54,15 @@ class FlutterAuthProviders(private val methodChannel: MethodChannel) { * A factory of [FlutterAuthProvider] instances. */ val factory: ApiAuthProviders by lazy { - ApiAuthProviders - .Builder() - .functionAuthProvider(FlutterAuthProvider(this, AuthorizationType.AWS_LAMBDA)) - .oidcAuthProvider(FlutterAuthProvider(this, AuthorizationType.OPENID_CONNECT)) - .build() + val authProviders = this.authProviders.toSet() + val builder = ApiAuthProviders.Builder() + if (authProviders.contains(AuthorizationType.AWS_LAMBDA)) { + builder.functionAuthProvider(FlutterAuthProvider(this, AuthorizationType.AWS_LAMBDA)) + } + if (authProviders.contains(AuthorizationType.OPENID_CONNECT)) { + builder.oidcAuthProvider(FlutterAuthProvider(this, AuthorizationType.OPENID_CONNECT)) + } + builder.build() } /** diff --git a/packages/amplify_api/android/src/main/kotlin/com/amazonaws/amplify/amplify_api/rest_api/FlutterRestApi.kt b/packages/amplify_api/android/src/main/kotlin/com/amazonaws/amplify/amplify_api/rest_api/FlutterRestApi.kt index 8ac2127e1b..01cd07d8cc 100644 --- a/packages/amplify_api/android/src/main/kotlin/com/amazonaws/amplify/amplify_api/rest_api/FlutterRestApi.kt +++ b/packages/amplify_api/android/src/main/kotlin/com/amazonaws/amplify/amplify_api/rest_api/FlutterRestApi.kt @@ -1,3 +1,20 @@ +/* + * + * Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"). + * You may not use this file except in compliance with the License. + * A copy of the License is located at + * + * http://aws.amazon.com/apache2.0 + * + * or in the "license" file accompanying this file. This file is distributed + * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing + * permissions and limitations under the License. + * + */ + package com.amazonaws.amplify.amplify_api.rest_api import android.os.Handler diff --git a/packages/amplify_api/android/src/test/kotlin/com/amazonaws/amplify/amplify_api/RestApiData.kt b/packages/amplify_api/android/src/test/kotlin/com/amazonaws/amplify/amplify_api/RestApiData.kt index bb54eceafe..2035e15678 100644 --- a/packages/amplify_api/android/src/test/kotlin/com/amazonaws/amplify/amplify_api/RestApiData.kt +++ b/packages/amplify_api/android/src/test/kotlin/com/amazonaws/amplify/amplify_api/RestApiData.kt @@ -1,3 +1,20 @@ +/* + * + * Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"). + * You may not use this file except in compliance with the License. + * A copy of the License is located at + * + * http://aws.amazon.com/apache2.0 + * + * or in the "license" file accompanying this file. This file is distributed + * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing + * permissions and limitations under the License. + * + */ + package com.amazonaws.amplify.amplify_api val getSuccessData = "{\"success\":\"get call succeed!\",\"url\":\"/items\"}".toByteArray() diff --git a/packages/amplify_api/example/android/app/src/main/kotlin/com/amazonaws/amplify/amplify_api_example/MainActivity.kt b/packages/amplify_api/example/android/app/src/main/kotlin/com/amazonaws/amplify/amplify_api_example/MainActivity.kt index bf138dc549..1d9dcfc6d5 100644 --- a/packages/amplify_api/example/android/app/src/main/kotlin/com/amazonaws/amplify/amplify_api_example/MainActivity.kt +++ b/packages/amplify_api/example/android/app/src/main/kotlin/com/amazonaws/amplify/amplify_api_example/MainActivity.kt @@ -1,3 +1,20 @@ +/* + * + * Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"). + * You may not use this file except in compliance with the License. + * A copy of the License is located at + * + * http://aws.amazon.com/apache2.0 + * + * or in the "license" file accompanying this file. This file is distributed + * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing + * permissions and limitations under the License. + * + */ + package com.amazonaws.amplify.amplify_api_example import io.flutter.embedding.android.FlutterActivity diff --git a/packages/amplify_api/example/ios/Runner/AppDelegate.swift b/packages/amplify_api/example/ios/Runner/AppDelegate.swift index 70693e4a8c..db74139c8c 100644 --- a/packages/amplify_api/example/ios/Runner/AppDelegate.swift +++ b/packages/amplify_api/example/ios/Runner/AppDelegate.swift @@ -1,3 +1,18 @@ +// +// Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"). +// You may not use this file except in compliance with the License. +// A copy of the License is located at +// +// http://aws.amazon.com/apache2.0 +// +// or in the "license" file accompanying this file. This file is distributed +// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either +// express or implied. See the License for the specific language governing +// permissions and limitations under the License. +// + import UIKit import Flutter diff --git a/packages/amplify_api/ios/Classes/Auth/FlutterAuthProvider.swift b/packages/amplify_api/ios/Classes/Auth/FlutterAuthProvider.swift index e11001b3e8..38af124e0b 100644 --- a/packages/amplify_api/ios/Classes/Auth/FlutterAuthProvider.swift +++ b/packages/amplify_api/ios/Classes/Auth/FlutterAuthProvider.swift @@ -78,11 +78,23 @@ class FlutterAuthProviders: APIAuthProviderFactory { return token ?? unknownError } + private let authProviders: Set + + init(_ authProviders: [AWSAuthorizationType]) { + self.authProviders = Set(authProviders) + } + override func oidcAuthProvider() -> AmplifyOIDCAuthProvider? { + guard authProviders.contains(.openIDConnect) else { + return nil + } return FlutterAuthProvider(type: .openIDConnect) } override func functionAuthProvider() -> AmplifyFunctionAuthProvider? { + guard authProviders.contains(.function) else { + return nil + } return FlutterAuthProvider(type: .function) } } diff --git a/packages/amplify_api/ios/Classes/SwiftAmplifyApiPlugin.swift b/packages/amplify_api/ios/Classes/SwiftAmplifyApiPlugin.swift index 53a8e2e66a..76f25f35eb 100644 --- a/packages/amplify_api/ios/Classes/SwiftAmplifyApiPlugin.swift +++ b/packages/amplify_api/ios/Classes/SwiftAmplifyApiPlugin.swift @@ -58,13 +58,19 @@ public class SwiftAmplifyApiPlugin: NSObject, FlutterPlugin { let cancelToken = try FlutterApiRequest.getCancelToken(args: callArgs) onCancel(flutterResult: result, cancelToken: cancelToken) return - } else if method == "addPlugin"{ - addPlugin(result: result) - return } let arguments = try FlutterApiRequest.getMap(args: callArgs) + if method == "addPlugin"{ + let authProvidersList = arguments["authProviders"] as? [String] ?? [] + let authProviders = authProvidersList.compactMap { + AWSAuthorizationType(rawValue: $0) + } + addPlugin(authProviders: authProviders, result: result) + return + } + try innerHandle(method: method, arguments: arguments, result: result) } catch { print("Failed to parse query arguments with \(error)") @@ -72,12 +78,12 @@ public class SwiftAmplifyApiPlugin: NSObject, FlutterPlugin { } } - private func addPlugin(result: FlutterResult) { + private func addPlugin(authProviders: [AWSAuthorizationType], result: FlutterResult) { do { try Amplify.add( plugin: AWSAPIPlugin( sessionFactory: FlutterURLSessionBehaviorFactory(), - apiAuthProviderFactory: FlutterAuthProviders())) + apiAuthProviderFactory: FlutterAuthProviders(authProviders))) result(true) } catch let apiError as APIError { ErrorUtil.postErrorToFlutterChannel( diff --git a/packages/amplify_api/ios/amplify_api.podspec b/packages/amplify_api/ios/amplify_api.podspec index 85b79b12ed..2d10cbe9ef 100644 --- a/packages/amplify_api/ios/amplify_api.podspec +++ b/packages/amplify_api/ios/amplify_api.podspec @@ -17,8 +17,8 @@ The API module for Amplify Flutter. s.source = { :git => 'https://github.com/aws-amplify/amplify-flutter.git' } s.source_files = 'Classes/**/*' s.dependency 'Flutter' - s.dependency 'Amplify', '~> 1.15.5' - s.dependency 'AmplifyPlugins/AWSAPIPlugin', '~> 1.15.5' + s.dependency 'Amplify', '1.15.6' + s.dependency 'AmplifyPlugins/AWSAPIPlugin', '1.15.6' s.dependency 'amplify_core' s.dependency 'SwiftLint' s.dependency 'SwiftFormat/CLI' diff --git a/packages/amplify_api/lib/src/method_channel_api.dart b/packages/amplify_api/lib/src/method_channel_api.dart index d7775fb5d8..9d1b63987b 100644 --- a/packages/amplify_api/lib/src/method_channel_api.dart +++ b/packages/amplify_api/lib/src/method_channel_api.dart @@ -83,7 +83,10 @@ class AmplifyAPIMethodChannel extends AmplifyAPI { Future addPlugin() async { try { setupAuthProviders(); - await _channel.invokeMethod('addPlugin'); + await _channel.invokeMethod('addPlugin', { + 'authProviders': + _authProviders.keys.map((key) => key.rawValue).toList(), + }); } on PlatformException catch (e) { if (e.code == 'AmplifyAlreadyConfiguredException') { throw const AmplifyAlreadyConfiguredException( diff --git a/packages/amplify_api/test/auth_providers_test.dart b/packages/amplify_api/test/auth_providers_test.dart index 0573740de5..7d20a2b8a6 100644 --- a/packages/amplify_api/test/auth_providers_test.dart +++ b/packages/amplify_api/test/auth_providers_test.dart @@ -1,3 +1,18 @@ +// +// Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"). +// You may not use this file except in compliance with the License. +// A copy of the License is located at +// +// http://aws.amazon.com/apache2.0 +// +// or in the "license" file accompanying this file. This file is distributed +// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either +// express or implied. See the License for the specific language governing +// permissions and limitations under the License. +// + import 'package:amplify_api/amplify_api.dart'; import 'package:amplify_api/src/method_channel_api.dart'; import 'package:flutter/services.dart'; diff --git a/packages/amplify_api/test/auth_providers_test.mocks.dart b/packages/amplify_api/test/auth_providers_test.mocks.dart index eb56c9423f..86d46fa33d 100644 --- a/packages/amplify_api/test/auth_providers_test.mocks.dart +++ b/packages/amplify_api/test/auth_providers_test.mocks.dart @@ -1,3 +1,18 @@ +// +// Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"). +// You may not use this file except in compliance with the License. +// A copy of the License is located at +// +// http://aws.amazon.com/apache2.0 +// +// or in the "license" file accompanying this file. This file is distributed +// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either +// express or implied. See the License for the specific language governing +// permissions and limitations under the License. +// + // Mocks generated by Mockito 5.0.16 from annotations // in amplify_api/test/auth_providers_test.dart. // Do not manually edit this file. diff --git a/packages/amplify_api/test/graphql_error_test.dart b/packages/amplify_api/test/graphql_error_test.dart index f1cadec91a..0aeb961037 100644 --- a/packages/amplify_api/test/graphql_error_test.dart +++ b/packages/amplify_api/test/graphql_error_test.dart @@ -1,3 +1,18 @@ +// +// Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"). +// You may not use this file except in compliance with the License. +// A copy of the License is located at +// +// http://aws.amazon.com/apache2.0 +// +// or in the "license" file accompanying this file. This file is distributed +// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either +// express or implied. See the License for the specific language governing +// permissions and limitations under the License. +// + import 'package:amplify_api/amplify_api.dart'; import 'package:flutter/services.dart'; import 'package:flutter_test/flutter_test.dart'; diff --git a/packages/amplify_api_plugin_interface/lib/src/util.dart b/packages/amplify_api_plugin_interface/lib/src/util.dart index fb847b42cb..aa3d4ce489 100644 --- a/packages/amplify_api_plugin_interface/lib/src/util.dart +++ b/packages/amplify_api_plugin_interface/lib/src/util.dart @@ -1,3 +1,18 @@ +// +// Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"). +// You may not use this file except in compliance with the License. +// A copy of the License is located at +// +// http://aws.amazon.com/apache2.0 +// +// or in the "license" file accompanying this file. This file is distributed +// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either +// express or implied. See the License for the specific language governing +// permissions and limitations under the License. +// + import 'dart:convert'; /// Encodes [json] with indentation for easier debugging. diff --git a/packages/amplify_auth_cognito/android/build.gradle b/packages/amplify_auth_cognito/android/build.gradle index 3f4155ee10..1eb8ddae83 100644 --- a/packages/amplify_auth_cognito/android/build.gradle +++ b/packages/amplify_auth_cognito/android/build.gradle @@ -61,7 +61,7 @@ android { dependencies { api amplifyCore implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" - implementation 'com.amplifyframework:aws-auth-cognito:1.28.3-rc' + implementation 'com.amplifyframework:aws-auth-cognito:1.29.1' testImplementation 'junit:junit:4.13.2' testImplementation 'org.mockito:mockito-core:3.10.0' testImplementation 'org.mockito:mockito-inline:3.10.0' diff --git a/packages/amplify_auth_cognito/android/src/main/kotlin/com/amazonaws/amplify/amplify_auth_cognito/device/DeviceHandler.kt b/packages/amplify_auth_cognito/android/src/main/kotlin/com/amazonaws/amplify/amplify_auth_cognito/device/DeviceHandler.kt index e81fc168d3..098e1cd132 100644 --- a/packages/amplify_auth_cognito/android/src/main/kotlin/com/amazonaws/amplify/amplify_auth_cognito/device/DeviceHandler.kt +++ b/packages/amplify_auth_cognito/android/src/main/kotlin/com/amazonaws/amplify/amplify_auth_cognito/device/DeviceHandler.kt @@ -49,8 +49,7 @@ class DeviceHandler(private val errorHandler: AuthErrorHandler) : private val scope = CoroutineScope(Dispatchers.IO) + CoroutineName("DeviceHandler") @Suppress("UNCHECKED_CAST") - override fun onMethodCall(call: MethodCall, _result: MethodChannel.Result) { - val result = AtomicResult(_result, call.method) + override fun onMethodCall(call: MethodCall, result: MethodChannel.Result) { when (call.method) { "fetchDevices" -> fetchDevices(result) "rememberDevice" -> rememberDevice(result) @@ -116,4 +115,4 @@ class DeviceHandler(private val errorHandler: AuthErrorHandler) : } } } -} \ No newline at end of file +} diff --git a/packages/amplify_auth_cognito/example/integration_test/user_attributes_test.dart b/packages/amplify_auth_cognito/example/integration_test/user_attributes_test.dart index f89060ff7e..2179318592 100644 --- a/packages/amplify_auth_cognito/example/integration_test/user_attributes_test.dart +++ b/packages/amplify_auth_cognito/example/integration_test/user_attributes_test.dart @@ -26,7 +26,7 @@ const phoneNumberAttributeKey = CognitoUserAttributeKey.phoneNumber; const givenNameAttributeKey = CognitoUserAttributeKey.givenName; const emailVerifiedAttributeKey = CognitoUserAttributeKey.emailVerified; -dynamic getAttributeValueFromList( +String getAttributeValueFromList( List userAttributes, CognitoUserAttributeKey cognitoAttribute, ) { diff --git a/packages/amplify_auth_cognito/example/integration_test/utils/mock_data.dart b/packages/amplify_auth_cognito/example/integration_test/utils/mock_data.dart index f6ced4cac2..61e9142b50 100644 --- a/packages/amplify_auth_cognito/example/integration_test/utils/mock_data.dart +++ b/packages/amplify_auth_cognito/example/integration_test/utils/mock_data.dart @@ -1,3 +1,18 @@ +// +// Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"). +// You may not use this file except in compliance with the License. +// A copy of the License is located at +// +// http://aws.amazon.com/apache2.0 +// +// or in the "license" file accompanying this file. This file is distributed +// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either +// express or implied. See the License for the specific language governing +// permissions and limitations under the License. +// + import 'package:uuid/uuid.dart'; final uuid = Uuid(); diff --git a/packages/amplify_auth_cognito/example/integration_test/utils/setup_utils.dart b/packages/amplify_auth_cognito/example/integration_test/utils/setup_utils.dart index e36dd71d08..133c315ca0 100644 --- a/packages/amplify_auth_cognito/example/integration_test/utils/setup_utils.dart +++ b/packages/amplify_auth_cognito/example/integration_test/utils/setup_utils.dart @@ -1,3 +1,18 @@ +// +// Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"). +// You may not use this file except in compliance with the License. +// A copy of the License is located at +// +// http://aws.amazon.com/apache2.0 +// +// or in the "license" file accompanying this file. This file is distributed +// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either +// express or implied. See the License for the specific language governing +// permissions and limitations under the License. +// + import 'package:amplify_auth_cognito/amplify_auth_cognito.dart'; import 'package:amplify_auth_cognito_example/amplifyconfiguration.dart'; import 'package:amplify_flutter/amplify.dart'; diff --git a/packages/amplify_auth_cognito/example/integration_test/utils/validation_utils.dart b/packages/amplify_auth_cognito/example/integration_test/utils/validation_utils.dart index 7dce7c2565..a582900e0b 100644 --- a/packages/amplify_auth_cognito/example/integration_test/utils/validation_utils.dart +++ b/packages/amplify_auth_cognito/example/integration_test/utils/validation_utils.dart @@ -1,3 +1,18 @@ +// +// Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"). +// You may not use this file except in compliance with the License. +// A copy of the License is located at +// +// http://aws.amazon.com/apache2.0 +// +// or in the "license" file accompanying this file. This file is distributed +// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either +// express or implied. See the License for the specific language governing +// permissions and limitations under the License. +// + import 'package:amplify_auth_cognito/amplify_auth_cognito.dart'; final _hex = '[0-9a-f]'; diff --git a/packages/amplify_auth_cognito/example/ios/Runner/AppDelegate.swift b/packages/amplify_auth_cognito/example/ios/Runner/AppDelegate.swift index e7774f0162..217775c5a8 100644 --- a/packages/amplify_auth_cognito/example/ios/Runner/AppDelegate.swift +++ b/packages/amplify_auth_cognito/example/ios/Runner/AppDelegate.swift @@ -1,3 +1,18 @@ +// +// Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"). +// You may not use this file except in compliance with the License. +// A copy of the License is located at +// +// http://aws.amazon.com/apache2.0 +// +// or in the "license" file accompanying this file. This file is distributed +// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either +// express or implied. See the License for the specific language governing +// permissions and limitations under the License. +// + import UIKit import Flutter import Amplify diff --git a/packages/amplify_auth_cognito/example/lib/Widgets/ConfirmResetWidget.dart b/packages/amplify_auth_cognito/example/lib/Widgets/ConfirmResetWidget.dart index 3ac586c1d4..f8b2df64fb 100644 --- a/packages/amplify_auth_cognito/example/lib/Widgets/ConfirmResetWidget.dart +++ b/packages/amplify_auth_cognito/example/lib/Widgets/ConfirmResetWidget.dart @@ -1,3 +1,18 @@ +// +// Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"). +// You may not use this file except in compliance with the License. +// A copy of the License is located at +// +// http://aws.amazon.com/apache2.0 +// +// or in the "license" file accompanying this file. This file is distributed +// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either +// express or implied. See the License for the specific language governing +// permissions and limitations under the License. +// + import 'package:amplify_auth_cognito/amplify_auth_cognito.dart'; import 'package:amplify_core/amplify_core.dart'; import 'package:amplify_flutter/amplify.dart'; diff --git a/packages/amplify_auth_cognito/example/lib/Widgets/ConfirmSignInWidget.dart b/packages/amplify_auth_cognito/example/lib/Widgets/ConfirmSignInWidget.dart index 1623f9d145..93a3fde79c 100644 --- a/packages/amplify_auth_cognito/example/lib/Widgets/ConfirmSignInWidget.dart +++ b/packages/amplify_auth_cognito/example/lib/Widgets/ConfirmSignInWidget.dart @@ -1,3 +1,18 @@ +// +// Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"). +// You may not use this file except in compliance with the License. +// A copy of the License is located at +// +// http://aws.amazon.com/apache2.0 +// +// or in the "license" file accompanying this file. This file is distributed +// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either +// express or implied. See the License for the specific language governing +// permissions and limitations under the License. +// + import 'package:amplify_core/amplify_core.dart'; import 'package:amplify_flutter/amplify.dart'; import 'package:flutter/material.dart'; diff --git a/packages/amplify_auth_cognito/example/lib/Widgets/ConfirmSignUpWidget.dart b/packages/amplify_auth_cognito/example/lib/Widgets/ConfirmSignUpWidget.dart index 608f8d7a8d..31442e1440 100644 --- a/packages/amplify_auth_cognito/example/lib/Widgets/ConfirmSignUpWidget.dart +++ b/packages/amplify_auth_cognito/example/lib/Widgets/ConfirmSignUpWidget.dart @@ -1,3 +1,18 @@ +// +// Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"). +// You may not use this file except in compliance with the License. +// A copy of the License is located at +// +// http://aws.amazon.com/apache2.0 +// +// or in the "license" file accompanying this file. This file is distributed +// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either +// express or implied. See the License for the specific language governing +// permissions and limitations under the License. +// + import 'package:amplify_core/amplify_core.dart'; import 'package:amplify_flutter/amplify.dart'; import 'package:flutter/material.dart'; diff --git a/packages/amplify_auth_cognito/example/lib/Widgets/ConfirmUserAttribute.dart b/packages/amplify_auth_cognito/example/lib/Widgets/ConfirmUserAttribute.dart index 4d9f7c9514..49d4776582 100644 --- a/packages/amplify_auth_cognito/example/lib/Widgets/ConfirmUserAttribute.dart +++ b/packages/amplify_auth_cognito/example/lib/Widgets/ConfirmUserAttribute.dart @@ -1,3 +1,18 @@ +// +// Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"). +// You may not use this file except in compliance with the License. +// A copy of the License is located at +// +// http://aws.amazon.com/apache2.0 +// +// or in the "license" file accompanying this file. This file is distributed +// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either +// express or implied. See the License for the specific language governing +// permissions and limitations under the License. +// + import 'package:amplify_auth_cognito/amplify_auth_cognito.dart'; import 'package:amplify_core/amplify_core.dart'; import 'package:amplify_flutter/amplify.dart'; @@ -66,7 +81,7 @@ class _ConfirmUserAttributeState extends State { children: [ const SizedBox(height: 12), TextFormField( - initialValue: widget.userAttributeKey.key, + initialValue: widget.userAttributeKey.toString(), enabled: false, decoration: const InputDecoration( labelText: 'Attribute Name', diff --git a/packages/amplify_auth_cognito/example/lib/Widgets/SignInWidget.dart b/packages/amplify_auth_cognito/example/lib/Widgets/SignInWidget.dart index 9bbe530988..04d606b130 100644 --- a/packages/amplify_auth_cognito/example/lib/Widgets/SignInWidget.dart +++ b/packages/amplify_auth_cognito/example/lib/Widgets/SignInWidget.dart @@ -1,3 +1,18 @@ +// +// Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"). +// You may not use this file except in compliance with the License. +// A copy of the License is located at +// +// http://aws.amazon.com/apache2.0 +// +// or in the "license" file accompanying this file. This file is distributed +// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either +// express or implied. See the License for the specific language governing +// permissions and limitations under the License. +// + import 'package:amplify_auth_cognito/amplify_auth_cognito.dart'; import 'package:amplify_core/amplify_core.dart'; import 'package:amplify_flutter/amplify.dart'; diff --git a/packages/amplify_auth_cognito/example/lib/Widgets/SignUpWidget.dart b/packages/amplify_auth_cognito/example/lib/Widgets/SignUpWidget.dart index 2a39df01ec..19a4eb5c1a 100644 --- a/packages/amplify_auth_cognito/example/lib/Widgets/SignUpWidget.dart +++ b/packages/amplify_auth_cognito/example/lib/Widgets/SignUpWidget.dart @@ -1,3 +1,18 @@ +// +// Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"). +// You may not use this file except in compliance with the License. +// A copy of the License is located at +// +// http://aws.amazon.com/apache2.0 +// +// or in the "license" file accompanying this file. This file is distributed +// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either +// express or implied. See the License for the specific language governing +// permissions and limitations under the License. +// + import 'package:amplify_auth_cognito/amplify_auth_cognito.dart'; import 'package:amplify_core/amplify_core.dart'; import 'package:amplify_flutter/amplify.dart'; diff --git a/packages/amplify_auth_cognito/example/lib/Widgets/UpdatePasswordWidget.dart b/packages/amplify_auth_cognito/example/lib/Widgets/UpdatePasswordWidget.dart index adbf952141..414ad86a45 100644 --- a/packages/amplify_auth_cognito/example/lib/Widgets/UpdatePasswordWidget.dart +++ b/packages/amplify_auth_cognito/example/lib/Widgets/UpdatePasswordWidget.dart @@ -1,3 +1,18 @@ +// +// Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"). +// You may not use this file except in compliance with the License. +// A copy of the License is located at +// +// http://aws.amazon.com/apache2.0 +// +// or in the "license" file accompanying this file. This file is distributed +// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either +// express or implied. See the License for the specific language governing +// permissions and limitations under the License. +// + import 'package:amplify_core/amplify_core.dart'; import 'package:amplify_flutter/amplify.dart'; import 'package:flutter/material.dart'; diff --git a/packages/amplify_auth_cognito/example/lib/Widgets/UpdateUserAttribute.dart b/packages/amplify_auth_cognito/example/lib/Widgets/UpdateUserAttribute.dart index 27b29dd4d8..b133f1f81a 100644 --- a/packages/amplify_auth_cognito/example/lib/Widgets/UpdateUserAttribute.dart +++ b/packages/amplify_auth_cognito/example/lib/Widgets/UpdateUserAttribute.dart @@ -1,3 +1,18 @@ +// +// Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"). +// You may not use this file except in compliance with the License. +// A copy of the License is located at +// +// http://aws.amazon.com/apache2.0 +// +// or in the "license" file accompanying this file. This file is distributed +// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either +// express or implied. See the License for the specific language governing +// permissions and limitations under the License. +// + import 'package:amplify_auth_cognito/amplify_auth_cognito.dart'; import 'package:amplify_core/amplify_core.dart'; import 'package:amplify_flutter/amplify.dart'; @@ -7,7 +22,7 @@ import 'ConfirmUserAttribute.dart'; // ignore_for_file: public_member_api_docs class UpdateUserAttributeWidget extends StatefulWidget { - final String? userAttributeKey; + final CognitoUserAttributeKey? userAttributeKey; UpdateUserAttributeWidget({this.userAttributeKey}); @override @@ -55,7 +70,9 @@ class _UpdateUserAttributeWidgetState extends State { @override void initState() { isNewAttribute = widget.userAttributeKey == null; - _keyController = TextEditingController(text: widget.userAttributeKey); + _keyController = TextEditingController( + text: widget.userAttributeKey.toString(), + ); super.initState(); } diff --git a/packages/amplify_auth_cognito/example/lib/Widgets/UpdateUserAttributes.dart b/packages/amplify_auth_cognito/example/lib/Widgets/UpdateUserAttributes.dart index 2b45ded3f7..d1cd097b06 100644 --- a/packages/amplify_auth_cognito/example/lib/Widgets/UpdateUserAttributes.dart +++ b/packages/amplify_auth_cognito/example/lib/Widgets/UpdateUserAttributes.dart @@ -1,3 +1,18 @@ +// +// Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"). +// You may not use this file except in compliance with the License. +// A copy of the License is located at +// +// http://aws.amazon.com/apache2.0 +// +// or in the "license" file accompanying this file. This file is distributed +// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either +// express or implied. See the License for the specific language governing +// permissions and limitations under the License. +// + import 'package:amplify_auth_cognito/amplify_auth_cognito.dart'; import 'package:amplify_core/amplify_core.dart'; import 'package:amplify_flutter/amplify.dart'; diff --git a/packages/amplify_auth_cognito/example/lib/Widgets/ViewUserAttributes.dart b/packages/amplify_auth_cognito/example/lib/Widgets/ViewUserAttributes.dart index a9581853be..582df03e3f 100644 --- a/packages/amplify_auth_cognito/example/lib/Widgets/ViewUserAttributes.dart +++ b/packages/amplify_auth_cognito/example/lib/Widgets/ViewUserAttributes.dart @@ -1,3 +1,18 @@ +// +// Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"). +// You may not use this file except in compliance with the License. +// A copy of the License is located at +// +// http://aws.amazon.com/apache2.0 +// +// or in the "license" file accompanying this file. This file is distributed +// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either +// express or implied. See the License for the specific language governing +// permissions and limitations under the License. +// + import 'package:amplify_auth_cognito/amplify_auth_cognito.dart'; import 'package:amplify_flutter/amplify.dart'; import 'package:flutter/material.dart'; @@ -26,7 +41,7 @@ class _ViewUserAttributesState extends State { SnackBar(backgroundColor: Colors.red[900], content: Text(message))); } - Future _fetchAttributes({bool isRefresh = false}) { + Future _fetchAttributes({bool isRefresh = false}) { return Amplify.Auth.fetchUserAttributes().then((attributes) { setState(() => _userAttributes = attributes ..sort((a, b) => a.userAttributeKey.compareTo(b.userAttributeKey))); @@ -91,14 +106,14 @@ class _ViewUserAttributesState extends State { child: ListView.builder( itemCount: _userAttributes.length, itemBuilder: (context, index) { - var key = _userAttributes[index].userAttributeKey - as CognitoUserAttributeKey; - var value = _userAttributes[index].value; - var stringValue = value.toString(); + AuthUserAttribute atrribute = _userAttributes[index]; + CognitoUserAttributeKey userAttributeKey = + atrribute.userAttributeKey as CognitoUserAttributeKey; + String value = atrribute.value; return ListTile( - title: Text(key.key), - subtitle: Text(stringValue), - trailing: key.readOnly + title: Text(userAttributeKey.toString()), + subtitle: Text(value), + trailing: userAttributeKey.readOnly ? null : IconButton( icon: Icon(Icons.edit), @@ -107,7 +122,7 @@ class _ViewUserAttributesState extends State { MaterialPageRoute( builder: (context) => UpdateUserAttributeWidget( - userAttributeKey: key.key, + userAttributeKey: userAttributeKey, ), ), ); diff --git a/packages/amplify_auth_cognito/ios/amplify_auth_cognito.podspec b/packages/amplify_auth_cognito/ios/amplify_auth_cognito.podspec index 23d8e65506..775576d3d8 100644 --- a/packages/amplify_auth_cognito/ios/amplify_auth_cognito.podspec +++ b/packages/amplify_auth_cognito/ios/amplify_auth_cognito.podspec @@ -15,8 +15,8 @@ Pod::Spec.new do |s| s.source = { :git => 'https://github.com/aws-amplify/amplify-flutter.git' } s.source_files = 'Classes/**/*' s.dependency 'Flutter' - s.dependency 'Amplify', '~> 1.15.5' - s.dependency 'AmplifyPlugins/AWSCognitoAuthPlugin', '~> 1.15.5' + s.dependency 'Amplify', '1.15.6' + s.dependency 'AmplifyPlugins/AWSCognitoAuthPlugin', '1.15.6' s.dependency 'ObjectMapper' s.dependency 'amplify_core' s.platform = :ios, '11.0' diff --git a/packages/amplify_auth_cognito/test/amplify_auth_cognito_fetchUserAttributes_test.dart b/packages/amplify_auth_cognito/test/amplify_auth_cognito_fetchUserAttributes_test.dart index 154c46eaf8..edb3890b9e 100644 --- a/packages/amplify_auth_cognito/test/amplify_auth_cognito_fetchUserAttributes_test.dart +++ b/packages/amplify_auth_cognito/test/amplify_auth_cognito_fetchUserAttributes_test.dart @@ -68,7 +68,7 @@ void main() { expect(res[0].value, equals('person')); expect( res[1].userAttributeKey, equals(CognitoUserAttributeKey.custom('num'))); - expect(res[1].value, equals(2)); + expect(res[1].value, equals('2')); expect( res[2].userAttributeKey, equals( diff --git a/packages/amplify_auth_plugin_interface/lib/src/Attribute/AuthUserAttribute.dart b/packages/amplify_auth_plugin_interface/lib/src/Attribute/AuthUserAttribute.dart index 70e763b01d..8c2f983ef8 100644 --- a/packages/amplify_auth_plugin_interface/lib/src/Attribute/AuthUserAttribute.dart +++ b/packages/amplify_auth_plugin_interface/lib/src/Attribute/AuthUserAttribute.dart @@ -17,19 +17,13 @@ import 'package:amplify_auth_plugin_interface/amplify_auth_plugin_interface.dart class AuthUserAttribute { final UserAttributeKey userAttributeKey; - late final Object value; + final String value; /// Creates an object that holds the key and value for a user attribute. - AuthUserAttribute({ + const AuthUserAttribute({ required this.userAttributeKey, - required String value, - }) { - Object? _value; - if (userAttributeKey.key != 'phone_number') { - _value = int.tryParse(value); - } - this.value = _value ?? value; - } + required this.value, + }); // ignore: public_member_api_docs Map serializeAsMap() { diff --git a/packages/amplify_auth_plugin_interface/lib/src/Exceptions/invalid_user_pool_configuration_exception.dart b/packages/amplify_auth_plugin_interface/lib/src/Exceptions/invalid_user_pool_configuration_exception.dart index c610cf1f42..ea62aa9140 100644 --- a/packages/amplify_auth_plugin_interface/lib/src/Exceptions/invalid_user_pool_configuration_exception.dart +++ b/packages/amplify_auth_plugin_interface/lib/src/Exceptions/invalid_user_pool_configuration_exception.dart @@ -1,3 +1,18 @@ +// +// Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"). +// You may not use this file except in compliance with the License. +// A copy of the License is located at +// +// http://aws.amazon.com/apache2.0 +// +// or in the "license" file accompanying this file. This file is distributed +// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either +// express or implied. See the License for the specific language governing +// permissions and limitations under the License. +// + import 'package:amplify_auth_plugin_interface/amplify_auth_plugin_interface.dart'; /// {@template invalid_user_pool_configuration_exception} diff --git a/packages/amplify_core/android/build.gradle b/packages/amplify_core/android/build.gradle index 8643c08aff..58da361c0e 100644 --- a/packages/amplify_core/android/build.gradle +++ b/packages/amplify_core/android/build.gradle @@ -69,9 +69,9 @@ android { dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" - implementation 'com.amplifyframework:core:1.28.3-rc' + implementation 'com.amplifyframework:core:1.29.1' implementation 'com.google.code.gson:gson:2.8.6' - implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9' + implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.9' testImplementation 'junit:junit:4.13.2' testImplementation 'org.mockito:mockito-core:3.10.0' diff --git a/packages/amplify_core/android/src/main/kotlin/com/amazonaws/amplify/amplify_core/PlatformUtil.kt b/packages/amplify_core/android/src/main/kotlin/com/amazonaws/amplify/amplify_core/PlatformUtil.kt index e17b849c36..82e0302f21 100644 --- a/packages/amplify_core/android/src/main/kotlin/com/amazonaws/amplify/amplify_core/PlatformUtil.kt +++ b/packages/amplify_core/android/src/main/kotlin/com/amazonaws/amplify/amplify_core/PlatformUtil.kt @@ -1,3 +1,20 @@ +/* + * + * Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"). + * You may not use this file except in compliance with the License. + * A copy of the License is located at + * + * http://aws.amazon.com/apache2.0 + * + * or in the "license" file accompanying this file. This file is distributed + * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing + * permissions and limitations under the License. + * + */ + package com.amazonaws.amplify.amplify_core /** diff --git a/packages/amplify_core/example/android/app/src/main/kotlin/com/example/amplify_core_example/MainActivity.kt b/packages/amplify_core/example/android/app/src/main/kotlin/com/example/amplify_core_example/MainActivity.kt index f943fbe0be..d074a0959e 100644 --- a/packages/amplify_core/example/android/app/src/main/kotlin/com/example/amplify_core_example/MainActivity.kt +++ b/packages/amplify_core/example/android/app/src/main/kotlin/com/example/amplify_core_example/MainActivity.kt @@ -1,3 +1,20 @@ +/* + * + * Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"). + * You may not use this file except in compliance with the License. + * A copy of the License is located at + * + * http://aws.amazon.com/apache2.0 + * + * or in the "license" file accompanying this file. This file is distributed + * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing + * permissions and limitations under the License. + * + */ + package com.example.amplify_core_example import io.flutter.embedding.android.FlutterActivity diff --git a/packages/amplify_core/example/ios/Runner/AppDelegate.swift b/packages/amplify_core/example/ios/Runner/AppDelegate.swift index 70693e4a8c..db74139c8c 100644 --- a/packages/amplify_core/example/ios/Runner/AppDelegate.swift +++ b/packages/amplify_core/example/ios/Runner/AppDelegate.swift @@ -1,3 +1,18 @@ +// +// Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"). +// You may not use this file except in compliance with the License. +// A copy of the License is located at +// +// http://aws.amazon.com/apache2.0 +// +// or in the "license" file accompanying this file. This file is distributed +// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either +// express or implied. See the License for the specific language governing +// permissions and limitations under the License. +// + import UIKit import Flutter diff --git a/packages/amplify_core/example/lib/main.dart b/packages/amplify_core/example/lib/main.dart index 1ebdbe1d20..d53f185a47 100644 --- a/packages/amplify_core/example/lib/main.dart +++ b/packages/amplify_core/example/lib/main.dart @@ -1,3 +1,18 @@ +// +// Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"). +// You may not use this file except in compliance with the License. +// A copy of the License is located at +// +// http://aws.amazon.com/apache2.0 +// +// or in the "license" file accompanying this file. This file is distributed +// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either +// express or implied. See the License for the specific language governing +// permissions and limitations under the License. +// + import 'package:flutter/material.dart'; void main() { diff --git a/packages/amplify_core/lib/amplify_core.dart b/packages/amplify_core/lib/amplify_core.dart index d3332772e0..b6b5ccba4d 100644 --- a/packages/amplify_core/lib/amplify_core.dart +++ b/packages/amplify_core/lib/amplify_core.dart @@ -1,17 +1,17 @@ -/* - * Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"). - * You may not use this file except in compliance with the License. - * A copy of the License is located at - * - * http://aws.amazon.com/apache2.0 - * - * or in the "license" file accompanying this file. This file is distributed - * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either - * express or implied. See the License for the specific language governing - * permissions and limitations under the License. - */ +// +// Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"). +// You may not use this file except in compliance with the License. +// A copy of the License is located at +// +// http://aws.amazon.com/apache2.0 +// +// or in the "license" file accompanying this file. This file is distributed +// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either +// express or implied. See the License for the specific language governing +// permissions and limitations under the License. +// library amplify_core; diff --git a/packages/amplify_core/lib/src/util/json.dart b/packages/amplify_core/lib/src/util/json.dart deleted file mode 100644 index 6b4b7eb958..0000000000 --- a/packages/amplify_core/lib/src/util/json.dart +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"). - * You may not use this file except in compliance with the License. - * A copy of the License is located at - * - * http://aws.amazon.com/apache2.0 - * - * or in the "license" file accompanying this file. This file is distributed - * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either - * express or implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -import 'dart:convert'; -import 'dart:io'; - -dynamic getJsonFromFile(String path) async { - path = 'resources/' + path; - String jsonString = ''; - try { - jsonString = await File(path).readAsString(); - } catch (e) { - jsonString = await File('test/' + path).readAsString(); - } - return jsonDecode(jsonString); -} diff --git a/packages/amplify_datastore/android/build.gradle b/packages/amplify_datastore/android/build.gradle index c43a3c576f..b9cfb4e003 100644 --- a/packages/amplify_datastore/android/build.gradle +++ b/packages/amplify_datastore/android/build.gradle @@ -62,8 +62,8 @@ android { dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" - implementation "com.amplifyframework:aws-datastore:1.28.3-rc" - implementation "com.amplifyframework:aws-api-appsync:1.28.3-rc" + implementation "com.amplifyframework:aws-datastore:1.29.1" + implementation "com.amplifyframework:aws-api-appsync:1.29.1" testImplementation 'junit:junit:4.13.2' testImplementation 'org.mockito:mockito-core:3.10.0' testImplementation 'org.mockito:mockito-inline:3.10.0' diff --git a/packages/amplify_datastore/android/src/main/kotlin/com/amazonaws/amplify/amplify_datastore/AmplifyDataStorePlugin.kt b/packages/amplify_datastore/android/src/main/kotlin/com/amazonaws/amplify/amplify_datastore/AmplifyDataStorePlugin.kt index f3535172c0..35f07a3eda 100644 --- a/packages/amplify_datastore/android/src/main/kotlin/com/amazonaws/amplify/amplify_datastore/AmplifyDataStorePlugin.kt +++ b/packages/amplify_datastore/android/src/main/kotlin/com/amazonaws/amplify/amplify_datastore/AmplifyDataStorePlugin.kt @@ -195,8 +195,7 @@ class AmplifyDataStorePlugin : FlutterPlugin, MethodCallHandler { ) channel.invokeMethod("errorHandler", args) } - } - else { + } else { DataStoreErrorHandler { LOG.error(it.toString()) } diff --git a/packages/amplify_datastore/android/src/main/kotlin/com/amazonaws/amplify/amplify_datastore/types/model/FlutterAuthRule.kt b/packages/amplify_datastore/android/src/main/kotlin/com/amazonaws/amplify/amplify_datastore/types/model/FlutterAuthRule.kt index 7198bbbf73..c283eed281 100644 --- a/packages/amplify_datastore/android/src/main/kotlin/com/amazonaws/amplify/amplify_datastore/types/model/FlutterAuthRule.kt +++ b/packages/amplify_datastore/android/src/main/kotlin/com/amazonaws/amplify/amplify_datastore/types/model/FlutterAuthRule.kt @@ -30,7 +30,8 @@ data class FlutterAuthRule(val map: Map) { private val groupsField: String? = map["groupsField"] as String? private val operations: List? = (map["operations"] as List?)?.map { stringToModelOperation(it) } - private val authProvider: AuthStrategy.Provider? = stringToAuthStrategyProvider(map["provider"] as String?) + private val authProvider: AuthStrategy.Provider = + stringToAuthStrategyProvider(map["provider"] as String?) ?: authStrategy.defaultAuthProvider private fun stringToAuthStrategy(string: String): AuthStrategy { return when (string) { @@ -68,9 +69,7 @@ data class FlutterAuthRule(val map: Map) { val builder: AuthRule.Builder = AuthRule.builder() .authStrategy(authStrategy) - if (authProvider != null) { - builder.authProvider(authProvider) - } + builder.authProvider(authProvider) if (groups != null && groups.isNotEmpty()) { builder.groups(groups) diff --git a/packages/amplify_datastore/example/integration_test/utils/constants.dart b/packages/amplify_datastore/example/integration_test/utils/constants.dart index da502e16c2..1254ca7864 100644 --- a/packages/amplify_datastore/example/integration_test/utils/constants.dart +++ b/packages/amplify_datastore/example/integration_test/utils/constants.dart @@ -1,3 +1,18 @@ +// +// Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"). +// You may not use this file except in compliance with the License. +// A copy of the License is located at +// +// http://aws.amazon.com/apache2.0 +// +// or in the "license" file accompanying this file. This file is distributed +// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either +// express or implied. See the License for the specific language governing +// permissions and limitations under the License. +// + import 'dart:math'; // min and max 32 bit int values diff --git a/packages/amplify_datastore/example/integration_test/utils/model_test_operation_utils.dart b/packages/amplify_datastore/example/integration_test/utils/model_test_operation_utils.dart index e9b90b028d..10cd367c74 100644 --- a/packages/amplify_datastore/example/integration_test/utils/model_test_operation_utils.dart +++ b/packages/amplify_datastore/example/integration_test/utils/model_test_operation_utils.dart @@ -1,3 +1,18 @@ +// +// Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"). +// You may not use this file except in compliance with the License. +// A copy of the License is located at +// +// http://aws.amazon.com/apache2.0 +// +// or in the "license" file accompanying this file. This file is distributed +// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either +// express or implied. See the License for the specific language governing +// permissions and limitations under the License. +// + import 'package:amplify_datastore/amplify_datastore.dart'; import 'package:amplify_datastore_plugin_interface/amplify_datastore_plugin_interface.dart'; import 'package:amplify_flutter/amplify.dart'; diff --git a/packages/amplify_datastore/example/integration_test/utils/model_utils.dart b/packages/amplify_datastore/example/integration_test/utils/model_utils.dart index 7ea22a4172..1409c1f654 100644 --- a/packages/amplify_datastore/example/integration_test/utils/model_utils.dart +++ b/packages/amplify_datastore/example/integration_test/utils/model_utils.dart @@ -1,3 +1,18 @@ +// +// Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"). +// You may not use this file except in compliance with the License. +// A copy of the License is located at +// +// http://aws.amazon.com/apache2.0 +// +// or in the "license" file accompanying this file. This file is distributed +// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either +// express or implied. See the License for the specific language governing +// permissions and limitations under the License. +// + import 'package:amplify_datastore_example/models/ModelProvider.dart'; import 'package:amplify_datastore_plugin_interface/amplify_datastore_plugin_interface.dart'; diff --git a/packages/amplify_datastore/example/integration_test/utils/query_predicate_utils.dart b/packages/amplify_datastore/example/integration_test/utils/query_predicate_utils.dart index ac97edd6bc..ab351c571e 100644 --- a/packages/amplify_datastore/example/integration_test/utils/query_predicate_utils.dart +++ b/packages/amplify_datastore/example/integration_test/utils/query_predicate_utils.dart @@ -1,3 +1,18 @@ +// +// Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"). +// You may not use this file except in compliance with the License. +// A copy of the License is located at +// +// http://aws.amazon.com/apache2.0 +// +// or in the "license" file accompanying this file. This file is distributed +// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either +// express or implied. See the License for the specific language governing +// permissions and limitations under the License. +// + import 'package:amplify_datastore/amplify_datastore.dart'; import 'package:amplify_datastore_plugin_interface/amplify_datastore_plugin_interface.dart'; import 'package:amplify_flutter/amplify.dart'; diff --git a/packages/amplify_datastore/example/integration_test/utils/setup_utils.dart b/packages/amplify_datastore/example/integration_test/utils/setup_utils.dart index 3e4665d8bc..692c38a270 100644 --- a/packages/amplify_datastore/example/integration_test/utils/setup_utils.dart +++ b/packages/amplify_datastore/example/integration_test/utils/setup_utils.dart @@ -1,3 +1,18 @@ +// +// Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"). +// You may not use this file except in compliance with the License. +// A copy of the License is located at +// +// http://aws.amazon.com/apache2.0 +// +// or in the "license" file accompanying this file. This file is distributed +// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either +// express or implied. See the License for the specific language governing +// permissions and limitations under the License. +// + import 'package:amplify_datastore/amplify_datastore.dart'; import 'package:amplify_datastore_example/amplifyconfiguration.dart'; import 'package:amplify_datastore_example/models/ModelProvider.dart'; diff --git a/packages/amplify_datastore/example/integration_test/utils/sort_order_utils.dart b/packages/amplify_datastore/example/integration_test/utils/sort_order_utils.dart index 065abd8256..6003dc1f8b 100644 --- a/packages/amplify_datastore/example/integration_test/utils/sort_order_utils.dart +++ b/packages/amplify_datastore/example/integration_test/utils/sort_order_utils.dart @@ -1,3 +1,18 @@ +// +// Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"). +// You may not use this file except in compliance with the License. +// A copy of the License is located at +// +// http://aws.amazon.com/apache2.0 +// +// or in the "license" file accompanying this file. This file is distributed +// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either +// express or implied. See the License for the specific language governing +// permissions and limitations under the License. +// + import 'package:amplify_datastore/amplify_datastore.dart'; import 'package:amplify_datastore_plugin_interface/amplify_datastore_plugin_interface.dart'; import 'package:amplify_datastore_example/models/ModelProvider.dart'; diff --git a/packages/amplify_datastore/example/ios/Runner/AppDelegate.swift b/packages/amplify_datastore/example/ios/Runner/AppDelegate.swift index 70693e4a8c..db74139c8c 100644 --- a/packages/amplify_datastore/example/ios/Runner/AppDelegate.swift +++ b/packages/amplify_datastore/example/ios/Runner/AppDelegate.swift @@ -1,3 +1,18 @@ +// +// Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"). +// You may not use this file except in compliance with the License. +// A copy of the License is located at +// +// http://aws.amazon.com/apache2.0 +// +// or in the "license" file accompanying this file. This file is distributed +// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either +// express or implied. See the License for the specific language governing +// permissions and limitations under the License. +// + import UIKit import Flutter diff --git a/packages/amplify_datastore/example/lib/event_display_widgets.dart b/packages/amplify_datastore/example/lib/event_display_widgets.dart index 66f93ed482..714137b624 100644 --- a/packages/amplify_datastore/example/lib/event_display_widgets.dart +++ b/packages/amplify_datastore/example/lib/event_display_widgets.dart @@ -1,55 +1,70 @@ -part of sample_app; - -Widget getWidgetToDisplayBlogEvents(ScrollController scrollController, - List streamingData, Future Function() executeAfterBuild) { - return SizedBox( - height: 70, - child: ListView.builder( - controller: scrollController, - shrinkWrap: true, - reverse: true, - itemCount: streamingData.length, - itemBuilder: (BuildContext context, int index) { - executeAfterBuild(); - return Container( - margin: EdgeInsets.fromLTRB(30, 0, 0, 0), - child: Text(streamingData[index]), - ); - })); -} - -Widget getWidgetToDisplayPostEvents(ScrollController scrollController, - List streamingData, Future Function() executeAfterBuild) { - return SizedBox( - height: 70, - child: ListView.builder( - controller: scrollController, - shrinkWrap: true, - reverse: true, - itemCount: streamingData.length, - itemBuilder: (BuildContext context, int index) { - executeAfterBuild(); - return Container( - margin: EdgeInsets.fromLTRB(30, 0, 0, 0), - child: Text(streamingData[index]), - ); - })); -} - -Widget getWidgetToDisplayCommentEvents(ScrollController scrollController, - List streamingData, Future Function() executeAfterBuild) { - return SizedBox( - height: 70, - child: ListView.builder( - controller: scrollController, - shrinkWrap: true, - reverse: true, - itemCount: streamingData.length, - itemBuilder: (BuildContext context, int index) { - executeAfterBuild(); - return Container( - margin: EdgeInsets.fromLTRB(30, 0, 0, 0), - child: Text(streamingData[index]), - ); - })); -} +// +// Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"). +// You may not use this file except in compliance with the License. +// A copy of the License is located at +// +// http://aws.amazon.com/apache2.0 +// +// or in the "license" file accompanying this file. This file is distributed +// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either +// express or implied. See the License for the specific language governing +// permissions and limitations under the License. +// + +part of sample_app; + +Widget getWidgetToDisplayBlogEvents(ScrollController scrollController, + List streamingData, Future Function() executeAfterBuild) { + return SizedBox( + height: 70, + child: ListView.builder( + controller: scrollController, + shrinkWrap: true, + reverse: true, + itemCount: streamingData.length, + itemBuilder: (BuildContext context, int index) { + executeAfterBuild(); + return Container( + margin: EdgeInsets.fromLTRB(30, 0, 0, 0), + child: Text(streamingData[index]), + ); + })); +} + +Widget getWidgetToDisplayPostEvents(ScrollController scrollController, + List streamingData, Future Function() executeAfterBuild) { + return SizedBox( + height: 70, + child: ListView.builder( + controller: scrollController, + shrinkWrap: true, + reverse: true, + itemCount: streamingData.length, + itemBuilder: (BuildContext context, int index) { + executeAfterBuild(); + return Container( + margin: EdgeInsets.fromLTRB(30, 0, 0, 0), + child: Text(streamingData[index]), + ); + })); +} + +Widget getWidgetToDisplayCommentEvents(ScrollController scrollController, + List streamingData, Future Function() executeAfterBuild) { + return SizedBox( + height: 70, + child: ListView.builder( + controller: scrollController, + shrinkWrap: true, + reverse: true, + itemCount: streamingData.length, + itemBuilder: (BuildContext context, int index) { + executeAfterBuild(); + return Container( + margin: EdgeInsets.fromLTRB(30, 0, 0, 0), + child: Text(streamingData[index]), + ); + })); +} diff --git a/packages/amplify_datastore/example/lib/queries_display_widgets.dart b/packages/amplify_datastore/example/lib/queries_display_widgets.dart index 24fb80ec2a..f0b76d3b0e 100644 --- a/packages/amplify_datastore/example/lib/queries_display_widgets.dart +++ b/packages/amplify_datastore/example/lib/queries_display_widgets.dart @@ -1,170 +1,185 @@ -part of sample_app; - -Widget displayQueryButtons(bool isAmplifyConfigured, _MyAppState app) { - var boldText = - TextStyle(fontWeight: FontWeight.bold, color: Colors.black, fontSize: 14); - return Row(mainAxisAlignment: MainAxisAlignment.center, children: [ - VerticalDivider( - color: Colors.white, - width: 5, - ), - ElevatedButton( - onPressed: () { - if (isAmplifyConfigured) { - app.setState(() { - app._queriesToView = "Blog"; - }); - } - return null; - }, - style: ButtonStyle( - backgroundColor: MaterialStateProperty.all( - app._queriesToView == "Blog" ? Colors.white10 : Colors.white60, - ), - ), - child: Text( - 'Blogs', - style: app._queriesToView == "Blog" ? boldText : TextStyle(), - ), - ), - divider, - ElevatedButton( - onPressed: () { - if (isAmplifyConfigured) { - app.setState(() { - app._queriesToView = "Post"; - }); - } - return null; - }, - style: ButtonStyle( - backgroundColor: MaterialStateProperty.all( - app._queriesToView == "Post" ? Colors.white10 : Colors.white60, - ), - ), - child: Text( - 'Posts', - style: app._queriesToView == "Post" ? boldText : TextStyle(), - ), - ), - divider, - ElevatedButton( - onPressed: () { - if (isAmplifyConfigured) { - app.setState(() { - app._queriesToView = "Comment"; - }); - } - return null; - }, - style: ButtonStyle( - backgroundColor: MaterialStateProperty.all( - app._queriesToView == "Comment" ? Colors.white10 : Colors.white60, - ), - ), - child: Text( - 'Comments', - style: app._queriesToView == "Comment" ? boldText : TextStyle(), - ), - ), - ]); -} - -Widget getWidgetToDisplayBlog(List _blogsToView, Function deleteBlog) { - return Expanded( - child: ListView.builder( - itemCount: _blogsToView.length, - padding: const EdgeInsets.all(16.0), - scrollDirection: Axis.vertical, - shrinkWrap: true, - itemBuilder: /*1*/ (context, i) { - return ListTile( - title: Text( - "Name: " + _blogsToView[i].name, - style: TextStyle(fontSize: 14.0), - ), - trailing: IconButton( - onPressed: () { - print("Deleting " + _blogsToView[i].name); - deleteBlog(_blogsToView[i].id); - }, - icon: Icon( - Icons.delete_forever, - color: Colors.red, - ), - ), - ); - }), - ); -} - -Widget getWidgetToDisplayPost( - List _postsToView, Function deletePost, List allBlogs) { - return Expanded( - child: ListView.builder( - itemCount: _postsToView.length, - padding: const EdgeInsets.all(16.0), - scrollDirection: Axis.vertical, - // shrinkWrap: true, - itemBuilder: /*1*/ (context, i) { - return ListTile( - title: Text( - "Title: " + - _postsToView[i].title + - ", rating: " + - _postsToView[i].rating.toString() + - ", blog: " + - allBlogs - .firstWhere((blog) => blog.id == _postsToView[i].blog?.id) - .name, - style: TextStyle(fontSize: 14.0), - ), - trailing: IconButton( - onPressed: () { - print("Deleting " + _postsToView[i].title); - deletePost(_postsToView[i].id); - }, - icon: Icon( - Icons.delete_forever, - color: Colors.red, - ), - ), - ); - }), - ); -} - -Widget getWidgetToDisplayComment( - List _commentsToView, Function deleteFn, List allPosts) { - return Expanded( - child: ListView.builder( - itemCount: _commentsToView.length, - padding: const EdgeInsets.all(16.0), - scrollDirection: Axis.vertical, - shrinkWrap: true, - itemBuilder: /*1*/ (context, i) { - return ListTile( - title: Text( - "Content: " + - _commentsToView[i].content + - " and post: " + - allPosts - .firstWhere( - (post) => post.id == _commentsToView[i].post?.id) - .title, - style: TextStyle(fontSize: 14.0), - ), - trailing: IconButton( - onPressed: () { - print("Deleting " + _commentsToView[i].content); - deleteFn(_commentsToView[i].id); - }, - icon: Icon( - Icons.delete_forever, - color: Colors.red, - ), - ), - ); - }), - ); -} +// +// Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"). +// You may not use this file except in compliance with the License. +// A copy of the License is located at +// +// http://aws.amazon.com/apache2.0 +// +// or in the "license" file accompanying this file. This file is distributed +// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either +// express or implied. See the License for the specific language governing +// permissions and limitations under the License. +// + +part of sample_app; + +Widget displayQueryButtons(bool isAmplifyConfigured, _MyAppState app) { + var boldText = + TextStyle(fontWeight: FontWeight.bold, color: Colors.black, fontSize: 14); + return Row(mainAxisAlignment: MainAxisAlignment.center, children: [ + VerticalDivider( + color: Colors.white, + width: 5, + ), + ElevatedButton( + onPressed: () { + if (isAmplifyConfigured) { + app.setState(() { + app._queriesToView = "Blog"; + }); + } + return null; + }, + style: ButtonStyle( + backgroundColor: MaterialStateProperty.all( + app._queriesToView == "Blog" ? Colors.white10 : Colors.white60, + ), + ), + child: Text( + 'Blogs', + style: app._queriesToView == "Blog" ? boldText : TextStyle(), + ), + ), + divider, + ElevatedButton( + onPressed: () { + if (isAmplifyConfigured) { + app.setState(() { + app._queriesToView = "Post"; + }); + } + return null; + }, + style: ButtonStyle( + backgroundColor: MaterialStateProperty.all( + app._queriesToView == "Post" ? Colors.white10 : Colors.white60, + ), + ), + child: Text( + 'Posts', + style: app._queriesToView == "Post" ? boldText : TextStyle(), + ), + ), + divider, + ElevatedButton( + onPressed: () { + if (isAmplifyConfigured) { + app.setState(() { + app._queriesToView = "Comment"; + }); + } + return null; + }, + style: ButtonStyle( + backgroundColor: MaterialStateProperty.all( + app._queriesToView == "Comment" ? Colors.white10 : Colors.white60, + ), + ), + child: Text( + 'Comments', + style: app._queriesToView == "Comment" ? boldText : TextStyle(), + ), + ), + ]); +} + +Widget getWidgetToDisplayBlog(List _blogsToView, Function deleteBlog) { + return Expanded( + child: ListView.builder( + itemCount: _blogsToView.length, + padding: const EdgeInsets.all(16.0), + scrollDirection: Axis.vertical, + shrinkWrap: true, + itemBuilder: /*1*/ (context, i) { + return ListTile( + title: Text( + "Name: " + _blogsToView[i].name, + style: TextStyle(fontSize: 14.0), + ), + trailing: IconButton( + onPressed: () { + print("Deleting " + _blogsToView[i].name); + deleteBlog(_blogsToView[i].id); + }, + icon: Icon( + Icons.delete_forever, + color: Colors.red, + ), + ), + ); + }), + ); +} + +Widget getWidgetToDisplayPost( + List _postsToView, Function deletePost, List allBlogs) { + return Expanded( + child: ListView.builder( + itemCount: _postsToView.length, + padding: const EdgeInsets.all(16.0), + scrollDirection: Axis.vertical, + // shrinkWrap: true, + itemBuilder: /*1*/ (context, i) { + return ListTile( + title: Text( + "Title: " + + _postsToView[i].title + + ", rating: " + + _postsToView[i].rating.toString() + + ", blog: " + + allBlogs + .firstWhere((blog) => blog.id == _postsToView[i].blog?.id) + .name, + style: TextStyle(fontSize: 14.0), + ), + trailing: IconButton( + onPressed: () { + print("Deleting " + _postsToView[i].title); + deletePost(_postsToView[i].id); + }, + icon: Icon( + Icons.delete_forever, + color: Colors.red, + ), + ), + ); + }), + ); +} + +Widget getWidgetToDisplayComment( + List _commentsToView, Function deleteFn, List allPosts) { + return Expanded( + child: ListView.builder( + itemCount: _commentsToView.length, + padding: const EdgeInsets.all(16.0), + scrollDirection: Axis.vertical, + shrinkWrap: true, + itemBuilder: /*1*/ (context, i) { + return ListTile( + title: Text( + "Content: " + + _commentsToView[i].content + + " and post: " + + allPosts + .firstWhere( + (post) => post.id == _commentsToView[i].post?.id) + .title, + style: TextStyle(fontSize: 14.0), + ), + trailing: IconButton( + onPressed: () { + print("Deleting " + _commentsToView[i].content); + deleteFn(_commentsToView[i].id); + }, + icon: Icon( + Icons.delete_forever, + color: Colors.red, + ), + ), + ); + }), + ); +} diff --git a/packages/amplify_datastore/example/lib/save_model_widgets.dart b/packages/amplify_datastore/example/lib/save_model_widgets.dart index aeb4bb5c3e..adbbd7980a 100644 --- a/packages/amplify_datastore/example/lib/save_model_widgets.dart +++ b/packages/amplify_datastore/example/lib/save_model_widgets.dart @@ -1,140 +1,155 @@ -part of sample_app; - -Widget addBlogWidget(TextEditingController controller, bool isAmplifyConfigured, - Function saveFn) { - return Row( - children: [ - divider, - Flexible( - child: TextField( - decoration: const InputDecoration(hintText: "Blog Name"), - controller: controller, - ), - ), - divider, - ElevatedButton( - onPressed: () async { - if (isAmplifyConfigured) { - await saveFn(controller.text); - controller.clear(); - return; - } - return null; - }, - child: const Text('Save Blog'), - ), - divider, - ], - ); -} - -Widget addPostWidget( - {required TextEditingController titleController, - required TextEditingController ratingController, - required bool isAmplifyConfigured, - required List allBlogs, - required Function saveFn, - required _MyAppState app, - Blog? defaultBlog}) { - return Row( - children: [ - divider, - Flexible( - child: TextField( - decoration: const InputDecoration(hintText: "Post Title"), - controller: titleController, - ), - ), - divider, - SizedBox( - width: 100, - child: TextField( - decoration: const InputDecoration(hintText: "Rating"), - keyboardType: TextInputType.number, - controller: ratingController, - inputFormatters: [ - FilteringTextInputFormatter.digitsOnly - ], - ), - ), - divider, - DropdownButton( - value: defaultBlog, - hint: Text("Blog"), - items: allBlogs - .map((e) => DropdownMenuItem( - child: Text(e.name), - value: e, - )) - .toList(), //_dropdownMenuItems, - onChanged: (value) { - app.setState(() { - app._selectedBlogForNewPost = value; - }); - }), - divider, - ElevatedButton( - onPressed: () async { - if (isAmplifyConfigured) { - await saveFn(titleController.text, int.parse(ratingController.text), - app._selectedBlogForNewPost); - titleController.clear(); - ratingController.clear(); - return; - } - return null; - }, - child: const Text('Save Post'), - ), - divider, - ], - ); -} - -Widget addCommentWidget( - TextEditingController controller, - bool isAmplifyConfigured, - Post? defaultPost, - List allPosts, - Function saveFn, - _MyAppState app) { - return Row( - children: [ - divider, - Flexible( - child: TextField( - decoration: const InputDecoration(hintText: "Comment"), - controller: controller, - ), - ), - divider, - DropdownButton( - value: defaultPost, - hint: Text("Post"), - items: allPosts - .map((e) => DropdownMenuItem( - child: Text(e.title), - value: e, - )) - .toList(), //_dropdownMenuItems, - onChanged: (value) { - app.setState(() { - app._selectedPostForNewComment = value; - }); - }), - divider, - ElevatedButton( - onPressed: () async { - if (isAmplifyConfigured) { - await saveFn(controller.text, app._selectedPostForNewComment); - controller.clear(); - return; - } - return null; - }, - child: const Text('Save Comment'), - ), - divider, - ], - ); -} +// +// Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"). +// You may not use this file except in compliance with the License. +// A copy of the License is located at +// +// http://aws.amazon.com/apache2.0 +// +// or in the "license" file accompanying this file. This file is distributed +// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either +// express or implied. See the License for the specific language governing +// permissions and limitations under the License. +// + +part of sample_app; + +Widget addBlogWidget(TextEditingController controller, bool isAmplifyConfigured, + Function saveFn) { + return Row( + children: [ + divider, + Flexible( + child: TextField( + decoration: const InputDecoration(hintText: "Blog Name"), + controller: controller, + ), + ), + divider, + ElevatedButton( + onPressed: () async { + if (isAmplifyConfigured) { + await saveFn(controller.text); + controller.clear(); + return; + } + return null; + }, + child: const Text('Save Blog'), + ), + divider, + ], + ); +} + +Widget addPostWidget( + {required TextEditingController titleController, + required TextEditingController ratingController, + required bool isAmplifyConfigured, + required List allBlogs, + required Function saveFn, + required _MyAppState app, + Blog? defaultBlog}) { + return Row( + children: [ + divider, + Flexible( + child: TextField( + decoration: const InputDecoration(hintText: "Post Title"), + controller: titleController, + ), + ), + divider, + SizedBox( + width: 100, + child: TextField( + decoration: const InputDecoration(hintText: "Rating"), + keyboardType: TextInputType.number, + controller: ratingController, + inputFormatters: [ + FilteringTextInputFormatter.digitsOnly + ], + ), + ), + divider, + DropdownButton( + value: defaultBlog, + hint: Text("Blog"), + items: allBlogs + .map((e) => DropdownMenuItem( + child: Text(e.name), + value: e, + )) + .toList(), //_dropdownMenuItems, + onChanged: (value) { + app.setState(() { + app._selectedBlogForNewPost = value; + }); + }), + divider, + ElevatedButton( + onPressed: () async { + if (isAmplifyConfigured) { + await saveFn(titleController.text, int.parse(ratingController.text), + app._selectedBlogForNewPost); + titleController.clear(); + ratingController.clear(); + return; + } + return null; + }, + child: const Text('Save Post'), + ), + divider, + ], + ); +} + +Widget addCommentWidget( + TextEditingController controller, + bool isAmplifyConfigured, + Post? defaultPost, + List allPosts, + Function saveFn, + _MyAppState app) { + return Row( + children: [ + divider, + Flexible( + child: TextField( + decoration: const InputDecoration(hintText: "Comment"), + controller: controller, + ), + ), + divider, + DropdownButton( + value: defaultPost, + hint: Text("Post"), + items: allPosts + .map((e) => DropdownMenuItem( + child: Text(e.title), + value: e, + )) + .toList(), //_dropdownMenuItems, + onChanged: (value) { + app.setState(() { + app._selectedPostForNewComment = value; + }); + }), + divider, + ElevatedButton( + onPressed: () async { + if (isAmplifyConfigured) { + await saveFn(controller.text, app._selectedPostForNewComment); + controller.clear(); + return; + } + return null; + }, + child: const Text('Save Comment'), + ), + divider, + ], + ); +} diff --git a/packages/amplify_datastore/ios/Classes/SwiftAmplifyDataStorePlugin.swift b/packages/amplify_datastore/ios/Classes/SwiftAmplifyDataStorePlugin.swift index 470087e3e1..5a3d23609d 100644 --- a/packages/amplify_datastore/ios/Classes/SwiftAmplifyDataStorePlugin.swift +++ b/packages/amplify_datastore/ios/Classes/SwiftAmplifyDataStorePlugin.swift @@ -139,9 +139,7 @@ public class SwiftAmplifyDataStorePlugin: NSObject, FlutterPlugin { modelSchemaRegistry: modelSchemaRegistry, customTypeSchemaRegistry: customTypeSchemaRegistry ) - - var errorHandler: DataStoreErrorHandler if((args["hasErrorHandler"] as? Bool) == true) { errorHandler = { error in @@ -150,7 +148,7 @@ public class SwiftAmplifyDataStorePlugin: NSObject, FlutterPlugin { "errorMesage" : ErrorMessages.defaultFallbackErrorMessage, "details" : FlutterDataStoreErrorHandler.createSerializedError(error: error) ] - self.channel!.invokeMethod("errorHandler", arguments: args) + self.channel!.invokeMethod("errorHandler", arguments: map) } } else { errorHandler = { error in diff --git a/packages/amplify_datastore/ios/amplify_datastore.podspec b/packages/amplify_datastore/ios/amplify_datastore.podspec index 64a5a9112d..62de68f7c8 100644 --- a/packages/amplify_datastore/ios/amplify_datastore.podspec +++ b/packages/amplify_datastore/ios/amplify_datastore.podspec @@ -15,8 +15,8 @@ The DataStore module for Amplify Flutter. s.source = { :git => 'https://github.com/aws-amplify/amplify-flutter.git' } s.source_files = 'Classes/**/*' s.dependency 'Flutter' - s.dependency 'Amplify', '~> 1.15.5' - s.dependency 'AmplifyPlugins/AWSDataStorePlugin', '~> 1.15.5' + s.dependency 'Amplify', '1.15.6' + s.dependency 'AmplifyPlugins/AWSDataStorePlugin', '1.15.6' s.dependency 'amplify_core' s.platform = :ios, '13.0' diff --git a/packages/amplify_datastore/test/outbox_mutation_event_test.dart b/packages/amplify_datastore/test/outbox_mutation_event_test.dart index 3157b28c3a..e816b26f7d 100644 --- a/packages/amplify_datastore/test/outbox_mutation_event_test.dart +++ b/packages/amplify_datastore/test/outbox_mutation_event_test.dart @@ -1,3 +1,18 @@ +// +// Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"). +// You may not use this file except in compliance with the License. +// A copy of the License is located at +// +// http://aws.amazon.com/apache2.0 +// +// or in the "license" file accompanying this file. This file is distributed +// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either +// express or implied. See the License for the specific language governing +// permissions and limitations under the License. +// + import 'package:amplify_datastore/amplify_datastore.dart'; import 'package:amplify_datastore/types/DataStoreHubEvents/HubEventElement.dart'; import 'package:amplify_datastore/types/DataStoreHubEvents/OutboxMutationEvent.dart'; diff --git a/packages/amplify_datastore_plugin_interface/lib/src/publicTypes.dart b/packages/amplify_datastore_plugin_interface/lib/src/publicTypes.dart index 642935ac86..0e32b33e7d 100644 --- a/packages/amplify_datastore_plugin_interface/lib/src/publicTypes.dart +++ b/packages/amplify_datastore_plugin_interface/lib/src/publicTypes.dart @@ -1,3 +1,18 @@ +// +// Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"). +// You may not use this file except in compliance with the License. +// A copy of the License is located at +// +// http://aws.amazon.com/apache2.0 +// +// or in the "license" file accompanying this file. This file is distributed +// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either +// express or implied. See the License for the specific language governing +// permissions and limitations under the License. +// + export 'types/exception/DataStoreException.dart'; export 'types/exception/DataStoreExceptionMessages.dart'; export 'types/models/subscription_event.dart'; diff --git a/packages/amplify_flutter/android/build.gradle b/packages/amplify_flutter/android/build.gradle index 04d2c2372e..9291687664 100644 --- a/packages/amplify_flutter/android/build.gradle +++ b/packages/amplify_flutter/android/build.gradle @@ -65,9 +65,9 @@ android { dependencies { api amplifyCore - implementation 'com.amplifyframework:core:1.28.3-rc' + implementation 'com.amplifyframework:core:1.29.1' implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" - implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9' + implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.9' testImplementation 'junit:junit:4.13.2' testImplementation 'org.mockito:mockito-core:3.10.0' @@ -75,6 +75,6 @@ dependencies { testImplementation 'androidx.test:core:1.4.0' testImplementation 'org.robolectric:robolectric:4.3.1' testImplementation 'com.google.code.gson:gson:2.8.6' - testImplementation 'com.amplifyframework:aws-auth-cognito:1.28.3-rc' + testImplementation 'com.amplifyframework:aws-auth-cognito:1.29.1' testImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-test:1.3.9' } diff --git a/packages/amplify_flutter/example/ios/Runner/AppDelegate.swift b/packages/amplify_flutter/example/ios/Runner/AppDelegate.swift index 70693e4a8c..db74139c8c 100644 --- a/packages/amplify_flutter/example/ios/Runner/AppDelegate.swift +++ b/packages/amplify_flutter/example/ios/Runner/AppDelegate.swift @@ -1,3 +1,18 @@ +// +// Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"). +// You may not use this file except in compliance with the License. +// A copy of the License is located at +// +// http://aws.amazon.com/apache2.0 +// +// or in the "license" file accompanying this file. This file is distributed +// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either +// express or implied. See the License for the specific language governing +// permissions and limitations under the License. +// + import UIKit import Flutter diff --git a/packages/amplify_flutter/ios/amplify_flutter.podspec b/packages/amplify_flutter/ios/amplify_flutter.podspec index 3df138da8d..28113592f9 100644 --- a/packages/amplify_flutter/ios/amplify_flutter.podspec +++ b/packages/amplify_flutter/ios/amplify_flutter.podspec @@ -17,9 +17,9 @@ Pod::Spec.new do |s| s.source = { :git => 'https://github.com/aws-amplify/amplify-flutter.git' } s.source_files = 'Classes/**/*' s.dependency 'Flutter' - s.dependency 'Amplify', '~> 1.15.5' - s.dependency 'AWSPluginsCore', '~> 1.15.5' - s.dependency 'AmplifyPlugins/AWSCognitoAuthPlugin', '~> 1.15.5' + s.dependency 'Amplify', '1.15.6' + s.dependency 'AWSPluginsCore', '1.15.6' + s.dependency 'AmplifyPlugins/AWSCognitoAuthPlugin', '1.15.6' s.dependency 'amplify_core' s.dependency 'SwiftLint' s.dependency 'SwiftFormat/CLI' diff --git a/packages/amplify_storage_s3/android/build.gradle b/packages/amplify_storage_s3/android/build.gradle index c5f856f759..59e336f226 100644 --- a/packages/amplify_storage_s3/android/build.gradle +++ b/packages/amplify_storage_s3/android/build.gradle @@ -49,5 +49,5 @@ android { dependencies { api amplifyCore implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" - implementation 'com.amplifyframework:aws-storage-s3:1.28.3-rc' + implementation 'com.amplifyframework:aws-storage-s3:1.29.1' } diff --git a/packages/amplify_storage_s3/example/ios/Runner/AppDelegate.swift b/packages/amplify_storage_s3/example/ios/Runner/AppDelegate.swift index 70693e4a8c..db74139c8c 100644 --- a/packages/amplify_storage_s3/example/ios/Runner/AppDelegate.swift +++ b/packages/amplify_storage_s3/example/ios/Runner/AppDelegate.swift @@ -1,3 +1,18 @@ +// +// Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"). +// You may not use this file except in compliance with the License. +// A copy of the License is located at +// +// http://aws.amazon.com/apache2.0 +// +// or in the "license" file accompanying this file. This file is distributed +// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either +// express or implied. See the License for the specific language governing +// permissions and limitations under the License. +// + import UIKit import Flutter diff --git a/packages/amplify_storage_s3/ios/amplify_storage_s3.podspec b/packages/amplify_storage_s3/ios/amplify_storage_s3.podspec index 1fd2b41df6..48e3beecc9 100644 --- a/packages/amplify_storage_s3/ios/amplify_storage_s3.podspec +++ b/packages/amplify_storage_s3/ios/amplify_storage_s3.podspec @@ -15,8 +15,8 @@ Pod::Spec.new do |s| s.source = { :path => '.' } s.source_files = 'Classes/**/*' s.dependency 'Flutter' - s.dependency 'Amplify', '~> 1.15.5' - s.dependency 'AmplifyPlugins/AWSS3StoragePlugin', '~> 1.15.5' + s.dependency 'Amplify', '1.15.6' + s.dependency 'AmplifyPlugins/AWSS3StoragePlugin', '1.15.6' s.dependency 'amplify_core' s.platform = :ios, '11.0' diff --git a/packages/amplify_storage_s3/lib/src/S3List/S3ListOptions.dart b/packages/amplify_storage_s3/lib/src/S3List/S3ListOptions.dart index 3293964dc2..512511dcfc 100644 --- a/packages/amplify_storage_s3/lib/src/S3List/S3ListOptions.dart +++ b/packages/amplify_storage_s3/lib/src/S3List/S3ListOptions.dart @@ -1,3 +1,18 @@ +// +// Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"). +// You may not use this file except in compliance with the License. +// A copy of the License is located at +// +// http://aws.amazon.com/apache2.0 +// +// or in the "license" file accompanying this file. This file is distributed +// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either +// express or implied. See the License for the specific language governing +// permissions and limitations under the License. +// + import 'package:flutter/foundation.dart'; import 'package:amplify_storage_plugin_interface/amplify_storage_plugin_interface.dart'; diff --git a/tool/license.txt b/tool/license.txt new file mode 100644 index 0000000000..582f995cda --- /dev/null +++ b/tool/license.txt @@ -0,0 +1,14 @@ + +Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"). +You may not use this file except in compliance with the License. +A copy of the License is located at + + http://aws.amazon.com/apache2.0 + +or in the "license" file accompanying this file. This file is distributed +on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either +express or implied. See the License for the specific language governing +permissions and limitations under the License. + \ No newline at end of file