Support the native in-app-purchasing API's in Titanium.
var IAP = require('ti.iap');
var PRODUCT_IDENTIFIER = 'YOUR_PRODUCT_IDENTIFIER';| const asyncExec = require('util').promisify(require('child_process').exec); | |
| /** | |
| * Execute command line in a child process | |
| * @param {...String} args Commands | |
| * @return {String} | |
| */ | |
| async function exec (...args) { | |
| const { stdout, stderr } = await asyncExec(...args); |
| module.exports = { | |
| data: [ | |
| {"Name":"Demivee","Type":"Prospect","Phone":"1-(818)173-8443"}, | |
| {"Name":"Shufflester","Type":"Prospect","Phone":"93-(232)869-5557"}, | |
| {"Name":"Voonte","Type":"Customer","Phone":"62-(269)473-1186"}, | |
| {"Name":"Thoughtsphere","Type":"Prospect","Phone":"86-(902)994-3017"}, | |
| {"Name":"Zoonder","Type":"Customer","Phone":"1-(202)358-2758"}, | |
| {"Name":"Flashspan","Type":"Customer","Phone":"57-(126)114-4912"}, | |
| {"Name":"Yoveo","Type":"Customer","Phone":"593-(320)380-5127"}, |
| /* | |
| * function to check for all location services outcomes | |
| */ | |
| function requestLocationPermissions(authorizationType, callback) { | |
| // FIXME: Always returns false on Android 6 | |
| // https://jira.appcelerator.org/browse/TIMOB-23135 | |
| if (OS_IOS && !Ti.Geolocation.locationServicesEnabled) { | |
| return callback({ | |
| success : false, |
| var win = Titanium.UI.createWindow({ | |
| backgroundColor: "#ffffff", | |
| title: "win" | |
| }); | |
| // animations | |
| var animateLeft = Ti.UI.createAnimation({ | |
| left: -520, | |
| transform: Ti.UI.create2DMatrix({rotate: 60}), | |
| opacity: 0, |
| /** | |
| * token | |
| * claim = "registered" || "public" || "private" | |
| */ | |
| exports.decodeJWT = function(token, claim) { | |
| var base64Url; | |
| if (claim == "registered") { | |
| base64Url = token.split('.')[0]; | |
| } else if (claim == "private") { | |
| base64Url = token.split('.')[2]; |
| //var tiHelper = require('ti_helper'); | |
| /* | |
| * USAGE | |
| * tiHelper.currency(numberToFormat,0); | |
| */ | |
| exports.currency = function(number, decimals, decSymbol, thousSymbol) { //number, decimal places , decimal symobl (.), thousands separator (,) | |
| decimals = isNaN(decimals = Math.abs(decimals)) ? 2 : decimals, | |
| decSymbol = decSymbol == undefined ? "." : decSymbol, |
| // https://jira.appcelerator.org/browse/TIMOB-12291 | |
| exports.compareQueries = function () { | |
| testCommonWay(); | |
| testGroupConcat(); | |
| }; | |
| const TEST_QUERY_EXEC_COUNT = 50; | |
| function testCommonWay() { |
NOTE: This is out-dated, I suggest using https://github.com/dbankier/ltss instead.
This alloy.jmk adds support for using CSS-like @import "file.tss"; statements in Alloy TSS styles.
The idea for this came when discussing adding the option of including a CSS-like reset stylesheet in Alloy to make up for platform differences in (background)color, but also some good practices.
I think one of the key issues in this discussion is that there is no such thing as the base style for an app. iOS fans would like to reset to iOS-like styles, Android fans like to reset to theirs, flat UI fanatics would like everything minimalized and Bootstrap adepts will ask for a huge library of styles.
| var CXCallObserver = require('CallKit/CXCallObserver'); // Require native class from CallKit | |
| var CallDelegate = require('callDelegate'); // Require delegate class from app/lib/ (Alloy) or Resources/ (Classic) | |
| var myDelegate = new CallDelegate(); // Instantiate Delegate | |
| myDelegate.callChanged = function (callObserver, call) { | |
| if (call.hasConnected) { | |
| Ti.API.info('********** voice call connected **********\n'); | |
| } else if(call.hasEnded) { | |
| Ti.API.info('********** voice call disconnected **********/n'); | |
| } |