Skip to content

WMSDK-435: Fix pending callbacks #160

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 9, 2025
Merged

WMSDK-435: Fix pending callbacks #160

merged 1 commit into from
Jun 9, 2025

Conversation

enotniy
Copy link
Collaborator

@enotniy enotniy commented Jun 5, 2025

@enotniy enotniy requested review from sergeysozinov and Copilot June 5, 2025 10:06
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request fixes pending callback issues by introducing an asynchronous initialization flow using _initFuture.

  • Introduces _initFuture to serialize initialization and callback execution.
  • Copies pending callbacks and operations to safely iterate during processing.
  • Ensures that various getter methods wait for initialization to complete before invoking platform methods.
Comments suppressed due to low confidence (2)

mindbox_platform_interface/lib/src/types/mindbox_method_handler.dart:117

  • [nitpick] Consider standardizing the null handling behavior for platform channel calls. For example, the getToken method uses a null-coalescing operator while getDeviceUUID does not. If a consistent behavior is desired, align these implementations.
void getDeviceUUID({required Function(String uuid) callback}) async {

mindbox_platform_interface/lib/src/types/mindbox_method_handler.dart:171

  • [nitpick] Consider using the negation operator (!custom) for clarity and to align with common coding practices.
if (custom == false && (_inAppClickHandler != null || _inAppDismissedHandler != null)) {

@mindbox-cloud mindbox-cloud deleted a comment from github-actions bot Jun 5, 2025
@@ -73,11 +81,15 @@ class MindboxMethodHandler {
_setMethodCallHandler();
}

for (final callbackMethod in _pendingCallbackMethods) {
final pendingCallbackMethodsCopy =
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А зачем нам этот код, если методы сработают только после инициализации? Т.е. списки будут пустыми

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

на всякий случай.

@enotniy enotniy merged commit ca9ed47 into develop Jun 9, 2025
11 of 12 checks passed
@enotniy enotniy deleted the feature/WMSDK-435 branch June 9, 2025 08:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants