This commit is contained in:
DDIsFriend
2023-08-30 18:35:34 +08:00
parent 456b879a00
commit cce7060345
11 changed files with 163 additions and 5 deletions
Vendored
BIN
View File
Binary file not shown.
@@ -2636,8 +2636,8 @@
filePath = "OrderSchedulingNotificationService/NotificationService.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "47"
endingLineNumber = "47"
startingLineNumber = "57"
endingLineNumber = "57"
landmarkName = "didReceive(_:withContentHandler:)"
landmarkType = "7">
</BreakpointContent>
@@ -3004,5 +3004,132 @@
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "8F63E486-6C7E-43D3-B7DC-0EC3E28F533D"
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "OrderSchedulingNotificationService/NotificationService.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "24"
endingLineNumber = "24"
landmarkName = "didReceive(_:withContentHandler:)"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "ED9EFA7A-7FCA-4E48-822A-321E00CD9178"
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "OrderScheduling/Global/GroupData/GroupData.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "22"
endingLineNumber = "22"
landmarkName = "parserAlertToDictionary(userInfo:)"
landmarkType = "7">
<Locations>
<Location
uuid = "ED9EFA7A-7FCA-4E48-822A-321E00CD9178 - c4488d2259840bec"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "OrderScheduling.GroupData.parserAlertToString(userInfo: Swift.Optional&lt;Swift.Dictionary&lt;Swift.AnyHashable, Any&gt;&gt;) -&gt; Swift.Optional&lt;Swift.String&gt;"
moduleName = "OrderScheduling"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/zd/Desktop/%E4%B8%AD%E9%81%93%E6%95%91%E6%8F%B4/OrderScheduling/OrderScheduling/Global/GroupData/GroupData.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "24"
endingLineNumber = "24"
offsetFromSymbolStart = "97">
</Location>
<Location
uuid = "ED9EFA7A-7FCA-4E48-822A-321E00CD9178 - 7671f3e233c182e2"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "OrderSchedulingNotificationService.GroupData.parserAlertToDictionary(userInfo: Swift.Optional&lt;Swift.Dictionary&lt;Swift.AnyHashable, Any&gt;&gt;) -&gt; Swift.Optional&lt;Swift.Dictionary&lt;Swift.String, Swift.String&gt;&gt;"
moduleName = "OrderSchedulingNotificationService"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/zd/Desktop/%E4%B8%AD%E9%81%93%E6%95%91%E6%8F%B4/OrderScheduling/OrderScheduling/Global/GroupData/GroupData.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "22"
endingLineNumber = "22"
offsetFromSymbolStart = "1376">
</Location>
</Locations>
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "1274D9D9-A9D2-4F3F-883A-A8FB6AAFB6E9"
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "OrderScheduling/Global/GroupData/GroupData.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "25"
endingLineNumber = "25"
landmarkName = "parserAlertToDictionary(userInfo:)"
landmarkType = "7">
<Locations>
<Location
uuid = "1274D9D9-A9D2-4F3F-883A-A8FB6AAFB6E9 - c4488d2259840bcd"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "OrderScheduling.GroupData.parserAlertToString(userInfo: Swift.Optional&lt;Swift.Dictionary&lt;Swift.AnyHashable, Any&gt;&gt;) -&gt; Swift.Optional&lt;Swift.String&gt;"
moduleName = "OrderScheduling"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/zd/Desktop/%E4%B8%AD%E9%81%93%E6%95%91%E6%8F%B4/OrderScheduling/OrderScheduling/Global/GroupData/GroupData.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "25"
endingLineNumber = "25"
offsetFromSymbolStart = "473">
</Location>
<Location
uuid = "1274D9D9-A9D2-4F3F-883A-A8FB6AAFB6E9 - c4488d2259840bcd"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "OrderScheduling.GroupData.parserAlertToString(userInfo: Swift.Optional&lt;Swift.Dictionary&lt;Swift.AnyHashable, Any&gt;&gt;) -&gt; Swift.Optional&lt;Swift.String&gt;"
moduleName = "OrderScheduling"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/zd/Desktop/%E4%B8%AD%E9%81%93%E6%95%91%E6%8F%B4/OrderScheduling/OrderScheduling/Global/GroupData/GroupData.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "25"
endingLineNumber = "25"
offsetFromSymbolStart = "662">
</Location>
<Location
uuid = "1274D9D9-A9D2-4F3F-883A-A8FB6AAFB6E9 - 7671f3e233c1828d"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "OrderSchedulingNotificationService.GroupData.parserAlertToDictionary(userInfo: Swift.Optional&lt;Swift.Dictionary&lt;Swift.AnyHashable, Any&gt;&gt;) -&gt; Swift.Optional&lt;Swift.Dictionary&lt;Swift.String, Swift.String&gt;&gt;"
moduleName = "OrderSchedulingNotificationService"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/zd/Desktop/%E4%B8%AD%E9%81%93%E6%95%91%E6%8F%B4/OrderScheduling/OrderScheduling/Global/GroupData/GroupData.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "25"
endingLineNumber = "25"
offsetFromSymbolStart = "1508">
</Location>
</Locations>
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
</Bucket>
BIN
View File
Binary file not shown.
@@ -13,10 +13,31 @@ open class GroupData {
public static let `default` = GroupData()
let groudUserDefault = UserDefaults(suiteName: GROUPID)
//
func parserAlertToDictionary(userInfo:[AnyHashable:Any]?) -> Dictionary<String,String>? {
let aps = userInfo?[pushNoti_aps_key] as? [String:Any]
if let data = (aps?[pushNoti_alert_key] as? String)?.data(using: .utf8) {
let dict = try? JSONSerialization.jsonObject(with: data, options: []) as? [String: String]
return dict
}
return nil
}
func parserAlertToString(userInfo:[AnyHashable:Any]?) -> String? {
let aps = userInfo?[pushNoti_aps_key] as? [String:Any]
let string = aps?[pushNoti_alert_key] as? String
return string
}
//
func isOrderPushNotification(userInfo:[AnyHashable:Any]?) -> Bool {
if let userInfo {
if let aps = userInfo[pushNoti_aps_key] as? [String:Any], let dict = (aps[pushNoti_alert_key] as? Dictionary<String, Any>), (dict[pushNoti_title_key] as? String) == pushNoti_newOrder_key {
if let dict = parserAlertToDictionary(userInfo: userInfo), dict[pushNoti_title_key] == pushNoti_newOrder_key {
return true
}
if let string = parserAlertToString(userInfo: userInfo), string.contains(pushNoti_newOrder_key) == true {
return true
}
}
@@ -19,9 +19,19 @@ class NotificationService: UNNotificationServiceExtension {
if let bestAttemptContent = bestAttemptContent {
// Modify the notification content here...
// bestAttemptContent.title = "\(bestAttemptContent.title) [modified]"
let userInfo = bestAttemptContent.userInfo
if let dict = GROUP.parserAlertToDictionary(userInfo: userInfo) {
if let title = dict[pushNoti_title_key] {
bestAttemptContent.title = title
}
if let body = dict[pushNoti_body_key] {
bestAttemptContent.body = body
}
}else if let body = GROUP.parserAlertToString(userInfo: userInfo) {
bestAttemptContent.body = body
}
// group
if GROUP.isOrderPushNotification(userInfo: userInfo) == true {
var sound : UNNotificationSound?
Generated Vendored
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
Binary file not shown.
Generated Vendored
BIN
View File
Binary file not shown.
Generated Vendored
BIN
View File
Binary file not shown.