Skip to content

Commit

Permalink
Fix document browser presentation (implemented using SwiftUI now)
Browse files Browse the repository at this point in the history
  • Loading branch information
kean committed Jul 2, 2021
1 parent 4e8993f commit 239e74d
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 11 deletions.
25 changes: 19 additions & 6 deletions Pulse.xcodeproj/xcshareddata/xcschemes/Pulse Demo watchOS.xcscheme
Original file line number Diff line number Diff line change
Expand Up @@ -54,33 +54,46 @@
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<RemoteRunnable
runnableDebuggingMode = "2"
BundleIdentifier = "com.apple.Carousel"
RemotePath = "/Pulse">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "0CEAB3D925FE862D00F09B0F"
BuildableName = "Pulse Demo watchOS.app"
BlueprintName = "Pulse Demo watchOS"
ReferencedContainer = "container:Pulse.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</RemoteRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<RemoteRunnable
runnableDebuggingMode = "2"
BundleIdentifier = "com.apple.Carousel"
RemotePath = "/Pulse">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "0CEAB3D925FE862D00F09B0F"
BuildableName = "Pulse Demo watchOS.app"
BlueprintName = "Pulse Demo watchOS"
ReferencedContainer = "container:Pulse.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</RemoteRunnable>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "0CEAB3D925FE862D00F09B0F"
BuildableName = "Pulse Demo watchOS.app"
BlueprintName = "Pulse Demo watchOS"
ReferencedContainer = "container:Pulse.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
Expand Down
22 changes: 17 additions & 5 deletions Pulse/Sources/PulseUI/Features/Settings/SettingsView-ios.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ struct SettingsView: View {
@ObservedObject var model: SettingsViewModel
@ObservedObject var console: ConsoleViewModel

@State private var isDocumentBrowserPresented = false

var body: some View {
NavigationView {
Form {
Expand All @@ -33,11 +35,7 @@ struct SettingsView: View {
Section {
if #available(iOS 14.0, *) {
Button(action: {
UIViewController.present { dismiss in
let vc = DocumentBrowserViewController(forOpeningContentTypes: [UTType(filenameExtension: "pulse")].compactMap { $0 })
vc.modalPresentationStyle = .fullScreen
return vc
}
isDocumentBrowserPresented = true
}) {
HStack {
Image(systemName: "doc")
Expand All @@ -46,6 +44,9 @@ struct SettingsView: View {
.foregroundColor(Color.primary)
}
}
.fullScreenCover(isPresented: $isDocumentBrowserPresented) {
DocumentBrowser()
}
}

ButtonRemoveAll(action: console.buttonRemoveAllMessagesTapped)
Expand Down Expand Up @@ -77,6 +78,17 @@ struct SettingsView: View {
}
}

@available(iOS 14.0, *)
private struct DocumentBrowser: UIViewControllerRepresentable {
func makeUIViewController(context: Context) -> DocumentBrowserViewController {
DocumentBrowserViewController(forOpeningContentTypes: [UTType(filenameExtension: "pulse")].compactMap { $0 })
}

func updateUIViewController(_ uiViewController: DocumentBrowserViewController, context: Context) {

}
}

// MARK: - Settings

@available(iOS 13.0, *)
Expand Down

0 comments on commit 239e74d

Please sign in to comment.