Skip to content

Commit

Permalink
提高加密推送参数的兼容性
Browse files Browse the repository at this point in the history
close: #263
  • Loading branch information
Finb committed Dec 11, 2024
1 parent 8a2a7fc commit 05d6ada
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions NotificationServiceExtension/Processor/CiphertextProcessor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,17 @@ class CiphertextProcessor: NotificationContentProcessor {

var result: [AnyHashable: Any] = [:]
for (key, val) in map {
// 将key重写为小写
result[key.lowercased()] = val
// 将key重写为小写, 防止用户误输入大小写,全按小写处理
var key = key.lowercased()
// 将 value 全部转换成字符串,因为其他方式传参的结果都是字符串
var val = val

// 如果是数字,转成字符串
if let num = val as? NSNumber {
val = num.stringValue
}

result[key] = val
}
return result
}
Expand Down

0 comments on commit 05d6ada

Please sign in to comment.