From ef1bf69e33556f1c32d1e5fb83d66a8e4c018725 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Mon, 25 Jun 2018 11:17:31 +0300 Subject: [PATCH] [Mobile] Bug 37649 (add events for closing application by Back button) --- apps/documenteditor/mobile/app/controller/Main.js | 12 ++++++++++++ .../presentationeditor/mobile/app/controller/Main.js | 12 ++++++++++++ apps/spreadsheeteditor/mobile/app/controller/Main.js | 12 ++++++++++++ 3 files changed, 36 insertions(+) diff --git a/apps/documenteditor/mobile/app/controller/Main.js b/apps/documenteditor/mobile/app/controller/Main.js index eaf50a6ce..d9aafc98a 100644 --- a/apps/documenteditor/mobile/app/controller/Main.js +++ b/apps/documenteditor/mobile/app/controller/Main.js @@ -170,6 +170,18 @@ define([ Common.Gateway.on('showmessage', _.bind(me.onExternalMessage, me)); Common.Gateway.on('opendocument', _.bind(me.loadDocument, me)); Common.Gateway.appReady(); + + Common.Gateway.on('internalcommand', function(data) { + if (data.command=='hardBack') { + if ($('.modal-in').length>0) { + if ( !$(me.loadMask).hasClass('modal-in') ) + uiApp.closeModal(); + Common.Gateway.internalMessage('hardBack', false); + } else + Common.Gateway.internalMessage('hardBack', true); + } + }); + Common.Gateway.internalMessage('listenHardBack'); } }, diff --git a/apps/presentationeditor/mobile/app/controller/Main.js b/apps/presentationeditor/mobile/app/controller/Main.js index 5660cfcb7..6452b65dc 100644 --- a/apps/presentationeditor/mobile/app/controller/Main.js +++ b/apps/presentationeditor/mobile/app/controller/Main.js @@ -169,6 +169,18 @@ define([ Common.Gateway.on('showmessage', _.bind(me.onExternalMessage, me)); Common.Gateway.on('opendocument', _.bind(me.loadDocument, me)); Common.Gateway.appReady(); + + Common.Gateway.on('internalcommand', function(data) { + if (data.command=='hardBack') { + if ($('.modal-in').length>0) { + if ( !$(me.loadMask).hasClass('modal-in') ) + uiApp.closeModal(); + Common.Gateway.internalMessage('hardBack', false); + } else + Common.Gateway.internalMessage('hardBack', true); + } + }); + Common.Gateway.internalMessage('listenHardBack'); } me.initNames(); diff --git a/apps/spreadsheeteditor/mobile/app/controller/Main.js b/apps/spreadsheeteditor/mobile/app/controller/Main.js index d691cfe1b..5daeb9fb7 100644 --- a/apps/spreadsheeteditor/mobile/app/controller/Main.js +++ b/apps/spreadsheeteditor/mobile/app/controller/Main.js @@ -175,6 +175,18 @@ define([ Common.Gateway.on('showmessage', _.bind(me.onExternalMessage, me)); Common.Gateway.on('opendocument', _.bind(me.loadDocument, me)); Common.Gateway.appReady(); + + Common.Gateway.on('internalcommand', function(data) { + if (data.command=='hardBack') { + if ($('.modal-in').length>0) { + if ( !$(me.loadMask).hasClass('modal-in') ) + uiApp.closeModal(); + Common.Gateway.internalMessage('hardBack', false); + } else + Common.Gateway.internalMessage('hardBack', true); + } + }); + Common.Gateway.internalMessage('listenHardBack'); } },