Permalink
Browse files

Dev next (#1284)

* added method to src,mocks, and respective tests (#1218)

* update localNotification.ctrl.js (#1213)

i think, to be able to calculate "_60_seconds_from_now", the "now" value has to be a number, so I added the "getTime()" method

* $cordovaAppRate sets callbacks correctly (onButtonClicked, onRateDialogShow) (#1209)

* Wrapper for 3d touch plugin (#1155)

* Add wrapper for 3d plugin

* Fixed JSHint warnings for undefined variable

* added iosOptions to $cordovaSpinnerDialog.show() (#1224)

* added iosOptions to $cordovaSpinnerDialog.show()

* added missing comma

* added additional test for options in spinnerDialog.show() method

* Updated appVersion mocks and added tests (#1231)

* Issue #1228 - google analytics (#1247)

* Add key param check

* Tests fix

* Tests fix

* Added shareWithOptions, which was introduced in 5.1.0 (#1263)

See
https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin#using-the-share-sheet
for usage details

* added tts plugin wrapper (#1265)

* added tts plugin wrapper

* commit only tts.js

* only commit plugin

* Add serial plugin wrapper (#1274)

* Add cordovaSerial plugin wrapper and unit tests

* Update README with serial plugin

* Add serial to jshint globals

* added recents control plugin wrapper (#1264)

* added recents control plugin

* built added recents control plugin

* added plugin to plugin list

* added tts plugin wrapper

* commit only tts.js

* only commit plugin

* only commit recents plugin

* remove tts plugin

* added plugin to list

* added coma :|
1 parent e4d716e commit 6914f8e2eeab89a6ef6c145a7a1cdaac3ad7e809 @gortok gortok committed on GitHub Jul 6, 2016
View
@@ -92,6 +92,7 @@ $ bower install ngCordova
- [Push Notifications](https://github.com/phonegap-build/PushPlugin) (**deprecated** - Will be removed in future release)
- [Push Notifications - V5] (https://github.com/phonegap/phonegap-plugin-push)
- [Screenshots](https://github.com/gitawego/cordova-screenshot)
+- [Serial](https://github.com/xseignard/cordovarduino)
- [SMS](https://github.com/aharris88/phonegap-sms-plugin)
- [Social Sharing](https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin)
- [Spinner Dialog](https://github.com/Paldom/SpinnerDialog)
@@ -3,7 +3,7 @@ angular.module('demo.localNotification.ctrl', [])
.controller('LocalNotificationCtrl', function ($scope, $rootScope, $cordovaLocalNotification) {
$scope.addNotification = function () {
- var now = new Date();
+ var now = new Date().getTime();
var _60_seconds_from_now = new Date(now + 60 * 1000);
var event = {
id: 1,
View
@@ -5579,6 +5579,7 @@ angular.module('ngCordova.plugins', [
'ngCordova.plugins.progressIndicator',
'ngCordova.plugins.push',
'ngCordova.plugins.push_v5',
+ 'ngCordova.plugins.recentsControl',
'ngCordova.plugins.sms',
'ngCordova.plugins.socialSharing',
'ngCordova.plugins.spinnerDialog',
@@ -7058,4 +7059,4 @@ angular.module('ngCordova.plugins.zip', [])
};
}]);
-})();
+})();
@@ -2,10 +2,29 @@ ngCordovaMocks.factory('$cordovaAppVersion', ['$q', function ($q) {
var throwsError = false;
return {
throwsError: throwsError,
- getAppVersion: function () {
- var defer = $q.defer();
- defer.resolve('mock v');
- return defer.promise;
+
+ getAppName: function () {
+ var q = $q.defer();
+ q.resolve('mock app name');
+ return q.promise;
+ },
+
+ getPackageName: function () {
+ var q = $q.defer();
+ q.resolve('com.package.mock');
+ return q.promise;
+ },
+
+ getVersionNumber: function () {
+ var q = $q.defer();
+ q.resolve('1.2.3');
+ return q.promise;
+ },
+
+ getVersionCode: function () {
+ var q = $q.defer();
+ q.resolve('4.5.6');
+ return q.promise;
}
};
}]);
@@ -258,6 +258,21 @@ ngCordovaMocks.factory('$cordovaSocialSharing', ['$q', function ($q) {
defer.resolve();
}
return defer.promise;
+ },
+
+ shareWithOptions: function (options) {
+ var defer = $q.defer();
+ if (this.throwsError) {
+ defer.reject('There was an error sharing via SMS.');
+ } else {
+ this.message = options.message;
+ this.subject = options.subject;
+ this.attachments = options.files;
+ this.link = options.url;
+
+ defer.resolve();
+ }
+ return defer.promise;
}
};
}]);
View
@@ -77,6 +77,15 @@ ngCordovaMocks.factory('$cordovaToast', ['$q', function ($q) {
}
return defer.promise;
},
+ showWithOptions: function (options) {
+ var defer = $q.defer();
+ if (this.throwsError) {
+ defer.reject('There was an error showing the toast.');
+ } else {
+ defer.resolve();
+ }
+ return defer.promise;
+ },
show: function (message, duration, position) {
var defer = $q.defer();
if (this.throwsError) {
View
@@ -0,0 +1,147 @@
+// install : cordova plugin add https://github.com/EddyVerbruggen/cordova-plugin-3dtouch.git
+// link : https://github.com/EddyVerbruggen/cordova-plugin-3dtouch
+
+angular.module('ngCordova.plugins.3dtouch', [])
+
+ .factory('$cordova3DTouch', ['$q', function($q) {
+ var quickActions = [];
+ var quickActionHandler = {};
+
+ var createQuickActionHandler = function(quickActionHandler) {
+ return function (payload) {
+ for (var key in quickActionHandler) {
+ if (payload.type === key) {
+ quickActionHandler[key]();
+ }
+ }
+ };
+ };
+
+ return {
+ /*
+ * Checks if Cordova 3D touch is present and loaded
+ *
+ * @return promise
+ */
+ isAvailable: function () {
+ var deferred = $q.defer();
+ if (!window.cordova) {
+ deferred.reject('Not supported in browser');
+ } else {
+ if (!window.ThreeDeeTouch) {
+ deferred.reject('Could not find 3D touch plugin');
+ } else {
+ window.ThreeDeeTouch.isAvailable(function (value) {
+ deferred.resolve(value);
+ }, function (err) {
+ deferred.reject(err);
+ });
+ }
+ }
+
+ return deferred.promise;
+ },
+
+ /*
+ * Add a quick action to menu
+ *
+ * @param string type
+ * @param string title
+ * @param string iconType (optional)
+ * @param string subtitle (optional)
+ * @param function callback (optional)
+ * @return promise
+ */
+ addQuickAction: function(type, title, iconType, iconTemplate, subtitle, callback) {
+ var deferred = $q.defer();
+
+ var quickAction = {
+ type: type,
+ title: title,
+ subtitle: subtitle
+ };
+
+ if (iconType) {
+ quickAction.iconType = iconType;
+ }
+
+ if (iconTemplate) {
+ quickAction.iconTemplate = iconTemplate;
+ }
+
+ this.isAvailable().then(function() {
+ quickActions.push(quickAction);
+ quickActionHandler[type] = callback;
+ window.ThreeDeeTouch.configureQuickActions(quickActions);
+ window.ThreeDeeTouch.onHomeIconPressed = createQuickActionHandler(quickActionHandler);
+ deferred.resolve(quickActions);
+ },
+ function(err) {
+ deferred.reject(err);
+ });
+
+ return deferred.promise;
+ },
+
+ /*
+ * Add a quick action handler. Used for static quick actions
+ *
+ * @param string type
+ * @param function callback
+ * @return promise
+ */
+ addQuickActionHandler: function(type, callback) {
+ var deferred = $q.defer();
+
+ this.isAvailable().then(function() {
+ quickActionHandler[type] = callback;
+ window.ThreeDeeTouch.onHomeIconPressed = createQuickActionHandler(quickActionHandler);
+ deferred.resolve(true);
+ },
+ function(err) {
+ deferred.reject(err);
+ });
+
+ return deferred.promise;
+ },
+
+ /*
+ * Enable link preview popup when force touch is appled to link elements
+ *
+ * @return bool
+ */
+ enableLinkPreview: function() {
+ var deferred = $q.defer();
+
+ this.isAvailable().then(function() {
+ window.ThreeDeeTouch.enableLinkPreview();
+ deferred.resolve(true);
+ },
+ function(err) {
+ deferred.reject(err);
+ });
+
+ return deferred.promise;
+ },
+
+ /*
+ * Add a hanlder function for force touch events,
+ *
+ * @param function callback
+ * @return promise
+ */
+ addForceTouchHandler: function(callback) {
+ var deferred = $q.defer();
+
+ this.isAvailable().then(function() {
+ window.ThreeDeeTouch.watchForceTouches(callback);
+ deferred.resolve(true);
+ },
+ function(err) {
+ deferred.reject(err);
+ });
+
+ return deferred.promise;
+ }
+ };
+ }]);
@@ -43,6 +43,7 @@ angular.module('ngCordova.plugins.appRate', [])
*
* @param {Object} customObj
* @param {string} customObj.title
+ * @param {string} customObj.message
* @param {string} customObj.cancelButtonLabel
* @param {string} customObj.laterButtonLabel
* @param {string} customObj.rateButtonLabel
@@ -80,13 +81,11 @@ angular.module('ngCordova.plugins.appRate', [])
},
onButtonClicked: function (cb) {
- AppRate.onButtonClicked = function (buttonIndex) {
- cb.call(this, buttonIndex);
- };
+ AppRate.preferences.callbacks.onButtonClicked = cb.bind(this);
},
onRateDialogShow: function (cb) {
- AppRate.onRateDialogShow = cb();
+ AppRate.preferences.callbacks.onRateDialogShow = cb.bind(this);
}
};
}];
@@ -56,8 +56,13 @@ angular.module('ngCordova.plugins.googleAnalytics', [])
addCustomDimension: function (key, value) {
var d = $q.defer();
+ var parsedKey = parseInt(key, 10);
- $window.analytics.addCustomDimension(key, value, function () {
+ if (isNaN(parsedKey)) {
+ d.reject('Parameter "key" must be an integer.');
+ }
+
+ $window.analytics.addCustomDimension(parsedKey, value, function () {
d.resolve();
}, function (error) {
d.reject(error);
@@ -1,4 +1,5 @@
angular.module('ngCordova.plugins', [
+ 'ngCordova.plugins.3dtouch',
'ngCordova.plugins.actionSheet',
'ngCordova.plugins.adMob',
'ngCordova.plugins.appAvailability',
@@ -0,0 +1,21 @@
+// install : cordova plugin add cordova-plugin-recentscontrol
+// link : https://github.com/smcpjames/cordova-plugin-recentscontrol
+
+/* globals RecentsControl: true */
+angular.module('ngCordova.plugins.recentsControl', [])
+
+.factory('$cordovaRecents', function () {
+ return {
+ setColor: function (color) {
+ return RecentsControl.setColor(color);
+ },
+
+ setDescription: function (desc) {
+ return RecentsControl.setDescription(desc);
+ },
+
+ setOptions: function (colorStr, desc) {
+ return RecentsControl.setOptions(colorStr, desc);
+ }
+ };
+});
Oops, something went wrong.

0 comments on commit 6914f8e

Please sign in to comment.