Add dismiss on tap outside extension
This commit is contained in:
@ -38,6 +38,12 @@ public class ShareExtensionViewModel: ObservableObject {
|
||||
extensionContext?.completeRequest(returningItems: [], completionHandler: nil)
|
||||
}
|
||||
|
||||
public func dismissExtension(extensionContext: NSExtensionContext?) {
|
||||
if let extensionContext = extensionContext {
|
||||
extensionContext.completeRequest(returningItems: [], completionHandler: nil)
|
||||
}
|
||||
}
|
||||
|
||||
func savePage(extensionContext: NSExtensionContext?) {
|
||||
if let extensionContext = extensionContext {
|
||||
save(extensionContext)
|
||||
|
||||
@ -323,7 +323,7 @@ public struct ShareExtensionView: View {
|
||||
#endif
|
||||
Spacer()
|
||||
Button(action: {
|
||||
extensionContext?.completeRequest(returningItems: [], completionHandler: nil)
|
||||
viewModel.dismissExtension(extensionContext: extensionContext)
|
||||
}, label: {
|
||||
Text("Dismiss")
|
||||
#if os(iOS)
|
||||
|
||||
@ -49,6 +49,8 @@
|
||||
child.didMove(toParent: self)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
#if os(macOS)
|
||||
|
||||
@ -8,13 +8,18 @@ import Views
|
||||
import UIKit
|
||||
|
||||
@objc(ShareExtensionViewController)
|
||||
final class ShareExtensionViewController: UIViewController {
|
||||
final class ShareExtensionViewController: UIViewController, UIGestureRecognizerDelegate {
|
||||
let labelsViewModel = LabelsViewModel()
|
||||
let viewModel = ShareExtensionViewModel()
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
view.backgroundColor = .clear
|
||||
view.backgroundColor = UIColor(white: 1.0, alpha: 0.001)
|
||||
view.isUserInteractionEnabled = true
|
||||
|
||||
let dismissGesture = UITapGestureRecognizer(target: self, action: #selector(self.viewTapped(_:)))
|
||||
dismissGesture.delegate = self
|
||||
view.addGestureRecognizer(dismissGesture)
|
||||
|
||||
if !viewModel.services.authenticator.isLoggedIn,
|
||||
!viewModel.services.dataService.appEnvironment.environmentConfigured
|
||||
@ -60,6 +65,14 @@ import Views
|
||||
)
|
||||
}
|
||||
|
||||
func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldReceive touch: UITouch) -> Bool {
|
||||
return touch.view == gestureRecognizer.view
|
||||
}
|
||||
|
||||
@objc func viewTapped(_ panGesture: UIGestureRecognizer) {
|
||||
viewModel.dismissExtension(extensionContext: extensionContext)
|
||||
}
|
||||
|
||||
func openSheet(_ rootView: AnyView) {
|
||||
let hostingController = UIHostingController(rootView: rootView)
|
||||
|
||||
|
||||
@ -14,8 +14,11 @@ import { unsubscribeDiscoverFeedMutation } from '../../../lib/networking/mutatio
|
||||
import { applyStoredTheme } from '../../../lib/themeUpdater'
|
||||
import { showErrorToast, showSuccessToast } from '../../../lib/toastHelpers'
|
||||
import { formatMessage } from '../../../locales/en/messages'
|
||||
import { useGetDiscoverFeeds } from "../../../lib/networking/queries/useGetDiscoverFeeds"
|
||||
import { UpdateDiscoverFeedInput, updateDiscoverFeedMutation } from "../../../lib/networking/mutations/updateDiscoverFeedMutation"
|
||||
import { useGetDiscoverFeeds } from '../../../lib/networking/queries/useGetDiscoverFeeds'
|
||||
import {
|
||||
UpdateDiscoverFeedInput,
|
||||
updateDiscoverFeedMutation,
|
||||
} from '../../../lib/networking/mutations/updateDiscoverFeedMutation'
|
||||
|
||||
export default function DiscoverFeedsSettings(): JSX.Element {
|
||||
const router = useRouter()
|
||||
@ -53,7 +56,9 @@ export default function DiscoverFeedsSettings(): JSX.Element {
|
||||
async function onDelete(id: string): Promise<void> {
|
||||
const result = await unsubscribeDiscoverFeedMutation(id)
|
||||
if (result) {
|
||||
showSuccessToast('Discover Feed unsubscribed', { position: 'bottom-right' })
|
||||
showSuccessToast('Discover Feed unsubscribed', {
|
||||
position: 'bottom-right',
|
||||
})
|
||||
} else {
|
||||
showErrorToast('Failed to unsubscribe', { position: 'bottom-right' })
|
||||
}
|
||||
@ -74,7 +79,7 @@ export default function DiscoverFeedsSettings(): JSX.Element {
|
||||
suggestionInfo={{
|
||||
title: 'Add RSS and Atom feeds to your Omnivore account',
|
||||
message:
|
||||
'When you add a new feed the last 24hrs of items, or at least one item will be added to your account. Feeds will be checked for updates every hour, and new items will be added to your Following. You can also add feeds to your Library by checking the box below.',
|
||||
'When you add a new feed the last 24hrs of items, or at least one item will be added to your account. Feeds will be checked for updates every four hours, and new items will be added to your Following. You can also add feeds to your Library by checking the box below.',
|
||||
docs: 'https://docs.omnivore.app/using/feeds.html',
|
||||
key: '--settings-feeds-show-help',
|
||||
CTAText: 'Add a feed',
|
||||
|
||||
@ -131,7 +131,7 @@ export default function Rss(): JSX.Element {
|
||||
suggestionInfo={{
|
||||
title: 'Add RSS and Atom feeds to your Omnivore account',
|
||||
message:
|
||||
'When you add a new feed the last 24hrs of items, or at least one item will be added to your account. Feeds will be checked for updates every hour, and new items will be added to your Following. You can also add feeds to your Library by checking the box below.',
|
||||
'When you add a new feed the last 24hrs of items, or at least one item will be added to your account. Feeds will be checked for updates every four hours, and new items will be added to your Following. You can also add feeds to your Library by checking the box below.',
|
||||
docs: 'https://docs.omnivore.app/using/feeds.html',
|
||||
key: '--settings-feeds-show-help',
|
||||
CTAText: 'Add a feed',
|
||||
|
||||
@ -86,7 +86,7 @@
|
||||
font-size: 1.43em !important;
|
||||
}
|
||||
.article-inner-css h3 {
|
||||
font-size: 1.25em !important;
|
||||
font-size: 1.0em !important;
|
||||
}
|
||||
.article-inner-css h4,
|
||||
.article-inner-css h5,
|
||||
|
||||
Reference in New Issue
Block a user