diff options
Diffstat (limited to 'StoneIsland/platforms/ios/www/js')
| -rwxr-xr-x | StoneIsland/platforms/ios/www/js/lib/etc/push.js | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/StoneIsland/platforms/ios/www/js/lib/etc/push.js b/StoneIsland/platforms/ios/www/js/lib/etc/push.js index 1606199f..14236728 100755 --- a/StoneIsland/platforms/ios/www/js/lib/etc/push.js +++ b/StoneIsland/platforms/ios/www/js/lib/etc/push.js @@ -106,28 +106,39 @@ var push = (function(){ } push.got_push_notification = function(push_obj) { console.log('We received this push notification: ' + JSON.stringify(push_obj)); + window.zsazsa = 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 || push_obj.additionalData.url)) { app.intro.$alert.show().html("[ HUB UPDATED ]") } + else { + 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){ |
