View gist:4f7794ece60831c14182
1 2 3 4 5 6 7 8 9 10
 
BOOL supportDirExists; // Add class level variable
 
//Update to FilesystemModule.m
//https://github.com/appcelerator/titanium_mobile/blob/master/iphone/Classes/FilesystemModule.m#L132
-(NSString*)applicationSupportDirectory
{
if(!supportDirExists){
NSString *supportDir = [NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES) lastObject];
if ([[NSFileManager defaultManager] fileExistsAtPath:supportDir isDirectory:NULL]) {
View gist:d4efb4fc6a2de91b1ba8
1 2 3 4 5 6 7 8 9 10
private boolean deviceHasPasscodeEnabled()
{
String LOCKSCREEN_UTILS = "com.android.internal.widget.LockPatternUtils";
try
{
Class<?> lockUtilsClass = Class.forName(LOCKSCREEN_UTILS);
// "this" is a Context, in my case an Activity
Object lockUtils = lockUtilsClass.getConstructor(Context.class).newInstance(this);
 
Method method = lockUtilsClass.getMethod("getActivePasswordQuality");
View delete.js
1 2 3 4 5 6 7 8 9 10
function del(id, user, request) {
var table = tables.getTable('noteEvents');
table.where({
id: id, userId : user.userId
}).read({
success: delItems
});
 
function delItems(items) {
if (items.length > 0) {
View read.js
1 2 3 4
function read(query, user, request) {
query.where({ userId: user.userId });
request.execute();
}
View gist:154c9e16180bd04b9a2f
1 2 3 4 5 6 7 8 9
function update(item, user, request) {
var table = tables.getTable('noteEvents');
table.where({
id: item.id,
userId : user.userId
}).read({
success: upsertItem
});
View insert.js
1 2 3 4 5 6 7 8 9
function insert(item, user, request) {
var table = tables.getTable('noteEvents');
table.where({
id: item.id,
userId :item.userId
}).read({
success: upsertItem
});
View insert.js
1 2 3 4 5 6 7 8 9 10
function insert(item, user, request) {
var table = tables.getTable('notes');
table.where({
id: item.id,
userId : user.userId
}).read({
success: upsertItem
});
 
function upsertItem(items) {
View update.js
1 2 3 4 5 6 7 8 9 10
function update(item, user, request) {
 
var table = tables.getTable('notes');
table.where({
id: item.id, userId : user.userId
}).read({
success: upsertItem
});
function upsertItem(items) {
View delete.js
1 2 3 4 5 6 7 8 9 10
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) {
View read.js
1 2 3 4
function read(query, user, request) {
query.where({ userId: user.userId });
request.execute();
}
Something went wrong with that request. Please try again.