summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xStoneIsland/platforms/android/assets/www/js/sdk/auth.js9
-rwxr-xr-xStoneIsland/platforms/ios/www/js/index.js9
-rwxr-xr-xStoneIsland/platforms/ios/www/js/lib/blogs/BlogView.js8
-rwxr-xr-xStoneIsland/platforms/ios/www/js/lib/cart/CartConfirm.js3
-rwxr-xr-xStoneIsland/platforms/ios/www/js/lib/cart/CartThanks.js2
-rwxr-xr-xStoneIsland/www/js/index.js9
-rwxr-xr-xStoneIsland/www/js/lib/blogs/BlogView.js8
-rwxr-xr-xStoneIsland/www/js/lib/cart/CartThanks.js2
8 files changed, 37 insertions, 13 deletions
diff --git a/StoneIsland/platforms/android/assets/www/js/sdk/auth.js b/StoneIsland/platforms/android/assets/www/js/sdk/auth.js
index 87ce60ea..6008ec31 100755
--- a/StoneIsland/platforms/android/assets/www/js/sdk/auth.js
+++ b/StoneIsland/platforms/android/assets/www/js/sdk/auth.js
@@ -30,7 +30,14 @@ var auth = sdk.auth = (function(){
sdk.account.checkin({
success: function(data){
fn && fn( auth.logged_in() )
- }
+ },
+ error: function(){
+ auth.clear_user(function(){
+ auth.clear_cart(function(){
+ fn && fn( auth.logged_in() )
+ })
+ })
+ },
})
auth.get_cart()
}
diff --git a/StoneIsland/platforms/ios/www/js/index.js b/StoneIsland/platforms/ios/www/js/index.js
index 63059c26..6bea75d0 100755
--- a/StoneIsland/platforms/ios/www/js/index.js
+++ b/StoneIsland/platforms/ios/www/js/index.js
@@ -73,7 +73,7 @@ var app = (function(){
cordova.plugins.Keyboard.disableScroll(true)
geo.fetch()
var image = new Image
- image.src = "/img/compass-logo.png"
+ image.src = "./img/compass-logo.png"
}
app.view = null
@@ -86,7 +86,11 @@ var app = (function(){
// }
if (navigator.onLine) {
- app.account.connect( app.router.launch.bind(app.router) )
+ app.account.connect()
+ app.blog.fetch(function(){
+ app.router.initial_route = "/intro"
+ app.router.launch()
+ })
}
else {
console.log(">> LAUNCHED WHILE OFFLINE")
@@ -97,7 +101,6 @@ var app = (function(){
push.init()
}
- app.did_finish_launching =
app.finished_launching = function(){
console.log(">> FINISHED LAUNCHING")
if (window.cordova) {
diff --git a/StoneIsland/platforms/ios/www/js/lib/blogs/BlogView.js b/StoneIsland/platforms/ios/www/js/lib/blogs/BlogView.js
index 64a65b09..06e051cb 100755
--- a/StoneIsland/platforms/ios/www/js/lib/blogs/BlogView.js
+++ b/StoneIsland/platforms/ios/www/js/lib/blogs/BlogView.js
@@ -4,15 +4,17 @@ var BlogView = View.extend({
loaded: false,
initialize: function(){
this.loader = new Loader ()
- this.fetch()
},
- fetch: function(){
+ fetch: function(fn){
$.ajax({
method: "GET",
// url: sdk.env == 'test' ? '/db.json' : "http://stone.sup.land/db.json",
url: "http://stone.sup.land/db.json",
- success: this.success.bind(this),
+ success: function(data){
+ this.success(data)
+ fn && fn()
+ }.bind(this),
cache: true,
})
},
diff --git a/StoneIsland/platforms/ios/www/js/lib/cart/CartConfirm.js b/StoneIsland/platforms/ios/www/js/lib/cart/CartConfirm.js
index e1bfb114..a82509af 100755
--- a/StoneIsland/platforms/ios/www/js/lib/cart/CartConfirm.js
+++ b/StoneIsland/platforms/ios/www/js/lib/cart/CartConfirm.js
@@ -128,9 +128,12 @@ var CartConfirm = FormView.extend({
},
save: function(){
+ app.curtain.show("loading")
promise(sdk.cart.finalize, {}).then(function(){
+ app.curtain.hide("loading")
app.router.go('cart/thanks')
}.bind(this)).error(function(data){
+ app.curtain.hide("loading")
// {"Header":{"StatusCode":403,"Description":"403 Forbidden"},"Error":{"Description":"GenericApiError:CartAlreadyClosed"}}
// {"Header":{"StatusCode":409,"Description":"304 NotModified"},"Error":{"Description":"FinalizationError:\\"Item has been removed from cart because it is no longer available.\\"\\n235"}}'
// {"Header":{"StatusCode":409,"Description":"304 NotModified"},"Error":{"Description":"FinalizationError:\"The cart cannot be empty.\"\n233"}}
diff --git a/StoneIsland/platforms/ios/www/js/lib/cart/CartThanks.js b/StoneIsland/platforms/ios/www/js/lib/cart/CartThanks.js
index 798fbbb3..03a45d4d 100755
--- a/StoneIsland/platforms/ios/www/js/lib/cart/CartThanks.js
+++ b/StoneIsland/platforms/ios/www/js/lib/cart/CartThanks.js
@@ -17,6 +17,8 @@ var CartThanks = View.extend({
app.footer.hide()
app.orders.loaded = false
+
+ sdk.auth.clear_cart()
},
ok: function(){
diff --git a/StoneIsland/www/js/index.js b/StoneIsland/www/js/index.js
index 63059c26..6bea75d0 100755
--- a/StoneIsland/www/js/index.js
+++ b/StoneIsland/www/js/index.js
@@ -73,7 +73,7 @@ var app = (function(){
cordova.plugins.Keyboard.disableScroll(true)
geo.fetch()
var image = new Image
- image.src = "/img/compass-logo.png"
+ image.src = "./img/compass-logo.png"
}
app.view = null
@@ -86,7 +86,11 @@ var app = (function(){
// }
if (navigator.onLine) {
- app.account.connect( app.router.launch.bind(app.router) )
+ app.account.connect()
+ app.blog.fetch(function(){
+ app.router.initial_route = "/intro"
+ app.router.launch()
+ })
}
else {
console.log(">> LAUNCHED WHILE OFFLINE")
@@ -97,7 +101,6 @@ var app = (function(){
push.init()
}
- app.did_finish_launching =
app.finished_launching = function(){
console.log(">> FINISHED LAUNCHING")
if (window.cordova) {
diff --git a/StoneIsland/www/js/lib/blogs/BlogView.js b/StoneIsland/www/js/lib/blogs/BlogView.js
index 64a65b09..06e051cb 100755
--- a/StoneIsland/www/js/lib/blogs/BlogView.js
+++ b/StoneIsland/www/js/lib/blogs/BlogView.js
@@ -4,15 +4,17 @@ var BlogView = View.extend({
loaded: false,
initialize: function(){
this.loader = new Loader ()
- this.fetch()
},
- fetch: function(){
+ fetch: function(fn){
$.ajax({
method: "GET",
// url: sdk.env == 'test' ? '/db.json' : "http://stone.sup.land/db.json",
url: "http://stone.sup.land/db.json",
- success: this.success.bind(this),
+ success: function(data){
+ this.success(data)
+ fn && fn()
+ }.bind(this),
cache: true,
})
},
diff --git a/StoneIsland/www/js/lib/cart/CartThanks.js b/StoneIsland/www/js/lib/cart/CartThanks.js
index 798fbbb3..03a45d4d 100755
--- a/StoneIsland/www/js/lib/cart/CartThanks.js
+++ b/StoneIsland/www/js/lib/cart/CartThanks.js
@@ -17,6 +17,8 @@ var CartThanks = View.extend({
app.footer.hide()
app.orders.loaded = false
+
+ sdk.auth.clear_cart()
},
ok: function(){