[ContactsExchanger] updated ContactsExchanger sources
authorPiotr Dabrowski <p.dabrowski2@samsung.com>
Sat, 13 Jul 2013 11:40:39 +0000 (13:40 +0200)
committerPiotr Dabrowski <p.dabrowski2@samsung.com>
Sat, 13 Jul 2013 11:40:39 +0000 (13:40 +0200)
Change-Id: I8cb5ecd39004581e985bef0e4c4a54f6e9843299

index.html
js/app.js
js/app.nfc.js
js/app.ui.js

index 6741486..d687ef9 100644 (file)
                        <h1>Contacts exchanger</h1>
                </div>
 
-               <div data-role="content" id="content-start"></div>
+               <div data-role="content" id="content-start">
+                       <div id="contact-nfc-error" data-role="popup" class="center_title_1btn">
+                               <div class="ui-popup-title"><h1>Warning</h1></div>
+                       <div class="ui-popup-text">
+                               If you want to use "Contact Exchanger" you must agree to access
+                               Contacts and NFC by this application.
+                       </div>
+                       <div class="ui-popup-button-bg">
+                               <a data-role="button" data-rel="back" data-inline="true"
+                                       id="acceptWarning">OK</a>
+                       </div>
+                       </div>
+               </div>
        </div>
 
        <div id="choose" data-role="page" data-footer-exist="true">
index 124510f..b48f869 100644 (file)
--- 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);
                        }
                },
index 30aa4e0..a252e61 100644 (file)
                                this.nfcAdapter.setPowered(true, this.onPowerOn.bind(this), this.onPowerOnFails.bind(this));
                        } catch (e) {
                                console.error('startNFC problem', e);
+                               this.app.ui.showPopupWarning();
                        }
                },
 
index 52fb5a4..290c01a 100644 (file)
@@ -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 '<p class="defaultText">'
                                + 'Default card is not defined yet!<br/>'
@@ -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 {