summaryrefslogtreecommitdiff
path: root/StoneIsland/www/js/lib/etc/push.js
diff options
context:
space:
mode:
Diffstat (limited to 'StoneIsland/www/js/lib/etc/push.js')
-rwxr-xr-xStoneIsland/www/js/lib/etc/push.js31
1 files changed, 21 insertions, 10 deletions
diff --git a/StoneIsland/www/js/lib/etc/push.js b/StoneIsland/www/js/lib/etc/push.js
index 1606199f..00a2e839 100755
--- a/StoneIsland/www/js/lib/etc/push.js
+++ b/StoneIsland/www/js/lib/etc/push.js
@@ -105,29 +105,40 @@ var push = (function(){
return sdk.cms() + '/_services/push/' + key
}
push.got_push_notification = function(push_obj) {
- console.log('We received this push notification: ' + JSON.stringify(push_obj));
+ // console.log('We received this push notification: ' + JSON.stringify(push_obj));
+
app.blog.refresh()
+
+ push_obj.additionalData = push_obj.additionalData || {}
+
+ var is_hub = true
try {
- var is_hub = JSON.stringify(push_obj || {}).match(/hub/i)
- if (is_hub) {
- app.intro.$alert.show().html("[ HUB UPDATED ]")
- }
- else {
- auth.clear_cart()
- app.intro.$alert.show().html("[ STORE UPDATED ]")
- }
+ is_hub = JSON.stringify(push_obj || {}).match(/hub/i)
}
catch (e) {
+ }
+
+ if (is_hub) {
app.intro.$alert.show().html("[ HUB UPDATED ]")
}
+ else if (! push_obj.additionalData.url) {
+ auth.clear_cart()
+ app.intro.$alert.show().html("[ STORE UPDATED ]")
+ }
if (push_obj.additionalData.foreground === false) {
// TODO: route the user to the uri in push_obj
pushPlugin.finish(function(){}, function(){})
}
+ else if (push_obj.additionalData.url) {
+ app.router.go(push_obj.additionalData.url)
+ }
+ else if (is_hub) {
+ app.router.go("hub")
+ }
else {
- app.route("intro")
+ app.router.go("intro")
}
}
push.error = function(e){