Skip to content

Instantly share code, notes, and snippets.

View benbahrenburg's full-sized avatar

Ben Bahrenburg benbahrenburg

View GitHub Profile
@benbahrenburg
benbahrenburg / launch.js
Last active August 29, 2015 13:56
Custom Style
<activities>
<activity android:screenOrientation="portrait"
android:theme="@style/FullHeightDialog" url="Sections/quetiondialog.js"/>
</activities>
@benbahrenburg
benbahrenburg / gist:9e676e869236e3191afa
Created August 4, 2014 05:16
iOS 8 - Launch App Seettings
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
@benbahrenburg
benbahrenburg / index.md
Last active August 29, 2015 14:06
iOS 8 : Local Notification PR Description

Adding iOS8 Location Notification Permission Support to Titanium

Before you start, you must make the below changes to Ti SDK 3.4.0 or greater

This gist discusses the approach used to provide a PR for https://jira.appcelerator.org/browse/TC-4671 PR submitted here tidev/titanium-sdk#6025

In this gist we will provide step by step instructions and reasons for adding features to Titanium to allow developers to check iOS 8 the current UIUserNotificationSettings for the app. These are needed so the developer can determine if the proper UIUserNotificationType has been granted to their app.

To accomplish this, we first add an event listener to Ti.App.iOS called usernotificationsetting. This will fire when the app's [UIApplication sharedApplication] currentUserNotificationSettings is updated.

@benbahrenburg
benbahrenburg / app.js
Created September 14, 2014 02:29
TC-4715
//This is the app.js you can use for testing
var win = Titanium.UI.createWindow({
backgroundColor:'#fff',layout:'vertical'
});
var btnAuthorization = Titanium.UI.createButton({
title:'Authorization Check', left:25,right:25, top:80
});
win.add(btnAuthorization);
@benbahrenburg
benbahrenburg / read.js
Created November 8, 2014 23:50
Note Table - Read Script
function read(query, user, request) {
query.where({ userId: user.userId });
request.execute();
}
@benbahrenburg
benbahrenburg / delete.js
Last active August 29, 2015 14:08
Note Table - Delete Script
function del(id, user, request) {
var table = tables.getTable('notes');
table.where({
id: id, userId : user.userId
}).read({
success: delItems
});
function delItems(items) {
if (items.length > 0) {
@benbahrenburg
benbahrenburg / update.js
Last active August 29, 2015 14:08
Note Table - Update Script
function update(item, user, request) {
var table = tables.getTable('notes');
table.where({
id: item.id, userId : user.userId
}).read({
success: upsertItem
});
function upsertItem(items) {
@benbahrenburg
benbahrenburg / insert.js
Last active August 29, 2015 14:08
Note Table - Insert Script
function insert(item, user, request) {
var table = tables.getTable('notes');
table.where({
id: item.id,
userId : user.userId
}).read({
success: upsertItem
});
function upsertItem(items) {
@benbahrenburg
benbahrenburg / insert.js
Last active August 29, 2015 14:08
NoteEvents - Insert Script
function insert(item, user, request) {
var table = tables.getTable('noteEvents');
table.where({
id: item.id,
userId :item.userId
}).read({
success: upsertItem
});
@benbahrenburg
benbahrenburg / gist:154c9e16180bd04b9a2f
Last active August 29, 2015 14:08
NoteEvents - Update Script
function update(item, user, request) {
var table = tables.getTable('noteEvents');
table.where({
id: item.id,
userId : user.userId
}).read({
success: upsertItem
});