Skip to content

Commit

Permalink
Save files for iOS
Browse files Browse the repository at this point in the history
  • Loading branch information
outspace committed Sep 1, 2023
1 parent 1b3a32f commit 195a3ab
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 9 deletions.
5 changes: 3 additions & 2 deletions client/fileUtilites.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ void FileUtilites::saveFile(QString fileName, const QString &data)
#endif

#ifdef Q_OS_IOS
QFile file(fileName);
QUrl fileUrl = QDir::tempPath() + "/" + fileName;
QFile file(fileUrl.toString());
#else
QUrl fileUrl = QUrl(fileName);
QFile file(fileUrl.toLocalFile());
Expand All @@ -37,7 +38,7 @@ void FileUtilites::saveFile(QString fileName, const QString &data)

#ifdef Q_OS_IOS
QStringList filesToSend;
filesToSend.append(fileName);
filesToSend.append(fileUrl.toString());
MobileUtils::shareText(filesToSend);
return;
#else
Expand Down
2 changes: 0 additions & 2 deletions client/platforms/ios/QtAppDelegate-C-Interface.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#ifndef QTAPPDELEGATECINTERFACE_H
#define QTAPPDELEGATECINTERFACE_H

#include "ui/controllers/importController.h"

void QtAppDelegateInitialize();

#endif // QTAPPDELEGATECINTERFACE_H
2 changes: 0 additions & 2 deletions client/platforms/ios/QtAppDelegate.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#import <UIKit/UIKit.h>

#include "ui/controllers/importController.h"

@interface QtAppDelegate : UIResponder <UIApplicationDelegate>
@end
8 changes: 7 additions & 1 deletion client/ui/qml/Components/ShareConnectionDrawer.qml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,13 @@ DrawerType {
text: qsTr("Share")
imageSource: "qrc:/images/controls/share-2.svg"

onClicked: fileDialog.open()
onClicked: {
if (Qt.platform.os === "ios") {
ExportController.saveFile("amnezia_config.vpn")
} else {
fileDialog.open()
}
}

FileDialog {
id: fileDialog
Expand Down
8 changes: 7 additions & 1 deletion client/ui/qml/Pages2/PageSettingsLogging.qml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,13 @@ PageType {

image: "qrc:/images/controls/save.svg"

onClicked: fileDialog.open()
onClicked: {
if (Qt.platform.os === "ios") {
SettingsController.exportLogsFile("AmneziaVPN.log")
} else {
fileDialog.open()
}
}

FileDialog {
id: fileDialog
Expand Down
6 changes: 5 additions & 1 deletion client/ui/qml/Pages2/PageSettingsSplitTunneling.qml
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,11 @@ PageType {
text: qsTr("Save site list")

clickedFunction: function() {
saveFileDialog.open()
if (Qt.platform.os === "ios") {
ExportController.saveFile("amezia_tunnel.json")
} else {
saveFileDialog.open()
}
}

FileDialog {
Expand Down

0 comments on commit 195a3ab

Please sign in to comment.