Skip to content

Commit

Permalink
Restore pasteboard
Browse files Browse the repository at this point in the history
  • Loading branch information
bourvill committed Feb 8, 2024
1 parent 0a7c35d commit 39d05c4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import SwiftUI

#if os(iOS)
@MainActor
struct HapticNotificationButtonStyle: ButtonStyle {
let feedbackType: UINotificationFeedbackGenerator.FeedbackType
func makeBody(configuration: Configuration) -> some View {
Expand Down
21 changes: 11 additions & 10 deletions App/Features/PasteBoard/PasteBoardViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import SharedLib
import UIKit

@MainActor
class PasteBoardViewModel: ObservableObject {
@Published var showPasteBoardView: Bool = false {
willSet {
Expand All @@ -23,16 +24,16 @@
private var cancellableNotification: AnyCancellable?

init() {
// cancellableNotification = NotificationCenter.default.publisher(for: UIApplication.didBecomeActiveNotification)
// .map { _ -> Bool in
// guard let pasteBoardUrl = UIPasteboard.general.url,
// pasteBoardUrl.absoluteString != WallabagUserDefaults.previousPasteBoardUrl
// else {
// return false
// }
// return true
// }
// .assign(to: \.showPasteBoardView, on: self)
cancellableNotification = NotificationCenter.default.publisher(for: UIApplication.didBecomeActiveNotification)
.map { _ -> Bool in
guard let pasteBoardUrl = UIPasteboard.general.url,
pasteBoardUrl.absoluteString != WallabagUserDefaults.previousPasteBoardUrl
else {
return false
}
return true
}
.assign(to: \.showPasteBoardView, on: self)
}

deinit {
Expand Down

0 comments on commit 39d05c4

Please sign in to comment.