Last active
March 14, 2017 22:51
-
-
Save falkolab/807da29ec954fe742e25 to your computer and use it in GitHub Desktop.
Revisions
-
falkolab revised this gist
Mar 18, 2016 . 1 changed file with 38 additions and 37 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,55 +2,56 @@ exports.FIRST_LAUNCH_KEY = "app.firstlaunch"; //первый запуск приложения после установки var isFirstLaunch = Ti.App.Properties.getBool(exports.FIRST_LAUNCH_KEY, true); if (isFirstLaunch) Ti.App.Properties.setBool(exports.FIRST_LAUNCH_KEY, false); // Свежий запуск приложения (не повторный интент) var initialLaunchPerformed = false; _.extend(exports, Backbone.Events); exports.isFirstLaunch = function() { // да, именно из переменной, не из Properties return isFirstLaunch; }; exports.runApplication = function() { Ti.API.debug('runner.runApplication'); if (isFirstLaunch) Ti.API.debug("Первый запуск после установки!"); this.trigger('run', { source: this }); }; exports.isInitialLaunchPerformed = function() { return initialLaunchPerformed; }; if (OS_ANDROID) { (function attachResumeHandler() { /* Every Android application has a root activity that starts the application. For Titanium applications, the root activity displays the splash screen. When a backgrounded application is left inactive (for about 30 minutes or so), upon reopening the app Android kills off activities above the root activity. This reveals the splash screen activity, making it appear as if the application is hung. http://docs.appcelerator.com/platform/latest/#!/api/Titanium.Android.Activity */ var rootActivity = Ti.Android.currentActivity; var onResume = function onResume() { var runner = require('runner'); if (!initialLaunchPerformed) { initialLaunchPerformed = true; return; } runner.runApplication(); }; if (_.isFunction(rootActivity.onResume)) { Ti.API.warn("onResume handler already defined. It composed with handler from `runner`"); rootActivity.onResume = _.compose(rootActivity.onResume, onResume); } else { rootActivity.onResume = onResume; } })(); } -
falkolab revised this gist
Mar 12, 2016 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,6 @@ require('runner').on('run', function(evt) { // evt.source - runner module reference var hc = Alloy.CFG.homeController; // home window launch Alloy.createController(hc.name, hc.args).getView().open(); }); -
falkolab created this gist
Mar 12, 2016 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,5 @@ require('runner').on('run', function(evt) { // evt.source - runner module reference var hc = Alloy.CFG.homeController; Alloy.createController(hc.name, hc.args).getView().open(); }); This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1 @@ require('runner').runApplication(); This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1 @@ <Alloy><View/></Alloy> This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,56 @@ exports.FIRST_LAUNCH_KEY = "app.firstlaunch"; //первый запуск приложения после установки var isFirstLaunch = Ti.App.Properties.getBool(exports.FIRST_LAUNCH_KEY, true); if(isFirstLaunch) Ti.App.Properties.setBool(exports.FIRST_LAUNCH_KEY, false); // Свежий запуск приложения (не повторный интент) var initialLaunchPerformed = false; _.extend(exports, Backbone.Events); exports.isFirstLaunch = function() { // да, именно из переменной, не из Properties return isFirstLaunch; }; exports.runApplication = function() { Ti.API.debug('runner.runApplication'); if(isFirstLaunch) Ti.API.debug("Первый запуск после установки!"); this.trigger('run', {source: this}); if(require('runner').isFirstLaunch()) { this.trigger('firstlaunch'); } }; exports.isInitialLaunchPerformed = function() { return initialLaunchPerformed; }; (function attachResumeHandler() { /* Every Android application has a root activity that starts the application. For Titanium applications, the root activity displays the splash screen. When a backgrounded application is left inactive (for about 30 minutes or so), upon reopening the app Android kills off activities above the root activity. This reveals the splash screen activity, making it appear as if the application is hung. http://docs.appcelerator.com/platform/latest/#!/api/Titanium.Android.Activity */ var rootActivity = Ti.Android.currentActivity; var onResume = function onResume() { var runner = require('runner'); if (!runner.isInitialLaunchPerformed()) { initialLaunchPerformed = true; return; } runner.runApplication(); }; if (_.isFunction(rootActivity.onResume)) { Ti.API.warn("onResume handler already defined. It composed with handler from `runner`"); rootActivity.onResume = _.compose(rootActivity.onResume, onResume); } else { rootActivity.onResume = onResume; } })();