Skip to content

Commit

Permalink
feat: set id to the node
Browse files Browse the repository at this point in the history
  • Loading branch information
arifBurakDemiray committed Nov 4, 2024
1 parent c966016 commit 701bc57
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## XX.XX.XX
- Added a new method `set_id(newDeviceId)` for managing device ID changes according to the device ID Type

## 24.10.0
- Default max segmentation value count changed from 30 to 100
- Mitigated an issue where SDK could create an unintended dump file
Expand Down
19 changes: 19 additions & 0 deletions lib/countly.js
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,25 @@ Countly.Bulk = Bulk;
return Countly.device_id;
};

/**
* Changes the current device ID according to the device ID type (the preffered method)
* @param {string} newId - new user/device ID to use. Must be a non-empty string value. Invalid values (like null, empty string or undefined) will be rejected
* */
Countly.set_id = function (newId) {

Check failure on line 634 in lib/countly.js

View workflow job for this annotation

GitHub Actions / build (14)

Unexpected space before function parentheses

Check failure on line 634 in lib/countly.js

View workflow job for this annotation

GitHub Actions / build (16)

Unexpected space before function parentheses

Check failure on line 634 in lib/countly.js

View workflow job for this annotation

GitHub Actions / build (17)

Unexpected space before function parentheses
cc.log(cc.logLevelEnums.INFO, "set_id, Changing the device ID to:[" + newId + "]");

Check failure on line 635 in lib/countly.js

View workflow job for this annotation

GitHub Actions / build (14)

Unexpected string concatenation

Check failure on line 635 in lib/countly.js

View workflow job for this annotation

GitHub Actions / build (16)

Unexpected string concatenation

Check failure on line 635 in lib/countly.js

View workflow job for this annotation

GitHub Actions / build (17)

Unexpected string concatenation
if (newId == null || newId === "") {

Check failure on line 636 in lib/countly.js

View workflow job for this annotation

GitHub Actions / build (14)

Expected '===' and instead saw '=='

Check failure on line 636 in lib/countly.js

View workflow job for this annotation

GitHub Actions / build (16)

Expected '===' and instead saw '=='

Check failure on line 636 in lib/countly.js

View workflow job for this annotation

GitHub Actions / build (17)

Expected '===' and instead saw '=='
cc.log(cc.logLevelEnums.WARNING, "set_id, The provided device is not a valid ID");
return;
}
if (Countly.deviceIdType === cc.deviceIdTypeEnums.DEVELOPER_SUPPLIED) {
/*change ID without merge as current ID is Dev supplied, so not first login*/

Check failure on line 641 in lib/countly.js

View workflow job for this annotation

GitHub Actions / build (14)

Expected exception block, space or tab after '/*' in comment

Check failure on line 641 in lib/countly.js

View workflow job for this annotation

GitHub Actions / build (14)

Expected space or tab before '*/' in comment

Check failure on line 641 in lib/countly.js

View workflow job for this annotation

GitHub Actions / build (16)

Expected exception block, space or tab after '/*' in comment

Check failure on line 641 in lib/countly.js

View workflow job for this annotation

GitHub Actions / build (16)

Expected space or tab before '*/' in comment

Check failure on line 641 in lib/countly.js

View workflow job for this annotation

GitHub Actions / build (17)

Expected exception block, space or tab after '/*' in comment

Check failure on line 641 in lib/countly.js

View workflow job for this annotation

GitHub Actions / build (17)

Expected space or tab before '*/' in comment
Countly.change_id(newId, false);
} else {

Check failure on line 643 in lib/countly.js

View workflow job for this annotation

GitHub Actions / build (14)

Closing curly brace appears on the same line as the subsequent block

Check failure on line 643 in lib/countly.js

View workflow job for this annotation

GitHub Actions / build (16)

Closing curly brace appears on the same line as the subsequent block

Check failure on line 643 in lib/countly.js

View workflow job for this annotation

GitHub Actions / build (17)

Closing curly brace appears on the same line as the subsequent block
/*change ID with merge as current ID is not Dev supplied*/

Check failure on line 644 in lib/countly.js

View workflow job for this annotation

GitHub Actions / build (14)

Expected exception block, space or tab after '/*' in comment

Check failure on line 644 in lib/countly.js

View workflow job for this annotation

GitHub Actions / build (14)

Expected space or tab before '*/' in comment

Check failure on line 644 in lib/countly.js

View workflow job for this annotation

GitHub Actions / build (16)

Expected exception block, space or tab after '/*' in comment

Check failure on line 644 in lib/countly.js

View workflow job for this annotation

GitHub Actions / build (16)

Expected space or tab before '*/' in comment

Check failure on line 644 in lib/countly.js

View workflow job for this annotation

GitHub Actions / build (17)

Expected exception block, space or tab after '/*' in comment

Check failure on line 644 in lib/countly.js

View workflow job for this annotation

GitHub Actions / build (17)

Expected space or tab before '*/' in comment
Countly.change_id(newId, true);
}
};

/**
* Change current user/device id
* @param {string} newId - new user/device ID to use
Expand Down

0 comments on commit 701bc57

Please sign in to comment.