🚀 Big News:Socket Has Acquired Secure Annex.Learn More
Socket
Book a DemoSign in
Socket

cordova-plugin-apple-watch

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cordova-plugin-apple-watch - npm Package Compare versions

Comparing version
0.8.8
to
0.9.0
+1
-1
package.json
{
"name": "cordova-plugin-apple-watch",
"version": "0.8.8",
"version": "0.9.0",
"author": "Lee Crossley <leee@hotmail.co.uk> (http://ilee.co.uk/)",

@@ -5,0 +5,0 @@ "description": "Cordova / PhoneGap Plugin for the Apple Watch (WatchKit) to allow in memory and lightweight json object message passing over named queues from a Cordova app to Apple Watch (and vice versa).",

<?xml version='1.0' encoding='UTF-8'?>
<plugin id="cordova-plugin-apple-watch" version="0.8.8" xmlns="http://apache.org/cordova/ns/plugins/1.0">
<plugin id="cordova-plugin-apple-watch" version="0.9.0" xmlns="http://apache.org/cordova/ns/plugins/1.0">
<name>Apple Watch</name>

@@ -4,0 +4,0 @@ <author>Lee Crossley (http://ilee.co.uk/)</author>

@@ -225,2 +225,12 @@ ## Apple Watch Plugin for Apache Cordova [![npm version](https://badge.fury.io/js/cordova-plugin-apple-watch.svg)](http://badge.fury.io/js/cordova-plugin-apple-watch)

### getUserDefaults
Allows retrieval of user default data.
```js
applewatch.getUserDefaults(successHandler, errorHandler, "myKey", appGroupId);
```
The app bundleId will be used for identification by default, prefixed by "group." if `appGroupId` is not supplied.
## Live demo

@@ -227,0 +237,0 @@

@@ -16,2 +16,3 @@ //

- (void) sendUserDefaults:(CDVInvokedUrlCommand*)command;
- (void) getUserDefaults:(CDVInvokedUrlCommand*)command;
- (void) addListener:(CDVInvokedUrlCommand*)command;

@@ -18,0 +19,0 @@ - (void) removeListener:(CDVInvokedUrlCommand*)command;

@@ -127,2 +127,21 @@ //

- (void) getUserDefaults:(CDVInvokedUrlCommand*)command
{
NSMutableDictionary *args = [command.arguments objectAtIndex:0];
NSString *key = [args objectForKey:@"key"];
NSString *appGroupId = [args objectForKey:@"appGroupId"];
if ([appGroupId length] == 0)
{
appGroupId = [NSString stringWithFormat:@"group.%@", [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleIdentifier"]];
}
NSUserDefaults *userDefaults = [[NSUserDefaults alloc] initWithSuiteName:appGroupId];
NSString *value = [userDefaults stringForKey:key];
CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:value];
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}
- (void) addListener:(CDVInvokedUrlCommand*)command;

@@ -129,0 +148,0 @@ {

@@ -43,2 +43,10 @@

AppleWatch.prototype.getUserDefaults = function (onSuccess, onError, key, appGroupId) {
var payload = {
"key": key,
"appGroupId": appGroupId
};
exec(onSuccess, onError, "AppleWatch", "getUserDefaults", [payload]);
};
AppleWatch.prototype.addListener = function (queueName, onMessage) {

@@ -45,0 +53,0 @@ var wrappedOnMessage = function (message) {