Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ class MindboxMethodHandler {
'before initialization.');
}
await channel.invokeMethod('init', configuration.toMap());

if (!_methodHandlerSet) {
_setMethodCallHandler();
}

for (final callbackMethod in _pendingCallbackMethods) {
callbackMethod.callback(
await channel.invokeMethod(callbackMethod.methodName) ?? 'null');
Expand Down Expand Up @@ -144,19 +149,13 @@ class MindboxMethodHandler {
required PushClickHandler handler,
}) {
_pushClickHandler = handler;
if (!_methodHandlerSet) {
_setMethodCallHandler();
}
}

/// Method for handling In-app click.
void handleInAppClick({
required InAppClickHandler handler,
}) {
_inAppClickHandler = handler;
if (!_methodHandlerSet) {
_setMethodCallHandler();
}
registerInAppCallbacks(callbacks: [
CustomInAppCallback(
_inAppClickHandler ?? (id, redirectUrl, payload) => {},
Expand All @@ -170,9 +169,6 @@ class MindboxMethodHandler {
required InAppDismissedHandler handler,
}) {
_inAppDismissedHandler = handler;
if (!_methodHandlerSet) {
_setMethodCallHandler();
}
registerInAppCallbacks(callbacks: [
CustomInAppCallback(
_inAppClickHandler ?? (id, redirectUrl, payload) => {},
Expand Down Expand Up @@ -291,22 +287,24 @@ class MindboxMethodHandler {

void _setMethodCallHandler() {
channel.setMethodCallHandler((call) {
if (call.method == 'pushClicked') {
if (call.arguments is List) {
_pushClickHandler?.call(call.arguments[0], call.arguments[1]);
switch (call.method) {
case 'pushClicked':
if (call.arguments is List) {
_pushClickHandler?.call(call.arguments[0], call.arguments[1]);
}
break;
case 'onInAppClick':
if (call.arguments is List) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

можно сюда логов добавить? А то кажется, где то здесь проблема с кликами в inapp и пайлоад

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Не получится сюда добавить. Возможно, стоит завести задачку, чтобы мы могли на стороне Flutter прокидывать логи в натив

Copy link
Collaborator

@enotniy enotniy May 7, 2024

Choose a reason for hiding this comment

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

Возможно, к тому же надо туда же прокидывать информацию о том, что это Flutter, чтобы в user-agent вставлять

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Закину на доску техдолга тогда

_inAppClickHandler?.call(
call.arguments[0], call.arguments[1], call.arguments[2]);
}
break;
case 'onInAppDismissed':
if (call.arguments is String) {
_inAppDismissedHandler?.call(call.arguments);
}
break;
}
}
if (call.method == 'onInAppClick') {
if (call.arguments is List) {
_inAppClickHandler?.call(
call.arguments[0], call.arguments[1], call.arguments[2]);
}
}
if (call.method == 'onInAppDismissed') {
if (call.arguments is String) {
_inAppDismissedHandler?.call(call.arguments);
}
}
return Future.value(true);
});
_methodHandlerSet = true;
Expand Down