From da65316f96610c27283fc58a78e31b2b0468efc2 Mon Sep 17 00:00:00 2001 From: msoumya-engg-sdk Date: Mon, 27 Oct 2025 12:03:35 +0530 Subject: [PATCH] MOEN-41290: Added Swift Package Manager distribution support --- .github/workflows/cd.yml | 25 +- .github/workflows/ci.yml | 90 +++ .gitignore | 79 +- .travis.yml | 14 - .../CHANGELOG.md => CHANGELOG.md | 6 + CONTRIBUTING.md | 192 +++++ .../project.pbxproj | 706 ------------------ .../contents.xcworkspacedata | 7 - .../contents.xcworkspacedata | 10 - .../xcshareddata/IDEWorkspaceChecks.plist | 8 - Example/Podfile.lock | 126 ---- Examples/.gitignore | 77 ++ .../MoEngagePluginBase}/AppDelegate.h | 0 .../MoEngagePluginBase}/AppDelegate.m | 0 .../AppIcon.appiconset/Contents.json | 0 .../Base.lproj/LaunchScreen.storyboard | 0 .../Base.lproj/Main.storyboard | 0 .../MoEngagePluginBase/Info.plist | 0 .../MoEngagePluginBase.entitlements | 0 .../MoEngagePluginBase}/ViewController.h | 0 .../MoEngagePluginBase}/ViewController.m | 0 .../MoEngagePluginBase}/main.m | 0 {Example => Examples}/Podfile | 16 +- Examples/Project.swift | 65 ++ Examples/Tuist.swift | 6 + Examples/Workspace.swift | 3 + MoEngagePluginBase.podspec | 56 +- MoEngagePluginCards.podspec | 18 - MoEngagePluginCards/CHANGELOG.md | 67 -- .../MoEngageCardCampaign+Array.swift | 26 - .../MoEngageCardClickData.swift | 35 - .../MoEngageCardsCategoryData.swift | 27 - .../NativeToHybrid/HybridEncodable.swift | 23 - .../MoEngageCampaignState.swift | 36 - .../MoEngageCardAccessibilityData.swift | 21 - .../NativeToHybrid/MoEngageCardAction.swift | 26 - .../MoEngageCardCampaign+Encode.swift | 42 -- .../MoEngageCardContainer.swift | 28 - .../NativeToHybrid/MoEngageCardData.swift | 22 - .../MoEngageCardDisplayControl.swift | 40 - .../NativeToHybrid/MoEngageCardShowTime.swift | 22 - .../NativeToHybrid/MoEngageCardStyle.swift | 21 - .../MoEngageCardSyncCompleteMetaData.swift | 62 -- .../MoEngageCardTemplateData.swift | 22 - .../NativeToHybrid/MoEngageCardWidget.swift | 30 - .../NativeToHybrid/MoEngageCardsData.swift | 26 - .../Sync/MoEngageCardSyncDataManager.swift | 40 - .../Sync/MoEngageCardSyncManager.swift | 140 ---- .../Helpers/MoEngageCardsDecodingError.swift | 24 - .../Helpers/MoEngageCardsPluginLogger.swift | 92 --- .../Helpers/MoEngagePluginCardsContants.swift | 19 - .../MoEngagePluginCardsDelegateHandler.swift | 16 - .../Helpers/MoEngagePluginCardsUtil.swift | 73 -- .../MoEngagePluginCardsBridge.swift | 492 ------------ MoEngagePluginGeofence.podspec | 13 - MoEngagePluginGeofence/CHANGELOG.md | 61 -- .../MoEngagePluginGeofenceBridge.swift | 29 - MoEngagePluginInbox.podspec | 13 - MoEngagePluginInbox/CHANGELOG.md | 61 -- .../MoEngagePluginInboxBridge.swift | 52 -- .../MoEngagePluginInboxConstants.swift | 38 - .../MoEngagePluginInboxUtils.swift | 129 ---- MoEngageSegmentPluginBase/Example/.gitignore | 68 -- .../xcschemes/MoEPluginBaseExample.xcscheme | 78 -- .../en.lproj/InfoPlist.strings | 2 - .../Example/Podfile.lock | 23 - .../Example/Tests/Tests-Info.plist | 22 - .../Example/Tests/Tests-Prefix.pch | 7 - .../Example/Tests/Tests.m | 35 - .../Example/Tests/en.lproj/InfoPlist.strings | 2 - .../xcshareddata/IDEWorkspaceChecks.plist | 8 - .../xcshareddata/swiftpm/Package.resolved | 14 - Package.swift | 42 ++ README.md | 10 +- Rakefile | 39 + .../MoEngageAnalyticsConfig.swift | 0 .../MoEngageInitConfig.swift | 0 .../MoEngageInitConfigCache.swift | 0 .../MoEngagePluginBase}/MoEngagePlugin.swift | 0 .../MoEngagePluginBaseHandler.swift | 0 .../MoEngagePluginBaseProtocol.swift | 0 .../MoEngagePluginBridge.swift | 0 .../MoEngagePluginConstants.swift | 0 .../MoEngagePluginInAppDelegateHandler.swift | 0 ...MoEngagePluginMessageDelegateHandler.swift | 0 .../MoEngagePluginMessageHandler.swift | 0 ...oEngagePluginMessageInstanceProvider.swift | 0 .../MoEngagePluginMessageUtils.swift | 0 .../MoEngagePluginModels.swift | 0 .../MoEngagePluginParser.swift | 0 .../MoEngagePluginUtils.swift | 0 ...EngageSDKDefaultInitializationConfig.swift | 0 .../MoEngageSDKInitializationConfig.swift | 0 .../CHANGELOG-old.md | 0 .../Example}/.gitignore | 0 .../project.pbxproj | 0 .../xcschemes/MoEPluginBaseExample.xcscheme | 0 .../MoEPluginBaseExample/AppDelegate.h | 0 .../MoEPluginBaseExample/AppDelegate.m | 0 .../Base.lproj/LaunchScreen.storyboard | 0 .../Base.lproj/Main.storyboard | 0 .../AppIcon.appiconset/Contents.json | 0 .../MoEPluginBaseExample-Info.plist | 0 .../MoEPluginBaseExample.entitlements | 0 .../MoEPluginBaseExample/ViewController.h | 0 .../MoEPluginBaseExample/ViewController.m | 0 .../en.lproj/InfoPlist.strings | 0 .../Example/MoEPluginBaseExample/main.m | 0 .../Example/Podfile | 0 .../Example}/Tests/Tests-Info.plist | 0 .../Example}/Tests/Tests-Prefix.pch | 0 .../Example}/Tests/Tests.m | 0 .../Example}/Tests/en.lproj/InfoPlist.strings | 0 .../MoEngageSegmentPluginBase}/LICENSE | 0 .../MoEngageSegmentPluginBase.podspec | 0 .../MoEngageSegmentPlugin.swift | 0 .../MoEngageSegmentPluginBridge.swift | 0 .../MoEngageSegmentPluginConstants.swift | 0 .../MoEngageSegmentPluginParser.swift | 0 .../MoEngageSegmentPluginUtils.swift | 0 .../project.pbxproj | 0 .../contents.xcworkspacedata | 0 .../xcshareddata/IDEWorkspaceChecks.plist | 0 .../MoEngageSegmentMockData.swift | 0 .../MoEngageSegmentPluginParserTests.swift | 0 .../MoEngageSegmentPluginUtilsTests.swift | 0 .../MoEngageCardCampaignTest.swift | 186 ----- .../MoEngageCardDecodingTest.swift | 101 --- .../MoEngageCardSyncTest.swift | 135 ---- .../MoEngagePluginCardsBridgeTest.swift | 463 ------------ Utilities/post_build.rb | 57 ++ Utilities/release_dependents.rb | 28 + Utilities/spec.rb | 54 -- _Pods.xcodeproj | 1 - package.json | 21 +- 135 files changed, 743 insertions(+), 4025 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 .travis.yml rename MoEngagePluginBase/CHANGELOG.md => CHANGELOG.md (88%) create mode 100644 CONTRIBUTING.md delete mode 100644 Example/MoEPluginBaseExample.xcodeproj/project.pbxproj delete mode 100644 Example/MoEPluginBaseExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata delete mode 100644 Example/MoEPluginBaseExample.xcworkspace/contents.xcworkspacedata delete mode 100644 Example/MoEPluginBaseExample.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist delete mode 100644 Example/Podfile.lock create mode 100644 Examples/.gitignore rename {Example/MoEPluginBaseExample => Examples/MoEngagePluginBase}/AppDelegate.h (100%) rename {Example/MoEPluginBaseExample => Examples/MoEngagePluginBase}/AppDelegate.m (100%) rename {Example/MoEPluginBaseExample/Images.xcassets => Examples/MoEngagePluginBase}/AppIcon.appiconset/Contents.json (100%) rename {Example/MoEPluginBaseExample => Examples/MoEngagePluginBase}/Base.lproj/LaunchScreen.storyboard (100%) rename {Example/MoEPluginBaseExample => Examples/MoEngagePluginBase}/Base.lproj/Main.storyboard (100%) rename Example/MoEPluginBaseExample/MoEPluginBaseExample-Info.plist => Examples/MoEngagePluginBase/Info.plist (100%) rename Example/MoEPluginBaseExample/MoEPluginBaseExample.entitlements => Examples/MoEngagePluginBase/MoEngagePluginBase.entitlements (100%) rename {Example/MoEPluginBaseExample => Examples/MoEngagePluginBase}/ViewController.h (100%) rename {Example/MoEPluginBaseExample => Examples/MoEngagePluginBase}/ViewController.m (100%) rename {Example/MoEPluginBaseExample => Examples/MoEngagePluginBase}/main.m (100%) rename {Example => Examples}/Podfile (73%) create mode 100644 Examples/Project.swift create mode 100644 Examples/Tuist.swift create mode 100644 Examples/Workspace.swift delete mode 100644 MoEngagePluginCards.podspec delete mode 100644 MoEngagePluginCards/CHANGELOG.md delete mode 100644 MoEngagePluginCards/DataTransfer/HybridToNative/MoEngageCardCampaign+Array.swift delete mode 100644 MoEngagePluginCards/DataTransfer/HybridToNative/MoEngageCardClickData.swift delete mode 100644 MoEngagePluginCards/DataTransfer/HybridToNative/MoEngageCardsCategoryData.swift delete mode 100644 MoEngagePluginCards/DataTransfer/NativeToHybrid/HybridEncodable.swift delete mode 100644 MoEngagePluginCards/DataTransfer/NativeToHybrid/MoEngageCampaignState.swift delete mode 100644 MoEngagePluginCards/DataTransfer/NativeToHybrid/MoEngageCardAccessibilityData.swift delete mode 100644 MoEngagePluginCards/DataTransfer/NativeToHybrid/MoEngageCardAction.swift delete mode 100644 MoEngagePluginCards/DataTransfer/NativeToHybrid/MoEngageCardCampaign+Encode.swift delete mode 100644 MoEngagePluginCards/DataTransfer/NativeToHybrid/MoEngageCardContainer.swift delete mode 100644 MoEngagePluginCards/DataTransfer/NativeToHybrid/MoEngageCardData.swift delete mode 100644 MoEngagePluginCards/DataTransfer/NativeToHybrid/MoEngageCardDisplayControl.swift delete mode 100644 MoEngagePluginCards/DataTransfer/NativeToHybrid/MoEngageCardShowTime.swift delete mode 100644 MoEngagePluginCards/DataTransfer/NativeToHybrid/MoEngageCardStyle.swift delete mode 100644 MoEngagePluginCards/DataTransfer/NativeToHybrid/MoEngageCardSyncCompleteMetaData.swift delete mode 100644 MoEngagePluginCards/DataTransfer/NativeToHybrid/MoEngageCardTemplateData.swift delete mode 100644 MoEngagePluginCards/DataTransfer/NativeToHybrid/MoEngageCardWidget.swift delete mode 100644 MoEngagePluginCards/DataTransfer/NativeToHybrid/MoEngageCardsData.swift delete mode 100644 MoEngagePluginCards/DataTransfer/Sync/MoEngageCardSyncDataManager.swift delete mode 100644 MoEngagePluginCards/DataTransfer/Sync/MoEngageCardSyncManager.swift delete mode 100644 MoEngagePluginCards/Helpers/MoEngageCardsDecodingError.swift delete mode 100644 MoEngagePluginCards/Helpers/MoEngageCardsPluginLogger.swift delete mode 100644 MoEngagePluginCards/Helpers/MoEngagePluginCardsContants.swift delete mode 100644 MoEngagePluginCards/Helpers/MoEngagePluginCardsDelegateHandler.swift delete mode 100644 MoEngagePluginCards/Helpers/MoEngagePluginCardsUtil.swift delete mode 100644 MoEngagePluginCards/MoEngagePluginCardsBridge.swift delete mode 100644 MoEngagePluginGeofence.podspec delete mode 100644 MoEngagePluginGeofence/CHANGELOG.md delete mode 100644 MoEngagePluginGeofence/MoEngagePluginGeofenceBridge.swift delete mode 100644 MoEngagePluginInbox.podspec delete mode 100644 MoEngagePluginInbox/CHANGELOG.md delete mode 100644 MoEngagePluginInbox/MoEngagePluginInboxBridge.swift delete mode 100644 MoEngagePluginInbox/MoEngagePluginInboxConstants.swift delete mode 100644 MoEngagePluginInbox/MoEngagePluginInboxUtils.swift delete mode 100644 MoEngageSegmentPluginBase/Example/.gitignore delete mode 100644 MoEngageSegmentPluginBase/Example/MoEPluginBaseExample.xcodeproj/xcshareddata/xcschemes/MoEPluginBaseExample.xcscheme delete mode 100644 MoEngageSegmentPluginBase/Example/MoEPluginBaseExample/en.lproj/InfoPlist.strings delete mode 100644 MoEngageSegmentPluginBase/Example/Podfile.lock delete mode 100644 MoEngageSegmentPluginBase/Example/Tests/Tests-Info.plist delete mode 100644 MoEngageSegmentPluginBase/Example/Tests/Tests-Prefix.pch delete mode 100644 MoEngageSegmentPluginBase/Example/Tests/Tests.m delete mode 100644 MoEngageSegmentPluginBase/Example/Tests/en.lproj/InfoPlist.strings delete mode 100644 MoEngageSegmentPluginBase/MoEngageSegmentPluginBaseApp.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist delete mode 100644 MoEngageSegmentPluginBase/MoEngageSegmentPluginBaseApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved create mode 100644 Package.swift create mode 100644 Rakefile rename {MoEngagePluginBase => Sources/MoEngagePluginBase}/MoEngageAnalyticsConfig.swift (100%) rename {MoEngagePluginBase => Sources/MoEngagePluginBase}/MoEngageInitConfig.swift (100%) rename {MoEngagePluginBase => Sources/MoEngagePluginBase}/MoEngageInitConfigCache.swift (100%) rename {MoEngagePluginBase => Sources/MoEngagePluginBase}/MoEngagePlugin.swift (100%) rename {MoEngagePluginBase => Sources/MoEngagePluginBase}/MoEngagePluginBaseHandler.swift (100%) rename {MoEngagePluginBase => Sources/MoEngagePluginBase}/MoEngagePluginBaseProtocol.swift (100%) rename {MoEngagePluginBase => Sources/MoEngagePluginBase}/MoEngagePluginBridge.swift (100%) rename {MoEngagePluginBase => Sources/MoEngagePluginBase}/MoEngagePluginConstants.swift (100%) rename {MoEngagePluginBase => Sources/MoEngagePluginBase}/MoEngagePluginInAppDelegateHandler.swift (100%) rename {MoEngagePluginBase => Sources/MoEngagePluginBase}/MoEngagePluginMessageDelegateHandler.swift (100%) rename {MoEngagePluginBase => Sources/MoEngagePluginBase}/MoEngagePluginMessageHandler.swift (100%) rename {MoEngagePluginBase => Sources/MoEngagePluginBase}/MoEngagePluginMessageInstanceProvider.swift (100%) rename {MoEngagePluginBase => Sources/MoEngagePluginBase}/MoEngagePluginMessageUtils.swift (100%) rename {MoEngagePluginBase => Sources/MoEngagePluginBase}/MoEngagePluginModels.swift (100%) rename {MoEngagePluginBase => Sources/MoEngagePluginBase}/MoEngagePluginParser.swift (100%) rename {MoEngagePluginBase => Sources/MoEngagePluginBase}/MoEngagePluginUtils.swift (100%) rename {MoEngagePluginBase => Sources/MoEngagePluginBase}/MoEngageSDKDefaultInitializationConfig.swift (100%) rename {MoEngagePluginBase => Sources/MoEngagePluginBase}/MoEngageSDKInitializationConfig.swift (100%) rename {MoEngageSegmentPluginBase => Sources/MoEngageSegmentPluginBase}/CHANGELOG-old.md (100%) rename {Example => Sources/MoEngageSegmentPluginBase/Example}/.gitignore (100%) rename {MoEngageSegmentPluginBase => Sources/MoEngageSegmentPluginBase}/Example/MoEPluginBaseExample.xcodeproj/project.pbxproj (100%) rename {Example => Sources/MoEngageSegmentPluginBase/Example}/MoEPluginBaseExample.xcodeproj/xcshareddata/xcschemes/MoEPluginBaseExample.xcscheme (100%) rename {MoEngageSegmentPluginBase => Sources/MoEngageSegmentPluginBase}/Example/MoEPluginBaseExample/AppDelegate.h (100%) rename {MoEngageSegmentPluginBase => Sources/MoEngageSegmentPluginBase}/Example/MoEPluginBaseExample/AppDelegate.m (100%) rename {MoEngageSegmentPluginBase => Sources/MoEngageSegmentPluginBase}/Example/MoEPluginBaseExample/Base.lproj/LaunchScreen.storyboard (100%) rename {MoEngageSegmentPluginBase => Sources/MoEngageSegmentPluginBase}/Example/MoEPluginBaseExample/Base.lproj/Main.storyboard (100%) rename {MoEngageSegmentPluginBase => Sources/MoEngageSegmentPluginBase}/Example/MoEPluginBaseExample/Images.xcassets/AppIcon.appiconset/Contents.json (100%) rename {MoEngageSegmentPluginBase => Sources/MoEngageSegmentPluginBase}/Example/MoEPluginBaseExample/MoEPluginBaseExample-Info.plist (100%) rename {MoEngageSegmentPluginBase => Sources/MoEngageSegmentPluginBase}/Example/MoEPluginBaseExample/MoEPluginBaseExample.entitlements (100%) rename {MoEngageSegmentPluginBase => Sources/MoEngageSegmentPluginBase}/Example/MoEPluginBaseExample/ViewController.h (100%) rename {MoEngageSegmentPluginBase => Sources/MoEngageSegmentPluginBase}/Example/MoEPluginBaseExample/ViewController.m (100%) rename {Example => Sources/MoEngageSegmentPluginBase/Example}/MoEPluginBaseExample/en.lproj/InfoPlist.strings (100%) rename {MoEngageSegmentPluginBase => Sources/MoEngageSegmentPluginBase}/Example/MoEPluginBaseExample/main.m (100%) rename {MoEngageSegmentPluginBase => Sources/MoEngageSegmentPluginBase}/Example/Podfile (100%) rename {Example => Sources/MoEngageSegmentPluginBase/Example}/Tests/Tests-Info.plist (100%) rename {Example => Sources/MoEngageSegmentPluginBase/Example}/Tests/Tests-Prefix.pch (100%) rename {Example => Sources/MoEngageSegmentPluginBase/Example}/Tests/Tests.m (100%) rename {Example => Sources/MoEngageSegmentPluginBase/Example}/Tests/en.lproj/InfoPlist.strings (100%) rename {MoEngageSegmentPluginBase => Sources/MoEngageSegmentPluginBase}/LICENSE (100%) rename {MoEngageSegmentPluginBase => Sources/MoEngageSegmentPluginBase}/MoEngageSegmentPluginBase.podspec (100%) rename {MoEngageSegmentPluginBase => Sources/MoEngageSegmentPluginBase}/MoEngageSegmentPluginBase/MoEngageSegmentPlugin.swift (100%) rename {MoEngageSegmentPluginBase => Sources/MoEngageSegmentPluginBase}/MoEngageSegmentPluginBase/MoEngageSegmentPluginBridge.swift (100%) rename {MoEngageSegmentPluginBase => Sources/MoEngageSegmentPluginBase}/MoEngageSegmentPluginBase/MoEngageSegmentPluginConstants.swift (100%) rename {MoEngageSegmentPluginBase => Sources/MoEngageSegmentPluginBase}/MoEngageSegmentPluginBase/MoEngageSegmentPluginParser.swift (100%) rename {MoEngageSegmentPluginBase => Sources/MoEngageSegmentPluginBase}/MoEngageSegmentPluginBase/MoEngageSegmentPluginUtils.swift (100%) rename {MoEngageSegmentPluginBase => Sources/MoEngageSegmentPluginBase}/MoEngageSegmentPluginBaseApp.xcodeproj/project.pbxproj (100%) rename {MoEngageSegmentPluginBase => Sources/MoEngageSegmentPluginBase}/MoEngageSegmentPluginBaseApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata (100%) rename {Example/MoEPluginBaseExample.xcodeproj => Sources/MoEngageSegmentPluginBase/MoEngageSegmentPluginBaseApp.xcodeproj}/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist (100%) rename {MoEngageSegmentPluginBase => Sources/MoEngageSegmentPluginBase}/MoEngageSegmentPluginBaseTests/MoEngageSegmentMockData.swift (100%) rename {MoEngageSegmentPluginBase => Sources/MoEngageSegmentPluginBase}/MoEngageSegmentPluginBaseTests/MoEngageSegmentPluginParserTests.swift (100%) rename {MoEngageSegmentPluginBase => Sources/MoEngageSegmentPluginBase}/MoEngageSegmentPluginBaseTests/MoEngageSegmentPluginUtilsTests.swift (100%) delete mode 100644 Tests/MoEngagePluginCardsTests/MoEngageCardCampaignTest.swift delete mode 100644 Tests/MoEngagePluginCardsTests/MoEngageCardDecodingTest.swift delete mode 100644 Tests/MoEngagePluginCardsTests/MoEngageCardSyncTest.swift delete mode 100644 Tests/MoEngagePluginCardsTests/MoEngagePluginCardsBridgeTest.swift create mode 100755 Utilities/post_build.rb create mode 100755 Utilities/release_dependents.rb delete mode 100644 Utilities/spec.rb delete mode 120000 _Pods.xcodeproj diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 8d84ab8..0219d46 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -12,6 +12,21 @@ on: type: string required: false default: '' + release-cards: + description: Whether to release Cards + type: boolean + required: false + default: true + release-geofence: + description: Whether to release Geofence + type: boolean + required: false + default: true + release-inbox: + description: Whether to release Inbox + type: boolean + required: false + default: true jobs: release: @@ -24,8 +39,6 @@ jobs: path: scripts repository: moengage/sdk-automation-scripts token: ${{ secrets.SDK_BOT_ACCESS_TOKEN }} - fetch-depth: 0 - fetch-tags: true - name: Setup dev environment uses: ./scripts/actions/ios-action-setup @@ -49,3 +62,11 @@ jobs: COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }} MO_RELEASE_TICKET: ${{ inputs.ticket }} MO_SDK_DEPENDENCY_VERSION: ${{ inputs.sdk-version }} + + - name: Release dependents + run: ${{ github.workspace }}/source/Utilities/release_dependents.rb + working-directory: source + env: + GH_TOKEN: ${{ secrets.SDK_BOT_ACCESS_TOKEN }} + GITHUB_TOKEN: ${{ secrets.SDK_BOT_ACCESS_TOKEN }} + MO_WORKFLOW_INPUTS: ${{ toJSON(inputs) }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..d2e8be7 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,90 @@ +name: Run tests + +on: + pull_request: + workflow_dispatch: + inputs: + environment_variables: + description: Custom space separated environment variables, that can be used for setup task + type: string + required: false + default: '' + +concurrency: + group: ci-${{ github.ref }} + cancel-in-progress: true + +jobs: + cocoapods: + name: Build and run tests for CocoaPods + runs-on: macos-15 + + steps: + - name: Set custom environment variables + if: github.event_name == 'workflow_dispatch' + run: | + VARIABLES=(${{ inputs.environment_variables }}) + for variable in ${VARIABLES[@]}; do + echo "$variable" >> $GITHUB_ENV + done + + - name: Checkout scripts + uses: actions/checkout@v4 + with: + token: ${{ secrets.SDK_BOT_ACCESS_TOKEN }} + path: scripts + repository: moengage/sdk-automation-scripts + + - name: Setup dev environment + uses: ./scripts/actions/ios-action-setup + env: + SDK_BOT_ACCESS_TOKEN: ${{ secrets.SDK_BOT_ACCESS_TOKEN }} + + - name: Checkout source repository + uses: actions/checkout@v4 + with: + token: ${{ secrets.SDK_BOT_ACCESS_TOKEN }} + path: source + + - name: Build and Run tests + working-directory: ./source + run: pod lib lint --allow-warnings --skip-import-validation + + swift-package: + name: Build and run tests for Swift Package Manager + runs-on: macos-15 + + steps: + - name: Set custom environment variables + if: github.event_name == 'workflow_dispatch' + run: | + VARIABLES=(${{ inputs.environment_variables }}) + for variable in ${VARIABLES[@]}; do + echo "$variable" >> $GITHUB_ENV + done + + - name: Checkout scripts + uses: actions/checkout@v4 + with: + token: ${{ secrets.SDK_BOT_ACCESS_TOKEN }} + path: scripts + repository: moengage/sdk-automation-scripts + + - name: Setup dev environment + uses: ./scripts/actions/ios-action-setup + env: + SDK_BOT_ACCESS_TOKEN: ${{ secrets.SDK_BOT_ACCESS_TOKEN }} + + - name: Checkout source repository + uses: actions/checkout@v4 + with: + token: ${{ secrets.SDK_BOT_ACCESS_TOKEN }} + path: source + + - name: Validate CHANGELOG + run: ${{ github.workspace }}/scripts/scripts/release/ios/validate_changelog.rb + working-directory: ./source + + - name: Build and Run tests + run: ${{ github.workspace }}/scripts/scripts/release/ios/build_swift_package.rb + working-directory: ./source diff --git a/.gitignore b/.gitignore index e77688e..243c6b4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,21 +1,15 @@ -# OS X -.DS_Store - # Xcode # # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore -## User settings -xcuserdata/ - -## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9) -*.xcscmblueprint -*.xccheckout +.DS_Store +Thumbs.db -## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4) +## Build generated build/ DerivedData/ -*.moved-aside + +## Various settings *.pbxuser !default.pbxuser *.mode1v3 @@ -24,14 +18,37 @@ DerivedData/ !default.mode2v3 *.perspectivev3 !default.perspectivev3 +xcuserdata/ +*.xcuserstate -## Obj-C/Swift specific -*.hmap +*.xcodeproj/project.xcworkspace/xcuserdata +*.xcodeproj/project.xcworkspace/xcshareddata -## App packaging -*.ipa -*.dSYM.zip -*.dSYM +## Other +*.moved-aside +*.xccheckout +*.xcscmblueprint + + +# Obj-C/Swift specific +# +# *.hmap +# *.ipa +# *.dSYM.zip +# *.dSYM + +## Playgrounds +timeline.xctimeline +playground.xcworkspace + +# Swift Package Manager +# +# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. +.swiftpm +Packages/ +Package.pins +Package.resolved +.build/ # CocoaPods # @@ -39,8 +56,10 @@ DerivedData/ # you should judge for yourself, the pros and cons are mentioned at: # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control # + Pods/ Podfile.lock + # # Add this line if you want to avoid checking in source code from the Xcode workspace # *.xcworkspace @@ -50,12 +69,16 @@ Podfile.lock # Add this line if you want to avoid checking in source code from Carthage dependencies. # Carthage/Checkouts -Carthage/Build/ +# Carthage/Build + +# Accio dependency management +Dependencies/ +.accio/ # fastlane # -# It is recommended to not store the screenshots in the git repo. -# Instead, use fastlane to re-generate the screenshots whenever they are needed. +# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the +# screenshots whenever they are needed. # For more information about the recommended setup visit: # https://docs.fastlane.tools/best-practices/source-control/#source-control @@ -69,4 +92,18 @@ fastlane/test_output # After new code Injection tools there's a generated folder /iOSInjectionProject # https://github.com/johnno1962/injectionforxcode -iOSInjectionProject/ +# iOSInjectionProject/ + +# Binary files +XCFramework/ +XCArchive/ +*.xcarchive +*.xcframework +*.zip +*.ipa + +# API doc +apidoc/ + +# Code coverage +coverage/ diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index b9cb837..0000000 --- a/.travis.yml +++ /dev/null @@ -1,14 +0,0 @@ -# references: -# * https://www.objc.io/issues/6-build-tools/travis-ci/ -# * https://github.com/supermarin/xcpretty#usage - -osx_image: xcode7.3 -language: objective-c -# cache: cocoapods -# podfile: Example/Podfile -# before_install: -# - gem install cocoapods # Since Travis is not always on latest version -# - pod install --project-directory=Example -script: -- set -o pipefail && xcodebuild test -enableCodeCoverage YES -workspace Example/MoEPluginBase.xcworkspace -scheme MoEPluginBase-Example -sdk iphonesimulator9.3 ONLY_ACTIVE_ARCH=NO | xcpretty -- pod lib lint diff --git a/MoEngagePluginBase/CHANGELOG.md b/CHANGELOG.md similarity index 88% rename from MoEngagePluginBase/CHANGELOG.md rename to CHANGELOG.md index 93735f8..f223d72 100644 --- a/MoEngagePluginBase/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +# Release Date + +## Release Version + +- [minor] Added Swift Package Manager distribution support + # 17-10-2025 ## 6.6.1 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..01b6681 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,192 @@ +# Contributing to iOS-PluginBase + +Thank you for your interest in contributing to the iOS-PluginBase project! This document provides guidelines and setup instructions for development. + +## Development Setup + +### Prerequisites + +Before you begin, ensure you have the following installed: + +- **Xcode 16.0+** with iOS 13.0+ SDK +- **Ruby 2.7+** (for Rake tasks and CocoaPods) +- **CocoaPods** (latest version) +- **Tuist 4.61.1** (for project generation) +- **Homebrew** (for installing Tuist) + +### Installation Steps + +1. **Clone other plugin repositories:** + + ```bash + cd your-workspace + git clone https://github.com/moengage/apple-plugin-cards.git + git clone https://github.com/moengage/apple-plugin-geofence.git + git clone https://github.com/moengage/apple-plugin-inbox.git + ``` + +1. **Comment out `iOS-PluginBase` version based dependency in cards, geofence and inbox `Package.swift` package manifest and uncomment relative path dependency.** i.e + + ```swift + // comment out following by prefixing with "// " + .package(url: "https://github.com/moengage/iOS-PluginBase.git", exact: "6.6.0"), + // For development uncomment out following by removing prefix "// " + // .package(path: "../iOS-PluginBase") + ``` + +1. **Clone the repository:** + + ```bash + git clone https://github.com/moengage/iOS-PluginBase.git + cd iOS-PluginBase + ``` + +1. **Install Tuist:** + + ```bash + brew install --formula tuist@4.61.1 --force + ``` + +1. **Setup the project:** + + ```bash + rake setup + ``` + + This command will: + - Install Tuist dependencies + - Generate the Xcode workspace + - Install CocoaPods dependencies + +### Project Structure Requirements + +**IMPORTANT:** For proper integration with Cards, Geofence, and Inbox plugins, you must maintain the following relative directory structure: + +```text +your-workspace/ +├── iOS-PluginBase/ # This repository +├── apple-plugin-cards/ # Cards plugin repository +├── apple-plugin-geofence/ # Geofence plugin repository +└── apple-plugin-inbox/ # Inbox plugin repository +└── hybrid/ # Hybrid package repository (Flutter, RN etc.) +``` + +The relative paths are critical for: + +- **CocoaPods integration** (see `Examples/Podfile`) +- **Tuist project generation** (see `Examples/Project.swift`) +- **Local development and testing** + +### Development Workflow + +1. **Open the workspace:** + + ```bash + open Examples/MoEngagePluginBase.xcworkspace + ``` + +2. Build and Run tests + +### Project Architecture + +This project consists of: + +- **MoEngagePluginBase**: Core plugin base functionality +- **MoEngageSegmentPluginBase**: Segment-specific plugin implementation +- **Examples**: Sample applications demonstrating usage + +### Key Files + +- `Package.swift`: Swift Package Manager configuration +- `MoEngagePluginBase.podspec`: CocoaPods specification +- `Rakefile`: Build automation tasks +- `package.json`: Version and dependency management +- `Examples/Podfile`: CocoaPods dependencies for examples +- `Examples/Project.swift`: Tuist project configuration + +### Dependencies + +The project depends on: + +- **MoEngage Apple SDK** (version 10.07.1+) +- **UIKit, Foundation, UserNotifications** frameworks +- **Cards, Geofence, Inbox plugins** (for full functionality) + +### Version Management + +Versions are managed through: + +- `package.json`: Contains version information and SDK requirements +- `Package.swift`: Auto-generated from `package.json` via `Utilities/post_build.rb` +- `MoEngagePluginBase.podspec`: CocoaPods version specification + +### Testing + +The project includes: + +- Unit tests in `Tests/MoEngagePluginBaseTests/` +- Integration tests with sample applications +- Tests for Segment plugin functionality + +### Release Process + +The project uses automated release workflows: + +- **CI/CD**: GitHub Actions for testing and deployment +- **Dependent releases**: Automated release of dependent plugins (Cards, Geofence, Inbox) +- **Version bumping**: Automated version management across related repositories + +### Troubleshooting + +**Common Issues:** + +1. **Tuist not found:** + + ```bash + brew install --formula tuist@4.61.1 --force + ``` + +2. **CocoaPods issues:** + + ```bash + cd Examples + pod deintegrate + pod install + ``` + +3. **Missing plugin dependencies:** + - Ensure the relative directory structure is maintained + - Clone the required plugin repositories in the correct locations + +4. **Build failures:** + + ```bash + rake setup # Re-run setup + ``` + +### Code Style + +- Follow Swift style guidelines +- Use meaningful variable and function names +- Add documentation for public APIs +- Write unit tests for new functionality + +### Submitting Changes + +1. Create a feature branch from `development` +2. Make your changes +3. Add tests for new functionality +4. Ensure all tests pass +5. Submit a pull request with a clear description + +### Support + +For questions or issues: + +- Check existing GitHub issues +- Create a new issue with detailed information +- Contact the maintainers + +--- + +**Note:** This project is primarily used as a base for MoEngage hybrid framework plugins and is not intended for direct use in applications. diff --git a/Example/MoEPluginBaseExample.xcodeproj/project.pbxproj b/Example/MoEPluginBaseExample.xcodeproj/project.pbxproj deleted file mode 100644 index 431fd2e..0000000 --- a/Example/MoEPluginBaseExample.xcodeproj/project.pbxproj +++ /dev/null @@ -1,706 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 6003F58E195388D20070C39A /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F58D195388D20070C39A /* Foundation.framework */; }; - 6003F590195388D20070C39A /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F58F195388D20070C39A /* CoreGraphics.framework */; }; - 6003F592195388D20070C39A /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F591195388D20070C39A /* UIKit.framework */; }; - 6003F5B0195388D20070C39A /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F5AF195388D20070C39A /* XCTest.framework */; }; - 6003F5B1195388D20070C39A /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F58D195388D20070C39A /* Foundation.framework */; }; - 6003F5B2195388D20070C39A /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F591195388D20070C39A /* UIKit.framework */; }; - 6003F5BA195388D20070C39A /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 6003F5B8195388D20070C39A /* InfoPlist.strings */; }; - 6003F5BC195388D20070C39A /* Tests.m in Sources */ = {isa = PBXBuildFile; fileRef = 6003F5BB195388D20070C39A /* Tests.m */; }; - AF1C72622507947C004DDCE3 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = AF1C72552507947C004DDCE3 /* InfoPlist.strings */; }; - AF1C72632507947C004DDCE3 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = AF1C72582507947C004DDCE3 /* ViewController.m */; }; - AF1C72642507947C004DDCE3 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = AF1C72592507947C004DDCE3 /* LaunchScreen.storyboard */; }; - AF1C72652507947C004DDCE3 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = AF1C725B2507947C004DDCE3 /* Main.storyboard */; }; - AF1C72662507947C004DDCE3 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = AF1C725D2507947C004DDCE3 /* main.m */; }; - AF1C72682507947C004DDCE3 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = AF1C725F2507947C004DDCE3 /* Images.xcassets */; }; - AF1C72692507947C004DDCE3 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = AF1C72602507947C004DDCE3 /* AppDelegate.m */; }; - E2C8670A074A33C35C24E4EE /* Pods_MoEPluginBaseExampleTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 51C49AFD292F25AE16134CA7 /* Pods_MoEPluginBaseExampleTests.framework */; }; - E6EC8A4ED84640062CA77713 /* Pods_MoEPluginBaseExample.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 03D0609301D6314FB6F59D92 /* Pods_MoEPluginBaseExample.framework */; }; -/* End PBXBuildFile section */ - -/* Begin PBXContainerItemProxy section */ - 6003F5B3195388D20070C39A /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 6003F582195388D10070C39A /* Project object */; - proxyType = 1; - remoteGlobalIDString = 6003F589195388D20070C39A; - remoteInfo = MoEPluginBase; - }; -/* End PBXContainerItemProxy section */ - -/* Begin PBXCopyFilesBuildPhase section */ - 6476DF3A2A38908200AF7592 /* Embed Frameworks */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = ""; - dstSubfolderSpec = 10; - files = ( - ); - name = "Embed Frameworks"; - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXCopyFilesBuildPhase section */ - -/* Begin PBXFileReference section */ - 03D0609301D6314FB6F59D92 /* Pods_MoEPluginBaseExample.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_MoEPluginBaseExample.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 51C49AFD292F25AE16134CA7 /* Pods_MoEPluginBaseExampleTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_MoEPluginBaseExampleTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 5D69267653C087C2A76C3E22 /* Pods-MoEPluginBaseExampleTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-MoEPluginBaseExampleTests.debug.xcconfig"; path = "Target Support Files/Pods-MoEPluginBaseExampleTests/Pods-MoEPluginBaseExampleTests.debug.xcconfig"; sourceTree = ""; }; - 6003F58A195388D20070C39A /* MoEPluginBaseExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MoEPluginBaseExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; - 6003F58D195388D20070C39A /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; - 6003F58F195388D20070C39A /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; - 6003F591195388D20070C39A /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; - 6003F5AE195388D20070C39A /* MoEPluginBaseExampleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = MoEPluginBaseExampleTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - 6003F5AF195388D20070C39A /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; - 6003F5B7195388D20070C39A /* Tests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Tests-Info.plist"; sourceTree = ""; }; - 6003F5B9195388D20070C39A /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; - 6003F5BB195388D20070C39A /* Tests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Tests.m; sourceTree = ""; }; - 606FC2411953D9B200FFA9A0 /* Tests-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Tests-Prefix.pch"; sourceTree = ""; }; - 7A075B5BECB8A6DE21EEAAC1 /* Pods-MoEPluginBaseExampleTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-MoEPluginBaseExampleTests.release.xcconfig"; path = "Target Support Files/Pods-MoEPluginBaseExampleTests/Pods-MoEPluginBaseExampleTests.release.xcconfig"; sourceTree = ""; }; - 7EB583818B17DE7196532810 /* Pods-MoEPluginBaseExample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-MoEPluginBaseExample.debug.xcconfig"; path = "Target Support Files/Pods-MoEPluginBaseExample/Pods-MoEPluginBaseExample.debug.xcconfig"; sourceTree = ""; }; - A72804FB0320C64226A0773B /* README.md */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = net.daringfireball.markdown; name = README.md; path = ../README.md; sourceTree = ""; }; - AF1C72562507947C004DDCE3 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; - AF1C72572507947C004DDCE3 /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; - AF1C72582507947C004DDCE3 /* ViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; - AF1C725A2507947C004DDCE3 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; - AF1C725C2507947C004DDCE3 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; - AF1C725D2507947C004DDCE3 /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; - AF1C725E2507947C004DDCE3 /* MoEPluginBaseExample-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "MoEPluginBaseExample-Info.plist"; sourceTree = ""; }; - AF1C725F2507947C004DDCE3 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; - AF1C72602507947C004DDCE3 /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; - AF1C72612507947C004DDCE3 /* ViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; - AF6A63742513CD0B0083F408 /* MoEPluginBaseExample.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = MoEPluginBaseExample.entitlements; sourceTree = ""; }; - AFEB6A9E50D9710207493EC2 /* Pods-MoEPluginBaseExample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-MoEPluginBaseExample.release.xcconfig"; path = "Target Support Files/Pods-MoEPluginBaseExample/Pods-MoEPluginBaseExample.release.xcconfig"; sourceTree = ""; }; - B9C3DBFCAB8B2967125634AF /* MoEPluginBase.podspec */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = MoEPluginBase.podspec; path = ../MoEPluginBase.podspec; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; - E1013D5AF43864F2C6CB4B5E /* LICENSE */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = LICENSE; path = ../LICENSE; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 6003F587195388D20070C39A /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 6003F590195388D20070C39A /* CoreGraphics.framework in Frameworks */, - 6003F592195388D20070C39A /* UIKit.framework in Frameworks */, - 6003F58E195388D20070C39A /* Foundation.framework in Frameworks */, - E6EC8A4ED84640062CA77713 /* Pods_MoEPluginBaseExample.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 6003F5AB195388D20070C39A /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 6003F5B0195388D20070C39A /* XCTest.framework in Frameworks */, - 6003F5B2195388D20070C39A /* UIKit.framework in Frameworks */, - 6003F5B1195388D20070C39A /* Foundation.framework in Frameworks */, - E2C8670A074A33C35C24E4EE /* Pods_MoEPluginBaseExampleTests.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 6003F581195388D10070C39A = { - isa = PBXGroup; - children = ( - AF1C72532507947C004DDCE3 /* MoEPluginBaseExample */, - 60FF7A9C1954A5C5007DD14C /* Podspec Metadata */, - 6003F5B5195388D20070C39A /* Tests */, - 6003F58C195388D20070C39A /* Frameworks */, - 6003F58B195388D20070C39A /* Products */, - C435D4DDDFE99AF4BC6CFA37 /* Pods */, - ); - sourceTree = ""; - }; - 6003F58B195388D20070C39A /* Products */ = { - isa = PBXGroup; - children = ( - 6003F58A195388D20070C39A /* MoEPluginBaseExample.app */, - 6003F5AE195388D20070C39A /* MoEPluginBaseExampleTests.xctest */, - ); - name = Products; - sourceTree = ""; - }; - 6003F58C195388D20070C39A /* Frameworks */ = { - isa = PBXGroup; - children = ( - 6003F58D195388D20070C39A /* Foundation.framework */, - 6003F58F195388D20070C39A /* CoreGraphics.framework */, - 6003F591195388D20070C39A /* UIKit.framework */, - 6003F5AF195388D20070C39A /* XCTest.framework */, - 03D0609301D6314FB6F59D92 /* Pods_MoEPluginBaseExample.framework */, - 51C49AFD292F25AE16134CA7 /* Pods_MoEPluginBaseExampleTests.framework */, - ); - name = Frameworks; - sourceTree = ""; - }; - 6003F5B5195388D20070C39A /* Tests */ = { - isa = PBXGroup; - children = ( - 6003F5BB195388D20070C39A /* Tests.m */, - 6003F5B6195388D20070C39A /* Supporting Files */, - ); - path = Tests; - sourceTree = ""; - }; - 6003F5B6195388D20070C39A /* Supporting Files */ = { - isa = PBXGroup; - children = ( - 6003F5B7195388D20070C39A /* Tests-Info.plist */, - 6003F5B8195388D20070C39A /* InfoPlist.strings */, - 606FC2411953D9B200FFA9A0 /* Tests-Prefix.pch */, - ); - name = "Supporting Files"; - sourceTree = ""; - }; - 60FF7A9C1954A5C5007DD14C /* Podspec Metadata */ = { - isa = PBXGroup; - children = ( - B9C3DBFCAB8B2967125634AF /* MoEPluginBase.podspec */, - A72804FB0320C64226A0773B /* README.md */, - E1013D5AF43864F2C6CB4B5E /* LICENSE */, - ); - name = "Podspec Metadata"; - sourceTree = ""; - }; - AF1C72532507947C004DDCE3 /* MoEPluginBaseExample */ = { - isa = PBXGroup; - children = ( - AF6A63742513CD0B0083F408 /* MoEPluginBaseExample.entitlements */, - AF1C72572507947C004DDCE3 /* AppDelegate.h */, - AF1C72602507947C004DDCE3 /* AppDelegate.m */, - AF1C72612507947C004DDCE3 /* ViewController.h */, - AF1C72582507947C004DDCE3 /* ViewController.m */, - AF1C725D2507947C004DDCE3 /* main.m */, - AF1C726B250794AD004DDCE3 /* Resources */, - ); - path = MoEPluginBaseExample; - sourceTree = ""; - }; - AF1C726B250794AD004DDCE3 /* Resources */ = { - isa = PBXGroup; - children = ( - AF1C72552507947C004DDCE3 /* InfoPlist.strings */, - AF1C725E2507947C004DDCE3 /* MoEPluginBaseExample-Info.plist */, - AF1C72592507947C004DDCE3 /* LaunchScreen.storyboard */, - AF1C725B2507947C004DDCE3 /* Main.storyboard */, - AF1C725F2507947C004DDCE3 /* Images.xcassets */, - ); - name = Resources; - sourceTree = ""; - }; - C435D4DDDFE99AF4BC6CFA37 /* Pods */ = { - isa = PBXGroup; - children = ( - 7EB583818B17DE7196532810 /* Pods-MoEPluginBaseExample.debug.xcconfig */, - AFEB6A9E50D9710207493EC2 /* Pods-MoEPluginBaseExample.release.xcconfig */, - 5D69267653C087C2A76C3E22 /* Pods-MoEPluginBaseExampleTests.debug.xcconfig */, - 7A075B5BECB8A6DE21EEAAC1 /* Pods-MoEPluginBaseExampleTests.release.xcconfig */, - ); - path = Pods; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 6003F589195388D20070C39A /* MoEPluginBaseExample */ = { - isa = PBXNativeTarget; - buildConfigurationList = 6003F5BF195388D20070C39A /* Build configuration list for PBXNativeTarget "MoEPluginBaseExample" */; - buildPhases = ( - 70B78503636C439A243C3E90 /* [CP] Check Pods Manifest.lock */, - 6003F586195388D20070C39A /* Sources */, - 6003F587195388D20070C39A /* Frameworks */, - 6003F588195388D20070C39A /* Resources */, - 50845E5E73D55B34543523EA /* [CP] Embed Pods Frameworks */, - 6476DF3A2A38908200AF7592 /* Embed Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = MoEPluginBaseExample; - productName = MoEPluginBase; - productReference = 6003F58A195388D20070C39A /* MoEPluginBaseExample.app */; - productType = "com.apple.product-type.application"; - }; - 6003F5AD195388D20070C39A /* MoEPluginBaseExampleTests */ = { - isa = PBXNativeTarget; - buildConfigurationList = 6003F5C2195388D20070C39A /* Build configuration list for PBXNativeTarget "MoEPluginBaseExampleTests" */; - buildPhases = ( - 6E2C817F8FA5A2D8F66E80D0 /* [CP] Check Pods Manifest.lock */, - 6003F5AA195388D20070C39A /* Sources */, - 6003F5AB195388D20070C39A /* Frameworks */, - 6003F5AC195388D20070C39A /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - 6003F5B4195388D20070C39A /* PBXTargetDependency */, - ); - name = MoEPluginBaseExampleTests; - productName = MoEPluginBaseTests; - productReference = 6003F5AE195388D20070C39A /* MoEPluginBaseExampleTests.xctest */; - productType = "com.apple.product-type.bundle.unit-test"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 6003F582195388D10070C39A /* Project object */ = { - isa = PBXProject; - attributes = { - CLASSPREFIX = MOEPLUGIN; - LastUpgradeCheck = 1220; - ORGANIZATIONNAME = "Chengappa C D"; - TargetAttributes = { - 6003F589195388D20070C39A = { - DevelopmentTeam = BPWYRAF5X7; - LastSwiftMigration = 1340; - }; - 6003F5AD195388D20070C39A = { - TestTargetID = 6003F589195388D20070C39A; - }; - }; - }; - buildConfigurationList = 6003F585195388D10070C39A /* Build configuration list for PBXProject "MoEPluginBaseExample" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = en; - hasScannedForEncodings = 0; - knownRegions = ( - en, - Base, - ); - mainGroup = 6003F581195388D10070C39A; - productRefGroup = 6003F58B195388D20070C39A /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 6003F589195388D20070C39A /* MoEPluginBaseExample */, - 6003F5AD195388D20070C39A /* MoEPluginBaseExampleTests */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - 6003F588195388D20070C39A /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - AF1C72652507947C004DDCE3 /* Main.storyboard in Resources */, - AF1C72682507947C004DDCE3 /* Images.xcassets in Resources */, - AF1C72622507947C004DDCE3 /* InfoPlist.strings in Resources */, - AF1C72642507947C004DDCE3 /* LaunchScreen.storyboard in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 6003F5AC195388D20070C39A /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 6003F5BA195388D20070C39A /* InfoPlist.strings in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXShellScriptBuildPhase section */ - 50845E5E73D55B34543523EA /* [CP] Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-MoEPluginBaseExample/Pods-MoEPluginBaseExample-frameworks.sh", - "${BUILT_PRODUCTS_DIR}/MoEngageCards/MoEngageCards.framework", - "${BUILT_PRODUCTS_DIR}/MoEngageCore/MoEngageCore.framework", - "${BUILT_PRODUCTS_DIR}/MoEngageGeofence/MoEngageGeofence.framework", - "${BUILT_PRODUCTS_DIR}/MoEngageInApps/MoEngageInApps.framework", - "${BUILT_PRODUCTS_DIR}/MoEngageInbox/MoEngageInbox.framework", - "${BUILT_PRODUCTS_DIR}/MoEngageMessaging/MoEngageMessaging.framework", - "${BUILT_PRODUCTS_DIR}/MoEngagePluginBase/MoEngagePluginBase.framework", - "${BUILT_PRODUCTS_DIR}/MoEngagePluginCards/MoEngagePluginCards.framework", - "${BUILT_PRODUCTS_DIR}/MoEngagePluginGeofence/MoEngagePluginGeofence.framework", - "${BUILT_PRODUCTS_DIR}/MoEngagePluginInbox/MoEngagePluginInbox.framework", - "${PODS_XCFRAMEWORKS_BUILD_DIR}/MoEngageCampaignsCore/MoEngageCampaignsCore.framework/MoEngageCampaignsCore", - "${PODS_XCFRAMEWORKS_BUILD_DIR}/MoEngageCards/MoEngageCards.framework/MoEngageCards", - "${PODS_XCFRAMEWORKS_BUILD_DIR}/MoEngageCore/MoEngageCore.framework/MoEngageCore", - "${PODS_XCFRAMEWORKS_BUILD_DIR}/MoEngageGeofence/MoEngageGeofence.framework/MoEngageGeofence", - "${PODS_XCFRAMEWORKS_BUILD_DIR}/MoEngageInApps/MoEngageInApps.framework/MoEngageInApps", - "${PODS_XCFRAMEWORKS_BUILD_DIR}/MoEngageInbox/MoEngageInbox.framework/MoEngageInbox", - "${PODS_XCFRAMEWORKS_BUILD_DIR}/MoEngageKMMConditionEvaluator/MoEngageKMMConditionEvaluator.framework/MoEngageKMMConditionEvaluator", - "${PODS_XCFRAMEWORKS_BUILD_DIR}/MoEngageMessaging/MoEngageMessaging.framework/MoEngageMessaging", - "${PODS_XCFRAMEWORKS_BUILD_DIR}/MoEngageRichNotification/MoEngageRichNotification.framework/MoEngageRichNotification", - "${PODS_XCFRAMEWORKS_BUILD_DIR}/MoEngageSDK/MoEngageSDK.framework/MoEngageSDK", - "${PODS_XCFRAMEWORKS_BUILD_DIR}/MoEngageSecurity/MoEngageSecurity.framework/MoEngageSecurity", - "${PODS_XCFRAMEWORKS_BUILD_DIR}/MoEngageTriggerEvaluator/MoEngageTriggerEvaluator.framework/MoEngageTriggerEvaluator", - ); - name = "[CP] Embed Pods Frameworks"; - outputPaths = ( - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MoEngagePluginBase.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MoEngagePluginCards.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MoEngagePluginGeofence.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MoEngagePluginInbox.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MoEngageCampaignsCore.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MoEngageCards.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MoEngageCore.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MoEngageGeofence.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MoEngageInApps.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MoEngageInbox.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MoEngageKMMConditionEvaluator.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MoEngageMessaging.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MoEngageRichNotification.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MoEngageSDK.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MoEngageSecurity.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MoEngageTriggerEvaluator.framework", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-MoEPluginBaseExample/Pods-MoEPluginBaseExample-frameworks.sh\"\n"; - showEnvVarsInLog = 0; - }; - 6E2C817F8FA5A2D8F66E80D0 /* [CP] Check Pods Manifest.lock */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - ); - inputPaths = ( - "${PODS_PODFILE_DIR_PATH}/Podfile.lock", - "${PODS_ROOT}/Manifest.lock", - ); - name = "[CP] Check Pods Manifest.lock"; - outputFileListPaths = ( - ); - outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-MoEPluginBaseExampleTests-checkManifestLockResult.txt", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; - showEnvVarsInLog = 0; - }; - 70B78503636C439A243C3E90 /* [CP] Check Pods Manifest.lock */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - ); - inputPaths = ( - "${PODS_PODFILE_DIR_PATH}/Podfile.lock", - "${PODS_ROOT}/Manifest.lock", - ); - name = "[CP] Check Pods Manifest.lock"; - outputFileListPaths = ( - ); - outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-MoEPluginBaseExample-checkManifestLockResult.txt", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; - showEnvVarsInLog = 0; - }; -/* End PBXShellScriptBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 6003F586195388D20070C39A /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - AF1C72662507947C004DDCE3 /* main.m in Sources */, - AF1C72632507947C004DDCE3 /* ViewController.m in Sources */, - AF1C72692507947C004DDCE3 /* AppDelegate.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 6003F5AA195388D20070C39A /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 6003F5BC195388D20070C39A /* Tests.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXTargetDependency section */ - 6003F5B4195388D20070C39A /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 6003F589195388D20070C39A /* MoEPluginBaseExample */; - targetProxy = 6003F5B3195388D20070C39A /* PBXContainerItemProxy */; - }; -/* End PBXTargetDependency section */ - -/* Begin PBXVariantGroup section */ - 6003F5B8195388D20070C39A /* InfoPlist.strings */ = { - isa = PBXVariantGroup; - children = ( - 6003F5B9195388D20070C39A /* en */, - ); - name = InfoPlist.strings; - sourceTree = ""; - }; - AF1C72552507947C004DDCE3 /* InfoPlist.strings */ = { - isa = PBXVariantGroup; - children = ( - AF1C72562507947C004DDCE3 /* en */, - ); - name = InfoPlist.strings; - sourceTree = ""; - }; - AF1C72592507947C004DDCE3 /* LaunchScreen.storyboard */ = { - isa = PBXVariantGroup; - children = ( - AF1C725A2507947C004DDCE3 /* Base */, - ); - name = LaunchScreen.storyboard; - sourceTree = ""; - }; - AF1C725B2507947C004DDCE3 /* Main.storyboard */ = { - isa = PBXVariantGroup; - children = ( - AF1C725C2507947C004DDCE3 /* Base */, - ); - name = Main.storyboard; - sourceTree = ""; - }; -/* End PBXVariantGroup section */ - -/* Begin XCBuildConfiguration section */ - 6003F5BD195388D20070C39A /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = Debug; - }; - 6003F5BE195388D20070C39A /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = YES; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; - SDKROOT = iphoneos; - TARGETED_DEVICE_FAMILY = "1,2"; - VALIDATE_PRODUCT = YES; - }; - name = Release; - }; - 6003F5C0195388D20070C39A /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 7EB583818B17DE7196532810 /* Pods-MoEPluginBaseExample.debug.xcconfig */; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CLANG_ENABLE_MODULES = YES; - CODE_SIGN_ENTITLEMENTS = MoEPluginBaseExample/MoEPluginBaseExample.entitlements; - DEVELOPMENT_TEAM = BPWYRAF5X7; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = ""; - INFOPLIST_FILE = "MoEPluginBaseExample/MoEPluginBaseExample-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - MARKETING_VERSION = 2.2.0; - MODULE_NAME = ExampleApp; - PRODUCT_BUNDLE_IDENTIFIER = com.alphadevs.MoEngage; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_OBJC_BRIDGING_HEADER = "MoEPluginBaseExample/MoEPluginBaseExample-Bridging-Header.h"; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.0; - WRAPPER_EXTENSION = app; - }; - name = Debug; - }; - 6003F5C1195388D20070C39A /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = AFEB6A9E50D9710207493EC2 /* Pods-MoEPluginBaseExample.release.xcconfig */; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CLANG_ENABLE_MODULES = YES; - CODE_SIGN_ENTITLEMENTS = MoEPluginBaseExample/MoEPluginBaseExample.entitlements; - DEVELOPMENT_TEAM = BPWYRAF5X7; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = ""; - INFOPLIST_FILE = "MoEPluginBaseExample/MoEPluginBaseExample-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - MARKETING_VERSION = 2.2.0; - MODULE_NAME = ExampleApp; - PRODUCT_BUNDLE_IDENTIFIER = com.alphadevs.MoEngage; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_OBJC_BRIDGING_HEADER = "MoEPluginBaseExample/MoEPluginBaseExample-Bridging-Header.h"; - SWIFT_VERSION = 4.0; - WRAPPER_EXTENSION = app; - }; - name = Release; - }; - 6003F5C3195388D20070C39A /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 5D69267653C087C2A76C3E22 /* Pods-MoEPluginBaseExampleTests.debug.xcconfig */; - buildSettings = { - BUNDLE_LOADER = "$(TEST_HOST)"; - FRAMEWORK_SEARCH_PATHS = ( - "$(PLATFORM_DIR)/Developer/Library/Frameworks", - "$(inherited)", - "$(DEVELOPER_FRAMEWORKS_DIR)", - ); - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = "Tests/Tests-Prefix.pch"; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - INFOPLIST_FILE = "Tests/Tests-Info.plist"; - PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.${PRODUCT_NAME:rfc1034identifier}"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.0; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/MoEPluginBaseExample_Example.app/MoEPluginBaseExample_Example"; - WRAPPER_EXTENSION = xctest; - }; - name = Debug; - }; - 6003F5C4195388D20070C39A /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 7A075B5BECB8A6DE21EEAAC1 /* Pods-MoEPluginBaseExampleTests.release.xcconfig */; - buildSettings = { - BUNDLE_LOADER = "$(TEST_HOST)"; - FRAMEWORK_SEARCH_PATHS = ( - "$(PLATFORM_DIR)/Developer/Library/Frameworks", - "$(inherited)", - "$(DEVELOPER_FRAMEWORKS_DIR)", - ); - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = "Tests/Tests-Prefix.pch"; - INFOPLIST_FILE = "Tests/Tests-Info.plist"; - PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.${PRODUCT_NAME:rfc1034identifier}"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.0; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/MoEPluginBaseExample_Example.app/MoEPluginBaseExample_Example"; - WRAPPER_EXTENSION = xctest; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 6003F585195388D10070C39A /* Build configuration list for PBXProject "MoEPluginBaseExample" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 6003F5BD195388D20070C39A /* Debug */, - 6003F5BE195388D20070C39A /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 6003F5BF195388D20070C39A /* Build configuration list for PBXNativeTarget "MoEPluginBaseExample" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 6003F5C0195388D20070C39A /* Debug */, - 6003F5C1195388D20070C39A /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 6003F5C2195388D20070C39A /* Build configuration list for PBXNativeTarget "MoEPluginBaseExampleTests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 6003F5C3195388D20070C39A /* Debug */, - 6003F5C4195388D20070C39A /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 6003F582195388D10070C39A /* Project object */; -} diff --git a/Example/MoEPluginBaseExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Example/MoEPluginBaseExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 1202f2b..0000000 --- a/Example/MoEPluginBaseExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/Example/MoEPluginBaseExample.xcworkspace/contents.xcworkspacedata b/Example/MoEPluginBaseExample.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 6e81241..0000000 --- a/Example/MoEPluginBaseExample.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - diff --git a/Example/MoEPluginBaseExample.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/Example/MoEPluginBaseExample.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist deleted file mode 100644 index 18d9810..0000000 --- a/Example/MoEPluginBaseExample.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +++ /dev/null @@ -1,8 +0,0 @@ - - - - - IDEDidComputeMac32BitWarning - - - diff --git a/Example/Podfile.lock b/Example/Podfile.lock deleted file mode 100644 index ac560e2..0000000 --- a/Example/Podfile.lock +++ /dev/null @@ -1,126 +0,0 @@ -PODS: - - MoEngage-iOS-SDK (10.00.0): - - MoEngage-iOS-SDK/KMMedCore (= 10.00.0) - - MoEngage-iOS-SDK/Cards (10.00.0): - - MoEngage-iOS-SDK/Core - - MoEngageCards (= 5.00.0) - - MoEngage-iOS-SDK/Core (10.00.0): - - MoEngageCore (= 10.00.0) - - MoEngageMessaging (= 5.00.0) - - MoEngageSDK (= 10.00.0) - - MoEngageSecurity (= 2.00.0) - - MoEngage-iOS-SDK/GeoFence (10.00.0): - - MoEngage-iOS-SDK/Core - - MoEngageGeofence (= 6.00.0) - - MoEngage-iOS-SDK/InApps (10.00.0): - - MoEngage-iOS-SDK/Core - - MoEngageInApps (= 7.00.0) - - MoEngageTriggerEvaluator (= 2.00.0) - - MoEngage-iOS-SDK/Inbox (10.00.0): - - MoEngage-iOS-SDK/Core - - MoEngage-iOS-SDK/RichNotification - - MoEngageInbox (= 3.00.0) - - MoEngage-iOS-SDK/KMMedCore (10.00.0): - - MoEngage-iOS-SDK/Core - - MoEngageKMMConditionEvaluator (= 1.0.0) - - MoEngage-iOS-SDK/RichNotification (10.00.0): - - MoEngage-iOS-SDK/Core - - MoEngageRichNotification (= 8.00.0) - - MoEngageCards (5.00.0): - - MoEngageCore - - MoEngageCore (10.00.0): - - MoEngageSecurity - - MoEngageGeofence (6.00.0): - - MoEngageCore - - MoEngageInApps (7.00.0): - - MoEngageCore - - MoEngageMessaging - - MoEngageTriggerEvaluator - - MoEngageInbox (3.00.0): - - MoEngageCore - - MoEngageMessaging - - MoEngageKMMConditionEvaluator (1.0.0) - - MoEngageMessaging (5.00.0): - - MoEngageCore - - MoEngagePluginBase (5.3.2): - - MoEngage-iOS-SDK (= 10.00.0) - - MoEngage-iOS-SDK/InApps - - MoEngagePluginBase/Tests (5.3.2): - - MoEngage-iOS-SDK (= 10.00.0) - - MoEngage-iOS-SDK/InApps - - MoEngagePluginCards (2.3.2): - - MoEngage-iOS-SDK/Cards - - MoEngagePluginBase (= 5.3.2) - - MoEngagePluginCards/Tests (2.3.2): - - MoEngage-iOS-SDK/Cards - - MoEngagePluginBase (= 5.3.2) - - MoEngagePluginGeofence (3.3.2): - - MoEngage-iOS-SDK/GeoFence - - MoEngagePluginBase (= 5.3.2) - - MoEngagePluginInbox (3.3.2): - - MoEngage-iOS-SDK/Inbox - - MoEngagePluginBase (= 5.3.2) - - MoEngageRichNotification (8.00.0): - - MoEngageCore - - MoEngageMessaging - - MoEngageSDK (10.00.0): - - MoEngageCore - - MoEngageMessaging - - MoEngageSecurity (2.00.0) - - MoEngageTriggerEvaluator (2.00.0): - - MoEngageCore - -DEPENDENCIES: - - MoEngagePluginBase (from `../`) - - MoEngagePluginBase/Tests (from `../`) - - MoEngagePluginCards (from `../`) - - MoEngagePluginCards/Tests (from `../`) - - MoEngagePluginGeofence (from `../`) - - MoEngagePluginInbox (from `../`) - -SPEC REPOS: - trunk: - - MoEngage-iOS-SDK - - MoEngageCards - - MoEngageCore - - MoEngageGeofence - - MoEngageInApps - - MoEngageInbox - - MoEngageKMMConditionEvaluator - - MoEngageMessaging - - MoEngageRichNotification - - MoEngageSDK - - MoEngageSecurity - - MoEngageTriggerEvaluator - -EXTERNAL SOURCES: - MoEngagePluginBase: - :path: "../" - MoEngagePluginCards: - :path: "../" - MoEngagePluginGeofence: - :path: "../" - MoEngagePluginInbox: - :path: "../" - -SPEC CHECKSUMS: - MoEngage-iOS-SDK: 41f93f385575e5c99a3553e81e8445eaca55ac36 - MoEngageCards: d64d51f2296e85dd863379d228d097948a093004 - MoEngageCore: c6e16a4b2c895d8f858ca1215d4603fcbdac8a1d - MoEngageGeofence: a59a9520063a4170226ba5f29fa929e197bf5123 - MoEngageInApps: 778f124693e99644a2860a96518434faaea335bd - MoEngageInbox: 8c2c54e0e8d36f3e98ca355d030119057b60a794 - MoEngageKMMConditionEvaluator: 052e7d21773e5e864b311747295f9b076f41e3a0 - MoEngageMessaging: b84ac4cfd9ab3ce4a4fa1b4e13c59488e001fa67 - MoEngagePluginBase: 812f3a8cbf84837f757f8d1bcbe1ae4dbd87a09a - MoEngagePluginCards: 3ac223eaefc3235f3b10f04400c66beca9b637b0 - MoEngagePluginGeofence: 09ac654a76ae27607e353a419188c741141a5403 - MoEngagePluginInbox: 890631793d311dc3943e62ae4d2a944cd4113027 - MoEngageRichNotification: 1a2543ceef6470ec12da6d7e187f3457a4281935 - MoEngageSDK: 421b60b7e4303b8c3752f6d5c596eb859d8cfc09 - MoEngageSecurity: f4c26dd8bf63d2983879113c911707a2d868a75e - MoEngageTriggerEvaluator: 32e73cf3d7bcf37f75cce80fd36cbd8b1c6f3316 - -PODFILE CHECKSUM: 8741372b5d30f7f786c90bff0679cb604ce9f954 - -COCOAPODS: 1.16.2 diff --git a/Examples/.gitignore b/Examples/.gitignore new file mode 100644 index 0000000..264ecbb --- /dev/null +++ b/Examples/.gitignore @@ -0,0 +1,77 @@ +### macOS ### +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two +Icon + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +### Xcode ### +# Xcode +# +# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore + +## User settings +xcuserdata/ + +## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9) +*.xcscmblueprint +*.xccheckout + +## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4) +build/ +DerivedData/ +*.moved-aside +*.pbxuser +!default.pbxuser +*.mode1v3 +!default.mode1v3 +*.mode2v3 +!default.mode2v3 +*.perspectivev3 +!default.perspectivev3 + +### Xcode Patch ### +*.xcodeproj/* +# !*.xcodeproj/project.pbxproj +# !*.xcodeproj/xcshareddata/ +# !*.xcworkspace/contents.xcworkspacedata +/*.gcno + +### Projects ### +*.xcodeproj +*.xcworkspace + +### Tuist derived files ### +graph.dot +Derived/ + +### Tuist managed dependencies ### +Tuist/.build +.package.resolved + +### CD +pods.rb + +### SPM +Package.resolved diff --git a/Example/MoEPluginBaseExample/AppDelegate.h b/Examples/MoEngagePluginBase/AppDelegate.h similarity index 100% rename from Example/MoEPluginBaseExample/AppDelegate.h rename to Examples/MoEngagePluginBase/AppDelegate.h diff --git a/Example/MoEPluginBaseExample/AppDelegate.m b/Examples/MoEngagePluginBase/AppDelegate.m similarity index 100% rename from Example/MoEPluginBaseExample/AppDelegate.m rename to Examples/MoEngagePluginBase/AppDelegate.m diff --git a/Example/MoEPluginBaseExample/Images.xcassets/AppIcon.appiconset/Contents.json b/Examples/MoEngagePluginBase/AppIcon.appiconset/Contents.json similarity index 100% rename from Example/MoEPluginBaseExample/Images.xcassets/AppIcon.appiconset/Contents.json rename to Examples/MoEngagePluginBase/AppIcon.appiconset/Contents.json diff --git a/Example/MoEPluginBaseExample/Base.lproj/LaunchScreen.storyboard b/Examples/MoEngagePluginBase/Base.lproj/LaunchScreen.storyboard similarity index 100% rename from Example/MoEPluginBaseExample/Base.lproj/LaunchScreen.storyboard rename to Examples/MoEngagePluginBase/Base.lproj/LaunchScreen.storyboard diff --git a/Example/MoEPluginBaseExample/Base.lproj/Main.storyboard b/Examples/MoEngagePluginBase/Base.lproj/Main.storyboard similarity index 100% rename from Example/MoEPluginBaseExample/Base.lproj/Main.storyboard rename to Examples/MoEngagePluginBase/Base.lproj/Main.storyboard diff --git a/Example/MoEPluginBaseExample/MoEPluginBaseExample-Info.plist b/Examples/MoEngagePluginBase/Info.plist similarity index 100% rename from Example/MoEPluginBaseExample/MoEPluginBaseExample-Info.plist rename to Examples/MoEngagePluginBase/Info.plist diff --git a/Example/MoEPluginBaseExample/MoEPluginBaseExample.entitlements b/Examples/MoEngagePluginBase/MoEngagePluginBase.entitlements similarity index 100% rename from Example/MoEPluginBaseExample/MoEPluginBaseExample.entitlements rename to Examples/MoEngagePluginBase/MoEngagePluginBase.entitlements diff --git a/Example/MoEPluginBaseExample/ViewController.h b/Examples/MoEngagePluginBase/ViewController.h similarity index 100% rename from Example/MoEPluginBaseExample/ViewController.h rename to Examples/MoEngagePluginBase/ViewController.h diff --git a/Example/MoEPluginBaseExample/ViewController.m b/Examples/MoEngagePluginBase/ViewController.m similarity index 100% rename from Example/MoEPluginBaseExample/ViewController.m rename to Examples/MoEngagePluginBase/ViewController.m diff --git a/Example/MoEPluginBaseExample/main.m b/Examples/MoEngagePluginBase/main.m similarity index 100% rename from Example/MoEPluginBaseExample/main.m rename to Examples/MoEngagePluginBase/main.m diff --git a/Example/Podfile b/Examples/Podfile similarity index 73% rename from Example/Podfile rename to Examples/Podfile index 5fcff2b..3975222 100644 --- a/Example/Podfile +++ b/Examples/Podfile @@ -1,8 +1,10 @@ +# source 'https://github.com/moengage/PodSpecs' +# source 'https://github.com/CocoaPods/Specs.git' + use_frameworks! platform :ios, '13.0' - -target 'MoEPluginBaseExample' do +target 'MoEngagePluginBaseCocoaiOS' do # test_source = { :git => 'https://github.com/moengage/MoEngage-iPhone-SDK.git', :branch => 'MOEN-37979_ver-upgrade' } # pod 'MoEngage-iOS-SDK', **test_source # pod 'MoEngageSecurity', **test_source @@ -17,11 +19,7 @@ target 'MoEPluginBaseExample' do # pod 'MoEngageRichNotification', **test_source # pod 'MoEngageRealTimeTrigger', **test_source pod 'MoEngagePluginBase', :testspecs => ['Tests'], :path => '../' - pod 'MoEngagePluginGeofence', :path => '../' - pod 'MoEngagePluginInbox', :path => '../' - pod 'MoEngagePluginCards', :testspecs => ['Tests'], :path => '../' - - target 'MoEPluginBaseExampleTests' do - inherit! :search_paths - end + pod 'MoEngagePluginGeofence', :path => '../../apple-plugin-geofence' + pod 'MoEngagePluginInbox', :path => '../../apple-plugin-inbox' + pod 'MoEngagePluginCards', :testspecs => ['Tests'], :path => '../../apple-plugin-cards' end diff --git a/Examples/Project.swift b/Examples/Project.swift new file mode 100644 index 0000000..e07a9d0 --- /dev/null +++ b/Examples/Project.swift @@ -0,0 +1,65 @@ +import ProjectDescription + +let defaultSettings: SettingsDictionary = [:] + .marketingVersion("8.3.0") + .currentProjectVersion("1.0.0") + .swiftObjcBridgingHeaderPath("MoEngageTestApp/MoEngageTestApp-Bridging-Header.h") + .merging([ + "GENERATE_INFOPLIST_FILE": true, + "CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES": true + ]) + +let project = Project( + name: "MoEngagePluginBase", + packages: [ + .local(path: "../"), + .local(path: "../../apple-plugin-cards"), + .local(path: "../../apple-plugin-geofence"), + .local(path: "../../apple-plugin-inbox"), + ], + targets: [ + // Sample Apps + .target( + name: "MoEngagePluginBaseCocoaiOS", + destinations: .iOS, + product: .app, + bundleId: "com.alphadevs.MoEngage", + deploymentTargets: .iOS("13.0"), + infoPlist: "MoEngagePluginBase/Info.plist", + sources: [ + "MoEngagePluginBase/**/*.{swift,h,m}" + ], + resources: [ + "MoEngagePluginBase/**/*.{xib,storyboard,xcassets,png,gpx,wav,mp3,ttf}", + ], + headers: .headers(public: "MoEngagePluginBase/**/*.h"), + entitlements: "MoEngagePluginBase/MoEngagePluginBase.entitlements", + settings: .settings(base:defaultSettings) + ), + .target( + name: "MoEngagePluginBaseSPM", + destinations: .iOS, + product: .app, + bundleId: "com.alphadevs.MoEngage", + deploymentTargets: .iOS("13.0"), + infoPlist: "MoEngagePluginBase/Info.plist", + sources: [ + "MoEngagePluginBase/**/*.{swift,h,m}" + ], + resources: [ + "MoEngagePluginBase/**/*.{xib,storyboard,xcassets,png,gpx,wav,mp3,ttf}", + ], + headers: .headers(public: "MoEngagePluginBase/**/*.h"), + entitlements: "MoEngagePluginBase/MoEngagePluginBase.entitlements", + dependencies: [ + .package(product: "MoEngagePluginBase", type: .runtime), + .package(product: "MoEngagePluginCards", type: .runtime), + .package(product: "MoEngagePluginGeofence", type: .runtime), + .package(product: "MoEngagePluginInbox", type: .runtime), + ], + settings: .settings(base:defaultSettings) + ), + ], + additionalFiles: ["../Utilities", "../Rakefile", "../LICENSE", "../package.json", "../*.md"], + resourceSynthesizers: [] +) diff --git a/Examples/Tuist.swift b/Examples/Tuist.swift new file mode 100644 index 0000000..628e7ff --- /dev/null +++ b/Examples/Tuist.swift @@ -0,0 +1,6 @@ +import ProjectDescription + +let config = Config( + compatibleXcodeVersions: ["16.2", "16.4"], + swiftVersion: "5.9" +) diff --git a/Examples/Workspace.swift b/Examples/Workspace.swift new file mode 100644 index 0000000..a58c2cd --- /dev/null +++ b/Examples/Workspace.swift @@ -0,0 +1,3 @@ +import ProjectDescription + +let workspace = Workspace(name: "MoEngagePluginBase", projects: ["./",]) diff --git a/MoEngagePluginBase.podspec b/MoEngagePluginBase.podspec index 507483d..bb8c999 100644 --- a/MoEngagePluginBase.podspec +++ b/MoEngagePluginBase.podspec @@ -1,15 +1,51 @@ +require 'json' +require 'ostruct' + Pod::Spec.new do |s| - require_relative 'Utilities/spec' - s.extend MoEngagePluginSDK::Spec - s.define + config = JSON.parse(File.read('package.json'), {object_class: OpenStruct}) + podspec_path = caller.find do |trace| + File.extname(trace.split(":")[0]).eql?('.podspec') + end.split(":")[0] + + podspec = File.basename(podspec_path, File.extname(podspec_path)) + package_index = config.packages.find_index { |package| package.name == podspec } + package = config.packages[package_index] + + s.name = podspec + s.version = package.version + s.homepage = 'https://www.moengage.com' + s.documentation_url = 'https://developers.moengage.com' + s.license = { :type => 'Commercial', :file => 'LICENSE' } + s.author = { 'MobileDev' => 'mobiledevs@moengage.com' } + s.social_media_url = 'https://twitter.com/moengage' + + s.source = { + :git => 'https://github.com/moengage/iOS-PluginBase.git', + :tag => package.tagPrefix + s.version.to_s + } + + s.ios.deployment_target = '13.0' + s.swift_version = '5.0' + s.requires_arc = true + s.source_files = "Sources/#{s.name}/**/*.{swift}" + s.preserve_paths = "*.md", "LICENSE" + + s.summary = 'MoEngage Plugin Base for Hybrid SDKs' + s.description = <<-DESC + MoEngage is a mobile marketing automation company. This framework is used by our plugins built for different hybrid frameworks i.e, Flutter, Cordova, React Native etc. + DESC - s.summary = 'MoEngage Plugin Base for Hybrid SDKs' - s.description = <<-DESC - MoEngage is a mobile marketing automation company. This framework is used by our plugins built for different hybrid frameworks i.e, Flutter, Cordova, React Native etc. - DESC + s.tvos.deployment_target = '13.0' - s.tvos.deployment_target = '13.0' + s.frameworks = 'UIKit', 'Foundation', 'UserNotifications' + s.dependency 'MoEngage-iOS-SDK', config.sdkVerMin + s.dependency 'MoEngage-iOS-SDK/InApps' - s.frameworks = 'UIKit', 'Foundation', 'UserNotifications' - s.dependency 'MoEngage-iOS-SDK/InApps' + test_file_glob = "Tests/#{s.name}Tests/**/*.{swift}" + s.test_spec 'Tests' do |ts| + ts.ios.deployment_target = '13.0' + ts.tvos.deployment_target = '13.0' + ts.source_files = test_file_glob + s.scheme = { :code_coverage => true } + end unless Dir.glob(test_file_glob).empty? end diff --git a/MoEngagePluginCards.podspec b/MoEngagePluginCards.podspec deleted file mode 100644 index d63eb44..0000000 --- a/MoEngagePluginCards.podspec +++ /dev/null @@ -1,18 +0,0 @@ -Pod::Spec.new do |s| - require_relative 'Utilities/spec' - s.extend MoEngagePluginSDK::Spec - s.define - - s.summary = 'MoEngage Cards Plugin for Hybrid SDKs' - s.description = <<-DESC - MoEngage is a mobile marketing automation company. This framework is used by our plugins built for different hybrid frameworks i.e, Flutter, Cordova, React Native etc. - DESC - - s.frameworks = 'UIKit', 'Foundation', 'UserNotifications' - s.dependency 'MoEngage-iOS-SDK/Cards' - - # s.test_spec 'UnitTests' do |ts| - # ts.source_files = 'Tests/MoEngagePluginCardsTests/**/*.swift' - # s.scheme = { :code_coverage => true } - # end -end diff --git a/MoEngagePluginCards/CHANGELOG.md b/MoEngagePluginCards/CHANGELOG.md deleted file mode 100644 index 2fd29be..0000000 --- a/MoEngagePluginCards/CHANGELOG.md +++ /dev/null @@ -1,67 +0,0 @@ -# 17-10-2025 - -## 3.7.1 - -- Updated MoEngage-iOS-SDK to 10.07.2 - -# 13-10-2025 - -## 3.7.0 - -- Updated MoEngage-iOS-SDK to 10.07.1 - -# 22-09-2025 - -## 3.6.0 - -- Updated MoEngage-iOS-SDK to 10.06.0 - -# 08-09-2025 - -## 3.5.0 - -- Updated MoEngage-iOS-SDK to 10.05.0 - -# 08-09-2025 - -## 3.4.1 - -- Updated MoEngage-iOS-SDK to 10.04.2 - -# 05-08-2025 - -## 3.4.0 - -- Updated MoEngage-iOS-SDK to 10.04.0 - -# 05-08-2025 - -## 3.3.3 - -- Updated MoEngage-iOS-SDK to 10.03.3 - -# 25-07-2025 - -## 3.3.2 - -- Updated MoEngage-iOS-SDK to 10.03.2 - -# 16-07-2025 - -## 3.3.1 - -- Updated MoEngage-iOS-SDK to 10.03.1 - -# 15-07-2025 - -## 3.3.0 - -- Updated MoEngage-iOS-SDK to 10.03.0 -- Added support for file based initialization - -# 03-07-2025 - -## 3.2.0 - -- Added automated version and changelog update -- Added support for Accessibility for Cards. diff --git a/MoEngagePluginCards/DataTransfer/HybridToNative/MoEngageCardCampaign+Array.swift b/MoEngagePluginCards/DataTransfer/HybridToNative/MoEngageCardCampaign+Array.swift deleted file mode 100644 index c055d79..0000000 --- a/MoEngagePluginCards/DataTransfer/HybridToNative/MoEngageCardCampaign+Array.swift +++ /dev/null @@ -1,26 +0,0 @@ -// -// MoEngageCardCampaign+Array.swift -// MoEngagePluginCards -// -// Created by Soumya Mahunt on 21/06/23. -// - -import MoEngageCore -import MoEngageCards - -extension Array where Element == [String: Any] { - func decodeFromHybrid() -> [MoEngageCardCampaign] { - var cards: [MoEngageCardCampaign] = [] - cards.reserveCapacity(self.count) - for cardData in self { - do { - let card = try MoEngageHybridSDKCards.buildCardCampaign(fromHybridData: cardData) - cards.append(card) - } catch { - MoEngagePluginCardsLogger.error("\(error)") - continue - } - } - return cards - } -} diff --git a/MoEngagePluginCards/DataTransfer/HybridToNative/MoEngageCardClickData.swift b/MoEngagePluginCards/DataTransfer/HybridToNative/MoEngageCardClickData.swift deleted file mode 100644 index c728fa6..0000000 --- a/MoEngagePluginCards/DataTransfer/HybridToNative/MoEngageCardClickData.swift +++ /dev/null @@ -1,35 +0,0 @@ -// -// MoEngageCardClickData.swift -// MoEngagePluginCards -// -// Created by Soumya Mahunt on 21/06/23. -// - -import MoEngageCards - -struct MoEngageCardClickData { - enum HybridKeys { - static let widgetId = "widgetId" - static let card = "card" - } - - let widgetId: Int? - let card: MoEngageCardCampaign - - init(widgetId: Int?, card: MoEngageCardCampaign) { - self.widgetId = widgetId - self.card = card - } - - static func decodeFromHybrid(_ data: [String: Any]) throws -> Self { - guard let cardData = data[HybridKeys.card] as? [String: Any] else { - throw MoEngageCardsDecodingError(key: HybridKeys.card, data: data) - } - - let widgetId = data[HybridKeys.widgetId] as? Int - return try self.init( - widgetId: widgetId == -1 ? nil : widgetId, - card: MoEngageHybridSDKCards.buildCardCampaign(fromHybridData: cardData) - ) - } -} diff --git a/MoEngagePluginCards/DataTransfer/HybridToNative/MoEngageCardsCategoryData.swift b/MoEngagePluginCards/DataTransfer/HybridToNative/MoEngageCardsCategoryData.swift deleted file mode 100644 index 221e99f..0000000 --- a/MoEngagePluginCards/DataTransfer/HybridToNative/MoEngageCardsCategoryData.swift +++ /dev/null @@ -1,27 +0,0 @@ -// -// MoEngageCardsCategoryData.swift -// MoEngagePluginCards -// -// Created by Soumya Mahunt on 21/06/23. -// - -import MoEngageCards - -struct MoEngageCardsCategoryData { - enum HybridKeys { - static let category = "category" - } - - let category: String - - init(category: String) { - self.category = category - } - - static func decodeFromHybrid(_ data: [String: Any]) throws -> Self { - guard let category = data[HybridKeys.category] as? String else { - throw MoEngageCardsDecodingError(key: HybridKeys.category, data: data) - } - return self.init(category: category) - } -} diff --git a/MoEngagePluginCards/DataTransfer/NativeToHybrid/HybridEncodable.swift b/MoEngagePluginCards/DataTransfer/NativeToHybrid/HybridEncodable.swift deleted file mode 100644 index d2ac5f2..0000000 --- a/MoEngagePluginCards/DataTransfer/NativeToHybrid/HybridEncodable.swift +++ /dev/null @@ -1,23 +0,0 @@ -// -// HybridEncodable.swift -// MoEngagePluginBase -// -// Created by Soumya Mahunt on 20/06/23. -// - -import Foundation - -protocol HybridEncodable { - func encodeForHybrid() -> [String: Any?] -} - -extension Array where Element: HybridEncodable { - func encodeForHybrid() -> [[String: Any?]] { - var data: [[String: Any?]] = [] - data.reserveCapacity(self.count) - for element in self { - data.append(element.encodeForHybrid()) - } - return data - } -} diff --git a/MoEngagePluginCards/DataTransfer/NativeToHybrid/MoEngageCampaignState.swift b/MoEngagePluginCards/DataTransfer/NativeToHybrid/MoEngageCampaignState.swift deleted file mode 100644 index 21d1c41..0000000 --- a/MoEngagePluginCards/DataTransfer/NativeToHybrid/MoEngageCampaignState.swift +++ /dev/null @@ -1,36 +0,0 @@ -// -// MoEngageCampaignState.swift -// MoEngagePluginCards -// -// Created by Soumya Mahunt on 20/06/23. -// - -import MoEngageCards - -extension MoEngageCampaignState: HybridEncodable { - enum HybridKeys { - static let showCountTotal = "totalShowCount" - static let isClicked = "isClicked" - static let firstSeenTime = "firstSeen" - static let firstDeliveredTime = "firstReceived" - static let showCountCurrentDevice = "localShowCount" - } - - func encodeForHybrid() -> [String: Any?] { - var data: [String : Any] = [ - HybridKeys.showCountTotal: self.showCountTotal, - HybridKeys.isClicked: self.isClicked, - HybridKeys.showCountCurrentDevice: self.showCountCurrentDevice, - ] - - if let firstSeenTime = self.firstSeenTime { - data[HybridKeys.firstSeenTime] = MoEngagePluginCardsUtil.convertDateToEpoch(firstSeenTime) - } - - if let firstDeliveredTime = self.firstDeliveredTime { - data[HybridKeys.firstDeliveredTime] = MoEngagePluginCardsUtil.convertDateToEpoch(firstDeliveredTime) - } - - return data - } -} diff --git a/MoEngagePluginCards/DataTransfer/NativeToHybrid/MoEngageCardAccessibilityData.swift b/MoEngagePluginCards/DataTransfer/NativeToHybrid/MoEngageCardAccessibilityData.swift deleted file mode 100644 index 4259855..0000000 --- a/MoEngagePluginCards/DataTransfer/NativeToHybrid/MoEngageCardAccessibilityData.swift +++ /dev/null @@ -1,21 +0,0 @@ -// -// MoEngageCardWidget.swift -// MoEngagePluginCards -// -// Created by Soumya Mahunt on 20/06/23. -// - -import MoEngageCards - -extension MoEngageCardAccessibilityData: HybridEncodable { - enum HybridKeys { - static let text = "text" - static let hint = "hint" - } - - func encodeForHybrid() -> [String : Any?] { - return [ - HybridKeys.text: self.label, - HybridKeys.hint: self.hint] - } -} diff --git a/MoEngagePluginCards/DataTransfer/NativeToHybrid/MoEngageCardAction.swift b/MoEngagePluginCards/DataTransfer/NativeToHybrid/MoEngageCardAction.swift deleted file mode 100644 index c157fe6..0000000 --- a/MoEngagePluginCards/DataTransfer/NativeToHybrid/MoEngageCardAction.swift +++ /dev/null @@ -1,26 +0,0 @@ -// -// MoEngageCardAction.swift -// MoEngagePluginCards -// -// Created by Soumya Mahunt on 20/06/23. -// - -import MoEngageCards - -extension MoEngageCardAction: HybridEncodable { - enum HybridKeys { - static let name = "name" - static let type = "type" - static let value = "value" - static let kvPairs = "kvPairs" - } - - func encodeForHybrid() -> [String : Any?] { - return [ - HybridKeys.name: self.name, - HybridKeys.type: self.type.rawValue, - HybridKeys.value: self.value, - HybridKeys.kvPairs: self.kvPairs, - ] - } -} diff --git a/MoEngagePluginCards/DataTransfer/NativeToHybrid/MoEngageCardCampaign+Encode.swift b/MoEngagePluginCards/DataTransfer/NativeToHybrid/MoEngageCardCampaign+Encode.swift deleted file mode 100644 index 4cd1d96..0000000 --- a/MoEngagePluginCards/DataTransfer/NativeToHybrid/MoEngageCardCampaign+Encode.swift +++ /dev/null @@ -1,42 +0,0 @@ -// -// MoEngageCardCampaign.swift -// MoEngagePluginCards -// -// Created by Soumya Mahunt on 20/06/23. -// - -import MoEngageCards - -extension MoEngageCardCampaign: HybridEncodable { - enum HybridKeys { - static let cardId = "card_id" - static let category = "category" - static let templateData = "template_data" - static let nestedData = "meta_data" - static let createdDate = "created_at" - static let updatedDate = "updated_at" - static let metaData = "metaData" - static let displayControl = "display_controls" - static let cardState = "campaignState" - static let campaignPayload = "campaignPayload" - } - - func encodeForHybrid() -> [String: Any?] { - var nestedData: [String : Any?] = [ - HybridKeys.updatedDate: MoEngagePluginCardsUtil.convertDateToEpoch(self.updatedDate), - HybridKeys.displayControl: self.displayControl?.encodeForHybrid(), - HybridKeys.cardState: self.cardState.encodeForHybrid(), - HybridKeys.metaData: self.metaData, - HybridKeys.campaignPayload: MoEngageHybridSDKCards.convertCardCampaignToJsonData(self) - ] - if let createdDate = self.createdDate { - nestedData[HybridKeys.createdDate] = MoEngagePluginCardsUtil.convertDateToEpoch(createdDate) - } - return [ - HybridKeys.cardId: self.cardID, - HybridKeys.category: self.category, - HybridKeys.templateData: self.templateData?.encodeForHybrid(), - HybridKeys.nestedData: nestedData - ] - } -} diff --git a/MoEngagePluginCards/DataTransfer/NativeToHybrid/MoEngageCardContainer.swift b/MoEngagePluginCards/DataTransfer/NativeToHybrid/MoEngageCardContainer.swift deleted file mode 100644 index 3b61b68..0000000 --- a/MoEngagePluginCards/DataTransfer/NativeToHybrid/MoEngageCardContainer.swift +++ /dev/null @@ -1,28 +0,0 @@ -// -// MoEngageCardContainer.swift -// MoEngagePluginCards -// -// Created by Soumya Mahunt on 20/06/23. -// - -import MoEngageCards - -extension MoEngageCardContainer: HybridEncodable { - enum HybridKeys { - static let id = "id" - static let type = "type" - static let style = "style" - static let actions = "actions" - static let widgets = "widgets" - } - - func encodeForHybrid() -> [String : Any?] { - return [ - HybridKeys.id: self.id, - HybridKeys.type: self.type.rawValue, - HybridKeys.style: self.style?.encodeForHybrid(), - HybridKeys.actions: self.actions.encodeForHybrid(), - HybridKeys.widgets: self.widgets.encodeForHybrid(), - ] - } -} diff --git a/MoEngagePluginCards/DataTransfer/NativeToHybrid/MoEngageCardData.swift b/MoEngagePluginCards/DataTransfer/NativeToHybrid/MoEngageCardData.swift deleted file mode 100644 index baea25a..0000000 --- a/MoEngagePluginCards/DataTransfer/NativeToHybrid/MoEngageCardData.swift +++ /dev/null @@ -1,22 +0,0 @@ -// -// MoEngageCardData.swift -// MoEngagePluginCards -// -// Created by Soumya Mahunt on 17/07/23. -// - -import MoEngageCards - -extension MoEngageCardData: HybridEncodable { - enum HybridKeys { - static let cards = MoEngagePluginCardsContants.cards - static let accessibility = MoEngagePluginCardsContants.accessibility - } - - func encodeForHybrid() -> [String : Any?] { - return [ - HybridKeys.cards: cards.encodeForHybrid(), - HybridKeys.accessibility: staticImageAccessibilityData?.mapValues { $0.encodeForHybrid() } as Any - ] - } -} diff --git a/MoEngagePluginCards/DataTransfer/NativeToHybrid/MoEngageCardDisplayControl.swift b/MoEngagePluginCards/DataTransfer/NativeToHybrid/MoEngageCardDisplayControl.swift deleted file mode 100644 index ee029c5..0000000 --- a/MoEngagePluginCards/DataTransfer/NativeToHybrid/MoEngageCardDisplayControl.swift +++ /dev/null @@ -1,40 +0,0 @@ -// -// MoEngageCardDisplayControl.swift -// MoEngagePluginCards -// -// Created by Soumya Mahunt on 20/06/23. -// - -import MoEngageCards - -extension MoEngageCardDisplayControl: HybridEncodable { - enum HybridKeys { - static let isPinned = "is_pin" - static let maxTimesToShow = "max_times_to_show" - static let expiryDate = "expire_at" - static let expiryAfterSeenDuration = "expire_after_seen" - static let expiryAfterDeliveredDuration = "expire_after_delivered" - static let showTime = "show_time" - } - - func encodeForHybrid() -> [String: Any?] { - var data: [String : Any?] = [ - HybridKeys.isPinned: self.isPinned, - HybridKeys.maxTimesToShow: self.maxTimesToShow, - HybridKeys.showTime: self.showTime?.encodeForHybrid(), - ] - - if let expiryDate = self.expiryDate { - data[HybridKeys.expiryDate] = MoEngagePluginCardsUtil.convertDateToEpoch(expiryDate) - } - - if let expiryAfterSeenDuration = self.expiryAfterSeenDuration { - data[HybridKeys.expiryAfterSeenDuration] = expiryAfterSeenDuration.rounded(.down) - } - - if let expiryAfterDeliveredDuration = self.expiryAfterDeliveredDuration { - data[HybridKeys.expiryAfterDeliveredDuration] = expiryAfterDeliveredDuration.rounded(.down) - } - return data - } -} diff --git a/MoEngagePluginCards/DataTransfer/NativeToHybrid/MoEngageCardShowTime.swift b/MoEngagePluginCards/DataTransfer/NativeToHybrid/MoEngageCardShowTime.swift deleted file mode 100644 index 4e85f22..0000000 --- a/MoEngagePluginCards/DataTransfer/NativeToHybrid/MoEngageCardShowTime.swift +++ /dev/null @@ -1,22 +0,0 @@ -// -// MoEngageCardShowTime.swift -// MoEngagePluginCards -// -// Created by Soumya Mahunt on 20/06/23. -// - -import MoEngageCards - -extension MoEngageCardShowTime: HybridEncodable { - enum HybridKeys { - static let startTime = "start_time" - static let endTime = "end_time" - } - - func encodeForHybrid() -> [String: Any?] { - return [ - HybridKeys.startTime: self.startTime, - HybridKeys.endTime: self.endTime, - ] - } -} diff --git a/MoEngagePluginCards/DataTransfer/NativeToHybrid/MoEngageCardStyle.swift b/MoEngagePluginCards/DataTransfer/NativeToHybrid/MoEngageCardStyle.swift deleted file mode 100644 index d7d93f0..0000000 --- a/MoEngagePluginCards/DataTransfer/NativeToHybrid/MoEngageCardStyle.swift +++ /dev/null @@ -1,21 +0,0 @@ -// -// MoEngageCardStyle.swift -// MoEngagePluginCards -// -// Created by Soumya Mahunt on 20/06/23. -// - -import MoEngageCards - -extension MoEngageCardStyle: HybridEncodable { - enum HybridKeys { - static let bgColor = "bgColor" - } - - func encodeForHybrid() -> [String : Any?] { - guard let bgColor = self.bgColor else { return [:] } - return [ - HybridKeys.bgColor: MoEngagePluginCardsUtil.convertRGBColorToHex(bgColor), - ] - } -} diff --git a/MoEngagePluginCards/DataTransfer/NativeToHybrid/MoEngageCardSyncCompleteMetaData.swift b/MoEngagePluginCards/DataTransfer/NativeToHybrid/MoEngageCardSyncCompleteMetaData.swift deleted file mode 100644 index df55437..0000000 --- a/MoEngagePluginCards/DataTransfer/NativeToHybrid/MoEngageCardSyncCompleteMetaData.swift +++ /dev/null @@ -1,62 +0,0 @@ -// -// MoEngageCardSyncCompleteMetaData.swift -// MoEngagePluginCards -// -// Created by Soumya Mahunt on 20/06/23. -// - -import MoEngageCards - -@objc public enum MoEngageCardsSyncEventType: Int, CustomStringConvertible { - case pullToRefresh - case inboxOpen - case appOpen - case immediate - - public var description: String { - switch self { - case .pullToRefresh: - return "PULL_TO_REFRESH" - case .inboxOpen: - return "INBOX_OPEN" - case .appOpen: - return "APP_OPEN" - case .immediate: - return "IMMEDIATE" - } - } -} - -struct MoEngageCardSyncCompleteMetaData: HybridEncodable { - let type: MoEngageCardsSyncEventType? - let data: MoEngageCardSyncCompleteData? - - init( - type: MoEngageCardsSyncEventType? = nil, - data: MoEngageCardSyncCompleteData? = nil - ) { - self.type = type - self.data = data - } - - enum HybridKeys { - static let syncCompleteData = "syncCompleteData" - static let hasUpdates = "hasUpdates" - static let type = "syncType" - } - - func encodeForHybrid() -> [String : Any?] { - let syncCompleteData: [String: Any?]? - if let type = self.type, let data = self.data { - syncCompleteData = [ - HybridKeys.type: type.description, - HybridKeys.hasUpdates: data.hasUpdates, - ] - } else { - syncCompleteData = nil - } - return [ - HybridKeys.syncCompleteData: syncCompleteData - ] - } -} diff --git a/MoEngagePluginCards/DataTransfer/NativeToHybrid/MoEngageCardTemplateData.swift b/MoEngagePluginCards/DataTransfer/NativeToHybrid/MoEngageCardTemplateData.swift deleted file mode 100644 index f0e4972..0000000 --- a/MoEngagePluginCards/DataTransfer/NativeToHybrid/MoEngageCardTemplateData.swift +++ /dev/null @@ -1,22 +0,0 @@ -// -// MoEngageCardTemplateData.swift -// MoEngagePluginCards -// -// Created by Soumya Mahunt on 20/06/23. -// - -import MoEngageCards - -extension MoEngageCardTemplateData: HybridEncodable { - enum HybridKeys { - static let type = "type" - static let containers = "containers" - } - - func encodeForHybrid() -> [String: Any?] { - return [ - HybridKeys.type: self.type.rawValue, - HybridKeys.containers: self.containers.encodeForHybrid(), - ] - } -} diff --git a/MoEngagePluginCards/DataTransfer/NativeToHybrid/MoEngageCardWidget.swift b/MoEngagePluginCards/DataTransfer/NativeToHybrid/MoEngageCardWidget.swift deleted file mode 100644 index 13a9df9..0000000 --- a/MoEngagePluginCards/DataTransfer/NativeToHybrid/MoEngageCardWidget.swift +++ /dev/null @@ -1,30 +0,0 @@ -// -// MoEngageCardWidget.swift -// MoEngagePluginCards -// -// Created by Soumya Mahunt on 20/06/23. -// - -import MoEngageCards - -extension MoEngageCardWidget: HybridEncodable { - enum HybridKeys { - static let id = "id" - static let type = "type" - static let content = "content" - static let style = "style" - static let actions = "actions" - static let accessibility = "accessibility" - } - - func encodeForHybrid() -> [String : Any?] { - return [ - HybridKeys.id: self.id, - HybridKeys.type: self.type.rawValue, - HybridKeys.content: self.content, - HybridKeys.style: self.style?.encodeForHybrid(), - HybridKeys.actions: self.actions.encodeForHybrid(), - HybridKeys.accessibility: self.accessibilityData?.encodeForHybrid() - ] - } -} diff --git a/MoEngagePluginCards/DataTransfer/NativeToHybrid/MoEngageCardsData.swift b/MoEngagePluginCards/DataTransfer/NativeToHybrid/MoEngageCardsData.swift deleted file mode 100644 index 9a08f3f..0000000 --- a/MoEngagePluginCards/DataTransfer/NativeToHybrid/MoEngageCardsData.swift +++ /dev/null @@ -1,26 +0,0 @@ -// -// MoEngageCardsData.swift -// MoEngagePluginBase -// -// Created by Soumya Mahunt on 20/06/23. -// - -import MoEngageCards - -extension MoEngageCardsData: HybridEncodable { - enum HybridKeys { - static let showAllTab = "shouldShowAllTab" - static let cardCategories = "categories" - static let cards = "cards" - static let accessibility = "accessibility" - } - - func encodeForHybrid() -> [String: Any?] { - return [ - HybridKeys.showAllTab: self.showAllTab, - HybridKeys.cardCategories: self.cardCategories, - HybridKeys.cards: self.cards.encodeForHybrid(), - HybridKeys.accessibility: self.staticImageAccessibilityData?.mapValues { $0.encodeForHybrid() } as Any - ] - } -} diff --git a/MoEngagePluginCards/DataTransfer/Sync/MoEngageCardSyncDataManager.swift b/MoEngagePluginCards/DataTransfer/Sync/MoEngageCardSyncDataManager.swift deleted file mode 100644 index 985405b..0000000 --- a/MoEngagePluginCards/DataTransfer/Sync/MoEngageCardSyncDataManager.swift +++ /dev/null @@ -1,40 +0,0 @@ -// -// MoEngageCardSyncDataManager.swift -// MoEngagePluginCards -// -// Created by Soumya Mahunt on 22/06/23. -// - -import MoEngageCards - -protocol MoEngageCardSyncDataManagerProtocol { - func dequeueSyncUpdateItems() -> [MoEngageCardSyncDataManager.QueueItem] - func queueCardSyncUpdate( - forEventType eventType: MoEngageCardsSyncEventType, - andAppID appId: String, - data: MoEngageCardSyncCompleteData? - ) -} - -final class MoEngageCardSyncDataManager: MoEngageCardSyncDataManagerProtocol { - struct QueueItem { - let eventType: MoEngageCardsSyncEventType - let appId: String - let data: MoEngageCardSyncCompleteData? - } - - private var items: [QueueItem] = [] - - func queueCardSyncUpdate( - forEventType eventType: MoEngageCardsSyncEventType, - andAppID appId: String, - data: MoEngageCardSyncCompleteData? - ) { - items.append(.init(eventType: eventType, appId: appId, data: data)) - } - - func dequeueSyncUpdateItems() -> [QueueItem] { - defer { items = [] } - return items - } -} diff --git a/MoEngagePluginCards/DataTransfer/Sync/MoEngageCardSyncManager.swift b/MoEngagePluginCards/DataTransfer/Sync/MoEngageCardSyncManager.swift deleted file mode 100644 index 0f6d6df..0000000 --- a/MoEngagePluginCards/DataTransfer/Sync/MoEngageCardSyncManager.swift +++ /dev/null @@ -1,140 +0,0 @@ -// -// MoEngageCardSyncManager.swift -// MoEngagePluginCards -// -// Created by Soumya Mahunt on 20/06/23. -// - -import MoEngageCore -import MoEngageCards - -protocol MoEngageCardSyncManagerProtocol: MoEngageHybridSDKCardsDelegate { - func setSyncListener() - func attachDelegate(_ delegate: MoEngageCardSyncDelegate) - func detachDelegate() - - func sendUpdate( - forEventType eventType: MoEngageCardsSyncEventType, - andAppID appId: String, - withNewData data: MoEngageCardSyncCompleteData? - ) -} - -final class MoEngageCardSyncManager: MoEngageCardSyncManagerProtocol { - private let queue: MoEngageCardSyncManagerSynchronizer - private let dataManager: MoEngageCardSyncDataManagerProtocol - private var delegate: MoEngageCardSyncDelegate? - private var isSyncListenerSet: Bool - - init( - queue: MoEngageCardSyncManagerSynchronizer = MoEngageCoreHandler.globalQueue, - dataManager: MoEngageCardSyncDataManagerProtocol = MoEngageCardSyncDataManager(), - isSyncListenerSet: Bool = false - ) { - self.queue = queue - self.dataManager = dataManager - self.isSyncListenerSet = isSyncListenerSet - } - - func setSyncListener() { - queue.async { - self.isSyncListenerSet = true - self.flushSyncEvents() - } - } - - func attachDelegate(_ delegate: MoEngageCardSyncDelegate) { - queue.async { - self.delegate = delegate - self.flushSyncEvents() - } - } - - func flushSyncEvents() { - for item in self.dataManager.dequeueSyncUpdateItems() { - self.sendUpdate( - forEventType: item.eventType, - andAppID: item.appId, - withNewData: item.data - ) - } - } - - func detachDelegate() { - queue.async { - self.delegate = nil - } - } - - func didSyncCards( - forEvent event: MoEngageHybridCardsSyncType, - recievedUpdate data: MoEngageCardSyncCompleteData - ) { - switch event { - case .appOpen: - self.sendUpdate( - forEventType: .appOpen, - andAppID: data.accountMeta.appID, - withNewData: data - ) - let dataForHybrid = MoEngagePluginCardsUtil.buildHybridPayload( - forIdentifier: data.accountMeta.appID, - containingData: MoEngageCardSyncCompleteMetaData( - type: .appOpen, - data: data - ).encodeForHybrid() - ) - MoEngagePluginCardsLogger.debug( - "Recieved app open sync callback \(dataForHybrid) in pluginbase", - forData: dataForHybrid - ) - case .immediateSync: - self.sendUpdate( - forEventType: .immediate, - andAppID: data.accountMeta.appID, - withNewData: data - ) - default: - break - } - } - - func sendUpdate( - forEventType eventType: MoEngageCardsSyncEventType, - andAppID appId: String, - withNewData data: MoEngageCardSyncCompleteData? - ) { - queue.async { - let metadata = MoEngageCardSyncCompleteMetaData(type: eventType, data: data) - if let delegate = self.delegate, - eventType != .appOpen || eventType != .immediate || self.isSyncListenerSet { - let dataForHybrid = MoEngagePluginCardsUtil.buildHybridPayload( - forIdentifier: appId, - containingData: metadata.encodeForHybrid() - ) - DispatchQueue.main.async { - delegate.syncComplete( - forEventType: eventType, - withData: dataForHybrid - ) - } - } else { - self.dataManager.queueCardSyncUpdate( - forEventType: eventType, - andAppID: appId, - data: data - ) - } - } - } -} - -protocol MoEngageCardSyncManagerSynchronizer { - func async(execute work: @escaping @convention(block) () -> Void) -} - -extension DispatchQueue: MoEngageCardSyncManagerSynchronizer { - func async(execute work: @escaping @convention(block) () -> Void) { - self.async(group: nil, execute: work) - } -} diff --git a/MoEngagePluginCards/Helpers/MoEngageCardsDecodingError.swift b/MoEngagePluginCards/Helpers/MoEngageCardsDecodingError.swift deleted file mode 100644 index 620a50d..0000000 --- a/MoEngagePluginCards/Helpers/MoEngageCardsDecodingError.swift +++ /dev/null @@ -1,24 +0,0 @@ -// -// MoEngageCardsDecodingError.swift -// MoEngagePluginCards -// -// Created by Soumya Mahunt on 20/06/23. -// - -import Foundation - -struct MoEngageCardsDecodingError: Error, CustomStringConvertible { - let key: String - let data: Any - let function: String - - init(key: String, data: Any, function: String = #function) { - self.key = key - self.data = data - self.function = function - } - - var description: String { - "Failed to decode \(key) in data: \(data) at \(function)" - } -} diff --git a/MoEngagePluginCards/Helpers/MoEngageCardsPluginLogger.swift b/MoEngagePluginCards/Helpers/MoEngageCardsPluginLogger.swift deleted file mode 100644 index 8314420..0000000 --- a/MoEngagePluginCards/Helpers/MoEngageCardsPluginLogger.swift +++ /dev/null @@ -1,92 +0,0 @@ -// -// MoEngageCardsPluginLogger.swift -// moengage_cards -// -// Created by Soumya Mahunt on 05/07/23. -// - -import Foundation -import MoEngageCore -import MoEngagePluginBase - -public enum MoEngagePluginCardsLogger { - private static let label = "Cards" - private static var sdkInstance: MoEngageSDKInstance? - - public static func debug(_ message: String, forData hybridData: [String: Any]) { - queueLog(message, forData: hybridData, withType: .debug) - } - - public static func error( - _ message: String, - forData hybridData: [String: Any] = [:], - file: String = #file, - function: String = #function, - line: Int = #line, - column: Int = #column - ) { - queueLog( - message, forData: hybridData, withType: .error, - file: file, function: function, line: line, column: column - ) - } - - private static func queueLog( - _ message: String, - forData hybridData: [String: Any], - withType type: MoEngageLoggerType, - file: String = #file, - function: String = #function, - line: Int = #line, - column: Int = #column - ) { - if let sdkInstance = Self.sdkInstance { - log( - message, withPayload: hybridData, withType: type, inInstance: sdkInstance, - file: file, function: function, line: line, column: column - ) - } else if let identifier = MoEngagePluginUtils.fetchIdentifierFromPayload( - attribute: hybridData - ) { - MoEngageCoreHandler.globalQueue.async { - guard let instance = MoEngageSDKInstanceProvider.getSDKInstance(workspaceId: identifier) else { return } - Self.sdkInstance = instance - log( - message, withPayload: hybridData, withType: type, inInstance: instance, - file: file, function: function, line: line, column: column - ) - } - } - } - - private static func log( - _ message: String, - withPayload payload: [String: Any], - withType type: MoEngageLoggerType, - inInstance sdkInstance: MoEngageSDKInstance, - file: String = #file, - function: String = #function, - line: Int = #line, - column: Int = #column - ) { - let finalMessage = generateLogs(message: message, payload: payload) - switch type { - case .debug: - sdkInstance.logger.log(logLevel: .debug, message: finalMessage) - case .error: - sdkInstance.logger.log(logLevel: .error, message: finalMessage) - case .info: - sdkInstance.logger.log(logLevel: .info, message: finalMessage) - case .verbose: - sdkInstance.logger.log(logLevel: .verbose, message: finalMessage) - case .warning: - sdkInstance.logger.log(logLevel: .warning, message: finalMessage) - @unknown default: - sdkInstance.logger.log(logLevel: .verbose, message: finalMessage) - } - } - - private static func generateLogs(message: String, payload: [String: Any]) -> String { - return "\(message) \(payload)" - } -} diff --git a/MoEngagePluginCards/Helpers/MoEngagePluginCardsContants.swift b/MoEngagePluginCards/Helpers/MoEngagePluginCardsContants.swift deleted file mode 100644 index 1b45568..0000000 --- a/MoEngagePluginCards/Helpers/MoEngagePluginCardsContants.swift +++ /dev/null @@ -1,19 +0,0 @@ -// -// MoEngagePluginCardsContants.swift -// MoEngagePluginCards -// -// Created by Soumya Mahunt on 19/06/23. -// - -import Foundation - -enum MoEngagePluginCardsContants { - static let isAllCategoryEnabled = "isAllCategoryEnabled" - static let newCardsCount = "newCardsCount" - static let unClickedCardsCount = "unClickedCardsCount" - static let category = "category" - static let categories = "categories" - static let cards = "cards" - static let card = "card" - static let accessibility = "accessibility" -} diff --git a/MoEngagePluginCards/Helpers/MoEngagePluginCardsDelegateHandler.swift b/MoEngagePluginCards/Helpers/MoEngagePluginCardsDelegateHandler.swift deleted file mode 100644 index 4248acc..0000000 --- a/MoEngagePluginCards/Helpers/MoEngagePluginCardsDelegateHandler.swift +++ /dev/null @@ -1,16 +0,0 @@ -// -// MoEngagePluginCardsDelegate.swift -// MoEngagePluginCards -// -// Created by Rakshitha on 16/08/23. -// - -import Foundation -import MoEngagePluginBase - -class MoEngagePluginCardsDelegateHandler: MoEngagePluginBaseProtocol { - - static func initializePluginBridge() { - let _ = MoEngagePluginCardsBridge.sharedInstance - } -} diff --git a/MoEngagePluginCards/Helpers/MoEngagePluginCardsUtil.swift b/MoEngagePluginCards/Helpers/MoEngagePluginCardsUtil.swift deleted file mode 100644 index 30df973..0000000 --- a/MoEngagePluginCards/Helpers/MoEngagePluginCardsUtil.swift +++ /dev/null @@ -1,73 +0,0 @@ -// -// MoEngagePluginCardsUtil.swift -// MoEngagePluginCards -// -// Created by Soumya Mahunt on 19/06/23. -// - -import MoEngagePluginBase -import MoEngageCore -import MoEngageCards - -enum MoEngagePluginCardsUtil { - - static func buildHybridPayload( - forIdentifier identifier: String, - containingData data: Any - ) -> [String: Any] { - let accountMeta = MoEngagePluginUtils.createAccountPayload(identifier: identifier) - return [ - MoEngagePluginConstants.General.accountMeta: accountMeta, - MoEngagePluginConstants.General.data: data - ] - } - - static func getData( - fromHybridPayload data: [String: Any], - at function: String = #function - ) throws -> T { - guard - let result = data[MoEngagePluginConstants.General.data] as? T - else { - throw MoEngageCardsDecodingError( - key: MoEngagePluginConstants.General.data, - data: data, - function: function - ) - } - return result - } - - static func getNestedData( - fromHybridPayload data: [String: Any], - forKey key: String, - at function: String = #function - ) throws -> T { - let parent: [String: Any] = try Self.getData(fromHybridPayload: data, at: function) - guard - let result = parent[key] as? T - else { - throw MoEngageCardsDecodingError( - key: key, - data: parent, - function: function - ) - } - return result - } - - static func convertRGBColorToHex(_ color: UIColor) -> String { - var r: CGFloat = 0 - var g: CGFloat = 0 - var b: CGFloat = 0 - var a: CGFloat = 0 - - color.getRed(&r, green: &g, blue: &b, alpha: &a) - let rgb: Int = (Int)(r*255)<<16 | (Int)(g*255)<<8 | (Int)(b*255)<<0 - return NSString(format:"#%06x", rgb) as String - } - - static func convertDateToEpoch(_ date: Date) -> Double { - return date.timeIntervalSince1970.rounded(.down) - } -} diff --git a/MoEngagePluginCards/MoEngagePluginCardsBridge.swift b/MoEngagePluginCards/MoEngagePluginCardsBridge.swift deleted file mode 100644 index 0d8f039..0000000 --- a/MoEngagePluginCards/MoEngagePluginCardsBridge.swift +++ /dev/null @@ -1,492 +0,0 @@ -// -// MoEngagePluginCardsBridge.swift -// MoEngagePluginCards -// -// Created by Soumya Mahunt on 19/06/23. -// - -import MoEngagePluginBase -import MoEngageCore -import MoEngageCards - -@objc public protocol MoEngageCardSyncDelegate { - func syncComplete(forEventType eventType: MoEngageCardsSyncEventType, withData data: [String: Any]) -} - -@objc final public class MoEngagePluginCardsBridge: NSObject { - @objc public static let sharedInstance = MoEngagePluginCardsBridge() - - private let handler: MoEngagePluginCardsBridgeHandler - private let syncManager: MoEngageCardSyncManagerProtocol - - internal init( - handler: MoEngagePluginCardsBridgeHandler = MoEngageSDKCards.sharedInstance, - syncManager: MoEngageCardSyncManagerProtocol = MoEngageCardSyncManager() - ) { - self.handler = handler - self.syncManager = syncManager - MoEngageHybridSDKCards.hybridCardsDelegate = syncManager - } - - private func logAppIdentifierFetchFailed( - for payload: [String: Any], - at function: String = #function - ) { - MoEngagePluginCardsLogger.error( - "Could't find app identifier data for payload: \(payload) at \(function)" - ) - } - - @objc public func setSyncEventListnerDelegate(_ delegate: MoEngageCardSyncDelegate) { - syncManager.attachDelegate(delegate) - } - - @objc public func onFrameworkDetached() { - syncManager.detachDelegate() - } - - @objc public func initialize(_ accountData: [String: Any]) { - guard - let _ = MoEngagePluginUtils.fetchIdentifierFromPayload( - attribute: accountData - ) - else { - logAppIdentifierFetchFailed(for: accountData) - return - } - } - - @objc public func refreshCards(_ accountData: [String: Any]) { - guard - let identifier = MoEngagePluginUtils.fetchIdentifierFromPayload( - attribute: accountData - ) - else { - logAppIdentifierFetchFailed(for: accountData) - return - } - - MoEngagePluginCardsLogger.debug("Refresh Cards - ", forData: accountData) - handler.refreshCards(forAppID: identifier) { data in - self.syncManager.sendUpdate( - forEventType: .pullToRefresh, - andAppID: identifier, - withNewData: data - ) - } - } - - @objc public func onCardsSectionLoaded(_ accountData: [String: Any]) { - guard - let identifier = MoEngagePluginUtils.fetchIdentifierFromPayload( - attribute: accountData - ) - else { - logAppIdentifierFetchFailed(for: accountData) - return - } - - - MoEngagePluginCardsLogger.debug("On CardsSection Loaded - ", forData: accountData) - - handler.onCardSectionLoaded(forAppID: identifier) { data in - self.syncManager.sendUpdate( - forEventType: .inboxOpen, - andAppID: identifier, - withNewData: data - ) - } - } - - @objc public func setSyncListener(_ accountData: [String: Any]) { - guard - let _ = MoEngagePluginUtils.fetchIdentifierFromPayload( - attribute: accountData - ) - else { - logAppIdentifierFetchFailed(for: accountData) - return - } - - MoEngagePluginCardsLogger.debug("AppOpen Sync Listener - ", forData: accountData) - syncManager.setSyncListener() - } - - @objc public func fetchCards( - _ accountData: [String: Any], - completionHandler: @escaping ([String: Any]) -> Void - ) { - guard - let identifier = MoEngagePluginUtils.fetchIdentifierFromPayload( - attribute: accountData - ) - else { - logAppIdentifierFetchFailed(for: accountData) - return - } - MoEngagePluginCardsLogger.debug("Fetch Cards - ", forData: accountData) - handler.fetchCards(forAppID: identifier) { data in - let result = MoEngagePluginCardsUtil.buildHybridPayload( - forIdentifier: identifier, - containingData: data?.encodeForHybrid() ?? [:] - ) - MoEngagePluginCardsLogger.debug("Fetch Cards response - ", forData: result) - completionHandler(result) - } - } - - @objc public func onCardsSectionUnLoaded(_ accountData: [String: Any]) { - guard - let identifier = MoEngagePluginUtils.fetchIdentifierFromPayload( - attribute: accountData - ) - else { - logAppIdentifierFetchFailed(for: accountData) - return - } - MoEngagePluginCardsLogger.debug("Card Section Unloaded - ", forData: accountData) - self.handler.cardsViewControllerDismissed(forAppID: identifier) - } - - @objc public func cardClicked(_ cardData: [String: Any]) { - guard - let identifier = MoEngagePluginUtils.fetchIdentifierFromPayload( - attribute: cardData - ) - else { - logAppIdentifierFetchFailed(for: cardData) - return - } - - MoEngagePluginCardsLogger.debug("Card Clicked - ", forData: cardData) - do { - let clickData: [String: Any] = try MoEngagePluginCardsUtil.getData(fromHybridPayload: cardData) - let cardClick = try MoEngageCardClickData.decodeFromHybrid(clickData) - if let widgetId = cardClick.widgetId { - self.handler.cardClicked( - cardClick.card, withWidgetID: widgetId, - forAppID: identifier - ) - } else { - self.handler.cardClicked(cardClick.card, forAppID: identifier) - } - } catch { - MoEngagePluginCardsLogger.error("\(error)") - return - } - } - - @objc public func cardDelivered(_ accountData: [String: Any]) { - guard - let identifier = MoEngagePluginUtils.fetchIdentifierFromPayload( - attribute: accountData - ) - else { - logAppIdentifierFetchFailed(for: accountData) - return - } - - MoEngagePluginCardsLogger.debug("Card Delivered - ", forData: accountData) - self.handler.cardDelivered(forAppID: identifier) - } - - @objc public func cardShown(_ cardData: [String: Any]) { - guard - let identifier = MoEngagePluginUtils.fetchIdentifierFromPayload( - attribute: cardData - ) - else { - logAppIdentifierFetchFailed(for: cardData) - return - } - MoEngagePluginCardsLogger.debug("Cards Shown ", forData: cardData) - do { - let showData: [String: Any] = try MoEngagePluginCardsUtil.getNestedData( - fromHybridPayload: cardData, - forKey: MoEngagePluginCardsContants.card - ) - let card = try MoEngageHybridSDKCards.buildCardCampaign(fromHybridData: showData) - self.handler.cardShown(card, forAppID: identifier) - } catch { - MoEngagePluginCardsLogger.error("\(error)") - return - } - } - - @objc public func deleteCards(_ cardsData: [String: Any]) { - guard - let identifier = MoEngagePluginUtils.fetchIdentifierFromPayload( - attribute: cardsData - ) - else { - logAppIdentifierFetchFailed(for: cardsData) - return - } - MoEngagePluginCardsLogger.debug("Delete Cards - ", forData: cardsData) - do { - let cardsData: [[String: Any]] = try MoEngagePluginCardsUtil.getNestedData( - fromHybridPayload: cardsData, - forKey: MoEngagePluginCardsContants.cards - ) - let cards = cardsData.decodeFromHybrid() - self.handler.deleteCards(cards, forAppID: identifier) { _, _ in } - } catch { - MoEngagePluginCardsLogger.error("\(error)") - return - } - } - - @objc public func getCardsInfo( - _ accountData: [String: Any], - completionHandler: @escaping ([String: Any]) -> Void - ) { - guard - let identifier = MoEngagePluginUtils.fetchIdentifierFromPayload( - attribute: accountData - ) - else { - logAppIdentifierFetchFailed(for: accountData) - return - } - MoEngagePluginCardsLogger.debug("Get Cards Info - ", forData: accountData) - self.handler.getCardsData( - forAppID: identifier - ) { cardsData, accountMeta in - let result = MoEngagePluginCardsUtil.buildHybridPayload( - forIdentifier: identifier, - containingData: cardsData?.encodeForHybrid() as Any - ) - MoEngagePluginCardsLogger.debug("Get Cards Info response - ", forData: result) - completionHandler(result) - } - } - - @objc public func getCardsCategories( - _ accountData: [String: Any], - completionHandler: @escaping ([String: Any]) -> Void - ) { - guard - let identifier = MoEngagePluginUtils.fetchIdentifierFromPayload( - attribute: accountData - ) - else { - logAppIdentifierFetchFailed(for: accountData) - return - } - - MoEngagePluginCardsLogger.debug("Get Cards Categories - ", forData: accountData) - - self.handler.getCardsCategories(forAppID: identifier) { categories, accountMeta in - let result = MoEngagePluginCardsUtil.buildHybridPayload( - forIdentifier: identifier, - containingData: [ - MoEngagePluginCardsContants.categories: categories - ] - ) - MoEngagePluginCardsLogger.debug("Get Cards Categories response - ", forData: result) - completionHandler(result) - } - } - - @objc public func getCardsForCategory( - _ categoryData: [String: Any], - completionHandler: @escaping ([String: Any]) -> Void - ) { - guard - let identifier = MoEngagePluginUtils.fetchIdentifierFromPayload( - attribute: categoryData - ) - else { - logAppIdentifierFetchFailed(for: categoryData) - return - } - MoEngagePluginCardsLogger.debug("Get Cards for Category - ", forData: categoryData) - do { - let categoryData: [String: Any] = try MoEngagePluginCardsUtil.getData(fromHybridPayload: categoryData) - let cardsCategory = try MoEngageCardsCategoryData.decodeFromHybrid(categoryData) - - self.handler.getCardData( - for: cardsCategory.category, - appID: identifier - ) { data in - var containingData: [String: Any] = [MoEngagePluginCardsContants.category: cardsCategory.category] - if let data = data?.encodeForHybrid() as? [String: Any] { - containingData.merge(data) { _, new in new } - } - let result = MoEngagePluginCardsUtil.buildHybridPayload( - forIdentifier: identifier, - containingData: containingData - ) - MoEngagePluginCardsLogger.debug("Get Cards for Category response - ", forData: result) - completionHandler(result) - } - } catch { - MoEngagePluginCardsLogger.error("\(error)") - let result = MoEngagePluginCardsUtil.buildHybridPayload( - forIdentifier: identifier, - containingData: [:] as [String: Any] - ) - completionHandler(result) - return - } - } - - @objc public func isAllCategoryEnabled( - _ accountData: [String: Any], - completionHandler: @escaping ([String: Any]) -> Void - ) { - guard - let identifier = MoEngagePluginUtils.fetchIdentifierFromPayload( - attribute: accountData - ) - else { - logAppIdentifierFetchFailed(for: accountData) - return - } - MoEngagePluginCardsLogger.debug("All Categories Enabled - ", forData: accountData) - - self.handler.isAllCategoryEnabled(forAppID: identifier) { isEnabled in - let result = MoEngagePluginCardsUtil.buildHybridPayload( - forIdentifier: identifier, - containingData: [ - MoEngagePluginCardsContants.isAllCategoryEnabled: isEnabled - ] - ) - - MoEngagePluginCardsLogger.debug("All Categories Enabled response - ", forData: result) - completionHandler(result) - } - } - - @objc public func getNewCardsCount( - _ accountData: [String: Any], - completionHandler: @escaping ([String: Any]) -> Void - ) { - guard - let identifier = MoEngagePluginUtils.fetchIdentifierFromPayload( - attribute: accountData - ) - else { - logAppIdentifierFetchFailed(for: accountData) - return - } - MoEngagePluginCardsLogger.debug("Fetch New Cards Count - ", forData: accountData) - - self.handler.getNewCardsCount(forAppID: identifier) { count, accountMeta in - let result = MoEngagePluginCardsUtil.buildHybridPayload( - forIdentifier: identifier, - containingData: [ - MoEngagePluginCardsContants.newCardsCount: count - ] - ) - MoEngagePluginCardsLogger.debug("Fetch New Cards Count response - ", forData: result) - completionHandler(result) - } - } - - @objc public func getUnClickedCardsCount( - _ accountData: [String: Any], - completionHandler: @escaping ([String: Any]) -> Void - ) { - guard - let identifier = MoEngagePluginUtils.fetchIdentifierFromPayload( - attribute: accountData - ) - else { - logAppIdentifierFetchFailed(for: accountData) - return - } - - MoEngagePluginCardsLogger.debug("Fetch Unclicked Cards Count - ", forData: accountData) - - self.handler.getUnclickedCardsCount(forAppID: identifier) { count, accountMeta in - let result = MoEngagePluginCardsUtil.buildHybridPayload( - forIdentifier: identifier, - containingData: [ - MoEngagePluginCardsContants.unClickedCardsCount: count - ] - ) - MoEngagePluginCardsLogger.debug("Fetch Unclicked Cards Count response - ", forData: result) - completionHandler(result) - } - } -} - -protocol MoEngagePluginCardsBridgeHandler { - func onAppOpenSync( - forAppID appID: String?, - withCompletion completionBlock: ((_ data: MoEngageCardSyncCompleteData?) -> Void)? - ) - - func onCardSectionLoaded( - forAppID appID: String?, - withCompletion completionBlock: ((_ data: MoEngageCardSyncCompleteData?) -> Void)? - ) - - func refreshCards( - forAppID appID: String?, - withCompletion completionBlock: ((_ data: MoEngageCardSyncCompleteData?) -> Void)? - ) - - func fetchCards( - forAppID appID: String?, - withCompletion completionBlock: ((_ data: MoEngageCardData?) -> Void)? - ) - - func getCardsData( - forAppID appID: String?, - withCompletionBlock completionBlock: @escaping ((_ cardsData: MoEngageCardsData?, _ accountMeta: MoEngageAccountMeta?) -> Void) - ) - - func getCardsCategories( - forAppID appID: String?, - withCompletionBlock completionBlock: - @escaping ((_ categories: [String], _ accountMeta: MoEngageAccountMeta?) -> ()) - ) - - func getCardData(for category: String, - appID: String?, - completionBlock: @escaping (MoEngageCardData?) -> Void) - - func isAllCategoryEnabled( - forAppID appID: String?, - withCompletionBlock completionBlock: @escaping ((Bool) -> Void) - ) - - func cardShown(_ card: MoEngageCardCampaign, forAppID appID: String?) - - func cardClicked(_ card: MoEngageCardCampaign, forAppID appID: String?) - func cardClicked(_ card: MoEngageCardCampaign, withWidgetID widgetID: Int, forAppID appID: String?) - - func cardDelivered(forAppID appID: String?) - - func deleteCards( - _ cardsArr: [MoEngageCardCampaign], - forAppID appID: String?, - andCompletionBlock completionBlock: - @escaping ((_ isDeleted: Bool, _ accountMeta: MoEngageAccountMeta?) -> ()) - ) - - func cardsViewControllerDismissed(forAppID appID: String?) - - func getNewCardsCount( - forAppID appID: String?, - withCompletionBlock completionBlock: - @escaping ((_ count: Int, _ accountMeta: MoEngageAccountMeta?) -> Void) - ) - - - func getUnclickedCardsCount( - forAppID appID: String?, - withCompletionBlock completionBlock: - @escaping ((_ count: Int, _ accountMeta: MoEngageAccountMeta?) -> Void) - ) - - func getClickedCardsCount( - forAppID appID: String?, - withCompletionBlock completionBlock: - @escaping ((_ count: Int, _ accountMeta: MoEngageAccountMeta?) -> Void) - ) -} - -extension MoEngageSDKCards: MoEngagePluginCardsBridgeHandler {} diff --git a/MoEngagePluginGeofence.podspec b/MoEngagePluginGeofence.podspec deleted file mode 100644 index 655b8d7..0000000 --- a/MoEngagePluginGeofence.podspec +++ /dev/null @@ -1,13 +0,0 @@ -Pod::Spec.new do |s| - require_relative 'Utilities/spec' - s.extend MoEngagePluginSDK::Spec - s.define - - s.summary = 'MoEngage Plugin Base for Hybrid SDKs' - s.description = <<-DESC - MoEngage is a mobile marketing automation company. This framework is used by our plugins built for different hybrid frameworks i.e, Flutter, Cordova, React Native etc. - DESC - - s.frameworks = 'UIKit', 'Foundation', 'UserNotifications' - s.dependency 'MoEngage-iOS-SDK/GeoFence' -end diff --git a/MoEngagePluginGeofence/CHANGELOG.md b/MoEngagePluginGeofence/CHANGELOG.md deleted file mode 100644 index 688e38c..0000000 --- a/MoEngagePluginGeofence/CHANGELOG.md +++ /dev/null @@ -1,61 +0,0 @@ -# 17-10-2025 - -## 4.6.1 - -- Updated MoEngage-iOS-SDK to 10.07.2 - -# 13-10-2025 - -## 4.6.0 - -- Updated MoEngage-iOS-SDK to 10.07.1 - -# 22-09-2025 - -## 4.5.0 - -- Updated MoEngage-iOS-SDK to 10.06.0 - -# 08-09-2025 - -## 4.4.0 - -- Updated MoEngage-iOS-SDK to 10.05.0 - -# 08-09-2025 - -## 4.3.1 - -- Updated MoEngage-iOS-SDK to 10.04.2 - -# 05-08-2025 - -## 4.3.0 - -- Updated MoEngage-iOS-SDK to 10.04.0 - -# 05-08-2025 - -## 4.2.3 - -- Updated MoEngage-iOS-SDK to 10.03.3 - -# 25-07-2025 - -## 4.2.2 - -- Updated MoEngage-iOS-SDK to 10.03.2 - -# 16-07-2025 - -## 4.2.1 - -- Updated MoEngage-iOS-SDK to 10.03.1 - -# 15-07-2025 - -## 4.2.0 - -- Updated MoEngage-iOS-SDK to 10.03.0 -- Added automated version and changelog update -- Added support for file based initialization diff --git a/MoEngagePluginGeofence/MoEngagePluginGeofenceBridge.swift b/MoEngagePluginGeofence/MoEngagePluginGeofenceBridge.swift deleted file mode 100644 index d1aca40..0000000 --- a/MoEngagePluginGeofence/MoEngagePluginGeofenceBridge.swift +++ /dev/null @@ -1,29 +0,0 @@ -// -// MoEngagePluginGeofenceBridge.swift -// MoEngageGeofencePlugin -// -// Created by Rakshitha on 23/06/22. -// - -import Foundation -import MoEngageGeofence -import MoEngagePluginBase - -@objc final public class MoEngagePluginGeofenceBridge: NSObject { - - @objc public static let sharedInstance = MoEngagePluginGeofenceBridge() - - private override init() { - super.init() - } - - @objc public func startGeofenceMonitoring(_ payload: [String: Any]) { - let identifier = MoEngagePluginUtils.fetchIdentifierFromPayload(attribute: payload) - MoEngageSDKGeofence.sharedInstance.startGeofenceMonitoring(forAppID: identifier) - } - - @objc public func stopGeofenceMonitoring(_ payload: [String: Any]) { - let identifier = MoEngagePluginUtils.fetchIdentifierFromPayload(attribute: payload) - MoEngageSDKGeofence.sharedInstance.stopGeofenceMonitoring(forAppID: identifier) - } -} diff --git a/MoEngagePluginInbox.podspec b/MoEngagePluginInbox.podspec deleted file mode 100644 index 7532c74..0000000 --- a/MoEngagePluginInbox.podspec +++ /dev/null @@ -1,13 +0,0 @@ -Pod::Spec.new do |s| - require_relative 'Utilities/spec' - s.extend MoEngagePluginSDK::Spec - s.define - - s.summary = 'MoEngage Plugin Base for Hybrid SDKs' - s.description = <<-DESC - MoEngage is a mobile marketing automation company. This framework is used by our plugins built for different hybrid frameworks i.e, Flutter, Cordova, React Native etc. - DESC - - s.frameworks = 'UIKit', 'Foundation', 'UserNotifications' - s.dependency 'MoEngage-iOS-SDK/Inbox' -end diff --git a/MoEngagePluginInbox/CHANGELOG.md b/MoEngagePluginInbox/CHANGELOG.md deleted file mode 100644 index 688e38c..0000000 --- a/MoEngagePluginInbox/CHANGELOG.md +++ /dev/null @@ -1,61 +0,0 @@ -# 17-10-2025 - -## 4.6.1 - -- Updated MoEngage-iOS-SDK to 10.07.2 - -# 13-10-2025 - -## 4.6.0 - -- Updated MoEngage-iOS-SDK to 10.07.1 - -# 22-09-2025 - -## 4.5.0 - -- Updated MoEngage-iOS-SDK to 10.06.0 - -# 08-09-2025 - -## 4.4.0 - -- Updated MoEngage-iOS-SDK to 10.05.0 - -# 08-09-2025 - -## 4.3.1 - -- Updated MoEngage-iOS-SDK to 10.04.2 - -# 05-08-2025 - -## 4.3.0 - -- Updated MoEngage-iOS-SDK to 10.04.0 - -# 05-08-2025 - -## 4.2.3 - -- Updated MoEngage-iOS-SDK to 10.03.3 - -# 25-07-2025 - -## 4.2.2 - -- Updated MoEngage-iOS-SDK to 10.03.2 - -# 16-07-2025 - -## 4.2.1 - -- Updated MoEngage-iOS-SDK to 10.03.1 - -# 15-07-2025 - -## 4.2.0 - -- Updated MoEngage-iOS-SDK to 10.03.0 -- Added automated version and changelog update -- Added support for file based initialization diff --git a/MoEngagePluginInbox/MoEngagePluginInboxBridge.swift b/MoEngagePluginInbox/MoEngagePluginInboxBridge.swift deleted file mode 100644 index d4a4c35..0000000 --- a/MoEngagePluginInbox/MoEngagePluginInboxBridge.swift +++ /dev/null @@ -1,52 +0,0 @@ -// -// MoEngagePluginInboxBridge.swift -// MoEngagePluginInbox -// -// Created by Rakshitha on 27/06/22. -// - -import Foundation -import MoEngageInbox -import MoEngagePluginBase - -@objc final public class MoEngagePluginInboxBridge: NSObject { - @objc public static let sharedInstance = MoEngagePluginInboxBridge() - - private override init() { - } - - @objc public func getInboxMessages(_ inboxDict: [String: Any], completionHandler: @escaping(([String: Any]) -> Void)) { - guard let identifier = MoEngagePluginUtils.fetchIdentifierFromPayload(attribute: inboxDict) else { return } - MoEngageSDKInbox.sharedInstance.getInboxMessages(forAppID: identifier) { [weak self] inboxMessages, _ in - let payload = MoEngagePluginInboxUtils.inboxEntryToJSON(inboxMessages: inboxMessages, identifier: identifier) - completionHandler(payload) - } - - } - - @objc public func trackInboxClick(_ inboxDict: [String: Any]) { - guard let identifier = MoEngagePluginUtils.fetchIdentifierFromPayload(attribute: inboxDict), - let campaignID = MoEngagePluginInboxUtils.fetchCampaignIdFromPayload(inboxDict: inboxDict) - else { return } - - MoEngageSDKInbox.sharedInstance.trackInboxClick(withCampaignID: campaignID, forAppID: identifier) - } - - @objc public func deleteInboxEntry(_ inboxDict: [String: Any]) { - guard let identifier = MoEngagePluginUtils.fetchIdentifierFromPayload(attribute: inboxDict), - let campaignID = MoEngagePluginInboxUtils.fetchCampaignIdFromPayload(inboxDict: inboxDict) - else { return } - - MoEngageSDKInbox.sharedInstance.removeInboxMessage(withCampaignID: campaignID, forAppID: identifier) - } - - @objc public func getUnreadMessageCount(_ inboxDict: [String: Any], completionHandler: @escaping(([String: Any]) -> Void)) { - - guard let identifier = MoEngagePluginUtils.fetchIdentifierFromPayload(attribute: inboxDict) else { return } - - MoEngageSDKInbox.sharedInstance.getUnreadNotificationCount(forAppID: identifier) { [weak self] count, _ in - let payload = MoEngagePluginInboxUtils.createUnreadCountPayload(count: count, identifier: identifier) - completionHandler(payload) - } - } -} diff --git a/MoEngagePluginInbox/MoEngagePluginInboxConstants.swift b/MoEngagePluginInbox/MoEngagePluginInboxConstants.swift deleted file mode 100644 index 42fd654..0000000 --- a/MoEngagePluginInbox/MoEngagePluginInboxConstants.swift +++ /dev/null @@ -1,38 +0,0 @@ -// -// MoEngagePluginInboxConstants.swift -// MoEngagePluginInbox -// -// Created by Rakshitha on 09/09/22. -// - -import Foundation - - -struct MoEngagePluginInboxConstants { - struct Inbox { - static let unClickedCount = "unClickedCount" - static let title = "title" - static let subtitle = "subtitle" - static let message = "message" - static let text = "text" - static let type = "type" - static let url = "url" - static let media = "media" - static let isClicked = "isClicked" - static let receivedTime = "receivedTime" - static let expiry = "expiry" - static let action = "action" - static let messages = "messages" - static let moengage = "moengage" - static let mediaType = "media-type" - static let deepLink = "deepLink" - static let richLanding = "richLanding" - static let screenName = "screenName" - static let groupKey = "groupKey" - static let notificationId = "notificationId" - static let sentTime = "sentTime" - static let accessibility = "accessibility" - static let accessibilityText = "text" - static let accessibilityHint = "hint" - } -} diff --git a/MoEngagePluginInbox/MoEngagePluginInboxUtils.swift b/MoEngagePluginInbox/MoEngagePluginInboxUtils.swift deleted file mode 100644 index e10af0b..0000000 --- a/MoEngagePluginInbox/MoEngagePluginInboxUtils.swift +++ /dev/null @@ -1,129 +0,0 @@ -// -// MoEngagePluginInboxUtils.swift -// MoEPluginInbox -// -// Created by Rakshitha on 11/07/22. -// - -import Foundation -import MoEngageInbox -import MoEngagePluginBase -import MoEngageSDK - -class MoEngagePluginInboxUtils { - - static func inboxEntryToJSON(inboxMessages: [MoEngageInboxEntry], identifier: String) -> [String: Any] { - let accountMeta = MoEngagePluginUtils.createAccountPayload(identifier: identifier) - var messages = [[String: Any]]() - - for inboxMessage in inboxMessages { - var message = [String: Any]() - - message[MoEngagePluginConstants.General.campaignId] = inboxMessage.campaignID - message[MoEngagePluginInboxConstants.Inbox.text] = createTextPayload(inboxMessage: inboxMessage) - message[MoEngagePluginInboxConstants.Inbox.isClicked] = inboxMessage.isRead - message[MoEngagePluginInboxConstants.Inbox.receivedTime] = MoEngageDateUtils.getString(forDate: inboxMessage.receivedDate, withFormat: MoEngageCoreConstants.DateTimeFormats.iso8601, andForGMTTimeZone: true) - message[MoEngagePluginInboxConstants.Inbox.expiry] = MoEngageDateUtils.getString(forDate: inboxMessage.inboxExpiryDate, withFormat:MoEngageCoreConstants.DateTimeFormats.iso8601, andForGMTTimeZone: true) - message[MoEngagePluginConstants.General.payload] = inboxMessage.notificationPayloadDict - message[MoEngagePluginInboxConstants.Inbox.action] = MoEngagePluginInboxUtils.createActionPayload(inboxMessage: inboxMessage) - - if let mediaPayload = createMediaPayload(inboxMessage: inboxMessage) { - message[MoEngagePluginInboxConstants.Inbox.media] = mediaPayload - } - message[MoEngagePluginInboxConstants.Inbox.groupKey] = inboxMessage.groupKey - message[MoEngagePluginInboxConstants.Inbox.notificationId] = inboxMessage.collapseId - message[MoEngagePluginInboxConstants.Inbox.sentTime] = MoEngageDateUtils.getString(forDate: inboxMessage.sentTime, withFormat:MoEngageCoreConstants.DateTimeFormats.iso8601, andForGMTTimeZone: true) - messages.append(message) - } - - let data = [MoEngagePluginConstants.General.platform: MoEngagePluginConstants.General.iOS, MoEngagePluginInboxConstants.Inbox.messages: messages] as [String: Any] - return [MoEngagePluginConstants.General.accountMeta: accountMeta, MoEngagePluginConstants.General.data: data] - } - - static func createTextPayload(inboxMessage: MoEngageInboxEntry) -> [String: Any] { - var textPayload = [String: Any]() - - textPayload[MoEngagePluginInboxConstants.Inbox.title] = inboxMessage.notificationTitle - textPayload[MoEngagePluginInboxConstants.Inbox.subtitle] = inboxMessage.notificationSubTitle - textPayload[MoEngagePluginInboxConstants.Inbox.message] = inboxMessage.notificationBody - - return textPayload - } - - static func createMediaPayload(inboxMessage: MoEngageInboxEntry) -> [String: Any]? { - if let url = inboxMessage.notificationMediaURL, - let type = inboxMessage.moengageDict[ MoEngagePluginInboxConstants.Inbox.mediaType] { - var mediaPayload = [String: Any]() - mediaPayload[MoEngagePluginInboxConstants.Inbox.type] = type - mediaPayload[MoEngagePluginInboxConstants.Inbox.url] = url - mediaPayload[MoEngagePluginInboxConstants.Inbox.accessibility] = createAccessibilityPayload(for: inboxMessage) - return mediaPayload - } - - return nil - } - - static func createAccessibilityPayload(for inboxMessage: MoEngageInboxEntry) -> [String: Any]? { - var payload = [String: Any]() - if let accessibilityData = inboxMessage.accessibilityData { - payload[MoEngagePluginInboxConstants.Inbox.accessibilityText] = accessibilityData.label - payload[MoEngagePluginInboxConstants.Inbox.accessibilityHint] = accessibilityData.hint - } - return payload - } - - static func createActionPayload(inboxMessage: MoEngageInboxEntry) -> [[String: Any]] { - var actionDict = [[String: Any]]() - - if let deepLinkURL = inboxMessage.deepLinkURL, !deepLinkURL.isEmpty { - var deepLinkAction = [String: Any]() - - deepLinkAction[MoEngagePluginConstants.General.actionType] = MoEngagePluginConstants.General.navigation - deepLinkAction[MoEngagePluginConstants.General.navigationType] = MoEngagePluginInboxConstants.Inbox.deepLink - deepLinkAction[MoEngagePluginConstants.General.value] = deepLinkURL - deepLinkAction[MoEngagePluginConstants.General.kvPair] = inboxMessage.screenDataDict - - actionDict.append(deepLinkAction) - } - - if let richLandingURL = inboxMessage.richLandingURL, !richLandingURL.isEmpty { - var richLandingAction = [String: Any]() - - richLandingAction[MoEngagePluginConstants.General.actionType] = MoEngagePluginConstants.General.navigation - richLandingAction[MoEngagePluginConstants.General.navigationType] = MoEngagePluginInboxConstants.Inbox.richLanding - richLandingAction[MoEngagePluginConstants.General.value] = richLandingURL - richLandingAction[MoEngagePluginConstants.General.kvPair] = inboxMessage.screenDataDict - - actionDict.append(richLandingAction) - } - - if let screenName = inboxMessage.screenName, !screenName.isEmpty { - var navigateToScreenAction = [String: Any]() - - navigateToScreenAction[MoEngagePluginConstants.General.actionType] = MoEngagePluginConstants.General.navigation - navigateToScreenAction[MoEngagePluginConstants.General.navigationType] = MoEngagePluginInboxConstants.Inbox.screenName - navigateToScreenAction[MoEngagePluginConstants.General.value] = screenName - navigateToScreenAction[MoEngagePluginConstants.General.kvPair] = inboxMessage.screenDataDict - - actionDict.append(navigateToScreenAction) - } - - return actionDict - } - - static func createUnreadCountPayload(count: Int, identifier: String) -> [String: Any] { - let accountMeta = MoEngagePluginUtils.createAccountPayload(identifier: identifier) - let data = [MoEngagePluginInboxConstants.Inbox.unClickedCount: count] - return [MoEngagePluginConstants.General.accountMeta: accountMeta, MoEngagePluginConstants.General.data: data] - } - - static func fetchCampaignIdFromPayload(inboxDict: [String: Any]) -> String? { - if let data = inboxDict[MoEngagePluginConstants.General.data] as? [String: Any], - let campaignID = data[MoEngagePluginConstants.General.campaignId] as? String, - !campaignID.isEmpty { - return campaignID - } - - return nil - } -} diff --git a/MoEngageSegmentPluginBase/Example/.gitignore b/MoEngageSegmentPluginBase/Example/.gitignore deleted file mode 100644 index b2f88e8..0000000 --- a/MoEngageSegmentPluginBase/Example/.gitignore +++ /dev/null @@ -1,68 +0,0 @@ -# Xcode -# -# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore - -## User settings -xcuserdata/ - -## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9) -*.xcscmblueprint -*.xccheckout - -## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4) -build/ -DerivedData/ -*.moved-aside -*.pbxuser -!default.pbxuser -*.mode1v3 -!default.mode1v3 -*.mode2v3 -!default.mode2v3 -*.perspectivev3 -!default.perspectivev3 - -## Obj-C/Swift specific -*.hmap - -## App packaging -*.ipa -*.dSYM.zip -*.dSYM - -# CocoaPods -# -# We recommend against adding the Pods directory to your .gitignore. However -# you should judge for yourself, the pros and cons are mentioned at: -# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control -# -Pods/ - -Add this line if you want to avoid checking in source code from the Xcode workspace -*.xcworkspace - -# Carthage -# -# Add this line if you want to avoid checking in source code from Carthage dependencies. -# Carthage/Checkouts - -Carthage/Build/ - -# fastlane -# -# It is recommended to not store the screenshots in the git repo. -# Instead, use fastlane to re-generate the screenshots whenever they are needed. -# For more information about the recommended setup visit: -# https://docs.fastlane.tools/best-practices/source-control/#source-control - -fastlane/report.xml -fastlane/Preview.html -fastlane/screenshots/**/*.png -fastlane/test_output - -# Code Injection -# -# After new code Injection tools there's a generated folder /iOSInjectionProject -# https://github.com/johnno1962/injectionforxcode - -iOSInjectionProject/ \ No newline at end of file diff --git a/MoEngageSegmentPluginBase/Example/MoEPluginBaseExample.xcodeproj/xcshareddata/xcschemes/MoEPluginBaseExample.xcscheme b/MoEngageSegmentPluginBase/Example/MoEPluginBaseExample.xcodeproj/xcshareddata/xcschemes/MoEPluginBaseExample.xcscheme deleted file mode 100644 index 12397f9..0000000 --- a/MoEngageSegmentPluginBase/Example/MoEPluginBaseExample.xcodeproj/xcshareddata/xcschemes/MoEPluginBaseExample.xcscheme +++ /dev/null @@ -1,78 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/MoEngageSegmentPluginBase/Example/MoEPluginBaseExample/en.lproj/InfoPlist.strings b/MoEngageSegmentPluginBase/Example/MoEPluginBaseExample/en.lproj/InfoPlist.strings deleted file mode 100644 index 477b28f..0000000 --- a/MoEngageSegmentPluginBase/Example/MoEPluginBaseExample/en.lproj/InfoPlist.strings +++ /dev/null @@ -1,2 +0,0 @@ -/* Localized versions of Info.plist keys */ - diff --git a/MoEngageSegmentPluginBase/Example/Podfile.lock b/MoEngageSegmentPluginBase/Example/Podfile.lock deleted file mode 100644 index e5594fd..0000000 --- a/MoEngageSegmentPluginBase/Example/Podfile.lock +++ /dev/null @@ -1,23 +0,0 @@ -PODS: - - MoEngage-iOS-SDK (9.10.0) - - MoEngageSegmentPluginBase (1.1.0): - - MoEngage-iOS-SDK (< 9.11.0, >= 9.10.0) - -DEPENDENCIES: - - MoEngageSegmentPluginBase (from `../`) - -SPEC REPOS: - trunk: - - MoEngage-iOS-SDK - -EXTERNAL SOURCES: - MoEngageSegmentPluginBase: - :path: "../" - -SPEC CHECKSUMS: - MoEngage-iOS-SDK: 2271b9202dead49dd5c317aeb1a5cd8b450b435c - MoEngageSegmentPluginBase: af1176f02d539eb462d27e887701d7c646006897 - -PODFILE CHECKSUM: a2534b3ed7df244380f026169d9b2db67c5b9e54 - -COCOAPODS: 1.12.1 diff --git a/MoEngageSegmentPluginBase/Example/Tests/Tests-Info.plist b/MoEngageSegmentPluginBase/Example/Tests/Tests-Info.plist deleted file mode 100644 index 169b6f7..0000000 --- a/MoEngageSegmentPluginBase/Example/Tests/Tests-Info.plist +++ /dev/null @@ -1,22 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - ${EXECUTABLE_NAME} - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundlePackageType - BNDL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1 - - diff --git a/MoEngageSegmentPluginBase/Example/Tests/Tests-Prefix.pch b/MoEngageSegmentPluginBase/Example/Tests/Tests-Prefix.pch deleted file mode 100644 index 0bfb741..0000000 --- a/MoEngageSegmentPluginBase/Example/Tests/Tests-Prefix.pch +++ /dev/null @@ -1,7 +0,0 @@ -// The contents of this file are implicitly included at the beginning of every test case source file. - -#ifdef __OBJC__ - - - -#endif diff --git a/MoEngageSegmentPluginBase/Example/Tests/Tests.m b/MoEngageSegmentPluginBase/Example/Tests/Tests.m deleted file mode 100644 index 01c3ae3..0000000 --- a/MoEngageSegmentPluginBase/Example/Tests/Tests.m +++ /dev/null @@ -1,35 +0,0 @@ -// -// MoEPluginBaseTests.m -// MoEPluginBaseTests -// -// Created by Chengappa C D on 09/08/2020. -// Copyright (c) 2020 Chengappa C D. All rights reserved. -// - -@import XCTest; - -@interface Tests : XCTestCase - -@end - -@implementation Tests - -- (void)setUp -{ - [super setUp]; - // Put setup code here. This method is called before the invocation of each test method in the class. -} - -- (void)tearDown -{ - // Put teardown code here. This method is called after the invocation of each test method in the class. - [super tearDown]; -} - -- (void)testExample -{ - XCTFail(@"No implementation for \"%s\"", __PRETTY_FUNCTION__); -} - -@end - diff --git a/MoEngageSegmentPluginBase/Example/Tests/en.lproj/InfoPlist.strings b/MoEngageSegmentPluginBase/Example/Tests/en.lproj/InfoPlist.strings deleted file mode 100644 index 477b28f..0000000 --- a/MoEngageSegmentPluginBase/Example/Tests/en.lproj/InfoPlist.strings +++ /dev/null @@ -1,2 +0,0 @@ -/* Localized versions of Info.plist keys */ - diff --git a/MoEngageSegmentPluginBase/MoEngageSegmentPluginBaseApp.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/MoEngageSegmentPluginBase/MoEngageSegmentPluginBaseApp.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist deleted file mode 100644 index 18d9810..0000000 --- a/MoEngageSegmentPluginBase/MoEngageSegmentPluginBaseApp.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +++ /dev/null @@ -1,8 +0,0 @@ - - - - - IDEDidComputeMac32BitWarning - - - diff --git a/MoEngageSegmentPluginBase/MoEngageSegmentPluginBaseApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/MoEngageSegmentPluginBase/MoEngageSegmentPluginBaseApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved deleted file mode 100644 index 20082d3..0000000 --- a/MoEngageSegmentPluginBase/MoEngageSegmentPluginBaseApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ /dev/null @@ -1,14 +0,0 @@ -{ - "pins" : [ - { - "identity" : "moengage-ios-sdk", - "kind" : "remoteSourceControl", - "location" : "https://github.com/moengage/MoEngage-iOS-SDK.git", - "state" : { - "branch" : "master", - "revision" : "28cc550330ba254a14cfa2f73596a584b6fa337c" - } - } - ], - "version" : 2 -} diff --git a/Package.swift b/Package.swift new file mode 100644 index 0000000..72c9129 --- /dev/null +++ b/Package.swift @@ -0,0 +1,42 @@ +// swift-tools-version:5.7 +// The swift-tools-version declares the minimum version of Swift required to build this package. + +import PackageDescription + +let package = Package( + name: "iOS-PluginBase", + platforms: [ + .iOS(.v13), + .tvOS(.v13) + ], + products: [ + // Products define the executables and libraries a package produces, and make them visible to other packages. + .library(name: "MoEngagePluginBase", targets: ["MoEngagePluginBase"]), + ], + dependencies: [ + // Dependencies declare other packages that this package depends on. + .package(url: "https://github.com/moengage/apple-sdk.git", exact: "10.07.2") + ], + targets: [ + // Targets are the basic building blocks of a package. A target can define a module or a test suite. + // Targets can depend on other targets in this package, and on products in packages this package depends on. + + .target( + name: "MoEngagePluginBase", + dependencies: [ + .product(name: "MoEngage-iOS-SDK", package: "apple-sdk"), + .product(name: "MoEngageInApps", package: "apple-sdk") + ], + linkerSettings: [ + .linkedFramework("UIKit"), + .linkedFramework("Foundation"), + .linkedFramework("UserNotifications") + ] + ), + .testTarget( + name: "MoEngagePluginBaseTests", + dependencies: ["MoEngagePluginBase"] + ) + ], + swiftLanguageVersions: [.v5] +) diff --git a/README.md b/README.md index a33482c..c197340 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,7 @@ # iOS-PluginBase -Plugin Base module used to support iOS platform in all Hybrid framework plugins. +Plugin Base module used to support iOS platform in all Hybrid framework plugins. ## Installation -MoEngagePluginBase is available through [CocoaPods](https://cocoapods.org). To install -it, simply add the following line to your Podfile: - -```ruby -pod 'MoEngagePluginBase' -``` - +This library is used in MoEngage hybrid plugins, not intended for direct use. diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..57cf327 --- /dev/null +++ b/Rakefile @@ -0,0 +1,39 @@ +require 'fileutils' +require 'optparse' +require 'ostruct' + +module MoEngagePluginSDK + EXAMPLES = 'Examples' + WORKSPACE = File.join(EXAMPLES, 'MoEngagePluginBase.xcworkspace') + LOCK = File.join(EXAMPLES, 'Podfile.lock') + TUIST = File.join(`brew --prefix`.strip, 'bin', 'tuist') +end + +file MoEngagePluginSDK::TUIST do + system('brew install --formula tuist@4.61.1 --force', out: STDOUT, exception: true) +end + +directory MoEngagePluginSDK::WORKSPACE +file MoEngagePluginSDK::WORKSPACE => MoEngagePluginSDK::TUIST do + Dir.chdir(MoEngagePluginSDK::EXAMPLES) do + system('tuist generate --no-open', out: STDOUT, exception: true) + end +end + +file MoEngagePluginSDK::LOCK => [MoEngagePluginSDK::WORKSPACE] do + Dir.chdir(MoEngagePluginSDK::EXAMPLES) do + system('pod install', out: STDOUT, exception: true) + end +end + +desc <<~DESC + Setup project for running +DESC +task :setup => [MoEngagePluginSDK::TUIST] do |t| + FileUtils.rm(MoEngagePluginSDK::LOCK) if File.exist?(MoEngagePluginSDK::LOCK) + Dir.chdir(MoEngagePluginSDK::EXAMPLES) do + system('tuist install', out: STDOUT, exception: true) + system('tuist generate --no-open', out: STDOUT, exception: true) + system("pod install", out: STDOUT, exception: true) + end +end diff --git a/MoEngagePluginBase/MoEngageAnalyticsConfig.swift b/Sources/MoEngagePluginBase/MoEngageAnalyticsConfig.swift similarity index 100% rename from MoEngagePluginBase/MoEngageAnalyticsConfig.swift rename to Sources/MoEngagePluginBase/MoEngageAnalyticsConfig.swift diff --git a/MoEngagePluginBase/MoEngageInitConfig.swift b/Sources/MoEngagePluginBase/MoEngageInitConfig.swift similarity index 100% rename from MoEngagePluginBase/MoEngageInitConfig.swift rename to Sources/MoEngagePluginBase/MoEngageInitConfig.swift diff --git a/MoEngagePluginBase/MoEngageInitConfigCache.swift b/Sources/MoEngagePluginBase/MoEngageInitConfigCache.swift similarity index 100% rename from MoEngagePluginBase/MoEngageInitConfigCache.swift rename to Sources/MoEngagePluginBase/MoEngageInitConfigCache.swift diff --git a/MoEngagePluginBase/MoEngagePlugin.swift b/Sources/MoEngagePluginBase/MoEngagePlugin.swift similarity index 100% rename from MoEngagePluginBase/MoEngagePlugin.swift rename to Sources/MoEngagePluginBase/MoEngagePlugin.swift diff --git a/MoEngagePluginBase/MoEngagePluginBaseHandler.swift b/Sources/MoEngagePluginBase/MoEngagePluginBaseHandler.swift similarity index 100% rename from MoEngagePluginBase/MoEngagePluginBaseHandler.swift rename to Sources/MoEngagePluginBase/MoEngagePluginBaseHandler.swift diff --git a/MoEngagePluginBase/MoEngagePluginBaseProtocol.swift b/Sources/MoEngagePluginBase/MoEngagePluginBaseProtocol.swift similarity index 100% rename from MoEngagePluginBase/MoEngagePluginBaseProtocol.swift rename to Sources/MoEngagePluginBase/MoEngagePluginBaseProtocol.swift diff --git a/MoEngagePluginBase/MoEngagePluginBridge.swift b/Sources/MoEngagePluginBase/MoEngagePluginBridge.swift similarity index 100% rename from MoEngagePluginBase/MoEngagePluginBridge.swift rename to Sources/MoEngagePluginBase/MoEngagePluginBridge.swift diff --git a/MoEngagePluginBase/MoEngagePluginConstants.swift b/Sources/MoEngagePluginBase/MoEngagePluginConstants.swift similarity index 100% rename from MoEngagePluginBase/MoEngagePluginConstants.swift rename to Sources/MoEngagePluginBase/MoEngagePluginConstants.swift diff --git a/MoEngagePluginBase/MoEngagePluginInAppDelegateHandler.swift b/Sources/MoEngagePluginBase/MoEngagePluginInAppDelegateHandler.swift similarity index 100% rename from MoEngagePluginBase/MoEngagePluginInAppDelegateHandler.swift rename to Sources/MoEngagePluginBase/MoEngagePluginInAppDelegateHandler.swift diff --git a/MoEngagePluginBase/MoEngagePluginMessageDelegateHandler.swift b/Sources/MoEngagePluginBase/MoEngagePluginMessageDelegateHandler.swift similarity index 100% rename from MoEngagePluginBase/MoEngagePluginMessageDelegateHandler.swift rename to Sources/MoEngagePluginBase/MoEngagePluginMessageDelegateHandler.swift diff --git a/MoEngagePluginBase/MoEngagePluginMessageHandler.swift b/Sources/MoEngagePluginBase/MoEngagePluginMessageHandler.swift similarity index 100% rename from MoEngagePluginBase/MoEngagePluginMessageHandler.swift rename to Sources/MoEngagePluginBase/MoEngagePluginMessageHandler.swift diff --git a/MoEngagePluginBase/MoEngagePluginMessageInstanceProvider.swift b/Sources/MoEngagePluginBase/MoEngagePluginMessageInstanceProvider.swift similarity index 100% rename from MoEngagePluginBase/MoEngagePluginMessageInstanceProvider.swift rename to Sources/MoEngagePluginBase/MoEngagePluginMessageInstanceProvider.swift diff --git a/MoEngagePluginBase/MoEngagePluginMessageUtils.swift b/Sources/MoEngagePluginBase/MoEngagePluginMessageUtils.swift similarity index 100% rename from MoEngagePluginBase/MoEngagePluginMessageUtils.swift rename to Sources/MoEngagePluginBase/MoEngagePluginMessageUtils.swift diff --git a/MoEngagePluginBase/MoEngagePluginModels.swift b/Sources/MoEngagePluginBase/MoEngagePluginModels.swift similarity index 100% rename from MoEngagePluginBase/MoEngagePluginModels.swift rename to Sources/MoEngagePluginBase/MoEngagePluginModels.swift diff --git a/MoEngagePluginBase/MoEngagePluginParser.swift b/Sources/MoEngagePluginBase/MoEngagePluginParser.swift similarity index 100% rename from MoEngagePluginBase/MoEngagePluginParser.swift rename to Sources/MoEngagePluginBase/MoEngagePluginParser.swift diff --git a/MoEngagePluginBase/MoEngagePluginUtils.swift b/Sources/MoEngagePluginBase/MoEngagePluginUtils.swift similarity index 100% rename from MoEngagePluginBase/MoEngagePluginUtils.swift rename to Sources/MoEngagePluginBase/MoEngagePluginUtils.swift diff --git a/MoEngagePluginBase/MoEngageSDKDefaultInitializationConfig.swift b/Sources/MoEngagePluginBase/MoEngageSDKDefaultInitializationConfig.swift similarity index 100% rename from MoEngagePluginBase/MoEngageSDKDefaultInitializationConfig.swift rename to Sources/MoEngagePluginBase/MoEngageSDKDefaultInitializationConfig.swift diff --git a/MoEngagePluginBase/MoEngageSDKInitializationConfig.swift b/Sources/MoEngagePluginBase/MoEngageSDKInitializationConfig.swift similarity index 100% rename from MoEngagePluginBase/MoEngageSDKInitializationConfig.swift rename to Sources/MoEngagePluginBase/MoEngageSDKInitializationConfig.swift diff --git a/MoEngageSegmentPluginBase/CHANGELOG-old.md b/Sources/MoEngageSegmentPluginBase/CHANGELOG-old.md similarity index 100% rename from MoEngageSegmentPluginBase/CHANGELOG-old.md rename to Sources/MoEngageSegmentPluginBase/CHANGELOG-old.md diff --git a/Example/.gitignore b/Sources/MoEngageSegmentPluginBase/Example/.gitignore similarity index 100% rename from Example/.gitignore rename to Sources/MoEngageSegmentPluginBase/Example/.gitignore diff --git a/MoEngageSegmentPluginBase/Example/MoEPluginBaseExample.xcodeproj/project.pbxproj b/Sources/MoEngageSegmentPluginBase/Example/MoEPluginBaseExample.xcodeproj/project.pbxproj similarity index 100% rename from MoEngageSegmentPluginBase/Example/MoEPluginBaseExample.xcodeproj/project.pbxproj rename to Sources/MoEngageSegmentPluginBase/Example/MoEPluginBaseExample.xcodeproj/project.pbxproj diff --git a/Example/MoEPluginBaseExample.xcodeproj/xcshareddata/xcschemes/MoEPluginBaseExample.xcscheme b/Sources/MoEngageSegmentPluginBase/Example/MoEPluginBaseExample.xcodeproj/xcshareddata/xcschemes/MoEPluginBaseExample.xcscheme similarity index 100% rename from Example/MoEPluginBaseExample.xcodeproj/xcshareddata/xcschemes/MoEPluginBaseExample.xcscheme rename to Sources/MoEngageSegmentPluginBase/Example/MoEPluginBaseExample.xcodeproj/xcshareddata/xcschemes/MoEPluginBaseExample.xcscheme diff --git a/MoEngageSegmentPluginBase/Example/MoEPluginBaseExample/AppDelegate.h b/Sources/MoEngageSegmentPluginBase/Example/MoEPluginBaseExample/AppDelegate.h similarity index 100% rename from MoEngageSegmentPluginBase/Example/MoEPluginBaseExample/AppDelegate.h rename to Sources/MoEngageSegmentPluginBase/Example/MoEPluginBaseExample/AppDelegate.h diff --git a/MoEngageSegmentPluginBase/Example/MoEPluginBaseExample/AppDelegate.m b/Sources/MoEngageSegmentPluginBase/Example/MoEPluginBaseExample/AppDelegate.m similarity index 100% rename from MoEngageSegmentPluginBase/Example/MoEPluginBaseExample/AppDelegate.m rename to Sources/MoEngageSegmentPluginBase/Example/MoEPluginBaseExample/AppDelegate.m diff --git a/MoEngageSegmentPluginBase/Example/MoEPluginBaseExample/Base.lproj/LaunchScreen.storyboard b/Sources/MoEngageSegmentPluginBase/Example/MoEPluginBaseExample/Base.lproj/LaunchScreen.storyboard similarity index 100% rename from MoEngageSegmentPluginBase/Example/MoEPluginBaseExample/Base.lproj/LaunchScreen.storyboard rename to Sources/MoEngageSegmentPluginBase/Example/MoEPluginBaseExample/Base.lproj/LaunchScreen.storyboard diff --git a/MoEngageSegmentPluginBase/Example/MoEPluginBaseExample/Base.lproj/Main.storyboard b/Sources/MoEngageSegmentPluginBase/Example/MoEPluginBaseExample/Base.lproj/Main.storyboard similarity index 100% rename from MoEngageSegmentPluginBase/Example/MoEPluginBaseExample/Base.lproj/Main.storyboard rename to Sources/MoEngageSegmentPluginBase/Example/MoEPluginBaseExample/Base.lproj/Main.storyboard diff --git a/MoEngageSegmentPluginBase/Example/MoEPluginBaseExample/Images.xcassets/AppIcon.appiconset/Contents.json b/Sources/MoEngageSegmentPluginBase/Example/MoEPluginBaseExample/Images.xcassets/AppIcon.appiconset/Contents.json similarity index 100% rename from MoEngageSegmentPluginBase/Example/MoEPluginBaseExample/Images.xcassets/AppIcon.appiconset/Contents.json rename to Sources/MoEngageSegmentPluginBase/Example/MoEPluginBaseExample/Images.xcassets/AppIcon.appiconset/Contents.json diff --git a/MoEngageSegmentPluginBase/Example/MoEPluginBaseExample/MoEPluginBaseExample-Info.plist b/Sources/MoEngageSegmentPluginBase/Example/MoEPluginBaseExample/MoEPluginBaseExample-Info.plist similarity index 100% rename from MoEngageSegmentPluginBase/Example/MoEPluginBaseExample/MoEPluginBaseExample-Info.plist rename to Sources/MoEngageSegmentPluginBase/Example/MoEPluginBaseExample/MoEPluginBaseExample-Info.plist diff --git a/MoEngageSegmentPluginBase/Example/MoEPluginBaseExample/MoEPluginBaseExample.entitlements b/Sources/MoEngageSegmentPluginBase/Example/MoEPluginBaseExample/MoEPluginBaseExample.entitlements similarity index 100% rename from MoEngageSegmentPluginBase/Example/MoEPluginBaseExample/MoEPluginBaseExample.entitlements rename to Sources/MoEngageSegmentPluginBase/Example/MoEPluginBaseExample/MoEPluginBaseExample.entitlements diff --git a/MoEngageSegmentPluginBase/Example/MoEPluginBaseExample/ViewController.h b/Sources/MoEngageSegmentPluginBase/Example/MoEPluginBaseExample/ViewController.h similarity index 100% rename from MoEngageSegmentPluginBase/Example/MoEPluginBaseExample/ViewController.h rename to Sources/MoEngageSegmentPluginBase/Example/MoEPluginBaseExample/ViewController.h diff --git a/MoEngageSegmentPluginBase/Example/MoEPluginBaseExample/ViewController.m b/Sources/MoEngageSegmentPluginBase/Example/MoEPluginBaseExample/ViewController.m similarity index 100% rename from MoEngageSegmentPluginBase/Example/MoEPluginBaseExample/ViewController.m rename to Sources/MoEngageSegmentPluginBase/Example/MoEPluginBaseExample/ViewController.m diff --git a/Example/MoEPluginBaseExample/en.lproj/InfoPlist.strings b/Sources/MoEngageSegmentPluginBase/Example/MoEPluginBaseExample/en.lproj/InfoPlist.strings similarity index 100% rename from Example/MoEPluginBaseExample/en.lproj/InfoPlist.strings rename to Sources/MoEngageSegmentPluginBase/Example/MoEPluginBaseExample/en.lproj/InfoPlist.strings diff --git a/MoEngageSegmentPluginBase/Example/MoEPluginBaseExample/main.m b/Sources/MoEngageSegmentPluginBase/Example/MoEPluginBaseExample/main.m similarity index 100% rename from MoEngageSegmentPluginBase/Example/MoEPluginBaseExample/main.m rename to Sources/MoEngageSegmentPluginBase/Example/MoEPluginBaseExample/main.m diff --git a/MoEngageSegmentPluginBase/Example/Podfile b/Sources/MoEngageSegmentPluginBase/Example/Podfile similarity index 100% rename from MoEngageSegmentPluginBase/Example/Podfile rename to Sources/MoEngageSegmentPluginBase/Example/Podfile diff --git a/Example/Tests/Tests-Info.plist b/Sources/MoEngageSegmentPluginBase/Example/Tests/Tests-Info.plist similarity index 100% rename from Example/Tests/Tests-Info.plist rename to Sources/MoEngageSegmentPluginBase/Example/Tests/Tests-Info.plist diff --git a/Example/Tests/Tests-Prefix.pch b/Sources/MoEngageSegmentPluginBase/Example/Tests/Tests-Prefix.pch similarity index 100% rename from Example/Tests/Tests-Prefix.pch rename to Sources/MoEngageSegmentPluginBase/Example/Tests/Tests-Prefix.pch diff --git a/Example/Tests/Tests.m b/Sources/MoEngageSegmentPluginBase/Example/Tests/Tests.m similarity index 100% rename from Example/Tests/Tests.m rename to Sources/MoEngageSegmentPluginBase/Example/Tests/Tests.m diff --git a/Example/Tests/en.lproj/InfoPlist.strings b/Sources/MoEngageSegmentPluginBase/Example/Tests/en.lproj/InfoPlist.strings similarity index 100% rename from Example/Tests/en.lproj/InfoPlist.strings rename to Sources/MoEngageSegmentPluginBase/Example/Tests/en.lproj/InfoPlist.strings diff --git a/MoEngageSegmentPluginBase/LICENSE b/Sources/MoEngageSegmentPluginBase/LICENSE similarity index 100% rename from MoEngageSegmentPluginBase/LICENSE rename to Sources/MoEngageSegmentPluginBase/LICENSE diff --git a/MoEngageSegmentPluginBase/MoEngageSegmentPluginBase.podspec b/Sources/MoEngageSegmentPluginBase/MoEngageSegmentPluginBase.podspec similarity index 100% rename from MoEngageSegmentPluginBase/MoEngageSegmentPluginBase.podspec rename to Sources/MoEngageSegmentPluginBase/MoEngageSegmentPluginBase.podspec diff --git a/MoEngageSegmentPluginBase/MoEngageSegmentPluginBase/MoEngageSegmentPlugin.swift b/Sources/MoEngageSegmentPluginBase/MoEngageSegmentPluginBase/MoEngageSegmentPlugin.swift similarity index 100% rename from MoEngageSegmentPluginBase/MoEngageSegmentPluginBase/MoEngageSegmentPlugin.swift rename to Sources/MoEngageSegmentPluginBase/MoEngageSegmentPluginBase/MoEngageSegmentPlugin.swift diff --git a/MoEngageSegmentPluginBase/MoEngageSegmentPluginBase/MoEngageSegmentPluginBridge.swift b/Sources/MoEngageSegmentPluginBase/MoEngageSegmentPluginBase/MoEngageSegmentPluginBridge.swift similarity index 100% rename from MoEngageSegmentPluginBase/MoEngageSegmentPluginBase/MoEngageSegmentPluginBridge.swift rename to Sources/MoEngageSegmentPluginBase/MoEngageSegmentPluginBase/MoEngageSegmentPluginBridge.swift diff --git a/MoEngageSegmentPluginBase/MoEngageSegmentPluginBase/MoEngageSegmentPluginConstants.swift b/Sources/MoEngageSegmentPluginBase/MoEngageSegmentPluginBase/MoEngageSegmentPluginConstants.swift similarity index 100% rename from MoEngageSegmentPluginBase/MoEngageSegmentPluginBase/MoEngageSegmentPluginConstants.swift rename to Sources/MoEngageSegmentPluginBase/MoEngageSegmentPluginBase/MoEngageSegmentPluginConstants.swift diff --git a/MoEngageSegmentPluginBase/MoEngageSegmentPluginBase/MoEngageSegmentPluginParser.swift b/Sources/MoEngageSegmentPluginBase/MoEngageSegmentPluginBase/MoEngageSegmentPluginParser.swift similarity index 100% rename from MoEngageSegmentPluginBase/MoEngageSegmentPluginBase/MoEngageSegmentPluginParser.swift rename to Sources/MoEngageSegmentPluginBase/MoEngageSegmentPluginBase/MoEngageSegmentPluginParser.swift diff --git a/MoEngageSegmentPluginBase/MoEngageSegmentPluginBase/MoEngageSegmentPluginUtils.swift b/Sources/MoEngageSegmentPluginBase/MoEngageSegmentPluginBase/MoEngageSegmentPluginUtils.swift similarity index 100% rename from MoEngageSegmentPluginBase/MoEngageSegmentPluginBase/MoEngageSegmentPluginUtils.swift rename to Sources/MoEngageSegmentPluginBase/MoEngageSegmentPluginBase/MoEngageSegmentPluginUtils.swift diff --git a/MoEngageSegmentPluginBase/MoEngageSegmentPluginBaseApp.xcodeproj/project.pbxproj b/Sources/MoEngageSegmentPluginBase/MoEngageSegmentPluginBaseApp.xcodeproj/project.pbxproj similarity index 100% rename from MoEngageSegmentPluginBase/MoEngageSegmentPluginBaseApp.xcodeproj/project.pbxproj rename to Sources/MoEngageSegmentPluginBase/MoEngageSegmentPluginBaseApp.xcodeproj/project.pbxproj diff --git a/MoEngageSegmentPluginBase/MoEngageSegmentPluginBaseApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Sources/MoEngageSegmentPluginBase/MoEngageSegmentPluginBaseApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata similarity index 100% rename from MoEngageSegmentPluginBase/MoEngageSegmentPluginBaseApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata rename to Sources/MoEngageSegmentPluginBase/MoEngageSegmentPluginBaseApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata diff --git a/Example/MoEPluginBaseExample.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/Sources/MoEngageSegmentPluginBase/MoEngageSegmentPluginBaseApp.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist similarity index 100% rename from Example/MoEPluginBaseExample.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist rename to Sources/MoEngageSegmentPluginBase/MoEngageSegmentPluginBaseApp.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist diff --git a/MoEngageSegmentPluginBase/MoEngageSegmentPluginBaseTests/MoEngageSegmentMockData.swift b/Sources/MoEngageSegmentPluginBase/MoEngageSegmentPluginBaseTests/MoEngageSegmentMockData.swift similarity index 100% rename from MoEngageSegmentPluginBase/MoEngageSegmentPluginBaseTests/MoEngageSegmentMockData.swift rename to Sources/MoEngageSegmentPluginBase/MoEngageSegmentPluginBaseTests/MoEngageSegmentMockData.swift diff --git a/MoEngageSegmentPluginBase/MoEngageSegmentPluginBaseTests/MoEngageSegmentPluginParserTests.swift b/Sources/MoEngageSegmentPluginBase/MoEngageSegmentPluginBaseTests/MoEngageSegmentPluginParserTests.swift similarity index 100% rename from MoEngageSegmentPluginBase/MoEngageSegmentPluginBaseTests/MoEngageSegmentPluginParserTests.swift rename to Sources/MoEngageSegmentPluginBase/MoEngageSegmentPluginBaseTests/MoEngageSegmentPluginParserTests.swift diff --git a/MoEngageSegmentPluginBase/MoEngageSegmentPluginBaseTests/MoEngageSegmentPluginUtilsTests.swift b/Sources/MoEngageSegmentPluginBase/MoEngageSegmentPluginBaseTests/MoEngageSegmentPluginUtilsTests.swift similarity index 100% rename from MoEngageSegmentPluginBase/MoEngageSegmentPluginBaseTests/MoEngageSegmentPluginUtilsTests.swift rename to Sources/MoEngageSegmentPluginBase/MoEngageSegmentPluginBaseTests/MoEngageSegmentPluginUtilsTests.swift diff --git a/Tests/MoEngagePluginCardsTests/MoEngageCardCampaignTest.swift b/Tests/MoEngagePluginCardsTests/MoEngageCardCampaignTest.swift deleted file mode 100644 index 971b55d..0000000 --- a/Tests/MoEngagePluginCardsTests/MoEngageCardCampaignTest.swift +++ /dev/null @@ -1,186 +0,0 @@ -// -// MoEngageCardDecodingTest.swift -// MoEngagePluginCards-Unit-UnitTests -// -// Created by Soumya Mahunt on 21/06/23. -// - -import XCTest -import MoEngageCards -@testable import MoEngagePluginCards - -class MoEngageCardCampaignTest: XCTestCase { - static let json = """ -{ - "card_id": "000000000001686897366450_F_T_CA_AB_0_P_0_L_0_ios", - "category": "Announcements", - "template_data": { - "type": "basic", - "containers": [ - { - "widgets": [ - { - "content": "
Some header
", - "type": "text", - "id": 1 - }, - { - "content": "
some message
", - "type": "text", - "id": 2 - }, - { - "content": "
some action
", - "type": "button", - "id": 3, - "actions": [ - { - "type": "screenName", - "name": "navigate", - "value": "action", - "kvPairs": {} - } - ] - } - ], - "style": { - "bgColor": "#b8e986" - }, - "type": "basic", - "id": 0, - "actions": [] - } - ], - "batch_no": 0 - }, - "meta_data": { - "campaignState": { - "localShowCount": 1, - "isClicked": false, - "firstSeen": 1687083671, - "firstReceived": 1687083671, - "totalShowCount": 4 - }, - "display_controls": { - "expire_at": 1689489366 - }, - "metaData": { - "moe_campaign_id": "000000000001686897366450", - "moe_campaign_type": "cards", - "moe_campaign_channel": "Cards", - "moe_delivery_type": "One Time", - "cid": "000000000001686897366450_F_T_CA_AB_0_P_0_L_0", - "moe_card_id": "000000000001686897366450_F_T_CA_AB_0_P_0_L_0_ios", - "moe_campaign_name": "MoEngageDemoAppMoeTest-TestCardCampaign" - }, - "created_at": 1686897366, - "updated_at": 1686897366, - "campaignPayload": { - "id": "000000000001686897366450_F_T_CA_AB_0_P_0_L_0_ios", - "platform": "ios", - "status": "show", - "created_at": 1686897366, - "updated_at": 1686897366, - "meta_data": { - "moe_campaign_id": "000000000001686897366450", - "moe_campaign_type": "cards", - "moe_campaign_channel": "Cards", - "moe_delivery_type": "One Time", - "cid": "000000000001686897366450_F_T_CA_AB_0_P_0_L_0", - "moe_card_id": "000000000001686897366450_F_T_CA_AB_0_P_0_L_0_ios", - "moe_campaign_name": "MoEngageDemoAppMoeTest-TestCardCampaign" - }, - "template_data": { - "type": "basic", - "containers": [ - { - "widgets": [ - { - "content": "
Some header
", - "type": "text", - "id": 1 - }, - { - "content": "
some message
", - "type": "text", - "id": 2 - }, - { - "content": "
some action
", - "type": "button", - "id": 3, - "actions": [ - { - "type": "screenName", - "name": "navigate", - "value": "action", - "kvPairs": {} - } - ] - } - ], - "style": { - "bgColor": "#b8e986" - }, - "type": "basic", - "id": 0, - "actions": [] - } - ], - "batch_no": 0 - }, - "user_activity": { - "is_clicked": false, - "first_seen": 1687083671, - "first_delivered": 1687083671, - "show_count": { - "CC2279BB-EA41-4095-BFF6-F7BFBD22D262-1685269519": 1, - "176255C0-0ACB-4589-9293-725B447AA641-1687165810": 0, - "028233A8-CF50-459E-B08C-D774C6FF19DE-1687173912": 0, - "835E677B-5C13-44E7-8F87-316B28EA6D3F-1687252998": 0 - } - }, - "display_controls": { - "expire_at": 1689489366 - }, - "category": "Announcements" - } - } -} -""".data(using: .utf8)! - - func testDecodingFromHybrid() throws { - guard - let data = try JSONSerialization.jsonObject(with: Self.json) as? [String: Any] - else { - XCTFail("Invalid JSON input") - return - } - let card: MoEngageCardCampaign = try MoEngageHybridSDKCards.buildCardCampaign(fromHybridData: data) - XCTAssertNotNil(card) - XCTAssertTrue(card.shouldShow) - XCTAssertEqual(card.cardID, "000000000001686897366450_F_T_CA_AB_0_P_0_L_0_ios") - XCTAssertEqual(card.category, "Announcements") - } - - func testEncodingToHybrid() throws { - guard - let data = try JSONSerialization.jsonObject(with: Self.json) as? [String: Any] - else { - XCTFail("Invalid JSON input") - return - } - let hybridData = try MoEngageHybridSDKCards.buildCardCampaign(fromHybridData: data).encodeForHybrid() - print(hybridData) - let card: MoEngageCardCampaign = try MoEngageHybridSDKCards.buildCardCampaign(fromHybridData: hybridData) - XCTAssertNotNil(card) - XCTAssertTrue(card.shouldShow) - XCTAssertEqual(card.cardID, "000000000001686897366450_F_T_CA_AB_0_P_0_L_0_ios") - XCTAssertEqual(card.category, "Announcements") - } - - func testDecodingFailureScenario() throws { - XCTExpectFailure("Decoding failure due to invalid data") - let card: MoEngageCardCampaign = try MoEngageHybridSDKCards.buildCardCampaign(fromHybridData: [:]) - } -} diff --git a/Tests/MoEngagePluginCardsTests/MoEngageCardDecodingTest.swift b/Tests/MoEngagePluginCardsTests/MoEngageCardDecodingTest.swift deleted file mode 100644 index 6b52f10..0000000 --- a/Tests/MoEngagePluginCardsTests/MoEngageCardDecodingTest.swift +++ /dev/null @@ -1,101 +0,0 @@ -// -// MoEngageCardDecodingTest.swift -// MoEngagePluginCards-Unit-UnitTests -// -// Created by Soumya Mahunt on 22/06/23. -// - -import XCTest -import MoEngageCards -@testable import MoEngagePluginCards - -final class MoEngageCardDecodingTest: XCTestCase { - - func testCardsCategoryDataDecode() throws { - let json = """ -{ - "category": "Announcements" -} -""".data(using: .utf8)! - guard - let data = try JSONSerialization.jsonObject(with: json) as? [String: Any] - else { - XCTFail("Invalid JSON input") - return - } - let cardCategory = try MoEngageCardsCategoryData.decodeFromHybrid(data) - XCTAssertEqual(cardCategory.category, "Announcements") - } - - func testCardsCategoryDataDecodingFailureScenario() throws { - XCTExpectFailure("Decoding failure due to invalid data") - let _ = try MoEngageCardsCategoryData.decodeFromHybrid([:]) - } - - func testCardClickDataDecodeWithWidgetId() throws { - let json = """ -{ - "widgetId": 1, - "card": \(String(data: MoEngageCardCampaignTest.json, encoding: .utf8)!) -} -""".data(using: .utf8)! - guard - let data = try JSONSerialization.jsonObject(with: json) as? [String: Any] - else { - XCTFail("Invalid JSON input") - return - } - let cardClick = try MoEngageCardClickData.decodeFromHybrid(data) - XCTAssertEqual(cardClick.widgetId, 1) - XCTAssertNotNil(cardClick.card) - XCTAssertTrue(cardClick.card.shouldShow) - XCTAssertEqual(cardClick.card.cardID, "000000000001686897366450_F_T_CA_AB_0_P_0_L_0_ios") - XCTAssertEqual(cardClick.card.category, "Announcements") - } - - func testCardClickDataDecodeWithoutWidgetId() throws { - let json = """ -{ - "card": \(String(data: MoEngageCardCampaignTest.json, encoding: .utf8)!) -} -""".data(using: .utf8)! - guard - let data = try JSONSerialization.jsonObject(with: json) as? [String: Any] - else { - XCTFail("Invalid JSON input") - return - } - let cardClick = try MoEngageCardClickData.decodeFromHybrid(data) - XCTAssertNil(cardClick.widgetId) - XCTAssertNotNil(cardClick.card) - XCTAssertTrue(cardClick.card.shouldShow) - XCTAssertEqual(cardClick.card.cardID, "000000000001686897366450_F_T_CA_AB_0_P_0_L_0_ios") - XCTAssertEqual(cardClick.card.category, "Announcements") - } - - func testCardClickDataDecodeWithoutWidgetIdInAndroidFormat() throws { - let json = """ -{ - "widgetId": -1, - "card": \(String(data: MoEngageCardCampaignTest.json, encoding: .utf8)!) -} -""".data(using: .utf8)! - guard - let data = try JSONSerialization.jsonObject(with: json) as? [String: Any] - else { - XCTFail("Invalid JSON input") - return - } - let cardClick = try MoEngageCardClickData.decodeFromHybrid(data) - XCTAssertNil(cardClick.widgetId) - XCTAssertNotNil(cardClick.card) - XCTAssertTrue(cardClick.card.shouldShow) - XCTAssertEqual(cardClick.card.cardID, "000000000001686897366450_F_T_CA_AB_0_P_0_L_0_ios") - XCTAssertEqual(cardClick.card.category, "Announcements") - } - - func testCardClickDataDecodingFailureScenario() throws { - XCTExpectFailure("Decoding failure due to invalid data") - let _ = try MoEngageCardClickData.decodeFromHybrid([:]) - } -} diff --git a/Tests/MoEngagePluginCardsTests/MoEngageCardSyncTest.swift b/Tests/MoEngagePluginCardsTests/MoEngageCardSyncTest.swift deleted file mode 100644 index 8552bfe..0000000 --- a/Tests/MoEngagePluginCardsTests/MoEngageCardSyncTest.swift +++ /dev/null @@ -1,135 +0,0 @@ -// -// MoEngageCardSyncTest.swift -// MoEngagePluginCards-Unit-UnitTests -// -// Created by Soumya Mahunt on 22/06/23. -// - -import XCTest -import MoEngageCards -@testable import MoEngagePluginCards - -final class MoEngageCardSyncTest: XCTestCase { - - func testAppOpenSyncQueueCallbackOnAttachAndListnerSet() throws { - let syncManager = MoEngageCardSyncManager(queue: DispatchQueue.main) - syncManager.sendUpdate(forEventType: .appOpen, andAppID: "", withNewData: nil) - - let exp = XCTestExpectation(description: "Sync delegate called once") - let mockDelegate = MockSyncDelegate { type, data, count in - XCTAssertEqual(type, .appOpen) - let data: [String: Any?] = try! MoEngagePluginCardsUtil.getData(fromHybridPayload: data) - switch data[MoEngageCardSyncCompleteMetaData.HybridKeys.syncCompleteData] { - case .none: - break - case .some(let value): - XCTAssertNil(value) - } - exp.fulfill() - } - syncManager.attachDelegate(mockDelegate) - syncManager.setSyncListener() - wait(for: [exp], timeout: 5) - } - - func testAppOpenSyncQueueCallbackOnAttachAndWithoutListnerSet() throws { - let syncManager = MoEngageCardSyncManager(queue: DispatchQueue.main) - syncManager.sendUpdate(forEventType: .appOpen, andAppID: "", withNewData: nil) - - let exp = XCTestExpectation(description: "Invalid sync delegate invocation without listner set") - //TODO: Check this later - // exp.isInverted = true - let mockDelegate = MockSyncDelegate { type, data, count in - XCTAssertEqual(type, .appOpen) - let data: [String: Any?] = try! MoEngagePluginCardsUtil.getData(fromHybridPayload: data) - switch data[MoEngageCardSyncCompleteMetaData.HybridKeys.syncCompleteData] { - case .none: - break - case .some(let value): - XCTAssertNil(value) - } - exp.fulfill() - } - syncManager.attachDelegate(mockDelegate) - wait(for: [exp], timeout: 5) - } - - func testCardSyncQueueCallbackOnAttach() throws { - let syncManager = MoEngageCardSyncManager(queue: DispatchQueue.main) - syncManager.sendUpdate(forEventType: .inboxOpen, andAppID: "", withNewData: nil) - - let exp = XCTestExpectation(description: "Sync delegate called once") - let mockDelegate = MockSyncDelegate { type, data, count in - XCTAssertEqual(type, .inboxOpen) - let data: [String: Any?] = try! MoEngagePluginCardsUtil.getData(fromHybridPayload: data) - switch data[MoEngageCardSyncCompleteMetaData.HybridKeys.syncCompleteData] { - case .none: - break - case .some(let value): - XCTAssertNil(value) - } - exp.fulfill() - } - syncManager.attachDelegate(mockDelegate) - wait(for: [exp], timeout: 5) - } - - func testCardSyncQueueCallbackAfterAttach() throws { - let syncManager = MoEngageCardSyncManager(queue: DispatchQueue.main) - let exp = XCTestExpectation(description: "Sync delegate called once") - let mockDelegate = MockSyncDelegate { type, data, count in - XCTAssertEqual(type, .inboxOpen) - let data: [String: Any?] = try! MoEngagePluginCardsUtil.getData(fromHybridPayload: data) - switch data[MoEngageCardSyncCompleteMetaData.HybridKeys.syncCompleteData] { - case .none: - break - case .some(let value): - XCTAssertNil(value) - } - exp.fulfill() - } - - syncManager.attachDelegate(mockDelegate) - syncManager.sendUpdate(forEventType: .inboxOpen, andAppID: "", withNewData: nil) - wait(for: [exp], timeout: 5) - } - - func testCardSyncQueueCallbackAfterDetachAndAttach() throws { - let syncManager = MoEngageCardSyncManager(queue: DispatchQueue.main) - let exp = XCTestExpectation(description: "Sync delegate called once") - let mockDelegate = MockSyncDelegate { type, data, count in - XCTAssertEqual(type, .inboxOpen) - let data: [String: Any?] = try! MoEngagePluginCardsUtil.getData(fromHybridPayload: data) - switch data[MoEngageCardSyncCompleteMetaData.HybridKeys.syncCompleteData] { - case .none: - break - case .some(let value): - XCTAssertNil(value) - } - exp.fulfill() - } - - syncManager.attachDelegate(mockDelegate) - syncManager.detachDelegate() - syncManager.attachDelegate(mockDelegate) - syncManager.sendUpdate(forEventType: .inboxOpen, andAppID: "", withNewData: nil) - wait(for: [exp], timeout: 5) - } -} - -class MockSyncDelegate: MoEngageCardSyncDelegate { - let assertion: (MoEngageCardsSyncEventType, [String : Any], UInt) -> Void - var invocationCount: UInt = 0 - - init(assertion: @escaping (MoEngageCardsSyncEventType, [String : Any], UInt) -> Void) { - self.assertion = assertion - } - - func syncComplete( - forEventType eventType: MoEngageCardsSyncEventType, - withData data: [String : Any] - ) { - invocationCount += 1 - self.assertion(eventType, data, invocationCount) - } -} diff --git a/Tests/MoEngagePluginCardsTests/MoEngagePluginCardsBridgeTest.swift b/Tests/MoEngagePluginCardsTests/MoEngagePluginCardsBridgeTest.swift deleted file mode 100644 index b923de6..0000000 --- a/Tests/MoEngagePluginCardsTests/MoEngagePluginCardsBridgeTest.swift +++ /dev/null @@ -1,463 +0,0 @@ -// -// MoEngagePluginCardsBridgeTest.swift -// MoEngagePluginCards-Unit-UnitTests -// -// Created by Soumya Mahunt on 23/06/23. -// - -import XCTest -import MoEngageCards -import MoEngagePluginBase -@testable import MoEngagePluginCards - -final class MoEngagePluginCardsBridgeTest: XCTestCase { - - var mockBaseData: [String: Any] { - return [ - MoEngagePluginConstants.General.accountMeta: [ - "appId": "some_id" - ] - ] - } - - static func mockHybridCardCampaign( - file: StaticString = #filePath, - line: UInt = #line - ) throws -> [String: Any] { - guard - let data = try JSONSerialization.jsonObject( - with: MoEngageCardCampaignTest.json - ) as? [String: Any] - else { - XCTFail("Invalid JSON input", file: file, line: line) - return [:] - } - return data - } - - func testRefreshCardsFailWithInvalidAccountData() throws { - let mockHandler = MockMoEngagePluginCardsBridgeHandler() - let exp = XCTestExpectation(description: "Invoked with invalid account data") - exp.isInverted = true - mockHandler.refreshCards = { appId, completion in - exp.fulfill() - } - - let bridge = MoEngagePluginCardsBridge(handler: mockHandler) - bridge.refreshCards([:]) - wait(for: [exp], timeout: 5) - } - - func testRefreshCardsSuccess() throws { - let mockHandler = MockMoEngagePluginCardsBridgeHandler() - let exp = XCTestExpectation(description: "Native SDK method invoked") - mockHandler.refreshCards = { appId, completion in - XCTAssertEqual(appId, "some_id") - exp.fulfill() - } - - let bridge = MoEngagePluginCardsBridge(handler: mockHandler) - bridge.refreshCards(self.mockBaseData) - wait(for: [exp], timeout: 5) - } - - func testCardsSectionLoadedFailWithInvalidAccountData() throws { - let mockHandler = MockMoEngagePluginCardsBridgeHandler() - let exp = XCTestExpectation(description: "Invoked with invalid account data") - exp.isInverted = true - mockHandler.cardSectionLoaded = { appId, completion in - exp.fulfill() - } - - let bridge = MoEngagePluginCardsBridge(handler: mockHandler) - bridge.onCardsSectionLoaded([:]) - wait(for: [exp], timeout: 5) - } - - func testCardsSectionLoadedSuccess() throws { - let mockHandler = MockMoEngagePluginCardsBridgeHandler() - let exp = XCTestExpectation(description: "Native SDK method invoked") - mockHandler.cardSectionLoaded = { appId, completion in - XCTAssertEqual(appId, "some_id") - exp.fulfill() - } - - let bridge = MoEngagePluginCardsBridge(handler: mockHandler) - bridge.onCardsSectionLoaded(self.mockBaseData) - wait(for: [exp], timeout: 5) - } - - func testAppOpenSyncListenerSetFailWithInvalidAccountData() throws { - let mockHandler = MockMoEngagePluginCardsBridgeHandler() - let exp = XCTestExpectation(description: "Invoked with invalid account data") - exp.isInverted = true - mockHandler.appOpenSync = { appId, completion in - exp.fulfill() - } - - let bridge = MoEngagePluginCardsBridge(handler: mockHandler) - bridge.setSyncListener([:]) - wait(for: [exp], timeout: 5) - } - - func testAppOpenSyncListenerSetSuccess() throws { - let mockHandler = MockMoEngagePluginCardsBridgeHandler() - let exp = XCTestExpectation(description: "Inavalid native SDK method invocation") - exp.isInverted = true - mockHandler.appOpenSync = { appId, completion in - XCTAssertEqual(appId, "some_id") - exp.fulfill() - } - - let bridge = MoEngagePluginCardsBridge(handler: mockHandler) - bridge.setSyncListener(self.mockBaseData) - wait(for: [exp], timeout: 5) - } - - func testCardsSectionUnLoadedFailWithInvalidAccountData() throws { - let mockHandler = MockMoEngagePluginCardsBridgeHandler() - let exp = XCTestExpectation(description: "Invoked with invalid account data") - exp.isInverted = true - mockHandler.cardsViewControllerDismissed = { appId in - exp.fulfill() - } - - let bridge = MoEngagePluginCardsBridge(handler: mockHandler) - bridge.onCardsSectionUnLoaded([:]) - wait(for: [exp], timeout: 5) - } - - func testCardsSectionUnLoadedSuccess() throws { - let mockHandler = MockMoEngagePluginCardsBridgeHandler() - let exp = XCTestExpectation(description: "Native SDK method invoked") - mockHandler.cardsViewControllerDismissed = { appId in - XCTAssertEqual(appId, "some_id") - exp.fulfill() - } - - let bridge = MoEngagePluginCardsBridge(handler: mockHandler) - bridge.onCardsSectionUnLoaded(self.mockBaseData) - wait(for: [exp], timeout: 5) - } - - func testCardClickedFailWithInvalidAccountData() throws { - let mockHandler = MockMoEngagePluginCardsBridgeHandler() - let exp = XCTestExpectation(description: "Invoked with invalid account data") - exp.isInverted = true - mockHandler.cardClicked = { card, appId in - exp.fulfill() - } - - let bridge = MoEngagePluginCardsBridge(handler: mockHandler) - bridge.cardClicked([:]) - wait(for: [exp], timeout: 5) - } - - func testCardClickedSuccess() throws { - let mockHandler = MockMoEngagePluginCardsBridgeHandler() - let exp = XCTestExpectation(description: "Native SDK method invoked") - mockHandler.cardClicked = { card, appId in - XCTAssertEqual(appId, "some_id") - XCTAssertNotNil(card) - XCTAssertTrue(card.shouldShow) - XCTAssertEqual(card.cardID, "000000000001686897366450_F_T_CA_AB_0_P_0_L_0_ios") - XCTAssertEqual(card.category, "Announcements") - exp.fulfill() - } - - let bridge = MoEngagePluginCardsBridge(handler: mockHandler) - var data = self.mockBaseData - data[MoEngagePluginConstants.General.data] = [ - MoEngageCardClickData.HybridKeys.card: try Self.mockHybridCardCampaign() - ] - bridge.cardClicked(data) - wait(for: [exp], timeout: 5) - } - - func testCardClickedSuccessWithWidgetId() throws { - let mockHandler = MockMoEngagePluginCardsBridgeHandler() - let exp = XCTestExpectation(description: "Native SDK method invoked") - mockHandler.cardWidgetClicked = { card, widgetId, appId in - XCTAssertEqual(appId, "some_id") - XCTAssertNotNil(card) - XCTAssertTrue(card.shouldShow) - XCTAssertEqual(card.cardID, "000000000001686897366450_F_T_CA_AB_0_P_0_L_0_ios") - XCTAssertEqual(card.category, "Announcements") - XCTAssertNotNil(widgetId) - XCTAssertEqual(widgetId, 5) - exp.fulfill() - } - - let bridge = MoEngagePluginCardsBridge(handler: mockHandler) - var data = self.mockBaseData - data[MoEngagePluginConstants.General.data] = [ - MoEngageCardClickData.HybridKeys.widgetId: 5, - MoEngageCardClickData.HybridKeys.card: try Self.mockHybridCardCampaign() - ] as [String : Any] - bridge.cardClicked(data) - wait(for: [exp], timeout: 5) - } - - func testCardDeliveredFailWithInvalidAccountData() throws { - let mockHandler = MockMoEngagePluginCardsBridgeHandler() - let exp = XCTestExpectation(description: "Invoked with invalid account data") - exp.isInverted = true - mockHandler.cardDelivered = { appId in - exp.fulfill() - } - - let bridge = MoEngagePluginCardsBridge(handler: mockHandler) - bridge.cardDelivered([:]) - wait(for: [exp], timeout: 5) - } - - func testCardDeliveredSuccess() throws { - let mockHandler = MockMoEngagePluginCardsBridgeHandler() - let exp = XCTestExpectation(description: "Native SDK method invoked") - mockHandler.cardDelivered = { appId in - XCTAssertEqual(appId, "some_id") - exp.fulfill() - } - - let bridge = MoEngagePluginCardsBridge(handler: mockHandler) - bridge.cardDelivered(self.mockBaseData) - wait(for: [exp], timeout: 5) - } - - func testCardShownFailWithInvalidAccountData() throws { - let mockHandler = MockMoEngagePluginCardsBridgeHandler() - let exp = XCTestExpectation(description: "Invoked with invalid account data") - exp.isInverted = true - mockHandler.cardShown = { card, appId in - exp.fulfill() - } - - let bridge = MoEngagePluginCardsBridge(handler: mockHandler) - bridge.cardShown([:]) - wait(for: [exp], timeout: 5) - } - - func testCardShownSuccess() throws { - let mockHandler = MockMoEngagePluginCardsBridgeHandler() - let exp = XCTestExpectation(description: "Native SDK method invoked") - mockHandler.cardShown = { card, appId in - XCTAssertEqual(appId, "some_id") - XCTAssertNotNil(card) - XCTAssertTrue(card.shouldShow) - XCTAssertEqual(card.cardID, "000000000001686897366450_F_T_CA_AB_0_P_0_L_0_ios") - XCTAssertEqual(card.category, "Announcements") - exp.fulfill() - } - - let bridge = MoEngagePluginCardsBridge(handler: mockHandler) - var data = self.mockBaseData - data[MoEngagePluginConstants.General.data] = [ - MoEngagePluginCardsContants.card: try Self.mockHybridCardCampaign() - ] - bridge.cardShown(data) - wait(for: [exp], timeout: 5) - } - - func testDeleteCardsFailWithInvalidAccountData() throws { - let mockHandler = MockMoEngagePluginCardsBridgeHandler() - let exp = XCTestExpectation(description: "Invoked with invalid account data") - exp.isInverted = true - mockHandler.deleteCards = { cards, appId, completion in - exp.fulfill() - } - - let bridge = MoEngagePluginCardsBridge(handler: mockHandler) - bridge.deleteCards([:]) - wait(for: [exp], timeout: 5) - } - - func testDeleteCardsSuccess() throws { - let mockHandler = MockMoEngagePluginCardsBridgeHandler() - let exp = XCTestExpectation(description: "Native SDK method invoked") - mockHandler.deleteCards = { cards, appId, completion in - XCTAssertEqual(appId, "some_id") - XCTAssertNotNil(cards.first) - guard let card = cards.first else { return } - XCTAssertNotNil(card) - XCTAssertTrue(card.shouldShow) - XCTAssertEqual(card.cardID, "000000000001686897366450_F_T_CA_AB_0_P_0_L_0_ios") - XCTAssertEqual(card.category, "Announcements") - exp.fulfill() - } - - let bridge = MoEngagePluginCardsBridge(handler: mockHandler) - var data = self.mockBaseData - data[MoEngagePluginConstants.General.data] = [ - MoEngagePluginCardsContants.cards: [try Self.mockHybridCardCampaign()] - ] - bridge.deleteCards(data) - wait(for: [exp], timeout: 5) - } - - func testFetchCards() throws { - let mockHandler = MockMoEngagePluginCardsBridgeHandler() - let exp = XCTestExpectation(description: "Native SDK method invoked") - mockHandler.fetchCards = { appId, completion in - XCTAssertEqual(appId, "some_id") - exp.fulfill() - } - - let bridge = MoEngagePluginCardsBridge(handler: mockHandler) - var data = self.mockBaseData - data[MoEngagePluginConstants.General.data] = [ - MoEngagePluginCardsContants.cards: [try Self.mockHybridCardCampaign()] - ] - bridge.fetchCards(self.mockBaseData) { payload in } - wait(for: [exp], timeout: 5) - } -} - -class MockMoEngagePluginCardsBridgeHandler: MoEngagePluginCardsBridgeHandler { - var appOpenSync: ((String?, ((MoEngageCardSyncCompleteData?) -> Void)?) -> Void)? - var cardSectionLoaded: ((String?, ((MoEngageCardSyncCompleteData?) -> Void)?) -> Void)? - var refreshCards: ((String?, ((MoEngageCardSyncCompleteData?) -> Void)?) -> Void)? - - var fetchCards: ((String?, ((MoEngageCardData?) -> Void)?) -> Void)? - - var getCardsCategories: ((String?, (([String], MoEngageAccountMeta?) -> Void)) -> Void)? - - var getCardsData: ((String?, ((MoEngageCardsData?, MoEngageAccountMeta?) -> Void)) -> Void)? - - var getCards: ((String, String?, (([MoEngageCardCampaign], MoEngageAccountMeta?) -> Void)) -> Void)? - - var isAllCategoryEnabled: ((String?, ((Bool) -> Void)) -> Void)? - - var cardShown: ((MoEngageCardCampaign, String?) -> Void)? - var cardClicked: ((MoEngageCardCampaign, String?) -> Void)? - var cardWidgetClicked: ((MoEngageCardCampaign, Int, String?) -> Void)? - var cardDelivered: ((String?) -> Void)? - - var cardsViewControllerDismissed: ((String?) -> Void)? - - var deleteCards: (([MoEngageCardCampaign], String?, ((Bool, MoEngageAccountMeta?) -> Void)) -> Void)? - - var getNewCardsCount: ((String?, ((Int, MoEngageAccountMeta?) -> Void)) -> Void)? - var getUnclickedCardsCount: ((String?, ((Int, MoEngageAccountMeta?) -> Void)) -> Void)? - var getClickedCardsCount: ((String?, ((Int, MoEngageAccountMeta?) -> Void)) -> Void)? - var getCardData: ((String, String?, ((MoEngageCardData?) -> Void)) -> Void)? - - func onAppOpenSync( - forAppID appID: String?, - withCompletion completionBlock: ((MoEngageCardSyncCompleteData?) -> Void)? - ) { - appOpenSync?(appID, completionBlock) - } - - func onCardSectionLoaded( - forAppID appID: String?, - withCompletion completionBlock: ((MoEngageCardSyncCompleteData?) -> Void)? - ) { - cardSectionLoaded?(appID, completionBlock) - } - - func refreshCards( - forAppID appID: String?, - withCompletion completionBlock: ((MoEngageCardSyncCompleteData?) -> Void)? - ) { - refreshCards?(appID, completionBlock) - } - - func fetchCards( - forAppID appID: String?, - withCompletion completionBlock: ((MoEngageCardData?) -> Void)? - ) { - fetchCards?(appID, completionBlock) - } - - func getCardsData( - forAppID appID: String?, - withCompletionBlock completionBlock: - @escaping ((MoEngageCardsData?, MoEngageAccountMeta?) -> Void) - ) { - self.getCardsData?(appID, completionBlock) - } - - func getCardsCategories( - forAppID appID: String?, - withCompletionBlock completionBlock: - @escaping (([String], MoEngageAccountMeta?) -> ()) - ) { - self.getCardsCategories?(appID, completionBlock) - } - - func getCards( - forCategory category: String, - forAppID appID: String?, - withCompletionBlock completionBlock: - @escaping (([MoEngageCardCampaign], MoEngageAccountMeta?) -> Void) - ) { - self.getCards?(category, appID, completionBlock) - } - - func isAllCategoryEnabled( - forAppID appID: String?, - withCompletionBlock completionBlock: @escaping ((Bool) -> Void) - ) { - self.isAllCategoryEnabled?(appID, completionBlock) - } - - func cardShown(_ card: MoEngageCardCampaign, forAppID appID: String?) { - self.cardShown?(card, appID) - } - - func cardClicked(_ card: MoEngageCardCampaign, forAppID appID: String?) { - self.cardClicked?(card, appID) - } - - func cardClicked( - _ card: MoEngageCardCampaign, - withWidgetID widgetID: Int, - forAppID appID: String? - ) { - self.cardWidgetClicked?(card, widgetID, appID) - } - - func cardDelivered(forAppID appID: String?) { - self.cardDelivered?(appID) - } - - func deleteCards( - _ cardsArr: [MoEngageCardCampaign], - forAppID appID: String?, - andCompletionBlock completionBlock: @escaping ((Bool, MoEngageAccountMeta?) -> ()) - ) { - self.deleteCards?(cardsArr, appID, completionBlock) - } - - func cardsViewControllerDismissed(forAppID appID: String?) { - cardsViewControllerDismissed?(appID) - } - - func getNewCardsCount( - forAppID appID: String?, - withCompletionBlock completionBlock: - @escaping ((Int, MoEngageAccountMeta?) -> Void) - ) { - self.getNewCardsCount?(appID, completionBlock) - } - - func getUnclickedCardsCount( - forAppID appID: String?, - withCompletionBlock completionBlock: - @escaping ((Int, MoEngageAccountMeta?) -> Void) - ) { - self.getUnclickedCardsCount?(appID, completionBlock) - } - - func getClickedCardsCount( - forAppID appID: String?, - withCompletionBlock completionBlock: - @escaping ((Int, MoEngageAccountMeta?) -> Void) - ) { - self.getClickedCardsCount?(appID, completionBlock) - } - - func getCardData(for category: String, appID: String?, completionBlock: @escaping (MoEngageCards.MoEngageCardData?) -> Void) { - self.getCardData?(category,appID, completionBlock) - } -} diff --git a/Utilities/post_build.rb b/Utilities/post_build.rb new file mode 100755 index 0000000..6a61780 --- /dev/null +++ b/Utilities/post_build.rb @@ -0,0 +1,57 @@ +#!/usr/bin/ruby + +# Usage: +# Update Package.swift, version constants as per package.json + +require 'json' + +config = JSON.parse(File.read('package.json'), {object_class: OpenStruct}) + +package_swift = < 'release-cards', + 'apple-plugin-geofence' => 'release-geofence', + 'apple-plugin-inbox' => 'release-inbox' +} + +inputs = JSON.parse(ENV['MO_WORKFLOW_INPUTS']) +config = JSON.parse(File.read('package.json'), {object_class: OpenStruct}) +passed_inputs = inputs.filter { |key, value| !repo_flag_mapping.values.include?(key) } +passed_inputs['base-version'] = config.packages.first.version +passed_inputs['sdk-version'] = config.sdkVerMin + +repo_flag_mapping.each do |repo, flag| + next unless MoEngagePluginSDK::TRUE_VALUES.include?("#{inputs[flag]}") + system("echo '#{JSON.generate(passed_inputs)}' | gh workflow run cd.yml --ref development --repo \"moengage/#{repo}\" --json", out: STDOUT, exception: true) +end diff --git a/Utilities/spec.rb b/Utilities/spec.rb deleted file mode 100644 index ec1d94d..0000000 --- a/Utilities/spec.rb +++ /dev/null @@ -1,54 +0,0 @@ -require 'json' -require 'ostruct' - -module MoEngagePluginSDK - @@config = JSON.parse(File.read('package.json'), {object_class: OpenStruct}) - def self.config - @@config - end - - module Spec - def define() - podspec_path = caller.find do |trace| - File.extname(trace.split(":")[0]).eql?('.podspec') - end.split(":")[0] - - podspec = File.basename(podspec_path, File.extname(podspec_path)) - package_index = MoEngagePluginSDK.config.packages.find_index { |package| package.name == podspec } - package = MoEngagePluginSDK.config.packages[package_index] if package_index - - self.name = podspec - self.version = package.version - self.homepage = 'https://www.moengage.com' - self.documentation_url = 'https://developers.moengage.com' - self.license = { :type => 'Commercial', :file => 'LICENSE' } - self.author = { 'MobileDev' => 'mobiledevs@moengage.com' } - self.social_media_url = 'https://twitter.com/moengage' - - self.source = { - :git => 'https://github.com/moengage/iOS-PluginBase.git', - :tag => package.tagPrefix + self.version.to_s - } - - self.ios.deployment_target = '13.0' - self.swift_version = '5.0' - self.requires_arc = true - self.source_files = "#{self.name}/**/*" - self.preserve_paths = "*.md", "LICENSE" - - plugin_base = 'MoEngagePluginBase' - unless package.name == plugin_base - plugin_base_index = MoEngagePluginSDK.config.packages.find_index { |package| package.name == plugin_base } - plugin_base_package = MoEngagePluginSDK.config.packages[plugin_base_index] - self.dependency plugin_base, plugin_base_package.version - else - self.dependency 'MoEngage-iOS-SDK', MoEngagePluginSDK.config.sdkVerMin - end - test_file_glob = "Tests/#{self.name}Tests/**/*.{swift}" - self.test_spec 'Tests' do |ts| - ts.ios.deployment_target = '13.0' - ts.source_files = test_file_glob - end unless Dir.glob(test_file_glob).empty? - end - end -end diff --git a/_Pods.xcodeproj b/_Pods.xcodeproj deleted file mode 120000 index 3c5a8e7..0000000 --- a/_Pods.xcodeproj +++ /dev/null @@ -1 +0,0 @@ -Example/Pods/Pods.xcodeproj \ No newline at end of file diff --git a/package.json b/package.json index 5b8dfa9..4b03f13 100644 --- a/package.json +++ b/package.json @@ -1,30 +1,13 @@ { "name": "MoEngagePluginBase", + "postBuild": "Utilities/post_build.rb", "sdkVerMin": "10.07.2", "packages": [ { "name": "MoEngagePluginBase", "version": "6.6.1", - "changelog": "MoEngagePluginBase/CHANGELOG.md", + "changelog": "CHANGELOG.md", "tagPrefix": "pluginBase-" - }, - { - "name": "MoEngagePluginCards", - "version": "3.7.1", - "changelog": "MoEngagePluginCards/CHANGELOG.md", - "tagPrefix": "pluginCards-" - }, - { - "name": "MoEngagePluginGeofence", - "version": "4.6.1", - "changelog": "MoEngagePluginGeofence/CHANGELOG.md", - "tagPrefix": "pluginGeofence-" - }, - { - "name": "MoEngagePluginInbox", - "version": "4.6.1", - "changelog": "MoEngagePluginInbox/CHANGELOG.md", - "tagPrefix": "pluginInbox-" } ] } \ No newline at end of file