From: Piotr Dabrowski Date: Sat, 13 Jul 2013 11:40:39 +0000 (+0200) Subject: [ContactsExchanger] updated ContactsExchanger sources X-Git-Tag: 2.2_release~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=086523359a60210cfec900e75b5821dbd47f1f6f;p=samples%2Fweb%2FContactsExchanger.git [ContactsExchanger] updated ContactsExchanger sources Change-Id: I8cb5ecd39004581e985bef0e4c4a54f6e9843299 --- diff --git a/index.html b/index.html index 6741486..d687ef9 100644 --- a/index.html +++ b/index.html @@ -29,7 +29,19 @@

Contacts exchanger

-
+
+
+

Warning

+
+ If you want to use "Contact Exchanger" you must agree to access + Contacts and NFC by this application. +
+
+ OK +
+
+
diff --git a/js/app.js b/js/app.js index 124510f..b48f869 100644 --- a/js/app.js +++ b/js/app.js @@ -116,6 +116,9 @@ var app = null; this.getAddressBooksError.bind(this) ); } catch (e) { + if (e.name === "SecurityError") { + this.ui.showPopupWarning(); + } console.error('getAddressBooks() error: ' + e.message); } }, diff --git a/js/app.nfc.js b/js/app.nfc.js index 30aa4e0..a252e61 100644 --- a/js/app.nfc.js +++ b/js/app.nfc.js @@ -232,6 +232,7 @@ this.nfcAdapter.setPowered(true, this.onPowerOn.bind(this), this.onPowerOnFails.bind(this)); } catch (e) { console.error('startNFC problem', e); + this.app.ui.showPopupWarning(); } }, diff --git a/js/app.ui.js b/js/app.ui.js index 52fb5a4..290c01a 100644 --- a/js/app.ui.js +++ b/js/app.ui.js @@ -125,6 +125,12 @@ App.Ui = null; /** * @returns {string} */ + showPopupWarning: function ui_showPopupWarning(){ + setTimeout(function(){ + $("#contact-nfc-error").popup("open",{"positionTo":"window"}); + },500); + }, + getTemporaryBoxContentHtml: function ui_getTemporaryBoxContentHtml() { return '

' + 'Default card is not defined yet!
' @@ -540,6 +546,11 @@ App.Ui = null; self.verticalCenter($('#startBox')); }, 20); }); + $( "#contact-nfc-error" ).bind({ + popupafterclose: function(){ + tizen.application.getCurrentApplication().exit(); + } + }); document.addEventListener('tizenhwkey', function(e) { if (e.keyName == "back") { @@ -551,6 +562,14 @@ App.Ui = null; } }); + document.addEventListener('webkitvisibilitychange', function () { + if(document.webkitVisibilityState === "visible") { + if ($.mobile.activePage.attr('id') === "choose") { + $.mobile.activePage.trigger('pageshow'); + } + } + }); + $('#transfer').on('pageshow', function () { if (tizen.nfc.getDefaultAdapter().powered) { try {