mirror of
https://github.com/leonboe1/QuickDrop.git
synced 2026-11-20 05:16:02 +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)
|
NSWorkspace.shared.activateFileViewerSelecting(filesFinishedDownloadingSinceLastRun)
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
openDownloadedFilesFolder()
|
||||||
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
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Clear the list of finished files
|
// Clear the list of finished files
|
||||||
@@ -144,6 +134,20 @@ public class SaveFilesManager {
|
|||||||
stopAccessingSecurityScopedResource()
|
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() {
|
public func stopAccessingSecurityScopedResource() {
|
||||||
guard let url = securityScopeUrl else {
|
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" : {
|
"Cancel" : {
|
||||||
"extractionState" : "manual",
|
"extractionState" : "manual",
|
||||||
"localizations" : {
|
"localizations" : {
|
||||||
|
|||||||
@@ -13,8 +13,15 @@ struct ContentView: View {
|
|||||||
var body: some View {
|
var body: some View {
|
||||||
AppRootView(isPlus: .constant(true), phoneView: {
|
AppRootView(isPlus: .constant(true), phoneView: {
|
||||||
DeviceListView()
|
DeviceListView()
|
||||||
|
.environment(\.sheetActive, isShareExtension())
|
||||||
}, settingsView: {
|
}, 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 {
|
var body: some View {
|
||||||
|
|
||||||
NavigationSubView(header: "QuickDrop ") {
|
NavigationSubView(header: "QuickDrop ", navigationBarLayout: isShareExtension() ? .SmallOnlyAlways : .Default) {
|
||||||
|
|
||||||
VStack(alignment: .leading, spacing: 8) {
|
VStack(alignment: .leading, spacing: 8) {
|
||||||
|
|
||||||
@@ -117,7 +124,14 @@ struct DeviceListView: View {
|
|||||||
}
|
}
|
||||||
.padding(.vertical, 16)
|
.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 {
|
//extension DeviceListView {
|
||||||
// static var preview: DeviceListView {
|
// static var preview: DeviceListView {
|
||||||
// let model = SendModel()
|
// let model = SendModel()
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
import LUI
|
||||||
|
|
||||||
class ShareViewController: UIViewController {
|
class ShareViewController: UIViewController {
|
||||||
override func viewDidLoad() {
|
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
|
// Replace with your app’s SwiftUI entry view
|
||||||
let contentView = ContentView()
|
let contentView = ContentView()
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user