chore: Dispatcher Threads#2375
Merged
abdulraqeeb33 merged 28 commits into5.4.0-alpha-01-kotlin-refactorfrom Oct 14, 2025
Merged
chore: Dispatcher Threads#2375abdulraqeeb33 merged 28 commits into5.4.0-alpha-01-kotlin-refactorfrom
abdulraqeeb33 merged 28 commits into5.4.0-alpha-01-kotlin-refactorfrom
Conversation
abdulraqeeb33
commented
Oct 8, 2025
| Logging.logLevel = LogLevel.NONE | ||
| } | ||
|
|
||
| test("simple performance test") { |
Contributor
Author
There was a problem hiding this comment.
i have added these tests to test the performance, but have them skipped. It takes really long to run them.
we could run them
RUN_PERFORMANCE_TESTS=true ./gradlew :onesignal:core:test --tests "com.onesignal.common.threading.*"
added 12 commits
October 7, 2025 21:07
jkasten2
requested changes
Oct 9, 2025
Member
jkasten2
left a comment
There was a problem hiding this comment.
Left some comments, still reviewing
...ignalSDK/onesignal/core/src/main/java/com/onesignal/common/threading/OneSignalDispatchers.kt
Outdated
Show resolved
Hide resolved
Examples/OneSignalDemo/app/src/main/java/com/onesignal/sdktest/application/MainApplicationKT.kt
Outdated
Show resolved
Hide resolved
OneSignalSDK/onesignal/core/src/main/java/com/onesignal/common/threading/CompletionAwaiter.kt
Show resolved
Hide resolved
OneSignalSDK/onesignal/core/src/main/java/com/onesignal/common/threading/CompletionAwaiter.kt
Outdated
Show resolved
Hide resolved
...ignalSDK/onesignal/core/src/main/java/com/onesignal/common/threading/OneSignalDispatchers.kt
Outdated
Show resolved
Hide resolved
...ignalSDK/onesignal/core/src/main/java/com/onesignal/common/threading/OneSignalDispatchers.kt
Show resolved
Hide resolved
...ignalSDK/onesignal/core/src/main/java/com/onesignal/common/threading/OneSignalDispatchers.kt
Outdated
Show resolved
Hide resolved
...ignalSDK/onesignal/core/src/main/java/com/onesignal/common/threading/OneSignalDispatchers.kt
Outdated
Show resolved
Hide resolved
...ignalSDK/onesignal/core/src/main/java/com/onesignal/common/threading/OneSignalDispatchers.kt
Outdated
Show resolved
Hide resolved
jkasten2
reviewed
Oct 9, 2025
OneSignalSDK/onesignal/core/src/main/java/com/onesignal/common/threading/ThreadUtils.kt
Show resolved
Hide resolved
jkasten2
reviewed
Oct 9, 2025
OneSignalSDK/onesignal/core/src/main/java/com/onesignal/core/activities/PermissionsActivity.kt
Outdated
Show resolved
Hide resolved
jkasten2
reviewed
Oct 9, 2025
...DK/onesignal/core/src/test/java/com/onesignal/core/internal/operations/OperationRepoTests.kt
Outdated
Show resolved
Hide resolved
jkasten2
reviewed
Oct 10, 2025
...ignalSDK/onesignal/core/src/main/java/com/onesignal/common/threading/OneSignalDispatchers.kt
Outdated
Show resolved
Hide resolved
jkasten2
reviewed
Oct 10, 2025
...ignalSDK/onesignal/core/src/main/java/com/onesignal/common/threading/OneSignalDispatchers.kt
Outdated
Show resolved
Hide resolved
jkasten2
reviewed
Oct 10, 2025
...ignalSDK/onesignal/core/src/main/java/com/onesignal/common/threading/OneSignalDispatchers.kt
Outdated
Show resolved
Hide resolved
jkasten2
reviewed
Oct 10, 2025
...ignalSDK/onesignal/core/src/main/java/com/onesignal/common/threading/OneSignalDispatchers.kt
Outdated
Show resolved
Hide resolved
jkasten2
reviewed
Oct 10, 2025
...l/in-app-messages/src/main/java/com/onesignal/inAppMessages/internal/InAppMessagesManager.kt
Show resolved
Hide resolved
jkasten2
reviewed
Oct 10, 2025
...l/in-app-messages/src/main/java/com/onesignal/inAppMessages/internal/InAppMessagesManager.kt
Outdated
Show resolved
Hide resolved
jkasten2
reviewed
Oct 10, 2025
...l/in-app-messages/src/main/java/com/onesignal/inAppMessages/internal/InAppMessagesManager.kt
Outdated
Show resolved
Hide resolved
jkasten2
requested changes
Oct 13, 2025
...gnalSDK/onesignal/core/src/test/java/com/onesignal/core/internal/application/SDKInitTests.kt
Outdated
Show resolved
Hide resolved
...DK/onesignal/core/src/test/java/com/onesignal/core/internal/operations/OperationRepoTests.kt
Show resolved
Hide resolved
jkasten2
approved these changes
Oct 14, 2025
Member
jkasten2
left a comment
There was a problem hiding this comment.
Looks good now, just one nit left in the example.
Comment on lines
+85
to
87
| } catch (e: Exception) { | ||
| Log.e(Tag.LOG_TAG, "OneSignal initialization error", e) | ||
| } |
Member
There was a problem hiding this comment.
I don't think we should try-catch here:
- Not something our customers need to do
- In development I would rather the app crash so we know there is a major issue.
Contributor
Author
There was a problem hiding this comment.
ok i will merge this into the refactor branch and fix it there. thanks
abdulraqeeb33
added a commit
that referenced
this pull request
Oct 15, 2025
…2374) * feat: Add Kotlin MainApplication and suspend initialization support - Add MainApplicationKT.kt as Kotlin version of MainApplication.java - Add initWithContextSuspend() method for async initialization - Refactor OneSignalImp to use IO dispatcher internally for initialization - Add comprehensive unit tests for suspend initialization - Rename LatchAwaiter to CompletionAwaiter for better semantics - Add helper classes for user management (AppIdHelper, LoginHelper, LogoutHelper, UserSwitcher) - Update build.gradle to include Kotlin coroutines dependency - Ensure ANR prevention by using background threads for initialization * Added more tests * mandating passing app id in the login/logout methods * linting * Made app id mandatory for login and logout. * cleanup * reduce the forks * Time out, deprecate annotation and appid,context * ktlin * include MainApplication.java, locks, early returns * chore: Dispatcher Threads (#2375) * Using dispatcher * Update threads to 2 * Updated methods * linting * readme * using the same thread pool * lint * making sure initstate has the right value * lint * Clear state and skip performance tests * lint * clear preferences * fixing tests * fixing tests * fixing tests * fixing tests * fixing tests * addressed PR comments * Addressed comments and fixed tests * lint * lint * fix test * lint * rewrote the test * fix test * made the test more robust * clear all preferences and simplified mocks * added more robustness --------- Co-authored-by: AR Abdul Azeez <abdul@onesignal.com> * Fix OperationRepoTests CI/CD flakiness by using individual coVerify calls - Replace coVerifyOrder with individual coVerify(exactly = 1) calls - Makes tests more resilient to timing variations in CI/CD environments - Maintains verification of all critical operations while allowing flexibility in exact timing * remove try catch and lint * Addressed comments, removed global scope launches, broke down userswitcher * fixed flag * fix tests * making sure using the name instead of value * test isolation * logout test * comments * cleanup --------- Co-authored-by: AR Abdul Azeez <abdul@onesignal.com>
abdulraqeeb33
added a commit
that referenced
this pull request
Oct 29, 2025
* refactor: move initialization process off main thread * Release 5.4.0-alpha-01 * feat: Add Kotlin MainApplication and suspend initialization support (#2374) * feat: Add Kotlin MainApplication and suspend initialization support - Add MainApplicationKT.kt as Kotlin version of MainApplication.java - Add initWithContextSuspend() method for async initialization - Refactor OneSignalImp to use IO dispatcher internally for initialization - Add comprehensive unit tests for suspend initialization - Rename LatchAwaiter to CompletionAwaiter for better semantics - Add helper classes for user management (AppIdHelper, LoginHelper, LogoutHelper, UserSwitcher) - Update build.gradle to include Kotlin coroutines dependency - Ensure ANR prevention by using background threads for initialization * Added more tests * mandating passing app id in the login/logout methods * linting * Made app id mandatory for login and logout. * cleanup * reduce the forks * Time out, deprecate annotation and appid,context * ktlin * include MainApplication.java, locks, early returns * chore: Dispatcher Threads (#2375) * Using dispatcher * Update threads to 2 * Updated methods * linting * readme * using the same thread pool * lint * making sure initstate has the right value * lint * Clear state and skip performance tests * lint * clear preferences * fixing tests * fixing tests * fixing tests * fixing tests * fixing tests * addressed PR comments * Addressed comments and fixed tests * lint * lint * fix test * lint * rewrote the test * fix test * made the test more robust * clear all preferences and simplified mocks * added more robustness --------- Co-authored-by: AR Abdul Azeez <abdul@onesignal.com> * Fix OperationRepoTests CI/CD flakiness by using individual coVerify calls - Replace coVerifyOrder with individual coVerify(exactly = 1) calls - Makes tests more resilient to timing variations in CI/CD environments - Maintains verification of all critical operations while allowing flexibility in exact timing * remove try catch and lint * Addressed comments, removed global scope launches, broke down userswitcher * fixed flag * fix tests * making sure using the name instead of value * test isolation * logout test * comments * cleanup --------- Co-authored-by: AR Abdul Azeez <abdul@onesignal.com> * chore: bump SDK_VERSION to 5.4.0-alpha-02 (#2386) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * Fix permissions activity (#2388) * broke down permissions activity * fixed the permissions dialog * cleanup * permissions tests * lint * waiting to false for pause * added some tests for pause * uncommented the code * removed duplicate class * fixed wrong import * fixed imports * fixed bug to display the dialog after cancelling * formatting ktlint * tests * lint * adding delay * removing the theme and going back to production * add a delay * add a delay --------- Co-authored-by: AR Abdul Azeez <abdul@onesignal.com> * chore: bump SDK_VERSION to 5.4.0-alpha-03 (#2392) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * spotless check * added more time * added more time --------- Co-authored-by: jinliu9508 <jinliu9508@gmail.com> Co-authored-by: AR Abdul Azeez <abdul@onesignal.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
jinliu9508
added a commit
that referenced
this pull request
Jan 6, 2026
* refactor: move initialization process off main thread * Release 5.4.0-alpha-01 * feat: Add Kotlin MainApplication and suspend initialization support (#2374) * feat: Add Kotlin MainApplication and suspend initialization support - Add MainApplicationKT.kt as Kotlin version of MainApplication.java - Add initWithContextSuspend() method for async initialization - Refactor OneSignalImp to use IO dispatcher internally for initialization - Add comprehensive unit tests for suspend initialization - Rename LatchAwaiter to CompletionAwaiter for better semantics - Add helper classes for user management (AppIdHelper, LoginHelper, LogoutHelper, UserSwitcher) - Update build.gradle to include Kotlin coroutines dependency - Ensure ANR prevention by using background threads for initialization * Added more tests * mandating passing app id in the login/logout methods * linting * Made app id mandatory for login and logout. * cleanup * reduce the forks * Time out, deprecate annotation and appid,context * ktlin * include MainApplication.java, locks, early returns * chore: Dispatcher Threads (#2375) * Using dispatcher * Update threads to 2 * Updated methods * linting * readme * using the same thread pool * lint * making sure initstate has the right value * lint * Clear state and skip performance tests * lint * clear preferences * fixing tests * fixing tests * fixing tests * fixing tests * fixing tests * addressed PR comments * Addressed comments and fixed tests * lint * lint * fix test * lint * rewrote the test * fix test * made the test more robust * clear all preferences and simplified mocks * added more robustness --------- Co-authored-by: AR Abdul Azeez <abdul@onesignal.com> * Fix OperationRepoTests CI/CD flakiness by using individual coVerify calls - Replace coVerifyOrder with individual coVerify(exactly = 1) calls - Makes tests more resilient to timing variations in CI/CD environments - Maintains verification of all critical operations while allowing flexibility in exact timing * remove try catch and lint * Addressed comments, removed global scope launches, broke down userswitcher * fixed flag * fix tests * making sure using the name instead of value * test isolation * logout test * comments * cleanup --------- Co-authored-by: AR Abdul Azeez <abdul@onesignal.com> * chore: bump SDK_VERSION to 5.4.0-alpha-02 (#2386) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * Fix permissions activity (#2388) * broke down permissions activity * fixed the permissions dialog * cleanup * permissions tests * lint * waiting to false for pause * added some tests for pause * uncommented the code * removed duplicate class * fixed wrong import * fixed imports * fixed bug to display the dialog after cancelling * formatting ktlint * tests * lint * adding delay * removing the theme and going back to production * add a delay * add a delay --------- Co-authored-by: AR Abdul Azeez <abdul@onesignal.com> * chore: bump SDK_VERSION to 5.4.0-alpha-03 (#2392) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * spotless check * added more time * added more time --------- Co-authored-by: jinliu9508 <jinliu9508@gmail.com> Co-authored-by: AR Abdul Azeez <abdul@onesignal.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
jinliu9508
added a commit
that referenced
this pull request
Jan 6, 2026
* refactor: move initialization process off main thread * Release 5.4.0-alpha-01 * feat: Add Kotlin MainApplication and suspend initialization support (#2374) * feat: Add Kotlin MainApplication and suspend initialization support - Add MainApplicationKT.kt as Kotlin version of MainApplication.java - Add initWithContextSuspend() method for async initialization - Refactor OneSignalImp to use IO dispatcher internally for initialization - Add comprehensive unit tests for suspend initialization - Rename LatchAwaiter to CompletionAwaiter for better semantics - Add helper classes for user management (AppIdHelper, LoginHelper, LogoutHelper, UserSwitcher) - Update build.gradle to include Kotlin coroutines dependency - Ensure ANR prevention by using background threads for initialization * Added more tests * mandating passing app id in the login/logout methods * linting * Made app id mandatory for login and logout. * cleanup * reduce the forks * Time out, deprecate annotation and appid,context * ktlin * include MainApplication.java, locks, early returns * chore: Dispatcher Threads (#2375) * Using dispatcher * Update threads to 2 * Updated methods * linting * readme * using the same thread pool * lint * making sure initstate has the right value * lint * Clear state and skip performance tests * lint * clear preferences * fixing tests * fixing tests * fixing tests * fixing tests * fixing tests * addressed PR comments * Addressed comments and fixed tests * lint * lint * fix test * lint * rewrote the test * fix test * made the test more robust * clear all preferences and simplified mocks * added more robustness --------- Co-authored-by: AR Abdul Azeez <abdul@onesignal.com> * Fix OperationRepoTests CI/CD flakiness by using individual coVerify calls - Replace coVerifyOrder with individual coVerify(exactly = 1) calls - Makes tests more resilient to timing variations in CI/CD environments - Maintains verification of all critical operations while allowing flexibility in exact timing * remove try catch and lint * Addressed comments, removed global scope launches, broke down userswitcher * fixed flag * fix tests * making sure using the name instead of value * test isolation * logout test * comments * cleanup --------- Co-authored-by: AR Abdul Azeez <abdul@onesignal.com> * chore: bump SDK_VERSION to 5.4.0-alpha-02 (#2386) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * Fix permissions activity (#2388) * broke down permissions activity * fixed the permissions dialog * cleanup * permissions tests * lint * waiting to false for pause * added some tests for pause * uncommented the code * removed duplicate class * fixed wrong import * fixed imports * fixed bug to display the dialog after cancelling * formatting ktlint * tests * lint * adding delay * removing the theme and going back to production * add a delay * add a delay --------- Co-authored-by: AR Abdul Azeez <abdul@onesignal.com> * chore: bump SDK_VERSION to 5.4.0-alpha-03 (#2392) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * spotless check * added more time * added more time --------- Co-authored-by: jinliu9508 <jinliu9508@gmail.com> Co-authored-by: AR Abdul Azeez <abdul@onesignal.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> # Conflicts: # OneSignalSDK/build.gradle # OneSignalSDK/onesignal/core/src/main/java/com/onesignal/session/internal/session/impl/SessionListener.kt
jinliu9508
added a commit
that referenced
this pull request
Jan 8, 2026
* refactor: move initialization process off main thread * Release 5.4.0-alpha-01 * feat: Add Kotlin MainApplication and suspend initialization support (#2374) * feat: Add Kotlin MainApplication and suspend initialization support - Add MainApplicationKT.kt as Kotlin version of MainApplication.java - Add initWithContextSuspend() method for async initialization - Refactor OneSignalImp to use IO dispatcher internally for initialization - Add comprehensive unit tests for suspend initialization - Rename LatchAwaiter to CompletionAwaiter for better semantics - Add helper classes for user management (AppIdHelper, LoginHelper, LogoutHelper, UserSwitcher) - Update build.gradle to include Kotlin coroutines dependency - Ensure ANR prevention by using background threads for initialization * Added more tests * mandating passing app id in the login/logout methods * linting * Made app id mandatory for login and logout. * cleanup * reduce the forks * Time out, deprecate annotation and appid,context * ktlin * include MainApplication.java, locks, early returns * chore: Dispatcher Threads (#2375) * Using dispatcher * Update threads to 2 * Updated methods * linting * readme * using the same thread pool * lint * making sure initstate has the right value * lint * Clear state and skip performance tests * lint * clear preferences * fixing tests * fixing tests * fixing tests * fixing tests * fixing tests * addressed PR comments * Addressed comments and fixed tests * lint * lint * fix test * lint * rewrote the test * fix test * made the test more robust * clear all preferences and simplified mocks * added more robustness --------- Co-authored-by: AR Abdul Azeez <abdul@onesignal.com> * Fix OperationRepoTests CI/CD flakiness by using individual coVerify calls - Replace coVerifyOrder with individual coVerify(exactly = 1) calls - Makes tests more resilient to timing variations in CI/CD environments - Maintains verification of all critical operations while allowing flexibility in exact timing * remove try catch and lint * Addressed comments, removed global scope launches, broke down userswitcher * fixed flag * fix tests * making sure using the name instead of value * test isolation * logout test * comments * cleanup --------- Co-authored-by: AR Abdul Azeez <abdul@onesignal.com> * chore: bump SDK_VERSION to 5.4.0-alpha-02 (#2386) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * Fix permissions activity (#2388) * broke down permissions activity * fixed the permissions dialog * cleanup * permissions tests * lint * waiting to false for pause * added some tests for pause * uncommented the code * removed duplicate class * fixed wrong import * fixed imports * fixed bug to display the dialog after cancelling * formatting ktlint * tests * lint * adding delay * removing the theme and going back to production * add a delay * add a delay --------- Co-authored-by: AR Abdul Azeez <abdul@onesignal.com> * chore: bump SDK_VERSION to 5.4.0-alpha-03 (#2392) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * spotless check * added more time * added more time --------- Co-authored-by: jinliu9508 <jinliu9508@gmail.com> Co-authored-by: AR Abdul Azeez <abdul@onesignal.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> # Conflicts: # OneSignalSDK/build.gradle # OneSignalSDK/onesignal/core/src/main/java/com/onesignal/session/internal/session/impl/SessionListener.kt
jinliu9508
added a commit
that referenced
this pull request
Jan 8, 2026
* refactor: move initialization process off main thread * Release 5.4.0-alpha-01 * feat: Add Kotlin MainApplication and suspend initialization support (#2374) * feat: Add Kotlin MainApplication and suspend initialization support - Add MainApplicationKT.kt as Kotlin version of MainApplication.java - Add initWithContextSuspend() method for async initialization - Refactor OneSignalImp to use IO dispatcher internally for initialization - Add comprehensive unit tests for suspend initialization - Rename LatchAwaiter to CompletionAwaiter for better semantics - Add helper classes for user management (AppIdHelper, LoginHelper, LogoutHelper, UserSwitcher) - Update build.gradle to include Kotlin coroutines dependency - Ensure ANR prevention by using background threads for initialization * Added more tests * mandating passing app id in the login/logout methods * linting * Made app id mandatory for login and logout. * cleanup * reduce the forks * Time out, deprecate annotation and appid,context * ktlin * include MainApplication.java, locks, early returns * chore: Dispatcher Threads (#2375) * Using dispatcher * Update threads to 2 * Updated methods * linting * readme * using the same thread pool * lint * making sure initstate has the right value * lint * Clear state and skip performance tests * lint * clear preferences * fixing tests * fixing tests * fixing tests * fixing tests * fixing tests * addressed PR comments * Addressed comments and fixed tests * lint * lint * fix test * lint * rewrote the test * fix test * made the test more robust * clear all preferences and simplified mocks * added more robustness --------- Co-authored-by: AR Abdul Azeez <abdul@onesignal.com> * Fix OperationRepoTests CI/CD flakiness by using individual coVerify calls - Replace coVerifyOrder with individual coVerify(exactly = 1) calls - Makes tests more resilient to timing variations in CI/CD environments - Maintains verification of all critical operations while allowing flexibility in exact timing * remove try catch and lint * Addressed comments, removed global scope launches, broke down userswitcher * fixed flag * fix tests * making sure using the name instead of value * test isolation * logout test * comments * cleanup --------- Co-authored-by: AR Abdul Azeez <abdul@onesignal.com> * chore: bump SDK_VERSION to 5.4.0-alpha-02 (#2386) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * Fix permissions activity (#2388) * broke down permissions activity * fixed the permissions dialog * cleanup * permissions tests * lint * waiting to false for pause * added some tests for pause * uncommented the code * removed duplicate class * fixed wrong import * fixed imports * fixed bug to display the dialog after cancelling * formatting ktlint * tests * lint * adding delay * removing the theme and going back to production * add a delay * add a delay --------- Co-authored-by: AR Abdul Azeez <abdul@onesignal.com> * chore: bump SDK_VERSION to 5.4.0-alpha-03 (#2392) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * spotless check * added more time * added more time --------- Co-authored-by: jinliu9508 <jinliu9508@gmail.com> Co-authored-by: AR Abdul Azeez <abdul@onesignal.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> # Conflicts: # OneSignalSDK/build.gradle # OneSignalSDK/onesignal/core/src/main/java/com/onesignal/session/internal/session/impl/SessionListener.kt
jinliu9508
pushed a commit
that referenced
this pull request
Jan 8, 2026
* refactor: move initialization process off main thread * Release 5.4.0-alpha-01 * feat: Add Kotlin MainApplication and suspend initialization support (#2374) * feat: Add Kotlin MainApplication and suspend initialization support - Add MainApplicationKT.kt as Kotlin version of MainApplication.java - Add initWithContextSuspend() method for async initialization - Refactor OneSignalImp to use IO dispatcher internally for initialization - Add comprehensive unit tests for suspend initialization - Rename LatchAwaiter to CompletionAwaiter for better semantics - Add helper classes for user management (AppIdHelper, LoginHelper, LogoutHelper, UserSwitcher) - Update build.gradle to include Kotlin coroutines dependency - Ensure ANR prevention by using background threads for initialization * Added more tests * mandating passing app id in the login/logout methods * linting * Made app id mandatory for login and logout. * cleanup * reduce the forks * Time out, deprecate annotation and appid,context * ktlin * include MainApplication.java, locks, early returns * chore: Dispatcher Threads (#2375) * Using dispatcher * Update threads to 2 * Updated methods * linting * readme * using the same thread pool * lint * making sure initstate has the right value * lint * Clear state and skip performance tests * lint * clear preferences * fixing tests * fixing tests * fixing tests * fixing tests * fixing tests * addressed PR comments * Addressed comments and fixed tests * lint * lint * fix test * lint * rewrote the test * fix test * made the test more robust * clear all preferences and simplified mocks * added more robustness --------- Co-authored-by: AR Abdul Azeez <abdul@onesignal.com> * Fix OperationRepoTests CI/CD flakiness by using individual coVerify calls - Replace coVerifyOrder with individual coVerify(exactly = 1) calls - Makes tests more resilient to timing variations in CI/CD environments - Maintains verification of all critical operations while allowing flexibility in exact timing * remove try catch and lint * Addressed comments, removed global scope launches, broke down userswitcher * fixed flag * fix tests * making sure using the name instead of value * test isolation * logout test * comments * cleanup --------- Co-authored-by: AR Abdul Azeez <abdul@onesignal.com> * chore: bump SDK_VERSION to 5.4.0-alpha-02 (#2386) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * Fix permissions activity (#2388) * broke down permissions activity * fixed the permissions dialog * cleanup * permissions tests * lint * waiting to false for pause * added some tests for pause * uncommented the code * removed duplicate class * fixed wrong import * fixed imports * fixed bug to display the dialog after cancelling * formatting ktlint * tests * lint * adding delay * removing the theme and going back to production * add a delay * add a delay --------- Co-authored-by: AR Abdul Azeez <abdul@onesignal.com> * chore: bump SDK_VERSION to 5.4.0-alpha-03 (#2392) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * spotless check * added more time * added more time --------- Co-authored-by: jinliu9508 <jinliu9508@gmail.com> Co-authored-by: AR Abdul Azeez <abdul@onesignal.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> # Conflicts: # OneSignalSDK/build.gradle # OneSignalSDK/onesignal/core/src/main/java/com/onesignal/session/internal/session/impl/SessionListener.kt # Conflicts: # Examples/OneSignalDemo/gradle.properties # OneSignalSDK/gradle.properties
jinliu9508
pushed a commit
that referenced
this pull request
Jan 8, 2026
* refactor: move initialization process off main thread * Release 5.4.0-alpha-01 * feat: Add Kotlin MainApplication and suspend initialization support (#2374) * feat: Add Kotlin MainApplication and suspend initialization support - Add MainApplicationKT.kt as Kotlin version of MainApplication.java - Add initWithContextSuspend() method for async initialization - Refactor OneSignalImp to use IO dispatcher internally for initialization - Add comprehensive unit tests for suspend initialization - Rename LatchAwaiter to CompletionAwaiter for better semantics - Add helper classes for user management (AppIdHelper, LoginHelper, LogoutHelper, UserSwitcher) - Update build.gradle to include Kotlin coroutines dependency - Ensure ANR prevention by using background threads for initialization * Added more tests * mandating passing app id in the login/logout methods * linting * Made app id mandatory for login and logout. * cleanup * reduce the forks * Time out, deprecate annotation and appid,context * ktlin * include MainApplication.java, locks, early returns * chore: Dispatcher Threads (#2375) * Using dispatcher * Update threads to 2 * Updated methods * linting * readme * using the same thread pool * lint * making sure initstate has the right value * lint * Clear state and skip performance tests * lint * clear preferences * fixing tests * fixing tests * fixing tests * fixing tests * fixing tests * addressed PR comments * Addressed comments and fixed tests * lint * lint * fix test * lint * rewrote the test * fix test * made the test more robust * clear all preferences and simplified mocks * added more robustness --------- Co-authored-by: AR Abdul Azeez <abdul@onesignal.com> * Fix OperationRepoTests CI/CD flakiness by using individual coVerify calls - Replace coVerifyOrder with individual coVerify(exactly = 1) calls - Makes tests more resilient to timing variations in CI/CD environments - Maintains verification of all critical operations while allowing flexibility in exact timing * remove try catch and lint * Addressed comments, removed global scope launches, broke down userswitcher * fixed flag * fix tests * making sure using the name instead of value * test isolation * logout test * comments * cleanup --------- Co-authored-by: AR Abdul Azeez <abdul@onesignal.com> * chore: bump SDK_VERSION to 5.4.0-alpha-02 (#2386) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * Fix permissions activity (#2388) * broke down permissions activity * fixed the permissions dialog * cleanup * permissions tests * lint * waiting to false for pause * added some tests for pause * uncommented the code * removed duplicate class * fixed wrong import * fixed imports * fixed bug to display the dialog after cancelling * formatting ktlint * tests * lint * adding delay * removing the theme and going back to production * add a delay * add a delay --------- Co-authored-by: AR Abdul Azeez <abdul@onesignal.com> * chore: bump SDK_VERSION to 5.4.0-alpha-03 (#2392) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * spotless check * added more time * added more time --------- Co-authored-by: jinliu9508 <jinliu9508@gmail.com> Co-authored-by: AR Abdul Azeez <abdul@onesignal.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> # Conflicts: # OneSignalSDK/build.gradle # OneSignalSDK/onesignal/core/src/main/java/com/onesignal/session/internal/session/impl/SessionListener.kt # Conflicts: # Examples/OneSignalDemo/gradle.properties # OneSignalSDK/gradle.properties # OneSignalSDK/onesignal/core/src/main/java/com/onesignal/common/threading/OneSignalDispatchers.kt # OneSignalSDK/onesignal/core/src/main/java/com/onesignal/core/activities/PermissionsActivity.kt # OneSignalSDK/onesignal/core/src/main/java/com/onesignal/core/internal/operations/impl/OperationRepo.kt # OneSignalSDK/onesignal/core/src/main/java/com/onesignal/core/internal/permissions/PermissionsViewModel.kt # OneSignalSDK/onesignal/core/src/main/java/com/onesignal/core/services/SyncJobService.kt # OneSignalSDK/onesignal/core/src/main/java/com/onesignal/internal/OneSignalImp.kt # OneSignalSDK/onesignal/core/src/test/java/com/onesignal/core/internal/application/SDKInitSuspendTests.kt # OneSignalSDK/onesignal/core/src/test/java/com/onesignal/core/internal/application/SDKInitTests.kt # OneSignalSDK/onesignal/core/src/test/java/com/onesignal/core/internal/operations/OperationRepoTests.kt # OneSignalSDK/onesignal/core/src/test/java/com/onesignal/core/internal/permissions/PermissionsViewModelTests.kt # OneSignalSDK/onesignal/core/src/test/java/com/onesignal/internal/OneSignalImpTests.kt # OneSignalSDK/onesignal/notifications/src/main/java/com/onesignal/notifications/internal/generation/impl/NotificationGenerationProcessor.kt # OneSignalSDK/onesignal/notifications/src/test/java/com/onesignal/notifications/internal/generation/NotificationGenerationProcessorTests.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
One Line Summary
Using a dispatcher instead of spawning new threads for different operations.
Details
Motivation
Optimizing the app and following standard implementations.
Scope
Internal only how the execution happens.
OPTIONAL - Other
OPTIONAL - Feel free to add any other sections or sub-sections that can explain your PR better.
Testing
Unit testing
Added Unit tests
Manual testing
RECOMMEND - OPTIONAL - Explain what scenarios were tested and the environment.
Example: Tested opening a notification while the app was foregrounded, app build with Android Studio 2020.3 with a fresh install of the OneSignal example app on a Pixel 6 with Android 12.
Affected code checklist
Checklist
Overview
Testing
Final pass
This change is