From 87387b7e7ed0bcf177376b3f5b02072f4e0ed096 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Mon, 29 Aug 2022 16:46:58 -0700 Subject: [PATCH] mobile: send logfiles as attachments on iOS as well This was added for Android a while ago, but now this works on iOS as well which is a very welcome addition for the recipient of these support emails (i.e. me). Signed-off-by: Dirk Hohndel --- CHANGELOG.md | 1 + mobile-widgets/qmlmanager.cpp | 10 +++++++++- mobile-widgets/qmlmanager.h | 5 +++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bde48a266..8c6a36c0c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ divelist: do not include planned versions of a dive if there is real data desktop: fix key composition in tag widgets and dive site widget +mobile: send log files as attachments for support emails on iOS mobile: allow cloud account deletion (Apple app store requirement) mobile: fix listing of local cloud cache directories dive computer support: diff --git a/mobile-widgets/qmlmanager.cpp b/mobile-widgets/qmlmanager.cpp index c358cd548..a616ae11d 100644 --- a/mobile-widgets/qmlmanager.cpp +++ b/mobile-widgets/qmlmanager.cpp @@ -58,7 +58,6 @@ #include #include "core/serial_usb_android.h" std::vector androidSerialDevices; - #endif QMLManager *QMLManager::m_instance = NULL; @@ -506,7 +505,16 @@ bool QMLManager::createSupportEmail() return true; } qDebug() << __FUNCTION__ << "failed to share the logFiles via intent, use the fall-back mail body method"; +#elif defined(Q_OS_IOS) + // call into objC++ code to share on iOS + QString libdcLogFileName(logfile_name); + iosshare.supportEmail(appLogFileName, libdcLogFileName); + // Unfortunately I haven't been able to figure out how to wait until the mail was sent + // so that this could tell us whether this was successful or not + // We always assume it worked and return to the caller. + return true; #endif + // fallback code that tries to copy the logs into the message body and uses the Qt send email method QString mailToLink = "mailto:in-app-support@subsurface-divelog.org?subject=Subsurface-mobile support request"; mailToLink += "&body="; mailToLink += messageBody; diff --git a/mobile-widgets/qmlmanager.h b/mobile-widgets/qmlmanager.h index b424f4417..717b18510 100644 --- a/mobile-widgets/qmlmanager.h +++ b/mobile-widgets/qmlmanager.h @@ -19,6 +19,8 @@ #if defined(Q_OS_ANDROID) #include "core/serial_usb_android.h" +#elif defined(Q_OS_IOS) +#include "ios/ios-share.h" #endif class QAction; @@ -266,6 +268,9 @@ private: QString appLogFileName; QFile appLogFile; bool appLogFileOpen; +#endif +#if defined(Q_OS_IOS) + IosShare iosshare; #endif qPrefCloudStorage::cloud_status m_oldStatus;