Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Funciona #5

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 13 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
# NSUserDefaults Plugin for App Groups #
By: Protonet GmbH
## Description

Authors: Joschka Schulz
This plugin helps to share data between a hybrid application and a native extension it is easy and efficient if everything is set up correctly.

## Adding the Plugin ##

Use the Cordova CLI and type in the following command:

`cordova plugin add https://github.com/protonet/cordova-plugin-nsuserdefaults-for-app-groups.git`
`cordova plugin add https://github.com/joaoduartemariucio/cordova-plugin-nsuserdefaults-for-app-groups`

## Description
## Sample Code

If you like to share some variables between your main app and an share extension, you need to save your variables in a NSUserDefaults container. The NSUserData container can be shared between your both apps and hold all the data you want to transfer.
The Plugin is only for iOS.

Please make sure you add the App Groups in the XCode Project for sharing the container between apps.
## Settings AppGroup

## Sample Code
It is necessary to configure the extension of the application as shown in the link below.

The Plugin is only for iOS.
https://developer.salesforce.com/blogs/engineering/2017/02/using-ios-app-extensions-mobile-sdk.html

### Save in UserDefaults

Expand Down Expand Up @@ -46,3 +45,8 @@ The Plugin is only for iOS.
}, function() {
// failed
});

### Load in Today extention in Swift

let foo = UserDefaults(suiteName: "group.cats.catsAreAwesome")!.string(forKey: "token")
print(foo)
28 changes: 28 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"version": "1.0.0",
"name": "cordova-plugin-appgroupsuserdefaults",
"cordova_name": "App Groups UserDefault",
"description": "Compartilhar dados salvos na aplicação",
"license": "Apache 2.0",
"repo": "",
"issue": "",
"author": {
"name": "João Vitor Duarte Mariucio",
"email": "[email protected]"
},
"repository": {
"type": "git",
"url": "https://github.com/joaoduartemariucio/cordova-plugin-nsuserdefaults-for-app-groups"
},
"keywords": [
"ecosystem:cordova",
"cordova-ios",
"ios",
"cordova"
],
"platforms": [
"ios"
],
"engines": [],
"englishdoc": ""
}
14 changes: 7 additions & 7 deletions plugin.xml
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
id="info.protonet.appgroupsuserdefaults" version="0.0.1">
<name>UserDefaults for App Groups</name>
<description>This plugin is used to save and load data to the app groups. It
is used to share data between App and Share Extension.</description>
id="cordova-plugin-appgroupsuserdefaults" version="1.0.0">
<name>App Groups UserDefault</name>
<description>
This plugin is used to save and load data to the app groups. It
is used to share data between App and Share Extension.
</description>
<author>Joschka Schulz</author>
<license>Apache 2.0</license>
<keywords>cordova,device,app groups</keywords>
<repo>https://github.com/protonet/cordova-plugin-nsuserdefaults-for-app-groups</repo>
<repo>https://github.com/joaoduartemariucio/cordova-plugin-nsuserdefaults-for-app-groups</repo>

<js-module src="www/app_groups_user_defaults.js" name="AppGroupsUserDefaults">
<clobbers target="AppGroupsUserDefaults" />
Expand All @@ -20,10 +22,8 @@
<param name="ios-package" value="AppGroupsUserDefaults" />
</feature>
</config-file>

<header-file src="src/ios/AppGroupsUserDefaults.h" />
<source-file src="src/ios/AppGroupsUserDefaults.m" />

<framework src="MobileCoreServices.framework" />
</platform>
</plugin>