fix(push): normalize OPPO action parameters
这个提交包含在:
父节点
fd94a3c499
当前提交
dfd7fdeb6b
@ -65,7 +65,7 @@ public class OppoPushProvider implements PushProvider {
|
|||||||
notification.put("off_line", true);
|
notification.put("off_line", true);
|
||||||
notification.put("off_line_ttl", 259200);
|
notification.put("off_line_ttl", 259200);
|
||||||
if (payload != null && !payload.isBlank()) {
|
if (payload != null && !payload.isBlank()) {
|
||||||
notification.put("action_parameters", payload);
|
notification.put("action_parameters", normalizeActionParameters(payload));
|
||||||
}
|
}
|
||||||
String channelId = options != null && options.channelId() != null && !options.channelId().isBlank()
|
String channelId = options != null && options.channelId() != null && !options.channelId().isBlank()
|
||||||
? options.channelId()
|
? options.channelId()
|
||||||
@ -139,6 +139,22 @@ public class OppoPushProvider implements PushProvider {
|
|||||||
return java.util.HexFormat.of().formatHex(digest);
|
return java.util.HexFormat.of().formatHex(digest);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String normalizeActionParameters(String payload) throws Exception {
|
||||||
|
JsonNode parsed = runCatchingJson(payload);
|
||||||
|
if (parsed != null && parsed.isObject()) {
|
||||||
|
return objectMapper.writeValueAsString(parsed);
|
||||||
|
}
|
||||||
|
return objectMapper.writeValueAsString(Map.of("payload", payload));
|
||||||
|
}
|
||||||
|
|
||||||
|
private JsonNode runCatchingJson(String value) {
|
||||||
|
try {
|
||||||
|
return objectMapper.readTree(value);
|
||||||
|
} catch (Exception ignored) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private String resolveConfig(String appKey, String key) {
|
private String resolveConfig(String appKey, String key) {
|
||||||
JsonNode config = configClient.loadServiceConfig(appKey, "ANDROID", "PUSH")
|
JsonNode config = configClient.loadServiceConfig(appKey, "ANDROID", "PUSH")
|
||||||
.map(node -> node.path("vendors").path("oppo"))
|
.map(node -> node.path("vendors").path("oppo"))
|
||||||
|
|||||||
正在加载...
在新工单中引用
屏蔽一个用户