mirror of
https://github.com/Finb/Bark.git
synced 2025-12-08 21:36:01 +00:00
修复可能的闪退
This commit is contained in:
parent
11b00b8dea
commit
152c9842f4
@ -216,10 +216,10 @@ class MessageListViewController: BaseViewController<MessageListViewModel> {
|
||||
alertController.addAction(copyAction)
|
||||
alertController.addAction(cancelAction)
|
||||
if UIDevice.current.userInterfaceIdiom == .pad {
|
||||
alertController.modalPresentationStyle = .popover
|
||||
if let cell = self.tableView.cellForRow(at: indexPath) {
|
||||
alertController.popoverPresentationController?.sourceView = self.tableView
|
||||
alertController.popoverPresentationController?.sourceRect = cell.frame
|
||||
alertController.modalPresentationStyle = .popover
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -130,10 +130,10 @@ class MessageSettingsViewController: BaseViewController<MessageSettingsViewModel
|
||||
|
||||
alertController.addAction(UIAlertAction(title: NSLocalizedString("Cancel"), style: .cancel, handler: nil))
|
||||
if UIDevice.current.userInterfaceIdiom == .pad {
|
||||
alertController.modalPresentationStyle = .popover
|
||||
if let cell = strongSelf.tableView.cellForRow(at: indexPath) {
|
||||
alertController.popoverPresentationController?.sourceView = strongSelf.tableView
|
||||
alertController.popoverPresentationController?.sourceRect = cell.frame
|
||||
alertController.modalPresentationStyle = .popover
|
||||
}
|
||||
}
|
||||
strongSelf.present(alertController, animated: true, completion: nil)
|
||||
|
||||
@ -171,10 +171,10 @@ class ServerListViewController: BaseViewController<ServerListViewModel> {
|
||||
alertController.addAction(UIAlertAction(title: NSLocalizedString("Cancel"), style: .cancel, handler: nil))
|
||||
|
||||
if UIDevice.current.userInterfaceIdiom == .pad {
|
||||
alertController.modalPresentationStyle = .popover
|
||||
if let cell = self.tableView.cellForRow(at: indexPath) {
|
||||
alertController.popoverPresentationController?.sourceView = self.tableView
|
||||
alertController.popoverPresentationController?.sourceRect = cell.frame
|
||||
alertController.modalPresentationStyle = .popover
|
||||
}
|
||||
}
|
||||
self.navigationController?.present(alertController, animated: true, completion: nil)
|
||||
|
||||
@ -15,7 +15,8 @@ class IconProcessor: NotificationContentProcessor {
|
||||
let userInfo = bestAttemptContent.userInfo
|
||||
|
||||
guard let imageUrl = userInfo["icon"] as? String,
|
||||
let imageFileUrl = await ImageDownloader.downloadImage(imageUrl)
|
||||
let imageFileUrl = await ImageDownloader.downloadImage(imageUrl),
|
||||
let imageData = NSData(contentsOfFile: imageFileUrl)
|
||||
else {
|
||||
return bestAttemptContent
|
||||
}
|
||||
@ -23,7 +24,7 @@ class IconProcessor: NotificationContentProcessor {
|
||||
var personNameComponents = PersonNameComponents()
|
||||
personNameComponents.nickname = bestAttemptContent.title
|
||||
|
||||
let avatar = INImage(imageData: NSData(contentsOfFile: imageFileUrl)! as Data)
|
||||
let avatar = INImage(imageData: imageData as Data)
|
||||
let senderPerson = INPerson(
|
||||
personHandle: INPersonHandle(value: "", type: .unknown),
|
||||
nameComponents: personNameComponents,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user