diff --git a/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/generated/source/buildConfig/debug/com/example/hello/BuildConfig.java b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/generated/source/buildConfig/debug/com/example/hello/BuildConfig.java new file mode 100644 index 00000000..d17051c9 --- /dev/null +++ b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/generated/source/buildConfig/debug/com/example/hello/BuildConfig.java @@ -0,0 +1,13 @@ +/** + * Automatically generated file. DO NOT MODIFY + */ +package com.example.hello; + +public final class BuildConfig { + public static final boolean DEBUG = Boolean.parseBoolean("true"); + public static final String APPLICATION_ID = "com.example.hello"; + public static final String BUILD_TYPE = "debug"; + public static final String FLAVOR = ""; + public static final int VERSION_CODE = 10000; + public static final String VERSION_NAME = "1.0.0"; +} diff --git a/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/generated/source/r/debug/com/example/hello/R.java b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/generated/source/r/debug/com/example/hello/R.java new file mode 100644 index 00000000..7a297a43 --- /dev/null +++ b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/generated/source/r/debug/com/example/hello/R.java @@ -0,0 +1,246 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * aapt tool from the resource data it found. It + * should not be modified by hand. + */ + +package com.example.hello; + +public final class R { + public static final class array { + public static final int country_codes=0x7f080000; + } + public static final class attr { + } + public static final class color { + public static final int contents_text=0x7f090000; + public static final int encode_view=0x7f090001; + public static final int possible_result_points=0x7f090002; + public static final int result_minor_text=0x7f090003; + public static final int result_points=0x7f090004; + public static final int result_text=0x7f090005; + public static final int result_view=0x7f090006; + public static final int status_text=0x7f090007; + public static final int transparent=0x7f090008; + public static final int viewfinder_laser=0x7f090009; + public static final int viewfinder_mask=0x7f09000a; + } + public static final class dimen { + public static final int half_padding=0x7f0a0000; + public static final int standard_padding=0x7f0a0001; + } + public static final class drawable { + public static final int flashbuttonoff=0x7f020000; + public static final int flashbuttonon=0x7f020001; + public static final int ic_action_next_item=0x7f020002; + public static final int ic_action_previous_item=0x7f020003; + public static final int ic_action_remove=0x7f020004; + public static final int launcher_icon=0x7f020005; + public static final int overlay_mw=0x7f020006; + public static final int screen=0x7f020007; + public static final int share_via_barcode=0x7f020008; + public static final int shopper_icon=0x7f020009; + public static final int zoom=0x7f02000a; + } + public static final class id { + public static final int RelativeLayout1=0x7f0b001d; + public static final int back_button=0x7f0b0019; + public static final int barcode_image_view=0x7f0b000c; + public static final int bookmark_title=0x7f0b0007; + public static final int bookmark_url=0x7f0b0008; + public static final int contents_supplement_text_view=0x7f0b0013; + public static final int contents_text_view=0x7f0b0012; + public static final int decode=0x7f0b0000; + public static final int decode_failed=0x7f0b0001; + public static final int decode_succeeded=0x7f0b0002; + public static final int done_button=0x7f0b001a; + public static final int flashButton=0x7f0b001f; + public static final int format_text_view=0x7f0b000d; + public static final int help_contents=0x7f0b0018; + public static final int history_detail=0x7f0b001c; + public static final int history_title=0x7f0b001b; + public static final int image_view=0x7f0b0017; + public static final int launch_product_query=0x7f0b0003; + public static final int menu_history_clear_text=0x7f0b002c; + public static final int menu_history_send=0x7f0b002b; + public static final int meta_text_view=0x7f0b0011; + public static final int meta_text_view_label=0x7f0b0010; + public static final int overlayImage=0x7f0b001e; + public static final int page_number_view=0x7f0b0024; + public static final int preview_view=0x7f0b0009; + public static final int query_button=0x7f0b0022; + public static final int query_text_view=0x7f0b0021; + public static final int quit=0x7f0b0004; + public static final int restart_preview=0x7f0b0005; + public static final int result_button_view=0x7f0b0014; + public static final int result_list_view=0x7f0b0023; + public static final int result_view=0x7f0b000b; + public static final int return_scan_result=0x7f0b0006; + public static final int share_app_button=0x7f0b0026; + public static final int share_bookmark_button=0x7f0b0027; + public static final int share_clipboard_button=0x7f0b0029; + public static final int share_contact_button=0x7f0b0028; + public static final int share_text_view=0x7f0b002a; + public static final int shopper_button=0x7f0b0015; + public static final int snippet_view=0x7f0b0025; + public static final int status_view=0x7f0b0016; + public static final int time_text_view=0x7f0b000f; + public static final int type_text_view=0x7f0b000e; + public static final int viewfinder_view=0x7f0b000a; + public static final int zoomButton=0x7f0b0020; + } + public static final class layout { + public static final int bookmark_picker_list_item=0x7f040000; + public static final int capture=0x7f040001; + public static final int encode=0x7f040002; + public static final int help=0x7f040003; + public static final int history_list_item=0x7f040004; + public static final int scanner=0x7f040005; + public static final int search_book_contents=0x7f040006; + public static final int search_book_contents_header=0x7f040007; + public static final int search_book_contents_list_item=0x7f040008; + public static final int share=0x7f040009; + } + public static final class menu { + public static final int capture=0x7f0c0000; + public static final int encode=0x7f0c0001; + public static final int history=0x7f0c0002; + } + public static final class mipmap { + public static final int icon=0x7f030000; + } + public static final class raw { + public static final int beep=0x7f060000; + } + public static final class string { + public static final int activity_name=0x7f070078; + public static final int app_name=0x7f070079; + public static final int app_picker_name=0x7f070000; + public static final int bookmark_picker_name=0x7f070001; + public static final int button_add_calendar=0x7f070002; + public static final int button_add_contact=0x7f070003; + public static final int button_back=0x7f070004; + public static final int button_book_search=0x7f070005; + public static final int button_cancel=0x7f070006; + public static final int button_custom_product_search=0x7f070007; + public static final int button_dial=0x7f070008; + public static final int button_done=0x7f070009; + public static final int button_email=0x7f07000a; + public static final int button_get_directions=0x7f07000b; + public static final int button_google_shopper=0x7f07000c; + public static final int button_mms=0x7f07000d; + public static final int button_ok=0x7f07000e; + public static final int button_open_browser=0x7f07000f; + public static final int button_product_search=0x7f070010; + public static final int button_search_book_contents=0x7f070011; + public static final int button_share_app=0x7f070012; + public static final int button_share_bookmark=0x7f070013; + public static final int button_share_by_email=0x7f070014; + public static final int button_share_by_sms=0x7f070015; + public static final int button_share_clipboard=0x7f070016; + public static final int button_share_contact=0x7f070017; + public static final int button_show_map=0x7f070018; + public static final int button_sms=0x7f070019; + public static final int button_web_search=0x7f07001a; + public static final int button_wifi=0x7f07001b; + public static final int contents_contact=0x7f07001c; + public static final int contents_email=0x7f07001d; + public static final int contents_location=0x7f07001e; + public static final int contents_phone=0x7f07001f; + public static final int contents_sms=0x7f070020; + public static final int contents_text=0x7f070021; + public static final int history_clear_one_history_text=0x7f070022; + public static final int history_clear_text=0x7f070023; + public static final int history_email_title=0x7f070024; + public static final int history_empty=0x7f070025; + public static final int history_empty_detail=0x7f070026; + public static final int history_send=0x7f070027; + public static final int history_title=0x7f070028; + public static final int launcher_name=0x7f07007a; + public static final int menu_encode_mecard=0x7f070029; + public static final int menu_encode_vcard=0x7f07002a; + public static final int menu_help=0x7f07002b; + public static final int menu_history=0x7f07002c; + public static final int menu_settings=0x7f07002d; + public static final int menu_share=0x7f07002e; + public static final int msg_bulk_mode_scanned=0x7f07002f; + public static final int msg_camera_framework_bug=0x7f070030; + public static final int msg_default_format=0x7f070031; + public static final int msg_default_meta=0x7f070032; + public static final int msg_default_mms_subject=0x7f070033; + public static final int msg_default_status=0x7f070034; + public static final int msg_default_time=0x7f070035; + public static final int msg_default_type=0x7f070036; + public static final int msg_encode_contents_failed=0x7f070037; + public static final int msg_google_books=0x7f070038; + public static final int msg_google_product=0x7f070039; + public static final int msg_google_shopper_missing=0x7f07003a; + public static final int msg_install_google_shopper=0x7f07003b; + public static final int msg_intent_failed=0x7f07003c; + public static final int msg_redirect=0x7f07003d; + public static final int msg_sbc_book_not_searchable=0x7f07003e; + public static final int msg_sbc_failed=0x7f07003f; + public static final int msg_sbc_no_page_returned=0x7f070040; + public static final int msg_sbc_page=0x7f070041; + public static final int msg_sbc_results=0x7f070042; + public static final int msg_sbc_searching_book=0x7f070043; + public static final int msg_sbc_snippet_unavailable=0x7f070044; + public static final int msg_sbc_unknown_page=0x7f070045; + public static final int msg_share_explanation=0x7f070046; + public static final int msg_share_subject_line=0x7f070047; + public static final int msg_share_text=0x7f070048; + public static final int msg_sure=0x7f070049; + public static final int msg_unmount_usb=0x7f07004a; + public static final int preferences_actions_title=0x7f07004b; + public static final int preferences_auto_focus_title=0x7f07004c; + public static final int preferences_bulk_mode_summary=0x7f07004d; + public static final int preferences_bulk_mode_title=0x7f07004e; + public static final int preferences_copy_to_clipboard_title=0x7f07004f; + public static final int preferences_custom_product_search_summary=0x7f070050; + public static final int preferences_custom_product_search_title=0x7f070051; + public static final int preferences_decode_1D_title=0x7f070052; + public static final int preferences_decode_Data_Matrix_title=0x7f070053; + public static final int preferences_decode_QR_title=0x7f070054; + public static final int preferences_device_bug_workarounds_title=0x7f070055; + public static final int preferences_disable_continuous_focus_summary=0x7f070056; + public static final int preferences_disable_continuous_focus_title=0x7f070057; + public static final int preferences_disable_exposure_title=0x7f070058; + public static final int preferences_front_light_summary=0x7f070059; + public static final int preferences_front_light_title=0x7f07005a; + public static final int preferences_general_title=0x7f07005b; + public static final int preferences_name=0x7f07005c; + public static final int preferences_play_beep_title=0x7f07005d; + public static final int preferences_remember_duplicates_summary=0x7f07005e; + public static final int preferences_remember_duplicates_title=0x7f07005f; + public static final int preferences_result_title=0x7f070060; + public static final int preferences_scanning_title=0x7f070061; + public static final int preferences_search_country=0x7f070062; + public static final int preferences_supplemental_summary=0x7f070063; + public static final int preferences_supplemental_title=0x7f070064; + public static final int preferences_try_bsplus=0x7f070065; + public static final int preferences_try_bsplus_summary=0x7f070066; + public static final int preferences_vibrate_title=0x7f070067; + public static final int result_address_book=0x7f070068; + public static final int result_calendar=0x7f070069; + public static final int result_email_address=0x7f07006a; + public static final int result_geo=0x7f07006b; + public static final int result_isbn=0x7f07006c; + public static final int result_product=0x7f07006d; + public static final int result_sms=0x7f07006e; + public static final int result_tel=0x7f07006f; + public static final int result_text=0x7f070070; + public static final int result_uri=0x7f070071; + public static final int result_wifi=0x7f070072; + public static final int sbc_name=0x7f070073; + public static final int share_name=0x7f070074; + public static final int wifi_changing_network=0x7f070075; + public static final int wifi_ssid_label=0x7f070076; + public static final int wifi_type_label=0x7f070077; + } + public static final class xml { + public static final int config=0x7f050000; + public static final int preferences=0x7f050001; + public static final int provider_paths=0x7f050002; + } +} diff --git a/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/cordova-js-src/android/nativeapiprovider.js b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/cordova-js-src/android/nativeapiprovider.js new file mode 100755 index 00000000..2e9aa67b --- /dev/null +++ b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/cordova-js-src/android/nativeapiprovider.js @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +*/ + +/** + * Exports the ExposedJsApi.java object if available, otherwise exports the PromptBasedNativeApi. + */ + +var nativeApi = this._cordovaNative || require('cordova/android/promptbasednativeapi'); +var currentApi = nativeApi; + +module.exports = { + get: function() { return currentApi; }, + setPreferPrompt: function(value) { + currentApi = value ? require('cordova/android/promptbasednativeapi') : nativeApi; + }, + // Used only by tests. + set: function(value) { + currentApi = value; + } +}; diff --git a/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/cordova-js-src/android/promptbasednativeapi.js b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/cordova-js-src/android/promptbasednativeapi.js new file mode 100755 index 00000000..f7fb6bc7 --- /dev/null +++ b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/cordova-js-src/android/promptbasednativeapi.js @@ -0,0 +1,35 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +*/ + +/** + * Implements the API of ExposedJsApi.java, but uses prompt() to communicate. + * This is used pre-JellyBean, where addJavascriptInterface() is disabled. + */ + +module.exports = { + exec: function(bridgeSecret, service, action, callbackId, argsJson) { + return prompt(argsJson, 'gap:'+JSON.stringify([bridgeSecret, service, action, callbackId])); + }, + setNativeToJsBridgeMode: function(bridgeSecret, value) { + prompt(value, 'gap_bridge_mode:' + bridgeSecret); + }, + retrieveJsMessages: function(bridgeSecret, fromOnlineEvent) { + return prompt(+fromOnlineEvent, 'gap_poll:' + bridgeSecret); + } +}; diff --git a/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/cordova-js-src/exec.js b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/cordova-js-src/exec.js new file mode 100755 index 00000000..f73d87a1 --- /dev/null +++ b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/cordova-js-src/exec.js @@ -0,0 +1,297 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * +*/ + +/** + * Execute a cordova command. It is up to the native side whether this action + * is synchronous or asynchronous. The native side can return: + * Synchronous: PluginResult object as a JSON string + * Asynchronous: Empty string "" + * If async, the native side will cordova.callbackSuccess or cordova.callbackError, + * depending upon the result of the action. + * + * @param {Function} success The success callback + * @param {Function} fail The fail callback + * @param {String} service The name of the service to use + * @param {String} action Action to be run in cordova + * @param {String[]} [args] Zero or more arguments to pass to the method + */ +var cordova = require('cordova'), + nativeApiProvider = require('cordova/android/nativeapiprovider'), + utils = require('cordova/utils'), + base64 = require('cordova/base64'), + channel = require('cordova/channel'), + jsToNativeModes = { + PROMPT: 0, + JS_OBJECT: 1 + }, + nativeToJsModes = { + // Polls for messages using the JS->Native bridge. + POLLING: 0, + // For LOAD_URL to be viable, it would need to have a work-around for + // the bug where the soft-keyboard gets dismissed when a message is sent. + LOAD_URL: 1, + // For the ONLINE_EVENT to be viable, it would need to intercept all event + // listeners (both through addEventListener and window.ononline) as well + // as set the navigator property itself. + ONLINE_EVENT: 2, + EVAL_BRIDGE: 3 + }, + jsToNativeBridgeMode, // Set lazily. + nativeToJsBridgeMode = nativeToJsModes.EVAL_BRIDGE, + pollEnabled = false, + bridgeSecret = -1; + +var messagesFromNative = []; +var isProcessing = false; +var resolvedPromise = typeof Promise == 'undefined' ? null : Promise.resolve(); +var nextTick = resolvedPromise ? function(fn) { resolvedPromise.then(fn); } : function(fn) { setTimeout(fn); }; + +function androidExec(success, fail, service, action, args) { + if (bridgeSecret < 0) { + // If we ever catch this firing, we'll need to queue up exec()s + // and fire them once we get a secret. For now, I don't think + // it's possible for exec() to be called since plugins are parsed but + // not run until until after onNativeReady. + throw new Error('exec() called without bridgeSecret'); + } + // Set default bridge modes if they have not already been set. + // By default, we use the failsafe, since addJavascriptInterface breaks too often + if (jsToNativeBridgeMode === undefined) { + androidExec.setJsToNativeBridgeMode(jsToNativeModes.JS_OBJECT); + } + + // If args is not provided, default to an empty array + args = args || []; + + // Process any ArrayBuffers in the args into a string. + for (var i = 0; i < args.length; i++) { + if (utils.typeName(args[i]) == 'ArrayBuffer') { + args[i] = base64.fromArrayBuffer(args[i]); + } + } + + var callbackId = service + cordova.callbackId++, + argsJson = JSON.stringify(args); + if (success || fail) { + cordova.callbacks[callbackId] = {success:success, fail:fail}; + } + + var msgs = nativeApiProvider.get().exec(bridgeSecret, service, action, callbackId, argsJson); + // If argsJson was received by Java as null, try again with the PROMPT bridge mode. + // This happens in rare circumstances, such as when certain Unicode characters are passed over the bridge on a Galaxy S2. See CB-2666. + if (jsToNativeBridgeMode == jsToNativeModes.JS_OBJECT && msgs === "@Null arguments.") { + androidExec.setJsToNativeBridgeMode(jsToNativeModes.PROMPT); + androidExec(success, fail, service, action, args); + androidExec.setJsToNativeBridgeMode(jsToNativeModes.JS_OBJECT); + } else if (msgs) { + messagesFromNative.push(msgs); + // Always process async to avoid exceptions messing up stack. + nextTick(processMessages); + } +} + +androidExec.init = function() { + //CB-11828 + //This failsafe checks the version of Android and if it's Jellybean, it switches it to + //using the Online Event bridge for communicating from Native to JS + // + //It's ugly, but it's necessary. + var check = navigator.userAgent.toLowerCase().match(/android\s[0-9].[0-9]/); + var version_code = check && check[0].match(/4.[0-3].*/); + if (version_code != null && nativeToJsBridgeMode == nativeToJsModes.EVAL_BRIDGE) { + nativeToJsBridgeMode = nativeToJsModes.ONLINE_EVENT; + } + + bridgeSecret = +prompt('', 'gap_init:' + nativeToJsBridgeMode); + channel.onNativeReady.fire(); +}; + +function pollOnceFromOnlineEvent() { + pollOnce(true); +} + +function pollOnce(opt_fromOnlineEvent) { + if (bridgeSecret < 0) { + // This can happen when the NativeToJsMessageQueue resets the online state on page transitions. + // We know there's nothing to retrieve, so no need to poll. + return; + } + var msgs = nativeApiProvider.get().retrieveJsMessages(bridgeSecret, !!opt_fromOnlineEvent); + if (msgs) { + messagesFromNative.push(msgs); + // Process sync since we know we're already top-of-stack. + processMessages(); + } +} + +function pollingTimerFunc() { + if (pollEnabled) { + pollOnce(); + setTimeout(pollingTimerFunc, 50); + } +} + +function hookOnlineApis() { + function proxyEvent(e) { + cordova.fireWindowEvent(e.type); + } + // The network module takes care of firing online and offline events. + // It currently fires them only on document though, so we bridge them + // to window here (while first listening for exec()-releated online/offline + // events). + window.addEventListener('online', pollOnceFromOnlineEvent, false); + window.addEventListener('offline', pollOnceFromOnlineEvent, false); + cordova.addWindowEventHandler('online'); + cordova.addWindowEventHandler('offline'); + document.addEventListener('online', proxyEvent, false); + document.addEventListener('offline', proxyEvent, false); +} + +hookOnlineApis(); + +androidExec.jsToNativeModes = jsToNativeModes; +androidExec.nativeToJsModes = nativeToJsModes; + +androidExec.setJsToNativeBridgeMode = function(mode) { + if (mode == jsToNativeModes.JS_OBJECT && !window._cordovaNative) { + mode = jsToNativeModes.PROMPT; + } + nativeApiProvider.setPreferPrompt(mode == jsToNativeModes.PROMPT); + jsToNativeBridgeMode = mode; +}; + +androidExec.setNativeToJsBridgeMode = function(mode) { + if (mode == nativeToJsBridgeMode) { + return; + } + if (nativeToJsBridgeMode == nativeToJsModes.POLLING) { + pollEnabled = false; + } + + nativeToJsBridgeMode = mode; + // Tell the native side to switch modes. + // Otherwise, it will be set by androidExec.init() + if (bridgeSecret >= 0) { + nativeApiProvider.get().setNativeToJsBridgeMode(bridgeSecret, mode); + } + + if (mode == nativeToJsModes.POLLING) { + pollEnabled = true; + setTimeout(pollingTimerFunc, 1); + } +}; + +function buildPayload(payload, message) { + var payloadKind = message.charAt(0); + if (payloadKind == 's') { + payload.push(message.slice(1)); + } else if (payloadKind == 't') { + payload.push(true); + } else if (payloadKind == 'f') { + payload.push(false); + } else if (payloadKind == 'N') { + payload.push(null); + } else if (payloadKind == 'n') { + payload.push(+message.slice(1)); + } else if (payloadKind == 'A') { + var data = message.slice(1); + payload.push(base64.toArrayBuffer(data)); + } else if (payloadKind == 'S') { + payload.push(window.atob(message.slice(1))); + } else if (payloadKind == 'M') { + var multipartMessages = message.slice(1); + while (multipartMessages !== "") { + var spaceIdx = multipartMessages.indexOf(' '); + var msgLen = +multipartMessages.slice(0, spaceIdx); + var multipartMessage = multipartMessages.substr(spaceIdx + 1, msgLen); + multipartMessages = multipartMessages.slice(spaceIdx + msgLen + 1); + buildPayload(payload, multipartMessage); + } + } else { + payload.push(JSON.parse(message)); + } +} + +// Processes a single message, as encoded by NativeToJsMessageQueue.java. +function processMessage(message) { + var firstChar = message.charAt(0); + if (firstChar == 'J') { + // This is deprecated on the .java side. It doesn't work with CSP enabled. + eval(message.slice(1)); + } else if (firstChar == 'S' || firstChar == 'F') { + var success = firstChar == 'S'; + var keepCallback = message.charAt(1) == '1'; + var spaceIdx = message.indexOf(' ', 2); + var status = +message.slice(2, spaceIdx); + var nextSpaceIdx = message.indexOf(' ', spaceIdx + 1); + var callbackId = message.slice(spaceIdx + 1, nextSpaceIdx); + var payloadMessage = message.slice(nextSpaceIdx + 1); + var payload = []; + buildPayload(payload, payloadMessage); + cordova.callbackFromNative(callbackId, success, status, payload, keepCallback); + } else { + console.log("processMessage failed: invalid message: " + JSON.stringify(message)); + } +} + +function processMessages() { + // Check for the reentrant case. + if (isProcessing) { + return; + } + if (messagesFromNative.length === 0) { + return; + } + isProcessing = true; + try { + var msg = popMessageFromQueue(); + // The Java side can send a * message to indicate that it + // still has messages waiting to be retrieved. + if (msg == '*' && messagesFromNative.length === 0) { + nextTick(pollOnce); + return; + } + processMessage(msg); + } finally { + isProcessing = false; + if (messagesFromNative.length > 0) { + nextTick(processMessages); + } + } +} + +function popMessageFromQueue() { + var messageBatch = messagesFromNative.shift(); + if (messageBatch == '*') { + return '*'; + } + + var spaceIdx = messageBatch.indexOf(' '); + var msgLen = +messageBatch.slice(0, spaceIdx); + var message = messageBatch.substr(spaceIdx + 1, msgLen); + messageBatch = messageBatch.slice(spaceIdx + msgLen + 1); + if (messageBatch) { + messagesFromNative.unshift(messageBatch); + } + return message; +} + +module.exports = androidExec; diff --git a/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/cordova-js-src/platform.js b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/cordova-js-src/platform.js new file mode 100755 index 00000000..2bfd0247 --- /dev/null +++ b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/cordova-js-src/platform.js @@ -0,0 +1,125 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * +*/ + +// The last resume event that was received that had the result of a plugin call. +var lastResumeEvent = null; + +module.exports = { + id: 'android', + bootstrap: function() { + var channel = require('cordova/channel'), + cordova = require('cordova'), + exec = require('cordova/exec'), + modulemapper = require('cordova/modulemapper'); + + // Get the shared secret needed to use the bridge. + exec.init(); + + // TODO: Extract this as a proper plugin. + modulemapper.clobbers('cordova/plugin/android/app', 'navigator.app'); + + var APP_PLUGIN_NAME = Number(cordova.platformVersion.split('.')[0]) >= 4 ? 'CoreAndroid' : 'App'; + + // Inject a listener for the backbutton on the document. + var backButtonChannel = cordova.addDocumentEventHandler('backbutton'); + backButtonChannel.onHasSubscribersChange = function() { + // If we just attached the first handler or detached the last handler, + // let native know we need to override the back button. + exec(null, null, APP_PLUGIN_NAME, "overrideBackbutton", [this.numHandlers == 1]); + }; + + // Add hardware MENU and SEARCH button handlers + cordova.addDocumentEventHandler('menubutton'); + cordova.addDocumentEventHandler('searchbutton'); + + function bindButtonChannel(buttonName) { + // generic button bind used for volumeup/volumedown buttons + var volumeButtonChannel = cordova.addDocumentEventHandler(buttonName + 'button'); + volumeButtonChannel.onHasSubscribersChange = function() { + exec(null, null, APP_PLUGIN_NAME, "overrideButton", [buttonName, this.numHandlers == 1]); + }; + } + // Inject a listener for the volume buttons on the document. + bindButtonChannel('volumeup'); + bindButtonChannel('volumedown'); + + // The resume event is not "sticky", but it is possible that the event + // will contain the result of a plugin call. We need to ensure that the + // plugin result is delivered even after the event is fired (CB-10498) + var cordovaAddEventListener = document.addEventListener; + + document.addEventListener = function(evt, handler, capture) { + cordovaAddEventListener(evt, handler, capture); + + if (evt === 'resume' && lastResumeEvent) { + handler(lastResumeEvent); + } + }; + + // Let native code know we are all done on the JS side. + // Native code will then un-hide the WebView. + channel.onCordovaReady.subscribe(function() { + exec(onMessageFromNative, null, APP_PLUGIN_NAME, 'messageChannel', []); + exec(null, null, APP_PLUGIN_NAME, "show", []); + }); + } +}; + +function onMessageFromNative(msg) { + var cordova = require('cordova'); + var action = msg.action; + + switch (action) + { + // Button events + case 'backbutton': + case 'menubutton': + case 'searchbutton': + // App life cycle events + case 'pause': + // Volume events + case 'volumedownbutton': + case 'volumeupbutton': + cordova.fireDocumentEvent(action); + break; + case 'resume': + if(arguments.length > 1 && msg.pendingResult) { + if(arguments.length === 2) { + msg.pendingResult.result = arguments[1]; + } else { + // The plugin returned a multipart message + var res = []; + for(var i = 1; i < arguments.length; i++) { + res.push(arguments[i]); + } + msg.pendingResult.result = res; + } + + // Save the plugin result so that it can be delivered to the js + // even if they miss the initial firing of the event + lastResumeEvent = msg; + } + cordova.fireDocumentEvent(action, msg); + break; + default: + throw new Error('Unknown event action ' + action); + } +} diff --git a/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/cordova-js-src/plugin/android/app.js b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/cordova-js-src/plugin/android/app.js new file mode 100755 index 00000000..22cf96e8 --- /dev/null +++ b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/cordova-js-src/plugin/android/app.js @@ -0,0 +1,108 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * +*/ + +var exec = require('cordova/exec'); +var APP_PLUGIN_NAME = Number(require('cordova').platformVersion.split('.')[0]) >= 4 ? 'CoreAndroid' : 'App'; + +module.exports = { + /** + * Clear the resource cache. + */ + clearCache:function() { + exec(null, null, APP_PLUGIN_NAME, "clearCache", []); + }, + + /** + * Load the url into the webview or into new browser instance. + * + * @param url The URL to load + * @param props Properties that can be passed in to the activity: + * wait: int => wait msec before loading URL + * loadingDialog: "Title,Message" => display a native loading dialog + * loadUrlTimeoutValue: int => time in msec to wait before triggering a timeout error + * clearHistory: boolean => clear webview history (default=false) + * openExternal: boolean => open in a new browser (default=false) + * + * Example: + * navigator.app.loadUrl("http://server/myapp/index.html", {wait:2000, loadingDialog:"Wait,Loading App", loadUrlTimeoutValue: 60000}); + */ + loadUrl:function(url, props) { + exec(null, null, APP_PLUGIN_NAME, "loadUrl", [url, props]); + }, + + /** + * Cancel loadUrl that is waiting to be loaded. + */ + cancelLoadUrl:function() { + exec(null, null, APP_PLUGIN_NAME, "cancelLoadUrl", []); + }, + + /** + * Clear web history in this web view. + * Instead of BACK button loading the previous web page, it will exit the app. + */ + clearHistory:function() { + exec(null, null, APP_PLUGIN_NAME, "clearHistory", []); + }, + + /** + * Go to previous page displayed. + * This is the same as pressing the backbutton on Android device. + */ + backHistory:function() { + exec(null, null, APP_PLUGIN_NAME, "backHistory", []); + }, + + /** + * Override the default behavior of the Android back button. + * If overridden, when the back button is pressed, the "backKeyDown" JavaScript event will be fired. + * + * Note: The user should not have to call this method. Instead, when the user + * registers for the "backbutton" event, this is automatically done. + * + * @param override T=override, F=cancel override + */ + overrideBackbutton:function(override) { + exec(null, null, APP_PLUGIN_NAME, "overrideBackbutton", [override]); + }, + + /** + * Override the default behavior of the Android volume button. + * If overridden, when the volume button is pressed, the "volume[up|down]button" + * JavaScript event will be fired. + * + * Note: The user should not have to call this method. Instead, when the user + * registers for the "volume[up|down]button" event, this is automatically done. + * + * @param button volumeup, volumedown + * @param override T=override, F=cancel override + */ + overrideButton:function(button, override) { + exec(null, null, APP_PLUGIN_NAME, "overrideButton", [button, override]); + }, + + /** + * Exit and terminate the application. + */ + exitApp:function() { + return exec(null, null, APP_PLUGIN_NAME, "exitApp", []); + } +}; diff --git a/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/cordova.js b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/cordova.js new file mode 100755 index 00000000..bda7c3e5 --- /dev/null +++ b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/cordova.js @@ -0,0 +1,2208 @@ +// Platform: android +// 7ef9f9c03167a4dde4372d869472241b6816fee9 +/* + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +*/ +;(function() { +var PLATFORM_VERSION_BUILD_LABEL = '6.2.3'; +// file: src/scripts/require.js + +/*jshint -W079 */ +/*jshint -W020 */ + +var require, + define; + +(function () { + var modules = {}, + // Stack of moduleIds currently being built. + requireStack = [], + // Map of module ID -> index into requireStack of modules currently being built. + inProgressModules = {}, + SEPARATOR = "."; + + + + function build(module) { + var factory = module.factory, + localRequire = function (id) { + var resultantId = id; + //Its a relative path, so lop off the last portion and add the id (minus "./") + if (id.charAt(0) === ".") { + resultantId = module.id.slice(0, module.id.lastIndexOf(SEPARATOR)) + SEPARATOR + id.slice(2); + } + return require(resultantId); + }; + module.exports = {}; + delete module.factory; + factory(localRequire, module.exports, module); + return module.exports; + } + + require = function (id) { + if (!modules[id]) { + throw "module " + id + " not found"; + } else if (id in inProgressModules) { + var cycle = requireStack.slice(inProgressModules[id]).join('->') + '->' + id; + throw "Cycle in require graph: " + cycle; + } + if (modules[id].factory) { + try { + inProgressModules[id] = requireStack.length; + requireStack.push(id); + return build(modules[id]); + } finally { + delete inProgressModules[id]; + requireStack.pop(); + } + } + return modules[id].exports; + }; + + define = function (id, factory) { + if (modules[id]) { + throw "module " + id + " already defined"; + } + + modules[id] = { + id: id, + factory: factory + }; + }; + + define.remove = function (id) { + delete modules[id]; + }; + + define.moduleMap = modules; +})(); + +//Export for use in node +if (typeof module === "object" && typeof require === "function") { + module.exports.require = require; + module.exports.define = define; +} + +// file: src/cordova.js +define("cordova", function(require, exports, module) { + +// Workaround for Windows 10 in hosted environment case +// http://www.w3.org/html/wg/drafts/html/master/browsers.html#named-access-on-the-window-object +if (window.cordova && !(window.cordova instanceof HTMLElement)) { + throw new Error("cordova already defined"); +} + + +var channel = require('cordova/channel'); +var platform = require('cordova/platform'); + + +/** + * Intercept calls to addEventListener + removeEventListener and handle deviceready, + * resume, and pause events. + */ +var m_document_addEventListener = document.addEventListener; +var m_document_removeEventListener = document.removeEventListener; +var m_window_addEventListener = window.addEventListener; +var m_window_removeEventListener = window.removeEventListener; + +/** + * Houses custom event handlers to intercept on document + window event listeners. + */ +var documentEventHandlers = {}, + windowEventHandlers = {}; + +document.addEventListener = function(evt, handler, capture) { + var e = evt.toLowerCase(); + if (typeof documentEventHandlers[e] != 'undefined') { + documentEventHandlers[e].subscribe(handler); + } else { + m_document_addEventListener.call(document, evt, handler, capture); + } +}; + +window.addEventListener = function(evt, handler, capture) { + var e = evt.toLowerCase(); + if (typeof windowEventHandlers[e] != 'undefined') { + windowEventHandlers[e].subscribe(handler); + } else { + m_window_addEventListener.call(window, evt, handler, capture); + } +}; + +document.removeEventListener = function(evt, handler, capture) { + var e = evt.toLowerCase(); + // If unsubscribing from an event that is handled by a plugin + if (typeof documentEventHandlers[e] != "undefined") { + documentEventHandlers[e].unsubscribe(handler); + } else { + m_document_removeEventListener.call(document, evt, handler, capture); + } +}; + +window.removeEventListener = function(evt, handler, capture) { + var e = evt.toLowerCase(); + // If unsubscribing from an event that is handled by a plugin + if (typeof windowEventHandlers[e] != "undefined") { + windowEventHandlers[e].unsubscribe(handler); + } else { + m_window_removeEventListener.call(window, evt, handler, capture); + } +}; + +function createEvent(type, data) { + var event = document.createEvent('Events'); + event.initEvent(type, false, false); + if (data) { + for (var i in data) { + if (data.hasOwnProperty(i)) { + event[i] = data[i]; + } + } + } + return event; +} + + +var cordova = { + define:define, + require:require, + version:PLATFORM_VERSION_BUILD_LABEL, + platformVersion:PLATFORM_VERSION_BUILD_LABEL, + platformId:platform.id, + /** + * Methods to add/remove your own addEventListener hijacking on document + window. + */ + addWindowEventHandler:function(event) { + return (windowEventHandlers[event] = channel.create(event)); + }, + addStickyDocumentEventHandler:function(event) { + return (documentEventHandlers[event] = channel.createSticky(event)); + }, + addDocumentEventHandler:function(event) { + return (documentEventHandlers[event] = channel.create(event)); + }, + removeWindowEventHandler:function(event) { + delete windowEventHandlers[event]; + }, + removeDocumentEventHandler:function(event) { + delete documentEventHandlers[event]; + }, + /** + * Retrieve original event handlers that were replaced by Cordova + * + * @return object + */ + getOriginalHandlers: function() { + return {'document': {'addEventListener': m_document_addEventListener, 'removeEventListener': m_document_removeEventListener}, + 'window': {'addEventListener': m_window_addEventListener, 'removeEventListener': m_window_removeEventListener}}; + }, + /** + * Method to fire event from native code + * bNoDetach is required for events which cause an exception which needs to be caught in native code + */ + fireDocumentEvent: function(type, data, bNoDetach) { + var evt = createEvent(type, data); + if (typeof documentEventHandlers[type] != 'undefined') { + if( bNoDetach ) { + documentEventHandlers[type].fire(evt); + } + else { + setTimeout(function() { + // Fire deviceready on listeners that were registered before cordova.js was loaded. + if (type == 'deviceready') { + document.dispatchEvent(evt); + } + documentEventHandlers[type].fire(evt); + }, 0); + } + } else { + document.dispatchEvent(evt); + } + }, + fireWindowEvent: function(type, data) { + var evt = createEvent(type,data); + if (typeof windowEventHandlers[type] != 'undefined') { + setTimeout(function() { + windowEventHandlers[type].fire(evt); + }, 0); + } else { + window.dispatchEvent(evt); + } + }, + + /** + * Plugin callback mechanism. + */ + // Randomize the starting callbackId to avoid collisions after refreshing or navigating. + // This way, it's very unlikely that any new callback would get the same callbackId as an old callback. + callbackId: Math.floor(Math.random() * 2000000000), + callbacks: {}, + callbackStatus: { + NO_RESULT: 0, + OK: 1, + CLASS_NOT_FOUND_EXCEPTION: 2, + ILLEGAL_ACCESS_EXCEPTION: 3, + INSTANTIATION_EXCEPTION: 4, + MALFORMED_URL_EXCEPTION: 5, + IO_EXCEPTION: 6, + INVALID_ACTION: 7, + JSON_EXCEPTION: 8, + ERROR: 9 + }, + + /** + * Called by native code when returning successful result from an action. + */ + callbackSuccess: function(callbackId, args) { + cordova.callbackFromNative(callbackId, true, args.status, [args.message], args.keepCallback); + }, + + /** + * Called by native code when returning error result from an action. + */ + callbackError: function(callbackId, args) { + // TODO: Deprecate callbackSuccess and callbackError in favour of callbackFromNative. + // Derive success from status. + cordova.callbackFromNative(callbackId, false, args.status, [args.message], args.keepCallback); + }, + + /** + * Called by native code when returning the result from an action. + */ + callbackFromNative: function(callbackId, isSuccess, status, args, keepCallback) { + try { + var callback = cordova.callbacks[callbackId]; + if (callback) { + if (isSuccess && status == cordova.callbackStatus.OK) { + callback.success && callback.success.apply(null, args); + } else if (!isSuccess) { + callback.fail && callback.fail.apply(null, args); + } + /* + else + Note, this case is intentionally not caught. + this can happen if isSuccess is true, but callbackStatus is NO_RESULT + which is used to remove a callback from the list without calling the callbacks + typically keepCallback is false in this case + */ + // Clear callback if not expecting any more results + if (!keepCallback) { + delete cordova.callbacks[callbackId]; + } + } + } + catch (err) { + var msg = "Error in " + (isSuccess ? "Success" : "Error") + " callbackId: " + callbackId + " : " + err; + console && console.log && console.log(msg); + cordova.fireWindowEvent("cordovacallbackerror", { 'message': msg }); + throw err; + } + }, + addConstructor: function(func) { + channel.onCordovaReady.subscribe(function() { + try { + func(); + } catch(e) { + console.log("Failed to run constructor: " + e); + } + }); + } +}; + + +module.exports = cordova; + +}); + +// file: /Users/maj/src/cordova-android/cordova-js-src/android/nativeapiprovider.js +define("cordova/android/nativeapiprovider", function(require, exports, module) { + +/** + * Exports the ExposedJsApi.java object if available, otherwise exports the PromptBasedNativeApi. + */ + +var nativeApi = this._cordovaNative || require('cordova/android/promptbasednativeapi'); +var currentApi = nativeApi; + +module.exports = { + get: function() { return currentApi; }, + setPreferPrompt: function(value) { + currentApi = value ? require('cordova/android/promptbasednativeapi') : nativeApi; + }, + // Used only by tests. + set: function(value) { + currentApi = value; + } +}; + +}); + +// file: /Users/maj/src/cordova-android/cordova-js-src/android/promptbasednativeapi.js +define("cordova/android/promptbasednativeapi", function(require, exports, module) { + +/** + * Implements the API of ExposedJsApi.java, but uses prompt() to communicate. + * This is used pre-JellyBean, where addJavascriptInterface() is disabled. + */ + +module.exports = { + exec: function(bridgeSecret, service, action, callbackId, argsJson) { + return prompt(argsJson, 'gap:'+JSON.stringify([bridgeSecret, service, action, callbackId])); + }, + setNativeToJsBridgeMode: function(bridgeSecret, value) { + prompt(value, 'gap_bridge_mode:' + bridgeSecret); + }, + retrieveJsMessages: function(bridgeSecret, fromOnlineEvent) { + return prompt(+fromOnlineEvent, 'gap_poll:' + bridgeSecret); + } +}; + +}); + +// file: src/common/argscheck.js +define("cordova/argscheck", function(require, exports, module) { + +var utils = require('cordova/utils'); + +var moduleExports = module.exports; + +var typeMap = { + 'A': 'Array', + 'D': 'Date', + 'N': 'Number', + 'S': 'String', + 'F': 'Function', + 'O': 'Object' +}; + +function extractParamName(callee, argIndex) { + return (/.*?\((.*?)\)/).exec(callee)[1].split(', ')[argIndex]; +} + +function checkArgs(spec, functionName, args, opt_callee) { + if (!moduleExports.enableChecks) { + return; + } + var errMsg = null; + var typeName; + for (var i = 0; i < spec.length; ++i) { + var c = spec.charAt(i), + cUpper = c.toUpperCase(), + arg = args[i]; + // Asterix means allow anything. + if (c == '*') { + continue; + } + typeName = utils.typeName(arg); + if ((arg === null || arg === undefined) && c == cUpper) { + continue; + } + if (typeName != typeMap[cUpper]) { + errMsg = 'Expected ' + typeMap[cUpper]; + break; + } + } + if (errMsg) { + errMsg += ', but got ' + typeName + '.'; + errMsg = 'Wrong type for parameter "' + extractParamName(opt_callee || args.callee, i) + '" of ' + functionName + ': ' + errMsg; + // Don't log when running unit tests. + if (typeof jasmine == 'undefined') { + console.error(errMsg); + } + throw TypeError(errMsg); + } +} + +function getValue(value, defaultValue) { + return value === undefined ? defaultValue : value; +} + +moduleExports.checkArgs = checkArgs; +moduleExports.getValue = getValue; +moduleExports.enableChecks = true; + + +}); + +// file: src/common/base64.js +define("cordova/base64", function(require, exports, module) { + +var base64 = exports; + +base64.fromArrayBuffer = function(arrayBuffer) { + var array = new Uint8Array(arrayBuffer); + return uint8ToBase64(array); +}; + +base64.toArrayBuffer = function(str) { + var decodedStr = typeof atob != 'undefined' ? atob(str) : new Buffer(str,'base64').toString('binary'); + var arrayBuffer = new ArrayBuffer(decodedStr.length); + var array = new Uint8Array(arrayBuffer); + for (var i=0, len=decodedStr.length; i < len; i++) { + array[i] = decodedStr.charCodeAt(i); + } + return arrayBuffer; +}; + +//------------------------------------------------------------------------------ + +/* This code is based on the performance tests at http://jsperf.com/b64tests + * This 12-bit-at-a-time algorithm was the best performing version on all + * platforms tested. + */ + +var b64_6bit = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; +var b64_12bit; + +var b64_12bitTable = function() { + b64_12bit = []; + for (var i=0; i<64; i++) { + for (var j=0; j<64; j++) { + b64_12bit[i*64+j] = b64_6bit[i] + b64_6bit[j]; + } + } + b64_12bitTable = function() { return b64_12bit; }; + return b64_12bit; +}; + +function uint8ToBase64(rawData) { + var numBytes = rawData.byteLength; + var output=""; + var segment; + var table = b64_12bitTable(); + for (var i=0;i> 12]; + output += table[segment & 0xfff]; + } + if (numBytes - i == 2) { + segment = (rawData[i] << 16) + (rawData[i+1] << 8); + output += table[segment >> 12]; + output += b64_6bit[(segment & 0xfff) >> 6]; + output += '='; + } else if (numBytes - i == 1) { + segment = (rawData[i] << 16); + output += table[segment >> 12]; + output += '=='; + } + return output; +} + +}); + +// file: src/common/builder.js +define("cordova/builder", function(require, exports, module) { + +var utils = require('cordova/utils'); + +function each(objects, func, context) { + for (var prop in objects) { + if (objects.hasOwnProperty(prop)) { + func.apply(context, [objects[prop], prop]); + } + } +} + +function clobber(obj, key, value) { + exports.replaceHookForTesting(obj, key); + var needsProperty = false; + try { + obj[key] = value; + } catch (e) { + needsProperty = true; + } + // Getters can only be overridden by getters. + if (needsProperty || obj[key] !== value) { + utils.defineGetter(obj, key, function() { + return value; + }); + } +} + +function assignOrWrapInDeprecateGetter(obj, key, value, message) { + if (message) { + utils.defineGetter(obj, key, function() { + console.log(message); + delete obj[key]; + clobber(obj, key, value); + return value; + }); + } else { + clobber(obj, key, value); + } +} + +function include(parent, objects, clobber, merge) { + each(objects, function (obj, key) { + try { + var result = obj.path ? require(obj.path) : {}; + + if (clobber) { + // Clobber if it doesn't exist. + if (typeof parent[key] === 'undefined') { + assignOrWrapInDeprecateGetter(parent, key, result, obj.deprecated); + } else if (typeof obj.path !== 'undefined') { + // If merging, merge properties onto parent, otherwise, clobber. + if (merge) { + recursiveMerge(parent[key], result); + } else { + assignOrWrapInDeprecateGetter(parent, key, result, obj.deprecated); + } + } + result = parent[key]; + } else { + // Overwrite if not currently defined. + if (typeof parent[key] == 'undefined') { + assignOrWrapInDeprecateGetter(parent, key, result, obj.deprecated); + } else { + // Set result to what already exists, so we can build children into it if they exist. + result = parent[key]; + } + } + + if (obj.children) { + include(result, obj.children, clobber, merge); + } + } catch(e) { + utils.alert('Exception building Cordova JS globals: ' + e + ' for key "' + key + '"'); + } + }); +} + +/** + * Merge properties from one object onto another recursively. Properties from + * the src object will overwrite existing target property. + * + * @param target Object to merge properties into. + * @param src Object to merge properties from. + */ +function recursiveMerge(target, src) { + for (var prop in src) { + if (src.hasOwnProperty(prop)) { + if (target.prototype && target.prototype.constructor === target) { + // If the target object is a constructor override off prototype. + clobber(target.prototype, prop, src[prop]); + } else { + if (typeof src[prop] === 'object' && typeof target[prop] === 'object') { + recursiveMerge(target[prop], src[prop]); + } else { + clobber(target, prop, src[prop]); + } + } + } + } +} + +exports.buildIntoButDoNotClobber = function(objects, target) { + include(target, objects, false, false); +}; +exports.buildIntoAndClobber = function(objects, target) { + include(target, objects, true, false); +}; +exports.buildIntoAndMerge = function(objects, target) { + include(target, objects, true, true); +}; +exports.recursiveMerge = recursiveMerge; +exports.assignOrWrapInDeprecateGetter = assignOrWrapInDeprecateGetter; +exports.replaceHookForTesting = function() {}; + +}); + +// file: src/common/channel.js +define("cordova/channel", function(require, exports, module) { + +var utils = require('cordova/utils'), + nextGuid = 1; + +/** + * Custom pub-sub "channel" that can have functions subscribed to it + * This object is used to define and control firing of events for + * cordova initialization, as well as for custom events thereafter. + * + * The order of events during page load and Cordova startup is as follows: + * + * onDOMContentLoaded* Internal event that is received when the web page is loaded and parsed. + * onNativeReady* Internal event that indicates the Cordova native side is ready. + * onCordovaReady* Internal event fired when all Cordova JavaScript objects have been created. + * onDeviceReady* User event fired to indicate that Cordova is ready + * onResume User event fired to indicate a start/resume lifecycle event + * onPause User event fired to indicate a pause lifecycle event + * + * The events marked with an * are sticky. Once they have fired, they will stay in the fired state. + * All listeners that subscribe after the event is fired will be executed right away. + * + * The only Cordova events that user code should register for are: + * deviceready Cordova native code is initialized and Cordova APIs can be called from JavaScript + * pause App has moved to background + * resume App has returned to foreground + * + * Listeners can be registered as: + * document.addEventListener("deviceready", myDeviceReadyListener, false); + * document.addEventListener("resume", myResumeListener, false); + * document.addEventListener("pause", myPauseListener, false); + * + * The DOM lifecycle events should be used for saving and restoring state + * window.onload + * window.onunload + * + */ + +/** + * Channel + * @constructor + * @param type String the channel name + */ +var Channel = function(type, sticky) { + this.type = type; + // Map of guid -> function. + this.handlers = {}; + // 0 = Non-sticky, 1 = Sticky non-fired, 2 = Sticky fired. + this.state = sticky ? 1 : 0; + // Used in sticky mode to remember args passed to fire(). + this.fireArgs = null; + // Used by onHasSubscribersChange to know if there are any listeners. + this.numHandlers = 0; + // Function that is called when the first listener is subscribed, or when + // the last listener is unsubscribed. + this.onHasSubscribersChange = null; +}, + channel = { + /** + * Calls the provided function only after all of the channels specified + * have been fired. All channels must be sticky channels. + */ + join: function(h, c) { + var len = c.length, + i = len, + f = function() { + if (!(--i)) h(); + }; + for (var j=0; jNative bridge. + POLLING: 0, + // For LOAD_URL to be viable, it would need to have a work-around for + // the bug where the soft-keyboard gets dismissed when a message is sent. + LOAD_URL: 1, + // For the ONLINE_EVENT to be viable, it would need to intercept all event + // listeners (both through addEventListener and window.ononline) as well + // as set the navigator property itself. + ONLINE_EVENT: 2, + EVAL_BRIDGE: 3 + }, + jsToNativeBridgeMode, // Set lazily. + nativeToJsBridgeMode = nativeToJsModes.EVAL_BRIDGE, + pollEnabled = false, + bridgeSecret = -1; + +var messagesFromNative = []; +var isProcessing = false; +var resolvedPromise = typeof Promise == 'undefined' ? null : Promise.resolve(); +var nextTick = resolvedPromise ? function(fn) { resolvedPromise.then(fn); } : function(fn) { setTimeout(fn); }; + +function androidExec(success, fail, service, action, args) { + if (bridgeSecret < 0) { + // If we ever catch this firing, we'll need to queue up exec()s + // and fire them once we get a secret. For now, I don't think + // it's possible for exec() to be called since plugins are parsed but + // not run until until after onNativeReady. + throw new Error('exec() called without bridgeSecret'); + } + // Set default bridge modes if they have not already been set. + // By default, we use the failsafe, since addJavascriptInterface breaks too often + if (jsToNativeBridgeMode === undefined) { + androidExec.setJsToNativeBridgeMode(jsToNativeModes.JS_OBJECT); + } + + // If args is not provided, default to an empty array + args = args || []; + + // Process any ArrayBuffers in the args into a string. + for (var i = 0; i < args.length; i++) { + if (utils.typeName(args[i]) == 'ArrayBuffer') { + args[i] = base64.fromArrayBuffer(args[i]); + } + } + + var callbackId = service + cordova.callbackId++, + argsJson = JSON.stringify(args); + if (success || fail) { + cordova.callbacks[callbackId] = {success:success, fail:fail}; + } + + var msgs = nativeApiProvider.get().exec(bridgeSecret, service, action, callbackId, argsJson); + // If argsJson was received by Java as null, try again with the PROMPT bridge mode. + // This happens in rare circumstances, such as when certain Unicode characters are passed over the bridge on a Galaxy S2. See CB-2666. + if (jsToNativeBridgeMode == jsToNativeModes.JS_OBJECT && msgs === "@Null arguments.") { + androidExec.setJsToNativeBridgeMode(jsToNativeModes.PROMPT); + androidExec(success, fail, service, action, args); + androidExec.setJsToNativeBridgeMode(jsToNativeModes.JS_OBJECT); + } else if (msgs) { + messagesFromNative.push(msgs); + // Always process async to avoid exceptions messing up stack. + nextTick(processMessages); + } +} + +androidExec.init = function() { + //CB-11828 + //This failsafe checks the version of Android and if it's Jellybean, it switches it to + //using the Online Event bridge for communicating from Native to JS + // + //It's ugly, but it's necessary. + var check = navigator.userAgent.toLowerCase().match(/android\s[0-9].[0-9]/); + var version_code = check && check[0].match(/4.[0-3].*/); + if (version_code != null && nativeToJsBridgeMode == nativeToJsModes.EVAL_BRIDGE) { + nativeToJsBridgeMode = nativeToJsModes.ONLINE_EVENT; + } + + bridgeSecret = +prompt('', 'gap_init:' + nativeToJsBridgeMode); + channel.onNativeReady.fire(); +}; + +function pollOnceFromOnlineEvent() { + pollOnce(true); +} + +function pollOnce(opt_fromOnlineEvent) { + if (bridgeSecret < 0) { + // This can happen when the NativeToJsMessageQueue resets the online state on page transitions. + // We know there's nothing to retrieve, so no need to poll. + return; + } + var msgs = nativeApiProvider.get().retrieveJsMessages(bridgeSecret, !!opt_fromOnlineEvent); + if (msgs) { + messagesFromNative.push(msgs); + // Process sync since we know we're already top-of-stack. + processMessages(); + } +} + +function pollingTimerFunc() { + if (pollEnabled) { + pollOnce(); + setTimeout(pollingTimerFunc, 50); + } +} + +function hookOnlineApis() { + function proxyEvent(e) { + cordova.fireWindowEvent(e.type); + } + // The network module takes care of firing online and offline events. + // It currently fires them only on document though, so we bridge them + // to window here (while first listening for exec()-releated online/offline + // events). + window.addEventListener('online', pollOnceFromOnlineEvent, false); + window.addEventListener('offline', pollOnceFromOnlineEvent, false); + cordova.addWindowEventHandler('online'); + cordova.addWindowEventHandler('offline'); + document.addEventListener('online', proxyEvent, false); + document.addEventListener('offline', proxyEvent, false); +} + +hookOnlineApis(); + +androidExec.jsToNativeModes = jsToNativeModes; +androidExec.nativeToJsModes = nativeToJsModes; + +androidExec.setJsToNativeBridgeMode = function(mode) { + if (mode == jsToNativeModes.JS_OBJECT && !window._cordovaNative) { + mode = jsToNativeModes.PROMPT; + } + nativeApiProvider.setPreferPrompt(mode == jsToNativeModes.PROMPT); + jsToNativeBridgeMode = mode; +}; + +androidExec.setNativeToJsBridgeMode = function(mode) { + if (mode == nativeToJsBridgeMode) { + return; + } + if (nativeToJsBridgeMode == nativeToJsModes.POLLING) { + pollEnabled = false; + } + + nativeToJsBridgeMode = mode; + // Tell the native side to switch modes. + // Otherwise, it will be set by androidExec.init() + if (bridgeSecret >= 0) { + nativeApiProvider.get().setNativeToJsBridgeMode(bridgeSecret, mode); + } + + if (mode == nativeToJsModes.POLLING) { + pollEnabled = true; + setTimeout(pollingTimerFunc, 1); + } +}; + +function buildPayload(payload, message) { + var payloadKind = message.charAt(0); + if (payloadKind == 's') { + payload.push(message.slice(1)); + } else if (payloadKind == 't') { + payload.push(true); + } else if (payloadKind == 'f') { + payload.push(false); + } else if (payloadKind == 'N') { + payload.push(null); + } else if (payloadKind == 'n') { + payload.push(+message.slice(1)); + } else if (payloadKind == 'A') { + var data = message.slice(1); + payload.push(base64.toArrayBuffer(data)); + } else if (payloadKind == 'S') { + payload.push(window.atob(message.slice(1))); + } else if (payloadKind == 'M') { + var multipartMessages = message.slice(1); + while (multipartMessages !== "") { + var spaceIdx = multipartMessages.indexOf(' '); + var msgLen = +multipartMessages.slice(0, spaceIdx); + var multipartMessage = multipartMessages.substr(spaceIdx + 1, msgLen); + multipartMessages = multipartMessages.slice(spaceIdx + msgLen + 1); + buildPayload(payload, multipartMessage); + } + } else { + payload.push(JSON.parse(message)); + } +} + +// Processes a single message, as encoded by NativeToJsMessageQueue.java. +function processMessage(message) { + var firstChar = message.charAt(0); + if (firstChar == 'J') { + // This is deprecated on the .java side. It doesn't work with CSP enabled. + eval(message.slice(1)); + } else if (firstChar == 'S' || firstChar == 'F') { + var success = firstChar == 'S'; + var keepCallback = message.charAt(1) == '1'; + var spaceIdx = message.indexOf(' ', 2); + var status = +message.slice(2, spaceIdx); + var nextSpaceIdx = message.indexOf(' ', spaceIdx + 1); + var callbackId = message.slice(spaceIdx + 1, nextSpaceIdx); + var payloadMessage = message.slice(nextSpaceIdx + 1); + var payload = []; + buildPayload(payload, payloadMessage); + cordova.callbackFromNative(callbackId, success, status, payload, keepCallback); + } else { + console.log("processMessage failed: invalid message: " + JSON.stringify(message)); + } +} + +function processMessages() { + // Check for the reentrant case. + if (isProcessing) { + return; + } + if (messagesFromNative.length === 0) { + return; + } + isProcessing = true; + try { + var msg = popMessageFromQueue(); + // The Java side can send a * message to indicate that it + // still has messages waiting to be retrieved. + if (msg == '*' && messagesFromNative.length === 0) { + nextTick(pollOnce); + return; + } + processMessage(msg); + } finally { + isProcessing = false; + if (messagesFromNative.length > 0) { + nextTick(processMessages); + } + } +} + +function popMessageFromQueue() { + var messageBatch = messagesFromNative.shift(); + if (messageBatch == '*') { + return '*'; + } + + var spaceIdx = messageBatch.indexOf(' '); + var msgLen = +messageBatch.slice(0, spaceIdx); + var message = messageBatch.substr(spaceIdx + 1, msgLen); + messageBatch = messageBatch.slice(spaceIdx + msgLen + 1); + if (messageBatch) { + messagesFromNative.unshift(messageBatch); + } + return message; +} + +module.exports = androidExec; + +}); + +// file: src/common/exec/proxy.js +define("cordova/exec/proxy", function(require, exports, module) { + + +// internal map of proxy function +var CommandProxyMap = {}; + +module.exports = { + + // example: cordova.commandProxy.add("Accelerometer",{getCurrentAcceleration: function(successCallback, errorCallback, options) {...},...); + add:function(id,proxyObj) { + console.log("adding proxy for " + id); + CommandProxyMap[id] = proxyObj; + return proxyObj; + }, + + // cordova.commandProxy.remove("Accelerometer"); + remove:function(id) { + var proxy = CommandProxyMap[id]; + delete CommandProxyMap[id]; + CommandProxyMap[id] = null; + return proxy; + }, + + get:function(service,action) { + return ( CommandProxyMap[service] ? CommandProxyMap[service][action] : null ); + } +}; +}); + +// file: src/common/init.js +define("cordova/init", function(require, exports, module) { + +var channel = require('cordova/channel'); +var cordova = require('cordova'); +var modulemapper = require('cordova/modulemapper'); +var platform = require('cordova/platform'); +var pluginloader = require('cordova/pluginloader'); +var utils = require('cordova/utils'); + +var platformInitChannelsArray = [channel.onNativeReady, channel.onPluginsReady]; + +function logUnfiredChannels(arr) { + for (var i = 0; i < arr.length; ++i) { + if (arr[i].state != 2) { + console.log('Channel not fired: ' + arr[i].type); + } + } +} + +window.setTimeout(function() { + if (channel.onDeviceReady.state != 2) { + console.log('deviceready has not fired after 5 seconds.'); + logUnfiredChannels(platformInitChannelsArray); + logUnfiredChannels(channel.deviceReadyChannelsArray); + } +}, 5000); + +// Replace navigator before any modules are required(), to ensure it happens as soon as possible. +// We replace it so that properties that can't be clobbered can instead be overridden. +function replaceNavigator(origNavigator) { + var CordovaNavigator = function() {}; + CordovaNavigator.prototype = origNavigator; + var newNavigator = new CordovaNavigator(); + // This work-around really only applies to new APIs that are newer than Function.bind. + // Without it, APIs such as getGamepads() break. + if (CordovaNavigator.bind) { + for (var key in origNavigator) { + if (typeof origNavigator[key] == 'function') { + newNavigator[key] = origNavigator[key].bind(origNavigator); + } + else { + (function(k) { + utils.defineGetterSetter(newNavigator,key,function() { + return origNavigator[k]; + }); + })(key); + } + } + } + return newNavigator; +} + +if (window.navigator) { + window.navigator = replaceNavigator(window.navigator); +} + +if (!window.console) { + window.console = { + log: function(){} + }; +} +if (!window.console.warn) { + window.console.warn = function(msg) { + this.log("warn: " + msg); + }; +} + +// Register pause, resume and deviceready channels as events on document. +channel.onPause = cordova.addDocumentEventHandler('pause'); +channel.onResume = cordova.addDocumentEventHandler('resume'); +channel.onActivated = cordova.addDocumentEventHandler('activated'); +channel.onDeviceReady = cordova.addStickyDocumentEventHandler('deviceready'); + +// Listen for DOMContentLoaded and notify our channel subscribers. +if (document.readyState == 'complete' || document.readyState == 'interactive') { + channel.onDOMContentLoaded.fire(); +} else { + document.addEventListener('DOMContentLoaded', function() { + channel.onDOMContentLoaded.fire(); + }, false); +} + +// _nativeReady is global variable that the native side can set +// to signify that the native code is ready. It is a global since +// it may be called before any cordova JS is ready. +if (window._nativeReady) { + channel.onNativeReady.fire(); +} + +modulemapper.clobbers('cordova', 'cordova'); +modulemapper.clobbers('cordova/exec', 'cordova.exec'); +modulemapper.clobbers('cordova/exec', 'Cordova.exec'); + +// Call the platform-specific initialization. +platform.bootstrap && platform.bootstrap(); + +// Wrap in a setTimeout to support the use-case of having plugin JS appended to cordova.js. +// The delay allows the attached modules to be defined before the plugin loader looks for them. +setTimeout(function() { + pluginloader.load(function() { + channel.onPluginsReady.fire(); + }); +}, 0); + +/** + * Create all cordova objects once native side is ready. + */ +channel.join(function() { + modulemapper.mapModules(window); + + platform.initialize && platform.initialize(); + + // Fire event to notify that all objects are created + channel.onCordovaReady.fire(); + + // Fire onDeviceReady event once page has fully loaded, all + // constructors have run and cordova info has been received from native + // side. + channel.join(function() { + require('cordova').fireDocumentEvent('deviceready'); + }, channel.deviceReadyChannelsArray); + +}, platformInitChannelsArray); + + +}); + +// file: src/common/init_b.js +define("cordova/init_b", function(require, exports, module) { + +var channel = require('cordova/channel'); +var cordova = require('cordova'); +var modulemapper = require('cordova/modulemapper'); +var platform = require('cordova/platform'); +var pluginloader = require('cordova/pluginloader'); +var utils = require('cordova/utils'); + +var platformInitChannelsArray = [channel.onDOMContentLoaded, channel.onNativeReady, channel.onPluginsReady]; + +// setting exec +cordova.exec = require('cordova/exec'); + +function logUnfiredChannels(arr) { + for (var i = 0; i < arr.length; ++i) { + if (arr[i].state != 2) { + console.log('Channel not fired: ' + arr[i].type); + } + } +} + +window.setTimeout(function() { + if (channel.onDeviceReady.state != 2) { + console.log('deviceready has not fired after 5 seconds.'); + logUnfiredChannels(platformInitChannelsArray); + logUnfiredChannels(channel.deviceReadyChannelsArray); + } +}, 5000); + +// Replace navigator before any modules are required(), to ensure it happens as soon as possible. +// We replace it so that properties that can't be clobbered can instead be overridden. +function replaceNavigator(origNavigator) { + var CordovaNavigator = function() {}; + CordovaNavigator.prototype = origNavigator; + var newNavigator = new CordovaNavigator(); + // This work-around really only applies to new APIs that are newer than Function.bind. + // Without it, APIs such as getGamepads() break. + if (CordovaNavigator.bind) { + for (var key in origNavigator) { + if (typeof origNavigator[key] == 'function') { + newNavigator[key] = origNavigator[key].bind(origNavigator); + } + else { + (function(k) { + utils.defineGetterSetter(newNavigator,key,function() { + return origNavigator[k]; + }); + })(key); + } + } + } + return newNavigator; +} +if (window.navigator) { + window.navigator = replaceNavigator(window.navigator); +} + +if (!window.console) { + window.console = { + log: function(){} + }; +} +if (!window.console.warn) { + window.console.warn = function(msg) { + this.log("warn: " + msg); + }; +} + +// Register pause, resume and deviceready channels as events on document. +channel.onPause = cordova.addDocumentEventHandler('pause'); +channel.onResume = cordova.addDocumentEventHandler('resume'); +channel.onActivated = cordova.addDocumentEventHandler('activated'); +channel.onDeviceReady = cordova.addStickyDocumentEventHandler('deviceready'); + +// Listen for DOMContentLoaded and notify our channel subscribers. +if (document.readyState == 'complete' || document.readyState == 'interactive') { + channel.onDOMContentLoaded.fire(); +} else { + document.addEventListener('DOMContentLoaded', function() { + channel.onDOMContentLoaded.fire(); + }, false); +} + +// _nativeReady is global variable that the native side can set +// to signify that the native code is ready. It is a global since +// it may be called before any cordova JS is ready. +if (window._nativeReady) { + channel.onNativeReady.fire(); +} + +// Call the platform-specific initialization. +platform.bootstrap && platform.bootstrap(); + +// Wrap in a setTimeout to support the use-case of having plugin JS appended to cordova.js. +// The delay allows the attached modules to be defined before the plugin loader looks for them. +setTimeout(function() { + pluginloader.load(function() { + channel.onPluginsReady.fire(); + }); +}, 0); + +/** + * Create all cordova objects once native side is ready. + */ +channel.join(function() { + modulemapper.mapModules(window); + + platform.initialize && platform.initialize(); + + // Fire event to notify that all objects are created + channel.onCordovaReady.fire(); + + // Fire onDeviceReady event once page has fully loaded, all + // constructors have run and cordova info has been received from native + // side. + channel.join(function() { + require('cordova').fireDocumentEvent('deviceready'); + }, channel.deviceReadyChannelsArray); + +}, platformInitChannelsArray); + +}); + +// file: src/common/modulemapper.js +define("cordova/modulemapper", function(require, exports, module) { + +var builder = require('cordova/builder'), + moduleMap = define.moduleMap, + symbolList, + deprecationMap; + +exports.reset = function() { + symbolList = []; + deprecationMap = {}; +}; + +function addEntry(strategy, moduleName, symbolPath, opt_deprecationMessage) { + if (!(moduleName in moduleMap)) { + throw new Error('Module ' + moduleName + ' does not exist.'); + } + symbolList.push(strategy, moduleName, symbolPath); + if (opt_deprecationMessage) { + deprecationMap[symbolPath] = opt_deprecationMessage; + } +} + +// Note: Android 2.3 does have Function.bind(). +exports.clobbers = function(moduleName, symbolPath, opt_deprecationMessage) { + addEntry('c', moduleName, symbolPath, opt_deprecationMessage); +}; + +exports.merges = function(moduleName, symbolPath, opt_deprecationMessage) { + addEntry('m', moduleName, symbolPath, opt_deprecationMessage); +}; + +exports.defaults = function(moduleName, symbolPath, opt_deprecationMessage) { + addEntry('d', moduleName, symbolPath, opt_deprecationMessage); +}; + +exports.runs = function(moduleName) { + addEntry('r', moduleName, null); +}; + +function prepareNamespace(symbolPath, context) { + if (!symbolPath) { + return context; + } + var parts = symbolPath.split('.'); + var cur = context; + for (var i = 0, part; part = parts[i]; ++i) { + cur = cur[part] = cur[part] || {}; + } + return cur; +} + +exports.mapModules = function(context) { + var origSymbols = {}; + context.CDV_origSymbols = origSymbols; + for (var i = 0, len = symbolList.length; i < len; i += 3) { + var strategy = symbolList[i]; + var moduleName = symbolList[i + 1]; + var module = require(moduleName); + // + if (strategy == 'r') { + continue; + } + var symbolPath = symbolList[i + 2]; + var lastDot = symbolPath.lastIndexOf('.'); + var namespace = symbolPath.substr(0, lastDot); + var lastName = symbolPath.substr(lastDot + 1); + + var deprecationMsg = symbolPath in deprecationMap ? 'Access made to deprecated symbol: ' + symbolPath + '. ' + deprecationMsg : null; + var parentObj = prepareNamespace(namespace, context); + var target = parentObj[lastName]; + + if (strategy == 'm' && target) { + builder.recursiveMerge(target, module); + } else if ((strategy == 'd' && !target) || (strategy != 'd')) { + if (!(symbolPath in origSymbols)) { + origSymbols[symbolPath] = target; + } + builder.assignOrWrapInDeprecateGetter(parentObj, lastName, module, deprecationMsg); + } + } +}; + +exports.getOriginalSymbol = function(context, symbolPath) { + var origSymbols = context.CDV_origSymbols; + if (origSymbols && (symbolPath in origSymbols)) { + return origSymbols[symbolPath]; + } + var parts = symbolPath.split('.'); + var obj = context; + for (var i = 0; i < parts.length; ++i) { + obj = obj && obj[parts[i]]; + } + return obj; +}; + +exports.reset(); + + +}); + +// file: src/common/modulemapper_b.js +define("cordova/modulemapper_b", function(require, exports, module) { + +var builder = require('cordova/builder'), + symbolList = [], + deprecationMap; + +exports.reset = function() { + symbolList = []; + deprecationMap = {}; +}; + +function addEntry(strategy, moduleName, symbolPath, opt_deprecationMessage) { + symbolList.push(strategy, moduleName, symbolPath); + if (opt_deprecationMessage) { + deprecationMap[symbolPath] = opt_deprecationMessage; + } +} + +// Note: Android 2.3 does have Function.bind(). +exports.clobbers = function(moduleName, symbolPath, opt_deprecationMessage) { + addEntry('c', moduleName, symbolPath, opt_deprecationMessage); +}; + +exports.merges = function(moduleName, symbolPath, opt_deprecationMessage) { + addEntry('m', moduleName, symbolPath, opt_deprecationMessage); +}; + +exports.defaults = function(moduleName, symbolPath, opt_deprecationMessage) { + addEntry('d', moduleName, symbolPath, opt_deprecationMessage); +}; + +exports.runs = function(moduleName) { + addEntry('r', moduleName, null); +}; + +function prepareNamespace(symbolPath, context) { + if (!symbolPath) { + return context; + } + var parts = symbolPath.split('.'); + var cur = context; + for (var i = 0, part; part = parts[i]; ++i) { + cur = cur[part] = cur[part] || {}; + } + return cur; +} + +exports.mapModules = function(context) { + var origSymbols = {}; + context.CDV_origSymbols = origSymbols; + for (var i = 0, len = symbolList.length; i < len; i += 3) { + var strategy = symbolList[i]; + var moduleName = symbolList[i + 1]; + var module = require(moduleName); + // + if (strategy == 'r') { + continue; + } + var symbolPath = symbolList[i + 2]; + var lastDot = symbolPath.lastIndexOf('.'); + var namespace = symbolPath.substr(0, lastDot); + var lastName = symbolPath.substr(lastDot + 1); + + var deprecationMsg = symbolPath in deprecationMap ? 'Access made to deprecated symbol: ' + symbolPath + '. ' + deprecationMsg : null; + var parentObj = prepareNamespace(namespace, context); + var target = parentObj[lastName]; + + if (strategy == 'm' && target) { + builder.recursiveMerge(target, module); + } else if ((strategy == 'd' && !target) || (strategy != 'd')) { + if (!(symbolPath in origSymbols)) { + origSymbols[symbolPath] = target; + } + builder.assignOrWrapInDeprecateGetter(parentObj, lastName, module, deprecationMsg); + } + } +}; + +exports.getOriginalSymbol = function(context, symbolPath) { + var origSymbols = context.CDV_origSymbols; + if (origSymbols && (symbolPath in origSymbols)) { + return origSymbols[symbolPath]; + } + var parts = symbolPath.split('.'); + var obj = context; + for (var i = 0; i < parts.length; ++i) { + obj = obj && obj[parts[i]]; + } + return obj; +}; + +exports.reset(); + + +}); + +// file: /Users/maj/src/cordova-android/cordova-js-src/platform.js +define("cordova/platform", function(require, exports, module) { + +// The last resume event that was received that had the result of a plugin call. +var lastResumeEvent = null; + +module.exports = { + id: 'android', + bootstrap: function() { + var channel = require('cordova/channel'), + cordova = require('cordova'), + exec = require('cordova/exec'), + modulemapper = require('cordova/modulemapper'); + + // Get the shared secret needed to use the bridge. + exec.init(); + + // TODO: Extract this as a proper plugin. + modulemapper.clobbers('cordova/plugin/android/app', 'navigator.app'); + + var APP_PLUGIN_NAME = Number(cordova.platformVersion.split('.')[0]) >= 4 ? 'CoreAndroid' : 'App'; + + // Inject a listener for the backbutton on the document. + var backButtonChannel = cordova.addDocumentEventHandler('backbutton'); + backButtonChannel.onHasSubscribersChange = function() { + // If we just attached the first handler or detached the last handler, + // let native know we need to override the back button. + exec(null, null, APP_PLUGIN_NAME, "overrideBackbutton", [this.numHandlers == 1]); + }; + + // Add hardware MENU and SEARCH button handlers + cordova.addDocumentEventHandler('menubutton'); + cordova.addDocumentEventHandler('searchbutton'); + + function bindButtonChannel(buttonName) { + // generic button bind used for volumeup/volumedown buttons + var volumeButtonChannel = cordova.addDocumentEventHandler(buttonName + 'button'); + volumeButtonChannel.onHasSubscribersChange = function() { + exec(null, null, APP_PLUGIN_NAME, "overrideButton", [buttonName, this.numHandlers == 1]); + }; + } + // Inject a listener for the volume buttons on the document. + bindButtonChannel('volumeup'); + bindButtonChannel('volumedown'); + + // The resume event is not "sticky", but it is possible that the event + // will contain the result of a plugin call. We need to ensure that the + // plugin result is delivered even after the event is fired (CB-10498) + var cordovaAddEventListener = document.addEventListener; + + document.addEventListener = function(evt, handler, capture) { + cordovaAddEventListener(evt, handler, capture); + + if (evt === 'resume' && lastResumeEvent) { + handler(lastResumeEvent); + } + }; + + // Let native code know we are all done on the JS side. + // Native code will then un-hide the WebView. + channel.onCordovaReady.subscribe(function() { + exec(onMessageFromNative, null, APP_PLUGIN_NAME, 'messageChannel', []); + exec(null, null, APP_PLUGIN_NAME, "show", []); + }); + } +}; + +function onMessageFromNative(msg) { + var cordova = require('cordova'); + var action = msg.action; + + switch (action) + { + // Button events + case 'backbutton': + case 'menubutton': + case 'searchbutton': + // App life cycle events + case 'pause': + // Volume events + case 'volumedownbutton': + case 'volumeupbutton': + cordova.fireDocumentEvent(action); + break; + case 'resume': + if(arguments.length > 1 && msg.pendingResult) { + if(arguments.length === 2) { + msg.pendingResult.result = arguments[1]; + } else { + // The plugin returned a multipart message + var res = []; + for(var i = 1; i < arguments.length; i++) { + res.push(arguments[i]); + } + msg.pendingResult.result = res; + } + + // Save the plugin result so that it can be delivered to the js + // even if they miss the initial firing of the event + lastResumeEvent = msg; + } + cordova.fireDocumentEvent(action, msg); + break; + default: + throw new Error('Unknown event action ' + action); + } +} + +}); + +// file: /Users/maj/src/cordova-android/cordova-js-src/plugin/android/app.js +define("cordova/plugin/android/app", function(require, exports, module) { + +var exec = require('cordova/exec'); +var APP_PLUGIN_NAME = Number(require('cordova').platformVersion.split('.')[0]) >= 4 ? 'CoreAndroid' : 'App'; + +module.exports = { + /** + * Clear the resource cache. + */ + clearCache:function() { + exec(null, null, APP_PLUGIN_NAME, "clearCache", []); + }, + + /** + * Load the url into the webview or into new browser instance. + * + * @param url The URL to load + * @param props Properties that can be passed in to the activity: + * wait: int => wait msec before loading URL + * loadingDialog: "Title,Message" => display a native loading dialog + * loadUrlTimeoutValue: int => time in msec to wait before triggering a timeout error + * clearHistory: boolean => clear webview history (default=false) + * openExternal: boolean => open in a new browser (default=false) + * + * Example: + * navigator.app.loadUrl("http://server/myapp/index.html", {wait:2000, loadingDialog:"Wait,Loading App", loadUrlTimeoutValue: 60000}); + */ + loadUrl:function(url, props) { + exec(null, null, APP_PLUGIN_NAME, "loadUrl", [url, props]); + }, + + /** + * Cancel loadUrl that is waiting to be loaded. + */ + cancelLoadUrl:function() { + exec(null, null, APP_PLUGIN_NAME, "cancelLoadUrl", []); + }, + + /** + * Clear web history in this web view. + * Instead of BACK button loading the previous web page, it will exit the app. + */ + clearHistory:function() { + exec(null, null, APP_PLUGIN_NAME, "clearHistory", []); + }, + + /** + * Go to previous page displayed. + * This is the same as pressing the backbutton on Android device. + */ + backHistory:function() { + exec(null, null, APP_PLUGIN_NAME, "backHistory", []); + }, + + /** + * Override the default behavior of the Android back button. + * If overridden, when the back button is pressed, the "backKeyDown" JavaScript event will be fired. + * + * Note: The user should not have to call this method. Instead, when the user + * registers for the "backbutton" event, this is automatically done. + * + * @param override T=override, F=cancel override + */ + overrideBackbutton:function(override) { + exec(null, null, APP_PLUGIN_NAME, "overrideBackbutton", [override]); + }, + + /** + * Override the default behavior of the Android volume button. + * If overridden, when the volume button is pressed, the "volume[up|down]button" + * JavaScript event will be fired. + * + * Note: The user should not have to call this method. Instead, when the user + * registers for the "volume[up|down]button" event, this is automatically done. + * + * @param button volumeup, volumedown + * @param override T=override, F=cancel override + */ + overrideButton:function(button, override) { + exec(null, null, APP_PLUGIN_NAME, "overrideButton", [button, override]); + }, + + /** + * Exit and terminate the application. + */ + exitApp:function() { + return exec(null, null, APP_PLUGIN_NAME, "exitApp", []); + } +}; + +}); + +// file: src/common/pluginloader.js +define("cordova/pluginloader", function(require, exports, module) { + +var modulemapper = require('cordova/modulemapper'); +var urlutil = require('cordova/urlutil'); + +// Helper function to inject a + + + + + + + + + + + + + + + + + +
+

Apache Cordova Hello

+ +
+ +

+ +

+ +

+ + + +

+ + + +

+ + + +

+ +

+ +

+ +

+ +

+ +

+ +

+ +

+ +

+ +

+

+
+ +
+ + + + + diff --git a/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/js/MWBScanner.js b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/js/MWBScanner.js new file mode 100755 index 00000000..d58b0376 --- /dev/null +++ b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/js/MWBScanner.js @@ -0,0 +1,928 @@ +/* + Version 1.8 + + - Added new feature that makes possible scanning in view: + + scanner.startScanning(x, y, width, height); + //all parameters represent percentages relative to the screen size + + - Other methods for partial screen scanning control: + + scanner.togglePauseResume() - toggle pause resume scanning + scanner.stopScanner() - stop and remove scanner view + scanner.toggleFlash() - toggle flash on/off + scanner.toggleZoom() - toggle zoom in/out + + + Version 1.7 + + - Added scanImage(URI) which can be used for image scanning. Optionally, the method can be used with custom init and callback - scanImage(MWBSInitSpace.init,MWBSInitSpace.callback,URI); + + URI - the path to the image + MWBSInitSpace.init - scanner initialisation + MWBSInitSpace.callback - result callback + + + Version 1.6 + + - Added continuous scanning functionality: + + - Added support for 64bit android devices. + - Camera overlay bug fixes. + Decoder updates: + - DM non-centric scanning upgrade (still with fixed number of testing locations) + - GS1 updates: + - Code 128 FNC1 not included in result, only GS1 compliance is set + - DM - proper handling of FNC1 and ECI support added + - Fixed non-symetric viewfinder (for all orientations) in ios/android native and phonegap + - Fixed PDF trialing characters on all platforms for specific samples + + + Version 1.5 + + - Added multi-threading support. By default decoder will use all available CPU cores on device. To limit the number + of used threads, use new function: MWBsetMaxThreads: function (maxThreads) + + Version 1.4.1 + + - Structure of plugin reorganized to fit plugman specifications + + Version 1.4 + + - Added support for custom init and callback functions. All init and callback function can still be declared here, + but users can now use an outside Javascript file that they can maintain during updates, so that they don't lose + their changes when they update. + To use the custom script, they only need to include it in the index file like so: + + To call the scanner with the custom init and callback you use scanner.startScanning(MWBSInitSpace.init,MWBSInitSpace.callback); + + - Added MWBsetCustomParam: function - allows user to put some custom key/value pair which can be used later from native code + + - Added ITF-14 support + + - Added Code 11 support + + - Added MSI Plessey support + + - Added GS1 support + + + Version 1.3 + Copyright (c) 2014 Manatee Works. All rights reserved. + + Changes in 1.3: + + - Zoom feature added for iOS and Android. It's not supported on WP8 due to API limitation. + + - Added function to turn Flash ON by default + + - Fixed 'frameworks was not added to the references' on WP8 + + - Fixed freezing if missing org.apache.cordova.device plugin + + - Added x86 lib for Android + + + + Changes in 1.2: + + - Registering calls moved from native code to MWBScanner.js + + You can now enter your licensing info without changing the native code of plugin; + + - Import package_name.R manually after adding Android plugin is not necessary anymore + + - Decoding library updated to 2.9.31 + + + + Changes in 1.1: + + - Advanced Overlay (MWBsetOverlayMode: function(overlayMode) + + You can now choose between Simple Image Overlay and MW Dynamic Overlay, which shows the actual + viewfinder, depending on selected barcode types and their respective scanning rectangles; + + - Orientation parameter (MWBsetInterfaceOrientation: function(interfaceOrientation)) + + Now there's only a single function for supplying orientation parameters which makes tweaking the + controller for changing scanner orientation no longer needed; + + - Enable or disable high resolution scanning (MWBenableHiRes: function(enableHiRes)) + + Added option to choose between high or normal resolution scanning to better match user + application requirements; + + - Flash handling (MWBenableFlash: function(enableFlash)) + + Added option to enable or disable the flash toggle button; + + + */ + + var CONSTANTS = { + /** + * @name Basic return values for API functions + * @{ + */ + MWB_RT_OK : 0, + MWB_RT_FAIL : -1, + MWB_RT_NOT_SUPPORTED : -2, + MWB_RT_BAD_PARAM : -3, + + + + /** @brief Code39 decoder flags value: require checksum check + */ + MWB_CFG_CODE39_REQUIRE_CHECKSUM : 0x2, + /**/ + + /** @brief Code39 decoder flags value: don't require stop symbol - can lead to false results + */ + MWB_CFG_CODE39_DONT_REQUIRE_STOP : 0x4, + /**/ + + /** @brief Code39 decoder flags value: decode full ASCII + */ + MWB_CFG_CODE39_EXTENDED_MODE : 0x8, + /**/ + + /** @brief Code93 decoder flags value: decode full ASCII + */ + MWB_CFG_CODE93_EXTENDED_MODE : 0x8, + /**/ + + + /** @brief Code25 decoder flags value: require checksum check + */ + MWB_CFG_CODE25_REQ_CHKSUM : 0x1, + /**/ + + /** @brief Code11 decoder flags value: require checksum check + * MWB_CFG_CODE11_REQ_SINGLE_CHKSUM is set by default + */ + MWB_CFG_CODE11_REQ_SINGLE_CHKSUM: 0x1, + MWB_CFG_CODE11_REQ_DOUBLE_CHKSUM: 0x2, + /**/ + + /** @brief MSI Plessey decoder flags value: require checksum check + * MWB_CFG_MSI_REQ_10_CHKSUM is set by default + */ + MWB_CFG_MSI_REQ_10_CHKSUM : 0x01, + MWB_CFG_MSI_REQ_1010_CHKSUM : 0x02, + MWB_CFG_MSI_REQ_11_IBM_CHKSUM : 0x04, + MWB_CFG_MSI_REQ_11_NCR_CHKSUM : 0x08, + MWB_CFG_MSI_REQ_1110_IBM_CHKSUM : 0x10, + MWB_CFG_MSI_REQ_1110_NCR_CHKSUM : 0x20, + /**/ + + /** @brief Codabar decoder flags value: include start/stop symbols in result + */ + MWB_CFG_CODABAR_INCLUDE_STARTSTOP : 0x1, + /**/ + + + + /** @brief Barcode decoder param types + */ + MWB_PAR_ID_RESULT_PREFIX : 0x10, + MWB_PAR_ID_ECI_MODE : 0x08, + /**/ + + /** @brief Barcode param values + */ + + MWB_PAR_VALUE_ECI_DISABLED : 0x00, //default + MWB_PAR_VALUE_ECI_ENABLED : 0x01, + + MWB_PAR_VALUE_RESULT_PREFIX_NEVER : 0x00, // default + MWB_PAR_VALUE_RESULT_PREFIX_ALWAYS : 0x01, + MWB_PAR_VALUE_RESULT_PREFIX_DEFAULT : 0x02, + /**/ + + + /** @brief UPC/EAN decoder disable addons detection + */ + MWB_CFG_EANUPC_DISABLE_ADDON : 0x1, + /**/ + + /** @brief Global decoder flags value: apply sharpening on input image + */ + MWB_CFG_GLOBAL_HORIZONTAL_SHARPENING : 0x01, + MWB_CFG_GLOBAL_VERTICAL_SHARPENING : 0x02, + MWB_CFG_GLOBAL_SHARPENING : 0x03, + + /** @brief Global decoder flags value: apply rotation on input image + */ + MWB_CFG_GLOBAL_ROTATE90 : 0x04, + + /** + * @name Bit mask identifiers for supported decoder types + * @{ */ + MWB_CODE_MASK_NONE : 0x00000000, + MWB_CODE_MASK_QR : 0x00000001, + MWB_CODE_MASK_DM : 0x00000002, + MWB_CODE_MASK_RSS : 0x00000004, + MWB_CODE_MASK_39 : 0x00000008, + MWB_CODE_MASK_EANUPC : 0x00000010, + MWB_CODE_MASK_128 : 0x00000020, + MWB_CODE_MASK_PDF : 0x00000040, + MWB_CODE_MASK_AZTEC : 0x00000080, + MWB_CODE_MASK_25 : 0x00000100, + MWB_CODE_MASK_93 : 0x00000200, + MWB_CODE_MASK_CODABAR : 0x00000400, + MWB_CODE_MASK_DOTCODE : 0x00000800, + MWB_CODE_MASK_11 : 0x00001000, + MWB_CODE_MASK_MSI : 0x00002000, + MWB_CODE_MASK_ALL : 0xffffffff, + /** @} */ + + + /** + * @name Bit mask identifiers for RSS decoder types + * @{ */ + MWB_SUBC_MASK_RSS_14 : 0x00000001, + MWB_SUBC_MASK_RSS_LIM : 0x00000004, + MWB_SUBC_MASK_RSS_EXP : 0x00000008, + /** @} */ + + /** + * @name Bit mask identifiers for Code 2 of 5 decoder types + * @{ */ + MWB_SUBC_MASK_C25_INTERLEAVED : 0x00000001, + MWB_SUBC_MASK_C25_STANDARD : 0x00000002, + MWB_SUBC_MASK_C25_ITF14 : 0x00000004, + /** @} */ + + /** + * @name Bit mask identifiers for UPC/EAN decoder types + * @{ */ + MWB_SUBC_MASK_EANUPC_EAN_13 : 0x00000001, + MWB_SUBC_MASK_EANUPC_EAN_8 : 0x00000002, + MWB_SUBC_MASK_EANUPC_UPC_A : 0x00000004, + MWB_SUBC_MASK_EANUPC_UPC_E : 0x00000008, + /** @} */ + + /** + * @name Bit mask identifiers for 1D scanning direction + * @{ */ + MWB_SCANDIRECTION_HORIZONTAL : 0x00000001, + MWB_SCANDIRECTION_VERTICAL : 0x00000002, + MWB_SCANDIRECTION_OMNI : 0x00000004, + MWB_SCANDIRECTION_AUTODETECT : 0x00000008, + /** @} */ + + FOUND_NONE : 0, + FOUND_DM : 1, + FOUND_39 : 2, + FOUND_RSS_14 : 3, + FOUND_RSS_14_STACK : 4, + FOUND_RSS_LIM : 5, + FOUND_RSS_EXP : 6, + FOUND_EAN_13 : 7, + FOUND_EAN_8 : 8, + FOUND_UPC_A : 9, + FOUND_UPC_E : 10, + FOUND_128 : 11, + FOUND_PDF : 12, + FOUND_QR : 13, + FOUND_AZTEC : 14, + FOUND_25_INTERLEAVED :15, + FOUND_25_STANDARD : 16, + FOUND_93 : 17, + FOUND_CODABAR : 18, + FOUND_DOTCODE : 19, + FOUND_128_GS1 : 20, + FOUND_ITF14 : 21, + FOUND_11 : 22, + FOUND_MSI : 23, + FOUND_25_IATA : 24, + OrientationPortrait : 'Portrait', + OrientationLandscapeLeft : 'LandscapeLeft', + OrientationLandscapeRight : 'LandscapeRight', + OverlayModeNone : 0, + OverlayModeMW : 1, + OverlayModeImage : 2 + }; + + + var BarcodeScanner = { + + /** + * Init decoder with default params. + */ + MWBinitDecoder: function(callback) { + cordova.exec(callback, function(){}, "MWBarcodeScanner", "initDecoder", []); + }, + + /** + * result.code - string representation of barcode result + * result.type - type of barcode detected or 'Cancel' if scanning is canceled + * result.bytes - bytes array of raw barcode result + * result.isGS1 - (boolean) barcode is GS1 compliant + * result.location - contains rectangle points p1,p2,p3,p4 with the corresponding x,y + * result.imageWidth - Width of the scanned image + * result.imageHeight - Height of the scanned image + */ + MWBstartScanning: function(callback,x,y,width,height) { + var args = Array.prototype.slice.call(arguments); + if(args.length>1){ + cordova.exec(callback, function(err) { + callback('Error: ' + err); + }, "MWBarcodeScanner", "startScannerView", [x,y,width,height]); + + }else{ + cordova.exec(callback, function(err) { + callback('Error: ' + err); + }, "MWBarcodeScanner", "startScanner", []); + + } + }, + + /** + * Registers licensing information with single selected decoder type. + * If registering information is correct, enables full support for selected + * decoder type. + * It should be called once per decoder type. + * + * @param[in] codeMask Single decoder type selector (MWB_CODE_MASK_...) + * @param[in] userName User name string + * @param[in] key License key string + * + * @retval MWB_RT_OK Registration successful + * @retval MWB_RT_FAIL Registration failed + * @retval MWB_RT_BAD_PARAM More than one decoder flag selected + * @retval MWB_RT_NOT_SUPPORTED Selected decoder type or its registration + * is not supported + */ + MWBregisterCode: function(codeMask, userName, key) { + cordova.exec(function(){}, function(){}, "MWBarcodeScanner", "registerCode", [codeMask, userName, key]); + }, + + /** + * Sets active or inactive status of decoder types + * + * @param[in] activeCodes ORed bit flags (MWB_CODE_MASK_...) of decoder types + * to be activated. + */ + MWBsetActiveCodes: function(activeCodes) { + cordova.exec(function(){}, function(){}, "MWBarcodeScanner", "setActiveCodes", [activeCodes]); + }, + + /** + * Set active subcodes for given code group flag. + * Subcodes under some decoder type are all activated by default. + * + * @param[in] codeMask Single decoder type/group (MWB_CODE_MASK_...) + * @param[in] subMask ORed bit flags of requested decoder subtypes (MWB_SUBC_MASK_) + */ + MWBsetActiveSubcodes: function(codeMask, activeSubcodes) { + cordova.exec(function(){}, function(){}, "MWBarcodeScanner", "setActiveSubcodes", [codeMask, activeSubcodes]); + }, + + /** + * MWBsetFlags configures options (if any) for decoder type specified in codeMask. + * Options are given in flags as bitwise OR of option bits. Available options depend on selected decoder type. + * + * @param[in] codeMask Single decoder type (MWB_CODE_MASK_...) + * @param[in] flags ORed bit mask of selected decoder type options (MWB_FLAG_...) + */ + MWBsetFlags: function(codeMask, flags) { + cordova.exec(function(){}, function(){}, "MWBarcodeScanner", "setFlags", [codeMask, flags]); + }, + + /** + * MWBsetMinLength configures minimum result length for decoder type specified in codeMask. + * + * @param[in] codeMask Single decoder type (MWB_CODE_MASK_...) + * @param[in] minLength Minimum result length for selected decoder type + */ + MWBsetMinLength: function(codeMask, minLength) { + cordova.exec(function(){}, function(){}, "MWBarcodeScanner", "setMinLength", [codeMask, minLength]); + }, + + /** + * This function enables some control over scanning lines choice for 1D barcodes. By ORing + * available bit-masks user can add one or more direction options to scanning lines set. + * @n - MWB_SCANDIRECTION_HORIZONTAL - horizontal lines + * @n - MWB_SCANDIRECTION_VERTICAL - vertical lines + * @n - MWB_SCANDIRECTION_OMNI - omnidirectional lines + * @n - MWB_SCANDIRECTION_AUTODETECT - enables BarcodeScanner's + * autodetection of barcode direction + * + * @param[in] direction ORed bit mask of direction modes given with + * MWB_SCANDIRECTION_... bit-masks + */ + MWBsetDirection: function(direction) { + cordova.exec(function(){}, function(){}, "MWBarcodeScanner", "setDirection", [direction]); + }, + + /** + * Sets rectangular area for barcode scanning with selected single decoder type. + * After MWBsetScanningRect() call, all subseqent scans will be restricted + * to this region. If rectangle is not set, whole image is scanned. + * Also, if width or height is zero, whole image is scanned. + * + * Parameters are interpreted as percentage of image dimensions, i.e. ranges are + * 0 - 100 for all parameters. + * + * @param[in] codeMask Single decoder type selector (MWB_CODE_MASK_...) + * @param[in] left X coordinate of left edge (percentage) + * @param[in] top Y coordinate of top edge (percentage) + * @param[in] width Rectangle witdh (x axis) (percentage) + * @param[in] height Rectangle height (y axis) (percentage) + */ + MWBsetScanningRect: function(codeMask, left, top, width, height) { + cordova.exec(function(){}, function(){}, "MWBarcodeScanner", "setScanningRect", [codeMask, left, top, width, height]); + }, + + /** + * Barcode detector relies on image processing and geometry inerpolation for + * extracting optimal data for decoding. Higher effort level involves more processing + * and intermediate parameter values, thus increasing probability of successful + * detection with low quality images, but also consuming more CPU time. + * + * @param[in] level Effort level - available values are 1, 2, 3, 4 and 5. + * Levels greater than 3 are not suitable fro real-time decoding + */ + MWBsetLevel: function(level) { + cordova.exec(function(){}, function(){}, "MWBarcodeScanner", "setLevel", [level]); + }, + + /** + * Sets prefered User Interface orientation of scanner screen + * Choose one fo the available values: + * OrientationPortrait + * OrientationLandscapeLeft + * OrientationLandscapeRight + * + * Default value is OrientationLandscapeLeft + */ + MWBsetInterfaceOrientation: function(interfaceOrientation) { + cordova.exec(function(){}, function(){}, "MWBarcodeScanner", "setInterfaceOrientation", [interfaceOrientation]); + }, + + /** + * Choose overlay graphics type for scanning screen: + * OverlayModeNone - No overlay is displayed + * OverlayModeMW - Use MW Dynamic Viewfinder with blinking line (you can customize display options + * in native class by changing defaults) + * OverlayModeImage - Show image on top of camera preview + * + * Default value is OverlayModeMW + */ + MWBsetOverlayMode: function(overlayMode) { + cordova.exec(function(){}, function(){}, "MWBarcodeScanner", "setOverlayMode", [overlayMode]); + }, + + /** + * Enable or disable high resolution scanning. It's recommended to enable it when target barcodes + * are of high density or small footprint. If device doesn't support high resolution param will be ignored + * + * Default value is true (enabled) + */ + MWBenableHiRes: function(enableHiRes) { + cordova.exec(function(){}, function(){}, "MWBarcodeScanner", "enableHiRes", [enableHiRes]); + }, + + /** + * Enable or disable flash toggle button on scanning screen. If device doesn't support flash mode + * button will be hidden regardles of param + * + * Default value is true (enabled) + */ + MWBenableFlash: function(enableFlash) { + cordova.exec(function(){}, function(){}, "MWBarcodeScanner", "enableFlash", [enableFlash]); + }, + + /** + * Set default state of flash (torch) when scanner activity is started + * + * Default value is false (disabled) + */ + MWBturnFlashOn: function(flashOn) { + cordova.exec(function(){}, function(){}, "MWBarcodeScanner", "turnFlashOn", [flashOn]); + }, +/** +* Toggle on/off flash state +* +*/ +MWBtoggleFlash: function() { + cordova.exec(function(){}, function(){}, "MWBarcodeScanner", "toggleFlash", []); +}, + + /** + * Enable or disable zoom button on scanning screen. If device doesn't support zoom, + * button will be hidden regardles of param. Zoom is not supported on Windows Phone 8 + * as there's no zooming api available! + * + * Default value is true (enabled) + */ + MWBenableZoom: function(enableZoom) { + cordova.exec(function(){}, function(){}, "MWBarcodeScanner", "enableZoom", [enableZoom]); + }, + + /** + * Set two desired zoom levels in percentage and initial level. Set first two params to zero for default + * levels. On iOS, first zoom level is set to maximum non-interpolated level available on device, and + * second is double of first level. On Android, default first zoom is 150% and second is 300%. Zoom is + * not supported on Windows Phone 8 as there's no zooming api available! + * Initial zoom level can be 0 (100% - non zoomed), 1 (zoomLevel1) or 2 (zoomLevel2). Default is 0. + * + */ + MWBsetZoomLevels: function(zoomLevel1, zoomLevel2, initialZoomLevel) { + cordova.exec(function(){}, function(){}, "MWBarcodeScanner", "setZoomLevels", [zoomLevel1, zoomLevel2, initialZoomLevel]); + }, +/** + * Toggle on/off zoom state + * + */ +MWBtoggleZoom: function() { + cordova.exec(function(){}, function(){}, "MWBarcodeScanner", "toggleZoom", []); +}, + + /** + * Set maximum threads to be used for decoding. Value will be limited to maximum available CPU cores. + * Default is 4 (will trim to max available value). Set to 1 to disable multi-threaded decoding + */ + MWBsetMaxThreads: function (maxThreads) { + cordova.exec(function () { }, function () { }, "MWBarcodeScanner", "setMaxThreads", [maxThreads]); + }, + + + /** + * Set custom key:value pair which is accesible from native code. + */ + MWBsetCustomParam: function(key, value) { + cordova.exec(function(){}, function(){}, "MWBarcodeScanner", "setCustomParam", [key, value]); + }, + + + /** + * Enable/disable continuous scanning. If 'shouldClose' is 'false', result callback will be performed and + * scanner will be paused. The User can call 'resumeScanning' to continue scanning, or 'closeScanner' + * for closing the scanner. Default is 'true'. + * Function is not available on WP8 due to the technical limitations. + */ + MWBcloseScannerOnDecode: function(shouldClose) { + cordova.exec(function(){}, function(){}, "MWBarcodeScanner", "closeScannerOnDecode", [shouldClose]); + }, + /** + * Resume scanning. Use this method if already using MWBcloseScannerOnDecode(false). + * Function is not available on WP8 due to the technical limitations. + */ + MWBresumeScanning: function() { + cordova.exec(function(){}, function(){}, "MWBarcodeScanner", "resumeScanning", []); + }, + /** + * Close scanner. Use this method if already using MWBcloseScannerOnDecode(false). + * Function is not available on WP8 due to the technical limitations. + */ + MWBcloseScanner: function() { + cordova.exec(function(){}, function(){}, "MWBarcodeScanner", "closeScanner", []); + }, + /** + * Use 60 fps when available. + * Function is only available on iOS. + * Default is 'false' + */ + MWBuse60fps: function(use) { + cordova.exec(function(){}, function(){}, "MWBarcodeScanner", "use60fps", [use]); + }, + /** + * Scan image. + * imageURI - path to the image to be scanned. + */ + MWBscanImage: function(imageURI, callback) { + cordova.exec(callback, function(){}, "MWBarcodeScanner", "scanImage", [imageURI]); + }, + /** + * Set custom decoder param. + * MWB_setParam set custom decoder param id/value pair for decoder type specified in \a codeMask. + * codeMask Single decoder type (MWB_CODE_MASK_...) + * paramId ID of param + * paramValue Integer value of param + */ + MWBsetParam: function(codeMask, paramId, paramValue) { + cordova.exec(function(){}, function(){}, "MWBarcodeScanner", "setParam", [codeMask, paramId, paramValue]); + }, + /** + * Remove scanner view + */ + MWBstopScannerView: function() { + cordova.exec(function(){}, function(){}, "MWBarcodeScanner", "stopScanner", []); + }, + /** + * Pause scanner view + */ + MWBtogglePauseResume: function() { + cordova.exec(function(){}, function(){}, "MWBarcodeScanner", "togglePauseResume", []); + }, + /** + * Ignore result if scanned the same code in continuous scanning mode + * + * delay Time interval between 2 scan results with the same result.code in milliseconds + */ + MWBduplicateCodeDelay: function(delay) { + cordova.exec(function(){}, function(){}, "MWBarcodeScanner", "duplicateCodeDelay", [delay]); + } + + }; + +//change these registration settings to match your licence keys +/* BEGIN Registration settings */ +//if your app doesn't work after setting license keys, try to uncomment the try-catch, and see what the error is + +// try{ + var mwregister = { + 'Android' : { + 'MWB_CODE_MASK_25' : {'username' : '', 'key' : ''}, + 'MWB_CODE_MASK_39' : {'username':'','key':''}, + 'MWB_CODE_MASK_93' : {'username':'','key':''}, + 'MWB_CODE_MASK_128' : {'username':'','key':''}, + 'MWB_CODE_MASK_AZTEC' : {'username':'','key':''}, + 'MWB_CODE_MASK_DM' : {'username':'','key':''}, + 'MWB_CODE_MASK_PDF' : {'username':'','key':''}, + 'MWB_CODE_MASK_QR' : {'username':'','key':''}, + 'MWB_CODE_MASK_RSS' : {'username':'','key':''}, + 'MWB_CODE_MASK_CODABAR' : {'username':'','key':''}, + 'MWB_CODE_MASK_11' : {'username':'','key':''}, + 'MWB_CODE_MASK_MSI' : {'username':'','key':''}, + 'MWB_CODE_MASK_DOTCODE' : {'username':'','key':''} + }, + 'iOS' :{ + 'MWB_CODE_MASK_25' : {'username' : '', 'key' : ''}, + 'MWB_CODE_MASK_39' : {'username':'','key':''}, + 'MWB_CODE_MASK_93' : {'username':'','key':''}, + 'MWB_CODE_MASK_128' : {'username':'','key':''}, + 'MWB_CODE_MASK_AZTEC' : {'username':'','key':''}, + 'MWB_CODE_MASK_DM' : {'username':'','key':''}, + 'MWB_CODE_MASK_PDF' : {'username':'','key':''}, + 'MWB_CODE_MASK_QR' : {'username':'','key':''}, + 'MWB_CODE_MASK_RSS' : {'username':'','key':''}, + 'MWB_CODE_MASK_CODABAR' : {'username':'','key':''}, + 'MWB_CODE_MASK_11' : {'username':'','key':''}, + 'MWB_CODE_MASK_MSI' : {'username':'','key':''}, + 'MWB_CODE_MASK_DOTCODE' : {'username':'','key':''} + }, + 'Win32NT' : { + 'MWB_CODE_MASK_25' : {'username' : '', 'key' : ''}, + 'MWB_CODE_MASK_39' : {'username':'','key':''}, + 'MWB_CODE_MASK_93' : {'username':'','key':''}, + 'MWB_CODE_MASK_128' : {'username':'','key':''}, + 'MWB_CODE_MASK_AZTEC' : {'username':'','key':''}, + 'MWB_CODE_MASK_DM' : {'username':'','key':''}, + 'MWB_CODE_MASK_PDF' : {'username':'','key':''}, + 'MWB_CODE_MASK_QR' : {'username':'','key':''}, + 'MWB_CODE_MASK_RSS' : {'username':'','key':''}, + 'MWB_CODE_MASK_CODABAR' : {'username':'','key':''}, + 'MWB_CODE_MASK_11' : {'username':'','key':''}, + 'MWB_CODE_MASK_MSI' : {'username':'','key':''}, + 'MWB_CODE_MASK_DOTCODE' : {'username':'','key':''} + } + } +// } +// catch(e){ +// console.log(e); +// } +/* END registration settings */ + scanner = {}; + +scanner.stopScanner= function(){ + BarcodeScanner.MWBstopScannerView(); +} +scanner.togglePauseResume= function(){ + BarcodeScanner.MWBtogglePauseResume(); +} +scanner.toggleFlash = function(){ + BarcodeScanner.MWBtoggleFlash(); +} +scanner.toggleZoom = function(){ + BarcodeScanner.MWBtoggleZoom(); +} + +scanner.scanImage =function(initMWBS,callbackMWBS,imageURI){ + + + var args = Array.prototype.slice.call(arguments); + + // console.log(arguments); + // console.log('--------'); + // console.log(args); + + var initMWBS = (args.length>1)?args[0]:false, + callbackMWBS = (args.length>1)?args[1]:false, + imageURI = (args.length>1)?args[2]:args[0]; + + + + //Initialize decoder with default params + BarcodeScanner.MWBinitDecoder(function(){ + var initFunc = (typeof initMWBS === 'function')?initMWBS:function(mwbs,constants,dvc){ + + console.log('Init function defined in MWBScanner.js invoked'); + + var platform = mwregister[dvc.platform]; + + Object.keys(platform).forEach(function(reg_codes){ + mwbs['MWBregisterCode'](constants[reg_codes],platform[reg_codes]['username'],platform[reg_codes]['key']); + }); + + + // console.log('JS registration ends: '+ (new Date()).getTime()); + // console.log('JS Settings starts: '+ (new Date()).getTime()); + //settings portion, disable those that are not needed + + /* BEGIN settings CALLS */ + //if your code doesn't work after changing a few parameters, and there is no error output, uncomment the try-catch, the error will be output in your console + // try{ + // mwbs['MWBsetActiveCodes'](constants.MWB_CODE_MASK_128 | constants.MWB_CODE_MASK_QR); + // mwbs['MWBsetFlags'](constants.MWB_CODE_MASK_39, constants.MWB_CFG_CODE39_EXTENDED_MODE); + // mwbs['MWBsetDirection'](constants.MWB_SCANDIRECTION_VERTICAL | constants.MWB_SCANDIRECTION_HORIZONTAL); + // mwbs['MWBsetScanningRect'](constants.MWB_CODE_MASK_39, 20,20,60,60); + // mwbs['MWBsetMinLength'](constants.MWB_CODE_MASK_39, 4); + // mwbs['MWBsetParam'](constants.MWB_CODE_MASK_DM, constants.MWB_PAR_ID_RESULT_PREFIX, constants.MWB_PAR_VALUE_RESULT_PREFIX_ALWAYS); + + + // console.log('JS Settings ends: '+ (new Date()).getTime()); + // } + // catch(e){ + // console.log(e); + // } + + /* END settings CALLS */ + + /* CUSTOM JAVASCRIPT CALLS */ + + + }; + //call the init function + initFunc(BarcodeScanner,CONSTANTS,device); + + var callFunc = (typeof callbackMWBS === 'function')?callbackMWBS:function(result){ + + console.log('MWBScanner Defined callback Invoked'); + + /** + * result.code - string representation of barcode result + * result.type - type of barcode detected or 'Cancel' if scanning is canceled + * result.bytes - bytes array of raw barcode result + * result.isGS1 - (boolean) barcode is GS1 compliant + * result.location - contains rectangle points p1,p2,p3,p4 with the corresponding x,y + * result.imageWidth - Width of the scanned image + * result.imageHeight - Height of the scanned image + */ + + if (result.type == 'NoResult'){ + //Perform some action on scanning canceled if needed + } + else if (result && result.code){ + + navigator.notification.alert(result.code, function(){}, result.type + (result.isGS1?" (GS1)":""), 'Close'); + + } + } + + + BarcodeScanner['MWBscanImage'](imageURI ,callFunc); + + }); + + } + + var x,y,width,height; + + scanner.startScanning = function(initMWBS,callbackMWBS) { + var args = Array.prototype.slice.call(arguments); + + + + var initMWBS = (args.length == 2 || args.length == 6)?args[0]:false, + callbackMWBS = (args.length == 2 || args.length == 6)?args[1]:false; + + x=y=width=height =false; + + if(args.length == 4){ + x = args[0], + y = args[1], + width = args[2], + height = args[3]; + }else if(args.length == 6){ + x = args[2], + y = args[3], + width = args[4], + height = args[5]; + } + + //Initialize decoder with default params + BarcodeScanner.MWBinitDecoder(function(){ + + var initFunc = (typeof initMWBS === 'function')?initMWBS:function(mwbs,constants,dvc){ + + console.log('Init function defined in MWBScanner.js invoked'); + + /* END registration settings */ + var platform = mwregister[dvc.platform]; + + Object.keys(platform).forEach(function(reg_codes){ + mwbs['MWBregisterCode'](constants[reg_codes],platform[reg_codes]['username'],platform[reg_codes]['key']); + }); + + + // console.log('JS registration ends: '+ (new Date()).getTime()); + // console.log('JS Settings starts: '+ (new Date()).getTime()); + //settings portion, disable those that are not needed + + /* BEGIN settings CALLS */ + //if your code doesn't work after changing a few parameters, and there is no error output, uncomment the try-catch, the error will be output in your console + // try{ + // mwbs['MWBsetInterfaceOrientation'] (constants.OrientationPortrait); + // mwbs['MWBsetOverlayMode'](constants.OverlayModeImage); + // mwbs['MWBenableHiRes'](true); + // mwbs['MWBenableFlash'](true); + // mwbs['MWBsetActiveCodes'](constants.MWB_CODE_MASK_128 | constants.MWB_CODE_MASK_39); + // mwbs['MWBsetLevel'](2); + // mwbs['MWBsetFlags'](constants.MWB_CODE_MASK_39, constants.MWB_CFG_CODE39_EXTENDED_MODE); + // mwbs['MWBsetDirection'](constants.MWB_SCANDIRECTION_VERTICAL | constants.MWB_SCANDIRECTION_HORIZONTAL); + // mwbs['MWBsetScanningRect'](constants.MWB_CODE_MASK_39, 20,20,60,60); + // mwbs['MWBenableZoom'](true); + // mwbs['MWBsetZoomLevels'](200, 400, 0); + // mwbs['MWBsetMinLength'](constants.MWB_CODE_MASK_39, 4); + // mwbs['MWBsetMaxThreads'](1); + // mwbs['MWBcloseScannerOnDecode'](false); + // mwbs['MWBuse60fps'](true); + // mwbs['MWBsetParam'](constants.MWB_CODE_MASK_DM, constants.MWB_PAR_ID_RESULT_PREFIX, constants.MWB_PAR_VALUE_RESULT_PREFIX_ALWAYS); + // mwbs['MWBduplicateCodeDelay'](1000); + + + + // console.log('JS Settings ends: '+ (new Date()).getTime()); + // } + // catch(e){ + // console.log(e); + // } + + /* END settings CALLS */ + + /* CUSTOM JAVASCRIPT CALLS */ + + }; + //call the init function + initFunc(BarcodeScanner,CONSTANTS,device); + + var callFunc = (typeof callbackMWBS === 'function')?callbackMWBS:function(result){ + + console.log('MWBScanner Defined callback Invoked'); + + /** + * result.code - string representation of barcode result + * result.type - type of barcode detected or 'Cancel' if scanning is canceled + * result.bytes - bytes array of raw barcode result + * result.isGS1 - (boolean) barcode is GS1 compliant + * result.location - contains rectangle points p1,p2,p3,p4 with the corresponding x,y + * result.imageWidth - Width of the scanned image + * result.imageHeight - Height of the scanned image + */ + + if (result.type == 'Cancel'){ + //Perform some action on scanning canceled if needed + } + else if (result && result.code){ + + /* + * Use this sample if scanning in view + */ + /* + var para = document.createElement("li"); + var node = document.createTextNode(result.code+" : "+result.type); + para.appendChild(node); + + var element = document.getElementById("mwb_list"); + element.appendChild(para); + */ + + + /* + * Use this sample when using mwbs['MWBcloseScannerOnDecode'](false); + */ + /* + setTimeout(function(){ + BarcodeScanner.MWBresumeScanning(); + },2000); + */ + + navigator.notification.alert(result.code, function(){}, result.type + (result.isGS1?" (GS1)":""), 'Close'); + + } + } + + console.log('JS Starting Scanner: '+ (new Date()).getTime()); + // Call the barcode scanner screen + if(x === false){ + BarcodeScanner.MWBstartScanning(callFunc); // Scan using full screen + }else{ + BarcodeScanner.MWBstartScanning(callFunc, x,y,width,height); // Scan using view with: x, y, width, height (percentage of screen size) + } + }); + } + module.exports = scanner; \ No newline at end of file diff --git a/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/js/accelerator.js b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/js/accelerator.js new file mode 100755 index 00000000..54cbe19a --- /dev/null +++ b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/js/accelerator.js @@ -0,0 +1,20 @@ +document.addEventListener("deviceready", onDeviceReady5, false); +function onDeviceReady5() +{ + console.log("navigator.accelerometer.getCurrentAcceleration got deviceready"); + document.getElementById("accel").addEventListener("click", loadAccelerator); + function onASuccess(acceleration) + { + alert('Acceleration X: ' + acceleration.x + '\n' + + 'Acceleration Y: ' + acceleration.y + '\n' + + 'Acceleration Z: ' + acceleration.z + '\n' + + 'Timestamp: ' + acceleration.timestamp + '\n'); + } + function onAError() { + alert('onError!'); + } + function loadAccelerator() + { + navigator.accelerometer.getCurrentAcceleration(onASuccess, onAError); + } +} \ No newline at end of file diff --git a/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/js/backgroundgeo.js b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/js/backgroundgeo.js new file mode 100755 index 00000000..b9a4c849 --- /dev/null +++ b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/js/backgroundgeo.js @@ -0,0 +1,37 @@ +document.addEventListener('deviceready', onDeviceReady12, false); +function onDeviceReady12 () +{ + //document.getElementById("getGeo").addEventListener("click", getGeo); + /** + * This callback will be executed every time a geolocation is recorded in the background. + */ + var callbackFn = function(location) { + console.log('[js] BackgroundGeolocation callback: ' + location.latitude + ',' + location.longitude); + alert('[js] BackgroundGeolocation callback: ' + location.latitude + ',' + location.longitude); + + // Do your HTTP request here to POST location to your server. + // jQuery.post(url, JSON.stringify(location)); + + /* + IMPORTANT: You must execute the finish method here to inform the native plugin that you're finished, + and the background-task may be completed. You must do this regardless if your HTTP request is successful or not. + IF YOU DON'T, ios will CRASH YOUR APP for spending too much time in the background. + */ + backgroundGeolocation.finish(); + }; + var failureFn = function(error) { + console.log('BackgroundGeolocation error'); + }; + //function getGeo() { + // BackgroundGeolocation is highly configurable. See platform specific configuration options + backgroundGeolocation.configure(callbackFn, failureFn, { + desiredAccuracy: 10, + stationaryRadius: 20, + distanceFilter: 30, + interval: 60000 + });//} + // Turn ON the background-geolocation system. The user will be tracked whenever they suspend the app. + backgroundGeolocation.start(); + // If you wish to turn OFF background-tracking, call the #stop method. + // backgroundGeolocation.stop(); +} \ No newline at end of file diff --git a/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/js/barcode.js b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/js/barcode.js new file mode 100755 index 00000000..78cf120f --- /dev/null +++ b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/js/barcode.js @@ -0,0 +1,6 @@ +document.getElementById("Scan_Barcode").addEventListener("click", scanbar); +function scanbar() +{ + console.log("in scanbar"); + scanner.startScanning(); +} \ No newline at end of file diff --git a/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/js/browser.js b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/js/browser.js new file mode 100755 index 00000000..880520f9 --- /dev/null +++ b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/js/browser.js @@ -0,0 +1,9 @@ +document.addEventListener("deviceready", onDeviceReady15, false); +function onDeviceReady15() +{ + document.getElementById("browser").addEventListener("click", createBrowser); + function createBrowser() + { + var ref = cordova.InAppBrowser.open('https://www.google.com/', '_system', 'location=yes'); + } +} \ No newline at end of file diff --git a/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/js/camera.js b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/js/camera.js new file mode 100755 index 00000000..e5c36432 --- /dev/null +++ b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/js/camera.js @@ -0,0 +1,19 @@ +document.addEventListener("deviceready", onDeviceReady10, false); +function onDeviceReady10() +{ + //alert("device ready camera"); + document.getElementById("cameraTakePicture").addEventListener("click", loadCam); + function onCamSuccess(imageData) + { + var image = document.getElementById('myImage'); + image.src = "data:image/jpeg;base64," + imageData; + } + function onCamFail(message) + { + alert('Failed because: ' + message); + } + function loadCam() + { + navigator.camera.getPicture(onCamSuccess, onCamFail, { quality: 50, destinationType: Camera.DestinationType.DATA_URL }); + } +} \ No newline at end of file diff --git a/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/js/contact.js b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/js/contact.js new file mode 100755 index 00000000..07a5b9e2 --- /dev/null +++ b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/js/contact.js @@ -0,0 +1,9 @@ +document.addEventListener("deviceready", onDeviceReady14, false); +function onDeviceReady14() +{ + document.getElementById("createContact").addEventListener("click", createContact); + function createContact() + { + var myContact = navigator.contacts.create({"displayName": "Test User"}); + } +} \ No newline at end of file diff --git a/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/js/corbarscan.js b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/js/corbarscan.js new file mode 100755 index 00000000..b2a921fe --- /dev/null +++ b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/js/corbarscan.js @@ -0,0 +1,15 @@ +document.getElementById("corbarscan").addEventListener("click", corbarscan); +function corbarscan () +{ + cordova.plugins.barcodeScanner.scan( + function (result) { + alert("We got a barcode\n" + + "Result: " + result.text + "\n" + + "Format: " + result.format + "\n" + + "Cancelled: " + result.cancelled); + }, + function (error) { + alert("Scanning failed: " + error); + } + ); +} \ No newline at end of file diff --git a/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/js/core-flashjax.js b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/js/core-flashjax.js new file mode 100755 index 00000000..7b5b459b --- /dev/null +++ b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/js/core-flashjax.js @@ -0,0 +1,187 @@ +(function(){ +var debug = true; +function irm_log(s){ + if((!debug) || (!console.log)) return; + console.log('IRM log:'+s); +} + //store builtin functions to keep their original implementations + var $Array = Array; + var $Object = window.Object; + //var lookupSetter = Object.prototype.__lookupSetter__; + //var lookupGetter = Object.prototype.__lookupGetter__; + //var defineSetter = Object.prototype.__defineSetter__; + //var defineGetter = Object.prototype.__defineGetter__; + var hasOwnProperty = Object.prototype.hasOwnProperty; + var builtins = {} + + builtins.__proto__ = null; + with (Function.prototype) + builtins.Function = { apply: apply, call: call, /*toSource: toSource,*/toString: toString }; + + // Create a function from a string. Note that functions created with + // the Function constructor DO NOT get a scope chain that includes the + // current lexical scope; their scope chains include only the global + // context. To export local function declarations, we do some simple + // parsing of the string form of the function and append commands that + // explicitly export each definition. Ads can obviously defeat this + // process in a variety of ways, but doing so just harms themselves. + + function makeFunction(body) { + if(body==undefined) throw new Error('makeFunction error: No code to make a function.'); + var locals = body.match(/function\s+\w+\(/g); + if (locals) { + body += ';'; + for (var i=0; i principal= " + principal); + //console.log("execWith -> principal = " + principal + "\n f = " + f); + console.log("execWith -> principal = " + principal); + + if(f==undefined) return; + + //alert("execWith -> code= " + f.toString()); + //console.log("execWith -> code= " + f.toString()); + console.log("shadowStack pushing principal = " + principal); + shadowStack.push(principal); + //ensure to call original apply function + f.apply = builtins.Function.apply; + //console.log("f.apply = " + f.apply); + try{ + var r = f.apply(this,$Array.prototype.slice.call(arguments,2)); + //console.log("var r = " + r); + }catch(e){} + console.log("shadowStack popping principal = " + principal); + shadowStack.pop(); + //flush_write(principal); + if (typeof r !== "undefined") return r; + } + +function execScript(principal, dynamic_script_code){ + console.log("In execScript function principal is " + principal); + //alert("execScript -> code= " + dynamic_script_code); + //console.log("execScript -> code= " + dynamic_script_code); + + var dynamic_script = makeFunction(dynamic_script_code); // call our code for turning a string into a global-scoped function + //console.log("Calling execWith principal = " + principal + "\n dynamic_script = " + dynamic_script); + console.log("Calling execWith principal = " + principal); + execWith(principal,dynamic_script); +} + +/********************** Begin the IRM code ******************************/ + //The common monitor function to intercept a function call with a policy + var monitorMethod = function(object, method, policy) { + console.log("object = " + object + "\nmethod = " + method + "\npolicy = " + policy); + // Find function corresponding to alias + while (!hasOwnProperty.call(object, method) && object.__proto__) + object = object.__proto__; + if (object === null) + throw new Error('Failed to find function for alias ' + method); + var original = object[method]; + if ((original === null) || (original === undefined)) + throw new Error('No method ' + method +'found for '+object); + //make sure to call the original apply function + original.apply = builtins.Function.apply; + object[method] = function wrapper() { + var object = this; + var orgArgs = arguments; + var proceed = function() { + return original.apply(object, orgArgs); + } + return policy(orgArgs, proceed,object); + } + } + + var document_getElementById_policy = function(args, proceed, object) { + var principal = thisPrincipal(); + console.log("In document_getElementById_pol principal = '" + principal + "' args[0] = '" + args[0] + "'"); + //console.log("In document_getElementById_pol principal = " + principal); + var node = proceed(); + return node; + }; + + var addEventListener_policy = function(args, proceed, node) { + //interface + //element.addEventListener(type, listener[, useCapture]); + var principal = thisPrincipal(); + console.log("in addEventListener_policy principal = " + principal + "\n args[0] = " + args[0] + "\n listener = args[1] = " + args[1]); + //console.log("in addEventListener_policy principal = " + principal); + var listener = args[1]; + //console.log("listener = " + listener); + //o_alert('principal "'+principal+'" calls addEventListener:'+listener.toString()); + //make the principal + //console.log("in addEventListener_policy principal = " + principal); + //alert('principal "'+principal+'" calls addEventListener:'+listener.toString()); + //console.log('principal "'+principal+'" calls addEventListener:'+listener.toString()); + + args[1] = function(){ console.log("Calling execWith principal = " + principal); return execWith(principal,listener);}; + return proceed(); + }; + if(Element.prototype.addEventListener){ + //console.log("Element.prototype.addEventListener calling addEventListener_policy"); + monitorMethod(Element.prototype, 'addEventListener', addEventListener_policy); + } + if(Node.prototype.addEventListener){ + //console.log("Node.prototype.addEventListener calling addEventListener_policy"); + monitorMethod(Node.prototype, 'addEventListener', addEventListener_policy); + } + + monitorMethod(document, 'addEventListener', addEventListener_policy); // Works + + if(Element.prototype.attachEvent){ + //console.log("Element.prototype.attachEvent calling addEventListener_policy"); + monitorMethod(Element.prototype, 'attachEvent', addEventListener_policy); + } + + if(Node.prototype.attachEvent){ + //console.log("Node.prototype.attachEvent calling addEventListener_policy"); + monitorMethod(Node.prototype, 'attachEvent', addEventListener_policy); + } + + var alert_policy = function(args, proceed, object) { + var principal = thisPrincipal(); + //var allow = check_policy(principal, undefined, 'alert', args); + args[0] = '"'+principal+'" calls alert with message:\n' + args[0] ; + return proceed(); + }; + + var camera_policy = function(args, proceed, object) { + var principal = thisPrincipal(); + alert(principal); + alert("principal \' " + principal + "\' invokes navigator.camera.getPicture"); + console.log("principal \' " + principal + "\' invokes navigator.camera.getPicture"); + return proceed();//run the original method + }; + + var current_accelerometer_policy = function(args, proceed,object) + { + var principal = thisPrincipal(); + alert(principal); + alert("principal \' " + principal + "\' invokes navigator.accelerometer.getCurrentAcceleration"); + return proceed(); + }; + + var geolocation_policy = function(args, proceed, object) { + console.log("In geolocation_policy"); + //console.log(args[0]); + //console.log(proceed); + //console.log(object); + var principal = thisPrincipal(); + alert(principal); + alert("principal \' " + principal + "\' invokes navigator.geolocation.getCurrentPosition"); + console.log("principal \' " + principal + "\' invokes navigator.geolocation.getCurrentPosition"); + return proceed();//run the original method + }; + var watch_policy = function(args, proceed, object) { + console.log("in watch_policy"); + var principal = thisPrincipal(); + alert(principal); + alert("principal \' " + principal + "\' invokes navigator.geolocation.watchPosition"); + console.log("principal \' " + principal + "\' invokes navigator.geolocation.watchPosition"); + return proceed();//run the original method + }; + + var network_policy = function(args, proceed, object){ + var principal = thisPrincipal(); + alert(principal); + alert("principal \' " + principal + "\' invokes navigator.connection.type"); + console.log("principal \' " + principal + "\' invokes navigator.connection.type"); + return proceed();//run the original method + }; + + var dialog_policy = function(args, proceed, object){ + var principal = thisPrincipal(); + alert(principal); + alert("principal \' " + principal + "\' invokes navigator.notification.alert"); + console.log("principal \' " + principal + "\' invokes navigator.notification.alert"); + return proceed();//run the original method + }; + + var direction_policy = function(args, proceed, object){ + var principal = thisPrincipal(); + alert(principal); + alert("principal \' " + principal + "\' invokes navigator.compass.getCurrentHeading"); + console.log("principal \' " + principal + "\' invokes navigator.compass.getCurrentHeading"); + return proceed();//run the original method + }; + + var clearWatch_policy = function(args, proceed, object){ + var principal = thisPrincipal(); + alert(principal); + alert("principal \' " + principal + "\' invokes navigator.geolocation.clearWatch"); + console.log("principal \' " + principal + "\' invokes navigator.geolocation.clearWatch"); + return proceed(); + }; + + var prefLang_policy = function(args, proceed, object) { + var principal = thisPrincipal(); + alert(principal); + alert("principal \' " + principal + "\' invokes navigator.globalization.getPreferredLanguage"); + console.log("principal \' " + principal + "\' invokes navigator.globalization.getPreferredLanguage"); + return proceed(); + }; + + var locale_policy = function(args, proceed, object) { + var principal = thisPrincipal(); + alert(principal); + alert("principal \' " + principal + "\' invokes navigator.globalization.getLocaleName"); + console.log("principal \' " + principal + "\' invokes navigator.globalization.getLocaleName"); + return proceed(); + }; + + var date_policy = function(args, proceed, object) { + var principal = thisPrincipal(); + alert(principal); + alert("principal \' " + principal + "\' invokes navigator.globalization.dateToString"); + console.log("principal \' " + principal + "\' invokes navigator.globalization.dateToString"); + return proceed(); + }; + + var createContact_policy = function(args, proceed, object) { + var principal = thisPrincipal(); + alert(principal); + alert("principal \' " + principal + "\' invokes navigator.contacts.create"); + console.log("principal \' " + principal + "\' invokes navigator.contacts.create"); + return proceed(); + }; + + var openBrowser_policy = function(args, proceed, object) { + var principal = thisPrincipal(); + alert(principal); + alert("principal \' " + principal + "\' invokes cordova.InAppBrowser.open"); + console.log("principal \' " + principal + "\' invokes cordova.InAppBrowser.open"); + return proceed(); + }; + + document.addEventListener("deviceready", onDReady, false); + function onDReady() + { + monitorMethod(cordova.InAppBrowser, 'open', openBrowser_policy); + monitorMethod(navigator.contacts, 'create', createContact_policy); + monitorMethod(navigator.globalization, 'getPreferredLanguage', prefLang_policy); + monitorMethod(navigator.globalization, 'getLocaleName', locale_policy); + monitorMethod(navigator.globalization, 'dateToString', date_policy); + monitorMethod(navigator.notification, 'alert', dialog_policy); + monitorMethod(navigator.compass, 'getCurrentHeading', direction_policy); + monitorMethod(document, 'getElementById',document_getElementById_policy); + //monitorMethod(window, 'alert',alert_policy); + monitorMethod(navigator.camera, 'getPicture', camera_policy); + monitorMethod(navigator.accelerometer,'getCurrentAcceleration', current_accelerometer_policy); + monitorMethod(navigator.geolocation, 'getCurrentPosition', geolocation_policy); + monitorMethod(navigator.geolocation, 'watchPosition', watch_policy); + //monitorMethod(navigator.connection, 'type', network_policy); + //monitorMethod(navigator.geolocation, 'clearWatch', clearWatch_policy); + monitorMethod(cordova.plugins.barcodeScanner, 'scan', camera_policy); + monitorMethod(scanner, 'startScanning', camera_policy); + monitorMethod(backgroundGeolocation, 'start', geolocation_policy); + monitorMethod(navigator.contacts, 'create', createContact_policy); + } + +function isJSURL(url){ + // alert(url.split('.').pop().split(/\#|\?/)[0]); + return url.split('.').pop().split(/\#|\?/)[0]==='js'; + +} + +//CORS request +//From: http://www.html5rocks.com/en/tutorials/cors/ +function createCORSRequest(method, url) { + var xhr = new XMLHttpRequest(); + if ("withCredentials" in xhr) { + + // Check if the XMLHttpRequest object has a "withCredentials" property. + // "withCredentials" only exists on XMLHTTPRequest2 objects. + xhr.open(method, url, true); + + } else if (typeof XDomainRequest != "undefined") { + + // Otherwise, check if XDomainRequest. + // XDomainRequest only exists in IE, and is IE's way of making CORS requests. + xhr = new XDomainRequest(); + xhr.open(method, url); + + } else { + + // Otherwise, CORS is not supported by the browser. + xhr = null; + + } + return xhr; +} + +function getCORSContent(principal,url) { + console.log("in getCORSContent function principal = " + principal); + var xhr = createCORSRequest('GET', url); + if (!xhr) { + alert('CORS not supported'); + return; + } + var text; + // Response handlers. + xhr.onload = function() { + text = xhr.responseText; + //var title = getTitle(text); + // alert('Response from CORS request to ' + url + ': ' + text); + if (isJSURL(url)) { + // alert('JS file'); + console.log("Calling execScript principal = " + principal); + execScript(principal,text); + } + + }; + + xhr.onerror = function() { + alert('Woops, there was an error making the request.'); + }; + + try{ + xhr.send(null); + return text; + }catch(e){ + irm_log("XMLHttpRequest error:"+e); + } + return ''; + +} +loadExternalJS=function(principal,url){ + // alert("load executev" + url + " under principal " + principal); + console.log("In loadExternalJS function principal = " + principal); + getCORSContent(principal,url); +} +})(); diff --git a/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/js/dialog.js b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/js/dialog.js new file mode 100755 index 00000000..3e4ef338 --- /dev/null +++ b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/js/dialog.js @@ -0,0 +1,18 @@ +document.addEventListener("deviceready", onDeviceReady3, false); +function onDeviceReady3() +{ + console.log("navigator.notification got deviceready"); + document.getElementById("dialog").addEventListener("click", loadDialog); + function dialogCallback() { + + } + function loadDialog() + { + navigator.notification.alert( + 'This is an alert using navigator.notification.alert!', // message + dialogCallback, // callback + 'ALERT!', // title + 'Done' // buttonName + ); + } +} \ No newline at end of file diff --git a/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/js/direction.js b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/js/direction.js new file mode 100755 index 00000000..1f63ee38 --- /dev/null +++ b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/js/direction.js @@ -0,0 +1,18 @@ +document.addEventListener("deviceready", onDeviceReady9, false); +function onDeviceReady9() +{ + console.log("navigator.compass.getCurrentHeading works well"); + document.getElementById("heading").addEventListener("click", loadDirection); + function onCompassError(error) + { + alert('CompassError: ' + error.code); + } + function onCompassSuccess(heading) + { + alert('Heading: ' + heading.magneticHeading); + } + function loadDirection() + { + navigator.compass.getCurrentHeading(onCompassSuccess, onCompassError); + } +} \ No newline at end of file diff --git a/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/js/fullflashjax.js b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/js/fullflashjax.js new file mode 100755 index 00000000..be9741c0 --- /dev/null +++ b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/js/fullflashjax.js @@ -0,0 +1,830 @@ + /** global declaration for Opera //BEGIN + */ + var thisPrincipal; + var fromAS; + //var safe_google_ad = function(){}; + //var safe_yahoo_ad = function(){}; + /** global declaration for Opera //END + */ + var deployed_domain = "securemashups.net"; + var publisher_principal = "top"; + var debug = true; + var isIE = (navigator.appName.indexOf("Microsoft") != -1); + function irm_log(s){ + if(!debug) return; + log('IRM log:'+s); + } + // Here is a pretend API method that we wish to protect. + + function myEvent(){ + irm_log('principal "'+thisPrincipal()+'" is permitted to exhibit myEvent'); + } + function new_XMLHttpRequest(){ + var xmlhttp; + try { + xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); + } catch (e) { + try { + xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); + } catch (E) { + xmlhttp = false; + } + } + if (!xmlhttp && typeof XMLHttpRequest!='undefined') { + xmlhttp = new XMLHttpRequest(); + } + return xmlhttp; + } + + function get_URL(url){ + var xhr = new_XMLHttpRequest(); + var fileSrc; + xhr.open('GET',url,false); + xhr.onreadystatechange = function() { + //alert('this.readyState='+this.readyState+';this.status='+this.status+'this.responseXML='+this.responseXML); + if (this.readyState === 4 && this.status == 200) { + fileSrc = this.responseText; + //alert(fileSrc); + } + } + + try{ + xhr.send(null); + return fileSrc; + }catch(e){ + alert(e); + } + return ''; + } + function get_remoteURL(url){ + var proxy_URL = 'proxy.php?url='+encodeURIComponent(url); + irm_log('get_remoteURL.url='+proxy_URL); + return get_URL(proxy_URL); + } + +//source:http://www.quirksmode.org/js/detect.html +/** + *Usage: + * Browser name: BrowserDetect.browser + * Browser version: BrowserDetect.version + * OS name: BrowserDetect.OS + */ +var BrowserDetect = { + init: function () { + this.browser = this.searchString(this.dataBrowser) || "An unknown browser"; + this.version = this.searchVersion(navigator.userAgent) + || this.searchVersion(navigator.appVersion) + || "an unknown version"; + this.OS = this.searchString(this.dataOS) || "an unknown OS"; + }, + searchString: function (data) { + for (var i=0;i' + + 'Longitude: ' + position.coords.longitude + '
'); + document.getElementById('watchlocation').innerHTML = x; + //alert(x) + } + function loadExtWebPage() + { + watchID = navigator.geolocation.watchPosition(onSuccess, onError,{ maximumAge: 3600000, timeout: 30000, enableHighAccuracy: true }); + } + function loadClearWatch(id) + { + navigator.geolocation.clearWatch(id); + } +} \ No newline at end of file diff --git a/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/plugins/com.manateeworks.barcodescanner/www/MWBScanner.js b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/plugins/com.manateeworks.barcodescanner/www/MWBScanner.js new file mode 100755 index 00000000..10e7ff16 --- /dev/null +++ b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/plugins/com.manateeworks.barcodescanner/www/MWBScanner.js @@ -0,0 +1,930 @@ +cordova.define("com.manateeworks.barcodescanner.Scanner", function(require, exports, module) { +/* + Version 1.8 + + - Added new feature that makes possible scanning in view: + + scanner.startScanning(x, y, width, height); + //all parameters represent percentages relative to the screen size + + - Other methods for partial screen scanning control: + + scanner.togglePauseResume() - toggle pause resume scanning + scanner.stopScanner() - stop and remove scanner view + scanner.toggleFlash() - toggle flash on/off + scanner.toggleZoom() - toggle zoom in/out + + + Version 1.7 + + - Added scanImage(URI) which can be used for image scanning. Optionally, the method can be used with custom init and callback - scanImage(MWBSInitSpace.init,MWBSInitSpace.callback,URI); + + URI - the path to the image + MWBSInitSpace.init - scanner initialisation + MWBSInitSpace.callback - result callback + + + Version 1.6 + + - Added continuous scanning functionality: + + - Added support for 64bit android devices. + - Camera overlay bug fixes. + Decoder updates: + - DM non-centric scanning upgrade (still with fixed number of testing locations) + - GS1 updates: + - Code 128 FNC1 not included in result, only GS1 compliance is set + - DM - proper handling of FNC1 and ECI support added + - Fixed non-symetric viewfinder (for all orientations) in ios/android native and phonegap + - Fixed PDF trialing characters on all platforms for specific samples + + + Version 1.5 + + - Added multi-threading support. By default decoder will use all available CPU cores on device. To limit the number + of used threads, use new function: MWBsetMaxThreads: function (maxThreads) + + Version 1.4.1 + + - Structure of plugin reorganized to fit plugman specifications + + Version 1.4 + + - Added support for custom init and callback functions. All init and callback function can still be declared here, + but users can now use an outside Javascript file that they can maintain during updates, so that they don't lose + their changes when they update. + To use the custom script, they only need to include it in the index file like so: + + To call the scanner with the custom init and callback you use scanner.startScanning(MWBSInitSpace.init,MWBSInitSpace.callback); + + - Added MWBsetCustomParam: function - allows user to put some custom key/value pair which can be used later from native code + + - Added ITF-14 support + + - Added Code 11 support + + - Added MSI Plessey support + + - Added GS1 support + + + Version 1.3 + Copyright (c) 2014 Manatee Works. All rights reserved. + + Changes in 1.3: + + - Zoom feature added for iOS and Android. It's not supported on WP8 due to API limitation. + + - Added function to turn Flash ON by default + + - Fixed 'frameworks was not added to the references' on WP8 + + - Fixed freezing if missing org.apache.cordova.device plugin + + - Added x86 lib for Android + + + + Changes in 1.2: + + - Registering calls moved from native code to MWBScanner.js + + You can now enter your licensing info without changing the native code of plugin; + + - Import package_name.R manually after adding Android plugin is not necessary anymore + + - Decoding library updated to 2.9.31 + + + + Changes in 1.1: + + - Advanced Overlay (MWBsetOverlayMode: function(overlayMode) + + You can now choose between Simple Image Overlay and MW Dynamic Overlay, which shows the actual + viewfinder, depending on selected barcode types and their respective scanning rectangles; + + - Orientation parameter (MWBsetInterfaceOrientation: function(interfaceOrientation)) + + Now there's only a single function for supplying orientation parameters which makes tweaking the + controller for changing scanner orientation no longer needed; + + - Enable or disable high resolution scanning (MWBenableHiRes: function(enableHiRes)) + + Added option to choose between high or normal resolution scanning to better match user + application requirements; + + - Flash handling (MWBenableFlash: function(enableFlash)) + + Added option to enable or disable the flash toggle button; + + + */ + + var CONSTANTS = { + /** + * @name Basic return values for API functions + * @{ + */ + MWB_RT_OK : 0, + MWB_RT_FAIL : -1, + MWB_RT_NOT_SUPPORTED : -2, + MWB_RT_BAD_PARAM : -3, + + + + /** @brief Code39 decoder flags value: require checksum check + */ + MWB_CFG_CODE39_REQUIRE_CHECKSUM : 0x2, + /**/ + + /** @brief Code39 decoder flags value: don't require stop symbol - can lead to false results + */ + MWB_CFG_CODE39_DONT_REQUIRE_STOP : 0x4, + /**/ + + /** @brief Code39 decoder flags value: decode full ASCII + */ + MWB_CFG_CODE39_EXTENDED_MODE : 0x8, + /**/ + + /** @brief Code93 decoder flags value: decode full ASCII + */ + MWB_CFG_CODE93_EXTENDED_MODE : 0x8, + /**/ + + + /** @brief Code25 decoder flags value: require checksum check + */ + MWB_CFG_CODE25_REQ_CHKSUM : 0x1, + /**/ + + /** @brief Code11 decoder flags value: require checksum check + * MWB_CFG_CODE11_REQ_SINGLE_CHKSUM is set by default + */ + MWB_CFG_CODE11_REQ_SINGLE_CHKSUM: 0x1, + MWB_CFG_CODE11_REQ_DOUBLE_CHKSUM: 0x2, + /**/ + + /** @brief MSI Plessey decoder flags value: require checksum check + * MWB_CFG_MSI_REQ_10_CHKSUM is set by default + */ + MWB_CFG_MSI_REQ_10_CHKSUM : 0x01, + MWB_CFG_MSI_REQ_1010_CHKSUM : 0x02, + MWB_CFG_MSI_REQ_11_IBM_CHKSUM : 0x04, + MWB_CFG_MSI_REQ_11_NCR_CHKSUM : 0x08, + MWB_CFG_MSI_REQ_1110_IBM_CHKSUM : 0x10, + MWB_CFG_MSI_REQ_1110_NCR_CHKSUM : 0x20, + /**/ + + /** @brief Codabar decoder flags value: include start/stop symbols in result + */ + MWB_CFG_CODABAR_INCLUDE_STARTSTOP : 0x1, + /**/ + + + + /** @brief Barcode decoder param types + */ + MWB_PAR_ID_RESULT_PREFIX : 0x10, + MWB_PAR_ID_ECI_MODE : 0x08, + /**/ + + /** @brief Barcode param values + */ + + MWB_PAR_VALUE_ECI_DISABLED : 0x00, //default + MWB_PAR_VALUE_ECI_ENABLED : 0x01, + + MWB_PAR_VALUE_RESULT_PREFIX_NEVER : 0x00, // default + MWB_PAR_VALUE_RESULT_PREFIX_ALWAYS : 0x01, + MWB_PAR_VALUE_RESULT_PREFIX_DEFAULT : 0x02, + /**/ + + + /** @brief UPC/EAN decoder disable addons detection + */ + MWB_CFG_EANUPC_DISABLE_ADDON : 0x1, + /**/ + + /** @brief Global decoder flags value: apply sharpening on input image + */ + MWB_CFG_GLOBAL_HORIZONTAL_SHARPENING : 0x01, + MWB_CFG_GLOBAL_VERTICAL_SHARPENING : 0x02, + MWB_CFG_GLOBAL_SHARPENING : 0x03, + + /** @brief Global decoder flags value: apply rotation on input image + */ + MWB_CFG_GLOBAL_ROTATE90 : 0x04, + + /** + * @name Bit mask identifiers for supported decoder types + * @{ */ + MWB_CODE_MASK_NONE : 0x00000000, + MWB_CODE_MASK_QR : 0x00000001, + MWB_CODE_MASK_DM : 0x00000002, + MWB_CODE_MASK_RSS : 0x00000004, + MWB_CODE_MASK_39 : 0x00000008, + MWB_CODE_MASK_EANUPC : 0x00000010, + MWB_CODE_MASK_128 : 0x00000020, + MWB_CODE_MASK_PDF : 0x00000040, + MWB_CODE_MASK_AZTEC : 0x00000080, + MWB_CODE_MASK_25 : 0x00000100, + MWB_CODE_MASK_93 : 0x00000200, + MWB_CODE_MASK_CODABAR : 0x00000400, + MWB_CODE_MASK_DOTCODE : 0x00000800, + MWB_CODE_MASK_11 : 0x00001000, + MWB_CODE_MASK_MSI : 0x00002000, + MWB_CODE_MASK_ALL : 0xffffffff, + /** @} */ + + + /** + * @name Bit mask identifiers for RSS decoder types + * @{ */ + MWB_SUBC_MASK_RSS_14 : 0x00000001, + MWB_SUBC_MASK_RSS_LIM : 0x00000004, + MWB_SUBC_MASK_RSS_EXP : 0x00000008, + /** @} */ + + /** + * @name Bit mask identifiers for Code 2 of 5 decoder types + * @{ */ + MWB_SUBC_MASK_C25_INTERLEAVED : 0x00000001, + MWB_SUBC_MASK_C25_STANDARD : 0x00000002, + MWB_SUBC_MASK_C25_ITF14 : 0x00000004, + /** @} */ + + /** + * @name Bit mask identifiers for UPC/EAN decoder types + * @{ */ + MWB_SUBC_MASK_EANUPC_EAN_13 : 0x00000001, + MWB_SUBC_MASK_EANUPC_EAN_8 : 0x00000002, + MWB_SUBC_MASK_EANUPC_UPC_A : 0x00000004, + MWB_SUBC_MASK_EANUPC_UPC_E : 0x00000008, + /** @} */ + + /** + * @name Bit mask identifiers for 1D scanning direction + * @{ */ + MWB_SCANDIRECTION_HORIZONTAL : 0x00000001, + MWB_SCANDIRECTION_VERTICAL : 0x00000002, + MWB_SCANDIRECTION_OMNI : 0x00000004, + MWB_SCANDIRECTION_AUTODETECT : 0x00000008, + /** @} */ + + FOUND_NONE : 0, + FOUND_DM : 1, + FOUND_39 : 2, + FOUND_RSS_14 : 3, + FOUND_RSS_14_STACK : 4, + FOUND_RSS_LIM : 5, + FOUND_RSS_EXP : 6, + FOUND_EAN_13 : 7, + FOUND_EAN_8 : 8, + FOUND_UPC_A : 9, + FOUND_UPC_E : 10, + FOUND_128 : 11, + FOUND_PDF : 12, + FOUND_QR : 13, + FOUND_AZTEC : 14, + FOUND_25_INTERLEAVED :15, + FOUND_25_STANDARD : 16, + FOUND_93 : 17, + FOUND_CODABAR : 18, + FOUND_DOTCODE : 19, + FOUND_128_GS1 : 20, + FOUND_ITF14 : 21, + FOUND_11 : 22, + FOUND_MSI : 23, + FOUND_25_IATA : 24, + OrientationPortrait : 'Portrait', + OrientationLandscapeLeft : 'LandscapeLeft', + OrientationLandscapeRight : 'LandscapeRight', + OverlayModeNone : 0, + OverlayModeMW : 1, + OverlayModeImage : 2 + }; + + + var BarcodeScanner = { + + /** + * Init decoder with default params. + */ + MWBinitDecoder: function(callback) { + cordova.exec(callback, function(){}, "MWBarcodeScanner", "initDecoder", []); + }, + + /** + * result.code - string representation of barcode result + * result.type - type of barcode detected or 'Cancel' if scanning is canceled + * result.bytes - bytes array of raw barcode result + * result.isGS1 - (boolean) barcode is GS1 compliant + * result.location - contains rectangle points p1,p2,p3,p4 with the corresponding x,y + * result.imageWidth - Width of the scanned image + * result.imageHeight - Height of the scanned image + */ + MWBstartScanning: function(callback,x,y,width,height) { + var args = Array.prototype.slice.call(arguments); + if(args.length>1){ + cordova.exec(callback, function(err) { + callback('Error: ' + err); + }, "MWBarcodeScanner", "startScannerView", [x,y,width,height]); + + }else{ + cordova.exec(callback, function(err) { + callback('Error: ' + err); + }, "MWBarcodeScanner", "startScanner", []); + + } + }, + + /** + * Registers licensing information with single selected decoder type. + * If registering information is correct, enables full support for selected + * decoder type. + * It should be called once per decoder type. + * + * @param[in] codeMask Single decoder type selector (MWB_CODE_MASK_...) + * @param[in] userName User name string + * @param[in] key License key string + * + * @retval MWB_RT_OK Registration successful + * @retval MWB_RT_FAIL Registration failed + * @retval MWB_RT_BAD_PARAM More than one decoder flag selected + * @retval MWB_RT_NOT_SUPPORTED Selected decoder type or its registration + * is not supported + */ + MWBregisterCode: function(codeMask, userName, key) { + cordova.exec(function(){}, function(){}, "MWBarcodeScanner", "registerCode", [codeMask, userName, key]); + }, + + /** + * Sets active or inactive status of decoder types + * + * @param[in] activeCodes ORed bit flags (MWB_CODE_MASK_...) of decoder types + * to be activated. + */ + MWBsetActiveCodes: function(activeCodes) { + cordova.exec(function(){}, function(){}, "MWBarcodeScanner", "setActiveCodes", [activeCodes]); + }, + + /** + * Set active subcodes for given code group flag. + * Subcodes under some decoder type are all activated by default. + * + * @param[in] codeMask Single decoder type/group (MWB_CODE_MASK_...) + * @param[in] subMask ORed bit flags of requested decoder subtypes (MWB_SUBC_MASK_) + */ + MWBsetActiveSubcodes: function(codeMask, activeSubcodes) { + cordova.exec(function(){}, function(){}, "MWBarcodeScanner", "setActiveSubcodes", [codeMask, activeSubcodes]); + }, + + /** + * MWBsetFlags configures options (if any) for decoder type specified in codeMask. + * Options are given in flags as bitwise OR of option bits. Available options depend on selected decoder type. + * + * @param[in] codeMask Single decoder type (MWB_CODE_MASK_...) + * @param[in] flags ORed bit mask of selected decoder type options (MWB_FLAG_...) + */ + MWBsetFlags: function(codeMask, flags) { + cordova.exec(function(){}, function(){}, "MWBarcodeScanner", "setFlags", [codeMask, flags]); + }, + + /** + * MWBsetMinLength configures minimum result length for decoder type specified in codeMask. + * + * @param[in] codeMask Single decoder type (MWB_CODE_MASK_...) + * @param[in] minLength Minimum result length for selected decoder type + */ + MWBsetMinLength: function(codeMask, minLength) { + cordova.exec(function(){}, function(){}, "MWBarcodeScanner", "setMinLength", [codeMask, minLength]); + }, + + /** + * This function enables some control over scanning lines choice for 1D barcodes. By ORing + * available bit-masks user can add one or more direction options to scanning lines set. + * @n - MWB_SCANDIRECTION_HORIZONTAL - horizontal lines + * @n - MWB_SCANDIRECTION_VERTICAL - vertical lines + * @n - MWB_SCANDIRECTION_OMNI - omnidirectional lines + * @n - MWB_SCANDIRECTION_AUTODETECT - enables BarcodeScanner's + * autodetection of barcode direction + * + * @param[in] direction ORed bit mask of direction modes given with + * MWB_SCANDIRECTION_... bit-masks + */ + MWBsetDirection: function(direction) { + cordova.exec(function(){}, function(){}, "MWBarcodeScanner", "setDirection", [direction]); + }, + + /** + * Sets rectangular area for barcode scanning with selected single decoder type. + * After MWBsetScanningRect() call, all subseqent scans will be restricted + * to this region. If rectangle is not set, whole image is scanned. + * Also, if width or height is zero, whole image is scanned. + * + * Parameters are interpreted as percentage of image dimensions, i.e. ranges are + * 0 - 100 for all parameters. + * + * @param[in] codeMask Single decoder type selector (MWB_CODE_MASK_...) + * @param[in] left X coordinate of left edge (percentage) + * @param[in] top Y coordinate of top edge (percentage) + * @param[in] width Rectangle witdh (x axis) (percentage) + * @param[in] height Rectangle height (y axis) (percentage) + */ + MWBsetScanningRect: function(codeMask, left, top, width, height) { + cordova.exec(function(){}, function(){}, "MWBarcodeScanner", "setScanningRect", [codeMask, left, top, width, height]); + }, + + /** + * Barcode detector relies on image processing and geometry inerpolation for + * extracting optimal data for decoding. Higher effort level involves more processing + * and intermediate parameter values, thus increasing probability of successful + * detection with low quality images, but also consuming more CPU time. + * + * @param[in] level Effort level - available values are 1, 2, 3, 4 and 5. + * Levels greater than 3 are not suitable fro real-time decoding + */ + MWBsetLevel: function(level) { + cordova.exec(function(){}, function(){}, "MWBarcodeScanner", "setLevel", [level]); + }, + + /** + * Sets prefered User Interface orientation of scanner screen + * Choose one fo the available values: + * OrientationPortrait + * OrientationLandscapeLeft + * OrientationLandscapeRight + * + * Default value is OrientationLandscapeLeft + */ + MWBsetInterfaceOrientation: function(interfaceOrientation) { + cordova.exec(function(){}, function(){}, "MWBarcodeScanner", "setInterfaceOrientation", [interfaceOrientation]); + }, + + /** + * Choose overlay graphics type for scanning screen: + * OverlayModeNone - No overlay is displayed + * OverlayModeMW - Use MW Dynamic Viewfinder with blinking line (you can customize display options + * in native class by changing defaults) + * OverlayModeImage - Show image on top of camera preview + * + * Default value is OverlayModeMW + */ + MWBsetOverlayMode: function(overlayMode) { + cordova.exec(function(){}, function(){}, "MWBarcodeScanner", "setOverlayMode", [overlayMode]); + }, + + /** + * Enable or disable high resolution scanning. It's recommended to enable it when target barcodes + * are of high density or small footprint. If device doesn't support high resolution param will be ignored + * + * Default value is true (enabled) + */ + MWBenableHiRes: function(enableHiRes) { + cordova.exec(function(){}, function(){}, "MWBarcodeScanner", "enableHiRes", [enableHiRes]); + }, + + /** + * Enable or disable flash toggle button on scanning screen. If device doesn't support flash mode + * button will be hidden regardles of param + * + * Default value is true (enabled) + */ + MWBenableFlash: function(enableFlash) { + cordova.exec(function(){}, function(){}, "MWBarcodeScanner", "enableFlash", [enableFlash]); + }, + + /** + * Set default state of flash (torch) when scanner activity is started + * + * Default value is false (disabled) + */ + MWBturnFlashOn: function(flashOn) { + cordova.exec(function(){}, function(){}, "MWBarcodeScanner", "turnFlashOn", [flashOn]); + }, +/** +* Toggle on/off flash state +* +*/ +MWBtoggleFlash: function() { + cordova.exec(function(){}, function(){}, "MWBarcodeScanner", "toggleFlash", []); +}, + + /** + * Enable or disable zoom button on scanning screen. If device doesn't support zoom, + * button will be hidden regardles of param. Zoom is not supported on Windows Phone 8 + * as there's no zooming api available! + * + * Default value is true (enabled) + */ + MWBenableZoom: function(enableZoom) { + cordova.exec(function(){}, function(){}, "MWBarcodeScanner", "enableZoom", [enableZoom]); + }, + + /** + * Set two desired zoom levels in percentage and initial level. Set first two params to zero for default + * levels. On iOS, first zoom level is set to maximum non-interpolated level available on device, and + * second is double of first level. On Android, default first zoom is 150% and second is 300%. Zoom is + * not supported on Windows Phone 8 as there's no zooming api available! + * Initial zoom level can be 0 (100% - non zoomed), 1 (zoomLevel1) or 2 (zoomLevel2). Default is 0. + * + */ + MWBsetZoomLevels: function(zoomLevel1, zoomLevel2, initialZoomLevel) { + cordova.exec(function(){}, function(){}, "MWBarcodeScanner", "setZoomLevels", [zoomLevel1, zoomLevel2, initialZoomLevel]); + }, +/** + * Toggle on/off zoom state + * + */ +MWBtoggleZoom: function() { + cordova.exec(function(){}, function(){}, "MWBarcodeScanner", "toggleZoom", []); +}, + + /** + * Set maximum threads to be used for decoding. Value will be limited to maximum available CPU cores. + * Default is 4 (will trim to max available value). Set to 1 to disable multi-threaded decoding + */ + MWBsetMaxThreads: function (maxThreads) { + cordova.exec(function () { }, function () { }, "MWBarcodeScanner", "setMaxThreads", [maxThreads]); + }, + + + /** + * Set custom key:value pair which is accesible from native code. + */ + MWBsetCustomParam: function(key, value) { + cordova.exec(function(){}, function(){}, "MWBarcodeScanner", "setCustomParam", [key, value]); + }, + + + /** + * Enable/disable continuous scanning. If 'shouldClose' is 'false', result callback will be performed and + * scanner will be paused. The User can call 'resumeScanning' to continue scanning, or 'closeScanner' + * for closing the scanner. Default is 'true'. + * Function is not available on WP8 due to the technical limitations. + */ + MWBcloseScannerOnDecode: function(shouldClose) { + cordova.exec(function(){}, function(){}, "MWBarcodeScanner", "closeScannerOnDecode", [shouldClose]); + }, + /** + * Resume scanning. Use this method if already using MWBcloseScannerOnDecode(false). + * Function is not available on WP8 due to the technical limitations. + */ + MWBresumeScanning: function() { + cordova.exec(function(){}, function(){}, "MWBarcodeScanner", "resumeScanning", []); + }, + /** + * Close scanner. Use this method if already using MWBcloseScannerOnDecode(false). + * Function is not available on WP8 due to the technical limitations. + */ + MWBcloseScanner: function() { + cordova.exec(function(){}, function(){}, "MWBarcodeScanner", "closeScanner", []); + }, + /** + * Use 60 fps when available. + * Function is only available on iOS. + * Default is 'false' + */ + MWBuse60fps: function(use) { + cordova.exec(function(){}, function(){}, "MWBarcodeScanner", "use60fps", [use]); + }, + /** + * Scan image. + * imageURI - path to the image to be scanned. + */ + MWBscanImage: function(imageURI, callback) { + cordova.exec(callback, function(){}, "MWBarcodeScanner", "scanImage", [imageURI]); + }, + /** + * Set custom decoder param. + * MWB_setParam set custom decoder param id/value pair for decoder type specified in \a codeMask. + * codeMask Single decoder type (MWB_CODE_MASK_...) + * paramId ID of param + * paramValue Integer value of param + */ + MWBsetParam: function(codeMask, paramId, paramValue) { + cordova.exec(function(){}, function(){}, "MWBarcodeScanner", "setParam", [codeMask, paramId, paramValue]); + }, + /** + * Remove scanner view + */ + MWBstopScannerView: function() { + cordova.exec(function(){}, function(){}, "MWBarcodeScanner", "stopScanner", []); + }, + /** + * Pause scanner view + */ + MWBtogglePauseResume: function() { + cordova.exec(function(){}, function(){}, "MWBarcodeScanner", "togglePauseResume", []); + }, + /** + * Ignore result if scanned the same code in continuous scanning mode + * + * delay Time interval between 2 scan results with the same result.code in milliseconds + */ + MWBduplicateCodeDelay: function(delay) { + cordova.exec(function(){}, function(){}, "MWBarcodeScanner", "duplicateCodeDelay", [delay]); + } + + }; + +//change these registration settings to match your licence keys +/* BEGIN Registration settings */ +//if your app doesn't work after setting license keys, try to uncomment the try-catch, and see what the error is + +// try{ + var mwregister = { + 'Android' : { + 'MWB_CODE_MASK_25' : {'username' : '', 'key' : ''}, + 'MWB_CODE_MASK_39' : {'username':'','key':''}, + 'MWB_CODE_MASK_93' : {'username':'','key':''}, + 'MWB_CODE_MASK_128' : {'username':'','key':''}, + 'MWB_CODE_MASK_AZTEC' : {'username':'','key':''}, + 'MWB_CODE_MASK_DM' : {'username':'','key':''}, + 'MWB_CODE_MASK_PDF' : {'username':'','key':''}, + 'MWB_CODE_MASK_QR' : {'username':'','key':''}, + 'MWB_CODE_MASK_RSS' : {'username':'','key':''}, + 'MWB_CODE_MASK_CODABAR' : {'username':'','key':''}, + 'MWB_CODE_MASK_11' : {'username':'','key':''}, + 'MWB_CODE_MASK_MSI' : {'username':'','key':''}, + 'MWB_CODE_MASK_DOTCODE' : {'username':'','key':''} + }, + 'iOS' :{ + 'MWB_CODE_MASK_25' : {'username' : '', 'key' : ''}, + 'MWB_CODE_MASK_39' : {'username':'','key':''}, + 'MWB_CODE_MASK_93' : {'username':'','key':''}, + 'MWB_CODE_MASK_128' : {'username':'','key':''}, + 'MWB_CODE_MASK_AZTEC' : {'username':'','key':''}, + 'MWB_CODE_MASK_DM' : {'username':'','key':''}, + 'MWB_CODE_MASK_PDF' : {'username':'','key':''}, + 'MWB_CODE_MASK_QR' : {'username':'','key':''}, + 'MWB_CODE_MASK_RSS' : {'username':'','key':''}, + 'MWB_CODE_MASK_CODABAR' : {'username':'','key':''}, + 'MWB_CODE_MASK_11' : {'username':'','key':''}, + 'MWB_CODE_MASK_MSI' : {'username':'','key':''}, + 'MWB_CODE_MASK_DOTCODE' : {'username':'','key':''} + }, + 'Win32NT' : { + 'MWB_CODE_MASK_25' : {'username' : '', 'key' : ''}, + 'MWB_CODE_MASK_39' : {'username':'','key':''}, + 'MWB_CODE_MASK_93' : {'username':'','key':''}, + 'MWB_CODE_MASK_128' : {'username':'','key':''}, + 'MWB_CODE_MASK_AZTEC' : {'username':'','key':''}, + 'MWB_CODE_MASK_DM' : {'username':'','key':''}, + 'MWB_CODE_MASK_PDF' : {'username':'','key':''}, + 'MWB_CODE_MASK_QR' : {'username':'','key':''}, + 'MWB_CODE_MASK_RSS' : {'username':'','key':''}, + 'MWB_CODE_MASK_CODABAR' : {'username':'','key':''}, + 'MWB_CODE_MASK_11' : {'username':'','key':''}, + 'MWB_CODE_MASK_MSI' : {'username':'','key':''}, + 'MWB_CODE_MASK_DOTCODE' : {'username':'','key':''} + } + } +// } +// catch(e){ +// console.log(e); +// } +/* END registration settings */ + scanner = {}; + +scanner.stopScanner= function(){ + BarcodeScanner.MWBstopScannerView(); +} +scanner.togglePauseResume= function(){ + BarcodeScanner.MWBtogglePauseResume(); +} +scanner.toggleFlash = function(){ + BarcodeScanner.MWBtoggleFlash(); +} +scanner.toggleZoom = function(){ + BarcodeScanner.MWBtoggleZoom(); +} + +scanner.scanImage =function(initMWBS,callbackMWBS,imageURI){ + + + var args = Array.prototype.slice.call(arguments); + + // console.log(arguments); + // console.log('--------'); + // console.log(args); + + var initMWBS = (args.length>1)?args[0]:false, + callbackMWBS = (args.length>1)?args[1]:false, + imageURI = (args.length>1)?args[2]:args[0]; + + + + //Initialize decoder with default params + BarcodeScanner.MWBinitDecoder(function(){ + var initFunc = (typeof initMWBS === 'function')?initMWBS:function(mwbs,constants,dvc){ + + console.log('Init function defined in MWBScanner.js invoked'); + + var platform = mwregister[dvc.platform]; + + Object.keys(platform).forEach(function(reg_codes){ + mwbs['MWBregisterCode'](constants[reg_codes],platform[reg_codes]['username'],platform[reg_codes]['key']); + }); + + + // console.log('JS registration ends: '+ (new Date()).getTime()); + // console.log('JS Settings starts: '+ (new Date()).getTime()); + //settings portion, disable those that are not needed + + /* BEGIN settings CALLS */ + //if your code doesn't work after changing a few parameters, and there is no error output, uncomment the try-catch, the error will be output in your console + // try{ + // mwbs['MWBsetActiveCodes'](constants.MWB_CODE_MASK_128 | constants.MWB_CODE_MASK_QR); + // mwbs['MWBsetFlags'](constants.MWB_CODE_MASK_39, constants.MWB_CFG_CODE39_EXTENDED_MODE); + // mwbs['MWBsetDirection'](constants.MWB_SCANDIRECTION_VERTICAL | constants.MWB_SCANDIRECTION_HORIZONTAL); + // mwbs['MWBsetScanningRect'](constants.MWB_CODE_MASK_39, 20,20,60,60); + // mwbs['MWBsetMinLength'](constants.MWB_CODE_MASK_39, 4); + // mwbs['MWBsetParam'](constants.MWB_CODE_MASK_DM, constants.MWB_PAR_ID_RESULT_PREFIX, constants.MWB_PAR_VALUE_RESULT_PREFIX_ALWAYS); + + + // console.log('JS Settings ends: '+ (new Date()).getTime()); + // } + // catch(e){ + // console.log(e); + // } + + /* END settings CALLS */ + + /* CUSTOM JAVASCRIPT CALLS */ + + + }; + //call the init function + initFunc(BarcodeScanner,CONSTANTS,device); + + var callFunc = (typeof callbackMWBS === 'function')?callbackMWBS:function(result){ + + console.log('MWBScanner Defined callback Invoked'); + + /** + * result.code - string representation of barcode result + * result.type - type of barcode detected or 'Cancel' if scanning is canceled + * result.bytes - bytes array of raw barcode result + * result.isGS1 - (boolean) barcode is GS1 compliant + * result.location - contains rectangle points p1,p2,p3,p4 with the corresponding x,y + * result.imageWidth - Width of the scanned image + * result.imageHeight - Height of the scanned image + */ + + if (result.type == 'NoResult'){ + //Perform some action on scanning canceled if needed + } + else if (result && result.code){ + + navigator.notification.alert(result.code, function(){}, result.type + (result.isGS1?" (GS1)":""), 'Close'); + + } + } + + + BarcodeScanner['MWBscanImage'](imageURI ,callFunc); + + }); + + } + + var x,y,width,height; + + scanner.startScanning = function(initMWBS,callbackMWBS) { + var args = Array.prototype.slice.call(arguments); + + + + var initMWBS = (args.length == 2 || args.length == 6)?args[0]:false, + callbackMWBS = (args.length == 2 || args.length == 6)?args[1]:false; + + x=y=width=height =false; + + if(args.length == 4){ + x = args[0], + y = args[1], + width = args[2], + height = args[3]; + }else if(args.length == 6){ + x = args[2], + y = args[3], + width = args[4], + height = args[5]; + } + + //Initialize decoder with default params + BarcodeScanner.MWBinitDecoder(function(){ + + var initFunc = (typeof initMWBS === 'function')?initMWBS:function(mwbs,constants,dvc){ + + console.log('Init function defined in MWBScanner.js invoked'); + + /* END registration settings */ + var platform = mwregister[dvc.platform]; + + Object.keys(platform).forEach(function(reg_codes){ + mwbs['MWBregisterCode'](constants[reg_codes],platform[reg_codes]['username'],platform[reg_codes]['key']); + }); + + + // console.log('JS registration ends: '+ (new Date()).getTime()); + // console.log('JS Settings starts: '+ (new Date()).getTime()); + //settings portion, disable those that are not needed + + /* BEGIN settings CALLS */ + //if your code doesn't work after changing a few parameters, and there is no error output, uncomment the try-catch, the error will be output in your console + // try{ + // mwbs['MWBsetInterfaceOrientation'] (constants.OrientationPortrait); + // mwbs['MWBsetOverlayMode'](constants.OverlayModeImage); + // mwbs['MWBenableHiRes'](true); + // mwbs['MWBenableFlash'](true); + // mwbs['MWBsetActiveCodes'](constants.MWB_CODE_MASK_128 | constants.MWB_CODE_MASK_39); + // mwbs['MWBsetLevel'](2); + // mwbs['MWBsetFlags'](constants.MWB_CODE_MASK_39, constants.MWB_CFG_CODE39_EXTENDED_MODE); + // mwbs['MWBsetDirection'](constants.MWB_SCANDIRECTION_VERTICAL | constants.MWB_SCANDIRECTION_HORIZONTAL); + // mwbs['MWBsetScanningRect'](constants.MWB_CODE_MASK_39, 20,20,60,60); + // mwbs['MWBenableZoom'](true); + // mwbs['MWBsetZoomLevels'](200, 400, 0); + // mwbs['MWBsetMinLength'](constants.MWB_CODE_MASK_39, 4); + // mwbs['MWBsetMaxThreads'](1); + // mwbs['MWBcloseScannerOnDecode'](false); + // mwbs['MWBuse60fps'](true); + // mwbs['MWBsetParam'](constants.MWB_CODE_MASK_DM, constants.MWB_PAR_ID_RESULT_PREFIX, constants.MWB_PAR_VALUE_RESULT_PREFIX_ALWAYS); + // mwbs['MWBduplicateCodeDelay'](1000); + + + + // console.log('JS Settings ends: '+ (new Date()).getTime()); + // } + // catch(e){ + // console.log(e); + // } + + /* END settings CALLS */ + + /* CUSTOM JAVASCRIPT CALLS */ + + }; + //call the init function + initFunc(BarcodeScanner,CONSTANTS,device); + + var callFunc = (typeof callbackMWBS === 'function')?callbackMWBS:function(result){ + + console.log('MWBScanner Defined callback Invoked'); + + /** + * result.code - string representation of barcode result + * result.type - type of barcode detected or 'Cancel' if scanning is canceled + * result.bytes - bytes array of raw barcode result + * result.isGS1 - (boolean) barcode is GS1 compliant + * result.location - contains rectangle points p1,p2,p3,p4 with the corresponding x,y + * result.imageWidth - Width of the scanned image + * result.imageHeight - Height of the scanned image + */ + + if (result.type == 'Cancel'){ + //Perform some action on scanning canceled if needed + } + else if (result && result.code){ + + /* + * Use this sample if scanning in view + */ + /* + var para = document.createElement("li"); + var node = document.createTextNode(result.code+" : "+result.type); + para.appendChild(node); + + var element = document.getElementById("mwb_list"); + element.appendChild(para); + */ + + + /* + * Use this sample when using mwbs['MWBcloseScannerOnDecode'](false); + */ + /* + setTimeout(function(){ + BarcodeScanner.MWBresumeScanning(); + },2000); + */ + + navigator.notification.alert(result.code, function(){}, result.type + (result.isGS1?" (GS1)":""), 'Close'); + + } + } + + console.log('JS Starting Scanner: '+ (new Date()).getTime()); + // Call the barcode scanner screen + if(x === false){ + BarcodeScanner.MWBstartScanning(callFunc); // Scan using full screen + }else{ + BarcodeScanner.MWBstartScanning(callFunc, x,y,width,height); // Scan using view with: x, y, width, height (percentage of screen size) + } + }); + } + module.exports = scanner; +}); diff --git a/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/plugins/cordova-native-camera/www/index-android.js b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/plugins/cordova-native-camera/www/index-android.js new file mode 100755 index 00000000..3c8f20ad --- /dev/null +++ b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/plugins/cordova-native-camera/www/index-android.js @@ -0,0 +1,205 @@ +cordova.define("cordova-native-camera.NativeCamera", function(require, exports, module) { +var mediaDevices = { + video: [], + audio: [] +}; +var retreivedDevices = false; + +var _currentStream = null; +var _mediaRecorder = null; +var _fileWriter = null; +var _fileEntry = null; +var _writeBuffer = []; + +var isWriting = false; + +exports.Position = { + FRONT: 0, + BACK: 1, + UNSPECIFIED: 2 +}; + +var _video = null; +var _canvas = null; +exports.size = { + width: 0, + height: 0 +}; + +var isInitialized = false; +var context; + +function b64toBlob(b64Data, contentType, sliceSize) { + contentType = contentType || ''; + sliceSize = sliceSize || 512; + + var byteCharacters = atob(b64Data); + var byteArrays = []; + + for (var offset = 0; offset < byteCharacters.length; offset += sliceSize) { + var slice = byteCharacters.slice(offset, offset + sliceSize); + + var byteNumbers = new Array(slice.length); + for (var i = 0; i < slice.length; i++) { + byteNumbers[i] = slice.charCodeAt(i); + } + + var byteArray = new Uint8Array(byteNumbers); + + byteArrays.push(byteArray); + } + + var blob = new Blob(byteArrays, {type: contentType}); + return blob; +} + +var _attemptWriting = function() { + if(!_fileWriter) { + return; + } + if(_writeBuffer.length>0 && _fileWriter.readyState!==1) { + _fileWriter.write(_writeBuffer.shift()); + } +}; + +var _initMediaRecorder = function() { + _mediaRecorder = new MediaRecorder(_currentStream); + _mediaRecorder.ondataavailable = function(e) { + if(e.data.size){ + _writeBuffer.push(e.data); + _attemptWriting(); + } + }; + + _mediaRecorder.start(100); +}; + +exports.showVideo = function(side) { + if(!isInitialized) { + _video = document.getElementById('camera-video'); + _canvas = document.createElement('CANVAS'); + + _video.addEventListener('canplay', function(ev) { + exports.size.width = _video.videoWidth; + exports.size.height = _video.videoHeight; + _canvas.setAttribute('width', exports.size.width); + _canvas.setAttribute('height', exports.size.height); + }); + // context = canvas.getContext("2d"); + isInitialized = true; + } + cordova.plugins.diagnostic.requestRuntimePermissions(function(status) { + function doVideo() { + side = side % mediaDevices.video.length; + currentVideoStreamIdx = side; + + var constraints = { + audio: true, + video: { + deviceId: { + exact: mediaDevices.video[side].deviceId + }, + width: 1280, + height: 720, + frameRate: {ideal: 30, max: 60} + } + }; + navigator.mediaDevices.getUserMedia(constraints) + .then(function(stream){ + _currentStream = stream; + if(_mediaRecorder) { + _initMediaRecorder(); + } + + _video.src = URL.createObjectURL(stream); + }); + } + + if(!retreivedDevices) { + navigator.mediaDevices.enumerateDevices() + .then(function(devices){ + for(var i=0; i 0) { + _attemptWriting(); + } + else if(_mediaRecorder.state !== 'recording') { + success(_filename); + } + }; + _fileWriter = fileWriter; + _initMediaRecorder(); + }); + }); + }); +}; + +exports.stopRecording = function() { + _mediaRecorder.stop(); +}; + +exports.takePhoto = function(success) { + var context = _canvas.getContext('2d'); + + _canvas.width = exports.size.width; + _canvas.height = exports.size.height; + + context.drawImage(_video, 0, 0, exports.size.width, exports.size.height); + + var photoUrl = _canvas.toDataURL('image/jpeg', 0.85); + var block = photoUrl.split(";"); + + var dataType = block[0].split(":")[1];// In this case "image/png" + // get the real base64 content of the file + var realData = block[1].split(",")[1];// In this case "iVBORw0KGg...." + + // document.getElementById('out-photo').src = photoUrl; + + window.resolveLocalFileSystemURL(cordova.file.dataDirectory, function (dirEntry) { + var timestamp = Math.round((new Date()).getTime() / 1000); + var _filename = 'culp_'+timestamp+'.jpg'; + + dirEntry.getFile(_filename, {create: true, exclusive: false}, function(fileEntry) { + fileEntry.createWriter(function(fileWriter) { + fileWriter.onwriteend = function() { + success(_filename); + }; + fileWriter.write(b64toBlob(realData, dataType)); + }); + }); + }); +}; +}); diff --git a/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/plugins/cordova-plugin-barcodescanner/www/barcodescanner.js b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/plugins/cordova-plugin-barcodescanner/www/barcodescanner.js new file mode 100755 index 00000000..67a375ea --- /dev/null +++ b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/plugins/cordova-plugin-barcodescanner/www/barcodescanner.js @@ -0,0 +1,128 @@ +cordova.define("cordova-plugin-barcodescanner.BarcodeScanner", function(require, exports, module) { +/** + * cordova is available under *either* the terms of the modified BSD license *or* the + * MIT License (2008). See http://opensource.org/licenses/alphabetical for full text. + * + * Copyright (c) Matt Kane 2010 + * Copyright (c) 2011, IBM Corporation + */ + + var ScannerLoader = function (require, exports, module) { + + var exec = require("cordova/exec"); + + /** + * Constructor. + * + * @returns {BarcodeScanner} + */ + function BarcodeScanner() { + + /** + * Encoding constants. + * + * @type Object + */ + this.Encode = { + TEXT_TYPE: "TEXT_TYPE", + EMAIL_TYPE: "EMAIL_TYPE", + PHONE_TYPE: "PHONE_TYPE", + SMS_TYPE: "SMS_TYPE" + // CONTACT_TYPE: "CONTACT_TYPE", // TODO: not implemented, requires passing a Bundle class from Javascript to Java + // LOCATION_TYPE: "LOCATION_TYPE" // TODO: not implemented, requires passing a Bundle class from Javascript to Java + }; + + /** + * Barcode format constants, defined in ZXing library. + * + * @type Object + */ + this.format = { + "all_1D": 61918, + "aztec": 1, + "codabar": 2, + "code_128": 16, + "code_39": 4, + "code_93": 8, + "data_MATRIX": 32, + "ean_13": 128, + "ean_8": 64, + "itf": 256, + "maxicode": 512, + "msi": 131072, + "pdf_417": 1024, + "plessey": 262144, + "qr_CODE": 2048, + "rss_14": 4096, + "rss_EXPANDED": 8192, + "upc_A": 16384, + "upc_E": 32768, + "upc_EAN_EXTENSION": 65536 + }; + }; + + /** + * Read code from scanner. + * + * @param {Function} successCallback This function will recieve a result object: { + * text : '12345-mock', // The code that was scanned. + * format : 'FORMAT_NAME', // Code format. + * cancelled : true/false, // Was canceled. + * } + * @param {Function} errorCallback + */ + BarcodeScanner.prototype.scan = function (successCallback, errorCallback) { + if (errorCallback == null) { + errorCallback = function () { + }; + } + + if (typeof errorCallback != "function") { + console.log("BarcodeScanner.scan failure: failure parameter not a function"); + return; + } + + if (typeof successCallback != "function") { + console.log("BarcodeScanner.scan failure: success callback parameter must be a function"); + return; + } + + exec(successCallback, errorCallback, 'BarcodeScanner', 'scan', []); + }; + + //------------------------------------------------------------------- + BarcodeScanner.prototype.encode = function (type, data, successCallback, errorCallback, options) { + if (errorCallback == null) { + errorCallback = function () { + }; + } + + if (typeof errorCallback != "function") { + console.log("BarcodeScanner.encode failure: failure parameter not a function"); + return; + } + + if (typeof successCallback != "function") { + console.log("BarcodeScanner.encode failure: success callback parameter must be a function"); + return; + } + + exec(successCallback, errorCallback, 'BarcodeScanner', 'encode', [ + {"type": type, "data": data, "options": options} + ]); + }; + + var barcodeScanner = new BarcodeScanner(); + module.exports = barcodeScanner; + + } + + ScannerLoader(require, exports, module); + + cordova.define("cordova/plugin/BarcodeScanner", ScannerLoader); + + + + + +}); diff --git a/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/plugins/cordova-plugin-battery-status/www/battery.js b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/plugins/cordova-plugin-battery-status/www/battery.js new file mode 100755 index 00000000..5394ef82 --- /dev/null +++ b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/plugins/cordova-plugin-battery-status/www/battery.js @@ -0,0 +1,113 @@ +cordova.define("cordova-plugin-battery-status.battery", function(require, exports, module) { +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * +*/ + +/** + * This class contains information about the current battery status. + * @constructor + */ +var cordova = require('cordova'), + exec = require('cordova/exec'); + +var STATUS_CRITICAL = 5; +var STATUS_LOW = 20; + +var Battery = function() { + this._level = null; + this._isPlugged = null; + // Create new event handlers on the window (returns a channel instance) + this.channels = { + batterystatus:cordova.addWindowEventHandler("batterystatus"), + batterylow:cordova.addWindowEventHandler("batterylow"), + batterycritical:cordova.addWindowEventHandler("batterycritical") + }; + for (var key in this.channels) { + this.channels[key].onHasSubscribersChange = Battery.onHasSubscribersChange; + } +}; + +function handlers() { + return battery.channels.batterystatus.numHandlers + + battery.channels.batterylow.numHandlers + + battery.channels.batterycritical.numHandlers; +} + +/** + * Event handlers for when callbacks get registered for the battery. + * Keep track of how many handlers we have so we can start and stop the native battery listener + * appropriately (and hopefully save on battery life!). + */ +Battery.onHasSubscribersChange = function() { + // If we just registered the first handler, make sure native listener is started. + if (this.numHandlers === 1 && handlers() === 1) { + exec(battery._status, battery._error, "Battery", "start", []); + } else if (handlers() === 0) { + exec(null, null, "Battery", "stop", []); + } +}; + +/** + * Callback for battery status + * + * @param {Object} info keys: level, isPlugged + */ +Battery.prototype._status = function (info) { + + if (info) { + if (battery._level !== info.level || battery._isPlugged !== info.isPlugged) { + + if(info.level === null && battery._level !== null) { + return; // special case where callback is called because we stopped listening to the native side. + } + + // Something changed. Fire batterystatus event + cordova.fireWindowEvent("batterystatus", info); + + if (!info.isPlugged) { // do not fire low/critical if we are charging. issue: CB-4520 + // note the following are NOT exact checks, as we want to catch a transition from + // above the threshold to below. issue: CB-4519 + if (battery._level > STATUS_CRITICAL && info.level <= STATUS_CRITICAL) { + // Fire critical battery event + cordova.fireWindowEvent("batterycritical", info); + } + else if (battery._level > STATUS_LOW && info.level <= STATUS_LOW) { + // Fire low battery event + cordova.fireWindowEvent("batterylow", info); + } + } + battery._level = info.level; + battery._isPlugged = info.isPlugged; + } + } +}; + +/** + * Error callback for battery start + */ +Battery.prototype._error = function(e) { + console.log("Error initializing Battery: " + e); +}; + +var battery = new Battery(); // jshint ignore:line + +module.exports = battery; + +}); diff --git a/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/plugins/cordova-plugin-camera/www/Camera.js b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/plugins/cordova-plugin-camera/www/Camera.js new file mode 100755 index 00000000..f0f28530 --- /dev/null +++ b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/plugins/cordova-plugin-camera/www/Camera.js @@ -0,0 +1,188 @@ +cordova.define("cordova-plugin-camera.camera", function(require, exports, module) { +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * +*/ + +var argscheck = require('cordova/argscheck'), + exec = require('cordova/exec'), + Camera = require('./Camera'); + // XXX: commented out + //CameraPopoverHandle = require('./CameraPopoverHandle'); + +/** + * @namespace navigator + */ + +/** + * @exports camera + */ +var cameraExport = {}; + +// Tack on the Camera Constants to the base camera plugin. +for (var key in Camera) { + cameraExport[key] = Camera[key]; +} + +/** + * Callback function that provides an error message. + * @callback module:camera.onError + * @param {string} message - The message is provided by the device's native code. + */ + +/** + * Callback function that provides the image data. + * @callback module:camera.onSuccess + * @param {string} imageData - Base64 encoding of the image data, _or_ the image file URI, depending on [`cameraOptions`]{@link module:camera.CameraOptions} in effect. + * @example + * // Show image + * // + * function cameraCallback(imageData) { + * var image = document.getElementById('myImage'); + * image.src = "data:image/jpeg;base64," + imageData; + * } + */ + +/** + * Optional parameters to customize the camera settings. + * * [Quirks](#CameraOptions-quirks) + * @typedef module:camera.CameraOptions + * @type {Object} + * @property {number} [quality=50] - Quality of the saved image, expressed as a range of 0-100, where 100 is typically full resolution with no loss from file compression. (Note that information about the camera's resolution is unavailable.) + * @property {module:Camera.DestinationType} [destinationType=FILE_URI] - Choose the format of the return value. + * @property {module:Camera.PictureSourceType} [sourceType=CAMERA] - Set the source of the picture. + * @property {Boolean} [allowEdit=true] - Allow simple editing of image before selection. + * @property {module:Camera.EncodingType} [encodingType=JPEG] - Choose the returned image file's encoding. + * @property {number} [targetWidth] - Width in pixels to scale image. Must be used with `targetHeight`. Aspect ratio remains constant. + * @property {number} [targetHeight] - Height in pixels to scale image. Must be used with `targetWidth`. Aspect ratio remains constant. + * @property {module:Camera.MediaType} [mediaType=PICTURE] - Set the type of media to select from. Only works when `PictureSourceType` is `PHOTOLIBRARY` or `SAVEDPHOTOALBUM`. + * @property {Boolean} [correctOrientation] - Rotate the image to correct for the orientation of the device during capture. + * @property {Boolean} [saveToPhotoAlbum] - Save the image to the photo album on the device after capture. + * @property {module:CameraPopoverOptions} [popoverOptions] - iOS-only options that specify popover location in iPad. + * @property {module:Camera.Direction} [cameraDirection=BACK] - Choose the camera to use (front- or back-facing). + */ + +/** + * @description Takes a photo using the camera, or retrieves a photo from the device's + * image gallery. The image is passed to the success callback as a + * Base64-encoded `String`, or as the URI for the image file. + * + * The `camera.getPicture` function opens the device's default camera + * application that allows users to snap pictures by default - this behavior occurs, + * when `Camera.sourceType` equals [`Camera.PictureSourceType.CAMERA`]{@link module:Camera.PictureSourceType}. + * Once the user snaps the photo, the camera application closes and the application is restored. + * + * If `Camera.sourceType` is `Camera.PictureSourceType.PHOTOLIBRARY` or + * `Camera.PictureSourceType.SAVEDPHOTOALBUM`, then a dialog displays + * that allows users to select an existing image. + * + * The return value is sent to the [`cameraSuccess`]{@link module:camera.onSuccess} callback function, in + * one of the following formats, depending on the specified + * `cameraOptions`: + * + * - A `String` containing the Base64-encoded photo image. + * - A `String` representing the image file location on local storage (default). + * + * You can do whatever you want with the encoded image or URI, for + * example: + * + * - Render the image in an `` tag, as in the example below + * - Save the data locally (`LocalStorage`, [Lawnchair](http://brianleroux.github.com/lawnchair/), etc.) + * - Post the data to a remote server + * + * __NOTE__: Photo resolution on newer devices is quite good. Photos + * selected from the device's gallery are not downscaled to a lower + * quality, even if a `quality` parameter is specified. To avoid common + * memory problems, set `Camera.destinationType` to `FILE_URI` rather + * than `DATA_URL`. + * + * __Supported Platforms__ + * + * - Android + * - BlackBerry + * - Browser + * - Firefox + * - FireOS + * - iOS + * - Windows + * - WP8 + * - Ubuntu + * + * More examples [here](#camera-getPicture-examples). Quirks [here](#camera-getPicture-quirks). + * + * @example + * navigator.camera.getPicture(cameraSuccess, cameraError, cameraOptions); + * @param {module:camera.onSuccess} successCallback + * @param {module:camera.onError} errorCallback + * @param {module:camera.CameraOptions} options CameraOptions + */ +cameraExport.getPicture = function(successCallback, errorCallback, options) { + argscheck.checkArgs('fFO', 'Camera.getPicture', arguments); + options = options || {}; + var getValue = argscheck.getValue; + + var quality = getValue(options.quality, 50); + var destinationType = getValue(options.destinationType, Camera.DestinationType.FILE_URI); + var sourceType = getValue(options.sourceType, Camera.PictureSourceType.CAMERA); + var targetWidth = getValue(options.targetWidth, -1); + var targetHeight = getValue(options.targetHeight, -1); + var encodingType = getValue(options.encodingType, Camera.EncodingType.JPEG); + var mediaType = getValue(options.mediaType, Camera.MediaType.PICTURE); + var allowEdit = !!options.allowEdit; + var correctOrientation = !!options.correctOrientation; + var saveToPhotoAlbum = !!options.saveToPhotoAlbum; + var popoverOptions = getValue(options.popoverOptions, null); + var cameraDirection = getValue(options.cameraDirection, Camera.Direction.BACK); + + var args = [quality, destinationType, sourceType, targetWidth, targetHeight, encodingType, + mediaType, allowEdit, correctOrientation, saveToPhotoAlbum, popoverOptions, cameraDirection]; + + exec(successCallback, errorCallback, "Camera", "takePicture", args); + // XXX: commented out + //return new CameraPopoverHandle(); +}; + +/** + * Removes intermediate image files that are kept in temporary storage + * after calling [`camera.getPicture`]{@link module:camera.getPicture}. Applies only when the value of + * `Camera.sourceType` equals `Camera.PictureSourceType.CAMERA` and the + * `Camera.destinationType` equals `Camera.DestinationType.FILE_URI`. + * + * __Supported Platforms__ + * + * - iOS + * + * @example + * navigator.camera.cleanup(onSuccess, onFail); + * + * function onSuccess() { + * console.log("Camera cleanup success.") + * } + * + * function onFail(message) { + * alert('Failed because: ' + message); + * } + */ +cameraExport.cleanup = function(successCallback, errorCallback) { + exec(successCallback, errorCallback, "Camera", "cleanup", []); +}; + +module.exports = cameraExport; + +}); diff --git a/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/plugins/cordova-plugin-camera/www/CameraConstants.js b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/plugins/cordova-plugin-camera/www/CameraConstants.js new file mode 100755 index 00000000..37fc57fb --- /dev/null +++ b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/plugins/cordova-plugin-camera/www/CameraConstants.js @@ -0,0 +1,104 @@ +cordova.define("cordova-plugin-camera.Camera", function(require, exports, module) { +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * +*/ + +/** + * @module Camera + */ +module.exports = { + /** + * @description + * Defines the output format of `Camera.getPicture` call. + * _Note:_ On iOS passing `DestinationType.NATIVE_URI` along with + * `PictureSourceType.PHOTOLIBRARY` or `PictureSourceType.SAVEDPHOTOALBUM` will + * disable any image modifications (resize, quality change, cropping, etc.) due + * to implementation specific. + * + * @enum {number} + */ + DestinationType:{ + /** Return base64 encoded string. DATA_URL can be very memory intensive and cause app crashes or out of memory errors. Use FILE_URI or NATIVE_URI if possible */ + DATA_URL: 0, + /** Return file uri (content://media/external/images/media/2 for Android) */ + FILE_URI: 1, + /** Return native uri (eg. asset-library://... for iOS) */ + NATIVE_URI: 2 + }, + /** + * @enum {number} + */ + EncodingType:{ + /** Return JPEG encoded image */ + JPEG: 0, + /** Return PNG encoded image */ + PNG: 1 + }, + /** + * @enum {number} + */ + MediaType:{ + /** Allow selection of still pictures only. DEFAULT. Will return format specified via DestinationType */ + PICTURE: 0, + /** Allow selection of video only, ONLY RETURNS URL */ + VIDEO: 1, + /** Allow selection from all media types */ + ALLMEDIA : 2 + }, + /** + * @description + * Defines the output format of `Camera.getPicture` call. + * _Note:_ On iOS passing `PictureSourceType.PHOTOLIBRARY` or `PictureSourceType.SAVEDPHOTOALBUM` + * along with `DestinationType.NATIVE_URI` will disable any image modifications (resize, quality + * change, cropping, etc.) due to implementation specific. + * + * @enum {number} + */ + PictureSourceType:{ + /** Choose image from the device's photo library (same as SAVEDPHOTOALBUM for Android) */ + PHOTOLIBRARY : 0, + /** Take picture from camera */ + CAMERA : 1, + /** Choose image only from the device's Camera Roll album (same as PHOTOLIBRARY for Android) */ + SAVEDPHOTOALBUM : 2 + }, + /** + * Matches iOS UIPopoverArrowDirection constants to specify arrow location on popover. + * @enum {number} + */ + PopoverArrowDirection:{ + ARROW_UP : 1, + ARROW_DOWN : 2, + ARROW_LEFT : 4, + ARROW_RIGHT : 8, + ARROW_ANY : 15 + }, + /** + * @enum {number} + */ + Direction:{ + /** Use the back-facing camera */ + BACK: 0, + /** Use the front-facing camera */ + FRONT: 1 + } +}; + +}); diff --git a/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/plugins/cordova-plugin-camera/www/CameraPopoverHandle.js b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/plugins/cordova-plugin-camera/www/CameraPopoverHandle.js new file mode 100755 index 00000000..a65ac7e7 --- /dev/null +++ b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/plugins/cordova-plugin-camera/www/CameraPopoverHandle.js @@ -0,0 +1,35 @@ +cordova.define("cordova-plugin-camera.CameraPopoverHandle", function(require, exports, module) { +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * +*/ + +/** + * @ignore in favour of iOS' one + * A handle to an image picker popover. + */ +var CameraPopoverHandle = function() { + this.setPosition = function(popoverOptions) { + console.log('CameraPopoverHandle.setPosition is only supported on iOS.'); + }; +}; + +module.exports = CameraPopoverHandle; + +}); diff --git a/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/plugins/cordova-plugin-camera/www/CameraPopoverOptions.js b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/plugins/cordova-plugin-camera/www/CameraPopoverOptions.js new file mode 100755 index 00000000..f6a1e8fa --- /dev/null +++ b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/plugins/cordova-plugin-camera/www/CameraPopoverOptions.js @@ -0,0 +1,55 @@ +cordova.define("cordova-plugin-camera.CameraPopoverOptions", function(require, exports, module) { +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * +*/ + +var Camera = require('./Camera'); + +/** + * @namespace navigator + */ + +/** + * iOS-only parameters that specify the anchor element location and arrow + * direction of the popover when selecting images from an iPad's library + * or album. + * Note that the size of the popover may change to adjust to the + * direction of the arrow and orientation of the screen. Make sure to + * account for orientation changes when specifying the anchor element + * location. + * @module CameraPopoverOptions + * @param {Number} [x=0] - x pixel coordinate of screen element onto which to anchor the popover. + * @param {Number} [y=32] - y pixel coordinate of screen element onto which to anchor the popover. + * @param {Number} [width=320] - width, in pixels, of the screen element onto which to anchor the popover. + * @param {Number} [height=480] - height, in pixels, of the screen element onto which to anchor the popover. + * @param {module:Camera.PopoverArrowDirection} [arrowDir=ARROW_ANY] - Direction the arrow on the popover should point. + */ +var CameraPopoverOptions = function (x, y, width, height, arrowDir) { + // information of rectangle that popover should be anchored to + this.x = x || 0; + this.y = y || 32; + this.width = width || 320; + this.height = height || 480; + this.arrowDir = arrowDir || Camera.PopoverArrowDirection.ARROW_ANY; +}; + +module.exports = CameraPopoverOptions; + +}); diff --git a/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/plugins/cordova-plugin-contacts/www/Contact.js b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/plugins/cordova-plugin-contacts/www/Contact.js new file mode 100755 index 00000000..22c3d0c8 --- /dev/null +++ b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/plugins/cordova-plugin-contacts/www/Contact.js @@ -0,0 +1,143 @@ +cordova.define("cordova-plugin-contacts.Contact", function(require, exports, module) { +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * +*/ + +var argscheck = require('cordova/argscheck'), + exec = require('cordova/exec'), + ContactError = require('./ContactError'), + utils = require('cordova/utils'), + convertUtils = require('./convertUtils'); + +/** +* Contains information about a single contact. +* @constructor +* @param {DOMString} id unique identifier +* @param {DOMString} displayName +* @param {ContactName} name +* @param {DOMString} nickname +* @param {Array.} phoneNumbers array of phone numbers +* @param {Array.} emails array of email addresses +* @param {Array.} addresses array of addresses +* @param {Array.} ims instant messaging user ids +* @param {Array.} organizations +* @param {DOMString} birthday contact's birthday +* @param {DOMString} note user notes about contact +* @param {Array.} photos +* @param {Array.} categories +* @param {Array.} urls contact's web sites +*/ +var Contact = function (id, displayName, name, nickname, phoneNumbers, emails, addresses, + ims, organizations, birthday, note, photos, categories, urls) { + this.id = id || null; + this.rawId = null; + this.displayName = displayName || null; + this.name = name || null; // ContactName + this.nickname = nickname || null; + this.phoneNumbers = phoneNumbers || null; // ContactField[] + this.emails = emails || null; // ContactField[] + this.addresses = addresses || null; // ContactAddress[] + this.ims = ims || null; // ContactField[] + this.organizations = organizations || null; // ContactOrganization[] + this.birthday = birthday || null; + this.note = note || null; + this.photos = photos || null; // ContactField[] + this.categories = categories || null; // ContactField[] + this.urls = urls || null; // ContactField[] +}; + +/** +* Removes contact from device storage. +* @param successCB success callback +* @param errorCB error callback +*/ +Contact.prototype.remove = function(successCB, errorCB) { + argscheck.checkArgs('FF', 'Contact.remove', arguments); + var fail = errorCB && function(code) { + errorCB(new ContactError(code)); + }; + if (this.id === null) { + fail(ContactError.UNKNOWN_ERROR); + } + else { + exec(successCB, fail, "Contacts", "remove", [this.id]); + } +}; + +/** +* Creates a deep copy of this Contact. +* With the contact ID set to null. +* @return copy of this Contact +*/ +Contact.prototype.clone = function() { + var clonedContact = utils.clone(this); + clonedContact.id = null; + clonedContact.rawId = null; + + function nullIds(arr) { + if (arr) { + for (var i = 0; i < arr.length; ++i) { + arr[i].id = null; + } + } + } + + // Loop through and clear out any id's in phones, emails, etc. + nullIds(clonedContact.phoneNumbers); + nullIds(clonedContact.emails); + nullIds(clonedContact.addresses); + nullIds(clonedContact.ims); + nullIds(clonedContact.organizations); + nullIds(clonedContact.categories); + nullIds(clonedContact.photos); + nullIds(clonedContact.urls); + return clonedContact; +}; + +/** +* Persists contact to device storage. +* @param successCB success callback +* @param errorCB error callback +*/ +Contact.prototype.save = function(successCB, errorCB) { + argscheck.checkArgs('FFO', 'Contact.save', arguments); + var fail = errorCB && function(code) { + errorCB(new ContactError(code)); + }; + var success = function(result) { + if (result) { + if (successCB) { + var fullContact = require('./contacts').create(result); + successCB(convertUtils.toCordovaFormat(fullContact)); + } + } + else { + // no Entry object returned + fail(ContactError.UNKNOWN_ERROR); + } + }; + var dupContact = convertUtils.toNativeFormat(utils.clone(this)); + exec(success, fail, "Contacts", "save", [dupContact]); +}; + + +module.exports = Contact; + +}); diff --git a/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/plugins/cordova-plugin-contacts/www/ContactAddress.js b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/plugins/cordova-plugin-contacts/www/ContactAddress.js new file mode 100755 index 00000000..c6c163e1 --- /dev/null +++ b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/plugins/cordova-plugin-contacts/www/ContactAddress.js @@ -0,0 +1,49 @@ +cordova.define("cordova-plugin-contacts.ContactAddress", function(require, exports, module) { +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * +*/ + +/** +* Contact address. +* @constructor +* @param {DOMString} id unique identifier, should only be set by native code +* @param formatted // NOTE: not a W3C standard +* @param streetAddress +* @param locality +* @param region +* @param postalCode +* @param country +*/ + +var ContactAddress = function(pref, type, formatted, streetAddress, locality, region, postalCode, country) { + this.id = null; + this.pref = (typeof pref != 'undefined' ? pref : false); + this.type = type || null; + this.formatted = formatted || null; + this.streetAddress = streetAddress || null; + this.locality = locality || null; + this.region = region || null; + this.postalCode = postalCode || null; + this.country = country || null; +}; + +module.exports = ContactAddress; + +}); diff --git a/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/plugins/cordova-plugin-contacts/www/ContactError.js b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/plugins/cordova-plugin-contacts/www/ContactError.js new file mode 100755 index 00000000..f7a7671c --- /dev/null +++ b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/plugins/cordova-plugin-contacts/www/ContactError.js @@ -0,0 +1,46 @@ +cordova.define("cordova-plugin-contacts.ContactError", function(require, exports, module) { +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * +*/ + +/** + * ContactError. + * An error code assigned by an implementation when an error has occurred + * @constructor + */ +var ContactError = function(err) { + this.code = (typeof err != 'undefined' ? err : null); +}; + +/** + * Error codes + */ +ContactError.UNKNOWN_ERROR = 0; +ContactError.INVALID_ARGUMENT_ERROR = 1; +ContactError.TIMEOUT_ERROR = 2; +ContactError.PENDING_OPERATION_ERROR = 3; +ContactError.IO_ERROR = 4; +ContactError.NOT_SUPPORTED_ERROR = 5; +ContactError.OPERATION_CANCELLED_ERROR = 6; +ContactError.PERMISSION_DENIED_ERROR = 20; + +module.exports = ContactError; + +}); diff --git a/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/plugins/cordova-plugin-contacts/www/ContactField.js b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/plugins/cordova-plugin-contacts/www/ContactField.js new file mode 100755 index 00000000..de72ed4e --- /dev/null +++ b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/plugins/cordova-plugin-contacts/www/ContactField.js @@ -0,0 +1,40 @@ +cordova.define("cordova-plugin-contacts.ContactField", function(require, exports, module) { +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * +*/ + +/** +* Generic contact field. +* @constructor +* @param {DOMString} id unique identifier, should only be set by native code // NOTE: not a W3C standard +* @param type +* @param value +* @param pref +*/ +var ContactField = function(type, value, pref) { + this.id = null; + this.type = (type && type.toString()) || null; + this.value = (value && value.toString()) || null; + this.pref = (typeof pref != 'undefined' ? pref : false); +}; + +module.exports = ContactField; + +}); diff --git a/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/plugins/cordova-plugin-contacts/www/ContactFieldType.js b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/plugins/cordova-plugin-contacts/www/ContactFieldType.js new file mode 100755 index 00000000..9f61cfd5 --- /dev/null +++ b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/plugins/cordova-plugin-contacts/www/ContactFieldType.js @@ -0,0 +1,58 @@ +cordova.define("cordova-plugin-contacts.ContactFieldType", function(require, exports, module) { +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * +*/ + + // Possible field names for various platforms. + // Some field names are platform specific + + var fieldType = { + addresses: "addresses", + birthday: "birthday", + categories: "categories", + country: "country", + department: "department", + displayName: "displayName", + emails: "emails", + familyName: "familyName", + formatted: "formatted", + givenName: "givenName", + honorificPrefix: "honorificPrefix", + honorificSuffix: "honorificSuffix", + id: "id", + ims: "ims", + locality: "locality", + middleName: "middleName", + name: "name", + nickname: "nickname", + note: "note", + organizations: "organizations", + phoneNumbers: "phoneNumbers", + photos: "photos", + postalCode: "postalCode", + region: "region", + streetAddress: "streetAddress", + title: "title", + urls: "urls" + }; + + module.exports = fieldType; + +}); diff --git a/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/plugins/cordova-plugin-contacts/www/ContactFindOptions.js b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/plugins/cordova-plugin-contacts/www/ContactFindOptions.js new file mode 100755 index 00000000..92b9f49a --- /dev/null +++ b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/plugins/cordova-plugin-contacts/www/ContactFindOptions.js @@ -0,0 +1,41 @@ +cordova.define("cordova-plugin-contacts.ContactFindOptions", function(require, exports, module) { +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * +*/ + +/** + * ContactFindOptions. + * @constructor + * @param filter used to match contacts against + * @param multiple boolean used to determine if more than one contact should be returned + * @param desiredFields + * @param hasPhoneNumber boolean used to filter the search and only return contacts that have a phone number informed + */ + +var ContactFindOptions = function(filter, multiple, desiredFields, hasPhoneNumber) { + this.filter = filter || ''; + this.multiple = (typeof multiple != 'undefined' ? multiple : false); + this.desiredFields = typeof desiredFields != 'undefined' ? desiredFields : []; + this.hasPhoneNumber = typeof hasPhoneNumber != 'undefined' ? hasPhoneNumber : false; +}; + +module.exports = ContactFindOptions; + +}); diff --git a/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/plugins/cordova-plugin-contacts/www/ContactName.js b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/plugins/cordova-plugin-contacts/www/ContactName.js new file mode 100755 index 00000000..f18a28a8 --- /dev/null +++ b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/plugins/cordova-plugin-contacts/www/ContactName.js @@ -0,0 +1,44 @@ +cordova.define("cordova-plugin-contacts.ContactName", function(require, exports, module) { +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * +*/ + +/** +* Contact name. +* @constructor +* @param formatted // NOTE: not part of W3C standard +* @param familyName +* @param givenName +* @param middle +* @param prefix +* @param suffix +*/ +var ContactName = function(formatted, familyName, givenName, middle, prefix, suffix) { + this.formatted = formatted || null; + this.familyName = familyName || null; + this.givenName = givenName || null; + this.middleName = middle || null; + this.honorificPrefix = prefix || null; + this.honorificSuffix = suffix || null; +}; + +module.exports = ContactName; + +}); diff --git a/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/plugins/cordova-plugin-contacts/www/ContactOrganization.js b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/plugins/cordova-plugin-contacts/www/ContactOrganization.js new file mode 100755 index 00000000..bb798533 --- /dev/null +++ b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/plugins/cordova-plugin-contacts/www/ContactOrganization.js @@ -0,0 +1,44 @@ +cordova.define("cordova-plugin-contacts.ContactOrganization", function(require, exports, module) { +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * +*/ + +/** +* Contact organization. +* @constructor +* @param pref +* @param type +* @param name +* @param dept +* @param title +*/ + +var ContactOrganization = function(pref, type, name, dept, title) { + this.id = null; + this.pref = (typeof pref != 'undefined' ? pref : false); + this.type = type || null; + this.name = name || null; + this.department = dept || null; + this.title = title || null; +}; + +module.exports = ContactOrganization; + +}); diff --git a/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/plugins/cordova-plugin-contacts/www/contacts.js b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/plugins/cordova-plugin-contacts/www/contacts.js new file mode 100755 index 00000000..6546d853 --- /dev/null +++ b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/plugins/cordova-plugin-contacts/www/contacts.js @@ -0,0 +1,102 @@ +cordova.define("cordova-plugin-contacts.contacts", function(require, exports, module) { +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * +*/ + +var argscheck = require('cordova/argscheck'), + exec = require('cordova/exec'), + ContactError = require('./ContactError'), + Contact = require('./Contact'), + fieldType = require('./ContactFieldType'), + convertUtils = require('./convertUtils'); + +/** +* Represents a group of Contacts. +* @constructor +*/ +var contacts = { + fieldType: fieldType, + /** + * Returns an array of Contacts matching the search criteria. + * @param fields that should be searched + * @param successCB success callback + * @param errorCB error callback + * @param {ContactFindOptions} options that can be applied to contact searching + * @return array of Contacts matching search criteria + */ + find: function(fields, successCB, errorCB, options) { + argscheck.checkArgs('afFO', 'contacts.find', arguments); + if (!fields.length) { + if (errorCB) { + errorCB(new ContactError(ContactError.INVALID_ARGUMENT_ERROR)); + } + } else { + // missing 'options' param means return all contacts + options = options || { filter: '', multiple: true }; + var win = function(result) { + var cs = []; + for (var i = 0, l = result.length; i < l; i++) { + cs.push(convertUtils.toCordovaFormat(contacts.create(result[i]))); + } + successCB(cs); + }; + exec(win, errorCB, "Contacts", "search", [fields, options]); + } + }, + + /** + * This function picks contact from phone using contact picker UI + * @returns new Contact object + */ + pickContact: function (successCB, errorCB) { + + argscheck.checkArgs('fF', 'contacts.pick', arguments); + + var win = function (result) { + // if Contacts.pickContact return instance of Contact object + // don't create new Contact object, use current + var contact = result instanceof Contact ? result : contacts.create(result); + successCB(convertUtils.toCordovaFormat(contact)); + }; + exec(win, errorCB, "Contacts", "pickContact", []); + }, + + /** + * This function creates a new contact, but it does not persist the contact + * to device storage. To persist the contact to device storage, invoke + * contact.save(). + * @param properties an object whose properties will be examined to create a new Contact + * @returns new Contact object + */ + create: function(properties) { + argscheck.checkArgs('O', 'contacts.create', arguments); + var contact = new Contact(); + for (var i in properties) { + if (typeof contact[i] !== 'undefined' && properties.hasOwnProperty(i)) { + contact[i] = properties[i]; + } + } + return contact; + } +}; + +module.exports = contacts; + +}); diff --git a/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/plugins/cordova-plugin-contacts/www/convertUtils.js b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/plugins/cordova-plugin-contacts/www/convertUtils.js new file mode 100755 index 00000000..01588fc9 --- /dev/null +++ b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/plugins/cordova-plugin-contacts/www/convertUtils.js @@ -0,0 +1,73 @@ +cordova.define("cordova-plugin-contacts.convertUtils", function(require, exports, module) { +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * +*/ + +var utils = require('cordova/utils'); + +module.exports = { + /** + * Converts primitives into Complex Object + * Currently only used for Date fields + */ + toCordovaFormat: function (contact) { + var value = contact.birthday; + if (value !== null) { + try { + contact.birthday = new Date(parseFloat(value)); + + //we might get 'Invalid Date' which does not throw an error + //and is an instance of Date. + if (isNaN(contact.birthday.getTime())) { + contact.birthday = null; + } + + } catch (exception){ + console.log("Cordova Contact toCordovaFormat error: exception creating date."); + } + } + return contact; + }, + + /** + * Converts Complex objects into primitives + * Only conversion at present is for Dates. + **/ + toNativeFormat: function (contact) { + var value = contact.birthday; + if (value !== null) { + // try to make it a Date object if it is not already + if (!utils.isDate(value)){ + try { + value = new Date(value); + } catch(exception){ + value = null; + } + } + if (utils.isDate(value)){ + value = value.valueOf(); // convert to milliseconds + } + contact.birthday = value; + } + return contact; + } +}; + +}); diff --git a/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/plugins/cordova-plugin-device-motion/www/Acceleration.js b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/plugins/cordova-plugin-device-motion/www/Acceleration.js new file mode 100755 index 00000000..794476b0 --- /dev/null +++ b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/plugins/cordova-plugin-device-motion/www/Acceleration.js @@ -0,0 +1,32 @@ +cordova.define("cordova-plugin-device-motion.Acceleration", function(require, exports, module) { +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * +*/ + +var Acceleration = function(x, y, z, timestamp) { + this.x = x; + this.y = y; + this.z = z; + this.timestamp = timestamp || (new Date()).getTime(); +}; + +module.exports = Acceleration; + +}); diff --git a/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/plugins/cordova-plugin-device-motion/www/accelerometer.js b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/plugins/cordova-plugin-device-motion/www/accelerometer.js new file mode 100755 index 00000000..b2d01f79 --- /dev/null +++ b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/plugins/cordova-plugin-device-motion/www/accelerometer.js @@ -0,0 +1,205 @@ +cordova.define("cordova-plugin-device-motion.accelerometer", function(require, exports, module) { +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * +*/ + +/** + * This class provides access to device accelerometer data. + * @constructor + */ +var argscheck = require('cordova/argscheck'), + utils = require("cordova/utils"), + exec = require("cordova/exec"), + Acceleration = require('./Acceleration'); + +// Is the accel sensor running? +var running = false; + +// Keeps reference to watchAcceleration calls. +var timers = {}; + +// Array of listeners; used to keep track of when we should call start and stop. +var listeners = []; + +// Last returned acceleration object from native +var accel = null; + +// Timer used when faking up devicemotion events +var eventTimerId = null; + +// Tells native to start. +function start() { + exec(function (a) { + var tempListeners = listeners.slice(0); + accel = new Acceleration(a.x, a.y, a.z, a.timestamp); + for (var i = 0, l = tempListeners.length; i < l; i++) { + tempListeners[i].win(accel); + } + }, function (e) { + var tempListeners = listeners.slice(0); + for (var i = 0, l = tempListeners.length; i < l; i++) { + tempListeners[i].fail(e); + } + }, "Accelerometer", "start", []); + running = true; +} + +// Tells native to stop. +function stop() { + exec(null, null, "Accelerometer", "stop", []); + accel = null; + running = false; +} + +// Adds a callback pair to the listeners array +function createCallbackPair(win, fail) { + return { win: win, fail: fail }; +} + +// Removes a win/fail listener pair from the listeners array +function removeListeners(l) { + var idx = listeners.indexOf(l); + if (idx > -1) { + listeners.splice(idx, 1); + if (listeners.length === 0) { + stop(); + } + } +} + +var accelerometer = { + /** + * Asynchronously acquires the current acceleration. + * + * @param {Function} successCallback The function to call when the acceleration data is available + * @param {Function} errorCallback The function to call when there is an error getting the acceleration data. (OPTIONAL) + * @param {AccelerationOptions} options The options for getting the accelerometer data such as timeout. (OPTIONAL) + */ + getCurrentAcceleration: function (successCallback, errorCallback, options) { + argscheck.checkArgs('fFO', 'accelerometer.getCurrentAcceleration', arguments); + + if (cordova.platformId === "windowsphone") { + exec(function (a) { + accel = new Acceleration(a.x, a.y, a.z, a.timestamp); + successCallback(accel); + }, function (e) { + errorCallback(e); + }, "Accelerometer", "getCurrentAcceleration", []); + + return; + } + + var p; + var win = function (a) { + removeListeners(p); + successCallback(a); + }; + var fail = function (e) { + removeListeners(p); + if (errorCallback) { + errorCallback(e); + } + }; + + p = createCallbackPair(win, fail); + listeners.push(p); + + if (!running) { + start(); + } + }, + + /** + * Asynchronously acquires the acceleration repeatedly at a given interval. + * + * @param {Function} successCallback The function to call each time the acceleration data is available + * @param {Function} errorCallback The function to call when there is an error getting the acceleration data. (OPTIONAL) + * @param {AccelerationOptions} options The options for getting the accelerometer data such as timeout. (OPTIONAL) + * @return String The watch id that must be passed to #clearWatch to stop watching. + */ + watchAcceleration: function (successCallback, errorCallback, options) { + argscheck.checkArgs('fFO', 'accelerometer.watchAcceleration', arguments); + // Default interval (10 sec) + var frequency = (options && options.frequency && typeof options.frequency == 'number') ? options.frequency : 10000; + + // Keep reference to watch id, and report accel readings as often as defined in frequency + var id = utils.createUUID(); + + var p = createCallbackPair(function () { }, function (e) { + removeListeners(p); + if (errorCallback) { + errorCallback(e); + } + }); + listeners.push(p); + + timers[id] = { + timer: window.setInterval(function () { + if (accel) { + successCallback(accel); + } + }, frequency), + listeners: p + }; + + if (running) { + // If we're already running then immediately invoke the success callback + // but only if we have retrieved a value, sample code does not check for null ... + if (accel) { + successCallback(accel); + } + } else { + start(); + } + + if (cordova.platformId === "browser" && !eventTimerId) { + // Start firing devicemotion events if we haven't already + var devicemotionEvent = new Event('devicemotion'); + eventTimerId = window.setInterval(function() { + window.dispatchEvent(devicemotionEvent); + }, 200); + } + + return id; + }, + + /** + * Clears the specified accelerometer watch. + * + * @param {String} id The id of the watch returned from #watchAcceleration. + */ + clearWatch: function (id) { + // Stop javascript timer & remove from timer list + if (id && timers[id]) { + window.clearInterval(timers[id].timer); + removeListeners(timers[id].listeners); + delete timers[id]; + + if (eventTimerId && Object.keys(timers).length === 0) { + // No more watchers, so stop firing 'devicemotion' events + window.clearInterval(eventTimerId); + eventTimerId = null; + } + } + } +}; +module.exports = accelerometer; + +}); diff --git a/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/plugins/cordova-plugin-device-orientation/www/CompassError.js b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/plugins/cordova-plugin-device-orientation/www/CompassError.js new file mode 100755 index 00000000..0055b9ad --- /dev/null +++ b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/plugins/cordova-plugin-device-orientation/www/CompassError.js @@ -0,0 +1,37 @@ +cordova.define("cordova-plugin-device-orientation.CompassError", function(require, exports, module) { +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * +*/ + +/** + * CompassError. + * An error code assigned by an implementation when an error has occurred + * @constructor + */ +var CompassError = function(err) { + this.code = (err !== undefined ? err : null); +}; + +CompassError.COMPASS_INTERNAL_ERR = 0; +CompassError.COMPASS_NOT_SUPPORTED = 20; + +module.exports = CompassError; + +}); diff --git a/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/plugins/cordova-plugin-device-orientation/www/CompassHeading.js b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/plugins/cordova-plugin-device-orientation/www/CompassHeading.js new file mode 100755 index 00000000..4ebb4aa6 --- /dev/null +++ b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/plugins/cordova-plugin-device-orientation/www/CompassHeading.js @@ -0,0 +1,32 @@ +cordova.define("cordova-plugin-device-orientation.CompassHeading", function(require, exports, module) { +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * +*/ + +var CompassHeading = function(magneticHeading, trueHeading, headingAccuracy, timestamp) { + this.magneticHeading = magneticHeading; + this.trueHeading = trueHeading; + this.headingAccuracy = headingAccuracy; + this.timestamp = timestamp || new Date().getTime(); +}; + +module.exports = CompassHeading; + +}); diff --git a/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/plugins/cordova-plugin-device-orientation/www/compass.js b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/plugins/cordova-plugin-device-orientation/www/compass.js new file mode 100755 index 00000000..48ee5f6b --- /dev/null +++ b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/plugins/cordova-plugin-device-orientation/www/compass.js @@ -0,0 +1,121 @@ +cordova.define("cordova-plugin-device-orientation.compass", function(require, exports, module) { +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * +*/ + +var argscheck = require('cordova/argscheck'), + exec = require('cordova/exec'), + utils = require('cordova/utils'), + CompassHeading = require('./CompassHeading'), + CompassError = require('./CompassError'), + + timers = {}, + eventTimerId = null, + compass = { + /** + * Asynchronously acquires the current heading. + * @param {Function} successCallback The function to call when the heading + * data is available + * @param {Function} errorCallback The function to call when there is an error + * getting the heading data. + * @param {CompassOptions} options The options for getting the heading data (not used). + */ + getCurrentHeading:function(successCallback, errorCallback, options) { + argscheck.checkArgs('fFO', 'compass.getCurrentHeading', arguments); + + var win = function(result) { + var ch = new CompassHeading(result.magneticHeading, result.trueHeading, result.headingAccuracy, result.timestamp); + successCallback(ch); + }; + var fail = errorCallback && function(code) { + var ce = new CompassError(code); + errorCallback(ce); + }; + + // Get heading + exec(win, fail, "Compass", "getHeading", [options]); + }, + + /** + * Asynchronously acquires the heading repeatedly at a given interval. + * @param {Function} successCallback The function to call each time the heading + * data is available + * @param {Function} errorCallback The function to call when there is an error + * getting the heading data. + * @param {HeadingOptions} options The options for getting the heading data + * such as timeout and the frequency of the watch. For iOS, filter parameter + * specifies to watch via a distance filter rather than time. + */ + watchHeading:function(successCallback, errorCallback, options) { + argscheck.checkArgs('fFO', 'compass.watchHeading', arguments); + // Default interval (100 msec) + var frequency = (options !== undefined && options.frequency !== undefined) ? options.frequency : 100; + var filter = (options !== undefined && options.filter !== undefined) ? options.filter : 0; + + var id = utils.createUUID(); + if (filter > 0) { + // is an iOS request for watch by filter, no timer needed + timers[id] = "iOS"; + compass.getCurrentHeading(successCallback, errorCallback, options); + } else { + // Start watch timer to get headings + timers[id] = window.setInterval(function() { + compass.getCurrentHeading(successCallback, errorCallback); + }, frequency); + } + + if (cordova.platformId === 'browser' && !eventTimerId) { + // Start firing deviceorientation events if haven't already + var deviceorientationEvent = new Event('deviceorientation'); + eventTimerId = window.setInterval(function() { + window.dispatchEvent(deviceorientationEvent); + }, 200); + } + + return id; + }, + + /** + * Clears the specified heading watch. + * @param {String} id The ID of the watch returned from #watchHeading. + */ + clearWatch:function(id) { + // Stop javascript timer & remove from timer list + if (id && timers[id]) { + if (timers[id] != "iOS") { + clearInterval(timers[id]); + } else { + // is iOS watch by filter so call into device to stop + exec(null, null, "Compass", "stopHeading", []); + } + delete timers[id]; + + if (eventTimerId && Object.keys(timers).length === 0) { + // No more watchers, so stop firing 'deviceorientation' events + window.clearInterval(eventTimerId); + eventTimerId = null; + } + } + } + }; + +module.exports = compass; + +}); diff --git a/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/plugins/cordova-plugin-device/www/device.js b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/plugins/cordova-plugin-device/www/device.js new file mode 100755 index 00000000..977dfc09 --- /dev/null +++ b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/plugins/cordova-plugin-device/www/device.js @@ -0,0 +1,86 @@ +cordova.define("cordova-plugin-device.device", function(require, exports, module) { +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * +*/ + +var argscheck = require('cordova/argscheck'), + channel = require('cordova/channel'), + utils = require('cordova/utils'), + exec = require('cordova/exec'), + cordova = require('cordova'); + +channel.createSticky('onCordovaInfoReady'); +// Tell cordova channel to wait on the CordovaInfoReady event +channel.waitForInitialization('onCordovaInfoReady'); + +/** + * This represents the mobile device, and provides properties for inspecting the model, version, UUID of the + * phone, etc. + * @constructor + */ +function Device() { + this.available = false; + this.platform = null; + this.version = null; + this.uuid = null; + this.cordova = null; + this.model = null; + this.manufacturer = null; + this.isVirtual = null; + this.serial = null; + + var me = this; + + channel.onCordovaReady.subscribe(function() { + me.getInfo(function(info) { + //ignoring info.cordova returning from native, we should use value from cordova.version defined in cordova.js + //TODO: CB-5105 native implementations should not return info.cordova + var buildLabel = cordova.version; + me.available = true; + me.platform = info.platform; + me.version = info.version; + me.uuid = info.uuid; + me.cordova = buildLabel; + me.model = info.model; + me.isVirtual = info.isVirtual; + me.manufacturer = info.manufacturer || 'unknown'; + me.serial = info.serial || 'unknown'; + channel.onCordovaInfoReady.fire(); + },function(e) { + me.available = false; + utils.alert("[ERROR] Error initializing Cordova: " + e); + }); + }); +} + +/** + * Get device info + * + * @param {Function} successCallback The function to call when the heading data is available + * @param {Function} errorCallback The function to call when there is an error getting the heading data. (OPTIONAL) + */ +Device.prototype.getInfo = function(successCallback, errorCallback) { + argscheck.checkArgs('fF', 'Device.getInfo', arguments); + exec(successCallback, errorCallback, "Device", "getDeviceInfo", []); +}; + +module.exports = new Device(); + +}); diff --git a/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/plugins/cordova-plugin-dialogs/www/android/notification.js b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/plugins/cordova-plugin-dialogs/www/android/notification.js new file mode 100755 index 00000000..69cb5a42 --- /dev/null +++ b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/plugins/cordova-plugin-dialogs/www/android/notification.js @@ -0,0 +1,77 @@ +cordova.define("cordova-plugin-dialogs.notification_android", function(require, exports, module) { +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * +*/ + +var exec = require('cordova/exec'); + +/** + * Provides Android enhanced notification API. + */ +module.exports = { + activityStart : function(title, message) { + // If title and message not specified then mimic Android behavior of + // using default strings. + if (typeof title === "undefined" && typeof message == "undefined") { + title = "Busy"; + message = 'Please wait...'; + } + + exec(null, null, 'Notification', 'activityStart', [ title, message ]); + }, + + /** + * Close an activity dialog + */ + activityStop : function() { + exec(null, null, 'Notification', 'activityStop', []); + }, + + /** + * Display a progress dialog with progress bar that goes from 0 to 100. + * + * @param {String} + * title Title of the progress dialog. + * @param {String} + * message Message to display in the dialog. + */ + progressStart : function(title, message) { + exec(null, null, 'Notification', 'progressStart', [ title, message ]); + }, + + /** + * Close the progress dialog. + */ + progressStop : function() { + exec(null, null, 'Notification', 'progressStop', []); + }, + + /** + * Set the progress dialog value. + * + * @param {Number} + * value 0-100 + */ + progressValue : function(value) { + exec(null, null, 'Notification', 'progressValue', [ value ]); + } +}; + +}); diff --git a/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/plugins/cordova-plugin-dialogs/www/notification.js b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/plugins/cordova-plugin-dialogs/www/notification.js new file mode 100755 index 00000000..5cd2cc8f --- /dev/null +++ b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/plugins/cordova-plugin-dialogs/www/notification.js @@ -0,0 +1,133 @@ +cordova.define("cordova-plugin-dialogs.notification", function(require, exports, module) { +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * +*/ + +var exec = require('cordova/exec'); +var platform = require('cordova/platform'); + +/** + * Provides access to notifications on the device. + */ + +module.exports = { + + /** + * Open a native alert dialog, with a customizable title and button text. + * + * @param {String} message Message to print in the body of the alert + * @param {Function} completeCallback The callback that is called when user clicks on a button. + * @param {String} title Title of the alert dialog (default: Alert) + * @param {String} buttonLabel Label of the close button (default: OK) + */ + alert: function(message, completeCallback, title, buttonLabel) { + var _message = (typeof message === "string" ? message : JSON.stringify(message)); + var _title = (typeof title === "string" ? title : "Alert"); + var _buttonLabel = (buttonLabel && typeof buttonLabel === "string" ? buttonLabel : "OK"); + exec(completeCallback, null, "Notification", "alert", [_message, _title, _buttonLabel]); + }, + + /** + * Open a native confirm dialog, with a customizable title and button text. + * The result that the user selects is returned to the result callback. + * + * @param {String} message Message to print in the body of the alert + * @param {Function} resultCallback The callback that is called when user clicks on a button. + * @param {String} title Title of the alert dialog (default: Confirm) + * @param {Array} buttonLabels Array of the labels of the buttons (default: ['OK', 'Cancel']) + */ + confirm: function(message, resultCallback, title, buttonLabels) { + var _message = (typeof message === "string" ? message : JSON.stringify(message)); + var _title = (typeof title === "string" ? title : "Confirm"); + var _buttonLabels = (buttonLabels || ["OK", "Cancel"]); + + // Strings are deprecated! + if (typeof _buttonLabels === 'string') { + console.log("Notification.confirm(string, function, string, string) is deprecated. Use Notification.confirm(string, function, string, array)."); + } + + _buttonLabels = convertButtonLabels(_buttonLabels); + + exec(resultCallback, null, "Notification", "confirm", [_message, _title, _buttonLabels]); + }, + + /** + * Open a native prompt dialog, with a customizable title and button text. + * The following results are returned to the result callback: + * buttonIndex Index number of the button selected. + * input1 The text entered in the prompt dialog box. + * + * @param {String} message Dialog message to display (default: "Prompt message") + * @param {Function} resultCallback The callback that is called when user clicks on a button. + * @param {String} title Title of the dialog (default: "Prompt") + * @param {Array} buttonLabels Array of strings for the button labels (default: ["OK","Cancel"]) + * @param {String} defaultText Textbox input value (default: empty string) + */ + prompt: function(message, resultCallback, title, buttonLabels, defaultText) { + var _message = (typeof message === "string" ? message : JSON.stringify(message)); + var _title = (typeof title === "string" ? title : "Prompt"); + var _buttonLabels = (buttonLabels || ["OK","Cancel"]); + + // Strings are deprecated! + if (typeof _buttonLabels === 'string') { + console.log("Notification.prompt(string, function, string, string) is deprecated. Use Notification.confirm(string, function, string, array)."); + } + + _buttonLabels = convertButtonLabels(_buttonLabels); + + var _defaultText = (defaultText || ""); + exec(resultCallback, null, "Notification", "prompt", [_message, _title, _buttonLabels, _defaultText]); + }, + + /** + * Causes the device to beep. + * On Android, the default notification ringtone is played "count" times. + * + * @param {Integer} count The number of beeps. + */ + beep: function(count) { + var defaultedCount = count || 1; + exec(null, null, "Notification", "beep", [ defaultedCount ]); + } +}; + +function convertButtonLabels(buttonLabels) { + + // Some platforms take an array of button label names. + // Other platforms take a comma separated list. + // For compatibility, we convert to the desired type based on the platform. + if (platform.id == "amazon-fireos" || platform.id == "android" || platform.id == "ios" || + platform.id == "windowsphone" || platform.id == "firefoxos" || platform.id == "ubuntu" || + platform.id == "windows8" || platform.id == "windows") { + + if (typeof buttonLabels === 'string') { + buttonLabels = buttonLabels.split(","); // not crazy about changing the var type here + } + } else { + if (Array.isArray(buttonLabels)) { + var buttonLabelArray = buttonLabels; + buttonLabels = buttonLabelArray.toString(); + } + } + + return buttonLabels; +} + +}); diff --git a/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/plugins/cordova-plugin-file/www/DirectoryEntry.js b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/plugins/cordova-plugin-file/www/DirectoryEntry.js new file mode 100755 index 00000000..36c6e28e --- /dev/null +++ b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/plugins/cordova-plugin-file/www/DirectoryEntry.js @@ -0,0 +1,120 @@ +cordova.define("cordova-plugin-file.DirectoryEntry", function(require, exports, module) { +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * +*/ + +var argscheck = require('cordova/argscheck'), + utils = require('cordova/utils'), + exec = require('cordova/exec'), + Entry = require('./Entry'), + FileError = require('./FileError'), + DirectoryReader = require('./DirectoryReader'); + +/** + * An interface representing a directory on the file system. + * + * {boolean} isFile always false (readonly) + * {boolean} isDirectory always true (readonly) + * {DOMString} name of the directory, excluding the path leading to it (readonly) + * {DOMString} fullPath the absolute full path to the directory (readonly) + * {FileSystem} filesystem on which the directory resides (readonly) + */ +var DirectoryEntry = function(name, fullPath, fileSystem, nativeURL) { + + // add trailing slash if it is missing + if ((fullPath) && !/\/$/.test(fullPath)) { + fullPath += "/"; + } + // add trailing slash if it is missing + if (nativeURL && !/\/$/.test(nativeURL)) { + nativeURL += "/"; + } + DirectoryEntry.__super__.constructor.call(this, false, true, name, fullPath, fileSystem, nativeURL); +}; + +utils.extend(DirectoryEntry, Entry); + +/** + * Creates a new DirectoryReader to read entries from this directory + */ +DirectoryEntry.prototype.createReader = function() { + return new DirectoryReader(this.toInternalURL()); +}; + +/** + * Creates or looks up a directory + * + * @param {DOMString} path either a relative or absolute path from this directory in which to look up or create a directory + * @param {Flags} options to create or exclusively create the directory + * @param {Function} successCallback is called with the new entry + * @param {Function} errorCallback is called with a FileError + */ +DirectoryEntry.prototype.getDirectory = function(path, options, successCallback, errorCallback) { + argscheck.checkArgs('sOFF', 'DirectoryEntry.getDirectory', arguments); + var fs = this.filesystem; + var win = successCallback && function(result) { + var entry = new DirectoryEntry(result.name, result.fullPath, fs, result.nativeURL); + successCallback(entry); + }; + var fail = errorCallback && function(code) { + errorCallback(new FileError(code)); + }; + exec(win, fail, "File", "getDirectory", [this.toInternalURL(), path, options]); +}; + +/** + * Deletes a directory and all of it's contents + * + * @param {Function} successCallback is called with no parameters + * @param {Function} errorCallback is called with a FileError + */ +DirectoryEntry.prototype.removeRecursively = function(successCallback, errorCallback) { + argscheck.checkArgs('FF', 'DirectoryEntry.removeRecursively', arguments); + var fail = errorCallback && function(code) { + errorCallback(new FileError(code)); + }; + exec(successCallback, fail, "File", "removeRecursively", [this.toInternalURL()]); +}; + +/** + * Creates or looks up a file + * + * @param {DOMString} path either a relative or absolute path from this directory in which to look up or create a file + * @param {Flags} options to create or exclusively create the file + * @param {Function} successCallback is called with the new entry + * @param {Function} errorCallback is called with a FileError + */ +DirectoryEntry.prototype.getFile = function(path, options, successCallback, errorCallback) { + argscheck.checkArgs('sOFF', 'DirectoryEntry.getFile', arguments); + var fs = this.filesystem; + var win = successCallback && function(result) { + var FileEntry = require('./FileEntry'); + var entry = new FileEntry(result.name, result.fullPath, fs, result.nativeURL); + successCallback(entry); + }; + var fail = errorCallback && function(code) { + errorCallback(new FileError(code)); + }; + exec(win, fail, "File", "getFile", [this.toInternalURL(), path, options]); +}; + +module.exports = DirectoryEntry; + +}); diff --git a/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/plugins/cordova-plugin-file/www/DirectoryReader.js b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/plugins/cordova-plugin-file/www/DirectoryReader.js new file mode 100755 index 00000000..2b3ada2f --- /dev/null +++ b/Hybrid Apps Extension (Aisha)/camera_app/platforms/android/build/intermediates/assets/debug/www/plugins/cordova-plugin-file/www/DirectoryReader.js @@ -0,0 +1,76 @@ +cordova.define("cordova-plugin-file.DirectoryReader", function(require, exports, module) { +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * +*/ + +var exec = require('cordova/exec'), + FileError = require('./FileError') ; + +/** + * An interface that lists the files and directories in a directory. + */ +function DirectoryReader(localURL) { + this.localURL = localURL || null; + this.hasReadEntries = false; +} + +/** + * Returns a list of entries from a directory. + * + * @param {Function} successCallback is called with a list of entries + * @param {Function} errorCallback is called with a FileError + */ +DirectoryReader.prototype.readEntries = function(successCallback, errorCallback) { + // If we've already read and passed on this directory's entries, return an empty list. + if (this.hasReadEntries) { + successCallback([]); + return; + } + var reader = this; + var win = typeof successCallback !== 'function' ? null : function(result) { + var retVal = []; + for (var i=0; i or + *