Permalink
Browse files

Merge branch 'develop'

  • Loading branch information...
2 parents 1368ea7 + ddf80c1 commit 0c83c94eff672e00583b90ba94035f6f703bf7d9 Harry Brundage committed Nov 18, 2010
View
@@ -3,3 +3,4 @@ build/iphone/*
build/android/*
build/**/*
*.swp
+*.swo
@@ -0,0 +1,12 @@
+_.extend Citrus, {
+ redirectifyLinks: (str) ->
+ str.replace(/href="(.+?)"/, 'href="citrus_redirect.html?to=$1"')
+
+ redirectableLink: (str) ->
+ matches = str.match /citrus_redirect.html\?to=(.+?)$/
+ if matches? && matches
+ return matches[1]
+ else
+ return false
+ }
+
@@ -0,0 +1,16 @@
+(function() {
+ _.extend(Citrus, {
+ redirectifyLinks: function(str) {
+ return str.replace(/href="(.+?)"/, 'href="citrus_redirect.html?to=$1"');
+ },
+ redirectableLink: function(str) {
+ var matches;
+ matches = str.match(/citrus_redirect.html\?to=(.+?)$/);
+ if ((typeof matches !== "undefined" && matches !== null) && matches) {
+ return matches[1];
+ } else {
+ return false;
+ }
+ }
+ });
+}).call(this);
@@ -0,0 +1 @@
+<b>Redirecting ... </b>
@@ -0,0 +1 @@
+<b>Redirecting ... </b>
@@ -5,6 +5,7 @@ Ti.include("/app/views/splash/actions/twitter_action_table_view_row.js")
Ti.include("/app/views/splash/actions/paypal_action_table_view_row.js")
Ti.include("/app/views/splash/actions/facebook_action_table_view_row.js")
Ti.include("/app/views/splash/actions/platform_action_table_view_row.js")
+Ti.include("/app/helpers/redirect_helper.js")
class SplashWindow extends Citrus.GenericWindow
# Sets up the loading indicator
@@ -67,7 +68,8 @@ class SplashWindow extends Citrus.GenericWindow
@win.add @retryButton
@retryButton.show()
- # Displays non Citrus decoded data as a simple qr code scanner.
+
+# Displays non Citrus decoded data as a simple qr code scanner.
displayDecodedData: (data) ->
unless @noticeLabel?
@noticeLabel = Ti.UI.createLabel {
@@ -81,15 +83,26 @@ class SplashWindow extends Citrus.GenericWindow
@win.add(@noticeLabel)
unless @dataView?
+
@dataView = Ti.UI.createWebView {
color:'#000'
top:150
height:300
width:300
- html: sc.helpers.makeClickable(data, {autolink: true, screenname: true})
+ url: 'app/views/splash/local_webview.html'
}
+
+ # Open links in Safari
+ @dataView.addEventListener "load", (e) =>
+ link = Citrus.redirectableLink(e.url)
+ if link
+ d "Opening redirected link #{link}"
+ Titanium.Platform.openURL(link)
+
@win.add(@dataView)
+ html = Citrus.redirectifyLinks(sc.helpers.makeClickable(data, {autolink: true, screenname: true}))
+ @dataView.html = html
@noticeLabel.show()
@dataView.show()
this.hideLoading()

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

0 comments on commit 0c83c94

Please sign in to comment.