From 5fb6eddbce21a228697192e45640356e6f774638 Mon Sep 17 00:00:00 2001
From: Ibrahim Hadeed <ihadeed@users.noreply.github.com>
Date: Fri, 14 Oct 2016 01:56:29 -0400
Subject: [PATCH 01/20] Update README.md

---
 README.md | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/README.md b/README.md
index 54ff59d..047f7fe 100644
--- a/README.md
+++ b/README.md
@@ -5,9 +5,9 @@ Clipboard management plugin for Cordova/PhoneGap that supports iOS, Android, and
 
 ## Usage
 
-Install the plugin using the CLI, for instance with PhoneGap:
-
-	phonegap local plugin add https://github.com/VersoSolutions/CordovaClipboard
+```
+cordova plugin add cordova-plugin-clipboard
+```
 
 The plugin creates the object `cordova.plugins.clipboard` with the methods `copy(text, onSuccess, onError)` and `paste(onSuccess, onError)`.
 

From fadc09a95537a2ac0eef4bfc4b9da8e7ddcdfa9d Mon Sep 17 00:00:00 2001
From: Ibrahim Hadeed <ihadeed@users.noreply.github.com>
Date: Fri, 14 Oct 2016 01:57:05 -0400
Subject: [PATCH 02/20] Update plugin.xml

---
 plugin.xml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/plugin.xml b/plugin.xml
index 4148d15..5b18707 100644
--- a/plugin.xml
+++ b/plugin.xml
@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
     xmlns:android="http://schemas.android.com/apk/res/android"
-    id="com.verso.cordova.clipboard"
-    version="0.1.0">
+    id="cordova-plugin-clipboard"
+    version="1.0.0">
 
     <engines>
         <engine name="cordova" version=">=3.0.0" />

From d0198e0b9a74573d91d1b155da5b8b705f684dea Mon Sep 17 00:00:00 2001
From: Ibby <ibby93@gmail.com>
Date: Fri, 14 Oct 2016 02:00:13 -0400
Subject: [PATCH 03/20] add package.json

---
 package.json | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)
 create mode 100644 package.json

diff --git a/package.json b/package.json
new file mode 100644
index 0000000..f2f5df7
--- /dev/null
+++ b/package.json
@@ -0,0 +1,30 @@
+{
+  "name": "cordova-plugin-clipboard",
+  "version": "1.0.0",
+  "description": "Clipboard management plugin for Cordova/PhoneGap that supports iOS, Android, and WP8",
+  "cordova": {
+    "id": "cordova-plugin-clipboard",
+    "platforms": [
+      "android",
+      "ios",
+      "wp8"
+    ]
+  },
+  "repository": {
+    "type": "git",
+    "url": "git+https://github.com/ihadeed/cordova-plugin-clipboard.git"
+  },
+  "keywords": [
+    "cordova",
+    "plugin",
+    "clipboard",
+    "phonegap",
+    "ionic"
+  ],
+  "author": "Ibrahim Hadeed",
+  "license": "MIT",
+  "bugs": {
+    "url": "https://github.com/ihadeed/cordova-plugin-clipboard/issues"
+  },
+  "homepage": "https://github.com/ihadeed/cordova-plugin-clipboard#readme"
+}

From 847e034921a21fcc3736b5d475f6a62da32978dd Mon Sep 17 00:00:00 2001
From: Ibrahim Hadeed <ihadeed@users.noreply.github.com>
Date: Fri, 14 Oct 2016 02:02:05 -0400
Subject: [PATCH 04/20] Update package.json

---
 package.json | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/package.json b/package.json
index f2f5df7..47590de 100644
--- a/package.json
+++ b/package.json
@@ -1,9 +1,9 @@
 {
-  "name": "cordova-plugin-clipboard",
+  "name": "cordova-plugin-clipboard2",
   "version": "1.0.0",
   "description": "Clipboard management plugin for Cordova/PhoneGap that supports iOS, Android, and WP8",
   "cordova": {
-    "id": "cordova-plugin-clipboard",
+    "id": "cordova-plugin-clipboard2",
     "platforms": [
       "android",
       "ios",

From d9fe5e30123b67d525e5b473152ee621b736c435 Mon Sep 17 00:00:00 2001
From: Ibrahim Hadeed <ihadeed@users.noreply.github.com>
Date: Fri, 14 Oct 2016 02:02:53 -0400
Subject: [PATCH 05/20] Update package.json

---
 package.json | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/package.json b/package.json
index 47590de..34041d7 100644
--- a/package.json
+++ b/package.json
@@ -1,9 +1,9 @@
 {
-  "name": "cordova-plugin-clipboard2",
+  "name": "cordova-clipboard",
   "version": "1.0.0",
   "description": "Clipboard management plugin for Cordova/PhoneGap that supports iOS, Android, and WP8",
   "cordova": {
-    "id": "cordova-plugin-clipboard2",
+    "id": "cordova-clipboard",
     "platforms": [
       "android",
       "ios",
@@ -12,7 +12,7 @@
   },
   "repository": {
     "type": "git",
-    "url": "git+https://github.com/ihadeed/cordova-plugin-clipboard.git"
+    "url": "git+https://github.com/ihadeed/cordova-clipboard.git"
   },
   "keywords": [
     "cordova",
@@ -24,7 +24,7 @@
   "author": "Ibrahim Hadeed",
   "license": "MIT",
   "bugs": {
-    "url": "https://github.com/ihadeed/cordova-plugin-clipboard/issues"
+    "url": "https://github.com/ihadeed/cordova-clipboard/issues"
   },
-  "homepage": "https://github.com/ihadeed/cordova-plugin-clipboard#readme"
+  "homepage": "https://github.com/ihadeed/cordova-clipboard#readme"
 }

From ce04d6fdc8fb60c36c41e6121f7c3b3a117a4dd8 Mon Sep 17 00:00:00 2001
From: Ibrahim Hadeed <ihadeed@users.noreply.github.com>
Date: Fri, 14 Oct 2016 02:03:04 -0400
Subject: [PATCH 06/20] Update plugin.xml

---
 plugin.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/plugin.xml b/plugin.xml
index 5b18707..e3c0ccc 100644
--- a/plugin.xml
+++ b/plugin.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
     xmlns:android="http://schemas.android.com/apk/res/android"
-    id="cordova-plugin-clipboard"
+    id="cordova-clipboard"
     version="1.0.0">
 
     <engines>

From f90a87e9e9d7bbd7a3ccb2a153d66622db1fa177 Mon Sep 17 00:00:00 2001
From: Ibrahim Hadeed <ihadeed@users.noreply.github.com>
Date: Fri, 14 Oct 2016 02:03:15 -0400
Subject: [PATCH 07/20] Update README.md

---
 README.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/README.md b/README.md
index 047f7fe..437ee55 100644
--- a/README.md
+++ b/README.md
@@ -6,7 +6,7 @@ Clipboard management plugin for Cordova/PhoneGap that supports iOS, Android, and
 ## Usage
 
 ```
-cordova plugin add cordova-plugin-clipboard
+cordova plugin add cordova-clipboard
 ```
 
 The plugin creates the object `cordova.plugins.clipboard` with the methods `copy(text, onSuccess, onError)` and `paste(onSuccess, onError)`.

From c6449969c296ef659e94c83216ac1f99978403ac Mon Sep 17 00:00:00 2001
From: Alexandre Machado <alexandre@machado.cc>
Date: Thu, 28 Sep 2017 22:24:03 -0300
Subject: [PATCH 08/20] Suport Windows UWP (#1)

* add platform windows

* Update plugin.xml

* Update plugin.xml

* Create ClipboardProxy.js

* Delete Clipboard.cs

* Update ClipboardProxy.js

* Update ClipboardProxy.js

* cosmetics
---
 plugin.xml                    |  8 ++++-
 src/windows/ClipboardProxy.js | 58 +++++++++++++++++++++++++++++++++++
 2 files changed, 65 insertions(+), 1 deletion(-)
 create mode 100644 src/windows/ClipboardProxy.js

diff --git a/plugin.xml b/plugin.xml
index e3c0ccc..8796d75 100644
--- a/plugin.xml
+++ b/plugin.xml
@@ -5,7 +5,7 @@
     version="1.0.0">
 
     <engines>
-        <engine name="cordova" version=">=3.0.0" />
+        <engine name="cordova" version=">=4.0.0" />
     </engines>
 
     <name>Clipboard</name>
@@ -56,4 +56,10 @@
         <source-file src="src/wp8/Clipboard.cs" />
     </platform>
 
+    <!-- Windows uwp -->
+    <platform name="windows">
+        <js-module src="src/windows/ClipboardProxy.js" name="ClipboardProxy">
+            <merges target="" />
+        </js-module>
+    </platform>
 </plugin>
diff --git a/src/windows/ClipboardProxy.js b/src/windows/ClipboardProxy.js
new file mode 100644
index 0000000..be0f366
--- /dev/null
+++ b/src/windows/ClipboardProxy.js
@@ -0,0 +1,58 @@
+/*
+ *
+ * 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.
+ *
+ */
+
+/*jslint sloppy:true */
+/*global Windows:true, require, document, window, module */
+
+var cordova = require('cordova');
+
+module.exports = {
+
+    copy: function (successCallback, errorCallback, args) {
+        try {
+            var text = args[0];
+
+            var dataPackage = new Windows.ApplicationModel.DataTransfer.DataPackage();
+            dataPackage.setText(text);
+            Windows.ApplicationModel.DataTransfer.Clipboard.setContent(dataPackage);
+            successCallback(text);
+        } catch (e) {
+            errorCallback(e);;
+        }
+    },
+    paste: function (successCallback, errorCallback, args) {
+        try {
+            var text = "";
+
+            var dataPackageView = Windows.ApplicationModel.DataTransfer.Clipboard.getContent();
+            if (dataPackageView.contains(Windows.ApplicationModel.DataTransfer.StandardDataFormats.text)) {
+                dataPackageView.getTextAsync().then(function (value) {
+                    text = value;
+                    successCallback(text);
+                });
+            }
+        } catch (e) {
+            errorCallback(e);;
+        }
+    }
+}; // exports
+
+require("cordova/exec/proxy").add("Clipboard", module.exports);
\ No newline at end of file

From 9b1e2abbf2b022592881a5fe6dc5d4be697db8e1 Mon Sep 17 00:00:00 2001
From: Ibby Hadeed <ibby93@gmail.com>
Date: Thu, 28 Sep 2017 21:25:15 -0400
Subject: [PATCH 09/20] bump version

---
 plugin.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/plugin.xml b/plugin.xml
index 8796d75..e4fdac3 100644
--- a/plugin.xml
+++ b/plugin.xml
@@ -2,7 +2,7 @@
 <plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
     xmlns:android="http://schemas.android.com/apk/res/android"
     id="cordova-clipboard"
-    version="1.0.0">
+    version="1.1.0">
 
     <engines>
         <engine name="cordova" version=">=4.0.0" />

From b3fa929ec4c4c57683927b9e74c8f85bed3911e0 Mon Sep 17 00:00:00 2001
From: Ibby Hadeed <ibby93@gmail.com>
Date: Thu, 28 Sep 2017 21:25:19 -0400
Subject: [PATCH 10/20] 1.1.0

---
 package.json | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package.json b/package.json
index 34041d7..a3ddcbf 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "cordova-clipboard",
-  "version": "1.0.0",
+  "version": "1.1.0",
   "description": "Clipboard management plugin for Cordova/PhoneGap that supports iOS, Android, and WP8",
   "cordova": {
     "id": "cordova-clipboard",

From a502fcc7f671473bce7776253de2298b55b00c11 Mon Sep 17 00:00:00 2001
From: NullIsNot0 <NullIsNot0@users.noreply.github.com>
Date: Sat, 25 Nov 2017 05:51:57 +0200
Subject: [PATCH 11/20] Update CDVClipboard.m (#2)

---
 src/ios/CDVClipboard.m | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/ios/CDVClipboard.m b/src/ios/CDVClipboard.m
index c70378c..2658d82 100644
--- a/src/ios/CDVClipboard.m
+++ b/src/ios/CDVClipboard.m
@@ -10,7 +10,7 @@ - (void)copy:(CDVInvokedUrlCommand*)command {
 		UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
 		NSString     *text       = [command.arguments objectAtIndex:0];
 
-		[pasteboard setValue:text forPasteboardType:@"public.text"];
+		pasteboard.string = text;
 
 		CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:text];
 		[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
@@ -27,4 +27,4 @@ - (void)paste:(CDVInvokedUrlCommand*)command {
 	}];
 }
 
-@end
\ No newline at end of file
+@end

From 72ec0c25f4d8361f41634629aa01d540b8d2110e Mon Sep 17 00:00:00 2001
From: Ibby Hadeed <ibby93@gmail.com>
Date: Fri, 24 Nov 2017 23:05:40 -0500
Subject: [PATCH 12/20] Bump version

---
 plugin.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/plugin.xml b/plugin.xml
index e4fdac3..aa87888 100644
--- a/plugin.xml
+++ b/plugin.xml
@@ -2,7 +2,7 @@
 <plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
     xmlns:android="http://schemas.android.com/apk/res/android"
     id="cordova-clipboard"
-    version="1.1.0">
+    version="1.1.1">
 
     <engines>
         <engine name="cordova" version=">=4.0.0" />

From f8041a7c9fea7f0c51a940afa0dbe02e83f057b8 Mon Sep 17 00:00:00 2001
From: Ibby Hadeed <ibby93@gmail.com>
Date: Fri, 24 Nov 2017 23:05:45 -0500
Subject: [PATCH 13/20] 1.1.1

---
 package.json | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package.json b/package.json
index a3ddcbf..813b0ed 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "cordova-clipboard",
-  "version": "1.1.0",
+  "version": "1.1.1",
   "description": "Clipboard management plugin for Cordova/PhoneGap that supports iOS, Android, and WP8",
   "cordova": {
     "id": "cordova-clipboard",

From dff1721b053e3ea127a87877a05e888f0e13e0d1 Mon Sep 17 00:00:00 2001
From: Angel Careaga <acareagag@gmail.com>
Date: Fri, 20 Apr 2018 18:38:42 -0500
Subject: [PATCH 14/20] =?UTF-8?q?Added=20ability=20to=20clean=20clipboard?=
 =?UTF-8?q?=20:sparkles:=20[=C3=81ngel=20Careaga]=20(#4)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* Added ability to clean clipboard :sparkles:

-  Added the possibility to clean the clipboard on all available platforms.

* Version 1.2 jump :bookmark:

- The version was updated, after adding the option to clean the clipboard.
---
 README.md                     |  4 +++-
 package.json                  |  2 +-
 plugin.xml                    |  4 ++--
 src/android/Clipboard.java    | 12 ++++++++++++
 src/ios/CDVClipboard.h        |  1 +
 src/ios/CDVClipboard.m        | 10 ++++++++++
 src/windows/ClipboardProxy.js |  9 +++++++++
 src/wp8/Clipboard.cs          | 18 +++++++++++++++++-
 www/clipboard.js              | 10 ++++++++++
 9 files changed, 65 insertions(+), 5 deletions(-)

diff --git a/README.md b/README.md
index 437ee55..c786b1d 100644
--- a/README.md
+++ b/README.md
@@ -9,7 +9,7 @@ Clipboard management plugin for Cordova/PhoneGap that supports iOS, Android, and
 cordova plugin add cordova-clipboard
 ```
 
-The plugin creates the object `cordova.plugins.clipboard` with the methods `copy(text, onSuccess, onError)` and `paste(onSuccess, onError)`.
+The plugin creates the object `cordova.plugins.clipboard` with the methods `copy(text, onSuccess, onError)`, `paste(onSuccess, onError)` and `clear(onSuccess, onError)`
 
 Example:
 
@@ -19,6 +19,8 @@ Example:
 
 	cordova.plugins.clipboard.paste(function (text) { alert(text); });
 
+	cordova.plugins.clipboard.clear();
+
 ## Notes
 
 ### All platforms
diff --git a/package.json b/package.json
index 813b0ed..c46d801 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "cordova-clipboard",
-  "version": "1.1.1",
+  "version": "1.2",
   "description": "Clipboard management plugin for Cordova/PhoneGap that supports iOS, Android, and WP8",
   "cordova": {
     "id": "cordova-clipboard",
diff --git a/plugin.xml b/plugin.xml
index aa87888..c13ab04 100644
--- a/plugin.xml
+++ b/plugin.xml
@@ -2,7 +2,7 @@
 <plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
     xmlns:android="http://schemas.android.com/apk/res/android"
     id="cordova-clipboard"
-    version="1.1.1">
+    version="1.2">
 
     <engines>
         <engine name="cordova" version=">=4.0.0" />
@@ -14,7 +14,7 @@
 
     <author>Verso Solutions LLC</author>
 
-    <keywords>clipboard,copy,paste</keywords>
+    <keywords>clipboard,copy,paste,clear</keywords>
 
     <license>MIT</license>
 
diff --git a/src/android/Clipboard.java b/src/android/Clipboard.java
index 438ebc1..2875483 100644
--- a/src/android/Clipboard.java
+++ b/src/android/Clipboard.java
@@ -16,6 +16,7 @@ public class Clipboard extends CordovaPlugin {
 
     private static final String actionCopy = "copy";
     private static final String actionPaste = "paste";
+    private static final String actionClear = "clear";
 
     @Override
     public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
@@ -49,6 +50,17 @@ public boolean execute(String action, JSONArray args, CallbackContext callbackCo
 
                 callbackContext.success(text);
 
+                return true;
+            } catch (Exception e) {
+                callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.ERROR, e.toString()));
+            }
+        } else if (action.equals(actionClear)) {
+            try {
+                ClipData data = ClipData.newPlainText("", "");
+                clipBoard.setPrimaryClip(clip);
+
+                callbackContext.success(true);
+
                 return true;
             } catch (Exception e) {
                 callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.ERROR, e.toString()));
diff --git a/src/ios/CDVClipboard.h b/src/ios/CDVClipboard.h
index 29a6c03..a3576e3 100644
--- a/src/ios/CDVClipboard.h
+++ b/src/ios/CDVClipboard.h
@@ -5,5 +5,6 @@
 
 - (void)copy:(CDVInvokedUrlCommand*)command;
 - (void)paste:(CDVInvokedUrlCommand*)command;
+- (void)clear:(CDVInvokedUrlCommand*)command;
 
 @end
\ No newline at end of file
diff --git a/src/ios/CDVClipboard.m b/src/ios/CDVClipboard.m
index 2658d82..e80f537 100644
--- a/src/ios/CDVClipboard.m
+++ b/src/ios/CDVClipboard.m
@@ -27,4 +27,14 @@ - (void)paste:(CDVInvokedUrlCommand*)command {
 	}];
 }
 
+- (void)clear:(CDVInvokedUrlCommand*)command {
+	[self.commandDelegate runInBackground:^{
+		UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
+    	[pasteboard setValue:@"" forPasteboardType:UIPasteboardNameGeneral];
+	    
+	    CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsBool:true];
+	    [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
+	}];
+}
+
 @end
diff --git a/src/windows/ClipboardProxy.js b/src/windows/ClipboardProxy.js
index be0f366..fbbe951 100644
--- a/src/windows/ClipboardProxy.js
+++ b/src/windows/ClipboardProxy.js
@@ -52,6 +52,15 @@ module.exports = {
         } catch (e) {
             errorCallback(e);;
         }
+    },
+    clear: function (successCallback, errorCallback, args) {
+        try {
+            if(Windows.ApplicationModel.DataTransfer.Clipboard.getContent()){
+                successCallback(true);
+            }
+        } catch (e) {
+            errorCallback(e);;
+        }
     }
 }; // exports
 
diff --git a/src/wp8/Clipboard.cs b/src/wp8/Clipboard.cs
index 637a9c9..5ade987 100644
--- a/src/wp8/Clipboard.cs
+++ b/src/wp8/Clipboard.cs
@@ -36,7 +36,7 @@ public void copy(string options)
 
         }
 
-        public void paste(string options)
+        public void paste()
         {
             string text = "";
 
@@ -54,5 +54,21 @@ public void paste(string options)
                 }
             });
         }
+
+        public void clear()
+        {
+            System.Windows.Deployment.Current.Dispatcher.BeginInvoke(() =>
+            {
+                try
+                {
+                    System.Windows.Clipboard.Clear();
+                    DispatchCommandResult(new PluginResult(PluginResult.Status.OK, true));
+                }
+                catch
+                {
+                    DispatchCommandResult(new PluginResult(PluginResult.Status.ERROR));
+                }
+            });
+        }
     }
 }
\ No newline at end of file
diff --git a/www/clipboard.js b/www/clipboard.js
index 6c2ed7b..35153c3 100644
--- a/www/clipboard.js
+++ b/www/clipboard.js
@@ -29,6 +29,16 @@ Clipboard.prototype.paste = function (onSuccess, onFail) {
 	cordova.exec(onSuccess, onFail, "Clipboard", "paste", []);
 };
 
+/**
+ * Clear the clipboard content
+ *
+ * @param {Function} onSuccess The function to call in case of success
+ * @param {Function} onFail    The function to call in case of error
+ */
+Clipboard.prototype.clear = function (onSuccess, onFail) {
+	cordova.exec(onSuccess, onFail, "Clipboard", "clear", []);
+};
+
 // Register the plugin
 var clipboard = new Clipboard();
 module.exports = clipboard;

From 343db6ee89b7c6530d96b3b213388d533c91028f Mon Sep 17 00:00:00 2001
From: Ibby Hadeed <ibby93@gmail.com>
Date: Fri, 20 Apr 2018 19:40:18 -0400
Subject: [PATCH 15/20] Fix semantic versioning

---
 package.json | 2 +-
 plugin.xml   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/package.json b/package.json
index c46d801..14b01ce 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "cordova-clipboard",
-  "version": "1.2",
+  "version": "1.2.0",
   "description": "Clipboard management plugin for Cordova/PhoneGap that supports iOS, Android, and WP8",
   "cordova": {
     "id": "cordova-clipboard",
diff --git a/plugin.xml b/plugin.xml
index c13ab04..2513e03 100644
--- a/plugin.xml
+++ b/plugin.xml
@@ -2,7 +2,7 @@
 <plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
     xmlns:android="http://schemas.android.com/apk/res/android"
     id="cordova-clipboard"
-    version="1.2">
+    version="1.2.0">
 
     <engines>
         <engine name="cordova" version=">=4.0.0" />

From 5a5f3ee0e0e095e46b3cc1c41fb1bbee51edbc84 Mon Sep 17 00:00:00 2001
From: Angel Careaga <acareagag@gmail.com>
Date: Fri, 20 Apr 2018 21:26:15 -0500
Subject: [PATCH 16/20] Fix Clear Android :bug: (#5)

- Fix the method in Java.
---
 package.json               | 2 +-
 plugin.xml                 | 2 +-
 src/android/Clipboard.java | 6 +++---
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/package.json b/package.json
index 14b01ce..43f1319 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "cordova-clipboard",
-  "version": "1.2.0",
+  "version": "1.2.1",
   "description": "Clipboard management plugin for Cordova/PhoneGap that supports iOS, Android, and WP8",
   "cordova": {
     "id": "cordova-clipboard",
diff --git a/plugin.xml b/plugin.xml
index 2513e03..434267f 100644
--- a/plugin.xml
+++ b/plugin.xml
@@ -2,7 +2,7 @@
 <plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
     xmlns:android="http://schemas.android.com/apk/res/android"
     id="cordova-clipboard"
-    version="1.2.0">
+    version="1.2.1">
 
     <engines>
         <engine name="cordova" version=">=4.0.0" />
diff --git a/src/android/Clipboard.java b/src/android/Clipboard.java
index 2875483..fe6b445 100644
--- a/src/android/Clipboard.java
+++ b/src/android/Clipboard.java
@@ -56,10 +56,10 @@ public boolean execute(String action, JSONArray args, CallbackContext callbackCo
             }
         } else if (action.equals(actionClear)) {
             try {
-                ClipData data = ClipData.newPlainText("", "");
-                clipBoard.setPrimaryClip(clip);
+                ClipData clip = ClipData.newPlainText("", "");
+                clipboard.setPrimaryClip(clip);
 
-                callbackContext.success(true);
+                callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK));
 
                 return true;
             } catch (Exception e) {

From 12dadc710dd2d374f942abe746ae2f828112e934 Mon Sep 17 00:00:00 2001
From: Erik Brommers <ebrommers@gmail.com>
Date: Sat, 2 Jun 2018 14:00:45 -0500
Subject: [PATCH 17/20] Incorporate fixes from Jigsaw-Code fork (#6)

- Add support for osx
- Remove wonky MIMETYPE check in Android paste method
---
 plugin.xml                 | 12 ++++++++++++
 src/android/Clipboard.java | 16 +++++++---------
 src/ios/CDVClipboard.m     |  5 ++++-
 src/osx/CDVClipboard.h     |  9 +++++++++
 src/osx/CDVClipboard.m     | 34 ++++++++++++++++++++++++++++++++++
 5 files changed, 66 insertions(+), 10 deletions(-)
 create mode 100644 src/osx/CDVClipboard.h
 create mode 100644 src/osx/CDVClipboard.m

diff --git a/plugin.xml b/plugin.xml
index 434267f..41fc739 100644
--- a/plugin.xml
+++ b/plugin.xml
@@ -33,7 +33,19 @@
         <header-file src="src/ios/CDVClipboard.h" />
         <source-file src="src/ios/CDVClipboard.m" />
     </platform>
+    
+    <!-- OS X -->
+    <platform name="osx">
+        <config-file target="config.xml" parent="/*">
+            <feature name="Clipboard">
+                <param name="ios-package" value="CDVClipboard" />
+            </feature>
+        </config-file>
 
+        <header-file src="src/osx/CDVClipboard.h" />
+        <source-file src="src/osx/CDVClipboard.m" />
+    </platform>
+    
     <!-- Android -->
     <platform name="android">
         <source-file src="src/android/Clipboard.java" target-dir="src/com/verso/cordova/clipboard" />
diff --git a/src/android/Clipboard.java b/src/android/Clipboard.java
index fe6b445..8f8a9b8 100644
--- a/src/android/Clipboard.java
+++ b/src/android/Clipboard.java
@@ -38,16 +38,14 @@ public boolean execute(String action, JSONArray args, CallbackContext callbackCo
                 callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.ERROR, e.toString()));
             }
         } else if (action.equals(actionPaste)) {
-            if (!clipboard.getPrimaryClipDescription().hasMimeType(ClipDescription.MIMETYPE_TEXT_PLAIN)) {
-                callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.NO_RESULT));
-            }
-
             try {
-                ClipData.Item item = clipboard.getPrimaryClip().getItemAt(0);
-                String text = item.getText().toString();
-
-                if (text == null) text = "";
-
+                String text = "";
+                
+                ClipData clip = clipboard.getPrimaryClip();
+                if (clip != null) {
+                    ClipData.Item item = clip.getItemAt(0);
+                    text = item.getText().toString();
+                }
                 callbackContext.success(text);
 
                 return true;
diff --git a/src/ios/CDVClipboard.m b/src/ios/CDVClipboard.m
index e80f537..395cc4c 100644
--- a/src/ios/CDVClipboard.m
+++ b/src/ios/CDVClipboard.m
@@ -21,7 +21,10 @@ - (void)paste:(CDVInvokedUrlCommand*)command {
 	[self.commandDelegate runInBackground:^{
 		UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
 		NSString     *text       = [pasteboard valueForPasteboardType:@"public.text"];
-	    
+	    if (text == nil) {
+            text = @"";
+        }
+
 	    CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:text];
 	    [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
 	}];
diff --git a/src/osx/CDVClipboard.h b/src/osx/CDVClipboard.h
new file mode 100644
index 0000000..29a6c03
--- /dev/null
+++ b/src/osx/CDVClipboard.h
@@ -0,0 +1,9 @@
+#import <Foundation/Foundation.h>
+#import <Cordova/CDVPlugin.h>
+
+@interface CDVClipboard : CDVPlugin {}
+
+- (void)copy:(CDVInvokedUrlCommand*)command;
+- (void)paste:(CDVInvokedUrlCommand*)command;
+
+@end
\ No newline at end of file
diff --git a/src/osx/CDVClipboard.m b/src/osx/CDVClipboard.m
new file mode 100644
index 0000000..aafaedf
--- /dev/null
+++ b/src/osx/CDVClipboard.m
@@ -0,0 +1,34 @@
+#import <Foundation/Foundation.h>
+#import <Cordova/CDVPlugin.h>
+#import <Cordova/CDVPluginResult.h>
+#import "CDVClipboard.h"
+
+@implementation CDVClipboard
+
+- (void)copy:(CDVInvokedUrlCommand*)command {
+	[self.commandDelegate runInBackground:^{
+		NSPasteboard *pasteboard = [NSPasteboard generalPasteboard];
+		NSString *text = [command.arguments objectAtIndex:0];
+
+		[pasteboard clearContents];
+		[pasteboard setString:text forType:NSStringPboardType];
+
+		CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:text];
+		[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
+	}];
+}
+
+- (void)paste:(CDVInvokedUrlCommand*)command {
+	[self.commandDelegate runInBackground:^{
+		NSPasteboard *pasteboard = [NSPasteboard generalPasteboard];
+		NSString *text = [pasteboard stringForType:NSPasteboardTypeString];
+		if (text == nil) {
+			text = @"";
+		}
+
+		CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:text];
+		[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
+	}];
+}
+
+@end

From 64374d30752a5d334bc94b79c08c76203f4b7aba Mon Sep 17 00:00:00 2001
From: Ibby Hadeed <ibby@zyra.ca>
Date: Sat, 29 Jun 2019 01:06:18 -0400
Subject: [PATCH 18/20] Bump version

---
 plugin.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/plugin.xml b/plugin.xml
index 41fc739..698bab5 100644
--- a/plugin.xml
+++ b/plugin.xml
@@ -2,7 +2,7 @@
 <plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
     xmlns:android="http://schemas.android.com/apk/res/android"
     id="cordova-clipboard"
-    version="1.2.1">
+    version="1.3.0">
 
     <engines>
         <engine name="cordova" version=">=4.0.0" />

From 50f4b7d796160e25052acfc49b2c9913c5cea21c Mon Sep 17 00:00:00 2001
From: Ibby Hadeed <ibby@zyra.ca>
Date: Sat, 29 Jun 2019 01:06:20 -0400
Subject: [PATCH 19/20] 1.3.0

---
 package.json | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package.json b/package.json
index 43f1319..06d32a5 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "cordova-clipboard",
-  "version": "1.2.1",
+  "version": "1.3.0",
   "description": "Clipboard management plugin for Cordova/PhoneGap that supports iOS, Android, and WP8",
   "cordova": {
     "id": "cordova-clipboard",

From 07bf9906fb3067c80fcf487bdcc07be667192b80 Mon Sep 17 00:00:00 2001
From: Andreas Bissinger <be-ndee@users.noreply.github.com>
Date: Fri, 5 Jul 2019 07:26:06 +0200
Subject: [PATCH 20/20] Use tab-indentations in whole file (#10)

---
 src/ios/CDVClipboard.m | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/ios/CDVClipboard.m b/src/ios/CDVClipboard.m
index 395cc4c..3cec119 100644
--- a/src/ios/CDVClipboard.m
+++ b/src/ios/CDVClipboard.m
@@ -21,22 +21,22 @@ - (void)paste:(CDVInvokedUrlCommand*)command {
 	[self.commandDelegate runInBackground:^{
 		UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
 		NSString     *text       = [pasteboard valueForPasteboardType:@"public.text"];
-	    if (text == nil) {
-            text = @"";
-        }
+		if (text == nil) {
+			text = @"";
+		}
 
-	    CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:text];
-	    [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
+		CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:text];
+		[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
 	}];
 }
 
 - (void)clear:(CDVInvokedUrlCommand*)command {
 	[self.commandDelegate runInBackground:^{
 		UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
-    	[pasteboard setValue:@"" forPasteboardType:UIPasteboardNameGeneral];
-	    
-	    CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsBool:true];
-	    [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
+    		[pasteboard setValue:@"" forPasteboardType:UIPasteboardNameGeneral];
+
+		CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsBool:true];
+		[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
 	}];
 }