Skip to content

Commit

Permalink
Merge pull request #41 from particle-iot/events_fix
Browse files Browse the repository at this point in the history
nullpointerexception on event unsubscription in EventsFragment fix
  • Loading branch information
CityVibes authored Mar 4, 2018
2 parents cf798ef + c3fd02c commit b5bfff7
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 7 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
2.1.2
======
* NullPointerException fix on event unsubscription in EventsFragment.

2.1.1
======
* NullPointerException fix on setup cancellation.
Expand Down
8 changes: 4 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ buildscript {
}

dependencies {
classpath 'io.fabric.tools:gradle:1.24.4'
classpath 'io.fabric.tools:gradle:1.25.1'
}
}

Expand All @@ -24,8 +24,8 @@ android {
applicationId 'io.particle.android.app'
minSdkVersion 15
targetSdkVersion 27
versionCode 51
versionName "2.1.1"
versionCode 52
versionName "2.1.2"

multiDexEnabled true
vectorDrawables.useSupportLibrary = true
Expand Down Expand Up @@ -67,7 +67,7 @@ dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')

compile 'io.particle:cloudsdk:0.4.8'
compile 'io.particle:devicesetup:0.5.1'
compile 'io.particle:devicesetup:0.5.2'

// FIXME: look into getting rid of this 3rd party button now that the support lib has a FAB.
// Support lib doesn't do the "speed dial" pattern off of FABs though, so that would have to be
Expand Down
12 changes: 9 additions & 3 deletions app/src/main/java/io/particle/android/sdk/ui/EventsFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,9 @@ public void onEvent(String eventName, ParticleEvent particleEvent) {
emptyView.post(() -> emptyView.setVisibility(View.GONE));
}
});
} catch (NullPointerException ignore) {
//failed to subscribe to events, minor issue
} catch (NullPointerException ex) {
//set not subscribed
subscribed = false;
}
return null;
}
Expand All @@ -204,7 +205,12 @@ private void stopEventSubscription() {
Async.executeAsync(device, new Async.ApiProcedure<ParticleDevice>() {
@Override
public Void callApi(@NonNull ParticleDevice particleDevice) throws ParticleCloudException, IOException {
device.unsubscribeFromEvents(subscriptionId);
try {
device.unsubscribeFromEvents(subscriptionId);
} catch (NullPointerException ignore) {
//set to still subscribed
subscribed = true;
}
return null;
}

Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/config.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>

<string name="mode_button_name">Setup button</string>
<string name="electron_setup_uri">https://setup.particle.io</string>
<drawable name="screen_background">@drawable/ic_trianglify_background</drawable>

Expand Down

0 comments on commit b5bfff7

Please sign in to comment.