summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xStoneIsland/platforms/ios/Stone Island.xcodeproj/project.xcworkspace/xcuserdata/user.xcuserdatad/UserInterfaceState.xcuserstatebin39869 -> 39869 bytes
-rwxr-xr-xStoneIsland/platforms/ios/www/js/index.js18
-rwxr-xr-xStoneIsland/platforms/ios/www/js/lib/blogs/BlogView.js5
-rwxr-xr-xStoneIsland/platforms/ios/www/js/lib/blogs/StoryView.js7
-rwxr-xr-xStoneIsland/platforms/ios/www/js/lib/etc/push.js33
-rwxr-xr-xStoneIsland/www/js/index.js18
-rwxr-xr-xStoneIsland/www/js/lib/blogs/BlogView.js5
-rwxr-xr-xStoneIsland/www/js/lib/blogs/StoryView.js7
-rwxr-xr-xStoneIsland/www/js/lib/etc/push.js33
9 files changed, 86 insertions, 40 deletions
diff --git a/StoneIsland/platforms/ios/Stone Island.xcodeproj/project.xcworkspace/xcuserdata/user.xcuserdatad/UserInterfaceState.xcuserstate b/StoneIsland/platforms/ios/Stone Island.xcodeproj/project.xcworkspace/xcuserdata/user.xcuserdatad/UserInterfaceState.xcuserstate
index 739ca125..c9fcaba4 100755
--- a/StoneIsland/platforms/ios/Stone Island.xcodeproj/project.xcworkspace/xcuserdata/user.xcuserdatad/UserInterfaceState.xcuserstate
+++ b/StoneIsland/platforms/ios/Stone Island.xcodeproj/project.xcworkspace/xcuserdata/user.xcuserdatad/UserInterfaceState.xcuserstate
Binary files differ
diff --git a/StoneIsland/platforms/ios/www/js/index.js b/StoneIsland/platforms/ios/www/js/index.js
index 0b3531dd..77f8a782 100755
--- a/StoneIsland/platforms/ios/www/js/index.js
+++ b/StoneIsland/platforms/ios/www/js/index.js
@@ -64,6 +64,8 @@ var app = (function(){
app.ready = function(){
if (window.cordova) {
+ document.addEventListener('pause', app.paused, false)
+ document.addEventListener('resume', app.resumed, false)
cordova.plugins.Keyboard.disableScroll(true)
geo.fetch()
}
@@ -74,12 +76,26 @@ var app = (function(){
// app.router.launch()
// }
// else {
- app.account.connect( app.router.launch.bind(app.router) )
+ push.init()
+ app.account.connect( app.router.launch.bind(app.router) )
// }
$("body").removeClass("loading")
}
+
+ var pause_time = 0
+ app.paused = function(){
+
+ }
+
+ app.resumed = function(){
+ if (! pause_time) return
+ if (Date.now() - pause_time > 60 * 60 * 1000) {
+ app.blog.refresh()
+ }
+ }
+
return app
})()
diff --git a/StoneIsland/platforms/ios/www/js/lib/blogs/BlogView.js b/StoneIsland/platforms/ios/www/js/lib/blogs/BlogView.js
index ffd09fe1..02491b32 100755
--- a/StoneIsland/platforms/ios/www/js/lib/blogs/BlogView.js
+++ b/StoneIsland/platforms/ios/www/js/lib/blogs/BlogView.js
@@ -17,6 +17,11 @@ var BlogView = View.extend({
})
},
+ refresh: function(){
+ this.loaded = false
+ this.fetch()
+ },
+
success: function(data){
if (this.loaded) return
diff --git a/StoneIsland/platforms/ios/www/js/lib/blogs/StoryView.js b/StoneIsland/platforms/ios/www/js/lib/blogs/StoryView.js
index 98cd330b..c2a9f4b4 100755
--- a/StoneIsland/platforms/ios/www/js/lib/blogs/StoryView.js
+++ b/StoneIsland/platforms/ios/www/js/lib/blogs/StoryView.js
@@ -26,7 +26,7 @@ var StoryView = ScrollableView.extend({
},
populate: function(data){
- if (this.loaded) { console.warn("populate called twice"); return }
+ if (this.loaded) {}
this.loaded = true
this.data = data
this.$loader.hide()
@@ -59,11 +59,10 @@ var StoryView = ScrollableView.extend({
this.$content.find("[data-id=" + id + "]").addClass("active")
var section = this.sections[id]
- var replace = this.$img
- // optional image transition.. ?
+ var $replace = this.$img
this.$img.fadeTo(110,0.65, function() {
- replace.attr("src", section.image.uri)
+ $replace.attr("src", section.image.uri)
}).fadeTo(130,1)
this.deferScrollToTop()
},
diff --git a/StoneIsland/platforms/ios/www/js/lib/etc/push.js b/StoneIsland/platforms/ios/www/js/lib/etc/push.js
index 15371247..557a718f 100755
--- a/StoneIsland/platforms/ios/www/js/lib/etc/push.js
+++ b/StoneIsland/platforms/ios/www/js/lib/etc/push.js
@@ -2,7 +2,9 @@ var push = (function(){
var appId
var clientKey
var push = { settings: {} }
+ var parsePlugin
push.init = function(){
+ parsePlugin = window.parsePlugin || { initialize: function(){} }
parsePlugin.initialize(appId, clientKey, push.did_initialize, push.error)
}
push.did_initialize = function() {
@@ -44,26 +46,27 @@ var push = (function(){
// }
// }, push.error)
push.got_push_notification = function(push_obj) {
- alert('We received this push notification: ' + JSON.stringify(push_obj));
- app.collection.loaded = false
- app.hub.loaded = false
+ // alert('We received this push notification: ' + JSON.stringify(push_obj));
+ app.blog.refresh()
+
+ try {
+ var is_hub = JSON.stringify(push_obj || {}).match(/hub/i)
+ if (is_hub) {
+ app.intro.$alert.show().html("[ HUB UPDATED ]")
+ }
+ else {
+ app.intro.$alert.show().html("[ STORE UPDATED ]")
+ }
+ }
+ catch (e) {
+ app.intro.$alert.show().html("[ HUB UPDATED ]")
+ }
+
if (push_obj.receivedInForeground === false) {
// TODO: route the user to the uri in push_obj
}
else {
app.route("intro")
- try {
- var is_hub = JSON.stringify(push_obj || {}).match(/hub/i)
- if (is_hub) {
- app.intro.$alert.show().html("[ HUB UPDATED ]")
- }
- else {
- app.intro.$alert.show().html("[ STORE UPDATED ]")
- }
- }
- catch (e) {
- app.intro.$alert.show().html("[ HUB UPDATED ]")
- }
}
}
push.error = function(e){
diff --git a/StoneIsland/www/js/index.js b/StoneIsland/www/js/index.js
index 0b3531dd..77f8a782 100755
--- a/StoneIsland/www/js/index.js
+++ b/StoneIsland/www/js/index.js
@@ -64,6 +64,8 @@ var app = (function(){
app.ready = function(){
if (window.cordova) {
+ document.addEventListener('pause', app.paused, false)
+ document.addEventListener('resume', app.resumed, false)
cordova.plugins.Keyboard.disableScroll(true)
geo.fetch()
}
@@ -74,12 +76,26 @@ var app = (function(){
// app.router.launch()
// }
// else {
- app.account.connect( app.router.launch.bind(app.router) )
+ push.init()
+ app.account.connect( app.router.launch.bind(app.router) )
// }
$("body").removeClass("loading")
}
+
+ var pause_time = 0
+ app.paused = function(){
+
+ }
+
+ app.resumed = function(){
+ if (! pause_time) return
+ if (Date.now() - pause_time > 60 * 60 * 1000) {
+ app.blog.refresh()
+ }
+ }
+
return app
})()
diff --git a/StoneIsland/www/js/lib/blogs/BlogView.js b/StoneIsland/www/js/lib/blogs/BlogView.js
index ffd09fe1..02491b32 100755
--- a/StoneIsland/www/js/lib/blogs/BlogView.js
+++ b/StoneIsland/www/js/lib/blogs/BlogView.js
@@ -17,6 +17,11 @@ var BlogView = View.extend({
})
},
+ refresh: function(){
+ this.loaded = false
+ this.fetch()
+ },
+
success: function(data){
if (this.loaded) return
diff --git a/StoneIsland/www/js/lib/blogs/StoryView.js b/StoneIsland/www/js/lib/blogs/StoryView.js
index 98cd330b..c2a9f4b4 100755
--- a/StoneIsland/www/js/lib/blogs/StoryView.js
+++ b/StoneIsland/www/js/lib/blogs/StoryView.js
@@ -26,7 +26,7 @@ var StoryView = ScrollableView.extend({
},
populate: function(data){
- if (this.loaded) { console.warn("populate called twice"); return }
+ if (this.loaded) {}
this.loaded = true
this.data = data
this.$loader.hide()
@@ -59,11 +59,10 @@ var StoryView = ScrollableView.extend({
this.$content.find("[data-id=" + id + "]").addClass("active")
var section = this.sections[id]
- var replace = this.$img
- // optional image transition.. ?
+ var $replace = this.$img
this.$img.fadeTo(110,0.65, function() {
- replace.attr("src", section.image.uri)
+ $replace.attr("src", section.image.uri)
}).fadeTo(130,1)
this.deferScrollToTop()
},
diff --git a/StoneIsland/www/js/lib/etc/push.js b/StoneIsland/www/js/lib/etc/push.js
index 15371247..557a718f 100755
--- a/StoneIsland/www/js/lib/etc/push.js
+++ b/StoneIsland/www/js/lib/etc/push.js
@@ -2,7 +2,9 @@ var push = (function(){
var appId
var clientKey
var push = { settings: {} }
+ var parsePlugin
push.init = function(){
+ parsePlugin = window.parsePlugin || { initialize: function(){} }
parsePlugin.initialize(appId, clientKey, push.did_initialize, push.error)
}
push.did_initialize = function() {
@@ -44,26 +46,27 @@ var push = (function(){
// }
// }, push.error)
push.got_push_notification = function(push_obj) {
- alert('We received this push notification: ' + JSON.stringify(push_obj));
- app.collection.loaded = false
- app.hub.loaded = false
+ // alert('We received this push notification: ' + JSON.stringify(push_obj));
+ app.blog.refresh()
+
+ try {
+ var is_hub = JSON.stringify(push_obj || {}).match(/hub/i)
+ if (is_hub) {
+ app.intro.$alert.show().html("[ HUB UPDATED ]")
+ }
+ else {
+ app.intro.$alert.show().html("[ STORE UPDATED ]")
+ }
+ }
+ catch (e) {
+ app.intro.$alert.show().html("[ HUB UPDATED ]")
+ }
+
if (push_obj.receivedInForeground === false) {
// TODO: route the user to the uri in push_obj
}
else {
app.route("intro")
- try {
- var is_hub = JSON.stringify(push_obj || {}).match(/hub/i)
- if (is_hub) {
- app.intro.$alert.show().html("[ HUB UPDATED ]")
- }
- else {
- app.intro.$alert.show().html("[ STORE UPDATED ]")
- }
- }
- catch (e) {
- app.intro.$alert.show().html("[ HUB UPDATED ]")
- }
}
}
push.error = function(e){