Skip to content

Instantly share code, notes, and snippets.

View hansemannn's full-sized avatar
🗺️

Hans Knöchel hansemannn

🗺️
View GitHub Profile
@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 / 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 / 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 / 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 / push-manager.js
Created October 15, 2019 15:28
Handle iOS push notifications in Appcelerator Titanium
import FirebaseMessaging from 'firebase.cloudmessaging';
export default class PushManager {
listenForPushNotifications() {
// Called when the Firebase token is ready
FirebaseMessaging.addEventListener('didRefreshRegistrationToken', event => {
const fcmToken = event.fcmToken;
// Update push token here …
@hansemannn
hansemannn / loader.js
Created May 28, 2019 11:41
A cross platform modal loading indicator to use in Appcelerator Titanium
import TiAnimation from 'ti.animation';
/**
* A loader class to show a modal loading indicator
* above the current context (even above modal).
*
* Author: Hans Knöchel
*
*/
export default class Loader {
@hansemannn
hansemannn / deep-linking-manager.js
Created May 20, 2019 10:06
Titanium Deep Linking Manager (iOS)
export default class DeepLinkingManager {
constructor () {
this.handledLinks = {};
this.activityType = 'io.lambus.app.universalLink';
const activity = Ti.App.iOS.createUserActivity({
activityType: this.activityType
});