From faf7f7df4c44a42d71d4100f7b59a1652986aab7 Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Thu, 21 Dec 2023 12:05:35 -0800 Subject: [PATCH 01/69] chore(deps): Amplify Android 2.14.7 --- packages/amplify_datastore/android/build.gradle | 8 ++++---- .../push/amplify_push_notifications/android/build.gradle | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/amplify_datastore/android/build.gradle b/packages/amplify_datastore/android/build.gradle index 9860f85e3a..bd3ae5ac92 100644 --- a/packages/amplify_datastore/android/build.gradle +++ b/packages/amplify_datastore/android/build.gradle @@ -72,10 +72,10 @@ dependencies { // Support for Java 8 features coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.3' - implementation 'com.amplifyframework:aws-auth-cognito:2.13.0' - implementation "com.amplifyframework:aws-api:2.13.0" - implementation "com.amplifyframework:aws-datastore:2.13.0" - implementation "com.amplifyframework:aws-api-appsync:2.13.0" + implementation 'com.amplifyframework:aws-auth-cognito:2.14.7' + implementation "com.amplifyframework:aws-api:2.14.7" + implementation "com.amplifyframework:aws-datastore:2.14.7" + implementation "com.amplifyframework:aws-api-appsync:2.14.7" implementation 'com.google.code.gson:gson:2.10.1' implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.1' diff --git a/packages/notifications/push/amplify_push_notifications/android/build.gradle b/packages/notifications/push/amplify_push_notifications/android/build.gradle index f93e2fd098..0e139dd5cc 100644 --- a/packages/notifications/push/amplify_push_notifications/android/build.gradle +++ b/packages/notifications/push/amplify_push_notifications/android/build.gradle @@ -65,7 +65,7 @@ android { dependencies { api "com.google.firebase:firebase-messaging:23.2.0" // Import support library for Amplify push utils - implementation 'com.amplifyframework:aws-push-notifications-pinpoint-common:2.13.0' + implementation 'com.amplifyframework:aws-push-notifications-pinpoint-common:2.14.7' implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.4.1" implementation project(path: ':flutter_plugin_android_lifecycle') implementation 'androidx.test:core-ktx:1.5.0' From c759f571a8b546b72f21bb298685b9ff9ac94c0a Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Wed, 27 Dec 2023 10:10:21 -0800 Subject: [PATCH 02/69] chore: update Kotlin version --- packages/amplify_datastore/android/build.gradle | 2 +- .../push/amplify_push_notifications/android/build.gradle | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/amplify_datastore/android/build.gradle b/packages/amplify_datastore/android/build.gradle index bd3ae5ac92..2c7671be58 100644 --- a/packages/amplify_datastore/android/build.gradle +++ b/packages/amplify_datastore/android/build.gradle @@ -2,7 +2,7 @@ group 'com.amazonaws.amplify.amplify_datastore' version '1.0-SNAPSHOT' buildscript { - ext.kotlin_version = '1.7.10' + ext.kotlin_version = '1.9.22' repositories { mavenLocal() google() diff --git a/packages/notifications/push/amplify_push_notifications/android/build.gradle b/packages/notifications/push/amplify_push_notifications/android/build.gradle index 0e139dd5cc..5d518ac79a 100644 --- a/packages/notifications/push/amplify_push_notifications/android/build.gradle +++ b/packages/notifications/push/amplify_push_notifications/android/build.gradle @@ -2,7 +2,7 @@ group 'com.amazonaws.amplify.amplify_push_notifications' version '1.0-SNAPSHOT' buildscript { - ext.kotlin_version = '1.7.10' + ext.kotlin_version = '1.9.22' repositories { google() mavenCentral() From 1c24861680ddb8b1e6d04c2344761cab8e9a4539 Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Wed, 27 Dec 2023 11:15:22 -0800 Subject: [PATCH 03/69] chore: try updating kotlin serialization --- .../push/amplify_push_notifications/android/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/notifications/push/amplify_push_notifications/android/build.gradle b/packages/notifications/push/amplify_push_notifications/android/build.gradle index 5d518ac79a..94528d5b02 100644 --- a/packages/notifications/push/amplify_push_notifications/android/build.gradle +++ b/packages/notifications/push/amplify_push_notifications/android/build.gradle @@ -66,7 +66,7 @@ dependencies { api "com.google.firebase:firebase-messaging:23.2.0" // Import support library for Amplify push utils implementation 'com.amplifyframework:aws-push-notifications-pinpoint-common:2.14.7' - implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.4.1" + implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.2" implementation project(path: ':flutter_plugin_android_lifecycle') implementation 'androidx.test:core-ktx:1.5.0' From 02f622401066e5cba8be85ef3b533106959baa8c Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Wed, 27 Dec 2023 11:26:14 -0800 Subject: [PATCH 04/69] Revert "chore: try updating kotlin serialization" This reverts commit 1c24861680ddb8b1e6d04c2344761cab8e9a4539. --- .../push/amplify_push_notifications/android/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/notifications/push/amplify_push_notifications/android/build.gradle b/packages/notifications/push/amplify_push_notifications/android/build.gradle index 94528d5b02..5d518ac79a 100644 --- a/packages/notifications/push/amplify_push_notifications/android/build.gradle +++ b/packages/notifications/push/amplify_push_notifications/android/build.gradle @@ -66,7 +66,7 @@ dependencies { api "com.google.firebase:firebase-messaging:23.2.0" // Import support library for Amplify push utils implementation 'com.amplifyframework:aws-push-notifications-pinpoint-common:2.14.7' - implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.2" + implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.4.1" implementation project(path: ':flutter_plugin_android_lifecycle') implementation 'androidx.test:core-ktx:1.5.0' From e0eee84aeee012d4e7ddd0692cda0fe2b5a5725e Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Wed, 27 Dec 2023 11:41:57 -0800 Subject: [PATCH 05/69] chore: revert kotlin back to last major version --- packages/amplify_datastore/android/build.gradle | 2 +- .../push/amplify_push_notifications/android/build.gradle | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/amplify_datastore/android/build.gradle b/packages/amplify_datastore/android/build.gradle index 2c7671be58..ac6cad4910 100644 --- a/packages/amplify_datastore/android/build.gradle +++ b/packages/amplify_datastore/android/build.gradle @@ -2,7 +2,7 @@ group 'com.amazonaws.amplify.amplify_datastore' version '1.0-SNAPSHOT' buildscript { - ext.kotlin_version = '1.9.22' + ext.kotlin_version = '1.9.0' repositories { mavenLocal() google() diff --git a/packages/notifications/push/amplify_push_notifications/android/build.gradle b/packages/notifications/push/amplify_push_notifications/android/build.gradle index 5d518ac79a..1c5853b541 100644 --- a/packages/notifications/push/amplify_push_notifications/android/build.gradle +++ b/packages/notifications/push/amplify_push_notifications/android/build.gradle @@ -2,7 +2,7 @@ group 'com.amazonaws.amplify.amplify_push_notifications' version '1.0-SNAPSHOT' buildscript { - ext.kotlin_version = '1.9.22' + ext.kotlin_version = '1.9.0' repositories { google() mavenCentral() From 3ac272633253d879cc843897e78b1f6c6bc1f07e Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Wed, 27 Dec 2023 11:54:43 -0800 Subject: [PATCH 06/69] chore: revert kotlin to 1.8.22 --- packages/amplify_datastore/android/build.gradle | 2 +- .../push/amplify_push_notifications/android/build.gradle | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/amplify_datastore/android/build.gradle b/packages/amplify_datastore/android/build.gradle index ac6cad4910..219b369ac6 100644 --- a/packages/amplify_datastore/android/build.gradle +++ b/packages/amplify_datastore/android/build.gradle @@ -2,7 +2,7 @@ group 'com.amazonaws.amplify.amplify_datastore' version '1.0-SNAPSHOT' buildscript { - ext.kotlin_version = '1.9.0' + ext.kotlin_version = '1.8.22' repositories { mavenLocal() google() diff --git a/packages/notifications/push/amplify_push_notifications/android/build.gradle b/packages/notifications/push/amplify_push_notifications/android/build.gradle index 1c5853b541..43851734ef 100644 --- a/packages/notifications/push/amplify_push_notifications/android/build.gradle +++ b/packages/notifications/push/amplify_push_notifications/android/build.gradle @@ -2,7 +2,7 @@ group 'com.amazonaws.amplify.amplify_push_notifications' version '1.0-SNAPSHOT' buildscript { - ext.kotlin_version = '1.9.0' + ext.kotlin_version = '1.8.22' repositories { google() mavenCentral() From 6dab253ecaaf0db0d8c9cc7c91b4abad7c2cf92d Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Wed, 27 Dec 2023 12:14:30 -0800 Subject: [PATCH 07/69] chore: upgrade kotlin in the corresponding examples --- packages/amplify_datastore/android/build.gradle | 2 +- packages/amplify_datastore/example/android/build.gradle | 2 +- .../push/amplify_push_notifications/android/build.gradle | 2 +- .../amplify_push_notifications/example/android/build.gradle | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/amplify_datastore/android/build.gradle b/packages/amplify_datastore/android/build.gradle index 219b369ac6..2c7671be58 100644 --- a/packages/amplify_datastore/android/build.gradle +++ b/packages/amplify_datastore/android/build.gradle @@ -2,7 +2,7 @@ group 'com.amazonaws.amplify.amplify_datastore' version '1.0-SNAPSHOT' buildscript { - ext.kotlin_version = '1.8.22' + ext.kotlin_version = '1.9.22' repositories { mavenLocal() google() diff --git a/packages/amplify_datastore/example/android/build.gradle b/packages/amplify_datastore/example/android/build.gradle index ce647a433b..ab1fdb4702 100644 --- a/packages/amplify_datastore/example/android/build.gradle +++ b/packages/amplify_datastore/example/android/build.gradle @@ -1,5 +1,5 @@ buildscript { - ext.kotlin_version = '1.7.10' + ext.kotlin_version = '1.9.22' repositories { google() mavenCentral() diff --git a/packages/notifications/push/amplify_push_notifications/android/build.gradle b/packages/notifications/push/amplify_push_notifications/android/build.gradle index 43851734ef..5d518ac79a 100644 --- a/packages/notifications/push/amplify_push_notifications/android/build.gradle +++ b/packages/notifications/push/amplify_push_notifications/android/build.gradle @@ -2,7 +2,7 @@ group 'com.amazonaws.amplify.amplify_push_notifications' version '1.0-SNAPSHOT' buildscript { - ext.kotlin_version = '1.8.22' + ext.kotlin_version = '1.9.22' repositories { google() mavenCentral() diff --git a/packages/notifications/push/amplify_push_notifications/example/android/build.gradle b/packages/notifications/push/amplify_push_notifications/example/android/build.gradle index f7eb7f63ce..fd59c3d1ba 100644 --- a/packages/notifications/push/amplify_push_notifications/example/android/build.gradle +++ b/packages/notifications/push/amplify_push_notifications/example/android/build.gradle @@ -1,5 +1,5 @@ buildscript { - ext.kotlin_version = '1.7.10' + ext.kotlin_version = '1.9.22' repositories { google() mavenCentral() From 344c15f0c349cd629845b0f23383977f94239ac4 Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Wed, 27 Dec 2023 12:26:52 -0800 Subject: [PATCH 08/69] chore: update gradle version on datastore example --- packages/amplify_datastore/example/android/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/amplify_datastore/example/android/build.gradle b/packages/amplify_datastore/example/android/build.gradle index ab1fdb4702..0d64718f89 100644 --- a/packages/amplify_datastore/example/android/build.gradle +++ b/packages/amplify_datastore/example/android/build.gradle @@ -6,7 +6,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:7.4.2' + classpath 'com.android.tools.build:gradle:8.1.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } From a7edeb6b2c04943a0636e92dfcfb7d0ac00776e3 Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Thu, 28 Dec 2023 10:49:26 -0800 Subject: [PATCH 09/69] chore: upgrade gradle --- .../android/gradle/wrapper/gradle-wrapper.properties | 2 +- .../example/android/gradle/wrapper/gradle-wrapper.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/amplify_datastore/android/gradle/wrapper/gradle-wrapper.properties b/packages/amplify_datastore/android/gradle/wrapper/gradle-wrapper.properties index ceccc3a854..3ba4255dd8 100644 --- a/packages/amplify_datastore/android/gradle/wrapper/gradle-wrapper.properties +++ b/packages/amplify_datastore/android/gradle/wrapper/gradle-wrapper.properties @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.0-all.zip diff --git a/packages/amplify_datastore/example/android/gradle/wrapper/gradle-wrapper.properties b/packages/amplify_datastore/example/android/gradle/wrapper/gradle-wrapper.properties index ceccc3a854..3ba4255dd8 100644 --- a/packages/amplify_datastore/example/android/gradle/wrapper/gradle-wrapper.properties +++ b/packages/amplify_datastore/example/android/gradle/wrapper/gradle-wrapper.properties @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.0-all.zip From 0e339a0ab6c10f0d6b8f17357373cb2aa08fadd7 Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Thu, 28 Dec 2023 10:57:05 -0800 Subject: [PATCH 10/69] chore: attempt to fix gradle url --- .../android/gradle/wrapper/gradle-wrapper.properties | 2 +- .../example/android/gradle/wrapper/gradle-wrapper.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/amplify_datastore/android/gradle/wrapper/gradle-wrapper.properties b/packages/amplify_datastore/android/gradle/wrapper/gradle-wrapper.properties index 3ba4255dd8..cb086a5fcf 100644 --- a/packages/amplify_datastore/android/gradle/wrapper/gradle-wrapper.properties +++ b/packages/amplify_datastore/android/gradle/wrapper/gradle-wrapper.properties @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.0-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.1-all.zip diff --git a/packages/amplify_datastore/example/android/gradle/wrapper/gradle-wrapper.properties b/packages/amplify_datastore/example/android/gradle/wrapper/gradle-wrapper.properties index 3ba4255dd8..cb086a5fcf 100644 --- a/packages/amplify_datastore/example/android/gradle/wrapper/gradle-wrapper.properties +++ b/packages/amplify_datastore/example/android/gradle/wrapper/gradle-wrapper.properties @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.0-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.1-all.zip From c4fccd82a92462d7f9a378837f7181d0ee138661 Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Thu, 28 Dec 2023 15:59:38 -0800 Subject: [PATCH 11/69] chore: revert back to last kotlin major version --- packages/amplify_datastore/android/build.gradle | 2 +- .../android/gradle/wrapper/gradle-wrapper.properties | 2 +- packages/amplify_datastore/example/android/build.gradle | 2 +- .../example/android/gradle/wrapper/gradle-wrapper.properties | 2 +- .../push/amplify_push_notifications/android/build.gradle | 2 +- .../amplify_push_notifications/example/android/build.gradle | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/amplify_datastore/android/build.gradle b/packages/amplify_datastore/android/build.gradle index 2c7671be58..ac6cad4910 100644 --- a/packages/amplify_datastore/android/build.gradle +++ b/packages/amplify_datastore/android/build.gradle @@ -2,7 +2,7 @@ group 'com.amazonaws.amplify.amplify_datastore' version '1.0-SNAPSHOT' buildscript { - ext.kotlin_version = '1.9.22' + ext.kotlin_version = '1.9.0' repositories { mavenLocal() google() diff --git a/packages/amplify_datastore/android/gradle/wrapper/gradle-wrapper.properties b/packages/amplify_datastore/android/gradle/wrapper/gradle-wrapper.properties index cb086a5fcf..ceccc3a854 100644 --- a/packages/amplify_datastore/android/gradle/wrapper/gradle-wrapper.properties +++ b/packages/amplify_datastore/android/gradle/wrapper/gradle-wrapper.properties @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-all.zip diff --git a/packages/amplify_datastore/example/android/build.gradle b/packages/amplify_datastore/example/android/build.gradle index 0d64718f89..68b15a8414 100644 --- a/packages/amplify_datastore/example/android/build.gradle +++ b/packages/amplify_datastore/example/android/build.gradle @@ -1,5 +1,5 @@ buildscript { - ext.kotlin_version = '1.9.22' + ext.kotlin_version = '1.9.0' repositories { google() mavenCentral() diff --git a/packages/amplify_datastore/example/android/gradle/wrapper/gradle-wrapper.properties b/packages/amplify_datastore/example/android/gradle/wrapper/gradle-wrapper.properties index cb086a5fcf..ceccc3a854 100644 --- a/packages/amplify_datastore/example/android/gradle/wrapper/gradle-wrapper.properties +++ b/packages/amplify_datastore/example/android/gradle/wrapper/gradle-wrapper.properties @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-all.zip diff --git a/packages/notifications/push/amplify_push_notifications/android/build.gradle b/packages/notifications/push/amplify_push_notifications/android/build.gradle index 5d518ac79a..1c5853b541 100644 --- a/packages/notifications/push/amplify_push_notifications/android/build.gradle +++ b/packages/notifications/push/amplify_push_notifications/android/build.gradle @@ -2,7 +2,7 @@ group 'com.amazonaws.amplify.amplify_push_notifications' version '1.0-SNAPSHOT' buildscript { - ext.kotlin_version = '1.9.22' + ext.kotlin_version = '1.9.0' repositories { google() mavenCentral() diff --git a/packages/notifications/push/amplify_push_notifications/example/android/build.gradle b/packages/notifications/push/amplify_push_notifications/example/android/build.gradle index fd59c3d1ba..526488549f 100644 --- a/packages/notifications/push/amplify_push_notifications/example/android/build.gradle +++ b/packages/notifications/push/amplify_push_notifications/example/android/build.gradle @@ -1,5 +1,5 @@ buildscript { - ext.kotlin_version = '1.9.22' + ext.kotlin_version = '1.9.0' repositories { google() mavenCentral() From a295039259b16b4d0d4f3e94fd348ebb196d62d4 Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Thu, 28 Dec 2023 16:37:19 -0800 Subject: [PATCH 12/69] chore: change gradle version back to 7.4.2 --- packages/amplify_datastore/example/android/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/amplify_datastore/example/android/build.gradle b/packages/amplify_datastore/example/android/build.gradle index 68b15a8414..fb589d27e8 100644 --- a/packages/amplify_datastore/example/android/build.gradle +++ b/packages/amplify_datastore/example/android/build.gradle @@ -6,7 +6,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:8.1.0' + classpath 'com.android.tools.build:gradle:7.4.2' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } From 9a8cfcc6b93437495b00fe01bc8304250d17891b Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Thu, 28 Dec 2023 16:45:47 -0800 Subject: [PATCH 13/69] chore: match Kotlin to Android's version --- packages/amplify_datastore/android/build.gradle | 2 +- packages/amplify_datastore/example/android/build.gradle | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/amplify_datastore/android/build.gradle b/packages/amplify_datastore/android/build.gradle index ac6cad4910..1861c2252c 100644 --- a/packages/amplify_datastore/android/build.gradle +++ b/packages/amplify_datastore/android/build.gradle @@ -2,7 +2,7 @@ group 'com.amazonaws.amplify.amplify_datastore' version '1.0-SNAPSHOT' buildscript { - ext.kotlin_version = '1.9.0' + ext.kotlin_version = '1.9.10' repositories { mavenLocal() google() diff --git a/packages/amplify_datastore/example/android/build.gradle b/packages/amplify_datastore/example/android/build.gradle index fb589d27e8..dbb249e4a1 100644 --- a/packages/amplify_datastore/example/android/build.gradle +++ b/packages/amplify_datastore/example/android/build.gradle @@ -1,5 +1,5 @@ buildscript { - ext.kotlin_version = '1.9.0' + ext.kotlin_version = '1.9.10' repositories { google() mavenCentral() From e46a021998cbd3c7346fa45eb2e786b98851177a Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Fri, 29 Dec 2023 08:14:27 -0800 Subject: [PATCH 14/69] chore: make kotlin version consistent through both packages --- .../push/amplify_push_notifications/android/build.gradle | 2 +- .../amplify_push_notifications/example/android/build.gradle | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/notifications/push/amplify_push_notifications/android/build.gradle b/packages/notifications/push/amplify_push_notifications/android/build.gradle index 1c5853b541..7d9d76c74e 100644 --- a/packages/notifications/push/amplify_push_notifications/android/build.gradle +++ b/packages/notifications/push/amplify_push_notifications/android/build.gradle @@ -2,7 +2,7 @@ group 'com.amazonaws.amplify.amplify_push_notifications' version '1.0-SNAPSHOT' buildscript { - ext.kotlin_version = '1.9.0' + ext.kotlin_version = '1.9.10' repositories { google() mavenCentral() diff --git a/packages/notifications/push/amplify_push_notifications/example/android/build.gradle b/packages/notifications/push/amplify_push_notifications/example/android/build.gradle index 526488549f..e90901803d 100644 --- a/packages/notifications/push/amplify_push_notifications/example/android/build.gradle +++ b/packages/notifications/push/amplify_push_notifications/example/android/build.gradle @@ -1,5 +1,5 @@ buildscript { - ext.kotlin_version = '1.9.0' + ext.kotlin_version = '1.9.10' repositories { google() mavenCentral() From c9b481f640cdab94515e3e5ad3f1fe812878e3d7 Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Fri, 29 Dec 2023 12:59:22 -0800 Subject: [PATCH 15/69] chore: update to new android release --- packages/amplify_datastore/android/build.gradle | 8 ++++---- .../push/amplify_push_notifications/android/build.gradle | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/amplify_datastore/android/build.gradle b/packages/amplify_datastore/android/build.gradle index 1861c2252c..fc46d69152 100644 --- a/packages/amplify_datastore/android/build.gradle +++ b/packages/amplify_datastore/android/build.gradle @@ -72,10 +72,10 @@ dependencies { // Support for Java 8 features coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.3' - implementation 'com.amplifyframework:aws-auth-cognito:2.14.7' - implementation "com.amplifyframework:aws-api:2.14.7" - implementation "com.amplifyframework:aws-datastore:2.14.7" - implementation "com.amplifyframework:aws-api-appsync:2.14.7" + implementation 'com.amplifyframework:aws-auth-cognito:2.14.8' + implementation "com.amplifyframework:aws-api:2.14.8" + implementation "com.amplifyframework:aws-datastore:2.14.8" + implementation "com.amplifyframework:aws-api-appsync:2.14.8" implementation 'com.google.code.gson:gson:2.10.1' implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.1' diff --git a/packages/notifications/push/amplify_push_notifications/android/build.gradle b/packages/notifications/push/amplify_push_notifications/android/build.gradle index 7d9d76c74e..6456172244 100644 --- a/packages/notifications/push/amplify_push_notifications/android/build.gradle +++ b/packages/notifications/push/amplify_push_notifications/android/build.gradle @@ -65,7 +65,7 @@ android { dependencies { api "com.google.firebase:firebase-messaging:23.2.0" // Import support library for Amplify push utils - implementation 'com.amplifyframework:aws-push-notifications-pinpoint-common:2.14.7' + implementation 'com.amplifyframework:aws-push-notifications-pinpoint-common:2.14.8' implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.4.1" implementation project(path: ':flutter_plugin_android_lifecycle') implementation 'androidx.test:core-ktx:1.5.0' From 1f383f7768f25b9659d7875ab31622c59dcf2b15 Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Fri, 29 Dec 2023 14:18:43 -0800 Subject: [PATCH 16/69] chore: downgrade amplify-android version back to 2.14.7 with fix --- packages/amplify_datastore/android/build.gradle | 8 ++++---- .../push/amplify_push_notifications/android/build.gradle | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/amplify_datastore/android/build.gradle b/packages/amplify_datastore/android/build.gradle index fc46d69152..1861c2252c 100644 --- a/packages/amplify_datastore/android/build.gradle +++ b/packages/amplify_datastore/android/build.gradle @@ -72,10 +72,10 @@ dependencies { // Support for Java 8 features coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.3' - implementation 'com.amplifyframework:aws-auth-cognito:2.14.8' - implementation "com.amplifyframework:aws-api:2.14.8" - implementation "com.amplifyframework:aws-datastore:2.14.8" - implementation "com.amplifyframework:aws-api-appsync:2.14.8" + implementation 'com.amplifyframework:aws-auth-cognito:2.14.7' + implementation "com.amplifyframework:aws-api:2.14.7" + implementation "com.amplifyframework:aws-datastore:2.14.7" + implementation "com.amplifyframework:aws-api-appsync:2.14.7" implementation 'com.google.code.gson:gson:2.10.1' implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.1' diff --git a/packages/notifications/push/amplify_push_notifications/android/build.gradle b/packages/notifications/push/amplify_push_notifications/android/build.gradle index 6456172244..7d9d76c74e 100644 --- a/packages/notifications/push/amplify_push_notifications/android/build.gradle +++ b/packages/notifications/push/amplify_push_notifications/android/build.gradle @@ -65,7 +65,7 @@ android { dependencies { api "com.google.firebase:firebase-messaging:23.2.0" // Import support library for Amplify push utils - implementation 'com.amplifyframework:aws-push-notifications-pinpoint-common:2.14.8' + implementation 'com.amplifyframework:aws-push-notifications-pinpoint-common:2.14.7' implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.4.1" implementation project(path: ':flutter_plugin_android_lifecycle') implementation 'androidx.test:core-ktx:1.5.0' From c82259c80f5e654af7020a05713b43f975823e5f Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Wed, 3 Jan 2024 11:22:51 -0800 Subject: [PATCH 17/69] chore: bump android version to latest --- packages/amplify_datastore/android/build.gradle | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/amplify_datastore/android/build.gradle b/packages/amplify_datastore/android/build.gradle index 1861c2252c..fc46d69152 100644 --- a/packages/amplify_datastore/android/build.gradle +++ b/packages/amplify_datastore/android/build.gradle @@ -72,10 +72,10 @@ dependencies { // Support for Java 8 features coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.3' - implementation 'com.amplifyframework:aws-auth-cognito:2.14.7' - implementation "com.amplifyframework:aws-api:2.14.7" - implementation "com.amplifyframework:aws-datastore:2.14.7" - implementation "com.amplifyframework:aws-api-appsync:2.14.7" + implementation 'com.amplifyframework:aws-auth-cognito:2.14.8' + implementation "com.amplifyframework:aws-api:2.14.8" + implementation "com.amplifyframework:aws-datastore:2.14.8" + implementation "com.amplifyframework:aws-api-appsync:2.14.8" implementation 'com.google.code.gson:gson:2.10.1' implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.1' From bfbdfe5b486fed0d50c08c61913e6839e58d8504 Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Wed, 3 Jan 2024 11:31:26 -0800 Subject: [PATCH 18/69] chore: bump push notifications to the latest version of android --- .../push/amplify_push_notifications/android/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/notifications/push/amplify_push_notifications/android/build.gradle b/packages/notifications/push/amplify_push_notifications/android/build.gradle index 7d9d76c74e..6456172244 100644 --- a/packages/notifications/push/amplify_push_notifications/android/build.gradle +++ b/packages/notifications/push/amplify_push_notifications/android/build.gradle @@ -65,7 +65,7 @@ android { dependencies { api "com.google.firebase:firebase-messaging:23.2.0" // Import support library for Amplify push utils - implementation 'com.amplifyframework:aws-push-notifications-pinpoint-common:2.14.7' + implementation 'com.amplifyframework:aws-push-notifications-pinpoint-common:2.14.8' implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.4.1" implementation project(path: ':flutter_plugin_android_lifecycle') implementation 'androidx.test:core-ktx:1.5.0' From a8d57bfaf03d1466a2faa15f9f878d88186d09a7 Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Thu, 4 Jan 2024 11:50:46 -0800 Subject: [PATCH 19/69] chore: try switching to android version 11 --- packages/amplify_datastore/android/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/amplify_datastore/android/build.gradle b/packages/amplify_datastore/android/build.gradle index fc46d69152..514ece1627 100644 --- a/packages/amplify_datastore/android/build.gradle +++ b/packages/amplify_datastore/android/build.gradle @@ -56,8 +56,8 @@ android { compileOptions { // Support for Java 8 features coreLibraryDesugaringEnabled true - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_11 + targetCompatibility JavaVersion.VERSION_11 } testOptions { unitTests { From a36e141c53d7df5cc54facece518a07295a16ff9 Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Thu, 4 Jan 2024 14:01:54 -0800 Subject: [PATCH 20/69] chore: lowered desugaring version --- .../amplify_datastore/android/build.gradle | 13 +- .../AmplifyDataStorePlugin.kt | 63 +- .../DataStoreHubEventStreamHandler.kt | 2 +- .../amplify_datastore/FlutterAuthProvider.kt | 1 - .../NativeAuthPluginWrapper.kt | 15 +- .../exception/ExceptionUtil.kt | 1 + .../pigeons/NativePluginBindings.kt | 559 +++++++++--------- .../hub/FlutterOutboxMutationEnqueuedEvent.kt | 1 - .../FlutterSubscriptionDataProcessedEvent.kt | 2 +- .../types/model/FlutterAuthRule.kt | 1 - .../types/model/FlutterModelField.kt | 7 +- .../types/model/FlutterModelSchema.kt | 8 +- .../model/FlutterSerializedCustomType.kt | 8 +- .../types/model/FlutterSerializedModel.kt | 16 +- .../types/query/QueryPaginationBuilder.kt | 10 +- .../types/query/QueryPredicateBuilder.kt | 20 +- .../amplify_datastore/util/SafeCastingUtil.kt | 12 +- .../example/android/app/build.gradle | 8 +- .../example/android/build.gradle | 4 +- .../gradle/wrapper/gradle-wrapper.properties | 3 +- 20 files changed, 403 insertions(+), 351 deletions(-) diff --git a/packages/amplify_datastore/android/build.gradle b/packages/amplify_datastore/android/build.gradle index 514ece1627..d65bbb17c4 100644 --- a/packages/amplify_datastore/android/build.gradle +++ b/packages/amplify_datastore/android/build.gradle @@ -2,7 +2,7 @@ group 'com.amazonaws.amplify.amplify_datastore' version '1.0-SNAPSHOT' buildscript { - ext.kotlin_version = '1.9.10' + ext.kotlin_version = '1.9.0' repositories { mavenLocal() google() @@ -13,7 +13,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:8.1.0' + classpath 'com.android.tools.build:gradle:7.3.1' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath 'org.jlleitschuh.gradle:ktlint-gradle:11.5.0' } @@ -32,6 +32,8 @@ apply plugin: 'kotlin-android' apply plugin: 'org.jlleitschuh.gradle.ktlint' android { + namespace 'com.amazonaws.amplify.amplify_datastore' + compileSdkVersion 33 sourceSets { @@ -56,8 +58,8 @@ android { compileOptions { // Support for Java 8 features coreLibraryDesugaringEnabled true - sourceCompatibility JavaVersion.VERSION_11 - targetCompatibility JavaVersion.VERSION_11 + sourceCompatibility JavaVersion.VERSION_17 + targetCompatibility JavaVersion.VERSION_17 } testOptions { unitTests { @@ -65,12 +67,11 @@ android { } } - namespace 'com.amazonaws.amplify.amplify_datastore' } dependencies { // Support for Java 8 features - coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.3' + coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.2.3' implementation 'com.amplifyframework:aws-auth-cognito:2.14.8' implementation "com.amplifyframework:aws-api:2.14.8" 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 718d82a005..9a365d6217 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 @@ -74,8 +74,12 @@ import kotlin.collections.HashMap typealias ResolutionStrategy = DataStoreConflictHandler.ResolutionStrategy /** AmplifyDataStorePlugin */ -class AmplifyDataStorePlugin : FlutterPlugin, MethodCallHandler, NativeAmplifyBridge, - NativeAuthBridge, NativeApiBridge { +class AmplifyDataStorePlugin : + FlutterPlugin, + MethodCallHandler, + NativeAmplifyBridge, + NativeAuthBridge, + NativeApiBridge { private lateinit var channel: MethodChannel private lateinit var eventChannel: EventChannel private lateinit var observeCancelable: Cancelable @@ -179,7 +183,8 @@ class AmplifyDataStorePlugin : FlutterPlugin, MethodCallHandler, NativeAmplifyBr } catch (e: Exception) { uiThreadHandler.post { postExceptionToFlutterChannel( - result, "DataStoreException", + result, + "DataStoreException", createSerializedUnrecognizedError(e) ) } @@ -206,12 +211,13 @@ class AmplifyDataStorePlugin : FlutterPlugin, MethodCallHandler, NativeAmplifyBr ) { uiThreadHandler.post { postExceptionToFlutterChannel( - flutterResult, "DataStoreException", + flutterResult, + "DataStoreException", createSerializedError( ExceptionMessages.missingExceptionMessage, ExceptionMessages.missingRecoverySuggestion, "Received invalid request from Dart, modelSchemas and/or modelProviderVersion" + - " are not available. Request: " + request.toString() + " are not available. Request: " + request.toString() ) ) } @@ -243,7 +249,8 @@ class AmplifyDataStorePlugin : FlutterPlugin, MethodCallHandler, NativeAmplifyBr } catch (e: Exception) { uiThreadHandler.post { postExceptionToFlutterChannel( - flutterResult, "DataStoreException", + flutterResult, + "DataStoreException", createSerializedUnrecognizedError(e) ) } @@ -285,7 +292,8 @@ class AmplifyDataStorePlugin : FlutterPlugin, MethodCallHandler, NativeAmplifyBr } catch (e: Exception) { uiThreadHandler.post { postExceptionToFlutterChannel( - flutterResult, "DataStoreException", + flutterResult, + "DataStoreException", createSerializedUnrecognizedError(e) ) } @@ -308,7 +316,8 @@ class AmplifyDataStorePlugin : FlutterPlugin, MethodCallHandler, NativeAmplifyBr } catch (e: Exception) { uiThreadHandler.post { postExceptionToFlutterChannel( - flutterResult, "DataStoreException", + flutterResult, + "DataStoreException", createSerializedUnrecognizedError(e) ) } @@ -318,7 +327,8 @@ class AmplifyDataStorePlugin : FlutterPlugin, MethodCallHandler, NativeAmplifyBr LOG.error("Query operation failed.", it) uiThreadHandler.post { postExceptionToFlutterChannel( - flutterResult, "DataStoreException", + flutterResult, + "DataStoreException", createSerializedError(it) ) } @@ -345,7 +355,8 @@ class AmplifyDataStorePlugin : FlutterPlugin, MethodCallHandler, NativeAmplifyBr } catch (e: Exception) { uiThreadHandler.post { postExceptionToFlutterChannel( - flutterResult, "DataStoreException", + flutterResult, + "DataStoreException", createSerializedUnrecognizedError(e) ) } @@ -373,7 +384,8 @@ class AmplifyDataStorePlugin : FlutterPlugin, MethodCallHandler, NativeAmplifyBr } else { uiThreadHandler.post { postExceptionToFlutterChannel( - flutterResult, "DataStoreException", + flutterResult, + "DataStoreException", createSerializedError(it) ) } @@ -401,7 +413,8 @@ class AmplifyDataStorePlugin : FlutterPlugin, MethodCallHandler, NativeAmplifyBr } catch (e: Exception) { uiThreadHandler.post { postExceptionToFlutterChannel( - flutterResult, "DataStoreException", + flutterResult, + "DataStoreException", createSerializedUnrecognizedError(e) ) } @@ -426,7 +439,8 @@ class AmplifyDataStorePlugin : FlutterPlugin, MethodCallHandler, NativeAmplifyBr LOG.error("Save operation failed", it) uiThreadHandler.post { postExceptionToFlutterChannel( - flutterResult, "DataStoreException", + flutterResult, + "DataStoreException", createSerializedError(it) ) } @@ -446,7 +460,8 @@ class AmplifyDataStorePlugin : FlutterPlugin, MethodCallHandler, NativeAmplifyBr LOG.error("Failed to clear store with error: ", it) uiThreadHandler.post { postExceptionToFlutterChannel( - flutterResult, "DataStoreException", + flutterResult, + "DataStoreException", createSerializedError(it) ) } @@ -510,7 +525,8 @@ class AmplifyDataStorePlugin : FlutterPlugin, MethodCallHandler, NativeAmplifyBr LOG.error("Failed to start datastore with error: ", it) uiThreadHandler.post { postExceptionToFlutterChannel( - flutterResult, "DataStoreException", + flutterResult, + "DataStoreException", createSerializedError(it) ) } @@ -533,7 +549,8 @@ class AmplifyDataStorePlugin : FlutterPlugin, MethodCallHandler, NativeAmplifyBr LOG.error("Failed to stop datastore with error: ", it) uiThreadHandler.post { postExceptionToFlutterChannel( - flutterResult, "DataStoreException", + flutterResult, + "DataStoreException", createSerializedError(it) ) } @@ -563,7 +580,8 @@ class AmplifyDataStorePlugin : FlutterPlugin, MethodCallHandler, NativeAmplifyBr val latch = CountDownLatch(1) uiThreadHandler.post { channel.invokeMethod( - "resolveQueryPredicate", id, + "resolveQueryPredicate", + id, object : Result { override fun success(result: Any?) { try { @@ -591,8 +609,8 @@ class AmplifyDataStorePlugin : FlutterPlugin, MethodCallHandler, NativeAmplifyBr latch.await() } catch (e: InterruptedException) { LOG.error( - "Failed to resolve query predicate due to ${e}. Reverting to original query " + - "predicate." + "Failed to resolve query predicate due to $e. Reverting to original query " + + "predicate." ) } resolvedQueryPredicate @@ -769,7 +787,7 @@ class AmplifyDataStorePlugin : FlutterPlugin, MethodCallHandler, NativeAmplifyBr private fun createConflictHandler(request: Map): DataStoreConflictHandler { return if (request["hasConflictHandler"] as? Boolean? == true) { DataStoreConflictHandler { conflictData, - onDecision -> + onDecision -> val modelName = conflictData.local.modelName val args = mapOf( @@ -780,7 +798,8 @@ class AmplifyDataStorePlugin : FlutterPlugin, MethodCallHandler, NativeAmplifyBr uiThreadHandler.post { channel.invokeMethod( - "conflictHandler", args, + "conflictHandler", + args, object : Result { override fun success(result: Any?) { val resultMap: Map? = result.safeCastToMap() @@ -827,7 +846,7 @@ class AmplifyDataStorePlugin : FlutterPlugin, MethodCallHandler, NativeAmplifyBr } } else { DataStoreConflictHandler { _, - onDecision -> + onDecision -> onDecision.accept(DataStoreConflictHandler.ConflictResolutionDecision.applyRemote()) } } diff --git a/packages/amplify_datastore/android/src/main/kotlin/com/amazonaws/amplify/amplify_datastore/DataStoreHubEventStreamHandler.kt b/packages/amplify_datastore/android/src/main/kotlin/com/amazonaws/amplify/amplify_datastore/DataStoreHubEventStreamHandler.kt index c04ef90a90..428b33acc1 100644 --- a/packages/amplify_datastore/android/src/main/kotlin/com/amazonaws/amplify/amplify_datastore/DataStoreHubEventStreamHandler.kt +++ b/packages/amplify_datastore/android/src/main/kotlin/com/amazonaws/amplify/amplify_datastore/DataStoreHubEventStreamHandler.kt @@ -195,7 +195,7 @@ class DataStoreHubEventStreamHandler : EventChannel.StreamHandler { val message = FlutterSubscriptionDataProcessedEvent( hubEvent.name, model, - eventData.syncMetadata, + eventData.syncMetadata ) sendEvent(message.toValueMap()) } else { diff --git a/packages/amplify_datastore/android/src/main/kotlin/com/amazonaws/amplify/amplify_datastore/FlutterAuthProvider.kt b/packages/amplify_datastore/android/src/main/kotlin/com/amazonaws/amplify/amplify_datastore/FlutterAuthProvider.kt index 5d8dedeb78..70f28ec008 100644 --- a/packages/amplify_datastore/android/src/main/kotlin/com/amazonaws/amplify/amplify_datastore/FlutterAuthProvider.kt +++ b/packages/amplify_datastore/android/src/main/kotlin/com/amazonaws/amplify/amplify_datastore/FlutterAuthProvider.kt @@ -104,7 +104,6 @@ class FlutterAuthProviders( } } launch(Dispatchers.Main) { - nativeApiPlugin.getLatestAuthToken(authType.name) { resultToken -> result.success(resultToken) } diff --git a/packages/amplify_datastore/android/src/main/kotlin/com/amazonaws/amplify/amplify_datastore/NativeAuthPluginWrapper.kt b/packages/amplify_datastore/android/src/main/kotlin/com/amazonaws/amplify/amplify_datastore/NativeAuthPluginWrapper.kt index 1d0d83cb05..ad993a79f8 100644 --- a/packages/amplify_datastore/android/src/main/kotlin/com/amazonaws/amplify/amplify_datastore/NativeAuthPluginWrapper.kt +++ b/packages/amplify_datastore/android/src/main/kotlin/com/amazonaws/amplify/amplify_datastore/NativeAuthPluginWrapper.kt @@ -84,7 +84,7 @@ class NativeAuthPluginWrapper( val tokens = FlutterFactory.createAWSCognitoUserPoolTokens( session.userPoolTokens!!.accessToken, session.userPoolTokens!!.idToken, - session.userPoolTokens!!.refreshToken, + session.userPoolTokens!!.refreshToken ) AuthSessionResult.success(tokens) } else { @@ -97,9 +97,13 @@ class NativeAuthPluginWrapper( sessionCredentials.accessKeyId, sessionCredentials.secretAccessKey, sessionCredentials.sessionToken, - if (sessionCredentials.expirationIso8601Utc != null) Instant.fromIso8601( - sessionCredentials.expirationIso8601Utc!! - ).epochSeconds else null, + if (sessionCredentials.expirationIso8601Utc != null) { + Instant.fromIso8601( + sessionCredentials.expirationIso8601Utc!! + ).epochSeconds + } else { + null + } ) AuthSessionResult.success(credentials) } else { @@ -110,7 +114,7 @@ class NativeAuthPluginWrapper( AuthSessionResult.success(session.identityId), awsCredentials, AuthSessionResult.success(session.userSub), - userPoolTokens, + userPoolTokens ) onSuccess.accept(authSession) } @@ -403,5 +407,4 @@ class NativeAuthPluginWrapper( private fun unsupported(methodName: String): Nothing { throw IllegalStateException("$methodName is not supported") } - } diff --git a/packages/amplify_datastore/android/src/main/kotlin/com/amazonaws/amplify/amplify_datastore/exception/ExceptionUtil.kt b/packages/amplify_datastore/android/src/main/kotlin/com/amazonaws/amplify/amplify_datastore/exception/ExceptionUtil.kt index 317f766846..33ee1c3d5e 100644 --- a/packages/amplify_datastore/android/src/main/kotlin/com/amazonaws/amplify/amplify_datastore/exception/ExceptionUtil.kt +++ b/packages/amplify_datastore/android/src/main/kotlin/com/amazonaws/amplify/amplify_datastore/exception/ExceptionUtil.kt @@ -38,6 +38,7 @@ class ExceptionUtil { gsonBuilder.registerTypeAdapter(Throwable::class.java, ThrowableSerializer()) val gson = gsonBuilder.create() val serializedJsonException = gson.toJson(e) + @Suppress("UNCHECKED_CAST") var serializedMap: Map = gson.fromJson(serializedJsonException, Map::class.java) as Map diff --git a/packages/amplify_datastore/android/src/main/kotlin/com/amazonaws/amplify/amplify_datastore/pigeons/NativePluginBindings.kt b/packages/amplify_datastore/android/src/main/kotlin/com/amazonaws/amplify/amplify_datastore/pigeons/NativePluginBindings.kt index ccf949889f..1d556a948f 100644 --- a/packages/amplify_datastore/android/src/main/kotlin/com/amazonaws/amplify/amplify_datastore/pigeons/NativePluginBindings.kt +++ b/packages/amplify_datastore/android/src/main/kotlin/com/amazonaws/amplify/amplify_datastore/pigeons/NativePluginBindings.kt @@ -1,4 +1,4 @@ -// +// // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 // Autogenerated from Pigeon (v11.0.0), do not edit directly. @@ -15,23 +15,23 @@ import java.io.ByteArrayOutputStream import java.nio.ByteBuffer private fun wrapResult(result: Any?): List { - return listOf(result) + return listOf(result) } private fun wrapError(exception: Throwable): List { - if (exception is FlutterError) { - return listOf( - exception.code, - exception.message, - exception.details - ) - } else { - return listOf( - exception.javaClass.simpleName, - exception.toString(), - "Cause: " + exception.cause + ", Stacktrace: " + Log.getStackTraceString(exception) - ) - } + if (exception is FlutterError) { + return listOf( + exception.code, + exception.message, + exception.details + ) + } else { + return listOf( + exception.javaClass.simpleName, + exception.toString(), + "Cause: " + exception.cause + ", Stacktrace: " + Log.getStackTraceString(exception) + ) + } } /** @@ -40,338 +40,345 @@ private fun wrapError(exception: Throwable): List { * @property message The error message. * @property details The error details. Must be a datatype supported by the api codec. */ -class FlutterError ( - val code: String, - override val message: String? = null, - val details: Any? = null +class FlutterError( + val code: String, + override val message: String? = null, + val details: Any? = null ) : Throwable() /** Generated class from Pigeon that represents data sent in messages. */ -data class NativeAuthSession ( - val isSignedIn: Boolean, - val userSub: String? = null, - val userPoolTokens: NativeUserPoolTokens? = null, - val identityId: String? = null, - val awsCredentials: NativeAWSCredentials? = null +data class NativeAuthSession( + val isSignedIn: Boolean, + val userSub: String? = null, + val userPoolTokens: NativeUserPoolTokens? = null, + val identityId: String? = null, + val awsCredentials: NativeAWSCredentials? = null ) { - companion object { - @Suppress("UNCHECKED_CAST") - fun fromList(list: List): NativeAuthSession { - val isSignedIn = list[0] as Boolean - val userSub = list[1] as String? - val userPoolTokens: NativeUserPoolTokens? = (list[2] as List?)?.let { - NativeUserPoolTokens.fromList(it) - } - val identityId = list[3] as String? - val awsCredentials: NativeAWSCredentials? = (list[4] as List?)?.let { - NativeAWSCredentials.fromList(it) - } - return NativeAuthSession(isSignedIn, userSub, userPoolTokens, identityId, awsCredentials) + companion object { + @Suppress("UNCHECKED_CAST") + fun fromList(list: List): NativeAuthSession { + val isSignedIn = list[0] as Boolean + val userSub = list[1] as String? + val userPoolTokens: NativeUserPoolTokens? = (list[2] as List?)?.let { + NativeUserPoolTokens.fromList(it) + } + val identityId = list[3] as String? + val awsCredentials: NativeAWSCredentials? = (list[4] as List?)?.let { + NativeAWSCredentials.fromList(it) + } + return NativeAuthSession(isSignedIn, userSub, userPoolTokens, identityId, awsCredentials) + } + } + fun toList(): List { + return listOf( + isSignedIn, + userSub, + userPoolTokens?.toList(), + identityId, + awsCredentials?.toList() + ) } - } - fun toList(): List { - return listOf( - isSignedIn, - userSub, - userPoolTokens?.toList(), - identityId, - awsCredentials?.toList(), - ) - } } /** Generated class from Pigeon that represents data sent in messages. */ -data class NativeAuthUser ( - val userId: String, - val username: String +data class NativeAuthUser( + val userId: String, + val username: String ) { - companion object { - @Suppress("UNCHECKED_CAST") - fun fromList(list: List): NativeAuthUser { - val userId = list[0] as String - val username = list[1] as String - return NativeAuthUser(userId, username) + companion object { + @Suppress("UNCHECKED_CAST") + fun fromList(list: List): NativeAuthUser { + val userId = list[0] as String + val username = list[1] as String + return NativeAuthUser(userId, username) + } + } + fun toList(): List { + return listOf( + userId, + username + ) } - } - fun toList(): List { - return listOf( - userId, - username, - ) - } } /** Generated class from Pigeon that represents data sent in messages. */ -data class NativeUserPoolTokens ( - val accessToken: String, - val refreshToken: String, - val idToken: String +data class NativeUserPoolTokens( + val accessToken: String, + val refreshToken: String, + val idToken: String ) { - companion object { - @Suppress("UNCHECKED_CAST") - fun fromList(list: List): NativeUserPoolTokens { - val accessToken = list[0] as String - val refreshToken = list[1] as String - val idToken = list[2] as String - return NativeUserPoolTokens(accessToken, refreshToken, idToken) + companion object { + @Suppress("UNCHECKED_CAST") + fun fromList(list: List): NativeUserPoolTokens { + val accessToken = list[0] as String + val refreshToken = list[1] as String + val idToken = list[2] as String + return NativeUserPoolTokens(accessToken, refreshToken, idToken) + } + } + fun toList(): List { + return listOf( + accessToken, + refreshToken, + idToken + ) } - } - fun toList(): List { - return listOf( - accessToken, - refreshToken, - idToken, - ) - } } /** Generated class from Pigeon that represents data sent in messages. */ -data class NativeAWSCredentials ( - val accessKeyId: String, - val secretAccessKey: String, - val sessionToken: String? = null, - val expirationIso8601Utc: String? = null +data class NativeAWSCredentials( + val accessKeyId: String, + val secretAccessKey: String, + val sessionToken: String? = null, + val expirationIso8601Utc: String? = null ) { - companion object { - @Suppress("UNCHECKED_CAST") - fun fromList(list: List): NativeAWSCredentials { - val accessKeyId = list[0] as String - val secretAccessKey = list[1] as String - val sessionToken = list[2] as String? - val expirationIso8601Utc = list[3] as String? - return NativeAWSCredentials(accessKeyId, secretAccessKey, sessionToken, expirationIso8601Utc) + companion object { + @Suppress("UNCHECKED_CAST") + fun fromList(list: List): NativeAWSCredentials { + val accessKeyId = list[0] as String + val secretAccessKey = list[1] as String + val sessionToken = list[2] as String? + val expirationIso8601Utc = list[3] as String? + return NativeAWSCredentials(accessKeyId, secretAccessKey, sessionToken, expirationIso8601Utc) + } + } + fun toList(): List { + return listOf( + accessKeyId, + secretAccessKey, + sessionToken, + expirationIso8601Utc + ) } - } - fun toList(): List { - return listOf( - accessKeyId, - secretAccessKey, - sessionToken, - expirationIso8601Utc, - ) - } } @Suppress("UNCHECKED_CAST") private object NativeAuthPluginCodec : StandardMessageCodec() { - override fun readValueOfType(type: Byte, buffer: ByteBuffer): Any? { - return when (type) { - 128.toByte() -> { - return (readValue(buffer) as? List)?.let { - NativeAWSCredentials.fromList(it) - } - } - 129.toByte() -> { - return (readValue(buffer) as? List)?.let { - NativeAuthSession.fromList(it) - } - } - 130.toByte() -> { - return (readValue(buffer) as? List)?.let { - NativeUserPoolTokens.fromList(it) + override fun readValueOfType(type: Byte, buffer: ByteBuffer): Any? { + return when (type) { + 128.toByte() -> { + return (readValue(buffer) as? List)?.let { + NativeAWSCredentials.fromList(it) + } + } + 129.toByte() -> { + return (readValue(buffer) as? List)?.let { + NativeAuthSession.fromList(it) + } + } + 130.toByte() -> { + return (readValue(buffer) as? List)?.let { + NativeUserPoolTokens.fromList(it) + } + } + else -> super.readValueOfType(type, buffer) } - } - else -> super.readValueOfType(type, buffer) } - } - override fun writeValue(stream: ByteArrayOutputStream, value: Any?) { - when (value) { - is NativeAWSCredentials -> { - stream.write(128) - writeValue(stream, value.toList()) - } - is NativeAuthSession -> { - stream.write(129) - writeValue(stream, value.toList()) - } - is NativeUserPoolTokens -> { - stream.write(130) - writeValue(stream, value.toList()) - } - else -> super.writeValue(stream, value) + override fun writeValue(stream: ByteArrayOutputStream, value: Any?) { + when (value) { + is NativeAWSCredentials -> { + stream.write(128) + writeValue(stream, value.toList()) + } + is NativeAuthSession -> { + stream.write(129) + writeValue(stream, value.toList()) + } + is NativeUserPoolTokens -> { + stream.write(130) + writeValue(stream, value.toList()) + } + else -> super.writeValue(stream, value) + } } - } } /** Generated class from Pigeon that represents Flutter messages that can be called from Kotlin. */ @Suppress("UNCHECKED_CAST") class NativeAuthPlugin(private val binaryMessenger: BinaryMessenger) { - companion object { - /** The codec used by NativeAuthPlugin. */ - val codec: MessageCodec by lazy { - NativeAuthPluginCodec + companion object { + /** The codec used by NativeAuthPlugin. */ + val codec: MessageCodec by lazy { + NativeAuthPluginCodec + } } - } - fun fetchAuthSession(callback: (NativeAuthSession) -> Unit) { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.amplify_datastore.NativeAuthPlugin.fetchAuthSession", codec) - channel.send(null) { - val result = it as NativeAuthSession - callback(result) + fun fetchAuthSession(callback: (NativeAuthSession) -> Unit) { + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.amplify_datastore.NativeAuthPlugin.fetchAuthSession", codec) + channel.send(null) { + val result = it as NativeAuthSession + callback(result) + } } - } } + /** Generated class from Pigeon that represents Flutter messages that can be called from Kotlin. */ @Suppress("UNCHECKED_CAST") class NativeApiPlugin(private val binaryMessenger: BinaryMessenger) { - companion object { - /** The codec used by NativeApiPlugin. */ - val codec: MessageCodec by lazy { - StandardMessageCodec() + companion object { + /** The codec used by NativeApiPlugin. */ + val codec: MessageCodec by lazy { + StandardMessageCodec() + } } - } - fun getLatestAuthToken(providerNameArg: String, callback: (String?) -> Unit) { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.amplify_datastore.NativeApiPlugin.getLatestAuthToken", codec) - channel.send(listOf(providerNameArg)) { - val result = it as String? - callback(result) + fun getLatestAuthToken(providerNameArg: String, callback: (String?) -> Unit) { + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.amplify_datastore.NativeApiPlugin.getLatestAuthToken", codec) + channel.send(listOf(providerNameArg)) { + val result = it as String? + callback(result) + } } - } } + /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ interface NativeAmplifyBridge { - fun configure(version: String, config: String, callback: (Result) -> Unit) + fun configure(version: String, config: String, callback: (Result) -> Unit) - companion object { - /** The codec used by NativeAmplifyBridge. */ - val codec: MessageCodec by lazy { - StandardMessageCodec() - } - /** Sets up an instance of `NativeAmplifyBridge` to handle messages through the `binaryMessenger`. */ - @Suppress("UNCHECKED_CAST") - fun setUp(binaryMessenger: BinaryMessenger, api: NativeAmplifyBridge?) { - run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.amplify_datastore.NativeAmplifyBridge.configure", codec) - if (api != null) { - channel.setMessageHandler { message, reply -> - val args = message as List - val versionArg = args[0] as String - val configArg = args[1] as String - api.configure(versionArg, configArg) { result: Result -> - val error = result.exceptionOrNull() - if (error != null) { - reply.reply(wrapError(error)) - } else { - reply.reply(wrapResult(null)) - } + companion object { + /** The codec used by NativeAmplifyBridge. */ + val codec: MessageCodec by lazy { + StandardMessageCodec() + } + + /** Sets up an instance of `NativeAmplifyBridge` to handle messages through the `binaryMessenger`. */ + @Suppress("UNCHECKED_CAST") + fun setUp(binaryMessenger: BinaryMessenger, api: NativeAmplifyBridge?) { + run { + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.amplify_datastore.NativeAmplifyBridge.configure", codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val versionArg = args[0] as String + val configArg = args[1] as String + api.configure(versionArg, configArg) { result: Result -> + val error = result.exceptionOrNull() + if (error != null) { + reply.reply(wrapError(error)) + } else { + reply.reply(wrapResult(null)) + } + } + } + } else { + channel.setMessageHandler(null) + } } - } - } else { - channel.setMessageHandler(null) } - } } - } } + @Suppress("UNCHECKED_CAST") private object NativeAuthBridgeCodec : StandardMessageCodec() { - override fun readValueOfType(type: Byte, buffer: ByteBuffer): Any? { - return when (type) { - 128.toByte() -> { - return (readValue(buffer) as? List)?.let { - NativeAuthUser.fromList(it) + override fun readValueOfType(type: Byte, buffer: ByteBuffer): Any? { + return when (type) { + 128.toByte() -> { + return (readValue(buffer) as? List)?.let { + NativeAuthUser.fromList(it) + } + } + else -> super.readValueOfType(type, buffer) } - } - else -> super.readValueOfType(type, buffer) } - } - override fun writeValue(stream: ByteArrayOutputStream, value: Any?) { - when (value) { - is NativeAuthUser -> { - stream.write(128) - writeValue(stream, value.toList()) - } - else -> super.writeValue(stream, value) + override fun writeValue(stream: ByteArrayOutputStream, value: Any?) { + when (value) { + is NativeAuthUser -> { + stream.write(128) + writeValue(stream, value.toList()) + } + else -> super.writeValue(stream, value) + } } - } } /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ interface NativeAuthBridge { - fun addAuthPlugin(callback: (Result) -> Unit) - fun updateCurrentUser(user: NativeAuthUser?) + fun addAuthPlugin(callback: (Result) -> Unit) + fun updateCurrentUser(user: NativeAuthUser?) - companion object { - /** The codec used by NativeAuthBridge. */ - val codec: MessageCodec by lazy { - NativeAuthBridgeCodec - } - /** Sets up an instance of `NativeAuthBridge` to handle messages through the `binaryMessenger`. */ - @Suppress("UNCHECKED_CAST") - fun setUp(binaryMessenger: BinaryMessenger, api: NativeAuthBridge?) { - run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.amplify_datastore.NativeAuthBridge.addAuthPlugin", codec) - if (api != null) { - channel.setMessageHandler { _, reply -> - api.addAuthPlugin() { result: Result -> - val error = result.exceptionOrNull() - if (error != null) { - reply.reply(wrapError(error)) - } else { - reply.reply(wrapResult(null)) - } - } - } - } else { - channel.setMessageHandler(null) + companion object { + /** The codec used by NativeAuthBridge. */ + val codec: MessageCodec by lazy { + NativeAuthBridgeCodec } - } - run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.amplify_datastore.NativeAuthBridge.updateCurrentUser", codec) - if (api != null) { - channel.setMessageHandler { message, reply -> - val args = message as List - val userArg = args[0] as NativeAuthUser? - var wrapped: List - try { - api.updateCurrentUser(userArg) - wrapped = listOf(null) - } catch (exception: Throwable) { - wrapped = wrapError(exception) + + /** Sets up an instance of `NativeAuthBridge` to handle messages through the `binaryMessenger`. */ + @Suppress("UNCHECKED_CAST") + fun setUp(binaryMessenger: BinaryMessenger, api: NativeAuthBridge?) { + run { + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.amplify_datastore.NativeAuthBridge.addAuthPlugin", codec) + if (api != null) { + channel.setMessageHandler { _, reply -> + api.addAuthPlugin() { result: Result -> + val error = result.exceptionOrNull() + if (error != null) { + reply.reply(wrapError(error)) + } else { + reply.reply(wrapResult(null)) + } + } + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.amplify_datastore.NativeAuthBridge.updateCurrentUser", codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val userArg = args[0] as NativeAuthUser? + var wrapped: List + try { + api.updateCurrentUser(userArg) + wrapped = listOf(null) + } catch (exception: Throwable) { + wrapped = wrapError(exception) + } + reply.reply(wrapped) + } + } else { + channel.setMessageHandler(null) + } } - reply.reply(wrapped) - } - } else { - channel.setMessageHandler(null) } - } } - } } + /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ interface NativeApiBridge { - fun addApiPlugin(authProvidersList: List, callback: (Result) -> Unit) + fun addApiPlugin(authProvidersList: List, callback: (Result) -> Unit) - companion object { - /** The codec used by NativeApiBridge. */ - val codec: MessageCodec by lazy { - StandardMessageCodec() - } - /** Sets up an instance of `NativeApiBridge` to handle messages through the `binaryMessenger`. */ - @Suppress("UNCHECKED_CAST") - fun setUp(binaryMessenger: BinaryMessenger, api: NativeApiBridge?) { - run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.amplify_datastore.NativeApiBridge.addApiPlugin", codec) - if (api != null) { - channel.setMessageHandler { message, reply -> - val args = message as List - val authProvidersListArg = args[0] as List - api.addApiPlugin(authProvidersListArg) { result: Result -> - val error = result.exceptionOrNull() - if (error != null) { - reply.reply(wrapError(error)) - } else { - reply.reply(wrapResult(null)) - } + companion object { + /** The codec used by NativeApiBridge. */ + val codec: MessageCodec by lazy { + StandardMessageCodec() + } + + /** Sets up an instance of `NativeApiBridge` to handle messages through the `binaryMessenger`. */ + @Suppress("UNCHECKED_CAST") + fun setUp(binaryMessenger: BinaryMessenger, api: NativeApiBridge?) { + run { + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.amplify_datastore.NativeApiBridge.addApiPlugin", codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val authProvidersListArg = args[0] as List + api.addApiPlugin(authProvidersListArg) { result: Result -> + val error = result.exceptionOrNull() + if (error != null) { + reply.reply(wrapError(error)) + } else { + reply.reply(wrapResult(null)) + } + } + } + } else { + channel.setMessageHandler(null) + } } - } - } else { - channel.setMessageHandler(null) } - } } - } } diff --git a/packages/amplify_datastore/android/src/main/kotlin/com/amazonaws/amplify/amplify_datastore/types/hub/FlutterOutboxMutationEnqueuedEvent.kt b/packages/amplify_datastore/android/src/main/kotlin/com/amazonaws/amplify/amplify_datastore/types/hub/FlutterOutboxMutationEnqueuedEvent.kt index 743a6fe050..3772e2f993 100644 --- a/packages/amplify_datastore/android/src/main/kotlin/com/amazonaws/amplify/amplify_datastore/types/hub/FlutterOutboxMutationEnqueuedEvent.kt +++ b/packages/amplify_datastore/android/src/main/kotlin/com/amazonaws/amplify/amplify_datastore/types/hub/FlutterOutboxMutationEnqueuedEvent.kt @@ -12,7 +12,6 @@ class FlutterOutboxMutationEnqueuedEvent( private val element: OutboxMutationEvent.OutboxMutationEventElement ) : FlutterHubEvent { override fun toValueMap(): Map { - return mapOf( "eventName" to this.eventName, "modelName" to this.modelName, diff --git a/packages/amplify_datastore/android/src/main/kotlin/com/amazonaws/amplify/amplify_datastore/types/hub/FlutterSubscriptionDataProcessedEvent.kt b/packages/amplify_datastore/android/src/main/kotlin/com/amazonaws/amplify/amplify_datastore/types/hub/FlutterSubscriptionDataProcessedEvent.kt index 4ca2ae6dcc..b98e5975cf 100644 --- a/packages/amplify_datastore/android/src/main/kotlin/com/amazonaws/amplify/amplify_datastore/types/hub/FlutterSubscriptionDataProcessedEvent.kt +++ b/packages/amplify_datastore/android/src/main/kotlin/com/amazonaws/amplify/amplify_datastore/types/hub/FlutterSubscriptionDataProcessedEvent.kt @@ -10,7 +10,7 @@ import com.amplifyframework.datastore.appsync.ModelMetadata class FlutterSubscriptionDataProcessedEvent( override val eventName: String, private val model: SerializedModel, - private val syncMetadata: ModelMetadata, + private val syncMetadata: ModelMetadata ) : FlutterHubEvent { override fun toValueMap(): Map { return mapOf( 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 50d90fbe52..2f8e632589 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 @@ -53,7 +53,6 @@ data class FlutterAuthRule(val map: Map) { } fun convertToNativeAuthRule(): AuthRule { - val builder: AuthRule.Builder = AuthRule.builder() .authStrategy(authStrategy) diff --git a/packages/amplify_datastore/android/src/main/kotlin/com/amazonaws/amplify/amplify_datastore/types/model/FlutterModelField.kt b/packages/amplify_datastore/android/src/main/kotlin/com/amazonaws/amplify/amplify_datastore/types/model/FlutterModelField.kt index e790d50997..53ccacc09c 100644 --- a/packages/amplify_datastore/android/src/main/kotlin/com/amazonaws/amplify/amplify_datastore/types/model/FlutterModelField.kt +++ b/packages/amplify_datastore/android/src/main/kotlin/com/amazonaws/amplify/amplify_datastore/types/model/FlutterModelField.kt @@ -38,8 +38,11 @@ data class FlutterModelField(val map: Map) { // Association (if any) of the model private val flutterModelAssociation: FlutterModelAssociation? = - if (map["association"] == null) null - else FlutterModelAssociation(map["association"] as Map) + if (map["association"] == null) { + null + } else { + FlutterModelAssociation(map["association"] as Map) + } fun getModelAssociation(): FlutterModelAssociation? { return flutterModelAssociation diff --git a/packages/amplify_datastore/android/src/main/kotlin/com/amazonaws/amplify/amplify_datastore/types/model/FlutterModelSchema.kt b/packages/amplify_datastore/android/src/main/kotlin/com/amazonaws/amplify/amplify_datastore/types/model/FlutterModelSchema.kt index e047ddee7a..a95d2edc16 100644 --- a/packages/amplify_datastore/android/src/main/kotlin/com/amazonaws/amplify/amplify_datastore/types/model/FlutterModelSchema.kt +++ b/packages/amplify_datastore/android/src/main/kotlin/com/amazonaws/amplify/amplify_datastore/types/model/FlutterModelSchema.kt @@ -32,8 +32,10 @@ data class FlutterModelSchema(val map: Map) { if (rawIndexes is List<*>) { parsedIndexes.putAll( (rawIndexes.cast>()).associate { - (it["name"] as String? - ?: FlutterModelIndex.unnamedIndexKey) to FlutterModelIndex(it).convertToNativeModelIndex() + ( + it["name"] as String? + ?: FlutterModelIndex.unnamedIndexKey + ) to FlutterModelIndex(it).convertToNativeModelIndex() }.toMap() ) } @@ -54,6 +56,6 @@ data class FlutterModelSchema(val map: Map) { // to allow amplify-android correctly interpret custom primary key // schema version needs to be >= 1 .version(1) - .build(); + .build() } } diff --git a/packages/amplify_datastore/android/src/main/kotlin/com/amazonaws/amplify/amplify_datastore/types/model/FlutterSerializedCustomType.kt b/packages/amplify_datastore/android/src/main/kotlin/com/amazonaws/amplify/amplify_datastore/types/model/FlutterSerializedCustomType.kt index cab9edefa7..cf438de94f 100644 --- a/packages/amplify_datastore/android/src/main/kotlin/com/amazonaws/amplify/amplify_datastore/types/model/FlutterSerializedCustomType.kt +++ b/packages/amplify_datastore/android/src/main/kotlin/com/amazonaws/amplify/amplify_datastore/types/model/FlutterSerializedCustomType.kt @@ -28,9 +28,11 @@ data class FlutterSerializedCustomType(val serializedCustomType: SerializedCusto serializedData: Map, customTypeSchema: CustomTypeSchema ): Map { - if (serializedData.isEmpty()) throw Exception( - "FlutterSerializedCustomType - no serializedData for ${customTypeSchema.name}" - ) + if (serializedData.isEmpty()) { + throw Exception( + "FlutterSerializedCustomType - no serializedData for ${customTypeSchema.name}" + ) + } return serializedData.mapValues { val field = customTypeSchema.fields[it.key]!! diff --git a/packages/amplify_datastore/android/src/main/kotlin/com/amazonaws/amplify/amplify_datastore/types/model/FlutterSerializedModel.kt b/packages/amplify_datastore/android/src/main/kotlin/com/amazonaws/amplify/amplify_datastore/types/model/FlutterSerializedModel.kt index e7006ce561..69d7face9f 100644 --- a/packages/amplify_datastore/android/src/main/kotlin/com/amazonaws/amplify/amplify_datastore/types/model/FlutterSerializedModel.kt +++ b/packages/amplify_datastore/android/src/main/kotlin/com/amazonaws/amplify/amplify_datastore/types/model/FlutterSerializedModel.kt @@ -22,7 +22,6 @@ data class FlutterSerializedModel(val serializedModel: SerializedModel) { parseModelName(serializedModel.modelName) // ModelSchema -> SerializedModel should always have a name fun toMap(): Map { - val cleanedSerializedData: Map = serializedData.filterValues { it != null } return mapOf( @@ -32,14 +31,19 @@ data class FlutterSerializedModel(val serializedModel: SerializedModel) { } private fun parseModelName(modelName: String?): String { - return if (modelName.isNullOrEmpty()) "" - else modelName + return if (modelName.isNullOrEmpty()) { + "" + } else { + modelName + } } private fun parseSerializedDataMap(serializedData: Map, modelSchema: ModelSchema): Map { - if (serializedData.isEmpty()) throw Exception( - "FlutterSerializedModel - no serializedData for ${modelSchema.name}" - ) + if (serializedData.isEmpty()) { + throw Exception( + "FlutterSerializedModel - no serializedData for ${modelSchema.name}" + ) + } return serializedData.mapValues { val field = modelSchema.fields[it.key] diff --git a/packages/amplify_datastore/android/src/main/kotlin/com/amazonaws/amplify/amplify_datastore/types/query/QueryPaginationBuilder.kt b/packages/amplify_datastore/android/src/main/kotlin/com/amazonaws/amplify/amplify_datastore/types/query/QueryPaginationBuilder.kt index 938f8f6fd4..5d76f7a38a 100644 --- a/packages/amplify_datastore/android/src/main/kotlin/com/amazonaws/amplify/amplify_datastore/types/query/QueryPaginationBuilder.kt +++ b/packages/amplify_datastore/android/src/main/kotlin/com/amazonaws/amplify/amplify_datastore/types/query/QueryPaginationBuilder.kt @@ -13,15 +13,17 @@ class QueryPaginationBuilder { if (serializedMap == null) { return null } - var queryPaginationInput = if (serializedMap.containsKey("page")) + var queryPaginationInput = if (serializedMap.containsKey("page")) { Page.startingAt(serializedMap["page"] as Int) - else + } else { Page.firstPage() + } - queryPaginationInput = if (serializedMap.containsKey("limit")) + queryPaginationInput = if (serializedMap.containsKey("limit")) { queryPaginationInput.withLimit(serializedMap["limit"] as Int) - else + } else { queryPaginationInput + } return queryPaginationInput } diff --git a/packages/amplify_datastore/android/src/main/kotlin/com/amazonaws/amplify/amplify_datastore/types/query/QueryPredicateBuilder.kt b/packages/amplify_datastore/android/src/main/kotlin/com/amazonaws/amplify/amplify_datastore/types/query/QueryPredicateBuilder.kt index 528f75a84d..5f5eb704bb 100644 --- a/packages/amplify_datastore/android/src/main/kotlin/com/amazonaws/amplify/amplify_datastore/types/query/QueryPredicateBuilder.kt +++ b/packages/amplify_datastore/android/src/main/kotlin/com/amazonaws/amplify/amplify_datastore/types/query/QueryPredicateBuilder.kt @@ -60,7 +60,7 @@ class QueryPredicateBuilder { is List<*> -> { convertQueryByNestedModelIdentifierToPredicate( queryField, - operand.cast>(), + operand.cast>(), true ) } @@ -70,7 +70,7 @@ class QueryPredicateBuilder { is List<*> -> { convertQueryByNestedModelIdentifierToPredicate( queryField, - operand.cast>(), + operand.cast>(), false ) } @@ -136,7 +136,7 @@ class QueryPredicateBuilder { if (predicates.isNotEmpty()) { throw IllegalArgumentException( "More than one predicates added in the `not` queryPredicate operation." + - " Predicates Size: " + predicates.size + " Predicates Size: " + predicates.size ) } resultQueryPredicate = @@ -195,10 +195,13 @@ class QueryPredicateBuilder { } @JvmStatic - fun convertQueryByIdentifierOperationToPredicate(modelName: String?, operands: List>, - isEqualOperator: - Boolean): - QueryPredicate { + fun convertQueryByIdentifierOperationToPredicate( + modelName: String?, + operands: List>, + isEqualOperator: + Boolean + ): + QueryPredicate { var predicates = operands.map { val operandEntry = it.entries.first() when { @@ -223,7 +226,8 @@ class QueryPredicateBuilder { @JvmStatic fun convertQueryByNestedModelIdentifierToPredicate( - queryField: QueryField, operands: List>, + queryField: QueryField, + operands: List>, isEqualOperator: Boolean ): QueryPredicate { val identifierFieldsValues = operands.map { it.values.first() } diff --git a/packages/amplify_datastore/android/src/main/kotlin/com/amazonaws/amplify/amplify_datastore/util/SafeCastingUtil.kt b/packages/amplify_datastore/android/src/main/kotlin/com/amazonaws/amplify/amplify_datastore/util/SafeCastingUtil.kt index 8bbaf04d99..1117c324eb 100644 --- a/packages/amplify_datastore/android/src/main/kotlin/com/amazonaws/amplify/amplify_datastore/util/SafeCastingUtil.kt +++ b/packages/amplify_datastore/android/src/main/kotlin/com/amazonaws/amplify/amplify_datastore/util/SafeCastingUtil.kt @@ -5,12 +5,16 @@ package com.amazonaws.amplify.amplify_datastore.util @Suppress("UNCHECKED_CAST") inline fun Any?.safeCastToMap() = - if (this is T) + if (this is T) { this as Map - else null + } else { + null + } @Suppress("UNCHECKED_CAST") inline fun Any?.safeCastToList() = - if (this is List<*> && this.all { it is T }) + if (this is List<*> && this.all { it is T }) { this as List - else null + } else { + null + } diff --git a/packages/amplify_datastore/example/android/app/build.gradle b/packages/amplify_datastore/example/android/app/build.gradle index 1db33da315..c4399cfe6a 100644 --- a/packages/amplify_datastore/example/android/app/build.gradle +++ b/packages/amplify_datastore/example/android/app/build.gradle @@ -33,12 +33,12 @@ android { compileOptions { coreLibraryDesugaringEnabled true - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_11 + targetCompatibility JavaVersion.VERSION_11 } kotlinOptions { - jvmTarget = '1.8' + jvmTarget = '11' } sourceSets { @@ -53,6 +53,7 @@ android { versionCode flutterVersionCode.toInteger() versionName flutterVersionName testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner' + multiDexEnabled true } buildTypes { @@ -71,6 +72,7 @@ flutter { dependencies { coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5' implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" + implementation 'com.android.support:multidex:2.0.1' testImplementation 'junit:junit:4.13.2' diff --git a/packages/amplify_datastore/example/android/build.gradle b/packages/amplify_datastore/example/android/build.gradle index dbb249e4a1..d8cdb79bc3 100644 --- a/packages/amplify_datastore/example/android/build.gradle +++ b/packages/amplify_datastore/example/android/build.gradle @@ -1,12 +1,12 @@ buildscript { - ext.kotlin_version = '1.9.10' + ext.kotlin_version = '1.9.0' repositories { google() mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:7.4.2' + classpath 'com.android.tools.build:gradle:7.3.1' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } diff --git a/packages/amplify_datastore/example/android/gradle/wrapper/gradle-wrapper.properties b/packages/amplify_datastore/example/android/gradle/wrapper/gradle-wrapper.properties index ceccc3a854..fb50717da0 100644 --- a/packages/amplify_datastore/example/android/gradle/wrapper/gradle-wrapper.properties +++ b/packages/amplify_datastore/example/android/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,6 @@ +#Thu Jan 04 13:35:08 PST 2024 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-all.zip From 7478188da88fdc640c33aa42f7e452343348da57 Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Thu, 4 Jan 2024 14:18:47 -0800 Subject: [PATCH 21/69] chore: reduced gradle distribution to 7.4 --- .../example/android/gradle/wrapper/gradle-wrapper.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/amplify_datastore/example/android/gradle/wrapper/gradle-wrapper.properties b/packages/amplify_datastore/example/android/gradle/wrapper/gradle-wrapper.properties index fb50717da0..49b0261eb1 100644 --- a/packages/amplify_datastore/example/android/gradle/wrapper/gradle-wrapper.properties +++ b/packages/amplify_datastore/example/android/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Thu Jan 04 13:35:08 PST 2024 +#Thu Jan 04 14:14:23 PST 2024 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists From e14697ac083f4fabac4db9f92894269117f2f5b7 Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Thu, 4 Jan 2024 14:45:24 -0800 Subject: [PATCH 22/69] chore: change kotlin version back to 1.9.10 and gradle distribution url back to 7.6.1 --- packages/amplify_datastore/android/build.gradle | 2 +- packages/amplify_datastore/example/android/build.gradle | 2 +- .../example/android/gradle/wrapper/gradle-wrapper.properties | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/amplify_datastore/android/build.gradle b/packages/amplify_datastore/android/build.gradle index d65bbb17c4..b61e1fab51 100644 --- a/packages/amplify_datastore/android/build.gradle +++ b/packages/amplify_datastore/android/build.gradle @@ -2,7 +2,7 @@ group 'com.amazonaws.amplify.amplify_datastore' version '1.0-SNAPSHOT' buildscript { - ext.kotlin_version = '1.9.0' + ext.kotlin_version = '1.9.10' repositories { mavenLocal() google() diff --git a/packages/amplify_datastore/example/android/build.gradle b/packages/amplify_datastore/example/android/build.gradle index d8cdb79bc3..764e69f673 100644 --- a/packages/amplify_datastore/example/android/build.gradle +++ b/packages/amplify_datastore/example/android/build.gradle @@ -1,5 +1,5 @@ buildscript { - ext.kotlin_version = '1.9.0' + ext.kotlin_version = '1.9.10' repositories { google() mavenCentral() diff --git a/packages/amplify_datastore/example/android/gradle/wrapper/gradle-wrapper.properties b/packages/amplify_datastore/example/android/gradle/wrapper/gradle-wrapper.properties index 49b0261eb1..97a975ba08 100644 --- a/packages/amplify_datastore/example/android/gradle/wrapper/gradle-wrapper.properties +++ b/packages/amplify_datastore/example/android/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ #Thu Jan 04 14:14:23 PST 2024 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists From 522310200c644f6436501b3bd533eac261478fba Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Thu, 4 Jan 2024 15:01:30 -0800 Subject: [PATCH 23/69] chore: move java back to 1_8 --- packages/amplify_datastore/android/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/amplify_datastore/android/build.gradle b/packages/amplify_datastore/android/build.gradle index b61e1fab51..c642296242 100644 --- a/packages/amplify_datastore/android/build.gradle +++ b/packages/amplify_datastore/android/build.gradle @@ -58,8 +58,8 @@ android { compileOptions { // Support for Java 8 features coreLibraryDesugaringEnabled true - sourceCompatibility JavaVersion.VERSION_17 - targetCompatibility JavaVersion.VERSION_17 + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 } testOptions { unitTests { From a9cca7e0758859ce7647bded9c41b6b00c5673de Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Thu, 4 Jan 2024 15:24:52 -0800 Subject: [PATCH 24/69] chore: changed java version back to 1.8 in example/app/build.gradle --- packages/amplify_datastore/example/android/app/build.gradle | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/amplify_datastore/example/android/app/build.gradle b/packages/amplify_datastore/example/android/app/build.gradle index c4399cfe6a..cbddbc3504 100644 --- a/packages/amplify_datastore/example/android/app/build.gradle +++ b/packages/amplify_datastore/example/android/app/build.gradle @@ -33,12 +33,12 @@ android { compileOptions { coreLibraryDesugaringEnabled true - sourceCompatibility JavaVersion.VERSION_11 - targetCompatibility JavaVersion.VERSION_11 + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 } kotlinOptions { - jvmTarget = '11' + jvmTarget = '1.8' } sourceSets { From eb5a145c627966b277c6fd4154173d0b91053c7c Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Thu, 4 Jan 2024 15:39:39 -0800 Subject: [PATCH 25/69] chore: put namespace back at the bottom of android --- packages/amplify_datastore/android/build.gradle | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/amplify_datastore/android/build.gradle b/packages/amplify_datastore/android/build.gradle index c642296242..52bb7c0fd1 100644 --- a/packages/amplify_datastore/android/build.gradle +++ b/packages/amplify_datastore/android/build.gradle @@ -32,8 +32,6 @@ apply plugin: 'kotlin-android' apply plugin: 'org.jlleitschuh.gradle.ktlint' android { - namespace 'com.amazonaws.amplify.amplify_datastore' - compileSdkVersion 33 sourceSets { @@ -67,6 +65,7 @@ android { } } + namespace 'com.amazonaws.amplify.amplify_datastore' } dependencies { From 766b941b91fa5ec6d631415d84e586866d5e1ace Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Thu, 4 Jan 2024 15:52:47 -0800 Subject: [PATCH 26/69] chore: remove change date and put distribution URL back to the bottom --- .../example/android/gradle/wrapper/gradle-wrapper.properties | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/amplify_datastore/example/android/gradle/wrapper/gradle-wrapper.properties b/packages/amplify_datastore/example/android/gradle/wrapper/gradle-wrapper.properties index 97a975ba08..d2d5d93833 100644 --- a/packages/amplify_datastore/example/android/gradle/wrapper/gradle-wrapper.properties +++ b/packages/amplify_datastore/example/android/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,5 @@ -#Thu Jan 04 14:14:23 PST 2024 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-bin.zip From 05a6101874a66af6d6cf83668a7b87b9f729a5f5 Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Thu, 4 Jan 2024 16:37:53 -0800 Subject: [PATCH 27/69] chore: remove multi-dex --- packages/amplify_datastore/example/android/app/build.gradle | 2 -- 1 file changed, 2 deletions(-) diff --git a/packages/amplify_datastore/example/android/app/build.gradle b/packages/amplify_datastore/example/android/app/build.gradle index cbddbc3504..1db33da315 100644 --- a/packages/amplify_datastore/example/android/app/build.gradle +++ b/packages/amplify_datastore/example/android/app/build.gradle @@ -53,7 +53,6 @@ android { versionCode flutterVersionCode.toInteger() versionName flutterVersionName testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner' - multiDexEnabled true } buildTypes { @@ -72,7 +71,6 @@ flutter { dependencies { coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5' implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" - implementation 'com.android.support:multidex:2.0.1' testImplementation 'junit:junit:4.13.2' From f749c70d2d31125e47bb928aa0d0bd9cb7b10642 Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Mon, 8 Jan 2024 11:16:50 -0800 Subject: [PATCH 28/69] chore: change the distribution URL back to what it was before --- .../example/android/gradle/wrapper/gradle-wrapper.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/amplify_datastore/example/android/gradle/wrapper/gradle-wrapper.properties b/packages/amplify_datastore/example/android/gradle/wrapper/gradle-wrapper.properties index d2d5d93833..285ec6f161 100644 --- a/packages/amplify_datastore/example/android/gradle/wrapper/gradle-wrapper.properties +++ b/packages/amplify_datastore/example/android/gradle/wrapper/gradle-wrapper.properties @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-all.zip \ No newline at end of file From 761362d99bf5e3d10fe0e225007b8c3892a87fa9 Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Tue, 9 Jan 2024 10:32:56 -0800 Subject: [PATCH 29/69] chore: revert changes back to android bump only --- packages/amplify_datastore/android/build.gradle | 6 +++--- packages/amplify_datastore/example/android/build.gradle | 4 ++-- .../android/gradle/wrapper/gradle-wrapper.properties | 2 +- .../push/amplify_push_notifications/android/build.gradle | 2 +- .../amplify_push_notifications/example/android/build.gradle | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/amplify_datastore/android/build.gradle b/packages/amplify_datastore/android/build.gradle index 52bb7c0fd1..33ff091a1d 100644 --- a/packages/amplify_datastore/android/build.gradle +++ b/packages/amplify_datastore/android/build.gradle @@ -2,7 +2,7 @@ group 'com.amazonaws.amplify.amplify_datastore' version '1.0-SNAPSHOT' buildscript { - ext.kotlin_version = '1.9.10' + ext.kotlin_version = '1.7.10' repositories { mavenLocal() google() @@ -13,7 +13,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:7.3.1' + classpath 'com.android.tools.build:gradle:7.4.2' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath 'org.jlleitschuh.gradle:ktlint-gradle:11.5.0' } @@ -70,7 +70,7 @@ android { dependencies { // Support for Java 8 features - coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.2.3' + coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.3' implementation 'com.amplifyframework:aws-auth-cognito:2.14.8' implementation "com.amplifyframework:aws-api:2.14.8" diff --git a/packages/amplify_datastore/example/android/build.gradle b/packages/amplify_datastore/example/android/build.gradle index 764e69f673..bf1ce3f353 100644 --- a/packages/amplify_datastore/example/android/build.gradle +++ b/packages/amplify_datastore/example/android/build.gradle @@ -1,12 +1,12 @@ buildscript { - ext.kotlin_version = '1.9.10' + ext.kotlin_version = '1.7.10' repositories { google() mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:7.3.1' + classpath 'com.android.tools.build:gradle:8.1.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } diff --git a/packages/amplify_datastore/example/android/gradle/wrapper/gradle-wrapper.properties b/packages/amplify_datastore/example/android/gradle/wrapper/gradle-wrapper.properties index 285ec6f161..ceccc3a854 100644 --- a/packages/amplify_datastore/example/android/gradle/wrapper/gradle-wrapper.properties +++ b/packages/amplify_datastore/example/android/gradle/wrapper/gradle-wrapper.properties @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-all.zip \ No newline at end of file +distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-all.zip diff --git a/packages/notifications/push/amplify_push_notifications/android/build.gradle b/packages/notifications/push/amplify_push_notifications/android/build.gradle index 6456172244..cc624edd7e 100644 --- a/packages/notifications/push/amplify_push_notifications/android/build.gradle +++ b/packages/notifications/push/amplify_push_notifications/android/build.gradle @@ -2,7 +2,7 @@ group 'com.amazonaws.amplify.amplify_push_notifications' version '1.0-SNAPSHOT' buildscript { - ext.kotlin_version = '1.9.10' + ext.kotlin_version = '1.7.10' repositories { google() mavenCentral() diff --git a/packages/notifications/push/amplify_push_notifications/example/android/build.gradle b/packages/notifications/push/amplify_push_notifications/example/android/build.gradle index e90901803d..f7eb7f63ce 100644 --- a/packages/notifications/push/amplify_push_notifications/example/android/build.gradle +++ b/packages/notifications/push/amplify_push_notifications/example/android/build.gradle @@ -1,5 +1,5 @@ buildscript { - ext.kotlin_version = '1.9.10' + ext.kotlin_version = '1.7.10' repositories { google() mavenCentral() From 6fd3088ea8ace5cc9ab13dfaa2883bd5691252cd Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Tue, 9 Jan 2024 10:34:10 -0800 Subject: [PATCH 30/69] chore: revert gradle versions on datastore --- packages/amplify_datastore/android/build.gradle | 2 +- packages/amplify_datastore/example/android/build.gradle | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/amplify_datastore/android/build.gradle b/packages/amplify_datastore/android/build.gradle index 33ff091a1d..e5c3533c46 100644 --- a/packages/amplify_datastore/android/build.gradle +++ b/packages/amplify_datastore/android/build.gradle @@ -13,7 +13,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:7.4.2' + classpath 'com.android.tools.build:gradle:8.1.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath 'org.jlleitschuh.gradle:ktlint-gradle:11.5.0' } diff --git a/packages/amplify_datastore/example/android/build.gradle b/packages/amplify_datastore/example/android/build.gradle index bf1ce3f353..ce647a433b 100644 --- a/packages/amplify_datastore/example/android/build.gradle +++ b/packages/amplify_datastore/example/android/build.gradle @@ -6,7 +6,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:8.1.0' + classpath 'com.android.tools.build:gradle:7.4.2' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } From d1c6bbdd150ab8c0d0dd72d09d7738dfcc041003 Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Mon, 5 Feb 2024 15:19:51 -0800 Subject: [PATCH 31/69] chore: upgrade amplify-android to 2.14.9 and gradle to 8.1.0 --- packages/amplify_datastore/android/build.gradle | 10 +++++----- .../android/gradle/wrapper/gradle-wrapper.properties | 3 ++- .../amplify_datastore/example/android/build.gradle | 4 ++-- .../amplify_push_notifications/android/build.gradle | 4 ++-- .../example/android/build.gradle | 4 ++-- .../android/gradle/wrapper/gradle-wrapper.properties | 2 +- 6 files changed, 14 insertions(+), 13 deletions(-) diff --git a/packages/amplify_datastore/android/build.gradle b/packages/amplify_datastore/android/build.gradle index e5c3533c46..9487332dfa 100644 --- a/packages/amplify_datastore/android/build.gradle +++ b/packages/amplify_datastore/android/build.gradle @@ -2,7 +2,7 @@ group 'com.amazonaws.amplify.amplify_datastore' version '1.0-SNAPSHOT' buildscript { - ext.kotlin_version = '1.7.10' + ext.kotlin_version = '1.9.10' repositories { mavenLocal() google() @@ -72,10 +72,10 @@ dependencies { // Support for Java 8 features coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.3' - implementation 'com.amplifyframework:aws-auth-cognito:2.14.8' - implementation "com.amplifyframework:aws-api:2.14.8" - implementation "com.amplifyframework:aws-datastore:2.14.8" - implementation "com.amplifyframework:aws-api-appsync:2.14.8" + implementation 'com.amplifyframework:aws-auth-cognito:2.14.9' + implementation "com.amplifyframework:aws-api:2.14.9" + implementation "com.amplifyframework:aws-datastore:2.14.9" + implementation "com.amplifyframework:aws-api-appsync:2.14.9" implementation 'com.google.code.gson:gson:2.10.1' implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.1' diff --git a/packages/amplify_datastore/android/gradle/wrapper/gradle-wrapper.properties b/packages/amplify_datastore/android/gradle/wrapper/gradle-wrapper.properties index ceccc3a854..2cd5edfa53 100644 --- a/packages/amplify_datastore/android/gradle/wrapper/gradle-wrapper.properties +++ b/packages/amplify_datastore/android/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,6 @@ +#Mon Feb 05 14:44:47 PST 2024 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-all.zip diff --git a/packages/amplify_datastore/example/android/build.gradle b/packages/amplify_datastore/example/android/build.gradle index ce647a433b..070b4ffbfd 100644 --- a/packages/amplify_datastore/example/android/build.gradle +++ b/packages/amplify_datastore/example/android/build.gradle @@ -1,12 +1,12 @@ buildscript { - ext.kotlin_version = '1.7.10' + ext.kotlin_version = '1.9.10' repositories { google() mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:7.4.2' + classpath 'com.android.tools.build:gradle:8.1.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } diff --git a/packages/notifications/push/amplify_push_notifications/android/build.gradle b/packages/notifications/push/amplify_push_notifications/android/build.gradle index cc624edd7e..729cd592dc 100644 --- a/packages/notifications/push/amplify_push_notifications/android/build.gradle +++ b/packages/notifications/push/amplify_push_notifications/android/build.gradle @@ -2,7 +2,7 @@ group 'com.amazonaws.amplify.amplify_push_notifications' version '1.0-SNAPSHOT' buildscript { - ext.kotlin_version = '1.7.10' + ext.kotlin_version = '1.9.10' repositories { google() mavenCentral() @@ -65,7 +65,7 @@ android { dependencies { api "com.google.firebase:firebase-messaging:23.2.0" // Import support library for Amplify push utils - implementation 'com.amplifyframework:aws-push-notifications-pinpoint-common:2.14.8' + implementation 'com.amplifyframework:aws-push-notifications-pinpoint-common:2.14.9' implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.4.1" implementation project(path: ':flutter_plugin_android_lifecycle') implementation 'androidx.test:core-ktx:1.5.0' diff --git a/packages/notifications/push/amplify_push_notifications/example/android/build.gradle b/packages/notifications/push/amplify_push_notifications/example/android/build.gradle index f7eb7f63ce..070b4ffbfd 100644 --- a/packages/notifications/push/amplify_push_notifications/example/android/build.gradle +++ b/packages/notifications/push/amplify_push_notifications/example/android/build.gradle @@ -1,12 +1,12 @@ buildscript { - ext.kotlin_version = '1.7.10' + ext.kotlin_version = '1.9.10' repositories { google() mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:7.3.0' + classpath 'com.android.tools.build:gradle:8.1.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } diff --git a/packages/notifications/push/amplify_push_notifications/example/android/gradle/wrapper/gradle-wrapper.properties b/packages/notifications/push/amplify_push_notifications/example/android/gradle/wrapper/gradle-wrapper.properties index 3c472b99c6..128177bf1b 100644 --- a/packages/notifications/push/amplify_push_notifications/example/android/gradle/wrapper/gradle-wrapper.properties +++ b/packages/notifications/push/amplify_push_notifications/example/android/gradle/wrapper/gradle-wrapper.properties @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip From 32ecb675628806aadab29f41cfce1c52486d628c Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Mon, 26 Feb 2024 15:29:50 -0800 Subject: [PATCH 32/69] chore: updated gradle version in datastore example app and added namespace to example app --- packages/amplify_datastore/android/build.gradle | 4 ++-- .../android/gradle/wrapper/gradle-wrapper.properties | 5 +++-- packages/amplify_datastore/example/android/app/build.gradle | 1 + .../example/android/gradle/wrapper/gradle-wrapper.properties | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/amplify_datastore/android/build.gradle b/packages/amplify_datastore/android/build.gradle index 9487332dfa..cb3f7e1a73 100644 --- a/packages/amplify_datastore/android/build.gradle +++ b/packages/amplify_datastore/android/build.gradle @@ -56,8 +56,8 @@ android { compileOptions { // Support for Java 8 features coreLibraryDesugaringEnabled true - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_17 + targetCompatibility JavaVersion.VERSION_17 } testOptions { unitTests { diff --git a/packages/amplify_datastore/android/gradle/wrapper/gradle-wrapper.properties b/packages/amplify_datastore/android/gradle/wrapper/gradle-wrapper.properties index 2cd5edfa53..ac72c34e8a 100644 --- a/packages/amplify_datastore/android/gradle/wrapper/gradle-wrapper.properties +++ b/packages/amplify_datastore/android/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,7 @@ -#Mon Feb 05 14:44:47 PST 2024 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip +networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/packages/amplify_datastore/example/android/app/build.gradle b/packages/amplify_datastore/example/android/app/build.gradle index 1db33da315..e6caa2f455 100644 --- a/packages/amplify_datastore/example/android/app/build.gradle +++ b/packages/amplify_datastore/example/android/app/build.gradle @@ -27,6 +27,7 @@ apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" android { // TODO(dnys1): Replace with `flutter.compileSdkVersion` when bumping min Flutter version + namespace 'com.amazonaws.amplify.amplify_datastore_example' compileSdkVersion 33 ndkVersion flutter.ndkVersion diff --git a/packages/amplify_datastore/example/android/gradle/wrapper/gradle-wrapper.properties b/packages/amplify_datastore/example/android/gradle/wrapper/gradle-wrapper.properties index ceccc3a854..128177bf1b 100644 --- a/packages/amplify_datastore/example/android/gradle/wrapper/gradle-wrapper.properties +++ b/packages/amplify_datastore/example/android/gradle/wrapper/gradle-wrapper.properties @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip From 74fd3a74ccd9c4a3602b7273f703faae92ce149b Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Mon, 26 Feb 2024 15:40:54 -0800 Subject: [PATCH 33/69] chore: upgrade java version on push notifications and datastore example app --- packages/amplify_datastore/example/android/app/build.gradle | 4 ++-- .../push/amplify_push_notifications/android/build.gradle | 4 ++-- .../example/android/app/build.gradle | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/amplify_datastore/example/android/app/build.gradle b/packages/amplify_datastore/example/android/app/build.gradle index e6caa2f455..4e6d4b5b7b 100644 --- a/packages/amplify_datastore/example/android/app/build.gradle +++ b/packages/amplify_datastore/example/android/app/build.gradle @@ -34,8 +34,8 @@ android { compileOptions { coreLibraryDesugaringEnabled true - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_17 + targetCompatibility JavaVersion.VERSION_17 } kotlinOptions { diff --git a/packages/notifications/push/amplify_push_notifications/android/build.gradle b/packages/notifications/push/amplify_push_notifications/android/build.gradle index 729cd592dc..eebcb94c1a 100644 --- a/packages/notifications/push/amplify_push_notifications/android/build.gradle +++ b/packages/notifications/push/amplify_push_notifications/android/build.gradle @@ -30,8 +30,8 @@ android { compileSdkVersion 33 compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_17 + targetCompatibility JavaVersion.VERSION_17 } kotlinOptions { diff --git a/packages/notifications/push/amplify_push_notifications/example/android/app/build.gradle b/packages/notifications/push/amplify_push_notifications/example/android/app/build.gradle index 4e00d7ee09..d4757d7351 100644 --- a/packages/notifications/push/amplify_push_notifications/example/android/app/build.gradle +++ b/packages/notifications/push/amplify_push_notifications/example/android/app/build.gradle @@ -31,8 +31,8 @@ android { ndkVersion flutter.ndkVersion compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_17 + targetCompatibility JavaVersion.VERSION_17 } kotlinOptions { From 701daacacb55dff98c434653962b13a7df01f246 Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Mon, 26 Feb 2024 16:10:02 -0800 Subject: [PATCH 34/69] chore: updated jvm target in datastore and push notifications example apps --- packages/amplify_datastore/example/android/app/build.gradle | 4 ++-- .../example/android/app/build.gradle | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/amplify_datastore/example/android/app/build.gradle b/packages/amplify_datastore/example/android/app/build.gradle index 4e6d4b5b7b..52f6240851 100644 --- a/packages/amplify_datastore/example/android/app/build.gradle +++ b/packages/amplify_datastore/example/android/app/build.gradle @@ -28,7 +28,7 @@ apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" android { // TODO(dnys1): Replace with `flutter.compileSdkVersion` when bumping min Flutter version namespace 'com.amazonaws.amplify.amplify_datastore_example' - compileSdkVersion 33 + compileSdkVersion 34 ndkVersion flutter.ndkVersion compileOptions { @@ -39,7 +39,7 @@ android { } kotlinOptions { - jvmTarget = '1.8' + jvmTarget = '17' } sourceSets { diff --git a/packages/notifications/push/amplify_push_notifications/example/android/app/build.gradle b/packages/notifications/push/amplify_push_notifications/example/android/app/build.gradle index d4757d7351..23beef5429 100644 --- a/packages/notifications/push/amplify_push_notifications/example/android/app/build.gradle +++ b/packages/notifications/push/amplify_push_notifications/example/android/app/build.gradle @@ -36,7 +36,7 @@ android { } kotlinOptions { - jvmTarget = '1.8' + jvmTarget = '17' } sourceSets { From 6ef27c89b12430bd984308672eeea268f5e58134 Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Mon, 26 Feb 2024 16:45:47 -0800 Subject: [PATCH 35/69] chore: added proguard rules to datastore and push notifications example apps so that it would build. also removed NonNull tags from amplifydatastoreplugin because that is implied in the type --- .../amplify_datastore/AmplifyDataStorePlugin.kt | 12 ++++++------ .../example/android/app/build.gradle | 2 ++ .../example/android/app/proguard-rules.pro | 5 +++++ .../amplify_push_notifications/android/build.gradle | 2 +- .../example/android/app/build.gradle | 2 ++ .../example/android/app/proguard-rules.pro | 5 +++++ 6 files changed, 21 insertions(+), 7 deletions(-) create mode 100644 packages/amplify_datastore/example/android/app/proguard-rules.pro create mode 100644 packages/notifications/push/amplify_push_notifications/example/android/app/proguard-rules.pro 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 9a365d6217..cf95856e07 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 @@ -130,7 +130,7 @@ class AmplifyDataStorePlugin : } override fun onAttachedToEngine( - @NonNull flutterPluginBinding: FlutterPlugin.FlutterPluginBinding + flutterPluginBinding: FlutterPlugin.FlutterPluginBinding ) { context = flutterPluginBinding.applicationContext channel = MethodChannel( @@ -161,7 +161,7 @@ class AmplifyDataStorePlugin : LOG.info("Initiated DataStore plugin") } - override fun onDetachedFromEngine(@NonNull binding: FlutterPlugin.FlutterPluginBinding) { + override fun onDetachedFromEngine(binding: FlutterPlugin.FlutterPluginBinding) { channel.setMethodCallHandler(null) nativeAuthPlugin = null @@ -173,7 +173,7 @@ class AmplifyDataStorePlugin : NativeAmplifyBridge.setUp(binding.binaryMessenger, null) } - override fun onMethodCall(@NonNull call: MethodCall, @NonNull _result: Result) { + override fun onMethodCall(call: MethodCall, _result: Result) { val result = AtomicResult(_result, call.method) var data: Map = HashMap() try { @@ -558,7 +558,7 @@ class AmplifyDataStorePlugin : ) } - private fun checkArguments(@NonNull args: Any): Map { + private fun checkArguments(args: Any): Map { if (args !is Map<*, *>) { throw java.lang.Exception("Flutter method call arguments are not a map.") } @@ -566,8 +566,8 @@ class AmplifyDataStorePlugin : } private fun buildSyncExpressions( - @NonNull syncExpressions: List>, - @NonNull dataStoreConfigurationBuilder: DataStoreConfiguration.Builder + syncExpressions: List>, + dataStoreConfigurationBuilder: DataStoreConfiguration.Builder ) { syncExpressions.forEach { try { diff --git a/packages/amplify_datastore/example/android/app/build.gradle b/packages/amplify_datastore/example/android/app/build.gradle index 52f6240851..d5409b463b 100644 --- a/packages/amplify_datastore/example/android/app/build.gradle +++ b/packages/amplify_datastore/example/android/app/build.gradle @@ -23,6 +23,7 @@ if (flutterVersionName == null) { apply plugin: 'com.android.application' apply plugin: 'kotlin-android' +apply plugin: 'kotlin-parcelize' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" android { @@ -61,6 +62,7 @@ android { // TODO: Add your own signing config for the release build. // Signing with the debug keys for now, so `flutter run --release` works. signingConfig signingConfigs.debug + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } } } diff --git a/packages/amplify_datastore/example/android/app/proguard-rules.pro b/packages/amplify_datastore/example/android/app/proguard-rules.pro new file mode 100644 index 0000000000..c95fd1cea9 --- /dev/null +++ b/packages/amplify_datastore/example/android/app/proguard-rules.pro @@ -0,0 +1,5 @@ +-keep class kotlinx.parcelize.Parcelize { *; } +-keep @kotlinx.parcelize.Parcelize class * { *; } +-keepclassmembers class * implements android.os.Parcelable { + static ** CREATOR; +} diff --git a/packages/notifications/push/amplify_push_notifications/android/build.gradle b/packages/notifications/push/amplify_push_notifications/android/build.gradle index eebcb94c1a..2e78e243d9 100644 --- a/packages/notifications/push/amplify_push_notifications/android/build.gradle +++ b/packages/notifications/push/amplify_push_notifications/android/build.gradle @@ -27,7 +27,7 @@ apply plugin: 'kotlin-android' apply plugin: 'kotlinx-serialization' android { - compileSdkVersion 33 + compileSdkVersion 34 compileOptions { sourceCompatibility JavaVersion.VERSION_17 diff --git a/packages/notifications/push/amplify_push_notifications/example/android/app/build.gradle b/packages/notifications/push/amplify_push_notifications/example/android/app/build.gradle index 23beef5429..d4dedcba0d 100644 --- a/packages/notifications/push/amplify_push_notifications/example/android/app/build.gradle +++ b/packages/notifications/push/amplify_push_notifications/example/android/app/build.gradle @@ -23,6 +23,7 @@ if (flutterVersionName == null) { apply plugin: 'com.android.application' apply plugin: 'kotlin-android' +apply plugin: 'kotlin-parcelize' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" android { @@ -59,6 +60,7 @@ android { // TODO: Add your own signing config for the release build. // Signing with the debug keys for now, so `flutter run --release` works. signingConfig signingConfigs.debug + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } } } diff --git a/packages/notifications/push/amplify_push_notifications/example/android/app/proguard-rules.pro b/packages/notifications/push/amplify_push_notifications/example/android/app/proguard-rules.pro new file mode 100644 index 0000000000..c95fd1cea9 --- /dev/null +++ b/packages/notifications/push/amplify_push_notifications/example/android/app/proguard-rules.pro @@ -0,0 +1,5 @@ +-keep class kotlinx.parcelize.Parcelize { *; } +-keep @kotlinx.parcelize.Parcelize class * { *; } +-keepclassmembers class * implements android.os.Parcelable { + static ** CREATOR; +} From 7f13e590bfc025106418f83a774f1cfea3c80061 Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Tue, 27 Feb 2024 11:15:14 -0800 Subject: [PATCH 36/69] chore: change java version back to 1.8 for datastore and push notifications example apps --- packages/amplify_datastore/android/build.gradle | 4 ++-- packages/amplify_datastore/example/android/app/build.gradle | 6 +++--- .../push/amplify_push_notifications/android/build.gradle | 4 ++-- .../example/android/app/build.gradle | 6 +++--- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/amplify_datastore/android/build.gradle b/packages/amplify_datastore/android/build.gradle index cb3f7e1a73..9487332dfa 100644 --- a/packages/amplify_datastore/android/build.gradle +++ b/packages/amplify_datastore/android/build.gradle @@ -56,8 +56,8 @@ android { compileOptions { // Support for Java 8 features coreLibraryDesugaringEnabled true - sourceCompatibility JavaVersion.VERSION_17 - targetCompatibility JavaVersion.VERSION_17 + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 } testOptions { unitTests { diff --git a/packages/amplify_datastore/example/android/app/build.gradle b/packages/amplify_datastore/example/android/app/build.gradle index d5409b463b..d04000ded1 100644 --- a/packages/amplify_datastore/example/android/app/build.gradle +++ b/packages/amplify_datastore/example/android/app/build.gradle @@ -35,12 +35,12 @@ android { compileOptions { coreLibraryDesugaringEnabled true - sourceCompatibility JavaVersion.VERSION_17 - targetCompatibility JavaVersion.VERSION_17 + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 } kotlinOptions { - jvmTarget = '17' + jvmTarget = '1.8' } sourceSets { diff --git a/packages/notifications/push/amplify_push_notifications/android/build.gradle b/packages/notifications/push/amplify_push_notifications/android/build.gradle index 2e78e243d9..3dd66e4e56 100644 --- a/packages/notifications/push/amplify_push_notifications/android/build.gradle +++ b/packages/notifications/push/amplify_push_notifications/android/build.gradle @@ -30,8 +30,8 @@ android { compileSdkVersion 34 compileOptions { - sourceCompatibility JavaVersion.VERSION_17 - targetCompatibility JavaVersion.VERSION_17 + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 } kotlinOptions { diff --git a/packages/notifications/push/amplify_push_notifications/example/android/app/build.gradle b/packages/notifications/push/amplify_push_notifications/example/android/app/build.gradle index d4dedcba0d..ac79aef8f9 100644 --- a/packages/notifications/push/amplify_push_notifications/example/android/app/build.gradle +++ b/packages/notifications/push/amplify_push_notifications/example/android/app/build.gradle @@ -32,12 +32,12 @@ android { ndkVersion flutter.ndkVersion compileOptions { - sourceCompatibility JavaVersion.VERSION_17 - targetCompatibility JavaVersion.VERSION_17 + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 } kotlinOptions { - jvmTarget = '17' + jvmTarget = '1.8' } sourceSets { From 901eb10d82fc54c414a14e1bde391cd063e9e10f Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Tue, 27 Feb 2024 16:30:19 -0800 Subject: [PATCH 37/69] chore: update java-version in actions.yaml --- .github/workflows/actions.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/actions.yaml b/.github/workflows/actions.yaml index 52d7aa1928..bad50eae3c 100644 --- a/.github/workflows/actions.yaml +++ b/.github/workflows/actions.yaml @@ -118,7 +118,7 @@ jobs: - uses: actions/setup-java@cd89f46ac9d01407894225f350157564c9c7cee2 # 3.12.0 with: distribution: "corretto" # Amazon Corretto Build of OpenJDK - java-version: "11" + java-version: "17" - name: Test timeout-minutes: 10 From 23111390c903261911bcf2a52f022f6405314e5e Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Tue, 27 Feb 2024 16:39:32 -0800 Subject: [PATCH 38/69] Revert "chore: update java-version in actions.yaml" This reverts commit 901eb10d82fc54c414a14e1bde391cd063e9e10f. --- .github/workflows/actions.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/actions.yaml b/.github/workflows/actions.yaml index bad50eae3c..52d7aa1928 100644 --- a/.github/workflows/actions.yaml +++ b/.github/workflows/actions.yaml @@ -118,7 +118,7 @@ jobs: - uses: actions/setup-java@cd89f46ac9d01407894225f350157564c9c7cee2 # 3.12.0 with: distribution: "corretto" # Amazon Corretto Build of OpenJDK - java-version: "17" + java-version: "11" - name: Test timeout-minutes: 10 From 1ee59652f6f937439ec56ad8f9d64f790e4f2bf5 Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Thu, 29 Feb 2024 10:49:03 -0800 Subject: [PATCH 39/69] chore: test mvoing android gradle files into new format released by flutter --- .../example/android/app/build.gradle | 21 +++++++------ .../example/android/build.gradle | 13 -------- .../example/android/settings.gradle | 30 ++++++++++++++----- 3 files changed, 34 insertions(+), 30 deletions(-) diff --git a/packages/amplify_datastore/example/android/app/build.gradle b/packages/amplify_datastore/example/android/app/build.gradle index d04000ded1..048b50c8ad 100644 --- a/packages/amplify_datastore/example/android/app/build.gradle +++ b/packages/amplify_datastore/example/android/app/build.gradle @@ -6,11 +6,6 @@ if (localPropertiesFile.exists()) { } } -def flutterRoot = localProperties.getProperty('flutter.sdk') -if (flutterRoot == null) { - throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") -} - def flutterVersionCode = localProperties.getProperty('flutter.versionCode') if (flutterVersionCode == null) { flutterVersionCode = '1' @@ -21,10 +16,18 @@ if (flutterVersionName == null) { flutterVersionName = '1.0' } -apply plugin: 'com.android.application' -apply plugin: 'kotlin-android' -apply plugin: 'kotlin-parcelize' -apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" +// REMOVE IF TEST PASSES +// apply plugin: 'com.android.application' +// apply plugin: 'kotlin-android' +// apply plugin: 'kotlin-parcelize' +// apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" + +plugins { + id "com.android.application" + id "kotlin-android" + id "dev.flutter.flutter-gradle-plugin" +} + android { // TODO(dnys1): Replace with `flutter.compileSdkVersion` when bumping min Flutter version diff --git a/packages/amplify_datastore/example/android/build.gradle b/packages/amplify_datastore/example/android/build.gradle index 070b4ffbfd..bc157bd1a1 100644 --- a/packages/amplify_datastore/example/android/build.gradle +++ b/packages/amplify_datastore/example/android/build.gradle @@ -1,16 +1,3 @@ -buildscript { - ext.kotlin_version = '1.9.10' - repositories { - google() - mavenCentral() - } - - dependencies { - classpath 'com.android.tools.build:gradle:8.1.0' - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - } -} - allprojects { repositories { google() diff --git a/packages/amplify_datastore/example/android/settings.gradle b/packages/amplify_datastore/example/android/settings.gradle index 44e62bcf06..276cdabf9c 100644 --- a/packages/amplify_datastore/example/android/settings.gradle +++ b/packages/amplify_datastore/example/android/settings.gradle @@ -1,11 +1,25 @@ -include ':app' +pluginManagement { + def flutterSdkPath = { + def properties = new Properties() + file("local.properties").withInputStream { properties.load(it) } + def flutterSdkPath = properties.getProperty("flutter.sdk") + assert flutterSdkPath != null, "flutter.sdk not set in local.properties" + return flutterSdkPath + }() -def localPropertiesFile = new File(rootProject.projectDir, "local.properties") -def properties = new Properties() + includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") -assert localPropertiesFile.exists() -localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } + repositories { + google() + mavenCentral() + gradlePluginPortal() + } +} -def flutterSdkPath = properties.getProperty("flutter.sdk") -assert flutterSdkPath != null, "flutter.sdk not set in local.properties" -apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" +plugins { + id "dev.flutter.flutter-plugin-loader" version "1.0.0" + id "com.android.application" version "8.1.0" apply false + id "org.jetbrains.kotlin.android" version "1.9.10" apply false +} + +include ":app" From 72de8813023a917a7955c4f577aef39123177b9e Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Thu, 29 Feb 2024 11:19:20 -0800 Subject: [PATCH 40/69] chore: move plugins block to the top --- .../example/android/app/build.gradle | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/packages/amplify_datastore/example/android/app/build.gradle b/packages/amplify_datastore/example/android/app/build.gradle index 048b50c8ad..1fd8ec1284 100644 --- a/packages/amplify_datastore/example/android/app/build.gradle +++ b/packages/amplify_datastore/example/android/app/build.gradle @@ -1,3 +1,9 @@ +plugins { + id "com.android.application" + id "kotlin-android" + id "dev.flutter.flutter-gradle-plugin" +} + def localProperties = new Properties() def localPropertiesFile = rootProject.file('local.properties') if (localPropertiesFile.exists()) { @@ -22,13 +28,6 @@ if (flutterVersionName == null) { // apply plugin: 'kotlin-parcelize' // apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" -plugins { - id "com.android.application" - id "kotlin-android" - id "dev.flutter.flutter-gradle-plugin" -} - - android { // TODO(dnys1): Replace with `flutter.compileSdkVersion` when bumping min Flutter version namespace 'com.amazonaws.amplify.amplify_datastore_example' From 4a4a56d5b119c3d80a5365f7a3de83194d4c35ba Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Thu, 29 Feb 2024 13:35:18 -0800 Subject: [PATCH 41/69] Revert "chore: move plugins block to the top" This reverts commit 72de8813023a917a7955c4f577aef39123177b9e. --- .../example/android/app/build.gradle | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/packages/amplify_datastore/example/android/app/build.gradle b/packages/amplify_datastore/example/android/app/build.gradle index 1fd8ec1284..048b50c8ad 100644 --- a/packages/amplify_datastore/example/android/app/build.gradle +++ b/packages/amplify_datastore/example/android/app/build.gradle @@ -1,9 +1,3 @@ -plugins { - id "com.android.application" - id "kotlin-android" - id "dev.flutter.flutter-gradle-plugin" -} - def localProperties = new Properties() def localPropertiesFile = rootProject.file('local.properties') if (localPropertiesFile.exists()) { @@ -28,6 +22,13 @@ if (flutterVersionName == null) { // apply plugin: 'kotlin-parcelize' // apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" +plugins { + id "com.android.application" + id "kotlin-android" + id "dev.flutter.flutter-gradle-plugin" +} + + android { // TODO(dnys1): Replace with `flutter.compileSdkVersion` when bumping min Flutter version namespace 'com.amazonaws.amplify.amplify_datastore_example' From bb70336ded6eda3d3d8c925871107cae40ab52eb Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Thu, 29 Feb 2024 13:35:21 -0800 Subject: [PATCH 42/69] Revert "chore: test mvoing android gradle files into new format released by flutter" This reverts commit 1ee59652f6f937439ec56ad8f9d64f790e4f2bf5. --- .../example/android/app/build.gradle | 21 ++++++------- .../example/android/build.gradle | 13 ++++++++ .../example/android/settings.gradle | 30 +++++-------------- 3 files changed, 30 insertions(+), 34 deletions(-) diff --git a/packages/amplify_datastore/example/android/app/build.gradle b/packages/amplify_datastore/example/android/app/build.gradle index 048b50c8ad..d04000ded1 100644 --- a/packages/amplify_datastore/example/android/app/build.gradle +++ b/packages/amplify_datastore/example/android/app/build.gradle @@ -6,6 +6,11 @@ if (localPropertiesFile.exists()) { } } +def flutterRoot = localProperties.getProperty('flutter.sdk') +if (flutterRoot == null) { + throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") +} + def flutterVersionCode = localProperties.getProperty('flutter.versionCode') if (flutterVersionCode == null) { flutterVersionCode = '1' @@ -16,18 +21,10 @@ if (flutterVersionName == null) { flutterVersionName = '1.0' } -// REMOVE IF TEST PASSES -// apply plugin: 'com.android.application' -// apply plugin: 'kotlin-android' -// apply plugin: 'kotlin-parcelize' -// apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" - -plugins { - id "com.android.application" - id "kotlin-android" - id "dev.flutter.flutter-gradle-plugin" -} - +apply plugin: 'com.android.application' +apply plugin: 'kotlin-android' +apply plugin: 'kotlin-parcelize' +apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" android { // TODO(dnys1): Replace with `flutter.compileSdkVersion` when bumping min Flutter version diff --git a/packages/amplify_datastore/example/android/build.gradle b/packages/amplify_datastore/example/android/build.gradle index bc157bd1a1..070b4ffbfd 100644 --- a/packages/amplify_datastore/example/android/build.gradle +++ b/packages/amplify_datastore/example/android/build.gradle @@ -1,3 +1,16 @@ +buildscript { + ext.kotlin_version = '1.9.10' + repositories { + google() + mavenCentral() + } + + dependencies { + classpath 'com.android.tools.build:gradle:8.1.0' + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + } +} + allprojects { repositories { google() diff --git a/packages/amplify_datastore/example/android/settings.gradle b/packages/amplify_datastore/example/android/settings.gradle index 276cdabf9c..44e62bcf06 100644 --- a/packages/amplify_datastore/example/android/settings.gradle +++ b/packages/amplify_datastore/example/android/settings.gradle @@ -1,25 +1,11 @@ -pluginManagement { - def flutterSdkPath = { - def properties = new Properties() - file("local.properties").withInputStream { properties.load(it) } - def flutterSdkPath = properties.getProperty("flutter.sdk") - assert flutterSdkPath != null, "flutter.sdk not set in local.properties" - return flutterSdkPath - }() +include ':app' - includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") +def localPropertiesFile = new File(rootProject.projectDir, "local.properties") +def properties = new Properties() - repositories { - google() - mavenCentral() - gradlePluginPortal() - } -} +assert localPropertiesFile.exists() +localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } -plugins { - id "dev.flutter.flutter-plugin-loader" version "1.0.0" - id "com.android.application" version "8.1.0" apply false - id "org.jetbrains.kotlin.android" version "1.9.10" apply false -} - -include ":app" +def flutterSdkPath = properties.getProperty("flutter.sdk") +assert flutterSdkPath != null, "flutter.sdk not set in local.properties" +apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" From 345d90bab238182df64c5b55128f61c53cfa9298 Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Thu, 29 Feb 2024 16:31:32 -0800 Subject: [PATCH 43/69] chore: remove proguard files --- packages/amplify_datastore/example/android/app/build.gradle | 1 - .../amplify_datastore/example/android/app/proguard-rules.pro | 5 ----- .../example/android/app/build.gradle | 1 - .../example/android/app/proguard-rules.pro | 5 ----- .../example/android/gradle/wrapper/gradle-wrapper.properties | 4 +++- 5 files changed, 3 insertions(+), 13 deletions(-) delete mode 100644 packages/amplify_datastore/example/android/app/proguard-rules.pro delete mode 100644 packages/notifications/push/amplify_push_notifications/example/android/app/proguard-rules.pro diff --git a/packages/amplify_datastore/example/android/app/build.gradle b/packages/amplify_datastore/example/android/app/build.gradle index d04000ded1..9d1a8fa5a6 100644 --- a/packages/amplify_datastore/example/android/app/build.gradle +++ b/packages/amplify_datastore/example/android/app/build.gradle @@ -62,7 +62,6 @@ android { // TODO: Add your own signing config for the release build. // Signing with the debug keys for now, so `flutter run --release` works. signingConfig signingConfigs.debug - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } } } diff --git a/packages/amplify_datastore/example/android/app/proguard-rules.pro b/packages/amplify_datastore/example/android/app/proguard-rules.pro deleted file mode 100644 index c95fd1cea9..0000000000 --- a/packages/amplify_datastore/example/android/app/proguard-rules.pro +++ /dev/null @@ -1,5 +0,0 @@ --keep class kotlinx.parcelize.Parcelize { *; } --keep @kotlinx.parcelize.Parcelize class * { *; } --keepclassmembers class * implements android.os.Parcelable { - static ** CREATOR; -} diff --git a/packages/notifications/push/amplify_push_notifications/example/android/app/build.gradle b/packages/notifications/push/amplify_push_notifications/example/android/app/build.gradle index ac79aef8f9..7bf8fb99b1 100644 --- a/packages/notifications/push/amplify_push_notifications/example/android/app/build.gradle +++ b/packages/notifications/push/amplify_push_notifications/example/android/app/build.gradle @@ -60,7 +60,6 @@ android { // TODO: Add your own signing config for the release build. // Signing with the debug keys for now, so `flutter run --release` works. signingConfig signingConfigs.debug - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } } } diff --git a/packages/notifications/push/amplify_push_notifications/example/android/app/proguard-rules.pro b/packages/notifications/push/amplify_push_notifications/example/android/app/proguard-rules.pro deleted file mode 100644 index c95fd1cea9..0000000000 --- a/packages/notifications/push/amplify_push_notifications/example/android/app/proguard-rules.pro +++ /dev/null @@ -1,5 +0,0 @@ --keep class kotlinx.parcelize.Parcelize { *; } --keep @kotlinx.parcelize.Parcelize class * { *; } --keepclassmembers class * implements android.os.Parcelable { - static ** CREATOR; -} diff --git a/packages/notifications/push/amplify_push_notifications/example/android/gradle/wrapper/gradle-wrapper.properties b/packages/notifications/push/amplify_push_notifications/example/android/gradle/wrapper/gradle-wrapper.properties index 128177bf1b..ac72c34e8a 100644 --- a/packages/notifications/push/amplify_push_notifications/example/android/gradle/wrapper/gradle-wrapper.properties +++ b/packages/notifications/push/amplify_push_notifications/example/android/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip +networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip From 924e06b9ee10335e98dfa6f9b8f7598f09e1f4d7 Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Fri, 1 Mar 2024 10:51:47 -0800 Subject: [PATCH 44/69] chore: added jvm target in datastore to android build.gradle so that javaversion does not have to be upgraded --- packages/amplify_datastore/android/build.gradle | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/amplify_datastore/android/build.gradle b/packages/amplify_datastore/android/build.gradle index 9487332dfa..f047061de0 100644 --- a/packages/amplify_datastore/android/build.gradle +++ b/packages/amplify_datastore/android/build.gradle @@ -59,6 +59,11 @@ android { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } + + kotlinOptions { + jvmTarget = '1.8' + } + testOptions { unitTests { includeAndroidResources = true From 6ece5978a8beb9a2ad095b081d23ca394e257f93 Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Fri, 1 Mar 2024 11:43:34 -0800 Subject: [PATCH 45/69] chore: try manually adding a java version to the amplify datastore github workflow --- .github/dependabot.yaml | 28 +++++++++++++------------- .github/workflows/flutter_android.yaml | 7 +++++++ 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/.github/dependabot.yaml b/.github/dependabot.yaml index 57d7b2b604..db4e69f14d 100644 --- a/.github/dependabot.yaml +++ b/.github/dependabot.yaml @@ -129,20 +129,6 @@ updates: test: patterns: - "test" - - package-ecosystem: "pub" - directory: "infra" - schedule: - interval: "daily" - ignore: - # Ignore patch version bumps - - dependency-name: "*" - update-types: - - "version-update:semver-patch" - # Ignore all repo packages - - dependency-name: "amplify_core" - - dependency-name: "aws_common" - - dependency-name: "amplify_lints" - - dependency-name: "aws_signature_v4" - package-ecosystem: "pub" directory: "actions" schedule: @@ -207,6 +193,20 @@ updates: - dependency-name: "amplify_datastore_plugin_interface" - dependency-name: "amplify_storage_s3" - dependency-name: "amplify_storage_s3_dart" + - package-ecosystem: "pub" + directory: "infra" + schedule: + interval: "daily" + ignore: + # Ignore patch version bumps + - dependency-name: "*" + update-types: + - "version-update:semver-patch" + # Ignore all repo packages + - dependency-name: "amplify_core" + - dependency-name: "aws_common" + - dependency-name: "amplify_lints" + - dependency-name: "aws_signature_v4" - package-ecosystem: "pub" directory: "packages/aft" schedule: diff --git a/.github/workflows/flutter_android.yaml b/.github/workflows/flutter_android.yaml index 288c9dfd26..7f5ec64d40 100644 --- a/.github/workflows/flutter_android.yaml +++ b/.github/workflows/flutter_android.yaml @@ -31,6 +31,13 @@ jobs: exclude: - channel: ${{ (github.event_name == 'pull_request') && 'beta' || 'NONE' }} steps: + # Flutter requires Java 17 to build android apps with Gradle. + - name: Setup Java + uses: actions/setup-java@cd89f46ac9d01407894225f350157564c9c7cee2 # 3.12.0 + with: + distribution: "corretto" # Amazon Corretto Build of OpenJDK + java-version: "17" + - name: Git Checkout uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # 3.6.0 From 733c5f3507135eed432d94ffc396afcca45c34a5 Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Fri, 1 Mar 2024 11:55:36 -0800 Subject: [PATCH 46/69] Revert "chore: try manually adding a java version to the amplify datastore github workflow" This reverts commit 6ece5978a8beb9a2ad095b081d23ca394e257f93. --- .github/dependabot.yaml | 28 +++++++++++++------------- .github/workflows/flutter_android.yaml | 7 ------- 2 files changed, 14 insertions(+), 21 deletions(-) diff --git a/.github/dependabot.yaml b/.github/dependabot.yaml index db4e69f14d..57d7b2b604 100644 --- a/.github/dependabot.yaml +++ b/.github/dependabot.yaml @@ -129,6 +129,20 @@ updates: test: patterns: - "test" + - package-ecosystem: "pub" + directory: "infra" + schedule: + interval: "daily" + ignore: + # Ignore patch version bumps + - dependency-name: "*" + update-types: + - "version-update:semver-patch" + # Ignore all repo packages + - dependency-name: "amplify_core" + - dependency-name: "aws_common" + - dependency-name: "amplify_lints" + - dependency-name: "aws_signature_v4" - package-ecosystem: "pub" directory: "actions" schedule: @@ -193,20 +207,6 @@ updates: - dependency-name: "amplify_datastore_plugin_interface" - dependency-name: "amplify_storage_s3" - dependency-name: "amplify_storage_s3_dart" - - package-ecosystem: "pub" - directory: "infra" - schedule: - interval: "daily" - ignore: - # Ignore patch version bumps - - dependency-name: "*" - update-types: - - "version-update:semver-patch" - # Ignore all repo packages - - dependency-name: "amplify_core" - - dependency-name: "aws_common" - - dependency-name: "amplify_lints" - - dependency-name: "aws_signature_v4" - package-ecosystem: "pub" directory: "packages/aft" schedule: diff --git a/.github/workflows/flutter_android.yaml b/.github/workflows/flutter_android.yaml index 7f5ec64d40..288c9dfd26 100644 --- a/.github/workflows/flutter_android.yaml +++ b/.github/workflows/flutter_android.yaml @@ -31,13 +31,6 @@ jobs: exclude: - channel: ${{ (github.event_name == 'pull_request') && 'beta' || 'NONE' }} steps: - # Flutter requires Java 17 to build android apps with Gradle. - - name: Setup Java - uses: actions/setup-java@cd89f46ac9d01407894225f350157564c9c7cee2 # 3.12.0 - with: - distribution: "corretto" # Amazon Corretto Build of OpenJDK - java-version: "17" - - name: Git Checkout uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # 3.6.0 From 6217ad281aeb309dfe9af1620ecb5e8405249813 Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Fri, 1 Mar 2024 11:56:57 -0800 Subject: [PATCH 47/69] chore: manually require java 17 in flutter_android.yaml file --- .github/workflows/flutter_android.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/flutter_android.yaml b/.github/workflows/flutter_android.yaml index 288c9dfd26..bfe7961666 100644 --- a/.github/workflows/flutter_android.yaml +++ b/.github/workflows/flutter_android.yaml @@ -31,6 +31,12 @@ jobs: exclude: - channel: ${{ (github.event_name == 'pull_request') && 'beta' || 'NONE' }} steps: + - name: Setup Java + uses: actions/setup-java@cd89f46ac9d01407894225f350157564c9c7cee2 # 3.12.0 + with: + distribution: "corretto" # Amazon Corretto Build of OpenJDK + java-version: "17" + - name: Git Checkout uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # 3.6.0 From 1f2a400cc920d7f6c675f334fb48dce19ef85482 Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Fri, 1 Mar 2024 12:28:22 -0800 Subject: [PATCH 48/69] chore: ran ktlintFormat on datastore/android/src/test files --- .../AmplifyDataStorePlugin.kt | 1 - .../AmplifyDataStoreHubTest.kt | 122 +-- .../AmplifyDataStorePluginTest.kt | 85 +- .../AmplifyModelSchemaTest.kt | 12 +- .../AmplifySerializedModelTest.kt | 12 +- .../amplify_datastore/CoroutineTestRule.kt | 2 +- .../amplify/amplify_datastore/SchemaData.kt | 932 +++++++++--------- .../types/query/QueryPaginationBuilderTest.kt | 9 +- .../types/query/QueryPredicateBuilderTest.kt | 33 +- 9 files changed, 613 insertions(+), 595 deletions(-) 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 cf95856e07..0e6c7db1c0 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 @@ -6,7 +6,6 @@ package com.amazonaws.amplify.amplify_datastore import android.content.Context import android.os.Handler import android.os.Looper -import androidx.annotation.NonNull import androidx.annotation.VisibleForTesting import com.amazonaws.amplify.amplify_datastore.exception.ExceptionMessages import com.amazonaws.amplify.amplify_datastore.exception.ExceptionUtil.Companion.createSerializedError diff --git a/packages/amplify_datastore/android/src/test/kotlin/com/amazonaws/amplify/amplify_datastore/AmplifyDataStoreHubTest.kt b/packages/amplify_datastore/android/src/test/kotlin/com/amazonaws/amplify/amplify_datastore/AmplifyDataStoreHubTest.kt index 2fc9f81af7..9b39fc3e8b 100644 --- a/packages/amplify_datastore/android/src/test/kotlin/com/amazonaws/amplify/amplify_datastore/AmplifyDataStoreHubTest.kt +++ b/packages/amplify_datastore/android/src/test/kotlin/com/amazonaws/amplify/amplify_datastore/AmplifyDataStoreHubTest.kt @@ -72,12 +72,12 @@ class AmplifyDataStoreHubTest { fun test_hub_outboxMutationEnqueued_event() { flutterPlugin = AmplifyDataStorePlugin(eventHandler = mockStreamHandler, hubEventHandler = mockHubHandler) val eventData: HashMap = ( - readMapFromFile( - "hub", - "outboxMutationEnqueuedEvent.json", - HashMap::class.java - ) as HashMap - ) + readMapFromFile( + "hub", + "outboxMutationEnqueuedEvent.json", + HashMap::class.java + ) as HashMap + ) val element: HashMap = eventData["element"] as HashMap var metadataMap: HashMap val modelMap: HashMap = element["model"] as HashMap @@ -121,12 +121,12 @@ class AmplifyDataStoreHubTest { fun test_hub_outboxMutationProcessed_event() { flutterPlugin = AmplifyDataStorePlugin(eventHandler = mockStreamHandler, hubEventHandler = mockHubHandler) val eventData: HashMap = ( - readMapFromFile( - "hub", - "outboxMutationProcessedEvent.json", - HashMap::class.java - ) as HashMap - ) + readMapFromFile( + "hub", + "outboxMutationProcessedEvent.json", + HashMap::class.java + ) as HashMap + ) val element: HashMap = eventData["element"] as HashMap val metadataMap: HashMap = element["syncMetadata"] as HashMap val modelMap: HashMap = element["model"] as HashMap @@ -135,7 +135,7 @@ class AmplifyDataStoreHubTest { metadataMap["id"] as String, metadataMap["_deleted"] as Boolean, metadataMap["_version"] as Int, - time, + time ) val modelData = mapOf( "id" to serializedData["id"] as String, @@ -175,12 +175,12 @@ class AmplifyDataStoreHubTest { fun test_hub_ready_event() { flutterPlugin = AmplifyDataStorePlugin(eventHandler = mockStreamHandler, hubEventHandler = mockHubHandler) val eventData: HashMap = ( - readMapFromFile( - "hub", - "readyEvent.json", - HashMap::class.java - ) as HashMap - ) + readMapFromFile( + "hub", + "readyEvent.json", + HashMap::class.java + ) as HashMap + ) val event: HubEvent<*> = HubEvent.create(DataStoreChannelEventName.READY) @@ -205,12 +205,12 @@ class AmplifyDataStoreHubTest { fun test_hub_subscriptionsEstablished_event() { flutterPlugin = AmplifyDataStorePlugin(eventHandler = mockStreamHandler, hubEventHandler = mockHubHandler) val eventData: HashMap = ( - readMapFromFile( - "hub", - "subscriptionsEstablishedEvent.json", - HashMap::class.java - ) as HashMap - ) + readMapFromFile( + "hub", + "subscriptionsEstablishedEvent.json", + HashMap::class.java + ) as HashMap + ) val event: HubEvent<*> = HubEvent.create(DataStoreChannelEventName.SUBSCRIPTIONS_ESTABLISHED) @@ -235,12 +235,12 @@ class AmplifyDataStoreHubTest { fun test_hub_syncQueriesReady_event() { flutterPlugin = AmplifyDataStorePlugin(eventHandler = mockStreamHandler, hubEventHandler = mockHubHandler) val eventData: HashMap = ( - readMapFromFile( - "hub", - "syncQueriesReadyEvent.json", - HashMap::class.java - ) as HashMap - ) + readMapFromFile( + "hub", + "syncQueriesReadyEvent.json", + HashMap::class.java + ) as HashMap + ) val event: HubEvent<*> = HubEvent.create(DataStoreChannelEventName.SYNC_QUERIES_READY) @@ -267,12 +267,12 @@ class AmplifyDataStoreHubTest { fun test_hub_networkStatus_event() { flutterPlugin = AmplifyDataStorePlugin(eventHandler = mockStreamHandler, hubEventHandler = mockHubHandler) val eventData: HashMap = ( - readMapFromFile( - "hub", - "networkStatusEvent.json", - HashMap::class.java - ) as HashMap - ) + readMapFromFile( + "hub", + "networkStatusEvent.json", + HashMap::class.java + ) as HashMap + ) val networkStatusEvent: NetworkStatusEvent = NetworkStatusEvent(eventData["active"] as Boolean) @@ -298,12 +298,12 @@ class AmplifyDataStoreHubTest { fun test_hub_outboxStatus_event() { flutterPlugin = AmplifyDataStorePlugin(eventHandler = mockStreamHandler, hubEventHandler = mockHubHandler) val eventData: HashMap = ( - readMapFromFile( - "hub", - "outboxStatusEvent.json", - HashMap::class.java - ) as HashMap - ) + readMapFromFile( + "hub", + "outboxStatusEvent.json", + HashMap::class.java + ) as HashMap + ) val outboxStatusEvent = OutboxStatusEvent(eventData["isEmpty"] as Boolean) @@ -329,12 +329,12 @@ class AmplifyDataStoreHubTest { fun test_hub_syncQueriesStarted_event() { flutterPlugin = AmplifyDataStorePlugin(eventHandler = mockStreamHandler, hubEventHandler = mockHubHandler) val eventData: HashMap = ( - readMapFromFile( - "hub", - "syncQueriesStartedEvent.json", - HashMap::class.java - ) as HashMap - ) + readMapFromFile( + "hub", + "syncQueriesStartedEvent.json", + HashMap::class.java + ) as HashMap + ) val syncQueriesStartedEvent: SyncQueriesStartedEvent = SyncQueriesStartedEvent(arrayOf("Post")) val event: HubEvent<*> = HubEvent.create("syncQueriesStarted", syncQueriesStartedEvent) @@ -361,12 +361,12 @@ class AmplifyDataStoreHubTest { fun test_hub_modelSynced_event() { flutterPlugin = AmplifyDataStorePlugin(eventHandler = mockStreamHandler, hubEventHandler = mockHubHandler) val eventData: HashMap = ( - readMapFromFile( - "hub", - "modelSyncedEvent.json", - HashMap::class.java - ) as HashMap - ) + readMapFromFile( + "hub", + "modelSyncedEvent.json", + HashMap::class.java + ) as HashMap + ) val modelSyncedEvent: ModelSyncedEvent = ModelSyncedEvent( eventData["model"] as String, @@ -404,12 +404,12 @@ class AmplifyDataStoreHubTest { fun test_replay_events() { flutterPlugin = AmplifyDataStorePlugin(eventHandler = mockStreamHandler, hubEventHandler = mockHubHandler) val eventData: HashMap = ( - readMapFromFile( - "hub", - "readyEvent.json", - HashMap::class.java - ) as HashMap - ) + readMapFromFile( + "hub", + "readyEvent.json", + HashMap::class.java + ) as HashMap + ) val event: HubEvent<*> = HubEvent.create(DataStoreChannelEventName.READY) diff --git a/packages/amplify_datastore/android/src/test/kotlin/com/amazonaws/amplify/amplify_datastore/AmplifyDataStorePluginTest.kt b/packages/amplify_datastore/android/src/test/kotlin/com/amazonaws/amplify/amplify_datastore/AmplifyDataStorePluginTest.kt index 0b66d0d180..0b21600ad0 100644 --- a/packages/amplify_datastore/android/src/test/kotlin/com/amazonaws/amplify/amplify_datastore/AmplifyDataStorePluginTest.kt +++ b/packages/amplify_datastore/android/src/test/kotlin/com/amazonaws/amplify/amplify_datastore/AmplifyDataStorePluginTest.kt @@ -35,7 +35,6 @@ import org.mockito.ArgumentMatchers.any import org.mockito.ArgumentMatchers.anyString import org.mockito.ArgumentMatchers.eq import org.mockito.Mockito.RETURNS_SELF -import org.mockito.Mockito.`when` import org.mockito.Mockito.doAnswer import org.mockito.Mockito.mock import org.mockito.Mockito.mockStatic @@ -43,6 +42,7 @@ import org.mockito.Mockito.never import org.mockito.Mockito.times import org.mockito.Mockito.verify import org.mockito.Mockito.verifyNoInteractions +import org.mockito.Mockito.`when` import org.mockito.invocation.InvocationOnMock import org.robolectric.RobolectricTestRunner import java.lang.reflect.Field @@ -268,7 +268,8 @@ class AmplifyDataStorePluginTest { ) null }.`when`(mockAmplifyDataStorePlugin).query( - anyString(), any(QueryOptions::class.java), + anyString(), + any(QueryOptions::class.java), any>>(), any>() ) @@ -293,10 +294,10 @@ class AmplifyDataStorePluginTest { fun test_query_with_predicates_success_zero_result() { val queryOptions = Where.matches( - field("Post","id").eq("123").or( - field("Post","rating").ge(4).and( + field("Post", "id").eq("123").or( + field("Post", "rating").ge(4).and( not( - field("Post","created").eq("2020-02-20T20:20:20-08:00") + field("Post", "created").eq("2020-02-20T20:20:20-08:00") ) ) ) @@ -331,12 +332,12 @@ class AmplifyDataStorePluginTest { @Test fun test_query_api_error() { val testRequest: HashMap = ( - readMapFromFile( - "query_api", - "request/only_model_name.json", - HashMap::class.java - ) as HashMap - ) + readMapFromFile( + "query_api", + "request/only_model_name.json", + HashMap::class.java + ) as HashMap + ) doAnswer { invocation: InvocationOnMock -> assertEquals("Post", invocation.arguments[0]) @@ -385,12 +386,12 @@ class AmplifyDataStorePluginTest { @Test fun test_delete_success_result_no_predicates() { val testRequest: HashMap = ( - readMapFromFile( - "delete_api", - "request/instance_no_predicate.json", - HashMap::class.java - ) as HashMap - ) + readMapFromFile( + "delete_api", + "request/instance_no_predicate.json", + HashMap::class.java + ) as HashMap + ) val serializedModelData: HashMap = testRequest["serializedModel"] as HashMap @@ -427,14 +428,13 @@ class AmplifyDataStorePluginTest { @Test fun test_delete_api_error() { - val testRequest: HashMap = ( - readMapFromFile( - "delete_api", - "request/instance_no_predicate.json", - HashMap::class.java - ) as HashMap - ) + readMapFromFile( + "delete_api", + "request/instance_no_predicate.json", + HashMap::class.java + ) as HashMap + ) val serializedModelData: HashMap = testRequest["serializedModel"] as HashMap @@ -490,12 +490,12 @@ class AmplifyDataStorePluginTest { @Test fun test_save_success_result_no_predicates() { val testRequest: HashMap = ( - readMapFromFile( - "save_api", - "request/instance_without_predicate.json", - HashMap::class.java - ) as HashMap - ) + readMapFromFile( + "save_api", + "request/instance_without_predicate.json", + HashMap::class.java + ) as HashMap + ) val serializedModelData: HashMap = testRequest["serializedModel"] as HashMap @@ -533,14 +533,13 @@ class AmplifyDataStorePluginTest { @Test fun test_save_api_error() { - val testRequest: HashMap = ( - readMapFromFile( - "save_api", - "request/instance_without_predicate.json", - HashMap::class.java - ) as HashMap - ) + readMapFromFile( + "save_api", + "request/instance_without_predicate.json", + HashMap::class.java + ) as HashMap + ) val serializedModelData: HashMap = testRequest["serializedModel"] as HashMap @@ -649,12 +648,12 @@ class AmplifyDataStorePluginTest { hubEventHandler = mockHubHandler ) val eventData: HashMap = ( - readMapFromFile( - "observe_api", - "post_type_success_event.json", - HashMap::class.java - ) as HashMap - ) + readMapFromFile( + "observe_api", + "post_type_success_event.json", + HashMap::class.java + ) as HashMap + ) val modelData = mapOf( "id" to "43036c6b-8044-4309-bddc-262b6c686026", "title" to "Title 2", diff --git a/packages/amplify_datastore/android/src/test/kotlin/com/amazonaws/amplify/amplify_datastore/AmplifyModelSchemaTest.kt b/packages/amplify_datastore/android/src/test/kotlin/com/amazonaws/amplify/amplify_datastore/AmplifyModelSchemaTest.kt index 79a68fb6ee..0c300fdad4 100644 --- a/packages/amplify_datastore/android/src/test/kotlin/com/amazonaws/amplify/amplify_datastore/AmplifyModelSchemaTest.kt +++ b/packages/amplify_datastore/android/src/test/kotlin/com/amazonaws/amplify/amplify_datastore/AmplifyModelSchemaTest.kt @@ -15,12 +15,12 @@ import org.robolectric.RobolectricTestRunner class AmplifyModelSchemaTest { private var schemasMap: Map = ( - readMapFromFile( - "model_schema", - "model_schema_maps.json", - HashMap::class.java - ) as HashMap - ) + readMapFromFile( + "model_schema", + "model_schema_maps.json", + HashMap::class.java + ) as HashMap + ) @Test fun test_schema_blog_with_hasMany() { diff --git a/packages/amplify_datastore/android/src/test/kotlin/com/amazonaws/amplify/amplify_datastore/AmplifySerializedModelTest.kt b/packages/amplify_datastore/android/src/test/kotlin/com/amazonaws/amplify/amplify_datastore/AmplifySerializedModelTest.kt index c51d45f1cd..9d8b0df92e 100644 --- a/packages/amplify_datastore/android/src/test/kotlin/com/amazonaws/amplify/amplify_datastore/AmplifySerializedModelTest.kt +++ b/packages/amplify_datastore/android/src/test/kotlin/com/amazonaws/amplify/amplify_datastore/AmplifySerializedModelTest.kt @@ -13,12 +13,12 @@ import org.robolectric.RobolectricTestRunner class AmplifySerializedModelTest { private var serializedModelMaps: Map = ( - readMapFromFile( - "model_schema", - "serialized_model_maps.json", - HashMap::class.java - ) as HashMap - ) + readMapFromFile( + "model_schema", + "serialized_model_maps.json", + HashMap::class.java + ) as HashMap + ) @Test fun test_schema_blog_with_hasMany() { diff --git a/packages/amplify_datastore/android/src/test/kotlin/com/amazonaws/amplify/amplify_datastore/CoroutineTestRule.kt b/packages/amplify_datastore/android/src/test/kotlin/com/amazonaws/amplify/amplify_datastore/CoroutineTestRule.kt index 51debde6b2..7111a86339 100644 --- a/packages/amplify_datastore/android/src/test/kotlin/com/amazonaws/amplify/amplify_datastore/CoroutineTestRule.kt +++ b/packages/amplify_datastore/android/src/test/kotlin/com/amazonaws/amplify/amplify_datastore/CoroutineTestRule.kt @@ -25,4 +25,4 @@ class CoroutineTestRule(val testDispatcher: TestCoroutineDispatcher = TestCorout Dispatchers.resetMain() testDispatcher.cleanupTestCoroutines() } -} \ No newline at end of file +} diff --git a/packages/amplify_datastore/android/src/test/kotlin/com/amazonaws/amplify/amplify_datastore/SchemaData.kt b/packages/amplify_datastore/android/src/test/kotlin/com/amazonaws/amplify/amplify_datastore/SchemaData.kt index e1aee56abf..6e1a2851b3 100644 --- a/packages/amplify_datastore/android/src/test/kotlin/com/amazonaws/amplify/amplify_datastore/SchemaData.kt +++ b/packages/amplify_datastore/android/src/test/kotlin/com/amazonaws/amplify/amplify_datastore/SchemaData.kt @@ -18,111 +18,113 @@ import com.amplifyframework.core.model.temporal.Temporal val postSchema = ModelSchema.builder() .name("Post") .pluralName("Posts") - .indexes(mapOf( - "byBlog" to ModelIndex.builder() - .indexName("byBlog") - .indexFieldNames(listOf("blogID")) - .build() - )) + .indexes( + mapOf( + "byBlog" to ModelIndex.builder() + .indexName("byBlog") + .indexFieldNames(listOf("blogID")) + .build() + ) + ) .fields( mapOf( "id" to - ModelField.builder() - .name("id") - .javaClassForValue(String::class.java) - .targetType("String") - .isRequired(true) - .isArray(false) - .build(), + ModelField.builder() + .name("id") + .javaClassForValue(String::class.java) + .targetType("String") + .isRequired(true) + .isArray(false) + .build(), "title" to - ModelField.builder() - .name("title") - .javaClassForValue(String::class.java) - .targetType("String") - .isRequired(true) - .isArray(false) - .build(), + ModelField.builder() + .name("title") + .javaClassForValue(String::class.java) + .targetType("String") + .isRequired(true) + .isArray(false) + .build(), "created" to - ModelField.builder() - .name("created") - .javaClassForValue(Temporal.DateTime::class.java) - .targetType("AWSDateTime") - .isRequired(false) - .isArray(false) - .build(), + ModelField.builder() + .name("created") + .javaClassForValue(Temporal.DateTime::class.java) + .targetType("AWSDateTime") + .isRequired(false) + .isArray(false) + .build(), "rating" to - ModelField.builder() - .name("rating") - .javaClassForValue(Integer::class.java) - .targetType("Integer") - .isRequired(false) - .isArray(false) - .build(), + ModelField.builder() + .name("rating") + .javaClassForValue(Integer::class.java) + .targetType("Integer") + .isRequired(false) + .isArray(false) + .build(), "blog" to - ModelField.builder() - .name("blog") - .javaClassForValue(Model::class.java) - .targetType("Blog") - .isRequired(false) - .isArray(false) - .isModel(true) - .build(), + ModelField.builder() + .name("blog") + .javaClassForValue(Model::class.java) + .targetType("Blog") + .isRequired(false) + .isArray(false) + .isModel(true) + .build(), "comments" to - ModelField.builder() - .name("comments") - .javaClassForValue(List::class.java) - .targetType("Comment") - .isRequired(false) - .isArray(true) - .build(), + ModelField.builder() + .name("comments") + .javaClassForValue(List::class.java) + .targetType("Comment") + .isRequired(false) + .isArray(true) + .build(), "likeCount" to - ModelField.builder() - .name("likeCount") - .javaClassForValue(Integer::class.java) - .targetType("Integer") - .isRequired(false) - .isArray(false) - .build(), + ModelField.builder() + .name("likeCount") + .javaClassForValue(Integer::class.java) + .targetType("Integer") + .isRequired(false) + .isArray(false) + .build(), "createdAt" to - ModelField.builder() - .name("createdAt") - .javaClassForValue(Temporal.DateTime::class.java) - .targetType("AWSDateTime") - .isRequired(false) - .isArray(false) - .isReadOnly(true) - .build(), + ModelField.builder() + .name("createdAt") + .javaClassForValue(Temporal.DateTime::class.java) + .targetType("AWSDateTime") + .isRequired(false) + .isArray(false) + .isReadOnly(true) + .build(), "updatedAt" to - ModelField.builder() - .name("updatedAt") - .javaClassForValue(Temporal.DateTime::class.java) - .targetType("AWSDateTime") - .isRequired(false) - .isArray(false) - .isReadOnly(true) - .build() + ModelField.builder() + .name("updatedAt") + .javaClassForValue(Temporal.DateTime::class.java) + .targetType("AWSDateTime") + .isRequired(false) + .isArray(false) + .isReadOnly(true) + .build() ) ) .associations( mapOf( "blog" to - ModelAssociation.builder() - .name("BelongsTo") - .targetNames(listOf("blogID").toTypedArray()) - .build(), + ModelAssociation.builder() + .name("BelongsTo") + .targetNames(listOf("blogID").toTypedArray()) + .build(), "comments" to - ModelAssociation.builder() - .name("HasMany") - .associatedName("post") - .associatedType("Post") - .build() + ModelAssociation.builder() + .name("HasMany") + .associatedName("post") + .associatedType("Post") + .build() ) ) @@ -136,49 +138,49 @@ val postAuthComplexSchema = ModelSchema.builder() .fields( mapOf( "id" to - ModelField.builder() - .name("id") - .javaClassForValue(String::class.java) - .targetType("String") - .isRequired(true) - .isArray(false) - .build(), + ModelField.builder() + .name("id") + .javaClassForValue(String::class.java) + .targetType("String") + .isRequired(true) + .isArray(false) + .build(), "title" to - ModelField.builder() - .name("title") - .javaClassForValue(String::class.java) - .targetType("String") - .isRequired(true) - .isArray(false) - .build(), + ModelField.builder() + .name("title") + .javaClassForValue(String::class.java) + .targetType("String") + .isRequired(true) + .isArray(false) + .build(), "owner" to - ModelField.builder() - .name("owner") - .javaClassForValue(String::class.java) - .targetType("String") - .isRequired(false) - .isArray(false) - .build(), + ModelField.builder() + .name("owner") + .javaClassForValue(String::class.java) + .targetType("String") + .isRequired(false) + .isArray(false) + .build(), "createdAt" to - ModelField.builder() - .name("createdAt") - .javaClassForValue(Temporal.DateTime::class.java) - .targetType("AWSDateTime") - .isRequired(false) - .isArray(false) - .isReadOnly(true) - .build(), + ModelField.builder() + .name("createdAt") + .javaClassForValue(Temporal.DateTime::class.java) + .targetType("AWSDateTime") + .isRequired(false) + .isArray(false) + .isReadOnly(true) + .build(), "updatedAt" to - ModelField.builder() - .name("updatedAt") - .javaClassForValue(Temporal.DateTime::class.java) - .targetType("AWSDateTime") - .isRequired(false) - .isArray(false) - .isReadOnly(true) - .build() + ModelField.builder() + .name("updatedAt") + .javaClassForValue(Temporal.DateTime::class.java) + .targetType("AWSDateTime") + .isRequired(false) + .isArray(false) + .isReadOnly(true) + .build() ) ) .authRules( @@ -210,40 +212,40 @@ val postAuthComplexWithProviderUserPoolsSchema = ModelSchema.builder() .fields( mapOf( "id" to - ModelField.builder() - .name("id") - .javaClassForValue(String::class.java) - .targetType("String") - .isRequired(true) - .isArray(false) - .build(), + ModelField.builder() + .name("id") + .javaClassForValue(String::class.java) + .targetType("String") + .isRequired(true) + .isArray(false) + .build(), "owner" to - ModelField.builder() - .name("owner") - .javaClassForValue(String::class.java) - .targetType("String") - .isRequired(false) - .isArray(false) - .build(), + ModelField.builder() + .name("owner") + .javaClassForValue(String::class.java) + .targetType("String") + .isRequired(false) + .isArray(false) + .build(), "createdAt" to - ModelField.builder() - .name("createdAt") - .javaClassForValue(Temporal.DateTime::class.java) - .targetType("AWSDateTime") - .isRequired(false) - .isArray(false) - .isReadOnly(true) - .build(), + ModelField.builder() + .name("createdAt") + .javaClassForValue(Temporal.DateTime::class.java) + .targetType("AWSDateTime") + .isRequired(false) + .isArray(false) + .isReadOnly(true) + .build(), "updatedAt" to - ModelField.builder() - .name("updatedAt") - .javaClassForValue(Temporal.DateTime::class.java) - .targetType("AWSDateTime") - .isRequired(false) - .isArray(false) - .isReadOnly(true) - .build() + ModelField.builder() + .name("updatedAt") + .javaClassForValue(Temporal.DateTime::class.java) + .targetType("AWSDateTime") + .isRequired(false) + .isArray(false) + .isReadOnly(true) + .build() ) ) .authRules( @@ -266,32 +268,32 @@ val postAuthComplexWithProviderApiKeySchema = ModelSchema.builder() .fields( mapOf( "id" to - ModelField.builder() - .name("id") - .javaClassForValue(String::class.java) - .targetType("String") - .isRequired(true) - .isArray(false) - .build(), + ModelField.builder() + .name("id") + .javaClassForValue(String::class.java) + .targetType("String") + .isRequired(true) + .isArray(false) + .build(), "createdAt" to - ModelField.builder() - .name("createdAt") - .javaClassForValue(Temporal.DateTime::class.java) - .targetType("AWSDateTime") - .isRequired(false) - .isArray(false) - .isReadOnly(true) - .build(), + ModelField.builder() + .name("createdAt") + .javaClassForValue(Temporal.DateTime::class.java) + .targetType("AWSDateTime") + .isRequired(false) + .isArray(false) + .isReadOnly(true) + .build(), "updatedAt" to - ModelField.builder() - .name("updatedAt") - .javaClassForValue(Temporal.DateTime::class.java) - .targetType("AWSDateTime") - .isRequired(false) - .isArray(false) - .isReadOnly(true) - .build() + ModelField.builder() + .name("updatedAt") + .javaClassForValue(Temporal.DateTime::class.java) + .targetType("AWSDateTime") + .isRequired(false) + .isArray(false) + .isReadOnly(true) + .build() ) ) .authRules( @@ -312,58 +314,58 @@ val commentSchema = ModelSchema.builder() .fields( mapOf( "id" to - ModelField.builder() - .name("id") - .javaClassForValue(String::class.java) - .targetType("String") - .isRequired(true) - .isArray(false) - .build(), + ModelField.builder() + .name("id") + .javaClassForValue(String::class.java) + .targetType("String") + .isRequired(true) + .isArray(false) + .build(), "post" to - ModelField.builder() - .name("post") - .javaClassForValue(Model::class.java) - .targetType("Post") - .isRequired(false) - .isArray(false) - .isModel(true) - .build(), + ModelField.builder() + .name("post") + .javaClassForValue(Model::class.java) + .targetType("Post") + .isRequired(false) + .isArray(false) + .isModel(true) + .build(), "content" to - ModelField.builder() - .name("content") - .javaClassForValue(String::class.java) - .targetType("String") - .isRequired(true) - .isArray(false) - .build(), + ModelField.builder() + .name("content") + .javaClassForValue(String::class.java) + .targetType("String") + .isRequired(true) + .isArray(false) + .build(), "createdAt" to - ModelField.builder() - .name("createdAt") - .javaClassForValue(Temporal.DateTime::class.java) - .targetType("AWSDateTime") - .isRequired(false) - .isArray(false) - .isReadOnly(true) - .build(), + ModelField.builder() + .name("createdAt") + .javaClassForValue(Temporal.DateTime::class.java) + .targetType("AWSDateTime") + .isRequired(false) + .isArray(false) + .isReadOnly(true) + .build(), "updatedAt" to - ModelField.builder() - .name("updatedAt") - .javaClassForValue(Temporal.DateTime::class.java) - .targetType("AWSDateTime") - .isRequired(false) - .isArray(false) - .isReadOnly(true) - .build() + ModelField.builder() + .name("updatedAt") + .javaClassForValue(Temporal.DateTime::class.java) + .targetType("AWSDateTime") + .isRequired(false) + .isArray(false) + .isReadOnly(true) + .build() ) ) .associations( mapOf( "post" to - ModelAssociation.builder() - .name("BelongsTo") - .targetNames(listOf("postID").toTypedArray()) - .build() + ModelAssociation.builder() + .name("BelongsTo") + .targetNames(listOf("postID").toTypedArray()) + .build() ) ) .modelClass(SerializedModel::class.java) @@ -376,58 +378,58 @@ val blogSchema = ModelSchema.builder() .fields( mapOf( "id" to - ModelField.builder() - .name("id") - .javaClassForValue(String::class.java) - .targetType("String") - .isRequired(true) - .isArray(false) - .build(), + ModelField.builder() + .name("id") + .javaClassForValue(String::class.java) + .targetType("String") + .isRequired(true) + .isArray(false) + .build(), "name" to - ModelField.builder() - .name("name") - .javaClassForValue(String::class.java) - .targetType("String") - .isRequired(true) - .isArray(false) - .build(), + ModelField.builder() + .name("name") + .javaClassForValue(String::class.java) + .targetType("String") + .isRequired(true) + .isArray(false) + .build(), "posts" to - ModelField.builder() - .name("posts") - .javaClassForValue(List::class.java) - .targetType("Post") - .isRequired(false) - .isArray(true) - .build(), + ModelField.builder() + .name("posts") + .javaClassForValue(List::class.java) + .targetType("Post") + .isRequired(false) + .isArray(true) + .build(), "createdAt" to - ModelField.builder() - .name("createdAt") - .javaClassForValue(Temporal.DateTime::class.java) - .targetType("AWSDateTime") - .isRequired(false) - .isArray(false) - .isReadOnly(true) - .build(), + ModelField.builder() + .name("createdAt") + .javaClassForValue(Temporal.DateTime::class.java) + .targetType("AWSDateTime") + .isRequired(false) + .isArray(false) + .isReadOnly(true) + .build(), "updatedAt" to - ModelField.builder() - .name("updatedAt") - .javaClassForValue(Temporal.DateTime::class.java) - .targetType("AWSDateTime") - .isRequired(false) - .isArray(false) - .isReadOnly(true) - .build() + ModelField.builder() + .name("updatedAt") + .javaClassForValue(Temporal.DateTime::class.java) + .targetType("AWSDateTime") + .isRequired(false) + .isArray(false) + .isReadOnly(true) + .build() ) ) .associations( mapOf( "posts" to - ModelAssociation.builder() - .name("HasMany") - .associatedName("blog") - .associatedType("Blog") - .build() + ModelAssociation.builder() + .name("HasMany") + .associatedName("blog") + .associatedType("Blog") + .build() ) ) .modelClass(SerializedModel::class.java) @@ -440,104 +442,104 @@ val allTypeModelSchema = ModelSchema.builder() .fields( mapOf( "id" to - ModelField.builder() - .name("id") - .javaClassForValue(String::class.java) - .targetType("String") - .isRequired(true) - .isArray(false) - .build(), + ModelField.builder() + .name("id") + .javaClassForValue(String::class.java) + .targetType("String") + .isRequired(true) + .isArray(false) + .build(), "stringType" to - ModelField.builder() - .name("stringType") - .javaClassForValue(String::class.java) - .targetType("String") - .isRequired(true) - .isArray(false) - .build(), + ModelField.builder() + .name("stringType") + .javaClassForValue(String::class.java) + .targetType("String") + .isRequired(true) + .isArray(false) + .build(), "intType" to - ModelField.builder() - .name("intType") - .javaClassForValue(Integer::class.java) - .targetType("Integer") - .isRequired(true) - .isArray(false) - .build(), + ModelField.builder() + .name("intType") + .javaClassForValue(Integer::class.java) + .targetType("Integer") + .isRequired(true) + .isArray(false) + .build(), "floatType" to - ModelField.builder() - .name("floatType") - .javaClassForValue(Double::class.javaObjectType) - .targetType("Double") - .isRequired(true) - .isArray(false) - .build(), + ModelField.builder() + .name("floatType") + .javaClassForValue(Double::class.javaObjectType) + .targetType("Double") + .isRequired(true) + .isArray(false) + .build(), "boolType" to - ModelField.builder() - .name("boolType") - .javaClassForValue(Boolean::class.javaObjectType) - .targetType("Boolean") - .isRequired(true) - .isArray(false) - .build(), + ModelField.builder() + .name("boolType") + .javaClassForValue(Boolean::class.javaObjectType) + .targetType("Boolean") + .isRequired(true) + .isArray(false) + .build(), "dateType" to - ModelField.builder() - .name("dateType") - .javaClassForValue(Temporal.Date::class.java) - .targetType("AWSDate") - .isRequired(true) - .isArray(false) - .build(), + ModelField.builder() + .name("dateType") + .javaClassForValue(Temporal.Date::class.java) + .targetType("AWSDate") + .isRequired(true) + .isArray(false) + .build(), "dateTimeType" to - ModelField.builder() - .name("dateTimeType") - .javaClassForValue(Temporal.DateTime::class.java) - .targetType("AWSDateTime") - .isRequired(true) - .isArray(false) - .build(), + ModelField.builder() + .name("dateTimeType") + .javaClassForValue(Temporal.DateTime::class.java) + .targetType("AWSDateTime") + .isRequired(true) + .isArray(false) + .build(), "timeType" to - ModelField.builder() - .name("timeType") - .javaClassForValue(Temporal.Time::class.java) - .targetType("AWSTime") - .isRequired(true) - .isArray(false) - .build(), + ModelField.builder() + .name("timeType") + .javaClassForValue(Temporal.Time::class.java) + .targetType("AWSTime") + .isRequired(true) + .isArray(false) + .build(), "timestampType" to - ModelField.builder() - .name("timestampType") - .javaClassForValue(Temporal.Timestamp::class.java) - .targetType("AWSTimestamp") - .isRequired(true) - .isArray(false) - .build(), + ModelField.builder() + .name("timestampType") + .javaClassForValue(Temporal.Timestamp::class.java) + .targetType("AWSTimestamp") + .isRequired(true) + .isArray(false) + .build(), "enumType" to - ModelField.builder() - .name("enumType") - .javaClassForValue(String::class.java) - .targetType("String") - .isRequired(true) - .isArray(false) - .build(), + ModelField.builder() + .name("enumType") + .javaClassForValue(String::class.java) + .targetType("String") + .isRequired(true) + .isArray(false) + .build(), "createdAt" to - ModelField.builder() - .name("createdAt") - .javaClassForValue(Temporal.DateTime::class.java) - .targetType("AWSDateTime") - .isRequired(false) - .isArray(false) - .isReadOnly(true) - .build(), + ModelField.builder() + .name("createdAt") + .javaClassForValue(Temporal.DateTime::class.java) + .targetType("AWSDateTime") + .isRequired(false) + .isArray(false) + .isReadOnly(true) + .build(), "updatedAt" to - ModelField.builder() - .name("updatedAt") - .javaClassForValue(Temporal.DateTime::class.java) - .targetType("AWSDateTime") - .isRequired(false) - .isArray(false) - .isReadOnly(true) - .build() + ModelField.builder() + .name("updatedAt") + .javaClassForValue(Temporal.DateTime::class.java) + .targetType("AWSDateTime") + .isRequired(false) + .isArray(false) + .isReadOnly(true) + .build() ) ) .modelClass(SerializedModel::class.java) @@ -691,157 +693,163 @@ val inventorySchema = ModelSchema.builder() .name("Inventory") .pluralName("Inventories") .modelClass(SerializedModel::class.java) - .indexes(mapOf( - "undefined" to ModelIndex.builder() - .indexName("undefined") - .indexFieldNames(listOf("productID", "name", "warehouseID", "region")) - .build() - )) - .fields(mapOf( - "productID" to ModelField.builder() - .name("productID") - .targetType("String") - .javaClassForValue(String::class.java) - .isRequired(true) - .isReadOnly(false) - .isArray(false) - .build(), - "name" to ModelField.builder() - .name("name") - .targetType("String") - .javaClassForValue(String::class.java) - .isRequired(true) - .isReadOnly(false) - .isArray(false) - .build(), - "warehouseID" to ModelField.builder() - .name("warehouseID") - .targetType("String") - .javaClassForValue(String::class.java) - .isRequired(true) - .isReadOnly(false) - .isArray(false) - .build(), - "region" to ModelField.builder() - .name("region") - .targetType("String") - .javaClassForValue(String::class.java) - .isRequired(true) - .isReadOnly(false) - .isArray(false) - .build() - )) + .indexes( + mapOf( + "undefined" to ModelIndex.builder() + .indexName("undefined") + .indexFieldNames(listOf("productID", "name", "warehouseID", "region")) + .build() + ) + ) + .fields( + mapOf( + "productID" to ModelField.builder() + .name("productID") + .targetType("String") + .javaClassForValue(String::class.java) + .isRequired(true) + .isReadOnly(false) + .isArray(false) + .build(), + "name" to ModelField.builder() + .name("name") + .targetType("String") + .javaClassForValue(String::class.java) + .isRequired(true) + .isReadOnly(false) + .isArray(false) + .build(), + "warehouseID" to ModelField.builder() + .name("warehouseID") + .targetType("String") + .javaClassForValue(String::class.java) + .isRequired(true) + .isReadOnly(false) + .isArray(false) + .build(), + "region" to ModelField.builder() + .name("region") + .targetType("String") + .javaClassForValue(String::class.java) + .isRequired(true) + .isReadOnly(false) + .isArray(false) + .build() + ) + ) .version(1) .build() val cpkPostSchema = ModelSchema.builder() .name("Post") .pluralName("Posts") - .indexes(mapOf( - "byBlog" to ModelIndex.builder() - .indexName("byBlog") - .indexFieldNames(listOf("blogID")) - .build() - )) + .indexes( + mapOf( + "byBlog" to ModelIndex.builder() + .indexName("byBlog") + .indexFieldNames(listOf("blogID")) + .build() + ) + ) .fields( mapOf( "id" to - ModelField.builder() - .name("id") - .javaClassForValue(String::class.java) - .targetType("String") - .isRequired(true) - .isArray(false) - .build(), + ModelField.builder() + .name("id") + .javaClassForValue(String::class.java) + .targetType("String") + .isRequired(true) + .isArray(false) + .build(), "title" to - ModelField.builder() - .name("title") - .javaClassForValue(String::class.java) - .targetType("String") - .isRequired(true) - .isArray(false) - .build(), + ModelField.builder() + .name("title") + .javaClassForValue(String::class.java) + .targetType("String") + .isRequired(true) + .isArray(false) + .build(), "created" to - ModelField.builder() - .name("created") - .javaClassForValue(Temporal.DateTime::class.java) - .targetType("AWSDateTime") - .isRequired(false) - .isArray(false) - .build(), + ModelField.builder() + .name("created") + .javaClassForValue(Temporal.DateTime::class.java) + .targetType("AWSDateTime") + .isRequired(false) + .isArray(false) + .build(), "rating" to - ModelField.builder() - .name("rating") - .javaClassForValue(Integer::class.java) - .targetType("Integer") - .isRequired(false) - .isArray(false) - .build(), + ModelField.builder() + .name("rating") + .javaClassForValue(Integer::class.java) + .targetType("Integer") + .isRequired(false) + .isArray(false) + .build(), "blog" to - ModelField.builder() - .name("blog") - .javaClassForValue(Model::class.java) - .targetType("Blog") - .isRequired(false) - .isArray(false) - .isModel(true) - .build(), + ModelField.builder() + .name("blog") + .javaClassForValue(Model::class.java) + .targetType("Blog") + .isRequired(false) + .isArray(false) + .isModel(true) + .build(), "comments" to - ModelField.builder() - .name("comments") - .javaClassForValue(List::class.java) - .targetType("Comment") - .isRequired(false) - .isArray(true) - .build(), + ModelField.builder() + .name("comments") + .javaClassForValue(List::class.java) + .targetType("Comment") + .isRequired(false) + .isArray(true) + .build(), "likeCount" to - ModelField.builder() - .name("likeCount") - .javaClassForValue(Integer::class.java) - .targetType("Integer") - .isRequired(false) - .isArray(false) - .build(), + ModelField.builder() + .name("likeCount") + .javaClassForValue(Integer::class.java) + .targetType("Integer") + .isRequired(false) + .isArray(false) + .build(), "createdAt" to - ModelField.builder() - .name("createdAt") - .javaClassForValue(Temporal.DateTime::class.java) - .targetType("AWSDateTime") - .isRequired(false) - .isArray(false) - .isReadOnly(true) - .build(), + ModelField.builder() + .name("createdAt") + .javaClassForValue(Temporal.DateTime::class.java) + .targetType("AWSDateTime") + .isRequired(false) + .isArray(false) + .isReadOnly(true) + .build(), "updatedAt" to - ModelField.builder() - .name("updatedAt") - .javaClassForValue(Temporal.DateTime::class.java) - .targetType("AWSDateTime") - .isRequired(false) - .isArray(false) - .isReadOnly(true) - .build() + ModelField.builder() + .name("updatedAt") + .javaClassForValue(Temporal.DateTime::class.java) + .targetType("AWSDateTime") + .isRequired(false) + .isArray(false) + .isReadOnly(true) + .build() ) ) .associations( mapOf( "blog" to - ModelAssociation.builder() - .name("BelongsTo") - .targetNames(listOf("blogID", "blogName").toTypedArray()) - .build(), + ModelAssociation.builder() + .name("BelongsTo") + .targetNames(listOf("blogID", "blogName").toTypedArray()) + .build(), "comments" to - ModelAssociation.builder() - .name("HasMany") - .associatedName("post") - .associatedType("Post") - .build() + ModelAssociation.builder() + .name("HasMany") + .associatedName("post") + .associatedType("Post") + .build() ) ) diff --git a/packages/amplify_datastore/android/src/test/kotlin/com/amazonaws/amplify/amplify_datastore/types/query/QueryPaginationBuilderTest.kt b/packages/amplify_datastore/android/src/test/kotlin/com/amazonaws/amplify/amplify_datastore/types/query/QueryPaginationBuilderTest.kt index 329076ce62..53b4538ab6 100644 --- a/packages/amplify_datastore/android/src/test/kotlin/com/amazonaws/amplify/amplify_datastore/types/query/QueryPaginationBuilderTest.kt +++ b/packages/amplify_datastore/android/src/test/kotlin/com/amazonaws/amplify/amplify_datastore/types/query/QueryPaginationBuilderTest.kt @@ -16,7 +16,8 @@ class QueryPaginationBuilderTest { Where.paginated(Page.startingAt(3).withLimit(200)).paginationInput, QueryPaginationBuilder.fromSerializedMap( readMapFromFile( - "query_pagination", "custom_page_and_limit.json", + "query_pagination", + "custom_page_and_limit.json", HashMap::class.java ) as HashMap ) @@ -29,7 +30,8 @@ class QueryPaginationBuilderTest { Where.paginated(Page.firstPage()).paginationInput, QueryPaginationBuilder.fromSerializedMap( readMapFromFile( - "query_pagination", "first_page.json", + "query_pagination", + "first_page.json", HashMap::class.java ) as HashMap ) @@ -42,7 +44,8 @@ class QueryPaginationBuilderTest { Where.paginated(Page.firstResult()).paginationInput, QueryPaginationBuilder.fromSerializedMap( readMapFromFile( - "query_pagination", "first_result.json", + "query_pagination", + "first_result.json", HashMap::class.java ) as HashMap ) diff --git a/packages/amplify_datastore/android/src/test/kotlin/com/amazonaws/amplify/amplify_datastore/types/query/QueryPredicateBuilderTest.kt b/packages/amplify_datastore/android/src/test/kotlin/com/amazonaws/amplify/amplify_datastore/types/query/QueryPredicateBuilderTest.kt index 81a655917b..d59e9002aa 100644 --- a/packages/amplify_datastore/android/src/test/kotlin/com/amazonaws/amplify/amplify_datastore/types/query/QueryPredicateBuilderTest.kt +++ b/packages/amplify_datastore/android/src/test/kotlin/com/amazonaws/amplify/amplify_datastore/types/query/QueryPredicateBuilderTest.kt @@ -3,10 +3,10 @@ package com.amazonaws.amplify.amplify_datastore.types.query -import com.amazonaws.amplify.amplify_datastore.util.cast import com.amazonaws.amplify.amplify_datastore.cpkPostSchema import com.amazonaws.amplify.amplify_datastore.postSchema import com.amazonaws.amplify.amplify_datastore.readMapFromFile +import com.amazonaws.amplify.amplify_datastore.util.cast import com.amplifyframework.core.model.ModelIdentifier import com.amplifyframework.core.model.query.predicate.QueryField import com.amplifyframework.core.model.query.predicate.QueryPredicateGroup @@ -25,7 +25,7 @@ class QueryPredicateBuilderTest { private val inventoryName = QueryField.field("name") private val inventoryWarehouseID = QueryField.field("warehouseID") private val inventoryRegion = QueryField.field("region") - private val cpkBlogForeignKeyField = QueryField.field("Post","@@blogForeignKey") + private val cpkBlogForeignKeyField = QueryField.field("Post", "@@blogForeignKey") @Test fun test_when_id_not_equals() { @@ -33,7 +33,8 @@ class QueryPredicateBuilderTest { id.ne("123"), QueryPredicateBuilder.fromSerializedMap( readMapFromFile( - "query_predicate", "id_not_equals.json", + "query_predicate", + "id_not_equals.json", HashMap::class.java ).cast() ) @@ -167,7 +168,8 @@ class QueryPredicateBuilderTest { .and(inventoryRegion.eq("some region")), QueryPredicateBuilder.fromSerializedMap( readMapFromFile( - "query_predicate", "model_identifier_equals.json", + "query_predicate", + "model_identifier_equals.json", HashMap::class.java ).cast() ) @@ -183,7 +185,8 @@ class QueryPredicateBuilderTest { .and(inventoryRegion.ne("some region")), QueryPredicateBuilder.fromSerializedMap( readMapFromFile( - "query_predicate", "model_identifier_not_equals.json", + "query_predicate", + "model_identifier_not_equals.json", HashMap::class.java ).cast() ) @@ -201,7 +204,8 @@ class QueryPredicateBuilderTest { ), QueryPredicateBuilder.fromSerializedMap( readMapFromFile( - "query_predicate", "model_identifier_group_not_equals.json", + "query_predicate", + "model_identifier_group_not_equals.json", HashMap::class.java ).cast() ) @@ -215,11 +219,12 @@ class QueryPredicateBuilderTest { inventoryProductID.ne("product-id") .and(inventoryName.ne("product-name")) .and(inventoryWarehouseID.ne("warehouse-id")) - .and(inventoryRegion.ne("some region")), + .and(inventoryRegion.ne("some region")) ), QueryPredicateBuilder.fromSerializedMap( readMapFromFile( - "query_predicate", "model_identifier_group_equals.json", + "query_predicate", + "model_identifier_group_equals.json", HashMap::class.java ).cast() ) @@ -229,12 +234,16 @@ class QueryPredicateBuilderTest { @Test fun test_when_query_by_nested_model_identifier() { Assert.assertEquals( - cpkBlogForeignKeyField.eq(ModelIdentifier.Helper.getIdentifier( - "123", listOf("the parent") - )), + cpkBlogForeignKeyField.eq( + ModelIdentifier.Helper.getIdentifier( + "123", + listOf("the parent") + ) + ), QueryPredicateBuilder.fromSerializedMap( readMapFromFile( - "query_predicate", "query_by_nested_model_identifier.json", + "query_predicate", + "query_by_nested_model_identifier.json", HashMap::class.java ).cast(), cpkPostSchema From bf5152887d102d5cdf31d3aa8e7d92292fad5992 Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Mon, 4 Mar 2024 14:06:46 -0800 Subject: [PATCH 49/69] chore: bump robolectric --- packages/amplify_datastore/android/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/amplify_datastore/android/build.gradle b/packages/amplify_datastore/android/build.gradle index f047061de0..f3be83653f 100644 --- a/packages/amplify_datastore/android/build.gradle +++ b/packages/amplify_datastore/android/build.gradle @@ -93,7 +93,7 @@ dependencies { // Tests must be updated if bumped //noinspection GradleDependency - testImplementation 'org.robolectric:robolectric:4.3.1' + testImplementation 'org.robolectric:robolectric:4.11.1' testImplementation 'com.fasterxml.jackson.core:jackson-core:2.12.4' testImplementation 'com.fasterxml.jackson.core:jackson-annotations:2.12.4' testImplementation 'com.fasterxml.jackson.core:jackson-databind:2.12.4' From ba379dbd537a3cf64bc0ec14e584736986f54f89 Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Mon, 4 Mar 2024 14:19:05 -0800 Subject: [PATCH 50/69] chore: upgrade android to 2.14.11 --- packages/amplify_datastore/android/build.gradle | 8 ++++---- .../push/amplify_push_notifications/android/build.gradle | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/amplify_datastore/android/build.gradle b/packages/amplify_datastore/android/build.gradle index f3be83653f..71874cc9c0 100644 --- a/packages/amplify_datastore/android/build.gradle +++ b/packages/amplify_datastore/android/build.gradle @@ -77,10 +77,10 @@ dependencies { // Support for Java 8 features coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.3' - implementation 'com.amplifyframework:aws-auth-cognito:2.14.9' - implementation "com.amplifyframework:aws-api:2.14.9" - implementation "com.amplifyframework:aws-datastore:2.14.9" - implementation "com.amplifyframework:aws-api-appsync:2.14.9" + implementation 'com.amplifyframework:aws-auth-cognito:2.14.11' + implementation "com.amplifyframework:aws-api:2.14.11" + implementation "com.amplifyframework:aws-datastore:2.14.11" + implementation "com.amplifyframework:aws-api-appsync:2.14.11" implementation 'com.google.code.gson:gson:2.10.1' implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.1' diff --git a/packages/notifications/push/amplify_push_notifications/android/build.gradle b/packages/notifications/push/amplify_push_notifications/android/build.gradle index 3dd66e4e56..4d68751969 100644 --- a/packages/notifications/push/amplify_push_notifications/android/build.gradle +++ b/packages/notifications/push/amplify_push_notifications/android/build.gradle @@ -65,7 +65,7 @@ android { dependencies { api "com.google.firebase:firebase-messaging:23.2.0" // Import support library for Amplify push utils - implementation 'com.amplifyframework:aws-push-notifications-pinpoint-common:2.14.9' + implementation 'com.amplifyframework:aws-push-notifications-pinpoint-common:2.14.11' implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.4.1" implementation project(path: ':flutter_plugin_android_lifecycle') implementation 'androidx.test:core-ktx:1.5.0' From f7515a9fc12fe7e09045b35a75b865c1fa2a509f Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Mon, 25 Mar 2024 11:50:02 -0700 Subject: [PATCH 51/69] chore: made changes to uithreadhandler and added injectable datastore plugin in test constructor --- .../amplify_datastore/android/build.gradle | 1 + .../AmplifyDataStorePlugin.kt | 36 ++++++-- .../AmplifyDataStoreHubTest.kt | 2 - .../AmplifyDataStorePluginTest.kt | 83 ++++++++++--------- 4 files changed, 73 insertions(+), 49 deletions(-) diff --git a/packages/amplify_datastore/android/build.gradle b/packages/amplify_datastore/android/build.gradle index 71874cc9c0..3ba06d9e3b 100644 --- a/packages/amplify_datastore/android/build.gradle +++ b/packages/amplify_datastore/android/build.gradle @@ -97,4 +97,5 @@ dependencies { testImplementation 'com.fasterxml.jackson.core:jackson-core:2.12.4' testImplementation 'com.fasterxml.jackson.core:jackson-annotations:2.12.4' testImplementation 'com.fasterxml.jackson.core:jackson-databind:2.12.4' + testImplementation 'androidx.arch.core:core-testing:2.1.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 0e6c7db1c0..9d78cbdb1d 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 @@ -50,6 +50,7 @@ import com.amplifyframework.datastore.DataStoreConfiguration import com.amplifyframework.datastore.DataStoreConflictHandler import com.amplifyframework.datastore.DataStoreErrorHandler import com.amplifyframework.datastore.DataStoreException +import com.amplifyframework.datastore.DataStorePlugin import com.amplifyframework.util.UserAgent import io.flutter.embedding.engine.plugins.FlutterPlugin import io.flutter.plugin.common.EventChannel @@ -86,7 +87,7 @@ class AmplifyDataStorePlugin : private val dataStoreObserveEventStreamHandler: DataStoreObserveEventStreamHandler private val dataStoreHubEventStreamHandler: DataStoreHubEventStreamHandler - private val uiThreadHandler = Handler(Looper.getMainLooper()) + private val uiThreadHandler: Handler private val LOG = Amplify.Logging.forNamespace("amplify:flutter:datastore") private var isSettingUpObserve = AtomicBoolean() private var nativeAuthPlugin: NativeAuthPlugin? = null @@ -113,10 +114,15 @@ class AmplifyDataStorePlugin : } val modelProvider = FlutterModelProvider.instance + val _injectedPlugin: AWSDataStorePlugin? + val dataStorePlugin: AWSDataStorePlugin + get() = _injectedPlugin ?: Amplify.DataStore.getPlugin("awsDataStorePlugin") as AWSDataStorePlugin constructor() { dataStoreObserveEventStreamHandler = DataStoreObserveEventStreamHandler() dataStoreHubEventStreamHandler = DataStoreHubEventStreamHandler() + _injectedPlugin = null + uiThreadHandler = Handler(Looper.getMainLooper()) } @VisibleForTesting @@ -126,6 +132,19 @@ class AmplifyDataStorePlugin : ) { dataStoreObserveEventStreamHandler = eventHandler dataStoreHubEventStreamHandler = hubEventHandler + _injectedPlugin = null + uiThreadHandler = Handler(Looper.getMainLooper()) + } + internal constructor( + dataStorePlugin: AWSDataStorePlugin, + uiThreadHandler: Handler, + eventHandler: DataStoreObserveEventStreamHandler, + hubEventHandler: DataStoreHubEventStreamHandler + ) { + dataStoreObserveEventStreamHandler = eventHandler + dataStoreHubEventStreamHandler = hubEventHandler + this._injectedPlugin = dataStorePlugin + this.uiThreadHandler = uiThreadHandler } override fun onAttachedToEngine( @@ -299,7 +318,7 @@ class AmplifyDataStorePlugin : return } - val plugin = Amplify.DataStore.getPlugin("awsDataStorePlugin") as AWSDataStorePlugin + val plugin = dataStorePlugin plugin.query( modelName, queryOptions, @@ -312,6 +331,7 @@ class AmplifyDataStorePlugin : LOG.debug("Number of items received " + results.size) uiThreadHandler.post { flutterResult.success(results) } +// flutterResult.success(results) } catch (e: Exception) { uiThreadHandler.post { postExceptionToFlutterChannel( @@ -362,7 +382,7 @@ class AmplifyDataStorePlugin : return } - val plugin = Amplify.DataStore.getPlugin("awsDataStorePlugin") as AWSDataStorePlugin + val plugin = dataStorePlugin val instance = SerializedModel.builder() .modelSchema(schema) @@ -420,7 +440,7 @@ class AmplifyDataStorePlugin : return } - val plugin = Amplify.DataStore.getPlugin("awsDataStorePlugin") as AWSDataStorePlugin + val plugin = dataStorePlugin val serializedModel = SerializedModel.builder() .modelSchema(schema) @@ -448,7 +468,7 @@ class AmplifyDataStorePlugin : } fun onClear(flutterResult: Result) { - val plugin = Amplify.DataStore.getPlugin("awsDataStorePlugin") as AWSDataStorePlugin + val plugin = dataStorePlugin plugin.clear( { @@ -474,7 +494,7 @@ class AmplifyDataStorePlugin : return } - val plugin = Amplify.DataStore.getPlugin("awsDataStorePlugin") as AWSDataStorePlugin + val plugin = dataStorePlugin plugin.observe( { cancelable -> LOG.info("Established a new stream form flutter $cancelable") @@ -511,7 +531,7 @@ class AmplifyDataStorePlugin : @VisibleForTesting fun onStart(flutterResult: Result) { - val plugin = Amplify.DataStore.getPlugin("awsDataStorePlugin") as AWSDataStorePlugin + val plugin = dataStorePlugin plugin.start( { @@ -535,7 +555,7 @@ class AmplifyDataStorePlugin : @VisibleForTesting fun onStop(flutterResult: Result) { - val plugin = Amplify.DataStore.getPlugin("awsDataStorePlugin") as AWSDataStorePlugin + val plugin = dataStorePlugin plugin.stop( { diff --git a/packages/amplify_datastore/android/src/test/kotlin/com/amazonaws/amplify/amplify_datastore/AmplifyDataStoreHubTest.kt b/packages/amplify_datastore/android/src/test/kotlin/com/amazonaws/amplify/amplify_datastore/AmplifyDataStoreHubTest.kt index 9b39fc3e8b..6ff7356902 100644 --- a/packages/amplify_datastore/android/src/test/kotlin/com/amazonaws/amplify/amplify_datastore/AmplifyDataStoreHubTest.kt +++ b/packages/amplify_datastore/android/src/test/kotlin/com/amazonaws/amplify/amplify_datastore/AmplifyDataStoreHubTest.kt @@ -64,8 +64,6 @@ class AmplifyDataStoreHubTest { val modelProvider = FlutterModelProvider.instance modelProvider.addModelSchema("Post", postSchema) modelSchema = flutterPlugin.modelProvider.modelSchemas()["Post"]!! - setFinalStatic(Amplify::class.java.getDeclaredField("DataStore"), mockDataStore) - `when`(mockDataStore.getPlugin("awsDataStorePlugin")).thenReturn(mockAmplifyDataStorePlugin) } @Test diff --git a/packages/amplify_datastore/android/src/test/kotlin/com/amazonaws/amplify/amplify_datastore/AmplifyDataStorePluginTest.kt b/packages/amplify_datastore/android/src/test/kotlin/com/amazonaws/amplify/amplify_datastore/AmplifyDataStorePluginTest.kt index 0b21600ad0..00adb5f669 100644 --- a/packages/amplify_datastore/android/src/test/kotlin/com/amazonaws/amplify/amplify_datastore/AmplifyDataStorePluginTest.kt +++ b/packages/amplify_datastore/android/src/test/kotlin/com/amazonaws/amplify/amplify_datastore/AmplifyDataStorePluginTest.kt @@ -3,6 +3,8 @@ package com.amazonaws.amplify.amplify_datastore +import android.os.Handler +import androidx.arch.core.executor.testing.InstantTaskExecutorRule import com.amazonaws.amplify.amplify_datastore.exception.ExceptionMessages import com.amazonaws.amplify.amplify_datastore.types.model.FlutterSerializedModel import com.amplifyframework.api.aws.AuthModeStrategyType @@ -29,6 +31,7 @@ import com.amplifyframework.datastore.DataStoreItemChange import io.flutter.plugin.common.MethodChannel import org.junit.Assert.assertEquals import org.junit.Before +import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith import org.mockito.ArgumentMatchers.any @@ -45,17 +48,21 @@ import org.mockito.Mockito.verifyNoInteractions import org.mockito.Mockito.`when` import org.mockito.invocation.InvocationOnMock import org.robolectric.RobolectricTestRunner +import org.robolectric.Shadows import java.lang.reflect.Field import java.lang.reflect.Modifier import java.util.concurrent.TimeUnit @RunWith(RobolectricTestRunner::class) class AmplifyDataStorePluginTest { + @get:Rule + val instantTaskExecutorRule = InstantTaskExecutorRule() private lateinit var flutterPlugin: AmplifyDataStorePlugin private lateinit var modelSchema: ModelSchema private lateinit var amplifySuccessResults: MutableList private var mockDataStore = mock(DataStoreCategory::class.java) + private var mockThreadHandler = mock(Handler::class.java) private var mockAmplifyDataStorePlugin = mock(AWSDataStorePlugin::class.java) private val mockResult: MethodChannel.Result = mock(MethodChannel.Result::class.java) private val mockStreamHandler: DataStoreObserveEventStreamHandler = @@ -64,7 +71,8 @@ class AmplifyDataStorePluginTest { mock(DataStoreHubEventStreamHandler::class.java) private val dataStoreException = DataStoreException("Some useful exception message", "Some useful recovery message") - private val dataStoreObserveStartFailure = DataStoreException("Failed to start DataStore.", "Retry") + private val dataStoreObserveStartFailure = + DataStoreException("Failed to start DataStore.", "Retry") private val mockModelSchemas = mutableListOf( mapOf( "name" to "Post", @@ -84,14 +92,15 @@ class AmplifyDataStorePluginTest { ) ) - private val mockDataStorePluginBuilder = mock(AWSDataStorePlugin.Builder::class.java, RETURNS_SELF) + private val mockDataStorePluginBuilder = + mock(AWSDataStorePlugin.Builder::class.java, RETURNS_SELF) private val defaultDataStoreConfiguration = DataStoreConfiguration.defaults() private val mockDataStoreConfigurationBuilder = mock(DataStoreConfiguration.Builder::class.java, RETURNS_SELF) @Before fun setup() { - flutterPlugin = AmplifyDataStorePlugin() + flutterPlugin = AmplifyDataStorePlugin(mockAmplifyDataStorePlugin, mockThreadHandler, mockStreamHandler, mockHubHandler) val modelProvider = FlutterModelProvider.instance modelProvider.addModelSchema("Post", postSchema) modelProvider.addModelSchema("Blog", blogSchema) @@ -127,8 +136,10 @@ class AmplifyDataStorePluginTest { ) .build() ) - setFinalStatic(Amplify::class.java.getDeclaredField("DataStore"), mockDataStore) - `when`(mockDataStore.getPlugin("awsDataStorePlugin")).thenReturn(mockAmplifyDataStorePlugin) + `when`(mockThreadHandler.post(any(Runnable::class.java))).thenAnswer { + (it.arguments[0] as Runnable).run() + true + } } @Test @@ -160,7 +171,10 @@ class AmplifyDataStorePluginTest { verify(mockDataStoreConfigurationBuilder, times(1)).syncPageSize( defaultDataStoreConfiguration.syncPageSize ) - verify(mockDataStoreConfigurationBuilder, never()).syncExpression(anyString(), any()) + verify(mockDataStoreConfigurationBuilder, never()).syncExpression( + anyString(), + any() + ) verify(mockDataStorePluginBuilder, times(1)).authModeStrategy(authModeStrategy) } mockDataStorePlugin.close() @@ -195,7 +209,9 @@ class AmplifyDataStorePluginTest { mockDataStoreConfigurationBuilder, times(1) ).syncInterval(mockSyncInterval.toLong(), TimeUnit.MINUTES) - verify(mockDataStoreConfigurationBuilder, times(1)).syncMaxRecords(mockSyncMaxRecords) + verify(mockDataStoreConfigurationBuilder, times(1)).syncMaxRecords( + mockSyncMaxRecords + ) verify(mockDataStoreConfigurationBuilder, times(1)).syncPageSize(mockSyncPageSize) verify(mockDataStorePluginBuilder, times(1)).authModeStrategy(authModeStrategy) } @@ -281,7 +297,7 @@ class AmplifyDataStorePluginTest { HashMap::class.java ) as HashMap ) - verify(mockResult, times(1)).success( + verify(mockResult).success( readMapFromFile( "query_api", "response/2_results.json", @@ -595,11 +611,6 @@ class AmplifyDataStorePluginTest { @Test fun test_observe_set_up_success() { - flutterPlugin = AmplifyDataStorePlugin( - eventHandler = mockStreamHandler, - hubEventHandler = mockHubHandler - ) - doAnswer { invocation: InvocationOnMock -> (invocation.arguments[0] as Consumer).accept( Cancelable { } @@ -619,11 +630,6 @@ class AmplifyDataStorePluginTest { @Test fun test_observe_set_up_failure() { - flutterPlugin = AmplifyDataStorePlugin( - eventHandler = mockStreamHandler, - hubEventHandler = mockHubHandler - ) - doAnswer { invocation: InvocationOnMock -> (invocation.arguments[2] as Consumer).accept( dataStoreObserveStartFailure @@ -643,10 +649,6 @@ class AmplifyDataStorePluginTest { @Test fun test_observe_success_event() { - flutterPlugin = AmplifyDataStorePlugin( - eventHandler = mockStreamHandler, - hubEventHandler = mockHubHandler - ) val eventData: HashMap = ( readMapFromFile( "observe_api", @@ -835,29 +837,40 @@ class AmplifyDataStorePluginTest { ) ) - val deserializedResult = flutterPlugin.deserializeNestedModel(serializedPersonData, personSchema) + val deserializedResult = + flutterPlugin.deserializeNestedModel(serializedPersonData, personSchema) assertEquals(deserializedResult["id"], serializedPersonData["id"]) assertEquals(deserializedResult["name"], serializedPersonData["name"]) assert(deserializedResult["contact"] is SerializedCustomType) val serializedContactData = serializedPersonData["contact"] as Map<*, *> - val deserializedContactData = (deserializedResult["contact"] as SerializedCustomType).serializedData + val deserializedContactData = + (deserializedResult["contact"] as SerializedCustomType).serializedData assertEquals(deserializedContactData["email"], serializedContactData["email"]) assert(deserializedContactData["phone"] is SerializedCustomType) val serializedPhoneData = serializedContactData["phone"] as Map<*, *> - val deserializedPhoneData = (deserializedContactData["phone"] as SerializedCustomType).serializedData + val deserializedPhoneData = + (deserializedContactData["phone"] as SerializedCustomType).serializedData assertEquals(deserializedPhoneData, serializedPhoneData) assert(deserializedContactData["mailingAddresses"] is List<*>) - val serializedMailingAddressesData = serializedContactData["mailingAddresses"] as List> - val deserializedMailingAddressesData = deserializedContactData["mailingAddresses"] as List - val flatDeserializedMailingAddressesData = deserializedMailingAddressesData.map { it.serializedData } - assertEquals(flatDeserializedMailingAddressesData as List<*>, serializedMailingAddressesData as List<*>) + val serializedMailingAddressesData = + serializedContactData["mailingAddresses"] as List> + val deserializedMailingAddressesData = + deserializedContactData["mailingAddresses"] as List + val flatDeserializedMailingAddressesData = + deserializedMailingAddressesData.map { it.serializedData } + assertEquals( + flatDeserializedMailingAddressesData as List<*>, + serializedMailingAddressesData as List<*> + ) assert(deserializedResult["propertiesAddresses"] is List<*>) - val serializedPropertiesAddressesData = serializedPersonData["propertiesAddresses"] as List> + val serializedPropertiesAddressesData = + serializedPersonData["propertiesAddresses"] as List> val deserializedPropertiesAddressesData = deserializedResult["propertiesAddresses"] as List - val flatDeserializedPropertiesAddressesData = deserializedPropertiesAddressesData.map { it.serializedData } + val flatDeserializedPropertiesAddressesData = + deserializedPropertiesAddressesData.map { it.serializedData } assertEquals(flatDeserializedPropertiesAddressesData, serializedPropertiesAddressesData) } @@ -930,12 +943,4 @@ class AmplifyDataStorePluginTest { ) ) } - - private fun setFinalStatic(field: Field, newValue: Any?) { - field.isAccessible = true - val modifiersField: Field = Field::class.java.getDeclaredField("modifiers") - modifiersField.isAccessible = true - modifiersField.setInt(field, field.modifiers and Modifier.FINAL.inv()) - field.set(null, newValue) - } } From 0a0a4e875aea375f3d9ef142d778f64d1267b9fb Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Mon, 8 Apr 2024 15:01:38 -0700 Subject: [PATCH 52/69] chore: change Throwable serializer and added uiThreadhandler argument to plugin --- .../amplify_datastore/android/build.gradle | 2 +- .../AmplifyDataStorePlugin.kt | 42 ++++++++++++------- .../exception/ExceptionUtil.kt | 29 +++++++------ .../AmplifyDataStorePluginTest.kt | 6 ++- 4 files changed, 50 insertions(+), 29 deletions(-) diff --git a/packages/amplify_datastore/android/build.gradle b/packages/amplify_datastore/android/build.gradle index 3ba06d9e3b..5a373b8aea 100644 --- a/packages/amplify_datastore/android/build.gradle +++ b/packages/amplify_datastore/android/build.gradle @@ -93,7 +93,7 @@ dependencies { // Tests must be updated if bumped //noinspection GradleDependency - testImplementation 'org.robolectric:robolectric:4.11.1' + testImplementation 'org.robolectric:robolectric:4.12.1' testImplementation 'com.fasterxml.jackson.core:jackson-core:2.12.4' testImplementation 'com.fasterxml.jackson.core:jackson-annotations:2.12.4' testImplementation 'com.fasterxml.jackson.core:jackson-databind:2.12.4' 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 9d78cbdb1d..a122e7909f 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 @@ -203,7 +203,8 @@ class AmplifyDataStorePlugin : postExceptionToFlutterChannel( result, "DataStoreException", - createSerializedUnrecognizedError(e) + createSerializedUnrecognizedError(e), + uiThreadHandler ) } return @@ -236,7 +237,8 @@ class AmplifyDataStorePlugin : ExceptionMessages.missingRecoverySuggestion, "Received invalid request from Dart, modelSchemas and/or modelProviderVersion" + " are not available. Request: " + request.toString() - ) + ), + uiThreadHandler ) } return @@ -269,7 +271,8 @@ class AmplifyDataStorePlugin : postExceptionToFlutterChannel( flutterResult, "DataStoreException", - createSerializedUnrecognizedError(e) + createSerializedUnrecognizedError(e), + uiThreadHandler ) } } @@ -293,7 +296,7 @@ class AmplifyDataStorePlugin : try { Amplify.addPlugin(dataStorePlugin) } catch (e: Exception) { - handleAddPluginException("Datastore", e, flutterResult) + handleAddPluginException("Datastore", e, flutterResult, uiThreadHandler) return } flutterResult.success(null) @@ -312,7 +315,8 @@ class AmplifyDataStorePlugin : postExceptionToFlutterChannel( flutterResult, "DataStoreException", - createSerializedUnrecognizedError(e) + createSerializedUnrecognizedError(e), + uiThreadHandler ) } return @@ -331,13 +335,13 @@ class AmplifyDataStorePlugin : LOG.debug("Number of items received " + results.size) uiThreadHandler.post { flutterResult.success(results) } -// flutterResult.success(results) } catch (e: Exception) { uiThreadHandler.post { postExceptionToFlutterChannel( flutterResult, "DataStoreException", - createSerializedUnrecognizedError(e) + createSerializedUnrecognizedError(e), + uiThreadHandler ) } } @@ -348,7 +352,8 @@ class AmplifyDataStorePlugin : postExceptionToFlutterChannel( flutterResult, "DataStoreException", - createSerializedError(it) + createSerializedError(it), + uiThreadHandler ) } } @@ -376,7 +381,8 @@ class AmplifyDataStorePlugin : postExceptionToFlutterChannel( flutterResult, "DataStoreException", - createSerializedUnrecognizedError(e) + createSerializedUnrecognizedError(e), + uiThreadHandler ) } return @@ -405,7 +411,8 @@ class AmplifyDataStorePlugin : postExceptionToFlutterChannel( flutterResult, "DataStoreException", - createSerializedError(it) + createSerializedError(it), + uiThreadHandler ) } } @@ -434,7 +441,8 @@ class AmplifyDataStorePlugin : postExceptionToFlutterChannel( flutterResult, "DataStoreException", - createSerializedUnrecognizedError(e) + createSerializedUnrecognizedError(e), + uiThreadHandler ) } return @@ -460,7 +468,8 @@ class AmplifyDataStorePlugin : postExceptionToFlutterChannel( flutterResult, "DataStoreException", - createSerializedError(it) + createSerializedError(it), + uiThreadHandler ) } } @@ -481,7 +490,8 @@ class AmplifyDataStorePlugin : postExceptionToFlutterChannel( flutterResult, "DataStoreException", - createSerializedError(it) + createSerializedError(it), + uiThreadHandler ) } } @@ -546,7 +556,8 @@ class AmplifyDataStorePlugin : postExceptionToFlutterChannel( flutterResult, "DataStoreException", - createSerializedError(it) + createSerializedError(it), + uiThreadHandler ) } } @@ -570,7 +581,8 @@ class AmplifyDataStorePlugin : postExceptionToFlutterChannel( flutterResult, "DataStoreException", - createSerializedError(it) + createSerializedError(it), + uiThreadHandler ) } } diff --git a/packages/amplify_datastore/android/src/main/kotlin/com/amazonaws/amplify/amplify_datastore/exception/ExceptionUtil.kt b/packages/amplify_datastore/android/src/main/kotlin/com/amazonaws/amplify/amplify_datastore/exception/ExceptionUtil.kt index 33ee1c3d5e..fbc533d035 100644 --- a/packages/amplify_datastore/android/src/main/kotlin/com/amazonaws/amplify/amplify_datastore/exception/ExceptionUtil.kt +++ b/packages/amplify_datastore/android/src/main/kotlin/com/amazonaws/amplify/amplify_datastore/exception/ExceptionUtil.kt @@ -7,11 +7,14 @@ import android.os.Handler import android.os.Looper import com.amplifyframework.AmplifyException import com.amplifyframework.core.Amplify +import com.google.gson.Gson import com.google.gson.GsonBuilder import com.google.gson.JsonElement +import com.google.gson.JsonObject import com.google.gson.JsonPrimitive import com.google.gson.JsonSerializationContext import com.google.gson.JsonSerializer +import com.google.gson.reflect.TypeToken import io.flutter.plugin.common.MethodChannel.Result import java.lang.reflect.Type @@ -21,9 +24,10 @@ class ExceptionUtil { fun postExceptionToFlutterChannel( result: Result, errorCode: String, - details: Map + details: Map, + threadHandler: Handler ) { - Handler(Looper.getMainLooper()).post { + threadHandler.post { result.error( errorCode, ExceptionMessages.defaultFallbackExceptionMessage, @@ -35,7 +39,7 @@ class ExceptionUtil { @JvmStatic fun createSerializedError(e: AmplifyException): Map { val gsonBuilder = GsonBuilder() - gsonBuilder.registerTypeAdapter(Throwable::class.java, ThrowableSerializer()) + gsonBuilder.registerTypeHierarchyAdapter(AmplifyException::class.java, AmplifyExceptionSerializer()) val gson = gsonBuilder.create() val serializedJsonException = gson.toJson(e) @@ -78,7 +82,7 @@ class ExceptionUtil { } @JvmStatic - fun handleAddPluginException(pluginName: String, e: Exception, flutterResult: Result) { + fun handleAddPluginException(pluginName: String, e: Exception, flutterResult: Result, threadHandler: Handler) { var errorCode = pluginName + "Exception" if (e is Amplify.AlreadyConfiguredException) { errorCode = "AmplifyAlreadyConfiguredException" @@ -87,17 +91,18 @@ class ExceptionUtil { is AmplifyException -> createSerializedError(e) else -> createSerializedUnrecognizedError(e) } - postExceptionToFlutterChannel(flutterResult, errorCode, errorDetails) + postExceptionToFlutterChannel(flutterResult, errorCode, errorDetails, threadHandler) } } } -class ThrowableSerializer : JsonSerializer { - override fun serialize( - src: Throwable?, - typeOfSrc: Type?, - context: JsonSerializationContext? - ): JsonElement { - return JsonPrimitive(src.toString()) +class AmplifyExceptionSerializer : JsonSerializer { + override fun serialize(src: AmplifyException?, typeOfSrc: Type?, context: JsonSerializationContext?): JsonElement { + val jsonObject = JsonObject() + src?.let { + jsonObject.addProperty("message", src.message) + jsonObject.addProperty("recoverySuggestion", src.recoverySuggestion) + } + return jsonObject } } diff --git a/packages/amplify_datastore/android/src/test/kotlin/com/amazonaws/amplify/amplify_datastore/AmplifyDataStorePluginTest.kt b/packages/amplify_datastore/android/src/test/kotlin/com/amazonaws/amplify/amplify_datastore/AmplifyDataStorePluginTest.kt index 00adb5f669..f2727f1be3 100644 --- a/packages/amplify_datastore/android/src/test/kotlin/com/amazonaws/amplify/amplify_datastore/AmplifyDataStorePluginTest.kt +++ b/packages/amplify_datastore/android/src/test/kotlin/com/amazonaws/amplify/amplify_datastore/AmplifyDataStorePluginTest.kt @@ -4,6 +4,7 @@ package com.amazonaws.amplify.amplify_datastore import android.os.Handler +import android.os.Looper import androidx.arch.core.executor.testing.InstantTaskExecutorRule import com.amazonaws.amplify.amplify_datastore.exception.ExceptionMessages import com.amazonaws.amplify.amplify_datastore.types.model.FlutterSerializedModel @@ -63,6 +64,7 @@ class AmplifyDataStorePluginTest { private var mockDataStore = mock(DataStoreCategory::class.java) private var mockThreadHandler = mock(Handler::class.java) + private var threadHandler = Handler(Looper.getMainLooper()) private var mockAmplifyDataStorePlugin = mock(AWSDataStorePlugin::class.java) private val mockResult: MethodChannel.Result = mock(MethodChannel.Result::class.java) private val mockStreamHandler: DataStoreObserveEventStreamHandler = @@ -695,7 +697,9 @@ class AmplifyDataStorePluginTest { fun test_observe_receive_error_event() { flutterPlugin = AmplifyDataStorePlugin( eventHandler = mockStreamHandler, - hubEventHandler = mockHubHandler + hubEventHandler = mockHubHandler, + uiThreadHandler = mockThreadHandler, + dataStorePlugin = mockAmplifyDataStorePlugin, ) doAnswer { invocation: InvocationOnMock -> From 5ad338a2c86f48050d57e6c22ed650fea64f9b03 Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Tue, 9 Apr 2024 11:26:45 -0700 Subject: [PATCH 53/69] chore: update to the latest version of android --- packages/amplify_datastore/android/build.gradle | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/amplify_datastore/android/build.gradle b/packages/amplify_datastore/android/build.gradle index 5a373b8aea..700b6dfe71 100644 --- a/packages/amplify_datastore/android/build.gradle +++ b/packages/amplify_datastore/android/build.gradle @@ -77,10 +77,10 @@ dependencies { // Support for Java 8 features coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.3' - implementation 'com.amplifyframework:aws-auth-cognito:2.14.11' - implementation "com.amplifyframework:aws-api:2.14.11" - implementation "com.amplifyframework:aws-datastore:2.14.11" - implementation "com.amplifyframework:aws-api-appsync:2.14.11" + implementation 'com.amplifyframework:aws-auth-cognito:2.15.0' + implementation "com.amplifyframework:aws-api:2.15.0" + implementation "com.amplifyframework:aws-datastore:2.15.0" + implementation "com.amplifyframework:aws-api-appsync:2.15.0" implementation 'com.google.code.gson:gson:2.10.1' implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.1' From fa6bc51636d9abda75e0dc7e6c45cc426a8c4c10 Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Wed, 10 Apr 2024 11:17:45 -0700 Subject: [PATCH 54/69] chore: add GraphQL Exception serializer --- .../exception/ExceptionUtil.kt | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/packages/amplify_datastore/android/src/main/kotlin/com/amazonaws/amplify/amplify_datastore/exception/ExceptionUtil.kt b/packages/amplify_datastore/android/src/main/kotlin/com/amazonaws/amplify/amplify_datastore/exception/ExceptionUtil.kt index fbc533d035..eb8c144e88 100644 --- a/packages/amplify_datastore/android/src/main/kotlin/com/amazonaws/amplify/amplify_datastore/exception/ExceptionUtil.kt +++ b/packages/amplify_datastore/android/src/main/kotlin/com/amazonaws/amplify/amplify_datastore/exception/ExceptionUtil.kt @@ -7,8 +7,10 @@ import android.os.Handler import android.os.Looper import com.amplifyframework.AmplifyException import com.amplifyframework.core.Amplify +import com.amplifyframework.datastore.DataStoreException.GraphQLResponseException import com.google.gson.Gson import com.google.gson.GsonBuilder +import com.google.gson.JsonArray import com.google.gson.JsonElement import com.google.gson.JsonObject import com.google.gson.JsonPrimitive @@ -40,6 +42,7 @@ class ExceptionUtil { fun createSerializedError(e: AmplifyException): Map { val gsonBuilder = GsonBuilder() gsonBuilder.registerTypeHierarchyAdapter(AmplifyException::class.java, AmplifyExceptionSerializer()) + gsonBuilder.registerTypeHierarchyAdapter(GraphQLResponseException::class.java, GraphQLExceptionSerializer()) val gson = gsonBuilder.create() val serializedJsonException = gson.toJson(e) @@ -102,7 +105,31 @@ class AmplifyExceptionSerializer : JsonSerializer { src?.let { jsonObject.addProperty("message", src.message) jsonObject.addProperty("recoverySuggestion", src.recoverySuggestion) + src.cause?.let { cause -> + jsonObject.addProperty("cause", src.cause.toString()) + } } return jsonObject } } + +class GraphQLExceptionSerializer : JsonSerializer { + override fun serialize(src: GraphQLResponseException?, typeOfSrc: Type?, context: JsonSerializationContext?): JsonElement { + val jsonObject = JsonObject() + src?.let { + jsonObject.addProperty("message", src.message) + jsonObject.addProperty("recoverySuggestion", src.recoverySuggestion) + src.cause?.let { cause -> + jsonObject.addProperty("cause", src.cause.toString()) + } + val array = JsonArray() + src.errors.forEach{e -> + val temp = JsonObject() + temp.addProperty("message", e.message) + array.add(temp) + } + jsonObject.add("errors", array) + } + return jsonObject + } +} \ No newline at end of file From 115f0e88b86cc9e1aaadd7b330ae6fd98bc66baa Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Wed, 10 Apr 2024 12:06:35 -0700 Subject: [PATCH 55/69] chore: added comment to trigger tests --- packages/amplify_datastore/lib/amplify_datastore.dart | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/amplify_datastore/lib/amplify_datastore.dart b/packages/amplify_datastore/lib/amplify_datastore.dart index 2799013f15..491bdd1037 100644 --- a/packages/amplify_datastore/lib/amplify_datastore.dart +++ b/packages/amplify_datastore/lib/amplify_datastore.dart @@ -1,6 +1,8 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 +// COMMENT TO REMOVE: TRIGGER TESTS + import 'dart:async'; import 'dart:convert'; From 8b09e93cee49affab57d84d43bf0ee8cfed20d51 Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Wed, 10 Apr 2024 13:34:31 -0700 Subject: [PATCH 56/69] chore: bump java version to 17 in e2e android test --- .github/workflows/e2e_android.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/e2e_android.yaml b/.github/workflows/e2e_android.yaml index e65b5eb948..2953c16075 100644 --- a/.github/workflows/e2e_android.yaml +++ b/.github/workflows/e2e_android.yaml @@ -45,7 +45,7 @@ jobs: - uses: actions/setup-java@cd89f46ac9d01407894225f350157564c9c7cee2 # 3.12.0 with: distribution: "corretto" # Amazon Corretto Build of OpenJDK - java-version: "11" + java-version: "17" - name: Install dependencies uses: ./.github/composite_actions/install_dependencies From 107ec2592dc839ba74ab09d75d481d11c7a4c01f Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Wed, 10 Apr 2024 14:16:59 -0700 Subject: [PATCH 57/69] chore: remove test comment used to trigger tests --- packages/amplify_datastore/lib/amplify_datastore.dart | 2 -- 1 file changed, 2 deletions(-) diff --git a/packages/amplify_datastore/lib/amplify_datastore.dart b/packages/amplify_datastore/lib/amplify_datastore.dart index 491bdd1037..2799013f15 100644 --- a/packages/amplify_datastore/lib/amplify_datastore.dart +++ b/packages/amplify_datastore/lib/amplify_datastore.dart @@ -1,8 +1,6 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 -// COMMENT TO REMOVE: TRIGGER TESTS - import 'dart:async'; import 'dart:convert'; From 55bd04e5a652c43a0bb5d1e32e6807038be3dc8c Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Wed, 10 Apr 2024 16:32:13 -0700 Subject: [PATCH 58/69] chore: bump amplify-android push notifications version --- .../push/amplify_push_notifications/android/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/notifications/push/amplify_push_notifications/android/build.gradle b/packages/notifications/push/amplify_push_notifications/android/build.gradle index 4d68751969..cdd472d33e 100644 --- a/packages/notifications/push/amplify_push_notifications/android/build.gradle +++ b/packages/notifications/push/amplify_push_notifications/android/build.gradle @@ -65,7 +65,7 @@ android { dependencies { api "com.google.firebase:firebase-messaging:23.2.0" // Import support library for Amplify push utils - implementation 'com.amplifyframework:aws-push-notifications-pinpoint-common:2.14.11' + implementation 'com.amplifyframework:aws-push-notifications-pinpoint-common:2.15.0' implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.4.1" implementation project(path: ':flutter_plugin_android_lifecycle') implementation 'androidx.test:core-ktx:1.5.0' From fc31321b063b66c607ac43e98ffff290c0dec158 Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Wed, 10 Apr 2024 17:01:42 -0700 Subject: [PATCH 59/69] chore: remove unnecessary imports and variables --- packages/amplify_datastore/android/build.gradle | 1 - .../amplify_datastore/AmplifyDataStorePluginTest.kt | 9 --------- 2 files changed, 10 deletions(-) diff --git a/packages/amplify_datastore/android/build.gradle b/packages/amplify_datastore/android/build.gradle index 700b6dfe71..a6a2be51e9 100644 --- a/packages/amplify_datastore/android/build.gradle +++ b/packages/amplify_datastore/android/build.gradle @@ -97,5 +97,4 @@ dependencies { testImplementation 'com.fasterxml.jackson.core:jackson-core:2.12.4' testImplementation 'com.fasterxml.jackson.core:jackson-annotations:2.12.4' testImplementation 'com.fasterxml.jackson.core:jackson-databind:2.12.4' - testImplementation 'androidx.arch.core:core-testing:2.1.0' } diff --git a/packages/amplify_datastore/android/src/test/kotlin/com/amazonaws/amplify/amplify_datastore/AmplifyDataStorePluginTest.kt b/packages/amplify_datastore/android/src/test/kotlin/com/amazonaws/amplify/amplify_datastore/AmplifyDataStorePluginTest.kt index f2727f1be3..8ea4bae581 100644 --- a/packages/amplify_datastore/android/src/test/kotlin/com/amazonaws/amplify/amplify_datastore/AmplifyDataStorePluginTest.kt +++ b/packages/amplify_datastore/android/src/test/kotlin/com/amazonaws/amplify/amplify_datastore/AmplifyDataStorePluginTest.kt @@ -5,7 +5,6 @@ package com.amazonaws.amplify.amplify_datastore import android.os.Handler import android.os.Looper -import androidx.arch.core.executor.testing.InstantTaskExecutorRule import com.amazonaws.amplify.amplify_datastore.exception.ExceptionMessages import com.amazonaws.amplify.amplify_datastore.types.model.FlutterSerializedModel import com.amplifyframework.api.aws.AuthModeStrategyType @@ -32,7 +31,6 @@ import com.amplifyframework.datastore.DataStoreItemChange import io.flutter.plugin.common.MethodChannel import org.junit.Assert.assertEquals import org.junit.Before -import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith import org.mockito.ArgumentMatchers.any @@ -49,22 +47,15 @@ import org.mockito.Mockito.verifyNoInteractions import org.mockito.Mockito.`when` import org.mockito.invocation.InvocationOnMock import org.robolectric.RobolectricTestRunner -import org.robolectric.Shadows -import java.lang.reflect.Field -import java.lang.reflect.Modifier import java.util.concurrent.TimeUnit @RunWith(RobolectricTestRunner::class) class AmplifyDataStorePluginTest { - @get:Rule - val instantTaskExecutorRule = InstantTaskExecutorRule() private lateinit var flutterPlugin: AmplifyDataStorePlugin private lateinit var modelSchema: ModelSchema private lateinit var amplifySuccessResults: MutableList - private var mockDataStore = mock(DataStoreCategory::class.java) private var mockThreadHandler = mock(Handler::class.java) - private var threadHandler = Handler(Looper.getMainLooper()) private var mockAmplifyDataStorePlugin = mock(AWSDataStorePlugin::class.java) private val mockResult: MethodChannel.Result = mock(MethodChannel.Result::class.java) private val mockStreamHandler: DataStoreObserveEventStreamHandler = From 7144f4abe347f4cd16d377e275c93d0937a2ca08 Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Thu, 11 Apr 2024 15:12:40 -0700 Subject: [PATCH 60/69] chore: removed parcelize and deprecated compileSdkVersion --- packages/amplify_datastore/example/android/app/build.gradle | 3 +-- .../push/amplify_push_notifications/android/build.gradle | 2 +- .../example/android/app/build.gradle | 1 - 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/amplify_datastore/example/android/app/build.gradle b/packages/amplify_datastore/example/android/app/build.gradle index 9d1a8fa5a6..a39890adab 100644 --- a/packages/amplify_datastore/example/android/app/build.gradle +++ b/packages/amplify_datastore/example/android/app/build.gradle @@ -23,13 +23,12 @@ if (flutterVersionName == null) { apply plugin: 'com.android.application' apply plugin: 'kotlin-android' -apply plugin: 'kotlin-parcelize' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" android { // TODO(dnys1): Replace with `flutter.compileSdkVersion` when bumping min Flutter version namespace 'com.amazonaws.amplify.amplify_datastore_example' - compileSdkVersion 34 + compileSdk 34 ndkVersion flutter.ndkVersion compileOptions { diff --git a/packages/notifications/push/amplify_push_notifications/android/build.gradle b/packages/notifications/push/amplify_push_notifications/android/build.gradle index cdd472d33e..a64af9fd99 100644 --- a/packages/notifications/push/amplify_push_notifications/android/build.gradle +++ b/packages/notifications/push/amplify_push_notifications/android/build.gradle @@ -27,7 +27,7 @@ apply plugin: 'kotlin-android' apply plugin: 'kotlinx-serialization' android { - compileSdkVersion 34 + compileSdk 34 compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 diff --git a/packages/notifications/push/amplify_push_notifications/example/android/app/build.gradle b/packages/notifications/push/amplify_push_notifications/example/android/app/build.gradle index 7bf8fb99b1..4e00d7ee09 100644 --- a/packages/notifications/push/amplify_push_notifications/example/android/app/build.gradle +++ b/packages/notifications/push/amplify_push_notifications/example/android/app/build.gradle @@ -23,7 +23,6 @@ if (flutterVersionName == null) { apply plugin: 'com.android.application' apply plugin: 'kotlin-android' -apply plugin: 'kotlin-parcelize' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" android { From 6f69b4fd1124264a08d0a7c7a83aa44e53fc6d53 Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Fri, 12 Apr 2024 09:53:26 -0700 Subject: [PATCH 61/69] chore: updated compileSdkVersion to compileSdk --- packages/amplify_datastore/android/build.gradle | 2 +- .../amplify_push_notifications/example/android/app/build.gradle | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/amplify_datastore/android/build.gradle b/packages/amplify_datastore/android/build.gradle index a6a2be51e9..c46fcda6de 100644 --- a/packages/amplify_datastore/android/build.gradle +++ b/packages/amplify_datastore/android/build.gradle @@ -32,7 +32,7 @@ apply plugin: 'kotlin-android' apply plugin: 'org.jlleitschuh.gradle.ktlint' android { - compileSdkVersion 33 + compileSdk 33 sourceSets { main.java.srcDirs += 'src/main/kotlin' diff --git a/packages/notifications/push/amplify_push_notifications/example/android/app/build.gradle b/packages/notifications/push/amplify_push_notifications/example/android/app/build.gradle index 4e00d7ee09..3896cd6806 100644 --- a/packages/notifications/push/amplify_push_notifications/example/android/app/build.gradle +++ b/packages/notifications/push/amplify_push_notifications/example/android/app/build.gradle @@ -27,7 +27,7 @@ apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" android { namespace "com.amazonaws.amplify.amplify_push_notifications_example" - compileSdkVersion flutter.compileSdkVersion + compileSdk flutter.compileSdkVersion ndkVersion flutter.ndkVersion compileOptions { From f20dc1dd570e9d1368dfe49a83d7193654765d13 Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Fri, 12 Apr 2024 10:04:47 -0700 Subject: [PATCH 62/69] chore: added times called back into test --- .../amplify/amplify_datastore/AmplifyDataStorePluginTest.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/amplify_datastore/android/src/test/kotlin/com/amazonaws/amplify/amplify_datastore/AmplifyDataStorePluginTest.kt b/packages/amplify_datastore/android/src/test/kotlin/com/amazonaws/amplify/amplify_datastore/AmplifyDataStorePluginTest.kt index 8ea4bae581..3e9215cc1a 100644 --- a/packages/amplify_datastore/android/src/test/kotlin/com/amazonaws/amplify/amplify_datastore/AmplifyDataStorePluginTest.kt +++ b/packages/amplify_datastore/android/src/test/kotlin/com/amazonaws/amplify/amplify_datastore/AmplifyDataStorePluginTest.kt @@ -290,7 +290,7 @@ class AmplifyDataStorePluginTest { HashMap::class.java ) as HashMap ) - verify(mockResult).success( + verify(mockResult, times(1)).success( readMapFromFile( "query_api", "response/2_results.json", From fb01657e3b360f0a07431a8b03d790b1018b16c8 Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Fri, 12 Apr 2024 12:55:09 -0700 Subject: [PATCH 63/69] chore: upgrade java version to 17 in android packages --- packages/amplify_datastore/android/build.gradle | 8 ++++---- .../amplify_datastore/example/android/app/build.gradle | 6 +++--- .../push/amplify_push_notifications/android/build.gradle | 6 +++--- .../example/android/app/build.gradle | 6 +++--- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/packages/amplify_datastore/android/build.gradle b/packages/amplify_datastore/android/build.gradle index c46fcda6de..0854131aab 100644 --- a/packages/amplify_datastore/android/build.gradle +++ b/packages/amplify_datastore/android/build.gradle @@ -54,14 +54,14 @@ android { htmlReport false } compileOptions { - // Support for Java 8 features + // Support for Java 17 features coreLibraryDesugaringEnabled true - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_17 + targetCompatibility JavaVersion.VERSION_17 } kotlinOptions { - jvmTarget = '1.8' + jvmTarget = '17' } testOptions { diff --git a/packages/amplify_datastore/example/android/app/build.gradle b/packages/amplify_datastore/example/android/app/build.gradle index a39890adab..4765eb5007 100644 --- a/packages/amplify_datastore/example/android/app/build.gradle +++ b/packages/amplify_datastore/example/android/app/build.gradle @@ -34,12 +34,12 @@ android { compileOptions { coreLibraryDesugaringEnabled true - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_17 + targetCompatibility JavaVersion.VERSION_17 } kotlinOptions { - jvmTarget = '1.8' + jvmTarget = '17' } sourceSets { diff --git a/packages/notifications/push/amplify_push_notifications/android/build.gradle b/packages/notifications/push/amplify_push_notifications/android/build.gradle index a64af9fd99..7b2d5bb67e 100644 --- a/packages/notifications/push/amplify_push_notifications/android/build.gradle +++ b/packages/notifications/push/amplify_push_notifications/android/build.gradle @@ -30,12 +30,12 @@ android { compileSdk 34 compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_17 + targetCompatibility JavaVersion.VERSION_17 } kotlinOptions { - jvmTarget = '1.8' + jvmTarget = '17' } sourceSets { diff --git a/packages/notifications/push/amplify_push_notifications/example/android/app/build.gradle b/packages/notifications/push/amplify_push_notifications/example/android/app/build.gradle index 3896cd6806..791a70a3ff 100644 --- a/packages/notifications/push/amplify_push_notifications/example/android/app/build.gradle +++ b/packages/notifications/push/amplify_push_notifications/example/android/app/build.gradle @@ -31,12 +31,12 @@ android { ndkVersion flutter.ndkVersion compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_17 + targetCompatibility JavaVersion.VERSION_17 } kotlinOptions { - jvmTarget = '1.8' + jvmTarget = '17' } sourceSets { From 4eeb9933da088079721ca4a8e173a2b498b460f2 Mon Sep 17 00:00:00 2001 From: Nika Hassani Date: Mon, 1 Apr 2024 14:57:32 -0700 Subject: [PATCH 64/69] set java version to 17 --- canaries/android/app/build.gradle | 6 +++--- .../example/android/app/build.gradle | 6 +++--- packages/amplify_datastore/android/build.gradle | 17 ++++------------- .../android/build.gradle | 8 ++++---- .../example/android/app/build.gradle | 6 +++--- .../android/build.gradle | 8 ++++---- .../example/android/app/build.gradle | 6 +++--- .../example/android/app/build.gradle | 6 +++--- .../amplify_auth_cognito/android/build.gradle | 6 +++--- .../example/android/app/build.gradle | 6 +++--- .../example/android/app/build.gradle | 9 ++++----- .../example/android/app/build.gradle | 6 +++--- .../amplify_db_common/android/build.gradle | 8 ++++---- .../example/android/app/build.gradle | 6 +++--- .../example/android/app/build.gradle | 6 +++--- .../amplify_secure_storage/android/build.gradle | 8 ++++---- .../example/android/app/build.gradle | 8 ++++---- .../example/android/app/build.gradle | 6 +++--- .../e2e_flutter_test/android/app/build.gradle | 6 +++--- .../__brick__/example/android/app/build.gradle | 6 +++--- 20 files changed, 67 insertions(+), 77 deletions(-) diff --git a/canaries/android/app/build.gradle b/canaries/android/app/build.gradle index 5cb91ce2b3..9fb60499d6 100644 --- a/canaries/android/app/build.gradle +++ b/canaries/android/app/build.gradle @@ -30,12 +30,12 @@ android { ndkVersion flutter.ndkVersion compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_17 + targetCompatibility JavaVersion.VERSION_17 } kotlinOptions { - jvmTarget = '1.8' + jvmTarget = '17' } sourceSets { diff --git a/packages/amplify/amplify_flutter/example/android/app/build.gradle b/packages/amplify/amplify_flutter/example/android/app/build.gradle index c72843b8fa..07ee2cc3f8 100644 --- a/packages/amplify/amplify_flutter/example/android/app/build.gradle +++ b/packages/amplify/amplify_flutter/example/android/app/build.gradle @@ -31,12 +31,12 @@ android { ndkVersion flutter.ndkVersion compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_17 + targetCompatibility JavaVersion.VERSION_17 } kotlinOptions { - jvmTarget = '1.8' + jvmTarget = '17' } sourceSets { diff --git a/packages/amplify_datastore/android/build.gradle b/packages/amplify_datastore/android/build.gradle index 0854131aab..07b7dee040 100644 --- a/packages/amplify_datastore/android/build.gradle +++ b/packages/amplify_datastore/android/build.gradle @@ -54,16 +54,10 @@ android { htmlReport false } compileOptions { - // Support for Java 17 features - coreLibraryDesugaringEnabled true sourceCompatibility JavaVersion.VERSION_17 targetCompatibility JavaVersion.VERSION_17 } - kotlinOptions { - jvmTarget = '17' - } - testOptions { unitTests { includeAndroidResources = true @@ -74,13 +68,10 @@ android { } dependencies { - // Support for Java 8 features - coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.3' - - implementation 'com.amplifyframework:aws-auth-cognito:2.15.0' - implementation "com.amplifyframework:aws-api:2.15.0" - implementation "com.amplifyframework:aws-datastore:2.15.0" - implementation "com.amplifyframework:aws-api-appsync:2.15.0" + implementation 'com.amplifyframework:aws-auth-cognito:2.13.0' + implementation "com.amplifyframework:aws-api:2.13.0" + implementation "com.amplifyframework:aws-datastore:2.13.0" + implementation "com.amplifyframework:aws-api-appsync:2.13.0" implementation 'com.google.code.gson:gson:2.10.1' implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.1' diff --git a/packages/amplify_native_legacy_wrapper/android/build.gradle b/packages/amplify_native_legacy_wrapper/android/build.gradle index bded54fcad..56bdbb0b86 100644 --- a/packages/amplify_native_legacy_wrapper/android/build.gradle +++ b/packages/amplify_native_legacy_wrapper/android/build.gradle @@ -28,12 +28,12 @@ android { compileSdkVersion 31 compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_17 + targetCompatibility JavaVersion.VERSION_17 } kotlinOptions { - jvmTarget = '1.8' + jvmTarget = '17' } sourceSets { @@ -41,7 +41,7 @@ android { } defaultConfig { - minSdkVersion 16 + minSdkVersion 24 } namespace 'com.amazonaws.amplify.amplify_native_legacy_wrapper' diff --git a/packages/amplify_native_legacy_wrapper/example/android/app/build.gradle b/packages/amplify_native_legacy_wrapper/example/android/app/build.gradle index c65642eac2..ce345269c6 100644 --- a/packages/amplify_native_legacy_wrapper/example/android/app/build.gradle +++ b/packages/amplify_native_legacy_wrapper/example/android/app/build.gradle @@ -31,12 +31,12 @@ android { ndkVersion flutter.ndkVersion compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_17 + targetCompatibility JavaVersion.VERSION_17 } kotlinOptions { - jvmTarget = '1.8' + jvmTarget = '17' } sourceSets { diff --git a/packages/analytics/amplify_analytics_pinpoint/android/build.gradle b/packages/analytics/amplify_analytics_pinpoint/android/build.gradle index 5b91c490e9..bd95f41457 100644 --- a/packages/analytics/amplify_analytics_pinpoint/android/build.gradle +++ b/packages/analytics/amplify_analytics_pinpoint/android/build.gradle @@ -28,12 +28,12 @@ android { compileSdkVersion 33 compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_17 + targetCompatibility JavaVersion.VERSION_17 } kotlinOptions { - jvmTarget = '1.8' + jvmTarget = '17' } sourceSets { @@ -41,7 +41,7 @@ android { } defaultConfig { - minSdkVersion 23 + minSdkVersion 24 } namespace 'com.amazonaws.amplify.amplify_analytics_pinpoint' diff --git a/packages/analytics/amplify_analytics_pinpoint/example/android/app/build.gradle b/packages/analytics/amplify_analytics_pinpoint/example/android/app/build.gradle index 987b594e90..c880d42fb8 100644 --- a/packages/analytics/amplify_analytics_pinpoint/example/android/app/build.gradle +++ b/packages/analytics/amplify_analytics_pinpoint/example/android/app/build.gradle @@ -31,12 +31,12 @@ android { ndkVersion flutter.ndkVersion compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_17 + targetCompatibility JavaVersion.VERSION_17 } kotlinOptions { - jvmTarget = '1.8' + jvmTarget = '17' } sourceSets { diff --git a/packages/api/amplify_api/example/android/app/build.gradle b/packages/api/amplify_api/example/android/app/build.gradle index 2eeb79a95a..dc522262ba 100644 --- a/packages/api/amplify_api/example/android/app/build.gradle +++ b/packages/api/amplify_api/example/android/app/build.gradle @@ -31,12 +31,12 @@ android { ndkVersion flutter.ndkVersion compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_17 + targetCompatibility JavaVersion.VERSION_17 } kotlinOptions { - jvmTarget = '1.8' + jvmTarget = '17' } sourceSets { diff --git a/packages/auth/amplify_auth_cognito/android/build.gradle b/packages/auth/amplify_auth_cognito/android/build.gradle index 4edb0f9845..05a473a4af 100644 --- a/packages/auth/amplify_auth_cognito/android/build.gradle +++ b/packages/auth/amplify_auth_cognito/android/build.gradle @@ -28,12 +28,12 @@ android { compileSdkVersion 33 compileOptions { - sourceCompatibility JavaVersion.VERSION_11 - targetCompatibility JavaVersion.VERSION_11 + sourceCompatibility JavaVersion.VERSION_17 + targetCompatibility JavaVersion.VERSION_17 } kotlinOptions { - jvmTarget = '11' + jvmTarget = '17' } sourceSets { diff --git a/packages/auth/amplify_auth_cognito/example/android/app/build.gradle b/packages/auth/amplify_auth_cognito/example/android/app/build.gradle index 87229227fc..3b5a840f1d 100644 --- a/packages/auth/amplify_auth_cognito/example/android/app/build.gradle +++ b/packages/auth/amplify_auth_cognito/example/android/app/build.gradle @@ -31,12 +31,12 @@ android { ndkVersion flutter.ndkVersion compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_17 + targetCompatibility JavaVersion.VERSION_17 } kotlinOptions { - jvmTarget = '1.8' + jvmTarget = '17' } sourceSets { diff --git a/packages/authenticator/amplify_authenticator/example/android/app/build.gradle b/packages/authenticator/amplify_authenticator/example/android/app/build.gradle index 700cb486dd..28f25e3a91 100644 --- a/packages/authenticator/amplify_authenticator/example/android/app/build.gradle +++ b/packages/authenticator/amplify_authenticator/example/android/app/build.gradle @@ -26,17 +26,16 @@ apply plugin: 'kotlin-android' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" android { - // TODO(dnys1): Replace with `flutter.compileSdkVersion` when bumping min Flutter version - compileSdkVersion 33 + compileSdkVersion flutter.compileSdkVersion ndkVersion flutter.ndkVersion compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_17 + targetCompatibility JavaVersion.VERSION_17 } kotlinOptions { - jvmTarget = '1.8' + jvmTarget = '17' } sourceSets { diff --git a/packages/authenticator/amplify_authenticator_test/example/android/app/build.gradle b/packages/authenticator/amplify_authenticator_test/example/android/app/build.gradle index da24017e07..74bfd747ed 100644 --- a/packages/authenticator/amplify_authenticator_test/example/android/app/build.gradle +++ b/packages/authenticator/amplify_authenticator_test/example/android/app/build.gradle @@ -28,12 +28,12 @@ android { ndkVersion flutter.ndkVersion compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_17 + targetCompatibility JavaVersion.VERSION_17 } kotlinOptions { - jvmTarget = '1.8' + jvmTarget = '17' } sourceSets { diff --git a/packages/common/amplify_db_common/android/build.gradle b/packages/common/amplify_db_common/android/build.gradle index 20b8528620..62db495a94 100644 --- a/packages/common/amplify_db_common/android/build.gradle +++ b/packages/common/amplify_db_common/android/build.gradle @@ -28,12 +28,12 @@ android { compileSdkVersion 33 compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_17 + targetCompatibility JavaVersion.VERSION_17 } kotlinOptions { - jvmTarget = '1.8' + jvmTarget = '17' } sourceSets { @@ -41,7 +41,7 @@ android { } defaultConfig { - minSdkVersion 19 + minSdkVersion 24 } namespace 'com.amazonaws.amplify.amplify_db_common' diff --git a/packages/common/amplify_db_common/example/android/app/build.gradle b/packages/common/amplify_db_common/example/android/app/build.gradle index 97f901e1bd..2a547c3235 100644 --- a/packages/common/amplify_db_common/example/android/app/build.gradle +++ b/packages/common/amplify_db_common/example/android/app/build.gradle @@ -31,12 +31,12 @@ android { ndkVersion flutter.ndkVersion compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_17 + targetCompatibility JavaVersion.VERSION_17 } kotlinOptions { - jvmTarget = '1.8' + jvmTarget = '17' } sourceSets { diff --git a/packages/notifications/push/amplify_push_notifications_pinpoint/example/android/app/build.gradle b/packages/notifications/push/amplify_push_notifications_pinpoint/example/android/app/build.gradle index 3c04f827c2..c9313b0cb4 100644 --- a/packages/notifications/push/amplify_push_notifications_pinpoint/example/android/app/build.gradle +++ b/packages/notifications/push/amplify_push_notifications_pinpoint/example/android/app/build.gradle @@ -31,12 +31,12 @@ android { ndkVersion flutter.ndkVersion compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_17 + targetCompatibility JavaVersion.VERSION_17 } kotlinOptions { - jvmTarget = '1.8' + jvmTarget = '17' } sourceSets { diff --git a/packages/secure_storage/amplify_secure_storage/android/build.gradle b/packages/secure_storage/amplify_secure_storage/android/build.gradle index eaa91135d2..bbc002a658 100644 --- a/packages/secure_storage/amplify_secure_storage/android/build.gradle +++ b/packages/secure_storage/amplify_secure_storage/android/build.gradle @@ -28,12 +28,12 @@ android { compileSdkVersion 33 compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_17 + targetCompatibility JavaVersion.VERSION_17 } kotlinOptions { - jvmTarget = '1.8' + jvmTarget = '17' } sourceSets { @@ -41,7 +41,7 @@ android { } defaultConfig { - minSdkVersion 23 + minSdkVersion 24 } testOptions.unitTests.includeAndroidResources = true diff --git a/packages/secure_storage/amplify_secure_storage/example/android/app/build.gradle b/packages/secure_storage/amplify_secure_storage/example/android/app/build.gradle index 85d8d9bc0b..5474dde175 100644 --- a/packages/secure_storage/amplify_secure_storage/example/android/app/build.gradle +++ b/packages/secure_storage/amplify_secure_storage/example/android/app/build.gradle @@ -31,12 +31,12 @@ android { ndkVersion flutter.ndkVersion compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_17 + targetCompatibility JavaVersion.VERSION_17 } kotlinOptions { - jvmTarget = '1.8' + jvmTarget = '17' } sourceSets { @@ -48,7 +48,7 @@ android { applicationId "com.amazonaws.amplify.amplify_secure_storage_example" // You can update the following values to match your application needs. // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration. - minSdkVersion 23 + minSdkVersion 24 targetSdkVersion flutter.targetSdkVersion versionCode flutterVersionCode.toInteger() versionName flutterVersionName diff --git a/packages/storage/amplify_storage_s3/example/android/app/build.gradle b/packages/storage/amplify_storage_s3/example/android/app/build.gradle index 8e166af4f0..57de3edc0c 100644 --- a/packages/storage/amplify_storage_s3/example/android/app/build.gradle +++ b/packages/storage/amplify_storage_s3/example/android/app/build.gradle @@ -31,12 +31,12 @@ android { ndkVersion flutter.ndkVersion compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_17 + targetCompatibility JavaVersion.VERSION_17 } kotlinOptions { - jvmTarget = '1.8' + jvmTarget = '17' } sourceSets { diff --git a/packages/worker_bee/e2e_flutter_test/android/app/build.gradle b/packages/worker_bee/e2e_flutter_test/android/app/build.gradle index 084c6fa419..b42dcd3911 100644 --- a/packages/worker_bee/e2e_flutter_test/android/app/build.gradle +++ b/packages/worker_bee/e2e_flutter_test/android/app/build.gradle @@ -31,12 +31,12 @@ android { ndkVersion flutter.ndkVersion compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_17 + targetCompatibility JavaVersion.VERSION_17 } kotlinOptions { - jvmTarget = '1.8' + jvmTarget = '17' } sourceSets { diff --git a/templates/flutter-package/__brick__/example/android/app/build.gradle b/templates/flutter-package/__brick__/example/android/app/build.gradle index 48c8935148..b1343f02a5 100644 --- a/templates/flutter-package/__brick__/example/android/app/build.gradle +++ b/templates/flutter-package/__brick__/example/android/app/build.gradle @@ -31,12 +31,12 @@ android { ndkVersion flutter.ndkVersion compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_17 + targetCompatibility JavaVersion.VERSION_17 } kotlinOptions { - jvmTarget = '1.8' + jvmTarget = '17' } sourceSets { From 01d87aadebb8902631e9a83e04f3522042e3f0bf Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Fri, 12 Apr 2024 13:43:07 -0700 Subject: [PATCH 65/69] chore: bump compileSdk for secure storage to 34 --- packages/amplify_datastore/android/build.gradle | 2 +- .../secure_storage/amplify_secure_storage/android/build.gradle | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/amplify_datastore/android/build.gradle b/packages/amplify_datastore/android/build.gradle index 07b7dee040..1a8faf153c 100644 --- a/packages/amplify_datastore/android/build.gradle +++ b/packages/amplify_datastore/android/build.gradle @@ -32,7 +32,7 @@ apply plugin: 'kotlin-android' apply plugin: 'org.jlleitschuh.gradle.ktlint' android { - compileSdk 33 + compileSdk 34 sourceSets { main.java.srcDirs += 'src/main/kotlin' diff --git a/packages/secure_storage/amplify_secure_storage/android/build.gradle b/packages/secure_storage/amplify_secure_storage/android/build.gradle index bbc002a658..aa9a6728a3 100644 --- a/packages/secure_storage/amplify_secure_storage/android/build.gradle +++ b/packages/secure_storage/amplify_secure_storage/android/build.gradle @@ -25,7 +25,7 @@ apply plugin: 'com.android.library' apply plugin: 'kotlin-android' android { - compileSdkVersion 33 + compileSdk 34 compileOptions { sourceCompatibility JavaVersion.VERSION_17 From 8afd4f5e0bd754ccd806de9c20a619e00b4192eb Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Fri, 12 Apr 2024 13:55:26 -0700 Subject: [PATCH 66/69] chore: fix amplify_datastore build.gradle --- packages/amplify_datastore/android/build.gradle | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/amplify_datastore/android/build.gradle b/packages/amplify_datastore/android/build.gradle index 1a8faf153c..903a2ede06 100644 --- a/packages/amplify_datastore/android/build.gradle +++ b/packages/amplify_datastore/android/build.gradle @@ -57,6 +57,10 @@ android { sourceCompatibility JavaVersion.VERSION_17 targetCompatibility JavaVersion.VERSION_17 } + + kotlinOptions { + jvmTarget = '17' + } testOptions { unitTests { @@ -68,10 +72,10 @@ android { } dependencies { - implementation 'com.amplifyframework:aws-auth-cognito:2.13.0' - implementation "com.amplifyframework:aws-api:2.13.0" - implementation "com.amplifyframework:aws-datastore:2.13.0" - implementation "com.amplifyframework:aws-api-appsync:2.13.0" + implementation 'com.amplifyframework:aws-auth-cognito:2.15.0' + implementation "com.amplifyframework:aws-api:2.15.0" + implementation "com.amplifyframework:aws-datastore:2.15.0" + implementation "com.amplifyframework:aws-api-appsync:2.15.0" implementation 'com.google.code.gson:gson:2.10.1' implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.1' From 2d7801a20a5d9338ce9534de4c4cbb228e664cd6 Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Fri, 12 Apr 2024 15:11:23 -0700 Subject: [PATCH 67/69] Revert "chore: bump compileSdk for secure storage to 34" This reverts commit 01d87aadebb8902631e9a83e04f3522042e3f0bf. --- packages/amplify_datastore/android/build.gradle | 2 +- .../secure_storage/amplify_secure_storage/android/build.gradle | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/amplify_datastore/android/build.gradle b/packages/amplify_datastore/android/build.gradle index 903a2ede06..5c13041766 100644 --- a/packages/amplify_datastore/android/build.gradle +++ b/packages/amplify_datastore/android/build.gradle @@ -32,7 +32,7 @@ apply plugin: 'kotlin-android' apply plugin: 'org.jlleitschuh.gradle.ktlint' android { - compileSdk 34 + compileSdk 33 sourceSets { main.java.srcDirs += 'src/main/kotlin' diff --git a/packages/secure_storage/amplify_secure_storage/android/build.gradle b/packages/secure_storage/amplify_secure_storage/android/build.gradle index aa9a6728a3..bbc002a658 100644 --- a/packages/secure_storage/amplify_secure_storage/android/build.gradle +++ b/packages/secure_storage/amplify_secure_storage/android/build.gradle @@ -25,7 +25,7 @@ apply plugin: 'com.android.library' apply plugin: 'kotlin-android' android { - compileSdk 34 + compileSdkVersion 33 compileOptions { sourceCompatibility JavaVersion.VERSION_17 From 0912b4f6f1095e22ef2f0ed231fd6e95c1dcf811 Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Fri, 12 Apr 2024 15:12:28 -0700 Subject: [PATCH 68/69] chore: change compileSdk to flutter.compileSdkVersion for example app --- packages/amplify_datastore/example/android/app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/amplify_datastore/example/android/app/build.gradle b/packages/amplify_datastore/example/android/app/build.gradle index 4765eb5007..aec60a4d81 100644 --- a/packages/amplify_datastore/example/android/app/build.gradle +++ b/packages/amplify_datastore/example/android/app/build.gradle @@ -28,7 +28,7 @@ apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" android { // TODO(dnys1): Replace with `flutter.compileSdkVersion` when bumping min Flutter version namespace 'com.amazonaws.amplify.amplify_datastore_example' - compileSdk 34 + compileSdk flutter.compileSdkVersion ndkVersion flutter.ndkVersion compileOptions { From 8d613e57e8a181bb0e51d9c297e9d24388855ac8 Mon Sep 17 00:00:00 2001 From: Jordan Nelson Date: Mon, 15 Apr 2024 10:58:55 -0400 Subject: [PATCH 69/69] chore: run tests for sdk 24 --- .../amplify_secure_storage/EncryptedKeyValueRepositoryTest.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/secure_storage/amplify_secure_storage/android/src/test/kotlin/com/amazonaws/amplify/amplify_secure_storage/EncryptedKeyValueRepositoryTest.kt b/packages/secure_storage/amplify_secure_storage/android/src/test/kotlin/com/amazonaws/amplify/amplify_secure_storage/EncryptedKeyValueRepositoryTest.kt index 24cc5a06ca..fd382bb1c3 100644 --- a/packages/secure_storage/amplify_secure_storage/android/src/test/kotlin/com/amazonaws/amplify/amplify_secure_storage/EncryptedKeyValueRepositoryTest.kt +++ b/packages/secure_storage/amplify_secure_storage/android/src/test/kotlin/com/amazonaws/amplify/amplify_secure_storage/EncryptedKeyValueRepositoryTest.kt @@ -16,7 +16,7 @@ import org.robolectric.RobolectricTestRunner import org.robolectric.annotation.Config @RunWith(RobolectricTestRunner::class) -@Config(manifest = Config.NONE, sdk = [23,33]) +@Config(manifest = Config.NONE, sdk = [24,33]) class EncryptedKeyValueRepositoryTest { private var context: Context = ApplicationProvider.getApplicationContext()