@ateam-ai-mobile/core 0.1.19 → 0.1.21

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/dist/index.mjs CHANGED
@@ -437,8 +437,10 @@ function createAuthSession(deps) {
437
437
  // src/pushRegistration.ts
438
438
  function createPushRegistration(backend) {
439
439
  let token = null;
440
+ let generation = 0;
440
441
  return {
441
442
  getToken: () => token,
443
+ generation: () => generation,
442
444
  async setToken(next) {
443
445
  if (!next) {
444
446
  token = null;
@@ -450,10 +452,12 @@ function createPushRegistration(backend) {
450
452
  await backend.registerDevice(next);
451
453
  } catch (e) {
452
454
  console.warn("[adas/push] registerDevice failed:", e?.message || e);
455
+ if (token === next) token = null;
453
456
  }
454
457
  },
455
458
  async unregister() {
456
459
  const t = token;
460
+ generation += 1;
457
461
  token = null;
458
462
  if (t) {
459
463
  backend.unregisterDevice(t).catch(