Display the dismiss button on Macos
This commit is contained in:
@ -9,6 +9,8 @@ import Foundation
|
||||
import SwiftUI
|
||||
|
||||
struct MiniShareExtensionView: View {
|
||||
@StateObject var viewModel: ShareExtensionViewModel
|
||||
@StateObject var labelsViewModel: LabelsViewModel
|
||||
let extensionContext: NSExtensionContext?
|
||||
|
||||
@State var showToast = true
|
||||
|
||||
@ -244,6 +244,14 @@ public struct ShareExtensionView: View {
|
||||
}
|
||||
}
|
||||
|
||||
var displayDismiss: Bool {
|
||||
#if os(iOS)
|
||||
if UIDevice.isIPhone {
|
||||
return true
|
||||
}
|
||||
#endif
|
||||
return false
|
||||
}
|
||||
public var body: some View {
|
||||
VStack(alignment: .leading, spacing: 15) {
|
||||
titleBar
|
||||
@ -255,21 +263,19 @@ public struct ShareExtensionView: View {
|
||||
|
||||
HStack {
|
||||
Spacer()
|
||||
#if os(iOS)
|
||||
if UIDevice.isIPad {
|
||||
Button(action: {
|
||||
extensionContext?.completeRequest(returningItems: [], completionHandler: nil)
|
||||
}, label: {
|
||||
Text("Dismiss")
|
||||
.font(Font.system(size: 17, weight: .semibold))
|
||||
.tint(Color.appGrayText)
|
||||
.padding(20)
|
||||
})
|
||||
.frame(height: 50)
|
||||
.cornerRadius(24)
|
||||
.padding(.bottom, 15)
|
||||
}
|
||||
#endif
|
||||
if displayDismiss {
|
||||
Button(action: {
|
||||
extensionContext?.completeRequest(returningItems: [], completionHandler: nil)
|
||||
}, label: {
|
||||
Text("Dismiss")
|
||||
.font(Font.system(size: 17, weight: .semibold))
|
||||
.tint(Color.appGrayText)
|
||||
.padding(20)
|
||||
})
|
||||
.frame(height: 50)
|
||||
.cornerRadius(24)
|
||||
.padding(.bottom, 15)
|
||||
}
|
||||
Button(action: {
|
||||
viewModel.handleReadNowAction(extensionContext: extensionContext)
|
||||
}, label: {
|
||||
|
||||
@ -89,39 +89,61 @@ struct WelcomeView: View {
|
||||
.sheet(isPresented: $showPrivacyModal) {
|
||||
NavigationView {
|
||||
BasicWebAppView.privacyPolicyWebView(baseURL: dataService.appEnvironment.webAppBaseURL)
|
||||
#if os(iOS)
|
||||
.toolbar {
|
||||
#if os(iOS)
|
||||
ToolbarItem(placement: .navigationBarTrailing) {
|
||||
Button(
|
||||
action: {
|
||||
showPrivacyModal = false
|
||||
},
|
||||
label: {
|
||||
Text(LocalText.genericClose)
|
||||
}
|
||||
)
|
||||
}
|
||||
#endif
|
||||
ToolbarItem(placement: .navigationBarTrailing) {
|
||||
Button(
|
||||
action: {
|
||||
showPrivacyModal = false
|
||||
},
|
||||
label: {
|
||||
Text(LocalText.genericClose)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
#else
|
||||
.toolbar {
|
||||
Button(
|
||||
action: {
|
||||
showPrivacyModal = false
|
||||
},
|
||||
label: {
|
||||
Text(LocalText.genericClose)
|
||||
}
|
||||
)
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
.sheet(isPresented: $showTermsModal) {
|
||||
NavigationView {
|
||||
BasicWebAppView.termsConditionsWebView(baseURL: dataService.appEnvironment.webAppBaseURL)
|
||||
#if os(iOS)
|
||||
.toolbar {
|
||||
#if os(iOS)
|
||||
ToolbarItem(placement: .navigationBarTrailing) {
|
||||
Button(
|
||||
action: {
|
||||
showTermsModal = false
|
||||
},
|
||||
label: {
|
||||
Text(LocalText.genericClose)
|
||||
}
|
||||
)
|
||||
}
|
||||
#endif
|
||||
ToolbarItem(placement: .navigationBarTrailing) {
|
||||
Button(
|
||||
action: {
|
||||
showTermsModal = false
|
||||
},
|
||||
label: {
|
||||
Text(LocalText.genericClose)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
#else
|
||||
.toolbar {
|
||||
Button(
|
||||
action: {
|
||||
showTermsModal = false
|
||||
},
|
||||
label: {
|
||||
Text(LocalText.genericClose)
|
||||
}
|
||||
)
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
.sheet(isPresented: $showAboutPage) {
|
||||
|
||||
@ -66,7 +66,7 @@ import Views
|
||||
let viewModel = ShareExtensionViewModel()
|
||||
|
||||
override func loadView() {
|
||||
view = NSView(frame: NSRect(x: 0, y: 0, width: 400, height: 600))
|
||||
view = NSView(frame: NSRect(x: 0, y: 0, width: 400, height: 400))
|
||||
}
|
||||
|
||||
override func viewDidLoad() {
|
||||
|
||||
Reference in New Issue
Block a user