Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.5.0] - 2026-02-19

### Added

- `reset()` method to clear all local SDK state including device ID

### Deprecated

- `removeUserId()` — use `reset()` instead

## [1.4.1] - 2026-02-13

### Added
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@clix-so/react-native-sdk",
"version": "1.4.1",
"version": "1.5.0",
"description": "Clix - Mobile push for builders",
"main": "./lib/module/index.js",
"types": "./lib/typescript/src/index.d.ts",
Expand Down
22 changes: 22 additions & 0 deletions src/core/Clix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ export class Clix {

/**
* Remove user ID
* @deprecated Use reset() instead
*/
static async removeUserId(): Promise<void> {
try {
Expand All @@ -125,6 +126,27 @@ export class Clix {
}
}

/**
* Resets all local SDK state including device ID.
*
* After calling this method, you must call initialize() again before using the SDK.
* Use this when a user logs out and you want to start fresh with a new device identity.
*/
static async reset(): Promise<void> {
try {
await Clix.initCoordinator.waitForInitialization();
this.shared?.sessionService?.cleanup();
this.shared?.liveActivityService?.cleanup();
this.shared?.notificationService?.cleanup();
Comment thread
gunoooo marked this conversation as resolved.
this.shared?.storageService?.remove('clix_device_id');
this.shared?.storageService?.remove('clix_session_last_activity');
this.shared = undefined;
this.initCoordinator.reset();
} catch (error) {
ClixLogger.error(`Failed to reset: ${error}`);
}
}
Comment thread
gunoooo marked this conversation as resolved.

/**
* Set user property
*/
Expand Down
9 changes: 9 additions & 0 deletions src/core/ClixInitCoordinator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,15 @@ export class ClixInitCoordinator {
this.reject?.(error);
}

reset(): void {
this.isCompleted = false;
this.isFailed = false;
this.promise = new Promise<void>((resolve, reject) => {
this.resolve = resolve;
this.reject = reject;
});
}

private isAlreadyFinalized(): boolean {
if (this.isCompleted || this.isFailed) {
ClixLogger.warn('Initialization already completed or failed');
Expand Down