mirror of
https://github.com/Finb/Bark.git
synced 2025-12-08 21:36:01 +00:00
下拉推送可以复制全部内容
This commit is contained in:
parent
a57fdaade6
commit
15f08940b4
@ -155,6 +155,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
|
||||
func presentController() {
|
||||
let alert = (userInfo["aps"] as? [String: Any])?["alert"] as? [String: Any]
|
||||
let title = alert?["title"] as? String
|
||||
let subtitle = alert?["subtitle"] as? String
|
||||
let body = alert?["body"] as? String
|
||||
let url: URL? = {
|
||||
if let url = userInfo["url"] as? String {
|
||||
@ -182,11 +183,14 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
|
||||
if let title = title {
|
||||
shareContent += "\(title)\n"
|
||||
}
|
||||
if let subtitle = subtitle {
|
||||
shareContent += "\(subtitle)\n"
|
||||
}
|
||||
if let body = body {
|
||||
shareContent += "\(body)\n"
|
||||
}
|
||||
for (key, value) in userInfo {
|
||||
if ["aps", "title", "body", "url"].contains((key as? String) ?? "") {
|
||||
if ["aps", "title", "subtitle", "body", "url"].contains((key as? String) ?? "") {
|
||||
continue
|
||||
}
|
||||
shareContent += "\(key): \(value) \n"
|
||||
|
||||
@ -78,7 +78,21 @@ class NotificationViewController: UIViewController, UNNotificationContentExtensi
|
||||
if let copy = userInfo["copy"] as? String {
|
||||
UIPasteboard.general.string = copy
|
||||
} else {
|
||||
UIPasteboard.general.string = response.notification.request.content.body
|
||||
var content = ""
|
||||
if !response.notification.request.content.title.isEmpty {
|
||||
content += "\(response.notification.request.content.title)\n"
|
||||
}
|
||||
if !response.notification.request.content.subtitle.isEmpty {
|
||||
content += "\(response.notification.request.content.subtitle)\n"
|
||||
}
|
||||
if !response.notification.request.content.body.isEmpty {
|
||||
content += "\(response.notification.request.content.body)\n"
|
||||
}
|
||||
if let url = userInfo["url"] as? String, !url.isEmpty {
|
||||
content += "\(url)\n"
|
||||
}
|
||||
content = content.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||
UIPasteboard.general.string = content
|
||||
}
|
||||
|
||||
showTips(text: NSLocalizedString("Copy", comment: ""))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user