Skip to content

Instantly share code, notes, and snippets.

@jtoth55
jtoth55 / OfflineQueue.js
Created February 6, 2014 18:49
Offline Queue
/*Offline Queue class which handles storing of offline data that needs to be posted to the api,
posting it once we come back online, retrying failed attempts to post the data, and chaining of posts for dependent calls*/
var _ = require('lib/common/3rdparty/underscore-module')._,
apiError = require('lib/common/api/ApiError'),
constants = require('lib/common/Constants'),
dataAccess = require('lib/common/data/DataAccess'),
enums = require('lib/common/Enums'),
log = require('lib/common/utility/Log'),
moment = require('lib/common/3rdparty/moment'),
@jtoth55
jtoth55 / app.js
Created September 30, 2013 19:06
var imageView;
function fireUpTheCamera() {
Titanium.Media.showCamera({
success : function(event) {
var cropRect = event.cropRect;
var image = event.media;
Ti.API.debug('Our type was: ' + event.mediaType);
@jtoth55
jtoth55 / app.js
Created September 30, 2013 18:52
titanium camera orientation issue
var win, table, row, cameraImage, image;
function openCamera() {
Ti.Media.showCamera({
success: function(event) {
if (event.mediaType === Ti.Media.MEDIA_TYPE_PHOTO) {
if(image) {
row.remove(image);
}
image = Ti.UI.createImageView({
[INFO] [api] GET call: https://api.telogis.com/mobilerest/mobilerestservice.svc/jobs?from=2013-09-25T04:00:00Z&to=2013-10-02T03:59:59Z&auth=c9a6fa1478a6719d42da59f58bf782a7
[WARN] [api] aborting GET call jobs?from=2013-09-25T04:00:00Z&to=2013-10-02T03:59:59Z due to window change from job-list to job-create
[INFO] [api] GET call: https://api.telogis.com/mobilerest/mobilerestservice.svc/geocode/USA/44%20yarmouth%20ln%2C%20north%20east%2C%20md?auth=c9a6fa1478a6719d42da59f58bf782a7
[WARN] [api] error: {"errorText":"Unable to GeoCode address"}
[WARN] [api] invoking error callback with message: Unable to GeoCode address. Please adjust and try again.
[INFO] [api] GET call: https://api.telogis.com/mobilerest/mobilerestservice.svc/geocode/USA/44%20yarmouth%20ln%2C%20north%20east%2C%20md%2021901?auth=c9a6fa1478a6719d42da59f58bf782a7
[WARN] [api] error: {"errorText":"Unable to GeoCode address"}
[WARN] [api] invoking error callback with message: Unable to GeoCode address. Please adjust and try again.
INFO] [api] GET call: https://api.telogis.com/mobilerest/mobilerestservice.svc/geocode/37.3324089050293,-122.03047180175781?auth=c9a6fa1478a6719d42da59f58bf782a7
[INFO] GET 200 result in 1149ms: [{"street":"","city":"","region":"","postalCode":"","lat":37.332408865237767,"lon":-122.03047123732992,"bearingFromStreet":null}]
[INFO] [api] POST call: https://api.telogis.com/mobilerest/mobilerestservice.svc/forms?auth=c9a6fa1478a6719d42da59f58bf782a7 with data: [{"template":"fbccb6f8ad4d40f5b647e3790a1c0236","values":"<instance name=\"Pre DVIR\" loc=\"37.3324089050293,-122.03047180175781\"> \r\n<text name=\"label\" id=\"81\">Pre Vehicle Inspection Report</text>\r\n<textbox name=\"Odometer reading\" id=\"79\" maxCharacters=\"500\">1353.99</textbox>\r\n<text name=\"label\" id=\"2\">Scan the code, please</text>\r\n<qrcode name=\"Front\" id=\"93\">Dfssdf</qrcode>\r\n<text name=\"label\" id=\"89\">Check indicates GOOD items:</text>\r\n<text name=\"label\" id=\"82\">Tractor and truck</text>\r\n<checkbox name=
INFO] stopping message reader
[INFO] starting message reader
[INFO] received new message from webview reader: "{\"type\":\"protocol\",\"data\":{\"version\":2},\"sender\":\"Compliance 1.5.2\"}"
[INFO] stopping login timeout
[INFO] protocol version support (webview: 2 / workplan: 2)
[INFO] sending message to hos web view: {"type":"protocol","data":{"version":2}}
[INFO] sending message to hos web view: {"type":"settings","data":{"useApiLive":true,"ruleType":"Federal","weeklyTime":"60","showAlerts":true,"useOilfield":true,"editEventsEnabled":true,"notesEnabled":true,"timeToViolationWarning":10,"showViolationOnStatusChange":true}}
[INFO] sending settings to hos web view: {"useApiLive":true,"ruleType":"Federal","weeklyTime":"60","showAlerts":true,"useOilfield":true,"editEventsEnabled":true,"notesEnabled":true,"timeToViolationWarning":10,"showViolationOnStatusChange":true}
[INFO] sending message to hos web view: {"type":"credentials","data":{"name":"qaatms:pgejustin","pass":"*"}
[INFO] sending credentials
@jtoth55
jtoth55 / NetworkChangeReceiver.java
Created August 27, 2013 20:38
NetworkChangeReceiver.java
package com.telogis.utils;
/**
* Created by kaga on 13Âπ¥8Êúà23Êó•.
*/
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.net.ConnectivityManager;
@jtoth55
jtoth55 / progress.js
Created August 11, 2013 17:56
Titanium Progress (Activity Indicator) Module
var navigation = require('navigation'),
utils = require('utils');
var indicator, win;
function create() {
win = navigation.getActiveWindow();
if(utils.ios) {
indicator = Ti.UI.createActivityIndicator({
color: '#ddd',
@jtoth55
jtoth55 / ModuleLoader.js
Created July 26, 2013 21:00
Compliance-Friendly Module Loader
if(typeof _ === 'undefined') {
_ = require('lib/common/3rdparty/underscore-module')._;
}
var modules = {};
exports.app = {}
exports.init = function (modulesList) {
modules = modulesList;
@jtoth55
jtoth55 / app.js
Created July 1, 2013 19:11
Tableviewrow height update fix
var win = Ti.UI.createWindow({ backgroundColor: "#fff" });
var table = Ti.UI.createTableView({ top: 0, bottom: 0, left: 0, right: 0 });
var rows = [];
var firstRow = Ti.UI.createTableViewRow({ height: '60dp', backgroundColor: 'Red', className: 'rowType1' });
firstRow.add(Ti.UI.createLabel({ text: 'Row 1' }));
firstRow.addEventListener('click', function() {
secondRow.height = (secondRow.height === '0dp' ? '60dp' : '0dp');