Fix clipboard
This commit is contained in:
parent
80cfc7158e
commit
2c4d57ece8
8
package-lock.json
generated
8
package-lock.json
generated
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "com.fixphrase.app",
|
"name": "com.fixphrase.app",
|
||||||
"version": "1.0.0",
|
"version": "1.1.0",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@ -416,6 +416,12 @@
|
|||||||
"shelljs": "^0.5.3"
|
"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": {
|
"cordova-common": {
|
||||||
"version": "3.2.1",
|
"version": "3.2.1",
|
||||||
"resolved": "https://registry.npmjs.org/cordova-common/-/cordova-common-3.2.1.tgz",
|
"resolved": "https://registry.npmjs.org/cordova-common/-/cordova-common-3.2.1.tgz",
|
||||||
|
@ -52,7 +52,8 @@
|
|||||||
},
|
},
|
||||||
"cordova-plugin-geolocation": {
|
"cordova-plugin-geolocation": {
|
||||||
"GPS_REQUIRED": "false"
|
"GPS_REQUIRED": "false"
|
||||||
}
|
},
|
||||||
|
"cordova-clipboard": {}
|
||||||
},
|
},
|
||||||
"platforms": [
|
"platforms": [
|
||||||
"browser",
|
"browser",
|
||||||
@ -69,6 +70,7 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"cordova-android": "^9.1.0",
|
"cordova-android": "^9.1.0",
|
||||||
"cordova-browser": "^6.0.0",
|
"cordova-browser": "^6.0.0",
|
||||||
|
"cordova-clipboard": "^1.3.0",
|
||||||
"cordova-ios": "^6.2.0",
|
"cordova-ios": "^6.2.0",
|
||||||
"cordova-plugin-add-swift-support": "^2.0.2",
|
"cordova-plugin-add-swift-support": "^2.0.2",
|
||||||
"cordova-plugin-androidx": "^3.0.0",
|
"cordova-plugin-androidx": "^3.0.0",
|
||||||
|
@ -75,7 +75,6 @@ function openLocationActionDialog(latitude, longitude, words) {
|
|||||||
text: "Link",
|
text: "Link",
|
||||||
onClick: function () {
|
onClick: function () {
|
||||||
window.plugins.socialsharing.shareWithOptions({
|
window.plugins.socialsharing.shareWithOptions({
|
||||||
message: words,
|
|
||||||
url: "https://fixphrase.com/#" + words.replaceAll(" ", "-")
|
url: "https://fixphrase.com/#" + words.replaceAll(" ", "-")
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -97,8 +96,7 @@ function openLocationActionDialog(latitude, longitude, words) {
|
|||||||
{
|
{
|
||||||
text: "FixPhrase",
|
text: "FixPhrase",
|
||||||
onClick: function () {
|
onClick: function () {
|
||||||
console.log("wefuiefhui weu");
|
copyToClipboard(words, function () {
|
||||||
navigator.clipboard.writeText(words).then(() => {
|
|
||||||
app.toast.show({text: "Copied!", closeTimeout: 3000});
|
app.toast.show({text: "Copied!", closeTimeout: 3000});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -106,7 +104,7 @@ function openLocationActionDialog(latitude, longitude, words) {
|
|||||||
{
|
{
|
||||||
text: "Link",
|
text: "Link",
|
||||||
onClick: function () {
|
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});
|
app.toast.show({text: "Copied!", closeTimeout: 3000});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -114,7 +112,7 @@ function openLocationActionDialog(latitude, longitude, words) {
|
|||||||
{
|
{
|
||||||
text: "Coordinates",
|
text: "Coordinates",
|
||||||
onClick: function () {
|
onClick: function () {
|
||||||
navigator.clipboard.writeText(latitude + ", " + longitude).then(() => {
|
copyToClipboard(latitude + ", " + longitude, function () {
|
||||||
app.toast.show({text: "Copied!", closeTimeout: 3000});
|
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 () {
|
onClick: function () {
|
||||||
openGeoLink("geo:" + latitude + "," + longitude);
|
openGeoLink("geo:" + latitude + "," + longitude);
|
||||||
}
|
}
|
||||||
|
@ -22,19 +22,19 @@ var cordovaInAppBrowserRef = null;
|
|||||||
|
|
||||||
var openBrowser = function (url) {
|
var openBrowser = function (url) {
|
||||||
window.open(url);
|
window.open(url);
|
||||||
}
|
};
|
||||||
|
|
||||||
var closeBrowser = function () {
|
var closeBrowser = function () {
|
||||||
// stub
|
// stub
|
||||||
}
|
};
|
||||||
|
|
||||||
var openExternalBrowser = function (url) {
|
var openExternalBrowser = function (url) {
|
||||||
window.open(url);
|
window.open(url);
|
||||||
}
|
};
|
||||||
|
|
||||||
var doHapticFeedback = function () {
|
var doHapticFeedback = function () {
|
||||||
console.log("Haptics not enabled.");
|
console.log("Haptics not enabled.");
|
||||||
}
|
};
|
||||||
|
|
||||||
var appTheme = "light";
|
var appTheme = "light";
|
||||||
|
|
||||||
@ -56,7 +56,7 @@ var getLocation = function (success, error) {
|
|||||||
error("Location is unavailable.");
|
error("Location is unavailable.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
var openGeoLink = function (href) {
|
var openGeoLink = function (href) {
|
||||||
if (platform_type == "cordova") {
|
if (platform_type == "cordova") {
|
||||||
@ -72,7 +72,15 @@ var openGeoLink = function (href) {
|
|||||||
} else {
|
} else {
|
||||||
window.open(href, "_blank");
|
window.open(href, "_blank");
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
|
var copyToClipboard = function (text, callback) {
|
||||||
|
navigator.clipboard.writeText(text).then(() => {
|
||||||
|
if (typeof callback == "function") {
|
||||||
|
callback();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
function initCordova() {
|
function initCordova() {
|
||||||
@ -169,6 +177,14 @@ function initCordova() {
|
|||||||
openGeoLink($(this).attr("href"));
|
openGeoLink($(this).attr("href"));
|
||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
copyToClipboard = function (text, callback) {
|
||||||
|
cordova.plugins.clipboard.copy(text, function () {
|
||||||
|
if (typeof callback == "function") {
|
||||||
|
callback();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function initNW() {
|
function initNW() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user