Commit 9edd261f authored by Martin Straka's avatar Martin Straka

Fixed some file paths and file names for iOS

parent 10bdd9e9
......@@ -40,10 +40,19 @@
- (void)openExportDocumentPicker:(NSArray<NSURL *> *)exportUrls {
UIDocumentPickerViewController *documentPicker = [[UIDocumentPickerViewController alloc] initWithURLs:exportUrls inMode:UIDocumentPickerModeExportToService];
documentPicker.delegate = self;
documentPicker.modalPresentationStyle = UIModalPresentationFormSheet;
[self presentViewController:documentPicker animated:YES completion:nil];
if (@available(iOS 11.0, *)) {
UIDocumentPickerViewController *documentPicker = [[UIDocumentPickerViewController alloc] initWithURLs:exportUrls inMode:UIDocumentPickerModeExportToService];
documentPicker.delegate = self;
documentPicker.modalPresentationStyle = UIModalPresentationFormSheet;
[self presentViewController:documentPicker animated:YES completion:nil];
} else {
for (NSURL *url in exportUrls) {
UIDocumentPickerViewController *documentPicker = [[UIDocumentPickerViewController alloc] initWithURL:url inMode:UIDocumentPickerModeExportToService];
documentPicker.delegate = self;
documentPicker.modalPresentationStyle = UIModalPresentationFormSheet;
[self presentViewController:documentPicker animated:YES completion:nil];
}
}
}
- (void)openImportDocumentPicker:(NSArray<NSString *> *)allowedUtis {
......
......@@ -137,7 +137,7 @@ QString IosHelper::getShortSendFilePath(const QString &sandBoxFilePath)
// Get short local send file path
QString pattern(SEND_FILE_PATH_PREFIX);
int pos = sandBoxFilePath.indexOf(pattern) + pattern.length();
return QUrl::fromPercentEncoding(sandBoxFilePath.mid(pos).toUtf8());
return sandBoxFilePath.mid(pos);
#else
Q_UNUSED(sandBoxFilePath);
......@@ -260,7 +260,7 @@ QString IosHelper::moveFileToTargetPath(const QUrl &sourceFileUrl,
QUrl targetFileUrl(ICloudIo::moveFile(sourceFileUrl, targetPath));
if (targetFileUrl.isValid()) {
targetFileUrl.setScheme(QString());
return targetFileUrl.toString();
return QUrl::fromPercentEncoding(targetFileUrl.toString().toUtf8());
}
#else /* !Q_OS_IOS */
......
......@@ -25,6 +25,7 @@
#include "src/datovka_shared/log/log.h"
#include "src/global.h"
#include "src/io/filesystem.h"
#include "src/models/accountmodel.h"
#include "src/net/isds_const.h"
#include "src/net/isds_session.h"
......@@ -87,6 +88,16 @@ bool IsdsSession::setCertDataToCtx(IsdsContext &ctx, const QString &certPath)
debugFuncCall();
QFile certFile(certPath);
#if defined Q_OS_IOS
// iOS base sandbox path is different after application was updated.
// We cannot use static path for certificate on iOS like Android.
QFileInfo fi(certFile);
certFile.setFileName(joinDirs(appCertDirPath(), fi.fileName()));
#endif
if (!certFile.open(QIODevice::ReadOnly)) {
logErrorNL("Cannot open certificate from '%s'.",
certPath.toUtf8().constData());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment