From f967e1ad6a0fb8f773945f09f6f7a85e9421227d Mon Sep 17 00:00:00 2001 From: Rakshitha Date: Fri, 12 Jul 2024 10:59:33 +0530 Subject: [PATCH] MOEN-33174: Cards fetch on login --- .../ios/Classes/MoEngageCardSyncListner.swift | 5 +++-- .../moengage_cards_ios/ios/Classes/MoEngageCardsPlugin.swift | 4 ++-- .../ios/Classes/MoEngageFlutterCardsConstants.swift | 4 ++-- cards/moengage_cards_ios/lib/moengage_cards_ios.dart | 4 ++-- .../lib/moengage_cards_platform_interface.dart | 2 +- .../lib/src/internal/constants.dart | 2 +- 6 files changed, 11 insertions(+), 10 deletions(-) diff --git a/cards/moengage_cards_ios/ios/Classes/MoEngageCardSyncListner.swift b/cards/moengage_cards_ios/ios/Classes/MoEngageCardSyncListner.swift index 86db4ee0..7cbe1c85 100644 --- a/cards/moengage_cards_ios/ios/Classes/MoEngageCardSyncListner.swift +++ b/cards/moengage_cards_ios/ios/Classes/MoEngageCardSyncListner.swift @@ -37,8 +37,9 @@ extension MoEngageCardsSyncEventType { return MoEngageFlutterCardsConstants.NativeToFlutterMethods.pullToRefreshCardsSync case .inboxOpen: return MoEngageFlutterCardsConstants.NativeToFlutterMethods.inboxOpenCardsSync - case .appOpen: - return MoEngageFlutterCardsConstants.NativeToFlutterMethods.appOpenCardsSync + case .appOpen, + .immediate: + return MoEngageFlutterCardsConstants.NativeToFlutterMethods.cardGenericSync } } } diff --git a/cards/moengage_cards_ios/ios/Classes/MoEngageCardsPlugin.swift b/cards/moengage_cards_ios/ios/Classes/MoEngageCardsPlugin.swift index 486cb5ae..8f442f29 100644 --- a/cards/moengage_cards_ios/ios/Classes/MoEngageCardsPlugin.swift +++ b/cards/moengage_cards_ios/ios/Classes/MoEngageCardsPlugin.swift @@ -52,8 +52,8 @@ public class MoEngageCardsPlugin: NSObject, FlutterPlugin { } case MoEngageFlutterCardsConstants.FlutterToNativeMethods.onCardSectionLoaded: pluginHelper.onCardsSectionLoaded(payload) - case MoEngageFlutterCardsConstants.FlutterToNativeMethods.setAppOpenCardsSyncListener: - pluginHelper.setAppOpenSyncListener(payload) + case MoEngageFlutterCardsConstants.FlutterToNativeMethods.cardGenericSync: + pluginHelper.setSyncListener(payload) case MoEngageFlutterCardsConstants.FlutterToNativeMethods.onCardSectionUnloaded: pluginHelper.onCardsSectionUnLoaded(payload) case MoEngageFlutterCardsConstants.FlutterToNativeMethods.getCardsCategories: diff --git a/cards/moengage_cards_ios/ios/Classes/MoEngageFlutterCardsConstants.swift b/cards/moengage_cards_ios/ios/Classes/MoEngageFlutterCardsConstants.swift index 1d9fe5b8..894af4f1 100644 --- a/cards/moengage_cards_ios/ios/Classes/MoEngageFlutterCardsConstants.swift +++ b/cards/moengage_cards_ios/ios/Classes/MoEngageFlutterCardsConstants.swift @@ -15,7 +15,7 @@ enum MoEngageFlutterCardsConstants { static let refreshCards = "refreshCards" static let fetchCards = "fetchCards" static let onCardSectionLoaded = "onCardSectionLoaded" - static let setAppOpenCardsSyncListener = "setAppOpenCardsSyncListener" + static let cardGenericSync = "setSyncCompleteListener" static let onCardSectionUnloaded = "onCardSectionUnLoaded" static let getCardsCategories = "getCardsCategories" static let cardsInfo = "getCardsInfo" @@ -32,6 +32,6 @@ enum MoEngageFlutterCardsConstants { enum NativeToFlutterMethods { static let inboxOpenCardsSync = "onInboxOpenCardsSync" static let pullToRefreshCardsSync = "onPullToRefreshCardsSync" - static let appOpenCardsSync = "onAppOpenCardsSync" + static let cardGenericSync = "onCardsSync" } } diff --git a/cards/moengage_cards_ios/lib/moengage_cards_ios.dart b/cards/moengage_cards_ios/lib/moengage_cards_ios.dart index 53f2c014..34de7a37 100644 --- a/cards/moengage_cards_ios/lib/moengage_cards_ios.dart +++ b/cards/moengage_cards_ios/lib/moengage_cards_ios.dart @@ -42,11 +42,11 @@ class MoEngageCardsIOS extends MoEngageCardsPlatform { @override void setSyncCompleteListener( CardsSyncListener cardsSyncListener, - String appId, + String appId ) { super.setSyncCompleteListener(cardsSyncListener, appId); methodChannel.invokeMethod( - methodSetAppOpenCardsSyncListener, + methodSetCardsSyncListener, getAccountMeta(appId), ); } diff --git a/cards/moengage_cards_platform_interface/lib/moengage_cards_platform_interface.dart b/cards/moengage_cards_platform_interface/lib/moengage_cards_platform_interface.dart index 4831aebc..f0f92bed 100644 --- a/cards/moengage_cards_platform_interface/lib/moengage_cards_platform_interface.dart +++ b/cards/moengage_cards_platform_interface/lib/moengage_cards_platform_interface.dart @@ -121,7 +121,7 @@ abstract class MoEngageCardsPlatformInterface extends PlatformInterface { /// [appId] - MoEngage App ID void setSyncCompleteListener( CardsSyncListener cardsSyncListener, - String appId, + String appId ) => throw UnimplementedError(); } diff --git a/cards/moengage_cards_platform_interface/lib/src/internal/constants.dart b/cards/moengage_cards_platform_interface/lib/src/internal/constants.dart index e98fa4f4..bb00bf24 100644 --- a/cards/moengage_cards_platform_interface/lib/src/internal/constants.dart +++ b/cards/moengage_cards_platform_interface/lib/src/internal/constants.dart @@ -79,7 +79,7 @@ const String methodInitialize = 'initialize'; const String methodRefreshCards = 'refreshCards'; const String methodFetchCards = 'fetchCards'; const String methodOnCardSectionLoaded = 'onCardSectionLoaded'; -const String methodSetAppOpenCardsSyncListener = 'setAppOpenCardsSyncListener'; +const String methodSetCardsSyncListener = 'setSyncCompleteListener'; const String methodOnCardSectionUnLoaded = 'onCardSectionUnLoaded'; const String methodCardsCategories = 'getCardsCategories'; const String methodCardsInfo = 'getCardsInfo';