Commit 887f8b76 by Sebastián Katzer

Update plugin dependencies and ios platform

parent 41b51ab6
{
"prepare_queue": {
"installed": [],
"uninstalled": []
},
"config_munge": {
"files": {
"res/xml/config.xml": {
"parents": {
"/*": [
{
"xml": "<feature name=\"Toast\"><param name=\"android-package\" value=\"nl.xservices.plugins.Toast\" /></feature>",
"count": 1
},
{
"xml": "<feature name=\"Device\"><param name=\"android-package\" value=\"org.apache.cordova.device.Device\" /></feature>",
"count": 1
},
{
"xml": "<feature name=\"LocalNotification\"><param name=\"android-package\" value=\"de.appplant.cordova.plugin.localnotification.LocalNotification\" /></feature>",
"count": 1
}
]
}
},
"AndroidManifest.xml": {
"parents": {
"/manifest/application": [
{
"xml": "<receiver android:exported=\"false\" android:name=\"de.appplant.cordova.plugin.localnotification.TriggerReceiver\" />",
"count": 1
},
{
"xml": "<receiver android:exported=\"false\" android:name=\"de.appplant.cordova.plugin.localnotification.ClearReceiver\" />",
"count": 1
},
{
"xml": "<activity android:exported=\"false\" android:launchMode=\"singleInstance\" android:name=\"de.appplant.cordova.plugin.localnotification.ClickActivity\" android:theme=\"@android:style/Theme.NoDisplay\" />",
"count": 1
},
{
"xml": "<receiver android:exported=\"false\" android:name=\"de.appplant.cordova.plugin.notification.TriggerReceiver\" />",
"count": 1
},
{
"xml": "<receiver android:exported=\"false\" android:name=\"de.appplant.cordova.plugin.notification.ClearReceiver\" />",
"count": 1
},
{
"xml": "<receiver android:exported=\"false\" android:name=\"de.appplant.cordova.plugin.localnotification.RestoreReceiver\"><intent-filter><action android:name=\"android.intent.action.BOOT_COMPLETED\" /></intent-filter></receiver>",
"count": 1
},
{
"xml": "<activity android:exported=\"false\" android:launchMode=\"singleInstance\" android:name=\"de.appplant.cordova.plugin.notification.ClickActivity\" android:theme=\"@android:style/Theme.NoDisplay\" />",
"count": 1
}
],
"/manifest": [
{
"xml": "<uses-permission android:name=\"android.permission.RECEIVE_BOOT_COMPLETED\" />",
"count": 1
},
{
"xml": "<uses-permission android:name=\"android.permission.WRITE_EXTERNAL_STORAGE\" />",
"count": 1
}
]
}
}
}
},
"installed_plugins": {
"cordova-plugin-x-toast": {
"PACKAGE_NAME": "de.appplant.localnotification.example"
},
"cordova-android-support-v4": {
"PACKAGE_NAME": "de.appplant.localnotification.example"
},
"cordova-plugin-device": {
"PACKAGE_NAME": "de.appplant.localnotification.example"
},
"de.appplant.cordova.plugin.local-notification": {
"PACKAGE_NAME": "de.appplant.localnotification.example"
}
},
"dependent_plugins": {},
"modules": [
{
"file": "plugins/cordova-plugin-x-toast/www/Toast.js",
"id": "cordova-plugin-x-toast.Toast",
"pluginId": "cordova-plugin-x-toast",
"clobbers": [
"window.plugins.toast"
]
},
{
"file": "plugins/cordova-plugin-x-toast/test/tests.js",
"id": "cordova-plugin-x-toast.tests",
"pluginId": "cordova-plugin-x-toast"
},
{
"file": "plugins/cordova-plugin-device/www/device.js",
"id": "cordova-plugin-device.device",
"pluginId": "cordova-plugin-device",
"clobbers": [
"device"
]
},
{
"file": "plugins/de.appplant.cordova.plugin.local-notification/www/local-notification.js",
"id": "de.appplant.cordova.plugin.local-notification.LocalNotification",
"pluginId": "de.appplant.cordova.plugin.local-notification",
"clobbers": [
"cordova.plugins.notification.local",
"plugin.notification.local"
]
},
{
"file": "plugins/de.appplant.cordova.plugin.local-notification/www/local-notification-core.js",
"id": "de.appplant.cordova.plugin.local-notification.LocalNotification.Core",
"pluginId": "de.appplant.cordova.plugin.local-notification",
"clobbers": [
"cordova.plugins.notification.local.core",
"plugin.notification.local.core"
]
},
{
"file": "plugins/de.appplant.cordova.plugin.local-notification/www/local-notification-util.js",
"id": "de.appplant.cordova.plugin.local-notification.LocalNotification.Util",
"pluginId": "de.appplant.cordova.plugin.local-notification",
"merges": [
"cordova.plugins.notification.local.core",
"plugin.notification.local.core"
]
}
]
}
\ No newline at end of file
cordova.define('cordova/plugin_list', function(require, exports, module) {
module.exports = [
{
"file": "plugins/nl.x-services.plugins.toast/www/Toast.js",
"id": "nl.x-services.plugins.toast.Toast",
"file": "plugins/cordova-plugin-x-toast/www/Toast.js",
"id": "cordova-plugin-x-toast.Toast",
"pluginId": "cordova-plugin-x-toast",
"clobbers": [
"window.plugins.toast"
]
},
{
"file": "plugins/nl.x-services.plugins.toast/test/tests.js",
"id": "nl.x-services.plugins.toast.tests"
"file": "plugins/cordova-plugin-x-toast/test/tests.js",
"id": "cordova-plugin-x-toast.tests",
"pluginId": "cordova-plugin-x-toast"
},
{
"file": "plugins/cordova-plugin-device/www/device.js",
"id": "cordova-plugin-device.device",
"pluginId": "cordova-plugin-device",
"clobbers": [
"device"
]
},
{
"file": "plugins/de.appplant.cordova.plugin.local-notification/www/local-notification.js",
"id": "de.appplant.cordova.plugin.local-notification.LocalNotification",
"pluginId": "de.appplant.cordova.plugin.local-notification",
"clobbers": [
"cordova.plugins.notification.local",
"plugin.notification.local"
......@@ -22,6 +33,7 @@ module.exports = [
{
"file": "plugins/de.appplant.cordova.plugin.local-notification/www/local-notification-core.js",
"id": "de.appplant.cordova.plugin.local-notification.LocalNotification.Core",
"pluginId": "de.appplant.cordova.plugin.local-notification",
"clobbers": [
"cordova.plugins.notification.local.core",
"plugin.notification.local.core"
......@@ -30,27 +42,15 @@ module.exports = [
{
"file": "plugins/de.appplant.cordova.plugin.local-notification/www/local-notification-util.js",
"id": "de.appplant.cordova.plugin.local-notification.LocalNotification.Util",
"pluginId": "de.appplant.cordova.plugin.local-notification",
"merges": [
"cordova.plugins.notification.local.core",
"plugin.notification.local.core"
]
},
{
"file": "plugins/cordova-plugin-device/www/device.js",
"id": "cordova-plugin-device.device",
"clobbers": [
"device"
]
}
];
module.exports.metadata =
// TOP OF METADATA
{
"android.support.v4": "21.0.1",
"de.appplant.cordova.common.registerusernotificationsettings": "1.0.1",
"nl.x-services.plugins.toast": "2.0.4",
"de.appplant.cordova.plugin.local-notification": "0.8.2-dev",
"cordova-plugin-device": "1.0.1"
}
{}
// BOTTOM OF METADATA
});
\ No newline at end of file
cordova.define("nl.x-services.plugins.toast.tests", function(require, exports, module) { exports.defineAutoTests = function() {
cordova.define("cordova-plugin-x-toast.tests", function(require, exports, module) { exports.defineAutoTests = function() {
var fail = function (done) {
expect(true).toBe(false);
......@@ -20,6 +20,14 @@ cordova.define("nl.x-services.plugins.toast.tests", function(require, exports, m
expect(window.plugins.toast.show).toBeDefined();
});
it("should define showWithOptions", function() {
expect(window.plugins.toast.showWithOptions).toBeDefined();
});
it("should define optionsBuilder", function() {
expect(window.plugins.toast.optionsBuilder).toBeDefined();
});
it("should define showShortTop", function() {
expect(window.plugins.toast.showShortTop).toBeDefined();
});
......@@ -49,10 +57,6 @@ cordova.define("nl.x-services.plugins.toast.tests", function(require, exports, m
it("should fail due to an invalid position", function(done) {
window.plugins.toast.show('hi', 'short', 'nowhere', fail.bind(null, done), succeed.bind(null, done));
});
it("should fail due to an invalid duration", function(done) {
window.plugins.toast.show('hi', 'medium', 'top', fail.bind(null, done), succeed.bind(null, done));
});
});
};
......
cordova.define("nl.x-services.plugins.toast.Toast", function(require, exports, module) { function Toast() {
cordova.define("cordova-plugin-x-toast.Toast", function(require, exports, module) { function Toast() {
}
Toast.prototype.optionsBuilder = function () {
// defaults
var message = null;
var duration = "short";
var position = "center";
var addPixelsY = 0;
return {
withMessage: function(m) {
message = m;
return this;
},
withDuration: function(d) {
duration = d;
return this;
},
withPosition: function(p) {
position = p;
return this;
},
withAddPixelsY: function(y) {
addPixelsY = y;
return this;
},
build: function() {
return {
message: message,
duration: duration,
position: position,
addPixelsY: addPixelsY
}
}
}
};
Toast.prototype.showWithOptions = function (options, successCallback, errorCallback) {
cordova.exec(successCallback, errorCallback, "Toast", "show", [options]);
};
Toast.prototype.show = function (message, duration, position, successCallback, errorCallback) {
cordova.exec(successCallback, errorCallback, "Toast", "show", [message, duration, position]);
this.showWithOptions(
this.optionsBuilder()
.withMessage(message)
.withDuration(duration)
.withPosition(position)
.build(),
successCallback,
errorCallback);
};
Toast.prototype.showShortTop = function (message, successCallback, errorCallback) {
......@@ -29,6 +81,10 @@ Toast.prototype.showLongBottom = function (message, successCallback, errorCallba
this.show(message, "long", "bottom", successCallback, errorCallback);
};
Toast.prototype.hide = function (successCallback, errorCallback) {
cordova.exec(successCallback, errorCallback, "Toast", "hide", []);
};
Toast.install = function () {
if (!window.plugins) {
window.plugins = {};
......
......@@ -248,7 +248,6 @@ dependencies {
// SUB-PROJECT DEPENDENCIES START
debugCompile project(path: ":CordovaLib", configuration: "debug")
releaseCompile project(path: ":CordovaLib", configuration: "release")
compile "com.android.support:support-v4:+"
// SUB-PROJECT DEPENDENCIES END
}
......
cordova.define('cordova/plugin_list', function(require, exports, module) {
module.exports = [
{
"file": "plugins/cordova-plugin-x-toast/www/Toast.js",
"id": "cordova-plugin-x-toast.Toast",
"pluginId": "cordova-plugin-x-toast",
"clobbers": [
"window.plugins.toast"
]
},
{
"file": "plugins/cordova-plugin-x-toast/test/tests.js",
"id": "cordova-plugin-x-toast.tests",
"pluginId": "cordova-plugin-x-toast"
},
{
"file": "plugins/cordova-plugin-device/www/device.js",
"id": "cordova-plugin-device.device",
"pluginId": "cordova-plugin-device",
"clobbers": [
"device"
]
},
{
"file": "plugins/de.appplant.cordova.plugin.local-notification/www/local-notification.js",
"id": "de.appplant.cordova.plugin.local-notification.LocalNotification",
"pluginId": "de.appplant.cordova.plugin.local-notification",
"clobbers": [
"cordova.plugins.notification.local",
"plugin.notification.local"
]
},
{
"file": "plugins/de.appplant.cordova.plugin.local-notification/www/local-notification-core.js",
"id": "de.appplant.cordova.plugin.local-notification.LocalNotification.Core",
"pluginId": "de.appplant.cordova.plugin.local-notification",
"clobbers": [
"cordova.plugins.notification.local.core",
"plugin.notification.local.core"
]
},
{
"file": "plugins/de.appplant.cordova.plugin.local-notification/www/local-notification-util.js",
"id": "de.appplant.cordova.plugin.local-notification.LocalNotification.Util",
"pluginId": "de.appplant.cordova.plugin.local-notification",
"merges": [
"cordova.plugins.notification.local.core",
"plugin.notification.local.core"
]
}
];
module.exports.metadata =
// TOP OF METADATA
{}
// BOTTOM OF METADATA
});
\ No newline at end of file
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;
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.manufacturer = info.manufacturer || '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();
});
cordova.define("nl.x-services.plugins.toast.tests", function(require, exports, module) { exports.defineAutoTests = function() {
cordova.define("cordova-plugin-x-toast.tests", function(require, exports, module) { exports.defineAutoTests = function() {
var fail = function (done) {
expect(true).toBe(false);
......@@ -20,6 +20,14 @@ cordova.define("nl.x-services.plugins.toast.tests", function(require, exports, m
expect(window.plugins.toast.show).toBeDefined();
});
it("should define showWithOptions", function() {
expect(window.plugins.toast.showWithOptions).toBeDefined();
});
it("should define optionsBuilder", function() {
expect(window.plugins.toast.optionsBuilder).toBeDefined();
});
it("should define showShortTop", function() {
expect(window.plugins.toast.showShortTop).toBeDefined();
});
......@@ -49,10 +57,6 @@ cordova.define("nl.x-services.plugins.toast.tests", function(require, exports, m
it("should fail due to an invalid position", function(done) {
window.plugins.toast.show('hi', 'short', 'nowhere', fail.bind(null, done), succeed.bind(null, done));
});
it("should fail due to an invalid duration", function(done) {
window.plugins.toast.show('hi', 'medium', 'top', fail.bind(null, done), succeed.bind(null, done));
});
});
};
......
cordova.define("nl.x-services.plugins.toast.Toast", function(require, exports, module) { function Toast() {
cordova.define("cordova-plugin-x-toast.Toast", function(require, exports, module) { function Toast() {
}
Toast.prototype.optionsBuilder = function () {
// defaults
var message = null;
var duration = "short";
var position = "center";
var addPixelsY = 0;
return {
withMessage: function(m) {
message = m;
return this;
},
withDuration: function(d) {
duration = d;
return this;
},
withPosition: function(p) {
position = p;
return this;
},
withAddPixelsY: function(y) {
addPixelsY = y;
return this;
},
build: function() {
return {
message: message,
duration: duration,
position: position,
addPixelsY: addPixelsY
}
}
}
};
Toast.prototype.showWithOptions = function (options, successCallback, errorCallback) {
cordova.exec(successCallback, errorCallback, "Toast", "show", [options]);
};
Toast.prototype.show = function (message, duration, position, successCallback, errorCallback) {
cordova.exec(successCallback, errorCallback, "Toast", "show", [message, duration, position]);
this.showWithOptions(
this.optionsBuilder()
.withMessage(message)
.withDuration(duration)
.withPosition(position)
.build(),
successCallback,
errorCallback);
};
Toast.prototype.showShortTop = function (message, successCallback, errorCallback) {
......@@ -29,6 +81,10 @@ Toast.prototype.showLongBottom = function (message, successCallback, errorCallba
this.show(message, "long", "bottom", successCallback, errorCallback);
};
Toast.prototype.hide = function (successCallback, errorCallback) {
cordova.exec(successCallback, errorCallback, "Toast", "hide", []);
};
Toast.install = function () {
if (!window.plugins) {
window.plugins = {};
......
cordova.define("de.appplant.cordova.plugin.local-notification.LocalNotification.Util", function(require, exports, module) { /*
* Copyright (c) 2013-2015 by appPlant UG. All rights reserved.
*
* @APPPLANT_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apache License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. Please obtain a copy of the License at
* http://opensource.org/licenses/Apache-2.0/ and read it before using this
* file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPPLANT_LICENSE_HEADER_END@
*/
var exec = require('cordova/exec'),
channel = require('cordova/channel');
/***********
* MEMBERS *
***********/
// Default values
exports._defaults = {
text: '',
title: '',
sound: 'res://platform_default',
badge: 0,
id: 0,
data: undefined,
every: undefined,
at: undefined
};
// listener
exports._listener = {};
/********
* UTIL *
********/
/**
* Merge platform specific properties into the default ones.
*
* @return {Object}
* The default properties for the platform
*/
exports.applyPlatformSpecificOptions = function () {
var defaults = this._defaults;
switch (device.platform) {
case 'Android':
defaults.icon = 'res://icon';
defaults.smallIcon = 'res://ic_popup_reminder';
defaults.ongoing = false;
defaults.autoClear = true;
defaults.led = 'FFFFFF';
break;
}
return defaults;
};
/**
* Merge custom properties with the default values.
*
* @param {Object} options
* Set of custom values
*
* @retrun {Object}
* The merged property list
*/
exports.mergeWithDefaults = function (options) {
var defaults = this.getDefaults();
options.at = this.getValueFor(options, 'at', 'firstAt', 'date');
options.text = this.getValueFor(options, 'text', 'message');
options.data = this.getValueFor(options, 'data', 'json');
if (defaults.hasOwnProperty('autoClear')) {
options.autoClear = this.getValueFor(options, 'autoClear', 'autoCancel');
}
if (options.autoClear !== true && options.ongoing) {
options.autoClear = false;
}
if (options.at === undefined || options.at === null) {
options.at = new Date();
}
for (var key in defaults) {
if (options[key] === null || options[key] === undefined) {
if (options.hasOwnProperty(key) && ['data','sound'].indexOf(key) > -1) {
options[key] = undefined;
} else {
options[key] = defaults[key];
}
}
}
for (key in options) {
if (!defaults.hasOwnProperty(key)) {
delete options[key];
console.warn('Unknown property: ' + key);
}
}
return options;
};
/**
* Convert the passed values to their required type.
*
* @param {Object} options
* Set of custom values
*
* @retrun {Object}
* The converted property list
*/
exports.convertProperties = function (options) {
if (options.id) {
if (isNaN(options.id)) {
options.id = this.getDefaults().id;
console.warn('Id is not a number: ' + options.id);
} else {
options.id = Number(options.id);
}
}
if (options.title) {
options.title = options.title.toString();
}
if (options.text) {
options.text = options.text.toString();
}
if (options.badge) {
if (isNaN(options.badge)) {
options.badge = this.getDefaults().badge;
console.warn('Badge number is not a number: ' + options.id);
} else {
options.badge = Number(options.badge);
}
}
if (options.at) {
if (typeof options.at == 'object') {
options.at = options.at.getTime();
}
options.at = Math.round(options.at/1000);
}
if (typeof options.data == 'object') {
options.data = JSON.stringify(options.data);
}
return options;
};
/**
* Create callback, which will be executed within a specific scope.
*
* @param {Function} callbackFn
* The callback function
* @param {Object} scope
* The scope for the function
*
* @return {Function}
* The new callback function
*/
exports.createCallbackFn = function (callbackFn, scope) {
if (typeof callbackFn != 'function')
return;
return function () {
callbackFn.apply(scope || this, arguments);
};
};
/**
* Convert the IDs to numbers.
*
* @param {String/Number[]} ids
*
* @return Array of Numbers
*/
exports.convertIds = function (ids) {
var convertedIds = [];
for (var i = 0; i < ids.length; i++) {
convertedIds.push(Number(ids[i]));
}
return convertedIds;
};
/**
* First found value for the given keys.
*
* @param {Object} options
* Object with key-value properties
* @param {String[]} keys*
* Key list
*/
exports.getValueFor = function (options) {
var keys = Array.apply(null, arguments).slice(1);
for (var i = 0; i < keys.length; i++) {
var key = keys[i];
if (options.hasOwnProperty(key)) {
return options[key];
}
}
};
/**
* Fire event with given arguments.
*
* @param {String} event
* The event's name
* @param {args*}
* The callback's arguments
*/
exports.fireEvent = function (event) {
var args = Array.apply(null, arguments).slice(1),
listener = this._listener[event];
if (!listener)
return;
for (var i = 0; i < listener.length; i++) {
var fn = listener[i][0],
scope = listener[i][1];
fn.apply(scope, args);
}
};
/**
* Execute the native counterpart.
*
* @param {String} action
* The name of the action
* @param args[]
* Array of arguments
* @param {Function} callback
* The callback function
* @param {Object} scope
* The scope for the function
*/
exports.exec = function (action, args, callback, scope) {
var fn = this.createCallbackFn(callback, scope),
params = [];
if (Array.isArray(args)) {
params = args;
} else if (args) {
params.push(args);
}
exec(fn, null, 'LocalNotification', action, params);
};
/*********
* HOOKS *
*********/
// Called after 'deviceready' event
channel.deviceready.subscribe(function () {
// Device is ready now, the listeners are registered
// and all queued events can be executed.
exec(null, null, 'LocalNotification', 'deviceready', []);
});
// Called before 'deviceready' event
channel.onCordovaReady.subscribe(function () {
// Device plugin is ready now
channel.onCordovaInfoReady.subscribe(function () {
// Merge platform specifics into defaults
exports.applyPlatformSpecificOptions();
});
});
});
......@@ -4,6 +4,12 @@
<feature name="Toast">
<param name="android-package" value="nl.xservices.plugins.Toast" />
</feature>
<feature name="Device">
<param name="android-package" value="org.apache.cordova.device.Device" />
</feature>
<feature name="LocalNotification">
<param name="android-package" value="de.appplant.cordova.plugin.localnotification.LocalNotification" />
</feature>
<name>NotificationExample</name>
<description>
A sample Apache Cordova application that responds to the deviceready event.
......@@ -13,10 +19,4 @@
</author>
<content src="index.html" />
<access origin="*" />
<feature name="Device">
<param name="android-package" value="org.apache.cordova.device.Device" />
</feature>
<feature name="LocalNotification">
<param name="android-package" value="de.appplant.cordova.plugin.localnotification.LocalNotification" />
</feature>
</widget>
......@@ -5,6 +5,7 @@ import org.apache.cordova.CallbackContext;
import org.apache.cordova.CordovaPlugin;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
/*
// TODO nice way for the Toast plugin to offer a longer delay than the default short and long options
......@@ -19,6 +20,7 @@ import org.json.JSONException;
public class Toast extends CordovaPlugin {
private static final String ACTION_SHOW_EVENT = "show";
private static final String ACTION_HIDE_EVENT = "hide";
private android.widget.Toast mostRecentToast;
......@@ -27,40 +29,44 @@ public class Toast extends CordovaPlugin {
@Override
public boolean execute(String action, JSONArray args, final CallbackContext callbackContext) throws JSONException {
if (ACTION_SHOW_EVENT.equals(action)) {
if (ACTION_HIDE_EVENT.equals(action)) {
if (mostRecentToast != null) {
mostRecentToast.cancel();
}
callbackContext.success();
return true;
} else if (ACTION_SHOW_EVENT.equals(action)) {
if (this.isPaused) {
return true;
}
final String message = args.getString(0);
final String duration = args.getString(1);
final String position = args.getString(2);
final JSONObject options = args.getJSONObject(0);
final String message = options.getString("message");
final String duration = options.getString("duration");
final String position = options.getString("position");
final int addPixelsY = options.has("addPixelsY") ? options.getInt("addPixelsY") : 0;
cordova.getActivity().runOnUiThread(new Runnable() {
public void run() {
android.widget.Toast toast = android.widget.Toast.makeText(webView.getContext(), message, 0);
android.widget.Toast toast = android.widget.Toast.makeText(
cordova.getActivity().getApplicationContext(),
message,
"short".equals(duration) ? android.widget.Toast.LENGTH_SHORT : android.widget.Toast.LENGTH_LONG);
if ("top".equals(position)) {
toast.setGravity(Gravity.TOP|Gravity.CENTER_HORIZONTAL, 0, 20);
toast.setGravity(Gravity.TOP|Gravity.CENTER_HORIZONTAL, 0, 20 + addPixelsY);
} else if ("bottom".equals(position)) {
toast.setGravity(Gravity.BOTTOM|Gravity.CENTER_HORIZONTAL, 0, 20);
toast.setGravity(Gravity.BOTTOM|Gravity.CENTER_HORIZONTAL, 0, 20 - addPixelsY);
} else if ("center".equals(position)) {
toast.setGravity(Gravity.CENTER_VERTICAL|Gravity.CENTER_HORIZONTAL, 0, 0);
toast.setGravity(Gravity.CENTER_VERTICAL|Gravity.CENTER_HORIZONTAL, 0, addPixelsY);
} else {
callbackContext.error("invalid position. valid options are 'top', 'center' and 'bottom'");
return;
}
if ("short".equals(duration)) {
toast.setDuration(android.widget.Toast.LENGTH_SHORT);
} else if ("long".equals(duration)) {
toast.setDuration(android.widget.Toast.LENGTH_LONG);
} else {
callbackContext.error("invalid duration. valid options are 'short' and 'long'");
return;
}
toast.show();
mostRecentToast = toast;
callbackContext.success();
......
......@@ -57,6 +57,7 @@
#define __CORDOVA_3_8_0 30800
#define __CORDOVA_3_9_0 30900
#define __CORDOVA_3_9_1 30901
#define __CORDOVA_3_9_2 30902
#define __CORDOVA_NA 99999 /* not available */
/*
......@@ -67,7 +68,7 @@
#endif
*/
#ifndef CORDOVA_VERSION_MIN_REQUIRED
#define CORDOVA_VERSION_MIN_REQUIRED __CORDOVA_3_9_1
#define CORDOVA_VERSION_MIN_REQUIRED __CORDOVA_3_9_2
#endif
/*
......
......@@ -38,7 +38,7 @@ extern NSString* const CDVRemoteNotificationError;
@property (readonly, assign) BOOL hasPendingOperation;
- (CDVPlugin*)initWithWebView:(UIWebView*)theWebView;
- (CDVPlugin*)initWithWebView:(UIWebView*)theWebView CDV_DEPRECATED(3.9.2, "Use pluginInitialize method instead. This will be removed in 4.0.0");
- (void)pluginInitialize;
- (void)handleOpenURL:(NSNotification*)notification;
......
......@@ -41,8 +41,8 @@
@property (nonatomic, readonly, strong) NSDictionary* pluginsMap;
@property (nonatomic, readonly, strong) NSMutableDictionary* settings;
@property (nonatomic, readonly, strong) NSXMLParser* configParser;
@property (nonatomic, readonly, strong) CDVWhitelist* whitelist; // readonly for public
@property (nonatomic, readonly, assign) BOOL loadFromString;
@property (nonatomic, readonly, strong) CDVWhitelist* whitelist CDV_DEPRECATED(3.9.2, "Use URLisAllowed to check specific URL. This will be removed in 4.0.0"); // readonly for public
@property (nonatomic, readonly, assign) BOOL loadFromString CDV_DEPRECATED(3.9.2, "This will be removed in 4.0.0");
@property (nonatomic, readwrite, copy) NSString* wwwFolderName;
@property (nonatomic, readwrite, copy) NSString* startPage;
......@@ -61,14 +61,14 @@
*/
@property (nonatomic, readwrite, copy) NSString* baseUserAgent;
+ (NSDictionary*)getBundlePlist:(NSString*)plistName;
+ (NSString*)applicationDocumentsDirectory;
+ (NSDictionary*)getBundlePlist:(NSString*)plistName CDV_DEPRECATED(3.9.2, "This will be removed in 4.0.0");
+ (NSString*)applicationDocumentsDirectory CDV_DEPRECATED(3.9.2, "This will be removed in 4.0.0");
- (void)printMultitaskingInfo;
- (void)createGapView;
- (void)printMultitaskingInfo CDV_DEPRECATED(3.9.2, "This will be removed in 4.0.0");
- (void)createGapView CDV_DEPRECATED(3.9.2, "This will be removed in 4.0.0");
- (UIWebView*)newCordovaViewWithFrame:(CGRect)bounds;
- (void)javascriptAlert:(NSString*)text;
- (void)javascriptAlert:(NSString*)text CDV_DEPRECATED(3.9.2, "Use the CDVCommandDelegate evalJs: directly. This will be removed in 4.0.0");
- (NSString*)appURLScheme;
- (NSArray*)parseInterfaceOrientations:(NSArray*)orientations;
......
......@@ -197,7 +197,7 @@ static NSString *stripFragment(NSString* url)
{
NSString* scheme = [[request URL] scheme];
if ([scheme isEqualToString:@"mailto"] || [scheme isEqualToString:@"tel"] || [scheme isEqualToString:@"sms"]) {
if ([scheme isEqualToString:@"mailto"] || [scheme isEqualToString:@"tel"] || [scheme isEqualToString:@"sms"] || [scheme isEqualToString:@"blob"]) {
return YES;
}
......
......@@ -41,7 +41,7 @@ char *CDVNewBase64Encode(
- (NSString*)base64EncodedString CDV_DEPRECATED(3.8 .0, "Use [NSData cdv_base64EncodedString]");
+ (NSData*)cdv_dataFromBase64String:(NSString*)aString;
- (NSString*)cdv_base64EncodedString;
+ (NSData*)cdv_dataFromBase64String:(NSString*)aString CDV_DEPRECATED(3.9.2, "Use NSData initWithBase64EncodedString instead. This will be removed in 4.0.0");
- (NSString*)cdv_base64EncodedString CDV_DEPRECATED(3.9.2, "Use NSData base64EncodedStringWithOptions instead. This will be removed in 4.0.0");
@end
......@@ -325,7 +325,7 @@
0867D690FE84028FC02AAC07 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0700;
LastUpgradeCheck = 0710;
};
buildConfigurationList = 1DEB922208733DC00010E9CD /* Build configuration list for PBXProject "CordovaLib" */;
compatibilityVersion = "Xcode 3.2";
......
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0700"
LastUpgradeVersion = "0710"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
......
// Platform: ios
// 2c29e187e4206a6a77fba940ef6f77aef5c7eb8c
// 49a8db57fa070d20ea7b304a53ffec3d7250c5af
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
......@@ -19,7 +19,7 @@
under the License.
*/
;(function() {
var PLATFORM_VERSION_BUILD_LABEL = '3.9.1';
var PLATFORM_VERSION_BUILD_LABEL = '3.9.2';
// file: src/scripts/require.js
/*jshint -W079 */
......@@ -101,7 +101,9 @@ if (typeof module === "object" && typeof require === "function") {
// file: src/cordova.js
define("cordova", function(require, exports, module) {
if(window.cordova){
// 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");
}
......@@ -815,7 +817,7 @@ module.exports = channel;
});
// file: /Users/steveng/repo/cordova/cordova-ios/cordova-js-src/exec.js
// file: e:/cordova/cordova-ios/cordova-js-src/exec.js
define("cordova/exec", function(require, exports, module) {
/**
......@@ -1286,10 +1288,12 @@ 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];
var platformInitChannelsArray = [channel.onDOMContentLoaded, channel.onNativeReady, channel.onPluginsReady];
// setting exec
cordova.exec = require('cordova/exec');
......@@ -1374,10 +1378,19 @@ if (window._nativeReady) {
// 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();
......@@ -1496,7 +1509,104 @@ exports.reset();
});
// file: /Users/steveng/repo/cordova/cordova-ios/cordova-js-src/platform.js
// 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);
// <runs/>
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: e:/cordova/cordova-ios/cordova-js-src/platform.js
define("cordova/platform", function(require, exports, module) {
module.exports = {
......@@ -1512,10 +1622,6 @@ module.exports = {
// file: src/common/pluginloader.js
define("cordova/pluginloader", function(require, exports, module) {
/*
NOTE: this file is NOT used when we use the browserify workflow
*/
var modulemapper = require('cordova/modulemapper');
var urlutil = require('cordova/urlutil');
......@@ -1625,6 +1731,54 @@ exports.load = function(callback) {
});
// file: src/common/pluginloader_b.js
define("cordova/pluginloader_b", function(require, exports, module) {
var modulemapper = require('cordova/modulemapper');
// Handler for the cordova_plugins.js content.
// See plugman's plugin_loader.js for the details of this object.
function handlePluginsObject(moduleList) {
// if moduleList is not defined or empty, we've nothing to do
if (!moduleList || !moduleList.length) {
return;
}
// Loop through all the modules and then through their clobbers and merges.
for (var i = 0, module; module = moduleList[i]; i++) {
if (module.clobbers && module.clobbers.length) {
for (var j = 0; j < module.clobbers.length; j++) {
modulemapper.clobbers(module.id, module.clobbers[j]);
}
}
if (module.merges && module.merges.length) {
for (var k = 0; k < module.merges.length; k++) {
modulemapper.merges(module.id, module.merges[k]);
}
}
// Finally, if runs is truthy we want to simply require() the module.
if (module.runs) {
modulemapper.runs(module.id);
}
}
}
// Loads all plugins' js-modules. Plugin loading is syncronous in browserified bundle
// but the method accepts callback to be compatible with non-browserify flow.
// onDeviceReady is blocked on onPluginsReady. onPluginsReady is fired when there are
// no plugins to load, or they are all done.
exports.load = function(callback) {
var moduleList = require("cordova/plugin_list");
handlePluginsObject(moduleList);
callback();
};
});
// file: src/common/urlutil.js
define("cordova/urlutil", function(require, exports, module) {
......
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0700"
LastUpgradeVersion = "0710"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
......
......@@ -135,7 +135,11 @@
}
#endif
#if __IPHONE_OS_VERSION_MAX_ALLOWED < 90000
- (NSUInteger)application:(UIApplication*)application supportedInterfaceOrientationsForWindow:(UIWindow*)window
#else
- (UIInterfaceOrientationMask)application:(UIApplication*)application supportedInterfaceOrientationsForWindow:(UIWindow*)window
#endif
{
// iPhone doesn't support upside down by default, while the iPad does. Override to allow all orientations always, and let the root view controller decide what's allowed (the supported orientations mask gets intersected).
NSUInteger supportedInterfaceOrientations = (1 << UIInterfaceOrientationPortrait) | (1 << UIInterfaceOrientationLandscapeLeft) | (1 << UIInterfaceOrientationLandscapeRight) | (1 << UIInterfaceOrientationPortraitUpsideDown);
......
......@@ -64,6 +64,11 @@
<string>0.0.1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
<key>NSMainNibFile</key>
<string></string>
<key>NSMainNibFile~ipad</key>
......@@ -171,5 +176,7 @@
<string>{768, 1024}</string>
</dict>
</array>
<key>UIRequiresFullScreen</key>
<true/>
</dict>
</plist>
......@@ -5,10 +5,13 @@
// each makeToast method creates a view and displays it as toast
- (void)makeToast:(NSString *)message;
- (void)makeToast:(NSString *)message duration:(NSTimeInterval)interval position:(id)position;
- (void)makeToast:(NSString *)message duration:(NSTimeInterval)duration position:(id)position addPixelsY:(int)addPixelsY;
- (void)makeToast:(NSString *)message duration:(NSTimeInterval)interval position:(id)position image:(UIImage *)image;
- (void)makeToast:(NSString *)message duration:(NSTimeInterval)interval position:(id)position title:(NSString *)title;
- (void)makeToast:(NSString *)message duration:(NSTimeInterval)interval position:(id)position title:(NSString *)title image:(UIImage *)image;
- (void)hideToast;
// displays toast with an activity spinner
- (void)makeToastActivity;
- (void)makeToastActivity:(id)position;
......@@ -16,6 +19,7 @@
// the showToast methods display any view as toast
- (void)showToast:(UIView *)toast;
- (void)showToast:(UIView *)toast duration:(NSTimeInterval)interval position:(id)point;
- (void)showToast:(UIView *)toast duration:(NSTimeInterval)interval position:(id)point ;
- (void)showToast:(UIView *)toast duration:(NSTimeInterval)interval position:(id)point addedPixelsY:(int)addPixelsY;
@end
......@@ -12,7 +12,7 @@ static const CGFloat CSToastMaxWidth = 0.8; // 80% of parent vie
static const CGFloat CSToastMaxHeight = 0.8; // 80% of parent view height
static const CGFloat CSToastHorizontalPadding = 16.0;
static const CGFloat CSToastVerticalPadding = 12.0;
static const CGFloat CSToastTopBottomOffset = 10.0;
static const CGFloat CSToastTopBottomOffset = 20.0;
static const CGFloat CSToastCornerRadius = 20.0;
static const CGFloat CSToastOpacity = 0.8;
static const CGFloat CSToastFontSize = 13.0;
......@@ -53,7 +53,7 @@ static UIView *prevToast = NULL;
- (void)hideToast:(UIView *)toast;
- (void)toastTimerDidFinish:(NSTimer *)timer;
- (void)handleToastTapped:(UITapGestureRecognizer *)recognizer;
- (CGPoint)centerPointForPosition:(id)position withToast:(UIView *)toast;
- (CGPoint)centerPointForPosition:(id)position withToast:(UIView *)toast withAddedPixelsY:(int) addPixelsY;
- (UIView *)viewForMessage:(NSString *)message title:(NSString *)title image:(UIImage *)image;
- (CGSize)sizeForString:(NSString *)string font:(UIFont *)font constrainedToSize:(CGSize)constrainedSize lineBreakMode:(NSLineBreakMode)lineBreakMode;
......@@ -73,6 +73,11 @@ static UIView *prevToast = NULL;
[self showToast:toast duration:duration position:position];
}
- (void)makeToast:(NSString *)message duration:(NSTimeInterval)duration position:(id)position addPixelsY:(int)addPixelsY {
UIView *toast = [self viewForMessage:message title:nil image:nil];
[self showToast:toast duration:duration position:position addedPixelsY:addPixelsY];
}
- (void)makeToast:(NSString *)message duration:(NSTimeInterval)duration position:(id)position title:(NSString *)title {
UIView *toast = [self viewForMessage:message title:title image:nil];
[self showToast:toast duration:duration position:position];
......@@ -93,11 +98,13 @@ static UIView *prevToast = NULL;
}
- (void)showToast:(UIView *)toast duration:(NSTimeInterval)duration position:(id)point {
if(prevToast){
[self hideToast:prevToast];
}
[self showToast:toast duration:CSToastDefaultDuration position:CSToastDefaultPosition addedPixelsY:0];
}
- (void)showToast:(UIView *)toast duration:(NSTimeInterval)duration position:(id)point addedPixelsY:(int) addPixelsY {
[self hideToast];
prevToast = toast;
toast.center = [self centerPointForPosition:point withToast:toast];
toast.center = [self centerPointForPosition:point withToast:toast withAddedPixelsY:addPixelsY];
toast.alpha = 0.0;
if (CSToastHidesOnTap) {
......@@ -107,7 +114,10 @@ static UIView *prevToast = NULL;
toast.exclusiveTouch = YES;
}
[self addSubview:toast];
// make sure that if InAppBrowser is active, we're still showing Toasts on top of it
UIViewController *vc = [self getTopMostViewController];
UIView *v = [vc view];
[v addSubview:toast];
[UIView animateWithDuration:CSToastFadeDuration
delay:0.0
......@@ -122,6 +132,20 @@ static UIView *prevToast = NULL;
}
- (UIViewController*) getTopMostViewController {
UIViewController *presentingViewController = [[[UIApplication sharedApplication] delegate] window].rootViewController;
while (presentingViewController.presentedViewController != nil) {
presentingViewController = presentingViewController.presentedViewController;
}
return presentingViewController;
}
- (void)hideToast {
if (prevToast){
[self hideToast:prevToast];
}
}
- (void)hideToast:(UIView *)toast {
[UIView animateWithDuration:CSToastFadeDuration
delay:0.0
......@@ -158,7 +182,7 @@ static UIView *prevToast = NULL;
if (existingActivityView != nil) return;
UIView *activityView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, CSToastActivityWidth, CSToastActivityHeight)];
activityView.center = [self centerPointForPosition:position withToast:activityView];
activityView.center = [self centerPointForPosition:position withToast:activityView withAddedPixelsY:0];
activityView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:CSToastOpacity];
activityView.alpha = 0.0;
activityView.autoresizingMask = (UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin);
......@@ -206,22 +230,22 @@ static UIView *prevToast = NULL;
#pragma mark - Helpers
- (CGPoint)centerPointForPosition:(id)point withToast:(UIView *)toast {
- (CGPoint)centerPointForPosition:(id)point withToast:(UIView *)toast withAddedPixelsY:(int) addPixelsY {
if([point isKindOfClass:[NSString class]]) {
// convert string literals @"top", @"bottom", @"center", or any point wrapped in an NSValue object into a CGPoint
if([point caseInsensitiveCompare:@"top"] == NSOrderedSame) {
return CGPointMake(self.bounds.size.width/2, (toast.frame.size.height / 2) + CSToastVerticalPadding + CSToastTopBottomOffset);
return CGPointMake(self.bounds.size.width/2, (toast.frame.size.height / 2) + addPixelsY + CSToastVerticalPadding + CSToastTopBottomOffset);
} else if([point caseInsensitiveCompare:@"bottom"] == NSOrderedSame) {
return CGPointMake(self.bounds.size.width/2, (self.bounds.size.height - (toast.frame.size.height / 2)) - CSToastVerticalPadding - CSToastTopBottomOffset);
return CGPointMake(self.bounds.size.width/2, (self.bounds.size.height - (toast.frame.size.height / 2)) - CSToastVerticalPadding - CSToastTopBottomOffset + addPixelsY);
} else if([point caseInsensitiveCompare:@"center"] == NSOrderedSame) {
return CGPointMake(self.bounds.size.width / 2, self.bounds.size.height / 2);
return CGPointMake(self.bounds.size.width / 2, (self.bounds.size.height / 2) + addPixelsY);
}
} else if ([point isKindOfClass:[NSValue class]]) {
return [point CGPointValue];
}
NSLog(@"Warning: Invalid position for toast.");
return [self centerPointForPosition:CSToastDefaultPosition withToast:toast];
return [self centerPointForPosition:CSToastDefaultPosition withToast:toast withAddedPixelsY:addPixelsY];
}
- (CGSize)sizeForString:(NSString *)string font:(UIFont *)font constrainedToSize:(CGSize)constrainedSize lineBreakMode:(NSLineBreakMode)lineBreakMode {
......@@ -233,7 +257,10 @@ static UIView *prevToast = NULL;
return CGSizeMake(ceilf(boundingRect.size.width), ceilf(boundingRect.size.height));
}
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
return [string sizeWithFont:font constrainedToSize:constrainedSize lineBreakMode:lineBreakMode];
#pragma clang diagnostic pop
}
- (UIView *)viewForMessage:(NSString *)message title:(NSString *)title image:(UIImage *)image {
......
......@@ -3,5 +3,6 @@
@interface Toast : CDVPlugin
- (void)show:(CDVInvokedUrlCommand*)command;
- (void)hide:(CDVInvokedUrlCommand*)command;
@end
\ No newline at end of file
......@@ -6,9 +6,12 @@
- (void)show:(CDVInvokedUrlCommand*)command {
NSString *message = [command.arguments objectAtIndex:0];
NSString *duration = [command.arguments objectAtIndex:1];
NSString *position = [command.arguments objectAtIndex:2];
NSDictionary* options = [command.arguments objectAtIndex:0];
NSString *message = [options objectForKey:@"message"];
NSString *duration = [options objectForKey:@"duration"];
NSString *position = [options objectForKey:@"position"];
NSNumber *addPixelsY = [options objectForKey:@"addPixelsY"];
if (![position isEqual: @"top"] && ![position isEqual: @"center"] && ![position isEqual: @"bottom"]) {
CDVPluginResult * pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"invalid position. valid options are 'top', 'center' and 'bottom'"];
......@@ -27,7 +30,14 @@
return;
}
[self.webView makeToast:message duration:durationInt position:position];
[self.webView makeToast:message duration:durationInt position:position addPixelsY:addPixelsY == nil ? 0 : [addPixelsY intValue]];
CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}
- (void)hide:(CDVInvokedUrlCommand*)command {
[self.webView hideToast];
CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
......
......@@ -14,6 +14,16 @@
<feature name="LocalStorage">
<param name="ios-package" value="CDVLocalStorage" />
</feature>
<feature name="Device">
<param name="ios-package" value="CDVDevice" />
</feature>
<feature name="Toast">
<param name="ios-package" value="Toast" />
</feature>
<feature name="LocalNotification">
<param name="ios-package" onload="true" value="APPLocalNotification" />
<param name="onload" value="true" />
</feature>
<name>NotificationExample</name>
<description>
A sample Apache Cordova application that responds to the deviceready event.
......@@ -23,14 +33,4 @@
</author>
<content src="index.html" />
<access origin="*" />
<feature name="Toast">
<param name="ios-package" value="Toast" />
</feature>
<feature name="Device">
<param name="ios-package" value="CDVDevice" />
</feature>
<feature name="LocalNotification">
<param name="ios-package" onload="true" value="APPLocalNotification" />
<param name="onload" value="true" />
</feature>
</widget>
//
// 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.
//
//
// Auto-generated config file to override configuration files (build-release/build-debug).
//
......@@ -28,5 +28,5 @@
CODE_SIGN_IDENTITY = iPhone Developer
CODE_SIGN_IDENTITY[sdk=iphoneos*] = iPhone Developer
// (CB-7872) Solution for XCode 6.1 signing errors related to resource envelope format deprecation
CODE_SIGN_RESOURCE_RULES_PATH = $(SDKROOT)/ResourceRules.plist
\ No newline at end of file
// (CB-9721) Set ENABLE_BITCODE to NO in build.xcconfig
ENABLE_BITCODE = NO
......@@ -50,7 +50,7 @@ module.exports.run = function (argv) {
// Valid values for "--target" (case sensitive):
var validTargets = ['iPhone-4s', 'iPhone-5', 'iPhone-5s', 'iPhone-6-Plus', 'iPhone-6',
'iPad-2', 'iPad-Retina', 'iPad-Air', 'Resizable-iPhone', 'Resizable-iPad'];
if (args.target && validTargets.indexOf(args.target) < 0 ) {
if (!(args.device) && args.target && validTargets.indexOf(args.target.split(',')[0]) < 0 ) {
return Q.reject(args.target + ' is not a valid target for emulator');
}
......
......@@ -25,6 +25,6 @@
Note: it does not work if the --shared option was used to create the project.
*/
var VERSION="3.9.1"
var VERSION="3.9.2"
console.log(VERSION);
{
"QuartzCore.framework": 1
}
\ No newline at end of file
{
"prepare_queue": {
"installed": [],
"uninstalled": []
},
"config_munge": {
"files": {
"config.xml": {
"parents": {
"/*": [
{
"xml": "<feature name=\"Device\"><param name=\"ios-package\" value=\"CDVDevice\" /></feature>",
"count": 1
},
{
"xml": "<feature name=\"Toast\"><param name=\"ios-package\" value=\"Toast\" /></feature>",
"count": 1
},
{
"xml": "<feature name=\"LocalNotification\"><param name=\"ios-package\" onload=\"true\" value=\"APPLocalNotification\" /><param name=\"onload\" value=\"true\" /></feature>",
"count": 1
}
]
}
}
}
},
"installed_plugins": {
"cordova-android-support-v4": {
"PACKAGE_NAME": "de.appplant.localnotification.example"
},
"cordova-plugin-device": {
"PACKAGE_NAME": "de.appplant.localnotification.example"
},
"cordova-plugin-x-toast": {
"PACKAGE_NAME": "de.appplant.localnotification.example"
},
"de.appplant.cordova.common.registerusernotificationsettings": {
"PACKAGE_NAME": "de.appplant.localnotification.example"
},
"de.appplant.cordova.plugin.local-notification": {
"PACKAGE_NAME": "de.appplant.localnotification.example"
}
},
"dependent_plugins": {},
"modules": [
{
"file": "plugins/cordova-plugin-device/www/device.js",
"id": "cordova-plugin-device.device",
"pluginId": "cordova-plugin-device",
"clobbers": [
"device"
]
},
{
"file": "plugins/cordova-plugin-x-toast/www/Toast.js",
"id": "cordova-plugin-x-toast.Toast",
"pluginId": "cordova-plugin-x-toast",
"clobbers": [
"window.plugins.toast"
]
},
{
"file": "plugins/cordova-plugin-x-toast/test/tests.js",
"id": "cordova-plugin-x-toast.tests",
"pluginId": "cordova-plugin-x-toast"
},
{
"file": "plugins/de.appplant.cordova.plugin.local-notification/www/local-notification.js",
"id": "de.appplant.cordova.plugin.local-notification.LocalNotification",
"pluginId": "de.appplant.cordova.plugin.local-notification",
"clobbers": [
"cordova.plugins.notification.local",
"plugin.notification.local"
]
},
{
"file": "plugins/de.appplant.cordova.plugin.local-notification/www/local-notification-core.js",
"id": "de.appplant.cordova.plugin.local-notification.LocalNotification.Core",
"pluginId": "de.appplant.cordova.plugin.local-notification",
"clobbers": [
"cordova.plugins.notification.local.core",
"plugin.notification.local.core"
]
},
{
"file": "plugins/de.appplant.cordova.plugin.local-notification/www/local-notification-util.js",
"id": "de.appplant.cordova.plugin.local-notification.LocalNotification.Util",
"pluginId": "de.appplant.cordova.plugin.local-notification",
"merges": [
"cordova.plugins.notification.local.core",
"plugin.notification.local.core"
]
}
]
}
\ No newline at end of file
// Platform: ios
// 2c29e187e4206a6a77fba940ef6f77aef5c7eb8c
// 49a8db57fa070d20ea7b304a53ffec3d7250c5af
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
......@@ -19,7 +19,7 @@
under the License.
*/
;(function() {
var PLATFORM_VERSION_BUILD_LABEL = '3.9.1';
var PLATFORM_VERSION_BUILD_LABEL = '3.9.2';
// file: src/scripts/require.js
/*jshint -W079 */
......@@ -101,7 +101,9 @@ if (typeof module === "object" && typeof require === "function") {
// file: src/cordova.js
define("cordova", function(require, exports, module) {
if(window.cordova){
// 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");
}
......@@ -815,7 +817,7 @@ module.exports = channel;
});
// file: /Users/steveng/repo/cordova/cordova-ios/cordova-js-src/exec.js
// file: e:/cordova/cordova-ios/cordova-js-src/exec.js
define("cordova/exec", function(require, exports, module) {
/**
......@@ -1286,10 +1288,12 @@ 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];
var platformInitChannelsArray = [channel.onDOMContentLoaded, channel.onNativeReady, channel.onPluginsReady];
// setting exec
cordova.exec = require('cordova/exec');
......@@ -1374,10 +1378,19 @@ if (window._nativeReady) {
// 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();
......@@ -1496,7 +1509,104 @@ exports.reset();
});
// file: /Users/steveng/repo/cordova/cordova-ios/cordova-js-src/platform.js
// 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);
// <runs/>
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: e:/cordova/cordova-ios/cordova-js-src/platform.js
define("cordova/platform", function(require, exports, module) {
module.exports = {
......@@ -1512,10 +1622,6 @@ module.exports = {
// file: src/common/pluginloader.js
define("cordova/pluginloader", function(require, exports, module) {
/*
NOTE: this file is NOT used when we use the browserify workflow
*/
var modulemapper = require('cordova/modulemapper');
var urlutil = require('cordova/urlutil');
......@@ -1625,6 +1731,54 @@ exports.load = function(callback) {
});
// file: src/common/pluginloader_b.js
define("cordova/pluginloader_b", function(require, exports, module) {
var modulemapper = require('cordova/modulemapper');
// Handler for the cordova_plugins.js content.
// See plugman's plugin_loader.js for the details of this object.
function handlePluginsObject(moduleList) {
// if moduleList is not defined or empty, we've nothing to do
if (!moduleList || !moduleList.length) {
return;
}
// Loop through all the modules and then through their clobbers and merges.
for (var i = 0, module; module = moduleList[i]; i++) {
if (module.clobbers && module.clobbers.length) {
for (var j = 0; j < module.clobbers.length; j++) {
modulemapper.clobbers(module.id, module.clobbers[j]);
}
}
if (module.merges && module.merges.length) {
for (var k = 0; k < module.merges.length; k++) {
modulemapper.merges(module.id, module.merges[k]);
}
}
// Finally, if runs is truthy we want to simply require() the module.
if (module.runs) {
modulemapper.runs(module.id);
}
}
}
// Loads all plugins' js-modules. Plugin loading is syncronous in browserified bundle
// but the method accepts callback to be compatible with non-browserify flow.
// onDeviceReady is blocked on onPluginsReady. onPluginsReady is fired when there are
// no plugins to load, or they are all done.
exports.load = function(callback) {
var moduleList = require("cordova/plugin_list");
handlePluginsObject(moduleList);
callback();
};
});
// file: src/common/urlutil.js
define("cordova/urlutil", function(require, exports, module) {
......
cordova.define('cordova/plugin_list', function(require, exports, module) {
module.exports = [
{
"file": "plugins/cordova-plugin-device/www/device.js",
"id": "cordova-plugin-device.device",
"pluginId": "cordova-plugin-device",
"clobbers": [
"device"
]
},
{
"file": "plugins/cordova-plugin-x-toast/www/Toast.js",
"id": "cordova-plugin-x-toast.Toast",
"pluginId": "cordova-plugin-x-toast",
"clobbers": [
"window.plugins.toast"
]
},
{
"file": "plugins/cordova-plugin-x-toast/test/tests.js",
"id": "cordova-plugin-x-toast.tests",
"pluginId": "cordova-plugin-x-toast"
},
{
"file": "plugins/de.appplant.cordova.plugin.local-notification/www/local-notification.js",
"id": "de.appplant.cordova.plugin.local-notification.LocalNotification",
"pluginId": "de.appplant.cordova.plugin.local-notification",
"clobbers": [
"cordova.plugins.notification.local",
"plugin.notification.local"
]
},
{
"file": "plugins/de.appplant.cordova.plugin.local-notification/www/local-notification-core.js",
"id": "de.appplant.cordova.plugin.local-notification.LocalNotification.Core",
"pluginId": "de.appplant.cordova.plugin.local-notification",
"clobbers": [
"cordova.plugins.notification.local.core",
"plugin.notification.local.core"
]
},
{
"file": "plugins/de.appplant.cordova.plugin.local-notification/www/local-notification-util.js",
"id": "de.appplant.cordova.plugin.local-notification.LocalNotification.Util",
"pluginId": "de.appplant.cordova.plugin.local-notification",
"merges": [
"cordova.plugins.notification.local.core",
"plugin.notification.local.core"
]
}
];
module.exports.metadata =
// TOP OF METADATA
{}
// BOTTOM OF METADATA
});
\ No newline at end of file
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;
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.manufacturer = info.manufacturer || '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();
});
cordova.define("nl.x-services.plugins.toast.tests", function(require, exports, module) { exports.defineAutoTests = function() {
cordova.define("cordova-plugin-x-toast.tests", function(require, exports, module) { exports.defineAutoTests = function() {
var fail = function (done) {
expect(true).toBe(false);
......@@ -20,6 +20,14 @@ cordova.define("nl.x-services.plugins.toast.tests", function(require, exports, m
expect(window.plugins.toast.show).toBeDefined();
});
it("should define showWithOptions", function() {
expect(window.plugins.toast.showWithOptions).toBeDefined();
});
it("should define optionsBuilder", function() {
expect(window.plugins.toast.optionsBuilder).toBeDefined();
});
it("should define showShortTop", function() {
expect(window.plugins.toast.showShortTop).toBeDefined();
});
......@@ -49,10 +57,6 @@ cordova.define("nl.x-services.plugins.toast.tests", function(require, exports, m
it("should fail due to an invalid position", function(done) {
window.plugins.toast.show('hi', 'short', 'nowhere', fail.bind(null, done), succeed.bind(null, done));
});
it("should fail due to an invalid duration", function(done) {
window.plugins.toast.show('hi', 'medium', 'top', fail.bind(null, done), succeed.bind(null, done));
});
});
};
......
cordova.define("nl.x-services.plugins.toast.Toast", function(require, exports, module) { function Toast() {
cordova.define("cordova-plugin-x-toast.Toast", function(require, exports, module) { function Toast() {
}
Toast.prototype.optionsBuilder = function () {
// defaults
var message = null;
var duration = "short";
var position = "center";
var addPixelsY = 0;
return {
withMessage: function(m) {
message = m;
return this;
},
withDuration: function(d) {
duration = d;
return this;
},
withPosition: function(p) {
position = p;
return this;
},
withAddPixelsY: function(y) {
addPixelsY = y;
return this;
},
build: function() {
return {
message: message,
duration: duration,
position: position,
addPixelsY: addPixelsY
}
}
}
};
Toast.prototype.showWithOptions = function (options, successCallback, errorCallback) {
cordova.exec(successCallback, errorCallback, "Toast", "show", [options]);
};
Toast.prototype.show = function (message, duration, position, successCallback, errorCallback) {
cordova.exec(successCallback, errorCallback, "Toast", "show", [message, duration, position]);
this.showWithOptions(
this.optionsBuilder()
.withMessage(message)
.withDuration(duration)
.withPosition(position)
.build(),
successCallback,
errorCallback);
};
Toast.prototype.showShortTop = function (message, successCallback, errorCallback) {
......@@ -29,6 +81,10 @@ Toast.prototype.showLongBottom = function (message, successCallback, errorCallba
this.show(message, "long", "bottom", successCallback, errorCallback);
};
Toast.prototype.hide = function (successCallback, errorCallback) {
cordova.exec(successCallback, errorCallback, "Toast", "hide", []);
};
Toast.install = function () {
if (!window.plugins) {
window.plugins = {};
......
cordova.define("de.appplant.cordova.plugin.local-notification.LocalNotification.Util", function(require, exports, module) { /*
* Copyright (c) 2013-2015 by appPlant UG. All rights reserved.
*
* @APPPLANT_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apache License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. Please obtain a copy of the License at
* http://opensource.org/licenses/Apache-2.0/ and read it before using this
* file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPPLANT_LICENSE_HEADER_END@
*/
var exec = require('cordova/exec'),
channel = require('cordova/channel');
/***********
* MEMBERS *
***********/
// Default values
exports._defaults = {
text: '',
title: '',
sound: 'res://platform_default',
badge: 0,
id: 0,
data: undefined,
every: undefined,
at: undefined
};
// listener
exports._listener = {};
/********
* UTIL *
********/
/**
* Merge platform specific properties into the default ones.
*
* @return {Object}
* The default properties for the platform
*/
exports.applyPlatformSpecificOptions = function () {
var defaults = this._defaults;
switch (device.platform) {
case 'Android':
defaults.icon = 'res://icon';
defaults.smallIcon = 'res://ic_popup_reminder';
defaults.ongoing = false;
defaults.autoClear = true;
defaults.led = 'FFFFFF';
break;
}
return defaults;
};
/**
* Merge custom properties with the default values.
*
* @param {Object} options
* Set of custom values
*
* @retrun {Object}
* The merged property list
*/
exports.mergeWithDefaults = function (options) {
var defaults = this.getDefaults();
options.at = this.getValueFor(options, 'at', 'firstAt', 'date');
options.text = this.getValueFor(options, 'text', 'message');
options.data = this.getValueFor(options, 'data', 'json');
if (defaults.hasOwnProperty('autoClear')) {
options.autoClear = this.getValueFor(options, 'autoClear', 'autoCancel');
}
if (options.autoClear !== true && options.ongoing) {
options.autoClear = false;
}
if (options.at === undefined || options.at === null) {
options.at = new Date();
}
for (var key in defaults) {
if (options[key] === null || options[key] === undefined) {
if (options.hasOwnProperty(key) && ['data','sound'].indexOf(key) > -1) {
options[key] = undefined;
} else {
options[key] = defaults[key];
}
}
}
for (key in options) {
if (!defaults.hasOwnProperty(key)) {
delete options[key];
console.warn('Unknown property: ' + key);
}
}
return options;
};
/**
* Convert the passed values to their required type.
*
* @param {Object} options
* Set of custom values
*
* @retrun {Object}
* The converted property list
*/
exports.convertProperties = function (options) {
if (options.id) {
if (isNaN(options.id)) {
options.id = this.getDefaults().id;
console.warn('Id is not a number: ' + options.id);
} else {
options.id = Number(options.id);
}
}
if (options.title) {
options.title = options.title.toString();
}
if (options.text) {
options.text = options.text.toString();
}
if (options.badge) {
if (isNaN(options.badge)) {
options.badge = this.getDefaults().badge;
console.warn('Badge number is not a number: ' + options.id);
} else {
options.badge = Number(options.badge);
}
}
if (options.at) {
if (typeof options.at == 'object') {
options.at = options.at.getTime();
}
options.at = Math.round(options.at/1000);
}
if (typeof options.data == 'object') {
options.data = JSON.stringify(options.data);
}
return options;
};
/**
* Create callback, which will be executed within a specific scope.
*
* @param {Function} callbackFn
* The callback function
* @param {Object} scope
* The scope for the function
*
* @return {Function}
* The new callback function
*/
exports.createCallbackFn = function (callbackFn, scope) {
if (typeof callbackFn != 'function')
return;
return function () {
callbackFn.apply(scope || this, arguments);
};
};
/**
* Convert the IDs to numbers.
*
* @param {String/Number[]} ids
*
* @return Array of Numbers
*/
exports.convertIds = function (ids) {
var convertedIds = [];
for (var i = 0; i < ids.length; i++) {
convertedIds.push(Number(ids[i]));
}
return convertedIds;
};
/**
* First found value for the given keys.
*
* @param {Object} options
* Object with key-value properties
* @param {String[]} keys*
* Key list
*/
exports.getValueFor = function (options) {
var keys = Array.apply(null, arguments).slice(1);
for (var i = 0; i < keys.length; i++) {
var key = keys[i];
if (options.hasOwnProperty(key)) {
return options[key];
}
}
};
/**
* Fire event with given arguments.
*
* @param {String} event
* The event's name
* @param {args*}
* The callback's arguments
*/
exports.fireEvent = function (event) {
var args = Array.apply(null, arguments).slice(1),
listener = this._listener[event];
if (!listener)
return;
for (var i = 0; i < listener.length; i++) {
var fn = listener[i][0],
scope = listener[i][1];
fn.apply(scope, args);
}
};
/**
* Execute the native counterpart.
*
* @param {String} action
* The name of the action
* @param args[]
* Array of arguments
* @param {Function} callback
* The callback function
* @param {Object} scope
* The scope for the function
*/
exports.exec = function (action, args, callback, scope) {
var fn = this.createCallbackFn(callback, scope),
params = [];
if (Array.isArray(args)) {
params = args;
} else if (args) {
params.push(args);
}
exec(fn, null, 'LocalNotification', action, params);
};
/*********
* HOOKS *
*********/
// Called after 'deviceready' event
channel.deviceready.subscribe(function () {
// Device is ready now, the listeners are registered
// and all queued events can be executed.
exec(null, null, 'LocalNotification', 'deviceready', []);
});
// Called before 'deviceready' event
channel.onCordovaReady.subscribe(function () {
// Device plugin is ready now
channel.onCordovaInfoReady.subscribe(function () {
// Merge platform specifics into defaults
exports.applyPlatformSpecificOptions();
});
});
});
/*
*
* 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.exports = {
id: 'ios',
bootstrap: function() {
require('cordova/channel').onNativeReady.fire();
}
};
// Platform: ios
// 2c29e187e4206a6a77fba940ef6f77aef5c7eb8c
// 49a8db57fa070d20ea7b304a53ffec3d7250c5af
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
......@@ -19,7 +19,7 @@
under the License.
*/
;(function() {
var PLATFORM_VERSION_BUILD_LABEL = '3.9.1';
var PLATFORM_VERSION_BUILD_LABEL = '3.9.2';
// file: src/scripts/require.js
/*jshint -W079 */
......@@ -101,7 +101,9 @@ if (typeof module === "object" && typeof require === "function") {
// file: src/cordova.js
define("cordova", function(require, exports, module) {
if(window.cordova){
// 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");
}
......@@ -815,7 +817,7 @@ module.exports = channel;
});
// file: /Users/steveng/repo/cordova/cordova-ios/cordova-js-src/exec.js
// file: e:/cordova/cordova-ios/cordova-js-src/exec.js
define("cordova/exec", function(require, exports, module) {
/**
......@@ -1286,10 +1288,12 @@ 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];
var platformInitChannelsArray = [channel.onDOMContentLoaded, channel.onNativeReady, channel.onPluginsReady];
// setting exec
cordova.exec = require('cordova/exec');
......@@ -1374,10 +1378,19 @@ if (window._nativeReady) {
// 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();
......@@ -1496,7 +1509,104 @@ exports.reset();
});
// file: /Users/steveng/repo/cordova/cordova-ios/cordova-js-src/platform.js
// 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);
// <runs/>
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: e:/cordova/cordova-ios/cordova-js-src/platform.js
define("cordova/platform", function(require, exports, module) {
module.exports = {
......@@ -1512,10 +1622,6 @@ module.exports = {
// file: src/common/pluginloader.js
define("cordova/pluginloader", function(require, exports, module) {
/*
NOTE: this file is NOT used when we use the browserify workflow
*/
var modulemapper = require('cordova/modulemapper');
var urlutil = require('cordova/urlutil');
......@@ -1625,6 +1731,54 @@ exports.load = function(callback) {
});
// file: src/common/pluginloader_b.js
define("cordova/pluginloader_b", function(require, exports, module) {
var modulemapper = require('cordova/modulemapper');
// Handler for the cordova_plugins.js content.
// See plugman's plugin_loader.js for the details of this object.
function handlePluginsObject(moduleList) {
// if moduleList is not defined or empty, we've nothing to do
if (!moduleList || !moduleList.length) {
return;
}
// Loop through all the modules and then through their clobbers and merges.
for (var i = 0, module; module = moduleList[i]; i++) {
if (module.clobbers && module.clobbers.length) {
for (var j = 0; j < module.clobbers.length; j++) {
modulemapper.clobbers(module.id, module.clobbers[j]);
}
}
if (module.merges && module.merges.length) {
for (var k = 0; k < module.merges.length; k++) {
modulemapper.merges(module.id, module.merges[k]);
}
}
// Finally, if runs is truthy we want to simply require() the module.
if (module.runs) {
modulemapper.runs(module.id);
}
}
}
// Loads all plugins' js-modules. Plugin loading is syncronous in browserified bundle
// but the method accepts callback to be compatible with non-browserify flow.
// onDeviceReady is blocked on onPluginsReady. onPluginsReady is fired when there are
// no plugins to load, or they are all done.
exports.load = function(callback) {
var moduleList = require("cordova/plugin_list");
handlePluginsObject(moduleList);
callback();
};
});
// file: src/common/urlutil.js
define("cordova/urlutil", function(require, exports, module) {
......
cordova.define('cordova/plugin_list', function(require, exports, module) {
module.exports = [
{
"file": "plugins/nl.x-services.plugins.toast/www/Toast.js",
"id": "nl.x-services.plugins.toast.Toast",
"file": "plugins/cordova-plugin-device/www/device.js",
"id": "cordova-plugin-device.device",
"pluginId": "cordova-plugin-device",
"clobbers": [
"device"
]
},
{
"file": "plugins/cordova-plugin-x-toast/www/Toast.js",
"id": "cordova-plugin-x-toast.Toast",
"pluginId": "cordova-plugin-x-toast",
"clobbers": [
"window.plugins.toast"
]
},
{
"file": "plugins/nl.x-services.plugins.toast/test/tests.js",
"id": "nl.x-services.plugins.toast.tests"
"file": "plugins/cordova-plugin-x-toast/test/tests.js",
"id": "cordova-plugin-x-toast.tests",
"pluginId": "cordova-plugin-x-toast"
},
{
"file": "plugins/de.appplant.cordova.plugin.local-notification/www/local-notification.js",
"id": "de.appplant.cordova.plugin.local-notification.LocalNotification",
"pluginId": "de.appplant.cordova.plugin.local-notification",
"clobbers": [
"cordova.plugins.notification.local",
"plugin.notification.local"
......@@ -22,6 +33,7 @@ module.exports = [
{
"file": "plugins/de.appplant.cordova.plugin.local-notification/www/local-notification-core.js",
"id": "de.appplant.cordova.plugin.local-notification.LocalNotification.Core",
"pluginId": "de.appplant.cordova.plugin.local-notification",
"clobbers": [
"cordova.plugins.notification.local.core",
"plugin.notification.local.core"
......@@ -30,27 +42,15 @@ module.exports = [
{
"file": "plugins/de.appplant.cordova.plugin.local-notification/www/local-notification-util.js",
"id": "de.appplant.cordova.plugin.local-notification.LocalNotification.Util",
"pluginId": "de.appplant.cordova.plugin.local-notification",
"merges": [
"cordova.plugins.notification.local.core",
"plugin.notification.local.core"
]
},
{
"file": "plugins/cordova-plugin-device/www/device.js",
"id": "cordova-plugin-device.device",
"clobbers": [
"device"
]
}
];
module.exports.metadata =
// TOP OF METADATA
{
"android.support.v4": "21.0.1",
"de.appplant.cordova.common.registerusernotificationsettings": "1.0.1",
"nl.x-services.plugins.toast": "2.0.4",
"de.appplant.cordova.plugin.local-notification": "0.8.2-dev",
"cordova-plugin-device": "1.0.1"
}
{}
// BOTTOM OF METADATA
});
\ No newline at end of file
cordova.define("cordova-plugin-x-toast.tests", function(require, exports, module) { exports.defineAutoTests = function() {
var fail = function (done) {
expect(true).toBe(false);
done();
},
succeed = function (done) {
expect(true).toBe(true);
done();
};
describe('Plugin availability', function () {
it("window.plugins.toast should exist", function() {
expect(window.plugins.toast).toBeDefined();
});
});
describe('API functions', function () {
it("should define show", function() {
expect(window.plugins.toast.show).toBeDefined();
});
it("should define showWithOptions", function() {
expect(window.plugins.toast.showWithOptions).toBeDefined();
});
it("should define optionsBuilder", function() {
expect(window.plugins.toast.optionsBuilder).toBeDefined();
});
it("should define showShortTop", function() {
expect(window.plugins.toast.showShortTop).toBeDefined();
});
it("should define showShortCenter", function() {
expect(window.plugins.toast.showShortCenter).toBeDefined();
});
it("should define showShortBottom", function() {
expect(window.plugins.toast.showShortBottom).toBeDefined();
});
it("should define showLongTop", function() {
expect(window.plugins.toast.showLongTop).toBeDefined();
});
it("should define showLongCenter", function() {
expect(window.plugins.toast.showLongCenter).toBeDefined();
});
it("should define showLongBottom", function() {
expect(window.plugins.toast.showLongBottom).toBeDefined();
});
});
describe('Invalid usage', function () {
it("should fail due to an invalid position", function(done) {
window.plugins.toast.show('hi', 'short', 'nowhere', fail.bind(null, done), succeed.bind(null, done));
});
});
};
});
cordova.define("cordova-plugin-x-toast.Toast", function(require, exports, module) { function Toast() {
}
Toast.prototype.optionsBuilder = function () {
// defaults
var message = null;
var duration = "short";
var position = "center";
var addPixelsY = 0;
return {
withMessage: function(m) {
message = m;
return this;
},
withDuration: function(d) {
duration = d;
return this;
},
withPosition: function(p) {
position = p;
return this;
},
withAddPixelsY: function(y) {
addPixelsY = y;
return this;
},
build: function() {
return {
message: message,
duration: duration,
position: position,
addPixelsY: addPixelsY
}
}
}
};
Toast.prototype.showWithOptions = function (options, successCallback, errorCallback) {
cordova.exec(successCallback, errorCallback, "Toast", "show", [options]);
};
Toast.prototype.show = function (message, duration, position, successCallback, errorCallback) {
this.showWithOptions(
this.optionsBuilder()
.withMessage(message)
.withDuration(duration)
.withPosition(position)
.build(),
successCallback,
errorCallback);
};
Toast.prototype.showShortTop = function (message, successCallback, errorCallback) {
this.show(message, "short", "top", successCallback, errorCallback);
};
Toast.prototype.showShortCenter = function (message, successCallback, errorCallback) {
this.show(message, "short", "center", successCallback, errorCallback);
};
Toast.prototype.showShortBottom = function (message, successCallback, errorCallback) {
this.show(message, "short", "bottom", successCallback, errorCallback);
};
Toast.prototype.showLongTop = function (message, successCallback, errorCallback) {
this.show(message, "long", "top", successCallback, errorCallback);
};
Toast.prototype.showLongCenter = function (message, successCallback, errorCallback) {
this.show(message, "long", "center", successCallback, errorCallback);
};
Toast.prototype.showLongBottom = function (message, successCallback, errorCallback) {
this.show(message, "long", "bottom", successCallback, errorCallback);
};
Toast.prototype.hide = function (successCallback, errorCallback) {
cordova.exec(successCallback, errorCallback, "Toast", "hide", []);
};
Toast.install = function () {
if (!window.plugins) {
window.plugins = {};
}
window.plugins.toast = new Toast();
return window.plugins.toast;
};
cordova.addConstructor(Toast.install);
});
{
"ios": "3.9.1"
"ios": "3.9.2"
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<!--
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.
-->
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<?xml version='1.0' encoding='utf-8'?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<OutputPath>build\phone\$(Configuration)\$(Platform)\</OutputPath>
<IntermediateOutputPath>build\phone\bld\</IntermediateOutputPath>
......@@ -59,7 +41,7 @@
<PropertyGroup Label="Globals">
<ProjectGuid>31b67a35-9503-4213-857e-f44eb42ae549</ProjectGuid>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<Import Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" />
<PropertyGroup Condition="'$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '12.0'">
<VisualStudioVersion>12.0</VisualStudioVersion>
</PropertyGroup>
......@@ -78,22 +60,11 @@
<AppxManifest Include="package.phone.appxmanifest">
<SubType>Designer</SubType>
</AppxManifest>
<Content Include="images\*.png" Exclude="images\*.scale-180.*" />
<Content Exclude="images\*.scale-180.*" Include="images\*.png" />
</ItemGroup>
<ItemGroup>
<SDKReference Include="Microsoft.Phone.WinJS.2.1, Version=1.0" />
</ItemGroup>
<Import Project="CordovaApp.projitems" Label="Shared" />
<Import Label="Shared" Project="CordovaApp.projitems" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\$(WMSJSProjectDirectory)\Microsoft.VisualStudio.$(WMSJSProject).targets" />
<!-- To modify your build process, add your task inside one of the targets below then uncomment
that target and the DisableFastUpToDateCheck PropertyGroup.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
<PropertyGroup>
<DisableFastUpToDateCheck>true</DisableFastUpToDateCheck>
</PropertyGroup>
-->
</Project>
<?xml version="1.0" encoding="utf-8"?>
<!--
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.
-->
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<?xml version='1.0' encoding='utf-8'?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<OutputPath>build\windows\$(Configuration)\$(Platform)\</OutputPath>
<IntermediateOutputPath>build\windows\bld\</IntermediateOutputPath>
......@@ -59,7 +41,7 @@
<PropertyGroup Label="Globals">
<ProjectGuid>58950fb6-2f93-4963-b9cd-637f83f3efbf</ProjectGuid>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<Import Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" />
<PropertyGroup Condition="'$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '12.0'">
<VisualStudioVersion>12.0</VisualStudioVersion>
</PropertyGroup>
......@@ -77,23 +59,12 @@
<AppxManifest Include="package.windows.appxmanifest">
<SubType>Designer</SubType>
</AppxManifest>
<Content Include="images\*.png" Exclude="images\*.scale-240.*" />
<Content Exclude="images\*.scale-240.*" Include="images\*.png" />
<None Include="CordovaApp_TemporaryKey.pfx" />
</ItemGroup>
<ItemGroup>
<SDKReference Include="Microsoft.WinJS.2.0, Version=1.0" />
</ItemGroup>
<Import Project="CordovaApp.projitems" Label="Shared" />
<Import Label="Shared" Project="CordovaApp.projitems" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\$(WMSJSProjectDirectory)\Microsoft.VisualStudio.$(WMSJSProject).targets" />
<!-- To modify your build process, add your task inside one of the targets below then uncomment
that target and the DisableFastUpToDateCheck PropertyGroup.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
<PropertyGroup>
<DisableFastUpToDateCheck>true</DisableFastUpToDateCheck>
</PropertyGroup>
-->
</Project>
<?xml version="1.0" encoding="utf-8"?>
<!--
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.
-->
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<?xml version='1.0' encoding='utf-8'?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<OutputPath>build\windows80\$(Configuration)\$(Platform)\</OutputPath>
<IntermediateOutputPath>build\windows80\bld\</IntermediateOutputPath>
......@@ -62,7 +44,7 @@
<PropertyGroup Condition="'$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '11.0'">
<VisualStudioVersion>11.0</VisualStudioVersion>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<Import Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\$(WMSJSProjectDirectory)\Microsoft.VisualStudio.$(WMSJSProject).Default.props" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\$(WMSJSProjectDirectory)\Microsoft.VisualStudio.$(WMSJSProject).props" />
<PropertyGroup>
......@@ -75,13 +57,13 @@
<AppxManifest Include="package.windows80.appxmanifest">
<SubType>Designer</SubType>
</AppxManifest>
<Content Include="images\*.png" Exclude="images\*.scale-240.*" />
<Content Exclude="images\*.scale-240.*" Include="images\*.png" />
<None Include="CordovaApp_TemporaryKey.pfx" />
</ItemGroup>
<ItemGroup>
<SDKReference Include="Microsoft.WinJS.1.0, Version=1.0" />
</ItemGroup>
<Import Project="CordovaApp.projitems" Label="Shared" />
<Import Label="Shared" Project="CordovaApp.projitems" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\$(WMSJSProjectDirectory)\Microsoft.VisualStudio.$(WMSJSProject).targets" />
<PropertyGroup>
<BuildFromCordovaTooling>false</BuildFromCordovaTooling>
......
<?xml version="1.0" encoding="utf-8"?>
<!--
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.
-->
<?xml version='1.0' encoding='utf-8'?>
<Package xmlns="http://schemas.microsoft.com/appx/2010/manifest" xmlns:m2="http://schemas.microsoft.com/appx/2013/manifest" xmlns:m3="http://schemas.microsoft.com/appx/2014/manifest" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest">
<Identity Name="1482d0c0-f943-11e4-ad39-81ab0f14e62c" Version="1.0.0.0" Publisher="CN=$username$" />
<Identity Name="de.appplant.localnotification.example" Publisher="CN=$username$" Version="0.0.1.0" />
<mp:PhoneIdentity PhoneProductId="1482d0c0-f943-11e4-ad39-81ab0f14e62c" PhonePublisherId="db093ed5-53b1-45f7-af72-751e8f36ab80" />
<Properties>
<DisplayName>NotificationExample</DisplayName>
<PublisherDisplayName>$username$</PublisherDisplayName>
<PublisherDisplayName>Apache Cordova Team</PublisherDisplayName>
<Logo>images\StoreLogo.png</Logo>
</Properties>
<Prerequisites>
......@@ -34,14 +16,8 @@
</Resources>
<Applications>
<Application Id="de.appplant.localnotification.example" StartPage="www/index.html">
<m3:VisualElements ToastCapable="true" DisplayName="NotificationExample"
Square150x150Logo="images\Square150x150Logo.png"
Square44x44Logo="images\Square44x44Logo.png"
Description="CordovaApp"
ForegroundText="light"
BackgroundColor="transparent">
<m3:DefaultTile Wide310x150Logo="images\Wide310x150Logo.png"
Square71x71Logo="images\Square71x71Logo.png">
<m3:VisualElements BackgroundColor="transparent" Description="CordovaApp" DisplayName="NotificationExample" ForegroundText="light" Square150x150Logo="images\Square150x150Logo.png" Square44x44Logo="images\Square44x44Logo.png" ToastCapable="true">
<m3:DefaultTile Square71x71Logo="images\Square71x71Logo.png" Wide310x150Logo="images\Wide310x150Logo.png">
<m3:ShowNameOnTiles>
<m3:ShowOn Tile="square150x150Logo" />
<m3:ShowOn Tile="wide310x150Logo" />
......
<?xml version="1.0" encoding="utf-8"?>
<!--
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.
-->
<?xml version='1.0' encoding='utf-8'?>
<Package xmlns="http://schemas.microsoft.com/appx/2010/manifest" xmlns:m2="http://schemas.microsoft.com/appx/2013/manifest">
<Identity Name="1482d0c0-f943-11e4-ad39-81ab0f14e62c" Version="1.0.0.0" Publisher="CN=$username$" />
<Identity Name="de.appplant.localnotification.example" Publisher="CN=$username$" Version="0.0.1.0" />
<Properties>
<DisplayName>NotificationExample</DisplayName>
<PublisherDisplayName>$username$</PublisherDisplayName>
<PublisherDisplayName>Apache Cordova Team</PublisherDisplayName>
<Logo>images\StoreLogo.png</Logo>
</Properties>
<Prerequisites>
......@@ -33,15 +15,8 @@
</Resources>
<Applications>
<Application Id="de.appplant.localnotification.example" StartPage="www/index.html">
<m2:VisualElements ToastCapable="true" DisplayName="NotificationExample"
Description="CordovaApp"
ForegroundText="light"
BackgroundColor="#464646"
Square150x150Logo="images\Square150x150Logo.png"
Square30x30Logo="images\Square30x30Logo.png">
<m2:DefaultTile Square70x70Logo="images\Square70x70Logo.png"
Square310x310Logo="images\Square310x310Logo.png"
Wide310x150Logo="images\Wide310x150Logo.png">
<m2:VisualElements BackgroundColor="#464646" Description="CordovaApp" DisplayName="NotificationExample" ForegroundText="light" Square150x150Logo="images\Square150x150Logo.png" Square30x30Logo="images\Square30x30Logo.png" ToastCapable="true">
<m2:DefaultTile Square310x310Logo="images\Square310x310Logo.png" Square70x70Logo="images\Square70x70Logo.png" Wide310x150Logo="images\Wide310x150Logo.png">
<m2:ShowNameOnTiles>
<m2:ShowOn Tile="square150x150Logo" />
<m2:ShowOn Tile="wide310x150Logo" />
......
<?xml version="1.0" encoding="utf-8"?>
<!--
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.
-->
<?xml version='1.0' encoding='utf-8'?>
<Package xmlns="http://schemas.microsoft.com/appx/2010/manifest">
<Identity Name="1482d0c0-f943-11e4-ad39-81ab0f14e62c" Version="1.0.0.0" Publisher="CN=$username$" />
<Identity Name="de.appplant.localnotification.example" Publisher="CN=$username$" Version="0.0.1.0" />
<Properties>
<DisplayName>NotificationExample</DisplayName>
<PublisherDisplayName>$username$</PublisherDisplayName>
<PublisherDisplayName>Apache Cordova Team</PublisherDisplayName>
<Logo>images\storelogo.png</Logo>
</Properties>
<Prerequisites>
......@@ -33,13 +15,8 @@
</Resources>
<Applications>
<Application Id="de.appplant.localnotification.example" StartPage="www/index.html">
<VisualElements ToastCapable="true" DisplayName="NotificationExample"
Logo="images\Square150x150Logo.png"
SmallLogo="images\Square30x30Logo.png"
Description="CordovaApp"
ForegroundText="light"
BackgroundColor="#464646">
<DefaultTile ShowName="allLogos" WideLogo="images\Wide310x150Logo.png"/>
<VisualElements BackgroundColor="#464646" Description="CordovaApp" DisplayName="NotificationExample" ForegroundText="light" Logo="images\Square150x150Logo.png" SmallLogo="images\Square30x30Logo.png" ToastCapable="true">
<DefaultTile ShowName="allLogos" WideLogo="images\Wide310x150Logo.png" />
<SplashScreen Image="images\splashscreen.png" />
</VisualElements>
</Application>
......
cordova.define('cordova/plugin_list', function(require, exports, module) {
module.exports = [
{
"file": "plugins/cordova-plugin-x-toast/www/Toast.js",
"id": "cordova-plugin-x-toast.Toast",
"pluginId": "cordova-plugin-x-toast",
"clobbers": [
"window.plugins.toast"
]
},
{
"file": "plugins/cordova-plugin-x-toast/test/tests.js",
"id": "cordova-plugin-x-toast.tests",
"pluginId": "cordova-plugin-x-toast"
},
{
"file": "plugins/cordova-plugin-device/www/device.js",
"id": "cordova-plugin-device.device",
"pluginId": "cordova-plugin-device",
"clobbers": [
"device"
]
},
{
"file": "plugins/cordova-plugin-device/src/windows/DeviceProxy.js",
"id": "cordova-plugin-device.DeviceProxy",
"pluginId": "cordova-plugin-device",
"merges": [
""
]
},
{
"file": "plugins/de.appplant.cordova.plugin.local-notification/www/local-notification.js",
"id": "de.appplant.cordova.plugin.local-notification.LocalNotification",
"pluginId": "de.appplant.cordova.plugin.local-notification",
"clobbers": [
"cordova.plugins.notification.local",
"plugin.notification.local"
]
},
{
"file": "plugins/de.appplant.cordova.plugin.local-notification/www/local-notification-core.js",
"id": "de.appplant.cordova.plugin.local-notification.LocalNotification.Core",
"pluginId": "de.appplant.cordova.plugin.local-notification",
"clobbers": [
"cordova.plugins.notification.local.core",
"plugin.notification.local.core"
]
},
{
"file": "plugins/de.appplant.cordova.plugin.local-notification/www/local-notification-util.js",
"id": "de.appplant.cordova.plugin.local-notification.LocalNotification.Util",
"pluginId": "de.appplant.cordova.plugin.local-notification",
"merges": [
"cordova.plugins.notification.local.core",
"plugin.notification.local.core"
]
},
{
"file": "plugins/de.appplant.cordova.plugin.local-notification/src/windows/LocalNotificationProxy.js",
"id": "de.appplant.cordova.plugin.local-notification.LocalNotification.Proxy",
"pluginId": "de.appplant.cordova.plugin.local-notification",
"merges": [
""
]
},
{
"file": "plugins/de.appplant.cordova.plugin.local-notification/src/windows/LocalNotificationCore.js",
"id": "de.appplant.cordova.plugin.local-notification.LocalNotification.Proxy.Core",
"pluginId": "de.appplant.cordova.plugin.local-notification",
"merges": [
""
]
},
{
"file": "plugins/de.appplant.cordova.plugin.local-notification/src/windows/LocalNotificationUtil.js",
"id": "de.appplant.cordova.plugin.local-notification.LocalNotification.Proxy.Util",
"pluginId": "de.appplant.cordova.plugin.local-notification",
"merges": [
""
]
}
];
module.exports.metadata =
// TOP OF METADATA
{}
// BOTTOM OF METADATA
});
\ No newline at end of file
cordova.define("cordova-plugin-device.DeviceProxy", 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 ROOT_CONTAINER = "{00000000-0000-0000-FFFF-FFFFFFFFFFFF}";
var DEVICE_CLASS_KEY = "{A45C254E-DF1C-4EFD-8020-67D146A850E0},10";
var DEVICE_CLASS_KEY_NO_SEMICOLON = '{A45C254E-DF1C-4EFD-8020-67D146A850E0}10';
var ROOT_CONTAINER_QUERY = "System.Devices.ContainerId:=\"" + ROOT_CONTAINER + "\"";
var HAL_DEVICE_CLASS = "4d36e966-e325-11ce-bfc1-08002be10318";
var DEVICE_DRIVER_VERSION_KEY = "{A8B865DD-2E3D-4094-AD97-E593A70C75D6},3";
var MANU_KEY = "System.Devices.Manufacturer";
module.exports = {
getDeviceInfo:function(win, fail, args) {
// deviceId aka uuid, stored in Windows.Storage.ApplicationData.current.localSettings.values.deviceId
var deviceId;
var manufacturer = "unknown";
// get deviceId, or create and store one
var localSettings = Windows.Storage.ApplicationData.current.localSettings;
if (localSettings.values.deviceId) {
deviceId = localSettings.values.deviceId;
}
else {
// App-specific hardware id could be used as uuid, but it changes if the hardware changes...
try {
var ASHWID = Windows.System.Profile.HardwareIdentification.getPackageSpecificToken(null).id;
deviceId = Windows.Storage.Streams.DataReader.fromBuffer(ASHWID).readGuid();
} catch (e) {
// Couldn't get the hardware UUID
deviceId = createUUID();
}
//...so cache it per-install
localSettings.values.deviceId = deviceId;
}
var userAgent = window.clientInformation.userAgent;
// this will report "windows" in windows8.1 and windows phone 8.1 apps
// and "windows8" in windows 8.0 apps similar to cordova.js
// See https://github.com/apache/cordova-js/blob/master/src/windows/platform.js#L25
var devicePlatform = userAgent.indexOf("MSAppHost/1.0") == -1 ? "windows" : "windows8";
var versionString = userAgent.match(/Windows (?:Phone |NT )?([0-9.]+)/)[1];
var Pnp = Windows.Devices.Enumeration.Pnp;
Pnp.PnpObject.findAllAsync(Pnp.PnpObjectType.deviceContainer,[MANU_KEY])
.then(function (infoList) {
var numDevices = infoList.length;
if (numDevices) {
for (var i = 0; i < numDevices; i++) {
var devContainer = infoList[i];
if (devContainer.id == ROOT_CONTAINER) {
manufacturer = devContainer.properties[MANU_KEY];
break;
}
}
}
})
.then(function () {
Pnp.PnpObject.findAllAsync(Pnp.PnpObjectType.device,
[DEVICE_DRIVER_VERSION_KEY, DEVICE_CLASS_KEY],
ROOT_CONTAINER_QUERY)
.then(function (rootDevices) {
for (var i = 0; i < rootDevices.length; i++) {
var rootDevice = rootDevices[i];
if (!rootDevice.properties) continue;
if (rootDevice.properties[DEVICE_CLASS_KEY_NO_SEMICOLON] == HAL_DEVICE_CLASS) {
versionString = rootDevice.properties[DEVICE_DRIVER_VERSION_KEY];
break;
}
}
setTimeout(function () {
win({ platform: devicePlatform,
version: versionString,
uuid: deviceId,
model: window.clientInformation.platform,
manufacturer:manufacturer});
}, 0);
});
});
}
}; // exports
require("cordova/exec/proxy").add("Device", module.exports);
});
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;
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.manufacturer = info.manufacturer || '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();
});
cordova.define("cordova-plugin-x-toast.tests", function(require, exports, module) { exports.defineAutoTests = function() {
var fail = function (done) {
expect(true).toBe(false);
done();
},
succeed = function (done) {
expect(true).toBe(true);
done();
};
describe('Plugin availability', function () {
it("window.plugins.toast should exist", function() {
expect(window.plugins.toast).toBeDefined();
});
});
describe('API functions', function () {
it("should define show", function() {
expect(window.plugins.toast.show).toBeDefined();
});
it("should define showWithOptions", function() {
expect(window.plugins.toast.showWithOptions).toBeDefined();
});
it("should define optionsBuilder", function() {
expect(window.plugins.toast.optionsBuilder).toBeDefined();
});
it("should define showShortTop", function() {
expect(window.plugins.toast.showShortTop).toBeDefined();
});
it("should define showShortCenter", function() {
expect(window.plugins.toast.showShortCenter).toBeDefined();
});
it("should define showShortBottom", function() {
expect(window.plugins.toast.showShortBottom).toBeDefined();
});
it("should define showLongTop", function() {
expect(window.plugins.toast.showLongTop).toBeDefined();
});
it("should define showLongCenter", function() {
expect(window.plugins.toast.showLongCenter).toBeDefined();
});
it("should define showLongBottom", function() {
expect(window.plugins.toast.showLongBottom).toBeDefined();
});
});
describe('Invalid usage', function () {
it("should fail due to an invalid position", function(done) {
window.plugins.toast.show('hi', 'short', 'nowhere', fail.bind(null, done), succeed.bind(null, done));
});
});
};
});
cordova.define("cordova-plugin-x-toast.Toast", function(require, exports, module) { function Toast() {
}
Toast.prototype.optionsBuilder = function () {
// defaults
var message = null;
var duration = "short";
var position = "center";
var addPixelsY = 0;
return {
withMessage: function(m) {
message = m;
return this;
},
withDuration: function(d) {
duration = d;
return this;
},
withPosition: function(p) {
position = p;
return this;
},
withAddPixelsY: function(y) {
addPixelsY = y;
return this;
},
build: function() {
return {
message: message,
duration: duration,
position: position,
addPixelsY: addPixelsY
}
}
}
};
Toast.prototype.showWithOptions = function (options, successCallback, errorCallback) {
cordova.exec(successCallback, errorCallback, "Toast", "show", [options]);
};
Toast.prototype.show = function (message, duration, position, successCallback, errorCallback) {
this.showWithOptions(
this.optionsBuilder()
.withMessage(message)
.withDuration(duration)
.withPosition(position)
.build(),
successCallback,
errorCallback);
};
Toast.prototype.showShortTop = function (message, successCallback, errorCallback) {
this.show(message, "short", "top", successCallback, errorCallback);
};
Toast.prototype.showShortCenter = function (message, successCallback, errorCallback) {
this.show(message, "short", "center", successCallback, errorCallback);
};
Toast.prototype.showShortBottom = function (message, successCallback, errorCallback) {
this.show(message, "short", "bottom", successCallback, errorCallback);
};
Toast.prototype.showLongTop = function (message, successCallback, errorCallback) {
this.show(message, "long", "top", successCallback, errorCallback);
};
Toast.prototype.showLongCenter = function (message, successCallback, errorCallback) {
this.show(message, "long", "center", successCallback, errorCallback);
};
Toast.prototype.showLongBottom = function (message, successCallback, errorCallback) {
this.show(message, "long", "bottom", successCallback, errorCallback);
};
Toast.prototype.hide = function (successCallback, errorCallback) {
cordova.exec(successCallback, errorCallback, "Toast", "hide", []);
};
Toast.install = function () {
if (!window.plugins) {
window.plugins = {};
}
window.plugins.toast = new Toast();
return window.plugins.toast;
};
cordova.addConstructor(Toast.install);
});
cordova.define("de.appplant.cordova.plugin.local-notification.LocalNotification.Proxy", function(require, exports, module) { /*
Copyright 2013-2015 appPlant UG
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.
*/
/**
* Executes all queued events.
*/
exports.deviceready = function () {
exports.core.deviceready();
};
/**
* Schedule a new local notification.
*
* @param {Function} success
* Success callback
* @param {Function} error
* Error callback
* @param {Object[]} notifications
* Array of local notifications
*/
exports.schedule = function (success, error, notifications) {
exports.core.schedule(notifications, 'schedule');
success();
};
/**
* Update existing notifications specified by IDs in options.
*
* @param {Function} success
* Success callback
* @param {Function} error
* Error callback
* @param {Object[]} notifications
* Array of local notifications
*/
exports.update = function (success, error, notifications) {
exports.core.update(notifications);
success();
};
/**
* Clear the specified notification.
*
* @param {Function} success
* Success callback
* @param {Function} error
* Error callback
* @param {int[]} ids
* List of local notification IDs
*/
exports.clear = function (success, error, ids) {
exports.core.clear(ids, true);
success();
};
/**
* Clear all previously sheduled notifications.
*
* @param {Function} success
* Success callback
* @param {Function} error
* Error callback
*/
exports.clearAll = function (success, error) {
exports.core.clearAll();
success();
};
/**
* Cancel the specified notifications.
*
* @param {Function} success
* Success callback
* @param {Function} error
* Error callback
* @param {int[]} ids
* List of local notification IDs
*/
exports.cancel = function (success, error, ids) {
exports.core.cancel(ids, true);
success();
};
/**
* Remove all previously registered notifications.
*
* @param {Function} success
* Success callback
* @param {Function} error
* Error callback
*/
exports.cancelAll = function (success, error) {
exports.core.cancelAll();
success();
};
/**
* Check if a notification with an ID is present.
*
* @param {Function} success
* Success callback
* @param {Function} error
* Error callback
* @param {int} id
* Local notification ID
*/
exports.isPresent = function (success, error, args) {
var found = exports.core.isPresent(args[0]);
success(found);
};
/**
* Check if a notification with an ID is scheduled.
*
* @param {Function} success
* Success callback
* @param {Function} error
* Error callback
* @param {int} id
* Local notification ID
*/
exports.isScheduled = function (success, error, args) {
var found = exports.core.isScheduled(args[0]);
success(found);
};
/**
* Check if a notification with an ID was triggered.
*
* @param {Function} success
* Success callback
* @param {Function} error
* Error callback
* @param {int} id
* Local notification ID
*/
exports.isTriggered = function (success, error, args) {
var found = exports.core.isTriggered(args[0]);
success(found);
};
/**
* List all local notification IDs.
*
* @param {Function} success
* Success callback
* @param {Function} error
* Error callback
*/
exports.getAllIds = function (success, error) {
var ids = exports.core.getAllIds();
success(ids);
};
/**
* List all scheduled notification IDs.
*
* @param {Function} success
* Success callback
* @param {Function} error
* Error callback
*/
exports.getScheduledIds = function (success, error) {
var ids = exports.core.getScheduledIds();
success(ids);
};
/**
* List all triggered notification IDs.
*
* @param {Function} success
* Success callback
* @param {Function} error
* Error callback
*/
exports.getTriggeredIds = function (success, error) {
var ids = exports.core.getTriggeredIds();
success(ids);
};
/**
* Propertys for given notification.
*
* @param {Function} success
* Success callback
* @param {Function} error
* Error callback
* @param {int[]} ids
* List of local notification IDs
*/
exports.getSingle = function (success, error, ids) {
var notification = exports.core.getAll(ids)[0];
success(notification);
};
/**
* Propertys for given scheduled notification.
*
* @param {Function} success
* Success callback
* @param {Function} error
* Error callback
* @param {int[]} ids
* List of local notification IDs
*/
exports.getSingleScheduled = function (success, error, ids) {
var notification = exports.core.getScheduled(ids)[0];
success(notification);
};
/**
* Propertys for given triggered notification.
*
* @param {Function} success
* Success callback
* @param {Function} error
* Error callback
* @param {int[]} ids
* List of local notification IDs
*/
exports.getSingleTriggered = function (success, error, ids) {
var notification = exports.core.getTriggered(ids)[0];
success(notification);
};
/**
* Property list for given notifications.
* If called without IDs, all notification will be returned.
*
* @param {Function} success
* Success callback
* @param {Function} error
* Error callback
* @param {int[]} ids
* List of local notification IDs
*/
exports.getAll = function (success, error, ids) {
var notifications = exports.core.getAll(ids);
success(notifications);
};
/**
* Property list for given triggered notifications.
* If called without IDs, all notification will be returned.
*
* @param {Function} success
* Success callback
* @param {Function} error
* Error callback
* @param {int[]} ids
* List of local notification IDs
*/
exports.getScheduled = function (success, error, ids) {
var notifications = exports.core.getScheduled(ids);
success(notifications);
};
/**
* Property list for given triggered notifications.
* If called without IDs, all notification will be returned.
*
* @param {Function} success
* Success callback
* @param {Function} error
* Error callback
* @param {int[]} ids
* List of local notification IDs
*/
exports.getTriggered = function (success, error, ids) {
var notifications = exports.core.getTriggered(ids);
success(notifications);
};
cordova.commandProxy.add('LocalNotification', exports);
});
cordova.define("de.appplant.cordova.plugin.local-notification.LocalNotification.Util", function(require, exports, module) { /*
* Copyright (c) 2013-2015 by appPlant UG. All rights reserved.
*
* @APPPLANT_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apache License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. Please obtain a copy of the License at
* http://opensource.org/licenses/Apache-2.0/ and read it before using this
* file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPPLANT_LICENSE_HEADER_END@
*/
var exec = require('cordova/exec'),
channel = require('cordova/channel');
/***********
* MEMBERS *
***********/
// Default values
exports._defaults = {
text: '',
title: '',
sound: 'res://platform_default',
badge: 0,
id: 0,
data: undefined,
every: undefined,
at: undefined
};
// listener
exports._listener = {};
/********
* UTIL *
********/
/**
* Merge platform specific properties into the default ones.
*
* @return {Object}
* The default properties for the platform
*/
exports.applyPlatformSpecificOptions = function () {
var defaults = this._defaults;
switch (device.platform) {
case 'Android':
defaults.icon = 'res://icon';
defaults.smallIcon = 'res://ic_popup_reminder';
defaults.ongoing = false;
defaults.autoClear = true;
defaults.led = 'FFFFFF';
break;
}
return defaults;
};
/**
* Merge custom properties with the default values.
*
* @param {Object} options
* Set of custom values
*
* @retrun {Object}
* The merged property list
*/
exports.mergeWithDefaults = function (options) {
var defaults = this.getDefaults();
options.at = this.getValueFor(options, 'at', 'firstAt', 'date');
options.text = this.getValueFor(options, 'text', 'message');
options.data = this.getValueFor(options, 'data', 'json');
if (defaults.hasOwnProperty('autoClear')) {
options.autoClear = this.getValueFor(options, 'autoClear', 'autoCancel');
}
if (options.autoClear !== true && options.ongoing) {
options.autoClear = false;
}
if (options.at === undefined || options.at === null) {
options.at = new Date();
}
for (var key in defaults) {
if (options[key] === null || options[key] === undefined) {
if (options.hasOwnProperty(key) && ['data','sound'].indexOf(key) > -1) {
options[key] = undefined;
} else {
options[key] = defaults[key];
}
}
}
for (key in options) {
if (!defaults.hasOwnProperty(key)) {
delete options[key];
console.warn('Unknown property: ' + key);
}
}
return options;
};
/**
* Convert the passed values to their required type.
*
* @param {Object} options
* Set of custom values
*
* @retrun {Object}
* The converted property list
*/
exports.convertProperties = function (options) {
if (options.id) {
if (isNaN(options.id)) {
options.id = this.getDefaults().id;
console.warn('Id is not a number: ' + options.id);
} else {
options.id = Number(options.id);
}
}
if (options.title) {
options.title = options.title.toString();
}
if (options.text) {
options.text = options.text.toString();
}
if (options.badge) {
if (isNaN(options.badge)) {
options.badge = this.getDefaults().badge;
console.warn('Badge number is not a number: ' + options.id);
} else {
options.badge = Number(options.badge);
}
}
if (options.at) {
if (typeof options.at == 'object') {
options.at = options.at.getTime();
}
options.at = Math.round(options.at/1000);
}
if (typeof options.data == 'object') {
options.data = JSON.stringify(options.data);
}
return options;
};
/**
* Create callback, which will be executed within a specific scope.
*
* @param {Function} callbackFn
* The callback function
* @param {Object} scope
* The scope for the function
*
* @return {Function}
* The new callback function
*/
exports.createCallbackFn = function (callbackFn, scope) {
if (typeof callbackFn != 'function')
return;
return function () {
callbackFn.apply(scope || this, arguments);
};
};
/**
* Convert the IDs to numbers.
*
* @param {String/Number[]} ids
*
* @return Array of Numbers
*/
exports.convertIds = function (ids) {
var convertedIds = [];
for (var i = 0; i < ids.length; i++) {
convertedIds.push(Number(ids[i]));
}
return convertedIds;
};
/**
* First found value for the given keys.
*
* @param {Object} options
* Object with key-value properties
* @param {String[]} keys*
* Key list
*/
exports.getValueFor = function (options) {
var keys = Array.apply(null, arguments).slice(1);
for (var i = 0; i < keys.length; i++) {
var key = keys[i];
if (options.hasOwnProperty(key)) {
return options[key];
}
}
};
/**
* Fire event with given arguments.
*
* @param {String} event
* The event's name
* @param {args*}
* The callback's arguments
*/
exports.fireEvent = function (event) {
var args = Array.apply(null, arguments).slice(1),
listener = this._listener[event];
if (!listener)
return;
for (var i = 0; i < listener.length; i++) {
var fn = listener[i][0],
scope = listener[i][1];
fn.apply(scope, args);
}
};
/**
* Execute the native counterpart.
*
* @param {String} action
* The name of the action
* @param args[]
* Array of arguments
* @param {Function} callback
* The callback function
* @param {Object} scope
* The scope for the function
*/
exports.exec = function (action, args, callback, scope) {
var fn = this.createCallbackFn(callback, scope),
params = [];
if (Array.isArray(args)) {
params = args;
} else if (args) {
params.push(args);
}
exec(fn, null, 'LocalNotification', action, params);
};
/*********
* HOOKS *
*********/
// Called after 'deviceready' event
channel.deviceready.subscribe(function () {
// Device is ready now, the listeners are registered
// and all queued events can be executed.
exec(null, null, 'LocalNotification', 'deviceready', []);
});
// Called before 'deviceready' event
channel.onCordovaReady.subscribe(function () {
// Device plugin is ready now
channel.onCordovaInfoReady.subscribe(function () {
// Merge platform specifics into defaults
exports.applyPlatformSpecificOptions();
});
});
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment