Merge branch 'eb/nseAvatarDonationUpdate'

This commit is contained in:
Eugene Bistolas 2021-08-27 10:03:58 -10:00
commit 82c19348d2
3 changed files with 31 additions and 18 deletions

View File

@ -226,22 +226,42 @@ class UserNotificationPresenterAdaptee: NSObject, NotificationPresenterAdaptee {
}
var contentToUse: UNNotificationContent = content
let postNotification = {
let request = UNNotificationRequest(identifier: notificationIdentifier, content: contentToUse, trigger: trigger)
if DebugFlags.internalLogging {
Logger.info("presenting notification with identifier: \(notificationIdentifier)")
}
self.notificationCenter.add(request) { (error: Error?) in
if let error = error {
owsFailDebug("Error: \(error)")
return
}
}
}
#if swift(>=5.5) // TODO Temporary for Xcode 12 support.
if #available(iOS 15, *), let interaction = interaction {
if DebugFlags.internalLogging {
Logger.info("Will donate interaction")
}
let group = DispatchGroup()
group.enter()
interaction.donate(completion: { error in
if DebugFlags.internalLogging {
Logger.info("Did donate interaction")
}
guard let error = error else {
if DebugFlags.internalLogging { Logger.info("Did donate interaction") }
group.leave()
if let error = error {
owsFailDebug("Failed to donate incoming message intent \(error)")
return
}
owsFailDebug("Failed to donate incoming message intent \(error)")
})
if case .timedOut = group.wait(timeout: .now() + 1.0) {
Logger.warn("Timed out donating intent")
}
if DebugFlags.internalLogging {
Logger.info("Will update notification content with intent")
}
@ -256,20 +276,13 @@ class UserNotificationPresenterAdaptee: NSObject, NotificationPresenterAdaptee {
owsFailDebug("Failed to update UNNotificationContent for comm style notification")
}
}
postNotification()
}
#else
postNotification()
#endif
let request = UNNotificationRequest(identifier: notificationIdentifier, content: contentToUse, trigger: trigger)
if DebugFlags.internalLogging {
Logger.info("presenting notification with identifier: \(notificationIdentifier)")
}
notificationCenter.add(request) { (error: Error?) in
if let error = error {
owsFailDebug("Error: \(error)")
return
}
}
}
private var pendingCancelations = Set<PendingCancelation>() {

View File

@ -214,7 +214,7 @@ class GRDBFullTextSearchFinder: NSObject {
private static let serialQueue = DispatchQueue(label: "org.signal.fts")
// This should only be accessed on serialQueue.
private static let ftsCache = LRUCache<String, String>(maxSize: 128)
private static let ftsCache = LRUCache<String, String>(maxSize: 128, nseMaxSize: 16)
private class func cacheKey(collection: String, uniqueId: String) -> String {
return "\(collection).\(uniqueId)"

View File

@ -14,7 +14,7 @@ public class OWSFormat: NSObject {
// user changes a system setting that would affect
// formatting behavior.
private static let shortNameComponentsCache = LRUCache<String, String>(maxSize: 512,
nseMaxSize: 0,
nseMaxSize: 64,
shouldEvacuateInBackground: true)
@objc