Skip to content

Commit

Permalink
AWS AppSync Android SDK version 2.6.20
Browse files Browse the repository at this point in the history
  • Loading branch information
minbi authored and rohandubal committed Jun 14, 2018
1 parent 54c13fa commit bf8ed98
Show file tree
Hide file tree
Showing 13 changed files with 46 additions and 17 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Change Log - AWS AppSync SDK for Android

## [Release 2.6.20](https://github.com/awslabs/aws-mobile-appsync-sdk-android/releases/tag/release_v2.6.20)

### Bug Fixes

* Prevent crashing when retrieving credentials to sign AppSync requests. Errors will now be routed to the `onError` callback. See [issue #16](https://github.com/awslabs/aws-mobile-appsync-sdk-android/issues/16)
* Remove references to subscription callback when subscription is cancelled. See [issue #13](https://github.com/awslabs/aws-mobile-appsync-sdk-android/issues/13)

### Enhancements

* Lazy load token in `BasicCognitoUserPoolsAuthProvider`.

## [Release 2.6.19](https://github.com/awslabs/aws-mobile-appsync-sdk-android/releases/tag/release_v2.6.19)

### Enhancements
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ In the project's `build.gradle`, add the following dependency in
the build script:

```groovy
classpath 'com.amazonaws:aws-android-sdk-appsync-gradle-plugin:2.6.19'
classpath 'com.amazonaws:aws-android-sdk-appsync-gradle-plugin:2.6.20'
```

**Sample project's build.gradle**
Expand All @@ -31,7 +31,7 @@ the build script:
// ..other code..
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.amazonaws:aws-android-sdk-appsync-gradle-plugin:2.6.19'
classpath 'com.amazonaws:aws-android-sdk-appsync-gradle-plugin:2.6.20'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
Expand All @@ -49,7 +49,7 @@ In the app's `build.gradle`, add the following plugin:
Add the following dependency:

```groovy
compile 'com.amazonaws:aws-android-sdk-appsync:2.6.19'
compile 'com.amazonaws:aws-android-sdk-appsync:2.6.20'
```

**Sample app's build.gradle**
Expand All @@ -62,7 +62,7 @@ Add the following dependency:
}
dependencies {
// Typical dependencies
compile 'com.amazonaws:aws-android-sdk-appsync:2.6.19'
compile 'com.amazonaws:aws-android-sdk-appsync:2.6.20'
}
```

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
// Generated file. Do not edit!
package com.apollographql.android
val VERSION = "2.6.19"
val VERSION = "2.6.20"
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public class RealAppSyncSubscriptionCall<T> implements AppSyncSubscriptionCall<T
private final AtomicReference<CallState> state = new AtomicReference<>(IDLE);
private final ApolloClient apolloClient;
private final RealAppSyncCall<T> solicitingCall;
private Callback<T> userCallback;

public RealAppSyncSubscriptionCall(
Subscription<?, T, ?> subscription,
Expand All @@ -56,6 +57,7 @@ public RealAppSyncSubscriptionCall(
@Override
public void execute(@Nonnull final Callback<T> callback) {
checkNotNull(callback, "callback == null");
userCallback = callback;
subscriptionManager.addListener(subscription, callback);
synchronized (this) {
switch (state.get()) {
Expand Down Expand Up @@ -99,6 +101,8 @@ public void cancel() {
case ACTIVE: {
try {
subscriptionManager.unsubscribe(subscription);
subscriptionManager.removeListener(subscription, userCallback);
userCallback = null;
} finally {
state.set(CANCELED);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ public void addListener(Subscription subscription, AppSyncSubscriptionCall.Callb

}

@Override
public void removeListener(Subscription subscription, AppSyncSubscriptionCall.Callback callback) {

}

@Override
public void setStore(ApolloStore apolloStore) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,13 @@ <T> void subscribe(
*/
void addListener(Subscription subscription, AppSyncSubscriptionCall.Callback callback);

/**
* Removes the listener based on the subscription's operation (unique) id
* @param subscription The subscription for which callbacks will be triggered.
* @param callback The callback for messages received on the subscription connection.
*/
void removeListener(Subscription subscription, AppSyncSubscriptionCall.Callback callback);

/**
* Sets the store used for cache updates based on subscription responses.
* @param apolloStore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ class AppSyncOfflineMutationManager {
static final int MSG_CHECK = 200;
static final int MSG_DISCONNECT = 300;
private static final String TAG = AppSyncOfflineMutationManager.class.getSimpleName();
private Context mContext;
private NetworkUpdateHandler networkUpdateHandler;
private HandlerThread handlerThread;
private boolean shouldProcess;
Expand Down Expand Up @@ -174,18 +173,17 @@ public AppSyncOfflineMutationManager(Context context,
final Map<ScalarType, CustomTypeAdapter> customTypeAdapters,
final AppSyncMutationSqlCacheOperations mutationSqlCacheOperations,
final AppSyncCustomNetworkInvoker persistentMutationsNetworkInvoker) {
this.mContext = context;
handlerThread = new HandlerThread(TAG + "-AWSAppSyncOfflineMutationsHandlerThread");
handlerThread.start();
this.networkUpdateHandler = new NetworkUpdateHandler(handlerThread.getLooper());
this.networkInfoReceiver = new NetworkInfoReceiver(this.mContext, this.networkUpdateHandler);
this.networkInfoReceiver = new NetworkInfoReceiver(context, this.networkUpdateHandler);
this.inMemoryOfflineMutationManager = new InMemoryOfflineMutationManager();
persistentOfflineMutationManager = new PersistentOfflineMutationManager(mutationSqlCacheOperations,
persistentMutationsNetworkInvoker);
this.scalarTypeAdapters = new ScalarTypeAdapters(customTypeAdapters);
this.mutationSqlCacheOperations = mutationSqlCacheOperations;

mContext.getApplicationContext().registerReceiver(networkInfoReceiver, new IntentFilter(
context.getApplicationContext().registerReceiver(networkInfoReceiver, new IntentFilter(
ConnectivityManager.CONNECTIVITY_ACTION));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,14 @@ public Response intercept(Chain chain) throws IOException {

if (AuthMode.IAM.equals(authMode)) {
//get the aws credentials from provider.
AWSCredentials credentials = this.credentialsProvider.getCredentials();
try {
AWSCredentials credentials = this.credentialsProvider.getCredentials();

//sign the request
signer.sign(dr, credentials);
//sign the request
signer.sign(dr, credentials);
} catch (Exception e) {
throw new IOException("Failed to read credentials to sign the request.", e);
}
}

Request.Builder okReqBuilder = new Request.Builder();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ public class BasicCognitoUserPoolsAuthProvider implements CognitoUserPoolsAuthPr

public BasicCognitoUserPoolsAuthProvider(CognitoUserPool userPool) {
this.userPool = userPool;
fetchToken();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public <T> void subscribe(
@Nonnull final List<String> subbedTopics,
@Nonnull SubscriptionResponse response,
ResponseNormalizer<Map<String, Object>> mapResponseNormalizer) {
Log.d(TAG, "subscribe called");
Log.d(TAG, "subscribe called " + subbedTopics);

SubscriptionObject subscriptionObject = getSubscriptionObject(subscription);
subscriptionObject.subscription = subscription;
Expand Down Expand Up @@ -262,6 +262,7 @@ public void unsubscribe(@Nonnull Subscription<?, ?, ?> subscription) {
getSubscriptionObjects((String) topic).remove(subObject);
}
subObject.getTopics().clear();
subscriptionsById.remove(subObject);
}

@Override
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext.kotlin_version = '1.2.30'
ext.kotlin_version = '1.2.40'
ext.aws_version = VERSION_NAME
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
classpath 'com.android.tools.build:gradle:3.1.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

// NOTE: Do not place your application dependencies here; they belong
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ org.gradle.jvmargs=-Xmx1536m
org.gradle.parallel=true

GROUP=com.amazonaws
VERSION_NAME=2.6.19
VERSION_NAME=2.6.20

POM_URL=https://github.com/awslabs/aws-mobile-appsync-sdk-android
POM_SCM_URL=https://github.com/awslabs/aws-mobile-appsync-sdk-android
Expand Down
Empty file modified gradlew
100644 → 100755
Empty file.

0 comments on commit bf8ed98

Please sign in to comment.