diff --git a/android/dist/ti.goosh-android-1.2.0.zip b/android/dist/ti.goosh-android-1.2.0.zip index 7ebd496..8191a05 100644 Binary files a/android/dist/ti.goosh-android-1.2.0.zip and b/android/dist/ti.goosh-android-1.2.0.zip differ diff --git a/android/dist/ti.goosh.jar b/android/dist/ti.goosh.jar index e8be23c..d1f9d9e 100644 Binary files a/android/dist/ti.goosh.jar and b/android/dist/ti.goosh.jar differ diff --git a/android/manifest b/android/manifest index 64e6257..786092c 100755 --- a/android/manifest +++ b/android/manifest @@ -2,12 +2,12 @@ # this is your module manifest and used by Titanium # during compilation, packaging, distribution, etc. # -version: 1.2.0 +version: 1.3.0 apiversion: 2 architectures: armeabi armeabi-v7a x86 description: ti.goosh -author: Flavio De Stefano -license: Specify your license +author: Flavio De Stefano, Ani Sinanaj +license: MIT copyright: Copyright (c) 2016 by Caffeina # these should not be edited diff --git a/android/src/ti/goosh/IntentService.java b/android/src/ti/goosh/IntentService.java index 2b7068a..d6e27b9 100755 --- a/android/src/ti/goosh/IntentService.java +++ b/android/src/ti/goosh/IntentService.java @@ -265,8 +265,118 @@ else if(vibrateJson.isJsonArray()) { Log.e(LCAT, "Lights exception: " + ex.getMessage()); } + // Ongoing + + try { + if(data.has("ongoing")) + { + JsonElement ongoingJson = data.get("ongoing"); + + if(ongoingJson.isJsonPrimitive()) + { + Boolean ongoing = ongoingJson.getAsBoolean(); + + builder.setOngoing(ongoing); + } + } + else + { + builder_defaults |= Notification.DEFAULT_LIGHTS; + } + } catch(Exception ex) { + Log.e(LCAT, "Ongoing exception: " + ex.getMessage()); + } + + // Group + + try { + if(data.has("group")) + { + JsonElement groupJson = data.get("group"); + + if(groupJson.isJsonPrimitive()) + { + String group = groupJson.getAsString(); + + builder.setGroup(group); + } + } + else + { + builder_defaults |= Notification.DEFAULT_LIGHTS; + } + } catch(Exception ex) { + Log.e(LCAT, "Group exception: " + ex.getMessage()); + } + + // GroupSummary + + try { + if(data.has("group_summary")) + { + JsonElement groupsumJson = data.get("group_summary"); + + if(groupsumJson.isJsonPrimitive()) + { + Boolean groupsum = groupsumJson.getAsBoolean(); + + builder.setGroupSummary(groupsum); + } + } + else + { + builder_defaults |= Notification.DEFAULT_LIGHTS; + } + } catch(Exception ex) { + Log.e(LCAT, "Group summary exception: " + ex.getMessage()); + } + + // When + + try { + if(data.has("when")) + { + JsonElement whenJson = data.get("when"); + + if(whenJson.isJsonPrimitive()) + { + int when = whenJson.getAsInt(); + + builder.setWhen(when); + } + } + else + { + builder_defaults |= Notification.DEFAULT_LIGHTS; + } + } catch(Exception ex) { + Log.e(LCAT, "When exception: " + ex.getMessage()); + } + + // Only alert once + + try { + if(data.has("only_alert_once")) + { + JsonElement oaoJson = data.get("only_alert_once"); + + if(oaoJson.isJsonPrimitive()) + { + Boolean oao = oaoJson.getAsBoolean(); + + builder.setOnlyAlertOnce(oao); + } + } + else + { + builder_defaults |= Notification.DEFAULT_LIGHTS; + } + } catch(Exception ex) { + Log.e(LCAT, "Only alert once exception: " + ex.getMessage()); + } + builder.setDefaults(builder_defaults); - + // Build // Tag diff --git a/android/src/ti/goosh/TiGooshModule.java b/android/src/ti/goosh/TiGooshModule.java index 582a500..9693408 100644 --- a/android/src/ti/goosh/TiGooshModule.java +++ b/android/src/ti/goosh/TiGooshModule.java @@ -31,6 +31,10 @@ import com.google.android.gms.common.ConnectionResult; import com.google.android.gms.common.GoogleApiAvailability; +import com.google.android.gms.gcm.GcmPubSub; +import com.google.android.gms.gcm.GoogleCloudMessaging; +import com.google.android.gms.iid.InstanceID; + @Kroll.module(name="TiGoosh", id="ti.goosh") public class TiGooshModule extends KrollModule {