feat: integrate JPush notifications

This commit is contained in:
2026-07-20 15:56:06 +08:00
parent 573c9a42ae
commit e7f1d777dd
50 changed files with 6552 additions and 2499 deletions
+30
View File
@@ -0,0 +1,30 @@
import Foundation
/// 极光 Registration ID 上报能力,允许推送管理器注入测试替身。
@MainActor
protocol PushRegistrationServing: AnyObject {
/// 将当前设备的极光 Registration ID 绑定到已登录业务账号。
func registerJPushID(_ registrationID: String) async throws
}
/// 推送 API,复用 Android 当前使用的 Registration ID 上报接口。
@MainActor
final class PushAPI: PushRegistrationServing {
private let client: APIClient
/// 使用共享网络客户端创建推送 API。
init(client: APIClient) {
self.client = client
}
/// 上报极光 Registration ID;后端字段名沿用 `jpush_reg_id`。
func registerJPushID(_ registrationID: String) async throws {
let _: EmptyPayload = try await client.send(
APIRequest(
method: .post,
path: "/api/app/user/register-jpush-id",
queryItems: [URLQueryItem(name: "jpush_reg_id", value: registrationID)]
)
)
}
}