summaryrefslogtreecommitdiff
path: root/StoneIsland/platforms/ios/www/js/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'StoneIsland/platforms/ios/www/js/index.js')
-rwxr-xr-xStoneIsland/platforms/ios/www/js/index.js40
1 files changed, 33 insertions, 7 deletions
diff --git a/StoneIsland/platforms/ios/www/js/index.js b/StoneIsland/platforms/ios/www/js/index.js
index 4f1747ab..b112721d 100755
--- a/StoneIsland/platforms/ios/www/js/index.js
+++ b/StoneIsland/platforms/ios/www/js/index.js
@@ -1,7 +1,8 @@
var app = (function(){
var app = {}
- app.init = function(){
+ app.init = function(){
+ console.log("init")
sdk.init({ env: "production" })
@@ -63,6 +64,7 @@ var app = (function(){
}
app.ready = function(){
+ console.log(">> READY")
if (window.cordova) {
document.addEventListener('pause', app.paused, false)
document.addEventListener('resume', app.resumed, false)
@@ -74,13 +76,33 @@ var app = (function(){
app.view = null
app.router = new SiteRouter ()
-// if (sdk.env == "test") {
-// app.router.launch()
-// }
-// else {
+
+// if (sdk.env == "test") {
+// app.router.launch()
+// }
+// else {
+// }
+
+ if (navigator.onLine) {
+ app.account.connect( app.router.launch.bind(app.router) )
+ }
+ else {
+ console.log(">> LAUNCHED WHILE OFFLINE")
+ app.closed.showElement()
+ app.closed.setMessage("PLEASE GO ONLINE TO BROWSE THE STONE ISLAND STORE", "")
+ app.state.launched_while_offline = true
+ app.finished_launching()
+ }
+
push.init()
- app.account.connect( app.router.launch.bind(app.router) )
-// }
+ }
+
+ app.finished_launching = function(){
+ console.log(">> FINISHED LAUNCHING")
+ if (window.cordova) {
+ navigator.splashscreen.hide()
+ }
+ $("body").removeClass("loading")
}
var refresh_time = +Date.now()
@@ -96,6 +118,10 @@ var app = (function(){
app.online = function(){
console.log(">> ONLINE")
+ if (app.state.launched_while_offline) {
+ app.state.launched_while_offline = false
+ app.router.go("intro")
+ }
}
app.offline = function(){
console.log(">> OFFLINE")