cordova-plugin-pushizo 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +97 -4
- package/package.json +1 -1
- package/plugin.xml +3 -3
- package/src/android/com/pushizo/cordova/PushizoBridgeCore.kt +252 -6
- package/src/android/com/pushizo/cordova/PushizoCordovaPlugin.kt +22 -0
- package/src/ios/PushizoBridgeCore.swift +122 -3
- package/src/ios/PushizoCordovaPlugin.swift +20 -0
- package/types/index.d.ts +12 -0
- package/www/core.d.ts +134 -8
- package/www/core.js +349 -7
- package/www/definitions.d.ts +120 -0
|
@@ -21,9 +21,11 @@ class PushizoCordovaPlugin : CordovaPlugin() {
|
|
|
21
21
|
private val bufferedEvents = ArrayDeque<JSONObject>()
|
|
22
22
|
private var pendingPermission: CallbackContext? = null
|
|
23
23
|
private var pendingLocationPermission: CallbackContext? = null
|
|
24
|
+
private var pendingBackgroundLocationPermission: CallbackContext? = null
|
|
24
25
|
|
|
25
26
|
override fun pluginInitialize() {
|
|
26
27
|
core = PushizoBridgeCore(cordova.activity.applicationContext) { type, payload -> sendEvent(type, payload) }
|
|
28
|
+
core.activityProvider = { cordova.activity }
|
|
27
29
|
core.attachIfInitialized()
|
|
28
30
|
}
|
|
29
31
|
|
|
@@ -32,6 +34,7 @@ class PushizoCordovaPlugin : CordovaPlugin() {
|
|
|
32
34
|
"setEventCallback" -> openEventChannel(callbackContext)
|
|
33
35
|
"requestPermission" -> requestPermission(callbackContext)
|
|
34
36
|
"requestLocationPermission" -> requestLocationPermission(args.optJSONObject(0) ?: JSONObject(), callbackContext)
|
|
37
|
+
"requestBackgroundLocationPermission" -> requestBackgroundLocationPermission(args.optJSONObject(0) ?: JSONObject(), callbackContext)
|
|
35
38
|
else -> return core.handle(action, args.optJSONObject(0) ?: JSONObject(), reply(callbackContext))
|
|
36
39
|
}
|
|
37
40
|
return true
|
|
@@ -103,6 +106,19 @@ class PushizoCordovaPlugin : CordovaPlugin() {
|
|
|
103
106
|
}
|
|
104
107
|
}
|
|
105
108
|
|
|
109
|
+
/**
|
|
110
|
+
* Arka plan konum izni (ADR-0065): açıklama diyaloğu ve manifest denetimi [PushizoBridgeCore] içindedir; "Devam"
|
|
111
|
+
* seçilirse sistem izni [BACKGROUND_LOCATION_REQUEST_CODE] ile istenir, sonuç [onRequestPermissionsResult] ile döner.
|
|
112
|
+
*/
|
|
113
|
+
private fun requestBackgroundLocationPermission(args: JSONObject, callbackContext: CallbackContext) {
|
|
114
|
+
core.requestBackgroundLocationPermission(cordova.activity, args, reply(callbackContext)) { permissions ->
|
|
115
|
+
// Yanıtsız kalan önceki istek güncel izin durumuyla kapatılır.
|
|
116
|
+
val previous = synchronized(lock) { pendingBackgroundLocationPermission.also { pendingBackgroundLocationPermission = callbackContext } }
|
|
117
|
+
previous?.success(core.backgroundLocationPermissionJson())
|
|
118
|
+
cordova.requestPermissions(this, BACKGROUND_LOCATION_REQUEST_CODE, permissions)
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
106
122
|
override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<String>, grantResults: IntArray) {
|
|
107
123
|
when (requestCode) {
|
|
108
124
|
PERMISSION_REQUEST_CODE -> {
|
|
@@ -117,6 +133,11 @@ class PushizoCordovaPlugin : CordovaPlugin() {
|
|
|
117
133
|
val callback = synchronized(lock) { pendingLocationPermission.also { pendingLocationPermission = null } } ?: return
|
|
118
134
|
callback.success(result)
|
|
119
135
|
}
|
|
136
|
+
BACKGROUND_LOCATION_REQUEST_CODE -> {
|
|
137
|
+
val result = core.onBackgroundLocationPermissionResult()
|
|
138
|
+
val callback = synchronized(lock) { pendingBackgroundLocationPermission.also { pendingBackgroundLocationPermission = null } } ?: return
|
|
139
|
+
callback.success(result)
|
|
140
|
+
}
|
|
120
141
|
}
|
|
121
142
|
}
|
|
122
143
|
|
|
@@ -136,6 +157,7 @@ class PushizoCordovaPlugin : CordovaPlugin() {
|
|
|
136
157
|
|
|
137
158
|
companion object {
|
|
138
159
|
private const val PERMISSION_REQUEST_CODE = 0x4854
|
|
160
|
+
private const val BACKGROUND_LOCATION_REQUEST_CODE = 0x4855
|
|
139
161
|
private const val MAX_BUFFERED_EVENTS = 50
|
|
140
162
|
}
|
|
141
163
|
}
|
|
@@ -116,6 +116,14 @@ final class PushizoBridgeCore: NSObject {
|
|
|
116
116
|
Pushizo.Chat.addOpenListener { info in
|
|
117
117
|
Self.active?.emit("chatOpen", info.dictionary)
|
|
118
118
|
}
|
|
119
|
+
// Özellik bayrakları yenilendi → JS `featureFlagsChange`; bildirim kutusu değişti → `inboxChange`
|
|
120
|
+
// (`{ type, itemId?, unreadCount }`). Yerel SDK ikisini de ana iş parçacığında çağırır.
|
|
121
|
+
Pushizo.FeatureFlags.addObserver {
|
|
122
|
+
Self.active?.emit("featureFlagsChange", [:])
|
|
123
|
+
}
|
|
124
|
+
Pushizo.Inbox.addObserver { event in
|
|
125
|
+
Self.active?.emit("inboxChange", event.dictionary)
|
|
126
|
+
}
|
|
119
127
|
}
|
|
120
128
|
|
|
121
129
|
private func onForeground(_ event: HSForegroundEvent) {
|
|
@@ -201,6 +209,7 @@ final class PushizoBridgeCore: NSObject {
|
|
|
201
209
|
config.initializeSdk()
|
|
202
210
|
registerListeners()
|
|
203
211
|
ok()
|
|
212
|
+
case "isInitialized": ok(["initialized": Pushizo.isInitialized])
|
|
204
213
|
case "setConsentGiven": Pushizo.setConsentGiven(args["given"] as? Bool ?? false); ok()
|
|
205
214
|
case "login":
|
|
206
215
|
guard let externalId = string("externalId") else { invalid("externalId gerekli"); return true }
|
|
@@ -209,7 +218,21 @@ final class PushizoBridgeCore: NSObject {
|
|
|
209
218
|
if let message = Pushizo.loginProofError(identityHash: identityHash, jwt: jwt) {
|
|
210
219
|
reply(.failure(code: "NOT_READY", message: message)); return true
|
|
211
220
|
}
|
|
212
|
-
|
|
221
|
+
guard let profile = args["profile"] as? [String: Any] else {
|
|
222
|
+
Pushizo.login(externalId, identityHash: identityHash, jwt: jwt); ok(); return true
|
|
223
|
+
}
|
|
224
|
+
// Profil (isteğe bağlı): yerel `login(_:profile:identityHash:jwt:)` e-posta, telefon ve takma adları girişten önce
|
|
225
|
+
// doğrular (yarım kalmış kimlik değişimi olmaz), profil işlemlerini girişten sonra kuyruğa yazar.
|
|
226
|
+
let userProfile = HSUserProfile(email: Self.nonBlank(profile["email"]), sms: Self.nonBlank(profile["sms"]),
|
|
227
|
+
tags: Self.stringMap(profile["tags"]), aliases: Self.stringMap(profile["aliases"]))
|
|
228
|
+
do {
|
|
229
|
+
try Pushizo.login(externalId, profile: userProfile, identityHash: identityHash, jwt: jwt)
|
|
230
|
+
ok()
|
|
231
|
+
} catch HSError.invalidArgument(let message) {
|
|
232
|
+
invalid(message)
|
|
233
|
+
} catch {
|
|
234
|
+
reply(.failure(code: "NOT_READY", message: Self.notInitialized))
|
|
235
|
+
}
|
|
213
236
|
case "updateUserJwt":
|
|
214
237
|
guard let jwt = string("jwt") else { invalid("jwt gerekli"); return true }
|
|
215
238
|
do {
|
|
@@ -229,6 +252,10 @@ final class PushizoBridgeCore: NSObject {
|
|
|
229
252
|
case "setLanguage":
|
|
230
253
|
guard let code = string("code") else { invalid("code gerekli"); return true }
|
|
231
254
|
Pushizo.User.setLanguage(code); ok()
|
|
255
|
+
// Kullanıcı özelliği: `null` (NSNull) özelliği siler; desteklenmeyen değer yerel SDK'da günlüğe yazılıp yok sayılır.
|
|
256
|
+
case "setUserProperty":
|
|
257
|
+
guard let key = string("key") else { invalid("key gerekli"); return true }
|
|
258
|
+
Pushizo.User.setProperty(key, args["value"]); ok()
|
|
232
259
|
case "addEmail", "removeEmail":
|
|
233
260
|
let email = args["email"] as? String ?? ""
|
|
234
261
|
guard HSContacts.normalizeEmail(email) != nil else { invalid("Geçersiz e-posta adresi."); return true }
|
|
@@ -252,6 +279,16 @@ final class PushizoBridgeCore: NSObject {
|
|
|
252
279
|
HSPreferenceInput(category: $0["category"] as? String ?? "", channel: $0["channel"] as? String, optedIn: $0["optedIn"] as? Bool ?? false)
|
|
253
280
|
}
|
|
254
281
|
inbox(reply) { Self.map(try await Pushizo.User.setPreferences(inputs)) }
|
|
282
|
+
// Reklam kişiselleştirme rızası (ADR-0037): tercih ucundaki ayrılmış `ads_personalization` anahtarı.
|
|
283
|
+
case "setAdsPersonalizationConsent":
|
|
284
|
+
let granted = args["granted"] as? Bool ?? false
|
|
285
|
+
inbox(reply) { Self.map(try await Pushizo.User.setAdsPersonalizationConsent(granted)) }
|
|
286
|
+
case "getConsents":
|
|
287
|
+
inbox(reply) { ["consents": try await Pushizo.User.getConsents().map { Self.map($0) }] }
|
|
288
|
+
// Fire OS ADM yalnızca Android'dedir: iOS'ta etkisiz, hata yok.
|
|
289
|
+
case "registerAdm": ok()
|
|
290
|
+
// Reklam kimliği (IDFA): nil veya sıfır kimlik sunucudaki kaydı siler.
|
|
291
|
+
case "setAdvertisingId": Pushizo.Ads.setAdvertisingId(string("id")); ok()
|
|
255
292
|
|
|
256
293
|
case "getPushSubscription":
|
|
257
294
|
Task {
|
|
@@ -280,6 +317,13 @@ final class PushizoBridgeCore: NSObject {
|
|
|
280
317
|
case "removeGroupedNotifications":
|
|
281
318
|
guard let group = string("group") else { invalid("group gerekli"); return true }
|
|
282
319
|
Pushizo.Notifications.removeGroupedNotifications(group); ok()
|
|
320
|
+
// Uygulama rozeti; bildirim uzantısıyla paylaşılan sayaç da eşitlenir (0 rozeti sıfırlar).
|
|
321
|
+
case "setBadgeCount":
|
|
322
|
+
guard let count = (args["count"] as? NSNumber)?.intValue, count >= 0 else { invalid("count negatif olmayan tam sayı olmalı"); return true }
|
|
323
|
+
Pushizo.Notifications.setBadgeCount(count); ok(["success": true])
|
|
324
|
+
// Uygulama simgesindeki güncel rozet (UIKit; ana iş parçacığında okunur).
|
|
325
|
+
case "getBadgeCount":
|
|
326
|
+
DispatchQueue.main.async { ok(["count": UIApplication.shared.applicationIconBadgeNumber]) }
|
|
283
327
|
case "setForegroundHandlerEnabled": foregroundHandlerEnabled = args["enabled"] as? Bool ?? false; ok()
|
|
284
328
|
case "displayNotification":
|
|
285
329
|
guard let id = string("notificationId") else { invalid("notificationId gerekli"); return true }
|
|
@@ -292,7 +336,9 @@ final class PushizoBridgeCore: NSObject {
|
|
|
292
336
|
|
|
293
337
|
case "sendEvent":
|
|
294
338
|
guard let name = string("name") else { invalid("name gerekli"); return true }
|
|
295
|
-
|
|
339
|
+
// `eventId` (isteğe bağlı) tekilleştirme kimliğidir; biçim geçersizse yerel SDK kendi kimliğini üretir.
|
|
340
|
+
Pushizo.Session.sendEvent(name, properties: args["properties"] as? [String: Any] ?? [:],
|
|
341
|
+
value: (args["value"] as? NSNumber)?.doubleValue, eventId: string("eventId"))
|
|
296
342
|
ok()
|
|
297
343
|
case "setLogLevel": Pushizo.Debug.setLogLevel(Self.logLevel(args["level"] as? String)); ok()
|
|
298
344
|
|
|
@@ -319,6 +365,24 @@ final class PushizoBridgeCore: NSObject {
|
|
|
319
365
|
case "inboxUnreadCount":
|
|
320
366
|
inbox(reply) { ["unreadCount": try await Pushizo.Inbox.unreadCount()] }
|
|
321
367
|
|
|
368
|
+
// İçerik kartları (ADR-0082).
|
|
369
|
+
case "contentCardsList":
|
|
370
|
+
let limit = (args["limit"] as? NSNumber)?.intValue ?? 50
|
|
371
|
+
inbox(reply) { Self.map(try await Pushizo.ContentCards.list(limit: limit)) }
|
|
372
|
+
case "contentCardEvent":
|
|
373
|
+
guard let id = string("id") else { invalid("id gerekli"); return true }
|
|
374
|
+
let event = string("event")
|
|
375
|
+
guard event == "impression" || event == "click" || event == "dismiss" else {
|
|
376
|
+
invalid("Kart olayı impression, click veya dismiss olmalı"); return true
|
|
377
|
+
}
|
|
378
|
+
inbox(reply) {
|
|
379
|
+
let card: HSContentCard
|
|
380
|
+
if event == "impression" { card = try await Pushizo.ContentCards.logImpression(id) }
|
|
381
|
+
else if event == "click" { card = try await Pushizo.ContentCards.logClick(id) }
|
|
382
|
+
else { card = try await Pushizo.ContentCards.dismiss(id) }
|
|
383
|
+
return Self.map(card)
|
|
384
|
+
}
|
|
385
|
+
|
|
322
386
|
// Konum (v2 Faz 17b; yalnızca ön plan): yerel SDK başlatılmadan çağrılırsa sessizce yok sayılmaz, NOT_READY döner.
|
|
323
387
|
case "setLocationShared":
|
|
324
388
|
guard Pushizo.isInitialized else { reply(.failure(code: "NOT_READY", message: Self.notInitialized)); return true }
|
|
@@ -328,12 +392,24 @@ final class PushizoBridgeCore: NSObject {
|
|
|
328
392
|
guard Pushizo.isInitialized else { reply(.failure(code: "NOT_READY", message: Self.notInitialized)); return true }
|
|
329
393
|
// Açıklama uyarısı + `requestWhenInUseAuthorization`; sonuç ana iş parçacığında döner.
|
|
330
394
|
Pushizo.Location.requestPermission(rationale: string("rationale")) { granted in ok(["permission": granted]) }
|
|
331
|
-
//
|
|
395
|
+
// İzin durumu yerel SDK'dan okunur ("kullanırken" veya "her zaman" = ön plan, "her zaman" = arka plan); istem açmaz.
|
|
396
|
+
case "getLocationPermission":
|
|
397
|
+
ok(["permission": Pushizo.Location.permissionGranted, "background": Pushizo.Location.backgroundPermissionGranted])
|
|
398
|
+
case "requestBackgroundLocationPermission":
|
|
399
|
+
guard Pushizo.isInitialized else { reply(.failure(code: "NOT_READY", message: Self.notInitialized)); return true }
|
|
400
|
+
// "Her zaman" izni (Android arka plan izninin karşılığı; `rationale` iOS'ta kullanılmaz). Sonuç ana iş parçacığında döner.
|
|
401
|
+
Pushizo.Location.requestAlwaysPermission { granted in ok(["permission": granted]) }
|
|
402
|
+
// Arka plan bölge izleme (ADR-0065): varsayılan kapalı; Info.plist'e izin eklenmez.
|
|
332
403
|
case "setGeofencingEnabled":
|
|
333
404
|
guard Pushizo.isInitialized else { reply(.failure(code: "NOT_READY", message: Self.notInitialized)); return true }
|
|
334
405
|
Pushizo.Location.setGeofencingEnabled(args["enabled"] as? Bool ?? false); ok()
|
|
335
406
|
case "isGeofencingEnabled": ok(["enabled": Pushizo.Location.isGeofencingEnabled])
|
|
336
407
|
|
|
408
|
+
// Android teslimat güçlendirme (ADR-0092) iOS'ta yoktur: durum "desteklenmiyor", diğerleri etkisiz false.
|
|
409
|
+
case "deliveryStatus": ok(["supported": false])
|
|
410
|
+
case "deliveryShouldShowGuidance": ok(["show": false])
|
|
411
|
+
case "deliveryOpenSettings", "deliveryShowGuidance": ok(["opened": false])
|
|
412
|
+
|
|
337
413
|
// Özellik bayrakları (ADR-0066): değerler yerel SDK önbelleğinden okunur.
|
|
338
414
|
case "featureFlagsRefresh":
|
|
339
415
|
Task {
|
|
@@ -418,6 +494,15 @@ final class PushizoBridgeCore: NSObject {
|
|
|
418
494
|
let download = args["download"] as? Bool ?? false
|
|
419
495
|
inbox(reply) { ["url": try Pushizo.Chat.attachmentUrl(attachmentId, download: download).absoluteString] }
|
|
420
496
|
case "chatGetVisitorId": ok(["visitorId": Self.orNull(Pushizo.Chat.visitorId)])
|
|
497
|
+
case "chatIsListening": ok(["listening": Pushizo.Chat.isListening])
|
|
498
|
+
// Hazır sohbet ekranı (`HSChatViewController`): etkin sahnenin en üstteki görünüm denetleyicisinden modal açılır.
|
|
499
|
+
case "chatShow":
|
|
500
|
+
guard Pushizo.isInitialized else { reply(.failure(code: "NOT_READY", message: Self.notInitialized)); return true }
|
|
501
|
+
Pushizo.Chat.show(); ok()
|
|
502
|
+
case "chatHide": Pushizo.Chat.hide(); ok()
|
|
503
|
+
// Sunum durumu UIKit'ten okunur: ana iş parçacığında (bekleyen `show`/`hide` işlendikten sonra) yanıtlanır.
|
|
504
|
+
case "chatIsPresented":
|
|
505
|
+
DispatchQueue.main.async { ok(["presented": Pushizo.Chat.isPresented]) }
|
|
421
506
|
|
|
422
507
|
// Live Activities (ADR-0024): genel `PushizoDefaultLiveActivityAttributes` türü; değer doğrulaması yerel SDK'dadır.
|
|
423
508
|
case "setupDefaultLiveActivity":
|
|
@@ -474,6 +559,29 @@ final class PushizoBridgeCore: NSObject {
|
|
|
474
559
|
|
|
475
560
|
// MARK: Eşleme
|
|
476
561
|
|
|
562
|
+
/// Boş olmayan metin; değilse nil.
|
|
563
|
+
static func nonBlank(_ raw: Any?) -> String? {
|
|
564
|
+
guard let value = raw as? String, !value.trimmingCharacters(in: .whitespaces).isEmpty else { return nil }
|
|
565
|
+
return value
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
/// Köprüden gelen düz nesne → metin sözlüğü (`null` değerler atlanır, sayı/boolean metne çevrilir).
|
|
569
|
+
static func stringMap(_ raw: Any?) -> [String: String] {
|
|
570
|
+
(raw as? [String: Any] ?? [:]).compactMapValues { value in
|
|
571
|
+
if value is NSNull { return nil }
|
|
572
|
+
return (value as? String) ?? "\(value)"
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
static func map(_ consent: HSUserConsent) -> [String: Any] {
|
|
577
|
+
[
|
|
578
|
+
"purpose": consent.purpose,
|
|
579
|
+
"granted": consent.granted,
|
|
580
|
+
"source": orNull(consent.source),
|
|
581
|
+
"updatedAt": millis(consent.updatedAt),
|
|
582
|
+
]
|
|
583
|
+
}
|
|
584
|
+
|
|
477
585
|
static func logLevel(_ name: String?) -> HSLog.Level {
|
|
478
586
|
switch name {
|
|
479
587
|
case "none": return HSLog.Level.none
|
|
@@ -518,6 +626,17 @@ final class PushizoBridgeCore: NSObject {
|
|
|
518
626
|
["preferences": r.preferences.map { map($0) }, "categories": r.categories.map { map($0) }]
|
|
519
627
|
}
|
|
520
628
|
|
|
629
|
+
static func map(_ card: HSContentCard) -> [String: Any] {
|
|
630
|
+
["id": card.id, "messageId": orNull(card.messageId), "type": card.type.rawValue, "title": orNull(card.title),
|
|
631
|
+
"body": orNull(card.body), "url": orNull(card.url), "imageUrl": orNull(card.imageUrl), "buttonText": orNull(card.buttonText),
|
|
632
|
+
"data": card.data, "pinned": card.pinned, "priority": card.priority, "viewed": card.viewed, "clicked": card.clicked,
|
|
633
|
+
"expiresAt": millis(card.expiresAt), "createdAt": millis(card.createdAt)]
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
static func map(_ feed: HSContentCardFeed) -> [String: Any] {
|
|
637
|
+
["cards": feed.cards.map { map($0) }, "unviewedCount": feed.unviewedCount]
|
|
638
|
+
}
|
|
639
|
+
|
|
521
640
|
static func map(_ page: HSInboxPage) -> [String: Any] {
|
|
522
641
|
["items": page.items.map { map($0) }, "unreadCount": page.unreadCount, "nextCursor": orNull(page.nextCursor), "hasMore": page.hasMore]
|
|
523
642
|
}
|
|
@@ -134,12 +134,18 @@ class PushizoCordovaPlugin: CDVPlugin {
|
|
|
134
134
|
@objc(inboxMarkAllRead:) func inboxMarkAllRead(_ command: CDVInvokedUrlCommand) { dispatch(command) }
|
|
135
135
|
@objc(inboxArchive:) func inboxArchive(_ command: CDVInvokedUrlCommand) { dispatch(command) }
|
|
136
136
|
@objc(inboxUnreadCount:) func inboxUnreadCount(_ command: CDVInvokedUrlCommand) { dispatch(command) }
|
|
137
|
+
@objc(contentCardsList:) func contentCardsList(_ command: CDVInvokedUrlCommand) { dispatch(command) }
|
|
138
|
+
@objc(contentCardEvent:) func contentCardEvent(_ command: CDVInvokedUrlCommand) { dispatch(command) }
|
|
137
139
|
@objc(setupDefaultLiveActivity:) func setupDefaultLiveActivity(_ command: CDVInvokedUrlCommand) { dispatch(command) }
|
|
138
140
|
@objc(startDefaultLiveActivity:) func startDefaultLiveActivity(_ command: CDVInvokedUrlCommand) { dispatch(command) }
|
|
139
141
|
@objc(setLocationShared:) func setLocationShared(_ command: CDVInvokedUrlCommand) { dispatch(command) }
|
|
140
142
|
@objc(isLocationShared:) func isLocationShared(_ command: CDVInvokedUrlCommand) { dispatch(command) }
|
|
141
143
|
@objc(setGeofencingEnabled:) func setGeofencingEnabled(_ command: CDVInvokedUrlCommand) { dispatch(command) }
|
|
142
144
|
@objc(isGeofencingEnabled:) func isGeofencingEnabled(_ command: CDVInvokedUrlCommand) { dispatch(command) }
|
|
145
|
+
@objc(deliveryStatus:) func deliveryStatus(_ command: CDVInvokedUrlCommand) { dispatch(command) }
|
|
146
|
+
@objc(deliveryShouldShowGuidance:) func deliveryShouldShowGuidance(_ command: CDVInvokedUrlCommand) { dispatch(command) }
|
|
147
|
+
@objc(deliveryOpenSettings:) func deliveryOpenSettings(_ command: CDVInvokedUrlCommand) { dispatch(command) }
|
|
148
|
+
@objc(deliveryShowGuidance:) func deliveryShowGuidance(_ command: CDVInvokedUrlCommand) { dispatch(command) }
|
|
143
149
|
@objc(featureFlagsRefresh:) func featureFlagsRefresh(_ command: CDVInvokedUrlCommand) { dispatch(command) }
|
|
144
150
|
@objc(featureFlagsIsEnabled:) func featureFlagsIsEnabled(_ command: CDVInvokedUrlCommand) { dispatch(command) }
|
|
145
151
|
@objc(featureFlagsGetValue:) func featureFlagsGetValue(_ command: CDVInvokedUrlCommand) { dispatch(command) }
|
|
@@ -163,4 +169,18 @@ class PushizoCordovaPlugin: CDVPlugin {
|
|
|
163
169
|
@objc(chatAttachmentUrl:) func chatAttachmentUrl(_ command: CDVInvokedUrlCommand) { dispatch(command) }
|
|
164
170
|
@objc(chatGetVisitorId:) func chatGetVisitorId(_ command: CDVInvokedUrlCommand) { dispatch(command) }
|
|
165
171
|
@objc(requestLocationPermission:) func requestLocationPermission(_ command: CDVInvokedUrlCommand) { dispatch(command) }
|
|
172
|
+
@objc(isInitialized:) func isInitialized(_ command: CDVInvokedUrlCommand) { dispatch(command) }
|
|
173
|
+
@objc(setAdsPersonalizationConsent:) func setAdsPersonalizationConsent(_ command: CDVInvokedUrlCommand) { dispatch(command) }
|
|
174
|
+
@objc(getConsents:) func getConsents(_ command: CDVInvokedUrlCommand) { dispatch(command) }
|
|
175
|
+
@objc(registerAdm:) func registerAdm(_ command: CDVInvokedUrlCommand) { dispatch(command) }
|
|
176
|
+
@objc(setAdvertisingId:) func setAdvertisingId(_ command: CDVInvokedUrlCommand) { dispatch(command) }
|
|
177
|
+
@objc(setBadgeCount:) func setBadgeCount(_ command: CDVInvokedUrlCommand) { dispatch(command) }
|
|
178
|
+
@objc(getLocationPermission:) func getLocationPermission(_ command: CDVInvokedUrlCommand) { dispatch(command) }
|
|
179
|
+
@objc(requestBackgroundLocationPermission:) func requestBackgroundLocationPermission(_ command: CDVInvokedUrlCommand) { dispatch(command) }
|
|
180
|
+
@objc(chatIsListening:) func chatIsListening(_ command: CDVInvokedUrlCommand) { dispatch(command) }
|
|
181
|
+
@objc(chatShow:) func chatShow(_ command: CDVInvokedUrlCommand) { dispatch(command) }
|
|
182
|
+
@objc(chatHide:) func chatHide(_ command: CDVInvokedUrlCommand) { dispatch(command) }
|
|
183
|
+
@objc(chatIsPresented:) func chatIsPresented(_ command: CDVInvokedUrlCommand) { dispatch(command) }
|
|
184
|
+
@objc(setUserProperty:) func setUserProperty(_ command: CDVInvokedUrlCommand) { dispatch(command) }
|
|
185
|
+
@objc(getBadgeCount:) func getBadgeCount(_ command: CDVInvokedUrlCommand) { dispatch(command) }
|
|
166
186
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -12,6 +12,9 @@ declare namespace Pushizo {
|
|
|
12
12
|
type LogLevel = Definitions.LogLevel;
|
|
13
13
|
type InitializeOptions = Definitions.InitializeOptions;
|
|
14
14
|
type LoginOptions = Definitions.LoginOptions;
|
|
15
|
+
type UserProfile = Definitions.UserProfile;
|
|
16
|
+
type UserPropertyValue = Definitions.UserPropertyValue;
|
|
17
|
+
type SendEventOptions = Definitions.SendEventOptions;
|
|
15
18
|
type PushizoNotification = Definitions.PushizoNotification;
|
|
16
19
|
type NotificationClickEvent = Definitions.NotificationClickEvent;
|
|
17
20
|
type ForegroundWillDisplayEvent = Definitions.ForegroundWillDisplayEvent;
|
|
@@ -35,11 +38,20 @@ declare namespace Pushizo {
|
|
|
35
38
|
type InboxItem = Definitions.InboxItem;
|
|
36
39
|
type InboxPage = Definitions.InboxPage;
|
|
37
40
|
type InboxListOptions = Definitions.InboxListOptions;
|
|
41
|
+
type InboxChangeEvent = Definitions.InboxChangeEvent;
|
|
42
|
+
type ContentCard = Definitions.ContentCard;
|
|
43
|
+
type ContentCardFeed = Definitions.ContentCardFeed;
|
|
44
|
+
type ContentCardType = Definitions.ContentCardType;
|
|
45
|
+
type DeliveryRisk = Definitions.DeliveryRisk;
|
|
46
|
+
type DeliverySetting = Definitions.DeliverySetting;
|
|
47
|
+
type DeliveryStatus = Definitions.DeliveryStatus;
|
|
48
|
+
type DeliveryGuidanceOptions = Definitions.DeliveryGuidanceOptions;
|
|
38
49
|
type PreferenceChannel = Definitions.PreferenceChannel;
|
|
39
50
|
type UserPreference = Definitions.UserPreference;
|
|
40
51
|
type PreferenceCategory = Definitions.PreferenceCategory;
|
|
41
52
|
type UserPreferences = Definitions.UserPreferences;
|
|
42
53
|
type PreferenceInput = Definitions.PreferenceInput;
|
|
54
|
+
type UserConsent = Definitions.UserConsent;
|
|
43
55
|
type ChatMessage = Definitions.ChatMessage;
|
|
44
56
|
type ChatAttachment = Definitions.ChatAttachment;
|
|
45
57
|
type ChatQuickReply = Definitions.ChatQuickReply;
|
package/www/core.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { ChatAttachmentOptions, ChatAttachmentSource, ChatConfig, ChatConversationState, ChatEventMap, ChatIdentifyResult, ChatMessage, ChatMessagePage, ChatMessagesOptions, ChatStartOptions, FeatureFlagValue, ForegroundWillDisplayEvent, PushizoNotification, InAppClickEvent, InAppLifecycleListener, InAppMessage, InAppTriggerValue, InboxItem, InboxListOptions, InboxPage, InitializeOptions, LiveActivityValue, LogLevel, LoginOptions, NotificationClickEvent, PermissionChangeEvent, PlacementListOptions, PreferenceInput, PushSubscriptionState, UserPreferences } from './definitions';
|
|
1
|
+
import type { ChatAttachmentOptions, ChatAttachmentSource, ChatConfig, ChatConversationState, ChatEventMap, ChatIdentifyResult, ChatMessage, ChatMessagePage, ChatMessagesOptions, ChatStartOptions, FeatureFlagValue, ForegroundWillDisplayEvent, PushizoNotification, InAppClickEvent, InAppLifecycleListener, InAppMessage, InAppTriggerValue, ContentCard, ContentCardFeed, DeliveryGuidanceOptions, DeliverySetting, DeliveryStatus, InboxChangeEvent, InboxItem, InboxListOptions, InboxPage, InitializeOptions, LiveActivityValue, LogLevel, LoginOptions, NotificationClickEvent, PermissionChangeEvent, PlacementListOptions, PreferenceInput, PushSubscriptionState, SendEventOptions, UserConsent, UserPreferences, UserPropertyValue } from './definitions';
|
|
2
2
|
/** Native katmandan gelen olay adları. */
|
|
3
|
-
export type BridgeEventType = 'click' | 'foregroundWillDisplay' | 'pushSubscriptionChange' | 'permissionChange' | 'inAppClick' | 'inAppLifecycle' | 'chatEvent' | 'chatOpen';
|
|
3
|
+
export type BridgeEventType = 'click' | 'foregroundWillDisplay' | 'pushSubscriptionChange' | 'permissionChange' | 'inAppClick' | 'inAppLifecycle' | 'chatEvent' | 'chatOpen' | 'featureFlagsChange' | 'inboxChange';
|
|
4
4
|
/** Taşıma katmanı: native metot çağrısı ve olay aboneliği. */
|
|
5
5
|
export interface Bridge {
|
|
6
6
|
call<T = void>(method: string, args?: Record<string, unknown>): Promise<T>;
|
|
@@ -21,6 +21,8 @@ export declare class PushizoCore {
|
|
|
21
21
|
private readonly permissionObservers;
|
|
22
22
|
private readonly inAppClickListeners;
|
|
23
23
|
private readonly inAppLifecycleListeners;
|
|
24
|
+
private readonly featureFlagObservers;
|
|
25
|
+
private readonly inboxObservers;
|
|
24
26
|
/** Dinleyici yokken gelen tıklamalar (soğuk başlatma); ilk dinleyiciye teslim edilir. */
|
|
25
27
|
private readonly pendingClicks;
|
|
26
28
|
/** Canlı sohbet dinleyicileri (tür başına). */
|
|
@@ -43,11 +45,15 @@ export declare class PushizoCore {
|
|
|
43
45
|
private listen;
|
|
44
46
|
/** SDK'yı başlatır; olay aboneliği burada kurulur. */
|
|
45
47
|
initialize(appIdOrOptions: string | InitializeOptions, options?: Omit<InitializeOptions, 'appId'>): Promise<void>;
|
|
48
|
+
/** Native SDK başlatıldı mı (`initialize` tamamlandı ya da süreç saklanan yapılandırmayla erkenden başlatıldı). */
|
|
49
|
+
isInitialized: () => Promise<boolean>;
|
|
46
50
|
/** KVKK/GDPR onayı (`requiresPrivacyConsent: true` ile başlatıldıysa). */
|
|
47
51
|
setConsentGiven(given: boolean): Promise<void>;
|
|
48
52
|
/**
|
|
49
53
|
* Anonim kullanıcıyı kimlikli kullanıcıya bağlar. Identity verification açıksa app moduna göre `identityHash`
|
|
50
|
-
* (eski imza: ikinci argüman metin) ve/veya JWT gerekir: `login(id, { jwt })`.
|
|
54
|
+
* (eski imza: ikinci argüman metin) ve/veya JWT gerekir: `login(id, { jwt })`. `profile` verilirse e-posta, SMS,
|
|
55
|
+
* etiket ve takma adlar aynı çağrıda ayarlanır: `login(id, { profile: { email: 'ali@ornek.com' } })`; geçersiz
|
|
56
|
+
* e-posta veya telefon girişten önce `INVALID_ARGUMENT` ile reddedilir (yarım kalmış kimlik değişimi olmaz).
|
|
51
57
|
*/
|
|
52
58
|
login(externalId: string, proof?: string | LoginOptions): Promise<void>;
|
|
53
59
|
/** Süresi dolan kimlik JWT'sini yeniler (giriş yapmış kullanıcı için); sonraki SDK istekleri yeni belirteci taşır. */
|
|
@@ -61,6 +67,11 @@ export declare class PushizoCore {
|
|
|
61
67
|
removeTags: (keys: string[]) => Promise<void>;
|
|
62
68
|
getTags: () => Promise<Record<string, string>>;
|
|
63
69
|
setLanguage: (code: string) => Promise<void>;
|
|
70
|
+
/**
|
|
71
|
+
* Kullanıcı özelliği yazar (ör. `setProperty('plan', 'pro')`); `null` özelliği siler. Değer metin, sayı, mantıksal ya da
|
|
72
|
+
* bunların dizisi/düz nesnesi olabilir; anahtar 1-64 karakterdir. Çevrimdışıyken yerel SDK kuyruğunda bekler.
|
|
73
|
+
*/
|
|
74
|
+
setProperty: (key: string, value: UserPropertyValue) => Promise<void>;
|
|
64
75
|
addAlias: (label: string, id: string) => Promise<void>;
|
|
65
76
|
addAliases: (aliases: Record<string, string>) => Promise<void>;
|
|
66
77
|
removeAlias: (label: string) => Promise<void>;
|
|
@@ -81,6 +92,18 @@ export declare class PushizoCore {
|
|
|
81
92
|
getPreferences: () => Promise<UserPreferences>;
|
|
82
93
|
/** Tercihleri yazar (1-100 kayıt; `channel` verilmezse tüm kanallar); güncel listeyi döndürür. */
|
|
83
94
|
setPreferences: (preferences: PreferenceInput[]) => Promise<UserPreferences>;
|
|
95
|
+
/**
|
|
96
|
+
* Reklam kişiselleştirme rızası (ADR-0037): `true` iken kullanıcının e-posta/telefon özeti app'in bağladığı reklam
|
|
97
|
+
* platformu kitlelerine gönderilebilir; `false` rızayı geri alır. Güncel tercih listesini döndürür.
|
|
98
|
+
*/
|
|
99
|
+
setAdsPersonalizationConsent: (granted: boolean) => Promise<UserPreferences>;
|
|
100
|
+
/** Rıza kayıtları (`ads_personalization` …). Abonelik henüz yoksa `NOT_READY` koduyla reddedilir. */
|
|
101
|
+
getConsents: () => Promise<UserConsent[]>;
|
|
102
|
+
/**
|
|
103
|
+
* Fire OS ADM kayıt kimliği (yalnızca Android; ana FCM aboneliğinin yerine geçmez). ADM kaydını kendisi yapan
|
|
104
|
+
* uygulamalar içindir. iOS ve web'de etkisizdir.
|
|
105
|
+
*/
|
|
106
|
+
registerAdm: (token: string) => Promise<void>;
|
|
84
107
|
pushSubscription: {
|
|
85
108
|
getState: () => Promise<PushSubscriptionState>;
|
|
86
109
|
getId: () => Promise<string | null>;
|
|
@@ -107,6 +130,20 @@ export declare class PushizoCore {
|
|
|
107
130
|
removeNotification: (id: number | string) => Promise<void>;
|
|
108
131
|
/** Aynı gruptaki bildirimleri kaldırır (Android `android_group`, iOS `thread-id`). */
|
|
109
132
|
removeGroupedNotifications: (group: string) => Promise<void>;
|
|
133
|
+
/**
|
|
134
|
+
* Uygulama rozetini ayarlar; rozet bu cihazda gösterilebiliyorsa true döner. iOS: rozet ve bildirim uzantısıyla
|
|
135
|
+
* paylaşılan sayaç ayarlanır (her zaman true). Android: başlatıcı rozeti için "sayıyı ayarla" API'si yoktur; yerel SDK
|
|
136
|
+
* sayıyı saklar ve sonraki bildirimlere yazar (Android 8 öncesinde, bildirimler ya da kanal rozeti kapalıyken false).
|
|
137
|
+
* Web: App Badging API (yüklü PWA); tarayıcı desteklemiyorsa false.
|
|
138
|
+
*/
|
|
139
|
+
setBadgeCount: (count: number) => Promise<boolean>;
|
|
140
|
+
/** Rozeti sıfırlar (`setBadgeCount(0)`); sonuç `setBadgeCount` ile aynıdır. */
|
|
141
|
+
clearBadge: () => Promise<boolean>;
|
|
142
|
+
/**
|
|
143
|
+
* Güncel rozet sayısı. Android: `setBadgeCount` ile saklanan son sayı; iOS: uygulama simgesindeki rozet; web: bu
|
|
144
|
+
* oturumda `setBadgeCount` ile başarıyla ayarlanan son sayı (tarayıcı rozeti okutmaz).
|
|
145
|
+
*/
|
|
146
|
+
getBadgeCount: () => Promise<number>;
|
|
110
147
|
/** Bildirim/düğme tıklaması; soğuk başlatmada bekleyen tıklama ilk dinleyiciye teslim edilir. */
|
|
111
148
|
addClickListener: (cb: Listener<NotificationClickEvent>) => (() => void);
|
|
112
149
|
removeClickListener: (cb: Listener<NotificationClickEvent>) => void;
|
|
@@ -117,9 +154,15 @@ export declare class PushizoCore {
|
|
|
117
154
|
addPermissionObserver: (cb: Listener<PermissionChangeEvent>) => (() => void);
|
|
118
155
|
removePermissionObserver: (cb: Listener<PermissionChangeEvent>) => void;
|
|
119
156
|
};
|
|
157
|
+
/** Rozet çağrısı; yanıt vermeyen (eski) native katman başarılı sayılır. */
|
|
158
|
+
private badge;
|
|
120
159
|
readonly Session: {
|
|
121
|
-
/**
|
|
122
|
-
|
|
160
|
+
/**
|
|
161
|
+
* Özel olay / outcome; in-app olay tetiklerini de değerlendirir. `options.eventId` tekilleştirme kimliğidir
|
|
162
|
+
* (8-64 karakter; harf, rakam ve `. _ : -`): reklam pikseliyle aynı kimlik verilirse sunucu olayı tekilleşir
|
|
163
|
+
* (ADR-0038). Biçim geçersizse yerel SDK kendi kimliğini üretir.
|
|
164
|
+
*/
|
|
165
|
+
sendEvent: (name: string, properties?: Record<string, unknown>, value?: number, options?: SendEventOptions) => Promise<void>;
|
|
123
166
|
};
|
|
124
167
|
readonly InAppMessages: {
|
|
125
168
|
addTrigger: (key: string, value: InAppTriggerValue) => Promise<void>;
|
|
@@ -147,10 +190,28 @@ export declare class PushizoCore {
|
|
|
147
190
|
/** Öğeyi kutudan kaldırır (sunucuda arşivlenir). */
|
|
148
191
|
archive: (id: string) => Promise<void>;
|
|
149
192
|
unreadCount: () => Promise<number>;
|
|
193
|
+
/**
|
|
194
|
+
* Kutu değişim gözlemcisi (rozet güncellemek için): `read`/`read_all`/`archived` her işlemde, `listed`/`count`
|
|
195
|
+
* yalnızca okunmamış sayısı değiştiğinde bildirilir. Dönen fonksiyon aboneliği kaldırır.
|
|
196
|
+
*/
|
|
197
|
+
addObserver: (cb: Listener<InboxChangeEvent>) => (() => void);
|
|
198
|
+
removeObserver: (cb: Listener<InboxChangeEvent>) => void;
|
|
199
|
+
};
|
|
200
|
+
readonly ContentCards: {
|
|
201
|
+
/** Kart akışı (sabitlenmiş → öncelik → yeni) ve görülmemiş kart sayısı; `limit` 1-100 (varsayılan 50). */
|
|
202
|
+
list: (limit?: number) => Promise<ContentCardFeed>;
|
|
203
|
+
/** Kart ekranda gösterildi (ilk gösterim kaydedilir). */
|
|
204
|
+
logImpression: (id: string) => Promise<ContentCard>;
|
|
205
|
+
/** Karta tıklandı (gösterim de sayılır). */
|
|
206
|
+
logClick: (id: string) => Promise<ContentCard>;
|
|
207
|
+
/** Kart kapatıldı; akıştan kalkar. */
|
|
208
|
+
dismiss: (id: string) => Promise<ContentCard>;
|
|
150
209
|
};
|
|
210
|
+
private cardEvent;
|
|
151
211
|
/**
|
|
152
212
|
* Canlı sohbet (Android ve iOS): ziyaretçi kimliği, çevrimdışı kuyruk, canlı akış (SSE + yoklama yedeği) ve push ile
|
|
153
|
-
* gelen mesajlar native SDK'dadır; login/logout ve push aboneliği değişince bağlama native SDK'da yenilenir.
|
|
213
|
+
* gelen mesajlar native SDK'dadır; login/logout ve push aboneliği değişince bağlama native SDK'da yenilenir. Hazır
|
|
214
|
+
* arayüz için `show()` / `hide()`; kendi arayüzünüz için diğer çağrılar ve olaylar.
|
|
154
215
|
*/
|
|
155
216
|
readonly Chat: {
|
|
156
217
|
/** Sohbeti etkinleştirir ve ziyaretçiyi bağlar (giriş yapmış kullanıcı, push aboneliği); konuşma varsa döner. */
|
|
@@ -186,8 +247,19 @@ export declare class PushizoCore {
|
|
|
186
247
|
stopListening: () => Promise<void>;
|
|
187
248
|
/** Ek dosyasının adresi; ziyaretçi belirtecini taşır, yalnızca görsel bileşenine verin ve loglamayın. */
|
|
188
249
|
attachmentUrl: (attachmentId: string, download?: boolean) => Promise<string>;
|
|
250
|
+
/** Canlı dinleme açık mı (`startListening` çağrıldı ve akış etkin). */
|
|
251
|
+
isListening: () => Promise<boolean>;
|
|
189
252
|
/** Bu cihazın ziyaretçi kimliği (sohbet henüz kullanılmadıysa null). */
|
|
190
253
|
getVisitorId: () => Promise<string | null>;
|
|
254
|
+
/**
|
|
255
|
+
* Hazır sohbet ekranını açar (Android `HsChatActivity`, iOS `HSChatViewController` modal; web: Web SDK sohbet
|
|
256
|
+
* widget'ı açık pencereyle). Ekran zaten açıksa yenisi açılmaz. `initialize` öncesinde `NOT_READY` ile reddedilir.
|
|
257
|
+
*/
|
|
258
|
+
show: () => Promise<void>;
|
|
259
|
+
/** `show` ile açılan sohbet ekranını kapatır (açık değilse hiçbir şey yapmaz). */
|
|
260
|
+
hide: () => Promise<void>;
|
|
261
|
+
/** `show` ile açılan sohbet ekranı şu an açık mı. */
|
|
262
|
+
isPresented: () => Promise<boolean>;
|
|
191
263
|
/** Sohbet olay dinleyicisi; kaldırma fonksiyonu döner. `open`: sohbet bildirimine tıklama. */
|
|
192
264
|
addEventListener: <K extends keyof ChatEventMap>(event: K, listener: Listener<ChatEventMap[K]>) => (() => void);
|
|
193
265
|
removeEventListener: <K extends keyof ChatEventMap>(event: K, listener: Listener<ChatEventMap[K]>) => void;
|
|
@@ -206,6 +278,12 @@ export declare class PushizoCore {
|
|
|
206
278
|
isEnabled: (key: string, defaultValue?: boolean) => Promise<boolean>;
|
|
207
279
|
/** Bayrağın değeri (metin, sayı, mantıksal, nesne veya dizi); değer yoksa `defaultValue`. */
|
|
208
280
|
getValue: <T extends FeatureFlagValue = FeatureFlagValue>(key: string, defaultValue?: T | null) => Promise<T | null>;
|
|
281
|
+
/**
|
|
282
|
+
* Bayrak değerleri sunucudan her yenilendiğinde (oturum başı ve `refresh()`) çağrılır; güncel değerler `isEnabled` /
|
|
283
|
+
* `getValue` ile okunur. Dönen fonksiyon aboneliği kaldırır.
|
|
284
|
+
*/
|
|
285
|
+
addObserver: (cb: () => void) => (() => void);
|
|
286
|
+
removeObserver: (cb: () => void) => void;
|
|
209
287
|
};
|
|
210
288
|
/**
|
|
211
289
|
* Gömülü yerleşimler: uygulamanın ayırdığı alana içerik. Model döner, çizim uygulamanındır; içerik ekrana gelince
|
|
@@ -240,15 +318,63 @@ export declare class PushizoCore {
|
|
|
240
318
|
* açılmaz. Sonuç: izin varsa veya verildiyse true; reddedildiyse, uygulama izni tanımlamadıysa veya vazgeçildiyse false.
|
|
241
319
|
*/
|
|
242
320
|
requestPermission: (rationale?: string) => Promise<boolean>;
|
|
321
|
+
/**
|
|
322
|
+
* Ön plan konum izni verilmiş mi (Android yaklaşık/hassas, iOS "kullanırken" veya "her zaman"; web: tarayıcı konum
|
|
323
|
+
* izninin son bilinen durumu). İstem açmaz.
|
|
324
|
+
*/
|
|
325
|
+
permissionGranted: () => Promise<boolean>;
|
|
326
|
+
/** Arka plan konum izni verilmiş mi (Android `ACCESS_BACKGROUND_LOCATION`, iOS "her zaman"). Web'de false. */
|
|
327
|
+
backgroundPermissionGranted: () => Promise<boolean>;
|
|
328
|
+
/**
|
|
329
|
+
* Arka plan konum iznini ister (bölge izleme için). Android: açıklama diyaloğu (`rationale`; verilmezse SDK metni),
|
|
330
|
+
* ardından `ACCESS_BACKGROUND_LOCATION` (Android 11+ sistem Ayarlar ekranını açar; önce ön plan konum izni verilmiş
|
|
331
|
+
* olmalı). iOS: "her zaman" izni (`rationale` yok sayılır; önce "kullanırken" izni verilmiş olmalı). Sonuç: izin
|
|
332
|
+
* varsa veya verildiyse true; reddedildiyse, uygulama izni tanımlamadıysa veya vazgeçildiyse false. Web'de false.
|
|
333
|
+
*/
|
|
334
|
+
requestBackgroundPermission: (rationale?: string) => Promise<boolean>;
|
|
335
|
+
/** `requestBackgroundPermission` ile aynı izin (iOS adı: "her zaman"); iki ad da her platformda çalışır. */
|
|
336
|
+
requestAlwaysPermission: () => Promise<boolean>;
|
|
243
337
|
/**
|
|
244
338
|
* Arka plan bölge izlemeyi açar/kapatır (ADR-0065; kalıcı, varsayılan kapalı). İzlemeyi işletim sistemi yapar,
|
|
245
|
-
* sunucuya koordinat gitmez. `setShared(true)` ve arka plan konum izni gerekir;
|
|
246
|
-
* manifest/Info.plist'e izin eklemez.
|
|
339
|
+
* sunucuya koordinat gitmez. `setShared(true)` ve arka plan konum izni gerekir (`requestBackgroundPermission`);
|
|
340
|
+
* köprü manifest/Info.plist'e izin eklemez.
|
|
247
341
|
*/
|
|
248
342
|
setGeofencingEnabled: (enabled: boolean) => Promise<void>;
|
|
249
343
|
/** Bölge izleme açık mı (kalıcı tercih; izin durumundan bağımsız). */
|
|
250
344
|
isGeofencingEnabled: () => Promise<boolean>;
|
|
251
345
|
};
|
|
346
|
+
/**
|
|
347
|
+
* Mobil reklam kimliği (Android GAID, iOS IDFA). SDK reklam kitaplığı ve izin istemi içermez: kimliği uygulama alır
|
|
348
|
+
* (Android `AdvertisingIdClient`, iOS App Tracking Transparency izninden sonra `ASIdentifierManager`) ve buraya verir.
|
|
349
|
+
* Kimlik reklam kitlesine yalnızca `ads_personalization` rızası olan kullanıcıda ve SHA-256 özetiyle gider.
|
|
350
|
+
*/
|
|
351
|
+
readonly Ads: {
|
|
352
|
+
/** Reklam kimliğini yazar; `null` veya sıfır kimlik sunucudaki kaydı siler. Web'de etkisizdir. */
|
|
353
|
+
setAdvertisingId: (id: string | null) => Promise<void>;
|
|
354
|
+
};
|
|
355
|
+
/**
|
|
356
|
+
* Android teslimat güçlendirme: bazı üreticilerin pil/otomatik başlatma yöneticisi arka plandaki uygulamayı durdurduğu
|
|
357
|
+
* için bildirimler gecikir ya da gelmez. Bu yüzey cihazdaki kısıtları okur ve kullanıcıyı ilgili ayar ekranına götürür.
|
|
358
|
+
* Yalnızca Android'de etkilidir: iOS ve web'de `status()` `supported: false` ve `risk: 'none'` döner, `openSettings` ile
|
|
359
|
+
* `showGuidance` hiçbir şey yapmadan `false` döner.
|
|
360
|
+
*/
|
|
361
|
+
readonly Delivery: {
|
|
362
|
+
/** Cihazın teslim durumu: üretici, ROM, pil muafiyeti, arka plan kısıtı, risk ve önerilen ayar ekranları. */
|
|
363
|
+
status: () => Promise<DeliveryStatus>;
|
|
364
|
+
/** Hazır açıklama diyaloğu şimdi gösterilmeli mi: teslim riski var ve diyalog son `minIntervalDays` günde gösterilmedi. */
|
|
365
|
+
shouldShowGuidance: (minIntervalDays?: number) => Promise<boolean>;
|
|
366
|
+
/**
|
|
367
|
+
* Ayar ekranını açar (`auto`: duruma en uygun ekran). Üreticiye özgü ekran bulunamazsa standart Android ekranına
|
|
368
|
+
* düşülür. Bir ekran açıldıysa true.
|
|
369
|
+
*/
|
|
370
|
+
openSettings: (setting?: DeliverySetting) => Promise<boolean>;
|
|
371
|
+
/**
|
|
372
|
+
* Hazır açıklama diyaloğunu gösterir (22 dil; `message` verilirse SDK metni yerine o gösterilir). Kullanıcı kabul
|
|
373
|
+
* ederse `setting` ekranı açılır. Ayar ekranı açıldıysa true; kullanıcı vazgeçtiyse, ekran açılamadıysa ya da etkin
|
|
374
|
+
* Activity yoksa false. SDK diyaloğu kendiliğinden göstermez; uygun anı uygulama seçer (`shouldShowGuidance`).
|
|
375
|
+
*/
|
|
376
|
+
showGuidance: (options?: DeliveryGuidanceOptions) => Promise<boolean>;
|
|
377
|
+
};
|
|
252
378
|
/**
|
|
253
379
|
* iOS Live Activities (ADR-0024; iOS 16.1+). Köprü genel `PushizoDefaultLiveActivityAttributes` türünü kullanır;
|
|
254
380
|
* widget extension'da bu türle `ActivityConfiguration` tanımlanmalı ve sunucuda tür adı aynen kaydedilmelidir.
|