summaryrefslogtreecommitdiff
path: root/www/js/LogCtrl.js
diff options
context:
space:
mode:
authorPliable Pixels <pliablepixels@gmail.com>2018-10-27 09:59:58 -0400
committerPliable Pixels <pliablepixels@gmail.com>2018-10-27 09:59:58 -0400
commit5e954457a795f77804ccaef74c8012aac50d765b (patch)
tree45e2698a18876c5ca820d8126aaf023b96c768df /www/js/LogCtrl.js
parent2ab37cf8e468fddf658897f6ef9c6391f8784b8f (diff)
switch to diff email plugin to allow attachments properly
Diffstat (limited to 'www/js/LogCtrl.js')
-rw-r--r--www/js/LogCtrl.js52
1 files changed, 27 insertions, 25 deletions
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