mirror of
https://github.com/leonboe1/QuickDrop.git
synced 2026-11-11 02:51:11 +00:00
iOS: Fix share extension showed app introduction, share extension add cancel button, add browse button to settings
This commit is contained in:
1 parent
006f389891
commit
9d71ed35b7
4 files changed
+152
-14
No files matched your search
@@ -124,17 +124,7 @@ public class SaveFilesManager {
|
||||
NSWorkspace.shared.activateFileViewerSelecting(filesFinishedDownloadingSinceLastRun)
|
||||
}
|
||||
#else
|
||||
|
||||
let documentsUrl = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first
|
||||
#if !EXTENSION
|
||||
if let documentsUrl = documentsUrl, let sharedUrl = URL(string: "shareddocuments://\(documentsUrl.path)"), UIApplication.shared.canOpenURL(sharedUrl) {
|
||||
UIApplication.shared.open(sharedUrl, options: [:])
|
||||
}
|
||||
else {
|
||||
showAlert(title: "CouldNotOpenDocumentsFolder", message: "CouldNotOpenDocumentsFolderDescription")
|
||||
}
|
||||
#endif
|
||||
|
||||
openDownloadedFilesFolder()
|
||||
#endif
|
||||
|
||||
// Clear the list of finished files
|
||||
@@ -144,6 +134,20 @@ public class SaveFilesManager {
|
||||
stopAccessingSecurityScopedResource()
|
||||
}
|
||||
|
||||
|
||||
public func openDownloadedFilesFolder() {
|
||||
#if !EXTENSION
|
||||
let documentsUrl = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first
|
||||
|
||||
if let documentsUrl = documentsUrl, let sharedUrl = URL(string: "shareddocuments://\(documentsUrl.path)"), UIApplication.shared.canOpenURL(sharedUrl) {
|
||||
UIApplication.shared.open(sharedUrl, options: [:])
|
||||
}
|
||||
else {
|
||||
showAlert(title: "CouldNotOpenDocumentsFolder", message: "CouldNotOpenDocumentsFolderDescription")
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
public func stopAccessingSecurityScopedResource() {
|
||||
guard let url = securityScopeUrl else {
|
||||
|
||||
@@ -1282,6 +1282,113 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"BrowseDownloadedFiles" : {
|
||||
"extractionState" : "manual",
|
||||
"localizations" : {
|
||||
"ar" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "تصفح الملفات التي تم تنزيلها"
|
||||
}
|
||||
},
|
||||
"de" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "Heruntergeladene Dateien durchsuchen"
|
||||
}
|
||||
},
|
||||
"en" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "Browse Downloaded Files"
|
||||
}
|
||||
},
|
||||
"es" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "Explorar archivos descargados"
|
||||
}
|
||||
},
|
||||
"fr" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "Parcourir les fichiers téléchargés"
|
||||
}
|
||||
},
|
||||
"hu" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "Letöltött fájlok böngészése"
|
||||
}
|
||||
},
|
||||
"it" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "Sfoglia file scaricati"
|
||||
}
|
||||
},
|
||||
"ja" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "ダウンロードしたファイルを表示"
|
||||
}
|
||||
},
|
||||
"ko" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "다운로드된 파일 탐색"
|
||||
}
|
||||
},
|
||||
"nl" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "Blader door gedownloade bestanden"
|
||||
}
|
||||
},
|
||||
"pt-BR" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "Navegar pelos arquivos baixados"
|
||||
}
|
||||
},
|
||||
"pt-PT" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "Procurar Ficheiros Transferidos"
|
||||
}
|
||||
},
|
||||
"ro" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "Navigați prin Fișierele Descărcate"
|
||||
}
|
||||
},
|
||||
"ru" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "Просмотр загруженных файлов"
|
||||
}
|
||||
},
|
||||
"th" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "เรียกดูไฟล์ที่ดาวน์โหลด"
|
||||
}
|
||||
},
|
||||
"uk" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "Переглянути завантажені файли"
|
||||
}
|
||||
},
|
||||
"zh-Hans" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "浏览已下载的文件"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"Cancel" : {
|
||||
"extractionState" : "manual",
|
||||
"localizations" : {
|
||||
|
||||
@@ -13,8 +13,15 @@ struct ContentView: View {
|
||||
var body: some View {
|
||||
AppRootView(isPlus: .constant(true), phoneView: {
|
||||
DeviceListView()
|
||||
.environment(\.sheetActive, isShareExtension())
|
||||
}, settingsView: {
|
||||
EmptyView()
|
||||
CustomSection {
|
||||
LUIButton {
|
||||
SaveFilesManager.shared.openDownloadedFilesFolder()
|
||||
} label: {
|
||||
NavigationLinkLabel(imageName: "folder.fill", text: "BrowseDownloadedFiles")
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -31,7 +38,7 @@ struct DeviceListView: View {
|
||||
|
||||
var body: some View {
|
||||
|
||||
NavigationSubView(header: "QuickDrop ") {
|
||||
NavigationSubView(header: "QuickDrop ", navigationBarLayout: isShareExtension() ? .SmallOnlyAlways : .Default) {
|
||||
|
||||
VStack(alignment: .leading, spacing: 8) {
|
||||
|
||||
@@ -117,7 +124,14 @@ struct DeviceListView: View {
|
||||
}
|
||||
.padding(.vertical, 16)
|
||||
}
|
||||
.navigationBarItems(trailing: LUISettingsButton())
|
||||
.navigationBarItems(trailing: ZStack {
|
||||
if isShareExtension() {
|
||||
XButton(action: { NearbyConnectionManager.shared.attachments?.closeView?() })
|
||||
}
|
||||
else {
|
||||
LUISettingsButton()
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -176,6 +190,15 @@ struct DeviceButton: View {
|
||||
}
|
||||
|
||||
|
||||
func isShareExtension() -> Bool {
|
||||
#if EXTENSION
|
||||
return true
|
||||
#else
|
||||
return false
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
//extension DeviceListView {
|
||||
// static var preview: DeviceListView {
|
||||
// let model = SendModel()
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
import UIKit
|
||||
import SwiftUI
|
||||
import LUI
|
||||
|
||||
class ShareViewController: UIViewController {
|
||||
override func viewDidLoad() {
|
||||
@@ -27,6 +28,9 @@ class ShareViewController: UIViewController {
|
||||
}
|
||||
})
|
||||
|
||||
// skip introduction for share extension
|
||||
LUISettings.sharedInstance.appLaunchedBefore = true
|
||||
|
||||
// Replace with your app’s SwiftUI entry view
|
||||
let contentView = ContentView()
|
||||
|
||||
|
||||
Reference in new issue
Block a user