Skip to content

Instantly share code, notes, and snippets.

View hansemannn's full-sized avatar
🗺️

Hans Knöchel hansemannn

🗺️
View GitHub Profile
@hansemannn
hansemannn / liveview-from-cli.md
Last active December 9, 2022 17:12
Use LiveView from the Titanium CLI (without Studio)
  1. Install LiveView globally:
npm i -g liveview
  1. Change the ~/.titanium/config.json to include the CLI hook (under paths -> hook):
{
	"user": { ... },
	"app": { ... },
	"cli": { ... },
@hansemannn
hansemannn / titanium.yml
Created September 14, 2022 20:29
Titanium Github Action (iOS + Android)
name: Build Titanium App
on:
push:
branches:
- '**'
tags-ignore: # Do not run if we push tags
- '**'
jobs:
@hansemannn
hansemannn / app.js
Created August 11, 2021 08:48
Titanium - iOS: Create a PDF from an image
import TiPDFMerge from 'ti.pdfmerge';
const win = Ti.UI.createWindow({
backgroundColor: '#fff'
});
const btn = Ti.UI.createButton({
title: 'Trigger'
});
@hansemannn
hansemannn / README.md
Last active June 27, 2021 18:41
Example of Ti.IAP on iOS

Titanium In-App-Purchasing

Support the native in-app-purchasing API's in Titanium.

Differences to Ti.StoreKit

  • Subscriptions can be verified server-side with the Apple REST API for improved security
  • More properties on the product:
    • discounts (Object with identifier, price, subscriptionPeriod, …)
    • introductoryPrice
@hansemannn
hansemannn / README.md
Created October 5, 2020 06:47
Titanium iOS In-App-Purchase / Storekit

Titanium In-App-Purchasing

Support the native in-app-purchasing API's in Titanium.

Example

var IAP = require('ti.iap');

var PRODUCT_IDENTIFIER = 'YOUR_PRODUCT_IDENTIFIER';
@hansemannn
hansemannn / example-ios.js
Created January 13, 2021 09:15
iOS In-App-Billing Module
var IAP = require('ti.iap');
var PRODUCT_IDENTIFIER = 'YOUR_PRODUCT_IDENTIFIER';
var SHARED_SECRET = 'YOUR_SHARED_SECRET';
var win = Ti.UI.createWindow({ backgroundColor: '#fff', title: 'IAP Demo' });
win.addEventListener('open', onOpen);
// Retrieve products info
var btn1 = Ti.UI.createButton({ title: 'Retrieve products info', top: 50 });
@hansemannn
hansemannn / app.js
Created September 25, 2020 09:24
Example of using the newest Stripe SDK for iOS/Android in Appcelerator Titanium (contact via @hans on TiSlack.org)
var Stripe = require('ti.stripe');
var win = Ti.UI.createWindow({
backgroundColor: '#fff',
layout: 'vertical'
});
win.addEventListener('open', initialize);
win.open();
@hansemannn
hansemannn / config-manager.js
Created August 21, 2020 11:22
Firebase remote config example for Axway Titanium
import TiFirebaseConfig from 'firebase.config';
export default class ConfigManager {
static fetch () {
return new Promise(resolve => {
const lastVersions = Ti.App.Properties.getList('kMyAppLastVersions', []);
const lastVersionLegacy = Ti.App.Properties.getString('lastVersion', null);
// Migrate prior updates
@hansemannn
hansemannn / CXCallObserver-example.js
Last active January 29, 2020 22:40
CXCallObserver in Hyperloop and Titanium
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');
}
@hansemannn
hansemannn / cropping-manager.js
Created March 14, 2019 11:04
An example of cropping images cross-platform on Titanium.
/**
* Crops a given image URL to an optional aspect ratop (square by default).
*
* Example:
*
* const image = await ImageCroppingManager.crop(myImageURL);
*
*/
export default class ImageCroppingManager {