Skip to content

Commit 309ce25

Browse files
committed
added copy and detail paswordcreator
1 parent d59110c commit 309ce25

20 files changed

+517
-17
lines changed

config.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version='1.0' encoding='utf-8'?>
2-
<widget android-versionCode="1" id="com.myazarc.pm" ios-CFBundleVersion="1" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
2+
<widget android-versionCode="3" id="com.myazarc.pm" ios-CFBundleVersion="1" version="1.1.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
33
<name>Pass Manager</name>
44
<description>Password Manager</description>
55
<author email="myazarc@gmail.com" href="myazarc.com">
@@ -23,5 +23,6 @@
2323
<allow-intent href="itms-apps:*" />
2424
</platform>
2525
<plugin name="cordova-sqlcipher-adapter" spec="^0.1.12-rc2" />
26+
<plugin name="com.verso.cordova.clipboard" spec="https://github.com/ibnclaudius/CordovaClipboard" />
2627
<engine name="android" spec="^7.0.0" />
2728
</widget>

package-lock.json

Lines changed: 5 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "pm",
3-
"version": "1.0.0",
3+
"version": "1.1.1",
44
"description": "A Vue.js project",
55
"author": "myazarc <i@myazarc.com>",
66
"private": true,
@@ -17,6 +17,7 @@
1717
},
1818
"dependencies": {
1919
"cordova-android": "^7.0.0",
20+
"cordova-clipboard": "git+https://github.com/ibnclaudius/CordovaClipboard.git",
2021
"cordova-plugin-device": "^2.0.2",
2122
"cordova-plugin-whitelist": "^1.3.3",
2223
"cordova-sqlcipher-adapter": "^0.1.12-rc2",
@@ -90,7 +91,8 @@
9091
"plugins": {
9192
"cordova-plugin-device": {},
9293
"cordova-plugin-whitelist": {},
93-
"cordova-sqlcipher-adapter": {}
94+
"cordova-sqlcipher-adapter": {},
95+
"com.verso.cordova.clipboard": {}
9496
},
9597
"platforms": [
9698
"android"

plugins/android.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
},
1616
"cordova-sqlcipher-adapter": {
1717
"PACKAGE_NAME": "com.myazarc.pm"
18+
},
19+
"com.verso.cordova.clipboard": {
20+
"PACKAGE_NAME": "com.myazarc.pm"
1821
}
1922
},
2023
"dependent_plugins": {}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2013 Verso Solutions LLC
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy of
6+
this software and associated documentation files (the "Software"), to deal in
7+
the Software without restriction, including without limitation the rights to
8+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9+
the Software, and to permit persons to whom the Software is furnished to do so,
10+
subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
Clipboard
2+
=========
3+
4+
Clipboard management plugin for Cordova/PhoneGap that supports iOS, Android, and Windows Phone 8.
5+
6+
## Usage
7+
8+
Install the plugin using the CLI, for instance with PhoneGap:
9+
10+
phonegap local plugin add https://github.com/ibnclaudius/CordovaClipboard
11+
12+
The plugin creates the object `cordova.plugins.clipboard` with the methods `copy(text, onSuccess, onError)` and `paste(onSuccess, onError)`.
13+
14+
Example:
15+
16+
var text = "Hello World!";
17+
18+
cordova.plugins.clipboard.copy(text);
19+
20+
cordova.plugins.clipboard.paste(function (text) { alert(text); });
21+
22+
## Notes
23+
24+
### All platforms
25+
26+
- The plugin only works with text content.
27+
28+
### Windows Phone
29+
30+
- The Windows Phone platform doesn't allow applications to read the content of the clipboard. Using the `paste` method will return an error.
31+
32+
### Android
33+
34+
- The minimum supported API Level is 11. Make sure that `minSdkVersion` is larger or equal to 11 in `AndroidManifest.xml`.
35+
36+
## Acknowledgements
37+
38+
This plugin was inspired by [ClipboardManagerPlugin](https://github.com/jacob/ClipboardManagerPlugin) (Android) and [ClipboardPlugin](https://github.com/phonegap/phonegap-plugins/tree/master/iPhone/ClipboardPlugin) (iOS).
39+
40+
## License
41+
42+
The MIT License (MIT)
43+
44+
Copyright (c) 2013 Verso Solutions LLC
45+
46+
Permission is hereby granted, free of charge, to any person obtaining a copy
47+
of this software and associated documentation files (the "Software"), to deal
48+
in the Software without restriction, including without limitation the rights
49+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
50+
copies of the Software, and to permit persons to whom the Software is
51+
furnished to do so, subject to the following conditions:
52+
53+
The above copyright notice and this permission notice shall be included in
54+
all copies or substantial portions of the Software.
55+
56+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
57+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
58+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
59+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
60+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
61+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
62+
THE SOFTWARE.
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
{
2+
"_from": "git+https://github.com/ibnclaudius/CordovaClipboard.git",
3+
"_id": "cordova-clipboard@0.1.0",
4+
"_inBundle": false,
5+
"_integrity": "",
6+
"_location": "/cordova-clipboard",
7+
"_phantomChildren": {},
8+
"_requested": {
9+
"type": "git",
10+
"raw": "https://github.com/ibnclaudius/CordovaClipboard",
11+
"rawSpec": "https://github.com/ibnclaudius/CordovaClipboard",
12+
"saveSpec": "git+https://github.com/ibnclaudius/CordovaClipboard.git",
13+
"fetchSpec": "https://github.com/ibnclaudius/CordovaClipboard.git",
14+
"gitCommittish": null
15+
},
16+
"_requiredBy": [
17+
"#USER",
18+
"/"
19+
],
20+
"_resolved": "git+https://github.com/ibnclaudius/CordovaClipboard.git#a27b871795ce8e10feacb2403347599116832fd6",
21+
"_spec": "https://github.com/ibnclaudius/CordovaClipboard",
22+
"_where": "/home/proder/pm",
23+
"author": "",
24+
"bugs": {
25+
"url": "https://github.com/VersoSolutions/CordovaClipboard/issues"
26+
},
27+
"bundleDependencies": false,
28+
"cordova": {
29+
"id": "com.verso.cordova.clipboard",
30+
"platforms": [
31+
"ios",
32+
"android",
33+
"wp8"
34+
]
35+
},
36+
"deprecated": false,
37+
"description": "Clipboard management plugin for Cordova/PhoneGap",
38+
"engines": {
39+
"name": "cordova",
40+
"version": ">=3.0.0"
41+
},
42+
"homepage": "https://github.com/VersoSolutions/CordovaClipboard#readme",
43+
"keywords": [
44+
"clipboard",
45+
"copy",
46+
"paste",
47+
"ecosystem:cordova",
48+
"cordova-ios",
49+
"cordova-android",
50+
"cordova-wp8"
51+
],
52+
"license": "MIT",
53+
"name": "cordova-clipboard",
54+
"repository": {
55+
"type": "git",
56+
"url": "git+https://github.com/VersoSolutions/CordovaClipboard.git"
57+
},
58+
"version": "0.1.0"
59+
}
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
3+
xmlns:android="http://schemas.android.com/apk/res/android"
4+
id="com.verso.cordova.clipboard"
5+
version="0.1.0">
6+
7+
<engines>
8+
<engine name="cordova" version=">=3.0.0" />
9+
</engines>
10+
11+
<name>Clipboard</name>
12+
13+
<description>Clipboard management plugin for Cordova/PhoneGap</description>
14+
15+
<author>Verso Solutions LLC</author>
16+
17+
<keywords>clipboard,copy,paste</keywords>
18+
19+
<license>MIT</license>
20+
21+
<js-module src="www/clipboard.js" name="Clipboard">
22+
<clobbers target="cordova.plugins.clipboard" />
23+
</js-module>
24+
25+
<!-- iOS -->
26+
<platform name="ios">
27+
<config-file target="config.xml" parent="/*">
28+
<feature name="Clipboard">
29+
<param name="ios-package" value="CDVClipboard" />
30+
</feature>
31+
</config-file>
32+
33+
<header-file src="src/ios/CDVClipboard.h" />
34+
<source-file src="src/ios/CDVClipboard.m" />
35+
</platform>
36+
37+
<!-- Android -->
38+
<platform name="android">
39+
<source-file src="src/android/Clipboard.java" target-dir="src/com/verso/cordova/clipboard" />
40+
41+
<config-file target="res/xml/config.xml" parent="/*">
42+
<feature name="Clipboard">
43+
<param name="android-package" value="com.verso.cordova.clipboard.Clipboard" />
44+
</feature>
45+
</config-file>
46+
</platform>
47+
48+
<!-- Windows Phone 8 -->
49+
<platform name="wp8">
50+
<config-file target="config.xml" parent="/*">
51+
<feature name="Clipboard">
52+
<param name="wp-package" value="Clipboard"/>
53+
</feature>
54+
</config-file>
55+
56+
<source-file src="src/wp8/Clipboard.cs" />
57+
</platform>
58+
59+
</plugin>
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
package com.verso.cordova.clipboard;
2+
3+
import org.apache.cordova.CordovaPlugin;
4+
import org.apache.cordova.PluginResult;
5+
import org.apache.cordova.CallbackContext;
6+
7+
import org.json.JSONArray;
8+
import org.json.JSONException;
9+
10+
import android.content.Context;
11+
import android.content.ClipboardManager;
12+
import android.content.ClipData;
13+
import android.content.ClipDescription;
14+
15+
public class Clipboard extends CordovaPlugin {
16+
17+
private static final String actionCopy = "copy";
18+
private static final String actionPaste = "paste";
19+
20+
@Override
21+
public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
22+
ClipboardManager clipboard = (ClipboardManager) cordova.getActivity().getSystemService(Context.CLIPBOARD_SERVICE);
23+
24+
if (action.equals(actionCopy)) {
25+
try {
26+
String text = args.getString(0);
27+
ClipData clip = ClipData.newPlainText("Text", text);
28+
29+
clipboard.setPrimaryClip(clip);
30+
31+
callbackContext.success(text);
32+
33+
return true;
34+
} catch (JSONException e) {
35+
callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.JSON_EXCEPTION));
36+
} catch (Exception e) {
37+
callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.ERROR, e.toString()));
38+
}
39+
} else if (action.equals(actionPaste)) {
40+
if (!clipboard.getPrimaryClipDescription().hasMimeType(ClipDescription.MIMETYPE_TEXT_PLAIN)) {
41+
callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.NO_RESULT));
42+
}
43+
44+
try {
45+
ClipData.Item item = clipboard.getPrimaryClip().getItemAt(0);
46+
String text = item.getText().toString();
47+
48+
if (text == null) text = "";
49+
50+
callbackContext.success(text);
51+
52+
return true;
53+
} catch (Exception e) {
54+
callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.ERROR, e.toString()));
55+
}
56+
}
57+
58+
return false;
59+
}
60+
}
61+
62+
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#import <Foundation/Foundation.h>
2+
#import <Cordova/CDVPlugin.h>
3+
4+
@interface CDVClipboard : CDVPlugin {}
5+
6+
- (void)copy:(CDVInvokedUrlCommand*)command;
7+
- (void)paste:(CDVInvokedUrlCommand*)command;
8+
9+
@end

0 commit comments

Comments
 (0)