diff options
| -rw-r--r-- | config.xml | 2 | ||||
| -rw-r--r-- | package.json | 7 | ||||
| -rw-r--r-- | www/js/LogCtrl.js | 52 |
3 files changed, 32 insertions, 29 deletions
@@ -146,7 +146,6 @@ <plugin name="cordova-plugin-device" spec="^2.0.1" /> <plugin name="cordova-plugin-file" spec="^6.0.1" /> <plugin name="cordova-plugin-media-pp-fork" spec="^1.0.2-dev" /> - <plugin name="cordova-plugin-email" spec="^1.2.7" /> <plugin name="cordova-plugin-statusbar" spec="^2.4.2" /> <plugin name="cordova-library-helper-pp-fork" spec="^1.0.1" /> <plugin name="cordova-plugin-multi-window" spec="0.0.3" /> @@ -167,6 +166,7 @@ </plugin> <plugin name="cordova-plugin-advanced-websocket" spec="^1.1.3" /> <plugin name="cordova-plugin-network-information" spec="^2.0.1" /> + <plugin name="cordova-plugin-x-socialsharing" spec="^5.4.1" /> <engine name="android" spec="^6.4.0" /> <engine name="ios" spec="~4.5.5" /> </widget> diff --git a/package.json b/package.json index da5e2c6c..c6ce98da 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,6 @@ "cordova-plugin-device": {}, "cordova-plugin-file": {}, "cordova-plugin-media-pp-fork": {}, - "cordova-plugin-email": {}, "cordova-plugin-statusbar": {}, "cordova-library-helper-pp-fork": {}, "cordova-plugin-multi-window": {}, @@ -53,7 +52,8 @@ "cordova-plugin-ionic-webview": { "ANDROID_SUPPORT_ANNOTATIONS_VERSION": "27.+" }, - "cordova-plugin-advanced-websocket": {} + "cordova-plugin-advanced-websocket": {}, + "cordova-plugin-x-socialsharing": {} } }, "dependencies": { @@ -70,7 +70,6 @@ "cordova-plugin-cloud-settings": "^1.0.4", "cordova-plugin-customurlscheme": "^4.3.0", "cordova-plugin-device": "^2.0.1", - "cordova-plugin-email": "^1.2.7", "cordova-plugin-file": "^6.0.1", "cordova-plugin-file-transfer": "^1.7.1", "cordova-plugin-globalization": "^1.0.7", @@ -90,9 +89,11 @@ "cordova-plugin-touch-id": "^3.2.0", "cordova-plugin-websocket": "^0.12.2", "cordova-plugin-whitelist": "^1.3.2", + "cordova-plugin-x-socialsharing": "^5.4.1", "cordova-sqlite-storage": "^1.5.3", "deep-equal": "^1.0.1", "electron-window-state": "^4.1.1", + "es6-promise-plugin": "^4.2.2", "jsonfile": "^4.0.0", "keypress": "^0.2.1", "menu": "^0.2.5", diff --git a/www/js/LogCtrl.js b/www/js/LogCtrl.js index cba597ed..e87b8034 100644 --- a/www/js/LogCtrl.js +++ b/www/js/LogCtrl.js @@ -106,11 +106,7 @@ angular.module('zmApp.controllers').controller('zmApp.LogCtrl', ['$scope', '$roo $scope.attachLogs = function() { - cordova.plugins.email.isAvailable( - function (isAvailable) { - - if (isAvailable) { - + var body = "zmNinja version:" + $scope.zmAppVersion + " (" + $rootScope.platformOS + ")<br/>" + @@ -124,33 +120,39 @@ angular.module('zmApp.controllers').controller('zmApp.LogCtrl', ['$scope', '$roo .then (function (d) { var url = cordova.file.dataDirectory + d.name; + //url = url.replace("file://",""); console.log ( "URL:"+url); - cordova.plugins.email.open({ - to: zm.authoremail, - subject: $rootScope.appName + ' logs attached', - body: body, + NVRDataModel.log ( "URL:"+url); + + + var onSuccess = function(result) { + NVRDataModel.log("Share completed? " + result.completed); // On Android apps mostly return false even while it's true + NVRDataModel.log("Shared to app: " + result.app); // On Android result.app since plugin version 5.4.0 this is no longer empty. On iOS it's empty when sharing is cancelled (result.completed=false) + }; + + var onError = function(msg) { + NVRDataModel.log("Sharing failed with message: " + msg); + }; + + window.plugins.socialsharing.shareViaEmail( + body, //body + 'zmNinja Logs attached', // subject + [zm.authoremail], //to + null, // cc + null, //bcc + [url], + onSuccess, + onError + ); + + - attachments: url - - }); }, function (e) { NVRDataModel.debug ("Error attaching log file:"+JSON.stringify(e)); }); - - - } else { - // kEmailNotConfigured - $rootScope.zmPopup = SecuredPopups.show('alert', { - title: $translate.instant('kError'), - template: $translate.instant('kEmailNotConfigured'), - okText: $translate.instant('kButtonOk'), - cancelText: $translate.instant('kButtonCancel'), - }); - } - - }); + }; //-------------------------------------------------------------------------- // Convenience function to send logs via email |
