Fix clipboard

master
Skylar Ittner 2 years ago
parent 80cfc7158e
commit 2c4d57ece8

8
package-lock.json generated

@ -1,6 +1,6 @@
{
"name": "com.fixphrase.app",
"version": "1.0.0",
"version": "1.1.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@ -416,6 +416,12 @@
"shelljs": "^0.5.3"
}
},
"cordova-clipboard": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/cordova-clipboard/-/cordova-clipboard-1.3.0.tgz",
"integrity": "sha512-IGk4LZm/DJ0Xk/jgakHm4wa+A/lrRP3QfzMAHDG7oWLJS4ISOpfI32Wez4ndnENItRslGyBVyJyKD83CxELCAw==",
"dev": true
},
"cordova-common": {
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/cordova-common/-/cordova-common-3.2.1.tgz",

@ -52,7 +52,8 @@
},
"cordova-plugin-geolocation": {
"GPS_REQUIRED": "false"
}
},
"cordova-clipboard": {}
},
"platforms": [
"browser",
@ -69,6 +70,7 @@
"devDependencies": {
"cordova-android": "^9.1.0",
"cordova-browser": "^6.0.0",
"cordova-clipboard": "^1.3.0",
"cordova-ios": "^6.2.0",
"cordova-plugin-add-swift-support": "^2.0.2",
"cordova-plugin-androidx": "^3.0.0",

@ -75,7 +75,6 @@ function openLocationActionDialog(latitude, longitude, words) {
text: "Link",
onClick: function () {
window.plugins.socialsharing.shareWithOptions({
message: words,
url: "https://fixphrase.com/#" + words.replaceAll(" ", "-")
});
}
@ -97,8 +96,7 @@ function openLocationActionDialog(latitude, longitude, words) {
{
text: "FixPhrase",
onClick: function () {
console.log("wefuiefhui weu");
navigator.clipboard.writeText(words).then(() => {
copyToClipboard(words, function () {
app.toast.show({text: "Copied!", closeTimeout: 3000});
});
}
@ -106,7 +104,7 @@ function openLocationActionDialog(latitude, longitude, words) {
{
text: "Link",
onClick: function () {
navigator.clipboard.writeText("https://fixphrase.com/#" + words.replaceAll(" ", "-")).then(() => {
copyToClipboard("https://fixphrase.com/#" + words.replaceAll(" ", "-"), function () {
app.toast.show({text: "Copied!", closeTimeout: 3000});
});
}
@ -114,7 +112,7 @@ function openLocationActionDialog(latitude, longitude, words) {
{
text: "Coordinates",
onClick: function () {
navigator.clipboard.writeText(latitude + ", " + longitude).then(() => {
copyToClipboard(latitude + ", " + longitude, function () {
app.toast.show({text: "Copied!", closeTimeout: 3000});
});
}
@ -122,7 +120,7 @@ function openLocationActionDialog(latitude, longitude, words) {
],
[
{
text: "Open in Default Maps App",
text: "Open in default maps app",
onClick: function () {
openGeoLink("geo:" + latitude + "," + longitude);
}

@ -22,19 +22,19 @@ var cordovaInAppBrowserRef = null;
var openBrowser = function (url) {
window.open(url);
}
};
var closeBrowser = function () {
// stub
}
};
var openExternalBrowser = function (url) {
window.open(url);
}
};
var doHapticFeedback = function () {
console.log("Haptics not enabled.");
}
};
var appTheme = "light";
@ -56,7 +56,7 @@ var getLocation = function (success, error) {
error("Location is unavailable.");
}
}
}
};
var openGeoLink = function (href) {
if (platform_type == "cordova") {
@ -72,7 +72,15 @@ var openGeoLink = function (href) {
} else {
window.open(href, "_blank");
}
}
};
var copyToClipboard = function (text, callback) {
navigator.clipboard.writeText(text).then(() => {
if (typeof callback == "function") {
callback();
}
});
};
function initCordova() {
@ -169,6 +177,14 @@ function initCordova() {
openGeoLink($(this).attr("href"));
evt.preventDefault();
});
copyToClipboard = function (text, callback) {
cordova.plugins.clipboard.copy(text, function () {
if (typeof callback == "function") {
callback();
}
});
}
}
function initNW() {

Loading…
Cancel
Save