diff --git a/js/controllers/addresses.js b/js/controllers/addresses.js
index c81a10fc3..cef87776f 100644
--- a/js/controllers/addresses.js
+++ b/js/controllers/addresses.js
@@ -19,6 +19,12 @@ angular.module('copayApp.controllers').controller('AddressesController',
$scope.openAddressModal = function(address) {
var ModalInstanceCtrl = function ($scope, $modalInstance, address) {
$scope.address = address;
+ $scope.isMobile = !!window.cordova;
+
+ $scope.mobileCopy = function(address) {
+ window.cordova.plugins.clipboard.copy(address);
+ window.plugins.toast.showShortBottom('Copied to clipboard');
+ }
$scope.cancel = function () {
$modalInstance.dismiss('cancel');
diff --git a/mobile/cordova_plugins.js b/mobile/cordova_plugins.js
index 695e5081b..887842e5e 100644
--- a/mobile/cordova_plugins.js
+++ b/mobile/cordova_plugins.js
@@ -20,6 +20,24 @@ module.exports = [
"clobbers": [
"navigator.splashscreen"
]
+ },
+ {
+ "file": "plugins/com.verso.cordova.clipboard/www/clipboard.js",
+ "id": "com.verso.cordova.clipboard.Clipboard",
+ "clobbers": [
+ "cordova.plugins.clipboard"
+ ]
+ },
+ {
+ "file": "plugins/nl.x-services.plugins.toast/www/Toast.js",
+ "id": "nl.x-services.plugins.toast.Toast",
+ "clobbers": [
+ "window.plugins.toast"
+ ]
+ },
+ {
+ "file": "plugins/nl.x-services.plugins.toast/test/tests.js",
+ "id": "nl.x-services.plugins.toast.tests"
}
];
module.exports.metadata =
@@ -27,7 +45,9 @@ module.exports.metadata =
{
"de.appplant.cordova.plugin.email-composer": "0.8.2dev",
"com.phonegap.plugins.barcodescanner": "1.0.1",
- "org.apache.cordova.splashscreen": "0.3.0"
+ "org.apache.cordova.splashscreen": "0.3.0",
+ "com.verso.cordova.clipboard": "0.1.0",
+ "nl.x-services.plugins.toast": "2.0"
}
// BOTTOM OF METADATA
});
\ No newline at end of file
diff --git a/mobile/plugins/com.verso.cordova.clipboard/www/clipboard.js b/mobile/plugins/com.verso.cordova.clipboard/www/clipboard.js
new file mode 100644
index 000000000..129c11130
--- /dev/null
+++ b/mobile/plugins/com.verso.cordova.clipboard/www/clipboard.js
@@ -0,0 +1,36 @@
+cordova.define("com.verso.cordova.clipboard.Clipboard", function(require, exports, module) { var cordova = require('cordova');
+
+/**
+ * Clipboard plugin for Cordova
+ *
+ * @constructor
+ */
+function Clipboard () {}
+
+/**
+ * Sets the clipboard content
+ *
+ * @param {String} text The content to copy to the clipboard
+ * @param {Function} onSuccess The function to call in case of success (takes the copied text as argument)
+ * @param {Function} onFail The function to call in case of error
+ */
+Clipboard.prototype.copy = function (text, onSuccess, onFail) {
+ if (typeof text === "undefined" || text === null) text = "";
+ cordova.exec(onSuccess, onFail, "Clipboard", "copy", [text]);
+};
+
+/**
+ * Gets 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.paste = function (onSuccess, onFail) {
+ cordova.exec(onSuccess, onFail, "Clipboard", "paste", []);
+};
+
+// Register the plugin
+var clipboard = new Clipboard();
+module.exports = clipboard;
+
+});
diff --git a/mobile/plugins/nl.x-services.plugins.toast/test/tests.js b/mobile/plugins/nl.x-services.plugins.toast/test/tests.js
new file mode 100644
index 000000000..1d079d4d8
--- /dev/null
+++ b/mobile/plugins/nl.x-services.plugins.toast/test/tests.js
@@ -0,0 +1,59 @@
+cordova.define("nl.x-services.plugins.toast.tests", function(require, exports, module) { exports.defineAutoTests = function() {
+
+ var fail = function (done) {
+ expect(true).toBe(false);
+ done();
+ },
+ succeed = function (done) {
+ expect(true).toBe(true);
+ done();
+ };
+
+ describe('Plugin availability', function () {
+ it("window.plugins.toast should exist", function() {
+ expect(window.plugins.toast).toBeDefined();
+ });
+ });
+
+ describe('API functions', function () {
+ it("should define show", function() {
+ expect(window.plugins.toast.show).toBeDefined();
+ });
+
+ it("should define showShortTop", function() {
+ expect(window.plugins.toast.showShortTop).toBeDefined();
+ });
+
+ it("should define showShortCenter", function() {
+ expect(window.plugins.toast.showShortCenter).toBeDefined();
+ });
+
+ it("should define showShortBottom", function() {
+ expect(window.plugins.toast.showShortBottom).toBeDefined();
+ });
+
+ it("should define showLongTop", function() {
+ expect(window.plugins.toast.showLongTop).toBeDefined();
+ });
+
+ it("should define showLongCenter", function() {
+ expect(window.plugins.toast.showLongCenter).toBeDefined();
+ });
+
+ it("should define showLongBottom", function() {
+ expect(window.plugins.toast.showLongBottom).toBeDefined();
+ });
+ });
+
+ describe('Invalid usage', function () {
+ it("should fail due to an invalid position", function(done) {
+ window.plugins.toast.show('hi', 'short', 'nowhere', fail.bind(null, done), succeed.bind(null, done));
+ });
+
+ it("should fail due to an invalid duration", function(done) {
+ window.plugins.toast.show('hi', 'medium', 'top', fail.bind(null, done), succeed.bind(null, done));
+ });
+ });
+};
+
+});
diff --git a/mobile/plugins/nl.x-services.plugins.toast/www/Toast.js b/mobile/plugins/nl.x-services.plugins.toast/www/Toast.js
new file mode 100644
index 000000000..cad6dab44
--- /dev/null
+++ b/mobile/plugins/nl.x-services.plugins.toast/www/Toast.js
@@ -0,0 +1,42 @@
+cordova.define("nl.x-services.plugins.toast.Toast", function(require, exports, module) { function Toast() {
+}
+
+Toast.prototype.show = function (message, duration, position, successCallback, errorCallback) {
+ cordova.exec(successCallback, errorCallback, "Toast", "show", [message, duration, position]);
+};
+
+Toast.prototype.showShortTop = function (message, successCallback, errorCallback) {
+ this.show(message, "short", "top", successCallback, errorCallback);
+};
+
+Toast.prototype.showShortCenter = function (message, successCallback, errorCallback) {
+ this.show(message, "short", "center", successCallback, errorCallback);
+};
+
+Toast.prototype.showShortBottom = function (message, successCallback, errorCallback) {
+ this.show(message, "short", "bottom", successCallback, errorCallback);
+};
+
+Toast.prototype.showLongTop = function (message, successCallback, errorCallback) {
+ this.show(message, "long", "top", successCallback, errorCallback);
+};
+
+Toast.prototype.showLongCenter = function (message, successCallback, errorCallback) {
+ this.show(message, "long", "center", successCallback, errorCallback);
+};
+
+Toast.prototype.showLongBottom = function (message, successCallback, errorCallback) {
+ this.show(message, "long", "bottom", successCallback, errorCallback);
+};
+
+Toast.install = function () {
+ if (!window.plugins) {
+ window.plugins = {};
+ }
+
+ window.plugins.toast = new Toast();
+ return window.plugins.toast;
+};
+
+cordova.addConstructor(Toast.install);
+});
diff --git a/mobile/res/xml/config.xml b/mobile/res/xml/config.xml
index 86c57a5ca..dfd9181ad 100644
--- a/mobile/res/xml/config.xml
+++ b/mobile/res/xml/config.xml
@@ -28,4 +28,10 @@