Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(api): Rebase OIDC fixes for RC #1036

Merged
merged 3 commits into from
Nov 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/amplify_api/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
## 0.3.0-rc.2 (2021-11-05)

### Fixes

- fix(api): OIDC Fixes for REST/GraphQL

## 0.3.0-rc.1 (2021-09-24)

### Breaking Changes
Expand Down
3 changes: 2 additions & 1 deletion packages/amplify_api/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,14 @@ dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "com.amplifyframework:aws-api:1.28.2"
implementation "com.amplifyframework:aws-api-appsync:1.28.2"
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9'

testImplementation 'androidx.test.ext:junit-ktx:1.1.3'
testImplementation 'junit:junit:4.13.2'
testImplementation 'org.mockito:mockito-core:3.10.0'
testImplementation 'org.mockito:mockito-inline:3.10.0'
testImplementation "org.mockito.kotlin:mockito-kotlin:3.2.0"
testImplementation 'androidx.test:core:1.4.0'
testImplementation 'androidx.test.ext:junit-ktx:1.1.3'
testImplementation 'org.robolectric:robolectric:4.3.1'
testImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-test:1.3.9'
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ import io.flutter.plugin.common.MethodCall
import io.flutter.plugin.common.MethodChannel
import io.flutter.plugin.common.MethodChannel.MethodCallHandler
import io.flutter.plugin.common.MethodChannel.Result
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.Dispatchers

/** AmplifyApiPlugin */
class AmplifyApiPlugin : FlutterPlugin, MethodCallHandler {
Expand All @@ -42,14 +44,20 @@ class AmplifyApiPlugin : FlutterPlugin, MethodCallHandler {
private lateinit var context: Context
private val graphqlSubscriptionStreamHandler: GraphQLSubscriptionStreamHandler
private val logger = Amplify.Logging.forNamespace("amplify:flutter:api")
private var dispatcher: CoroutineDispatcher

constructor() {
graphqlSubscriptionStreamHandler = GraphQLSubscriptionStreamHandler()
dispatcher = Dispatchers.IO
}

@VisibleForTesting
constructor(eventHandler: GraphQLSubscriptionStreamHandler) {
constructor(
eventHandler: GraphQLSubscriptionStreamHandler,
dispatcher: CoroutineDispatcher = Dispatchers.IO
) {
graphqlSubscriptionStreamHandler = eventHandler
this.dispatcher = dispatcher
}

private val handler = Handler(Looper.getMainLooper())
Expand Down Expand Up @@ -98,9 +106,9 @@ class AmplifyApiPlugin : FlutterPlugin, MethodCallHandler {
"delete" -> FlutterRestApi.delete(result, arguments)
"head" -> FlutterRestApi.head(result, arguments)
"patch" -> FlutterRestApi.patch(result, arguments)
"query" -> FlutterGraphQLApi.query(result, arguments)
"mutate" -> FlutterGraphQLApi.mutate(result, arguments)
"subscribe" -> FlutterGraphQLApi.subscribe(
"query" -> FlutterGraphQLApi(dispatcher).query(result, arguments)
"mutate" -> FlutterGraphQLApi(dispatcher).mutate(result, arguments)
"subscribe" -> FlutterGraphQLApi(dispatcher).subscribe(
result,
arguments,
graphqlSubscriptionStreamHandler
Expand Down
Loading