├── .github
├── ISSUE_TEMPLATE.md
├── PULL_REQUEST_TEMPLATE.md
└── workflows
│ └── codeql-analysis.yml
├── .gitignore
├── .travis.yml
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── LICENSE
├── Leanplum-iOS-Location.podspec
├── Leanplum-iOS-LocationAndBeacons.podspec
├── Leanplum-iOS-SDK.podspec
├── Leanplum.svg
├── Leanplum.xcworkspace
├── contents.xcworkspacedata
└── xcshareddata
│ ├── IDEWorkspaceChecks.plist
│ └── WorkspaceSettings.xcsettings
├── LeanplumSDK
├── LeanplumSDK.xcodeproj
│ ├── project.pbxproj
│ └── xcshareddata
│ │ └── xcschemes
│ │ ├── Leanplum-Bundle.xcscheme
│ │ └── Leanplum-Static.xcscheme
├── LeanplumSDK
│ ├── Classes
│ │ ├── CleverTapInstanceCallback.h
│ │ ├── CleverTapInstanceCallback.m
│ │ ├── Features
│ │ │ ├── Actions
│ │ │ │ ├── LPActionArg.m
│ │ │ │ ├── LPActionContext-Internal.h
│ │ │ │ ├── LPActionContext.m
│ │ │ │ ├── LPActionContextNotification.h
│ │ │ │ ├── LPActionContextNotification.m
│ │ │ │ ├── LPActionTriggerManager.h
│ │ │ │ └── LPActionTriggerManager.m
│ │ │ ├── Events
│ │ │ │ ├── LPEventCallback.h
│ │ │ │ ├── LPEventCallback.m
│ │ │ │ ├── LPEventCallbackManager.h
│ │ │ │ ├── LPEventCallbackManager.m
│ │ │ │ ├── LPEventDataManager.h
│ │ │ │ └── LPEventDataManager.m
│ │ │ ├── Inbox
│ │ │ │ └── LPInbox.m
│ │ │ └── Variables
│ │ │ │ ├── LPSecuredVars.h
│ │ │ │ ├── LPSecuredVars.m
│ │ │ │ ├── LPVar-Internal.h
│ │ │ │ ├── LPVar.m
│ │ │ │ ├── LPVarCache.h
│ │ │ │ └── LPVarCache.m
│ │ ├── Internal
│ │ │ ├── FeatureFlag
│ │ │ │ ├── LPFeatureFlagManager.h
│ │ │ │ ├── LPFeatureFlagManager.m
│ │ │ │ └── LPFeatureFlags.h
│ │ │ ├── LPConstants.h
│ │ │ ├── LPConstants.m
│ │ │ ├── LPContextualValues.h
│ │ │ ├── LPContextualValues.m
│ │ │ ├── LPEnumConstants.h
│ │ │ ├── LPEnumConstants.m
│ │ │ ├── LPInternalState.h
│ │ │ ├── LPInternalState.m
│ │ │ ├── Leanplum.m
│ │ │ ├── LeanplumCompatibility.m
│ │ │ └── LeanplumInternal.h
│ │ ├── LPActionArg.h
│ │ ├── LPActionContext.h
│ │ ├── LPInbox.h
│ │ ├── LPMessageTemplates.h
│ │ ├── LPMessageTemplates.m
│ │ ├── LPVar.h
│ │ ├── Leanplum.h
│ │ ├── LeanplumCompatibility.h
│ │ ├── LeanplumSDK.h
│ │ ├── Managers
│ │ │ ├── LPAppIconManager.h
│ │ │ ├── LPAppIconManager.m
│ │ │ ├── LPCountAggregator.h
│ │ │ ├── LPCountAggregator.m
│ │ │ ├── LPFileManager.h
│ │ │ ├── LPFileManager.m
│ │ │ ├── LPLogManager.h
│ │ │ ├── LPLogManager.m
│ │ │ ├── LPRegisterDevice.h
│ │ │ ├── LPRegisterDevice.m
│ │ │ ├── LPRevenueManager.h
│ │ │ ├── LPRevenueManager.m
│ │ │ └── Networking
│ │ │ │ ├── LPFileTransferManager.h
│ │ │ │ ├── LPFileTransferManager.m
│ │ │ │ ├── LPNetworkConstants.h
│ │ │ │ ├── LPNetworkEngine.h
│ │ │ │ ├── LPNetworkEngine.m
│ │ │ │ ├── LPNetworkFactory.h
│ │ │ │ ├── LPNetworkFactory.m
│ │ │ │ ├── LPNetworkOperation.h
│ │ │ │ ├── LPNetworkOperation.m
│ │ │ │ ├── LPNetworkProtocol.h
│ │ │ │ ├── LPRequest.h
│ │ │ │ ├── LPRequest.m
│ │ │ │ ├── LPRequestBatch.h
│ │ │ │ ├── LPRequestBatch.m
│ │ │ │ ├── LPRequestBatchFactory.h
│ │ │ │ ├── LPRequestBatchFactory.m
│ │ │ │ ├── LPRequestFactory.h
│ │ │ │ ├── LPRequestFactory.m
│ │ │ │ ├── LPRequestSender.h
│ │ │ │ ├── LPRequestSender.m
│ │ │ │ ├── LPRequestSenderTimer.h
│ │ │ │ ├── LPRequestSenderTimer.m
│ │ │ │ ├── LPResponse.h
│ │ │ │ ├── LPResponse.m
│ │ │ │ ├── LeanplumSocket.h
│ │ │ │ └── LeanplumSocket.m
│ │ ├── MessageTemplates
│ │ │ ├── LPAlertMessageTemplate.h
│ │ │ ├── LPAlertMessageTemplate.m
│ │ │ ├── LPAppRatingMessageTemplate.h
│ │ │ ├── LPAppRatingMessageTemplate.m
│ │ │ ├── LPCenterPopupMessageTemplate.h
│ │ │ ├── LPCenterPopupMessageTemplate.m
│ │ │ ├── LPConfirmMessageTemplate.h
│ │ │ ├── LPConfirmMessageTemplate.m
│ │ │ ├── LPIconChangeMessageTemplate.h
│ │ │ ├── LPIconChangeMessageTemplate.m
│ │ │ ├── LPInterstitialMessageTemplate.h
│ │ │ ├── LPInterstitialMessageTemplate.m
│ │ │ ├── LPMessageTemplateConstants.h
│ │ │ ├── LPMessageTemplateProtocol.h
│ │ │ ├── LPOpenUrlMessageTemplate.h
│ │ │ ├── LPOpenUrlMessageTemplate.m
│ │ │ ├── LPPushAskToAskMessageTemplate.h
│ │ │ ├── LPPushAskToAskMessageTemplate.m
│ │ │ ├── LPPushMessageTemplate.h
│ │ │ ├── LPPushMessageTemplate.m
│ │ │ ├── LPRegisterForPushMessageTemplate.h
│ │ │ ├── LPRegisterForPushMessageTemplate.m
│ │ │ ├── LPRichInterstitialMessageTemplate.h
│ │ │ ├── LPRichInterstitialMessageTemplate.m
│ │ │ ├── LPWebInterstitialMessageTemplate.h
│ │ │ ├── LPWebInterstitialMessageTemplate.m
│ │ │ ├── ViewControllers
│ │ │ │ ├── LPInterstitialViewController.h
│ │ │ │ ├── LPInterstitialViewController.m
│ │ │ │ ├── LPMessageTemplateUtilities.h
│ │ │ │ ├── LPMessageTemplateUtilities.m
│ │ │ │ ├── LPPopupViewController.h
│ │ │ │ ├── LPPopupViewController.m
│ │ │ │ ├── LPWebInterstitialViewController.h
│ │ │ │ └── LPWebInterstitialViewController.m
│ │ │ └── Views
│ │ │ │ ├── LPHitView.h
│ │ │ │ └── LPHitView.m
│ │ ├── Notifications
│ │ │ ├── LPNotificationsConstants.h
│ │ │ └── Local
│ │ │ │ ├── LPLocalNotificationsManager.h
│ │ │ │ └── LPLocalNotificationsManager.m
│ │ └── Utilities
│ │ │ ├── Encryption
│ │ │ ├── LPAES.h
│ │ │ └── LPAES.m
│ │ │ ├── FileMD5Hash.c
│ │ │ ├── FileMD5Hash.h
│ │ │ ├── LPDatabase.h
│ │ │ ├── LPDatabase.m
│ │ │ ├── LPJSON.h
│ │ │ ├── LPJSON.m
│ │ │ ├── LPKeychainWrapper.h
│ │ │ ├── LPKeychainWrapper.m
│ │ │ ├── LPOperationQueue.h
│ │ │ ├── LPOperationQueue.m
│ │ │ ├── LPSwizzle.h
│ │ │ ├── LPSwizzle.m
│ │ │ ├── LPUtils.h
│ │ │ ├── LPUtils.m
│ │ │ └── Vendor
│ │ │ ├── NSTimer-Blocks
│ │ │ ├── NSTimer+Blocks.h
│ │ │ └── NSTimer+Blocks.m
│ │ │ ├── Reachability
│ │ │ ├── Leanplum_Reachability.h
│ │ │ └── Leanplum_Reachability.m
│ │ │ ├── SocketIO
│ │ │ ├── Leanplum_SocketIO.h
│ │ │ └── Leanplum_SocketIO.m
│ │ │ ├── UniqueIdentifier
│ │ │ ├── NSString+MD5Addition.h
│ │ │ ├── NSString+MD5Addition.m
│ │ │ ├── UIDevice+IdentifierAddition.h
│ │ │ └── UIDevice+IdentifierAddition.m
│ │ │ └── WebSocket
│ │ │ ├── AsyncSocket
│ │ │ ├── Leanplum_AsyncSocket.h
│ │ │ └── Leanplum_AsyncSocket.m
│ │ │ ├── Leanplum_WebSocket+Utils.h
│ │ │ ├── Leanplum_WebSocket+Utils.m
│ │ │ ├── Leanplum_WebSocket.h
│ │ │ └── Leanplum_WebSocket.m
│ ├── ClassesSwift
│ │ ├── Actions
│ │ │ ├── ActionManager+Configuration.swift
│ │ │ ├── ActionManager+Definition.swift
│ │ │ ├── ActionManager+Executor.swift
│ │ │ ├── ActionManager+FileDownload.swift
│ │ │ ├── ActionManager+Processor.swift
│ │ │ ├── ActionManager+Queue.swift
│ │ │ ├── ActionManager+Scheduler.swift
│ │ │ ├── ActionManager+State.swift
│ │ │ ├── ActionManager+Tracking.swift
│ │ │ ├── ActionManager+Triggering.swift
│ │ │ ├── ActionManager.swift
│ │ │ └── Models
│ │ │ │ ├── ActionManager+Action.swift
│ │ │ │ ├── ActionManager+ActionDefinition.swift
│ │ │ │ └── ActionManager+ActionsTrigger.swift
│ │ ├── ApiConfig.swift
│ │ ├── ContentMerger.swift
│ │ ├── Extensions
│ │ │ ├── Bundle+Extensions.swift
│ │ │ ├── Data+EncodedString.swift
│ │ │ ├── Dictionary+Equatable.swift
│ │ │ ├── Dictionary+MapKeys.swift
│ │ │ ├── Dictionary+ValueKeyPath.swift
│ │ │ ├── LPRequestSender+UUID.swift
│ │ │ ├── NSRegularExpression+Matches.swift
│ │ │ ├── Thread+Name.swift
│ │ │ ├── UIUserNotificationSettings+Transform.swift
│ │ │ └── UNNotificationSettings+Transform.swift
│ │ ├── Leanplum.swift
│ │ ├── Migration
│ │ │ ├── LPCTNotificationsManager.swift
│ │ │ ├── MigrationManager+API.swift
│ │ │ ├── MigrationManager+Constants.swift
│ │ │ ├── MigrationManager+ResponseHandler.swift
│ │ │ ├── MigrationManager.swift
│ │ │ ├── MigrationState.swift
│ │ │ └── Wrapper
│ │ │ │ ├── CTWrapper+Utilities.swift
│ │ │ │ ├── CTWrapper.swift
│ │ │ │ ├── IdentityManager.swift
│ │ │ │ └── Wrapper.swift
│ │ ├── Notifications
│ │ │ ├── NSObject+Notifications.swift
│ │ │ ├── NotificationSettings.swift
│ │ │ ├── NotificationsManager+Utilities.swift
│ │ │ ├── NotificationsManager.swift
│ │ │ └── Proxy
│ │ │ │ ├── NotificationsProxy+Disabled.swift
│ │ │ │ ├── NotificationsProxy+Swizzling.swift
│ │ │ │ ├── NotificationsProxy+Utilities.swift
│ │ │ │ ├── NotificationsProxy+iOS9.swift
│ │ │ │ └── NotificationsProxy.swift
│ │ ├── User.swift
│ │ └── Utilities
│ │ │ ├── Logging.swift
│ │ │ ├── PropertyWrappers.swift
│ │ │ ├── UIAlert.swift
│ │ │ ├── Utilities.swift
│ │ │ └── WeakTimer.swift
│ ├── Resources
│ ├── Supporting Files
│ │ ├── Info.plist
│ │ └── Leanplum.modulemap
│ └── include
│ │ ├── FileMD5Hash.h
│ │ ├── LPAES.h
│ │ ├── LPAPIConfig.h
│ │ ├── LPActionArg.h
│ │ ├── LPActionContext-Internal.h
│ │ ├── LPActionContext.h
│ │ ├── LPActionManager.h
│ │ ├── LPAlertMessageTemplate.h
│ │ ├── LPAppIconManager.h
│ │ ├── LPAppRatingMessageTemplate.h
│ │ ├── LPCenterPopupMessageTemplate.h
│ │ ├── LPConfirmMessageTemplate.h
│ │ ├── LPConstants.h
│ │ ├── LPContextualValues.h
│ │ ├── LPCountAggregator.h
│ │ ├── LPDatabase.h
│ │ ├── LPDeferMessageManager.h
│ │ ├── LPEnumConstants.h
│ │ ├── LPEventCallback.h
│ │ ├── LPEventCallbackManager.h
│ │ ├── LPEventDataManager.h
│ │ ├── LPExceptionHandler.h
│ │ ├── LPFeatureFlagManager.h
│ │ ├── LPFeatureFlags.h
│ │ ├── LPFileManager.h
│ │ ├── LPFileTransferManager.h
│ │ ├── LPHitView.h
│ │ ├── LPIconChangeMessageTemplate.h
│ │ ├── LPInbox.h
│ │ ├── LPInternalState.h
│ │ ├── LPInterstitialMessageTemplate.h
│ │ ├── LPInterstitialViewController.h
│ │ ├── LPJSON.h
│ │ ├── LPKeychainWrapper.h
│ │ ├── LPLocalNotificationsHandler.h
│ │ ├── LPLocalNotificationsManager.h
│ │ ├── LPLogManager.h
│ │ ├── LPMessageArchiveData.h
│ │ ├── LPMessageTemplateConstants.h
│ │ ├── LPMessageTemplateProtocol.h
│ │ ├── LPMessageTemplateUtilities.h
│ │ ├── LPMessageTemplates.h
│ │ ├── LPNetworkConstants.h
│ │ ├── LPNetworkEngine.h
│ │ ├── LPNetworkFactory.h
│ │ ├── LPNetworkOperation.h
│ │ ├── LPNetworkProtocol.h
│ │ ├── LPNotificationsConstants.h
│ │ ├── LPNotificationsManager.h
│ │ ├── LPOpenUrlMessageTemplate.h
│ │ ├── LPOperationQueue.h
│ │ ├── LPPopupViewController.h
│ │ ├── LPPushAskToAskMessageTemplate.h
│ │ ├── LPPushMessageTemplate.h
│ │ ├── LPPushNotificationsHandler.h
│ │ ├── LPPushNotificationsManager.h
│ │ ├── LPRegisterDevice.h
│ │ ├── LPRegisterForPushMessageTemplate.h
│ │ ├── LPRequest.h
│ │ ├── LPRequestBatch.h
│ │ ├── LPRequestBatchFactory.h
│ │ ├── LPRequestFactory.h
│ │ ├── LPRequestSender.h
│ │ ├── LPRequestSenderTimer.h
│ │ ├── LPRequestUUIDHelper.h
│ │ ├── LPResponse.h
│ │ ├── LPRevenueManager.h
│ │ ├── LPRichInterstitialMessageTemplate.h
│ │ ├── LPSecuredVars.h
│ │ ├── LPSwizzle.h
│ │ ├── LPUIAlert.h
│ │ ├── LPUtils.h
│ │ ├── LPVar-Internal.h
│ │ ├── LPVar.h
│ │ ├── LPVarCache.h
│ │ ├── LPWebInterstitialMessageTemplate.h
│ │ ├── LPWebInterstitialViewController.h
│ │ ├── Leanplum.h
│ │ ├── LeanplumCompatibility.h
│ │ ├── LeanplumInternal.h
│ │ ├── LeanplumSDK.h
│ │ ├── LeanplumSocket.h
│ │ ├── Leanplum_AsyncSocket.h
│ │ ├── Leanplum_Reachability.h
│ │ ├── Leanplum_SocketIO.h
│ │ ├── Leanplum_WebSocket.h
│ │ ├── NSString+MD5Addition.h
│ │ ├── NSTimer+Blocks.h
│ │ └── UIDevice+IdentifierAddition.h
└── LeanplumSDKBundle
│ ├── Resources
│ ├── Assets.xcassets
│ │ ├── Buttons
│ │ │ ├── Contents.json
│ │ │ └── close.imageset
│ │ │ │ ├── Contents.json
│ │ │ │ ├── close.png
│ │ │ │ ├── close@2x.png
│ │ │ │ └── close@3x.png
│ │ └── Contents.json
│ ├── Interstitial.storyboard
│ ├── Popup.storyboard
│ ├── PrivacyInfo.xcprivacy
│ └── WebInterstitial.storyboard
│ └── Supporting Files
│ └── Info.plist
├── LeanplumSDKApp
├── LeanplumSDKApp.xcodeproj
│ ├── project.pbxproj
│ ├── project.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcshareddata
│ │ │ └── IDEWorkspaceChecks.plist
│ └── xcshareddata
│ │ └── xcschemes
│ │ └── LeanplumSDKApp.xcscheme
├── LeanplumSDKApp
│ ├── Classes
│ │ ├── AppDelegate.swift
│ │ ├── SceneDelegate.swift
│ │ └── ViewController.swift
│ └── Supporting Files
│ │ ├── Assets.xcassets
│ │ ├── AccentColor.colorset
│ │ │ └── Contents.json
│ │ ├── AppIcon.appiconset
│ │ │ └── Contents.json
│ │ └── Contents.json
│ │ ├── Base.lproj
│ │ ├── LaunchScreen.storyboard
│ │ └── Main.storyboard
│ │ └── Info.plist
└── LeanplumSDKTests
│ ├── Classes
│ ├── Actions
│ │ ├── ActionManagerDownloadTest.swift
│ │ └── ActionManagerTest.swift
│ ├── ContentMergerTest.swift
│ ├── DictionaryValueKeyPathTest.swift
│ ├── ExceptionsTest.m
│ ├── Extensions
│ │ ├── LPNetworkEngine+Category.h
│ │ ├── LPNetworkEngine+Category.m
│ │ ├── LPNetworkOperation+Category.h
│ │ ├── LPNetworkOperation+Category.m
│ │ ├── LPOpenUrlMessageTemplate+Extenstion.h
│ │ ├── LPRequest+Extension.h
│ │ ├── LPRequest+Extension.m
│ │ ├── LPRequestFactory+Extension.h
│ │ ├── LPRequestFactory+Extension.m
│ │ ├── LPRequestSender+Categories.h
│ │ ├── LPRequestSender+Categories.m
│ │ ├── LPVarCache+Extensions.h
│ │ ├── Leanplum+Extensions.h
│ │ ├── LeanplumReachability+Category.h
│ │ └── LeanplumReachability+Category.m
│ ├── LPActionContextTest.m
│ ├── LPActionTriggerManagerTest.m
│ ├── LPAppIconManagerTest.m
│ ├── LPCountAggregatorTest.m
│ ├── LPEventCallbackManagerTest.m
│ ├── LPEventDataManagerTest.m
│ ├── LPFeatureFlagManagerTest.m
│ ├── LPFileManagerTest.m
│ ├── LPInboxTest.m
│ ├── LPJSONTest.m
│ ├── LPLocalCapsTest.m
│ ├── LPNetworkOperationTest.m
│ ├── LPNotificationsHelperTest.m
│ ├── LPOpenUrlMessageTemplateTest.m
│ ├── LPRequestBatchTest.m
│ ├── LPRequestFactoryTest.m
│ ├── LPRequestSenderTest.m
│ ├── LPRequestSenderTimerTest.m
│ ├── LPRequestTest.m
│ ├── LPSecuredVarsTest.m
│ ├── LPUtilsTest.m
│ ├── LPWebInterstitialViewControllerTest.m
│ ├── LeanplumSDKTests-Bridging-Header.h
│ ├── LeanplumTest.m
│ ├── Leanplum_WebSocketTest.m
│ ├── LocationAndBeacons
│ │ └── GeofencingTest.m
│ ├── MessagesTest.m
│ ├── Migration
│ │ ├── CTWrapperTest.swift
│ │ ├── IdentityManagerMocks.swift
│ │ ├── IdentityManagerTest.swift
│ │ ├── Migration+Extensions.swift
│ │ └── MigrationResponsesTest.swift
│ ├── Notifications
│ │ ├── LeanplumNotificationsManagerUtilsTest.swift
│ │ ├── NotificationsManagerMock.swift
│ │ ├── NotificationsManagerTest.swift
│ │ ├── NotificationsProxyTest.swift
│ │ ├── NotificationsProxyiOS9Test.swift
│ │ └── PushNotificationSettingsTest.swift
│ ├── Utilities
│ │ ├── LeanplumHelper.h
│ │ ├── LeanplumHelper.m
│ │ └── NotificationTestHelper.swift
│ └── UtilitiesTest.swift
│ ├── Resources
│ ├── Files
│ │ ├── GoldIcon.png
│ │ ├── MainAppIcon.png
│ │ ├── test.file
│ │ └── test.pdf
│ ├── Responses
│ │ ├── Malformed
│ │ │ ├── malformed_simple_start_response.json
│ │ │ └── malformed_track_event_response.json
│ │ ├── action_response.json
│ │ ├── batch_response.json
│ │ ├── change_host_response.json
│ │ ├── complex_start_response.json
│ │ ├── get_migrate_state_response.json
│ │ ├── get_migrate_state_response_error.json
│ │ ├── get_migrate_state_response_missing.json
│ │ ├── local_caps_day_response.json
│ │ ├── local_caps_response.json
│ │ ├── local_caps_session_response.json
│ │ ├── local_caps_week_response.json
│ │ ├── newsfeed_response.json
│ │ ├── registration_response.json
│ │ ├── secured_vars_empty_response.json
│ │ ├── secured_vars_no_sign_response.json
│ │ ├── secured_vars_response.json
│ │ ├── simple_start_response.json
│ │ ├── start_variables_response.json
│ │ ├── start_with_variant_debug_info_response.json
│ │ ├── state_response.json
│ │ ├── track_event_response.json
│ │ ├── variables_response.json
│ │ ├── variables_with_newsfeed_response.json
│ │ └── variants_response.json
│ └── TestData
│ │ ├── ChainedMessage.json
│ │ ├── DifferentPriorities1.json
│ │ ├── DifferentPriorities2.json
│ │ ├── DifferentPrioritiesWithMissingValues.json
│ │ ├── NoPriorities.json
│ │ ├── SingleMessage.json
│ │ ├── TiedPriorities1.json
│ │ ├── TiedPriorities2.json
│ │ ├── TiedPrioritiesDelay.json
│ │ ├── TiedPrioritiesDifferentDelay.json
│ │ ├── regionData.json
│ │ └── sample_action_notification.json
│ └── Supporting Files
│ ├── Info.plist
│ └── Leanplum-Info.plist
├── LeanplumSDKLocation
├── LeanplumSDKLocation.xcodeproj
│ └── project.pbxproj
└── LeanplumSDKLocation
│ ├── Classes
│ ├── LPLocationManager.h
│ └── LPLocationManager.m
│ ├── PrivacyInfo.xcprivacy
│ └── include
│ └── LPLocationManager.h
├── LeanplumTargetWrapper
└── Dummy.swift
├── Makefile
├── Package.swift
├── Podfile
├── README.md
├── Tools
├── build.sh
├── push.sh
├── pushSPM.sh
├── triggerLocation.sh
├── triggerRN.sh
├── triggerRondo.sh
└── verifyTag.sh
└── sdk-version.txt
/.github/ISSUE_TEMPLATE.md:
--------------------------------------------------------------------------------
1 | ## Expected Behavior
2 |
3 |
4 | ## Actual Behavior
5 |
6 |
7 | ## Steps to Reproduce the Problem
8 |
9 | 1.
10 | 1.
11 | 1.
12 |
13 | ## Specifications
14 |
15 | - Version:
16 | - Platform:
17 | - Subsystem:
18 |
19 |
--------------------------------------------------------------------------------
/.github/PULL_REQUEST_TEMPLATE.md:
--------------------------------------------------------------------------------
1 | What | Where/Who
2 | ------------------|----------------------------------------
3 | JIRA Issue | [JIRA_TICKET_ID](https://leanplum.atlassian.net/browse/JIRA_TICKET_ID)
4 | People Involved | @colleague1, @colleague2
5 |
6 | [Notes on PR descriptions](https://leanplum.atlassian.net/wiki/spaces/PR/pages/288424408/Creating+a+GitHub+Pull+Request)
7 |
8 | ## Background
9 |
10 | ## Implementation
11 |
12 | ## Testing steps
13 |
14 | ## Is this change backwards-compatible?
15 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## macOS
2 | *.DS_Store
3 | .AppleDouble
4 | .LSOverride
5 |
6 | # Icon must end with two \r
7 | Icon
8 |
9 |
10 | # Thumbnails
11 | ._*
12 |
13 | # Files that might appear in the root of a volume
14 | .DocumentRevisions-V100
15 | .fseventsd
16 | .Spotlight-V100
17 | .TemporaryItems
18 | .Trashes
19 | .VolumeIcon.icns
20 | .com.apple.timemachine.donotpresent
21 |
22 | # Directories potentially created on remote AFP share
23 | .AppleDB
24 | .AppleDesktop
25 | Network Trash Folder
26 | Temporary Items
27 | .apdisk
28 | .build
29 |
30 | ## Windows
31 | # Windows thumbnail cache files
32 | Thumbs.db
33 | ehthumbs.db
34 | ehthumbs_vista.db
35 |
36 | # Folder config file
37 | Desktop.ini
38 |
39 | # Recycle Bin used on file shares
40 | $RECYCLE.BIN/
41 |
42 | # Windows Installer files
43 | *.cab
44 | *.msi
45 | *.msm
46 | *.msp
47 |
48 | # Windows shortcuts
49 | *.lnk
50 |
51 | ## Linux
52 | *~
53 |
54 | # temporary files which can be created if a process still has a handle open of a deleted file
55 | .fuse_hidden*
56 |
57 | # KDE directory preferences
58 | .directory
59 |
60 | # Linux trash folder which might appear on any partition or disk
61 | .Trash-*
62 |
63 | # .nfs files are created when an open file is removed but is still being accessed
64 | .nfs*
65 |
66 | ## Objective-C
67 |
68 | # OS X
69 | .DS_Store
70 |
71 | # Xcode
72 | build/
73 | *.pbxuser
74 | !default.pbxuser
75 | *.mode1v3
76 | !default.mode1v3
77 | *.mode2v3
78 | !default.mode2v3
79 | *.perspectivev3
80 | !default.perspectivev3
81 | xcuserdata/
82 | *.xccheckout
83 | profile
84 | *.moved-aside
85 | DerivedData
86 | *.hmap
87 | *.ipa
88 |
89 | # Bundler
90 | .bundle
91 |
92 | Carthage
93 | Pods/
94 |
95 | ## Custom
96 |
97 | Release
98 | Podfile.lock
99 | coverage-report/
100 | DerivedData/
101 | *.zip
102 |
103 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | # Build only if commit is tagged or PR is opened/updated
2 | if: |
3 | ((tag IS present) OR (type = pull_request)) AND \
4 | ((commit_message != 'update spm') AND (sender != env(GITHUB_NAME)))
5 |
6 | language: objective-c
7 | osx_image: xcode14
8 |
9 | xcode_workspace: Leanplum.xcworkspace
10 | xcode_scheme: LeanplumSDKApp
11 | xcode_destination: platform=iOS Simulator,OS=16.0,name=iPhone 14
12 |
13 | cache: cocoapods
14 | podfile: Podfile
15 | before_install:
16 | - gem install cocoapods # Since Travis is not always on latest version
17 | - pod install
18 |
19 | before_deploy:
20 | - ./Tools/verifyTag.sh
21 | - >
22 | if ! [ "$BUILD_ONCE" ]; then
23 | export BUILD_ONCE=1;
24 | ./Tools/build.sh;
25 | fi
26 |
27 | after_deploy:
28 | >-
29 | if ! [ "$AFTER_DEPLOY_RUN" ]; then
30 | export AFTER_DEPLOY_RUN=1;
31 | ./Tools/triggerRondo.sh;
32 | version=`cat sdk-version.txt`; if [[ $version != *"beta"* ]]; then ./Tools/triggerRN.sh; fi;
33 | fi
34 |
35 | deploy:
36 | - provider: script
37 | skip_cleanup: true
38 | script: ./Tools/push.sh
39 | on:
40 | tags: true
41 | - provider: releases
42 | skip_cleanup: true
43 | api_key: $GITHUB_TOKEN
44 | file:
45 | - Leanplum.zip
46 | - Release/static/Leanplum.xcframework.zip
47 | draft: true
48 | on:
49 | tags: true
50 | - provider: script
51 | skip_cleanup: true
52 | script: ./Tools/pushSPM.sh
53 | on:
54 | tags: true
55 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # How to Contribute
2 |
3 | While our SDKs are open source, we currently do **NOT** accept any feature request PRs.
4 | In some rare cases, we may accept bug fixes but there is absolutely no commitment or expectation for that and you should not rely on that in any way.
5 | If you want to request a feature or report a bug, please contact Leanplum Support.
6 |
7 | Here are some important resources:
8 |
9 | * [Leanplum Docs](http://leanplum.com/docs) The official Leanplum docs.
10 | * Leanplum Support: Get help at support@leanplum.com.
11 |
12 | ## Submitting changes
13 |
14 | Please consider following guidelines before creating a PR:
15 |
16 | - Confirm the intention and design of your change by reaching out to your Customer Success Manager.
17 | - Start creating your pull request from `master` branch
18 | - Please send a GitHub Pull Request with a clear list of what you've done (read more about [pull requests](https://help.github.com/articles/about-pull-requests/)).
19 | - Add unit tests for the code that you have touched.
20 | - Please follow the existing coding conventions (which are mostly standard of the default IDE).
21 | - Make sure all of your commits are atomic (one feature per commit).
22 | - Please adhere to the conventional changelog commit style: https://github.com/commitizen/cz-cli That allows us to easily create change logs.
23 |
--------------------------------------------------------------------------------
/Leanplum-iOS-Location.podspec:
--------------------------------------------------------------------------------
1 | Pod::Spec.new do |s|
2 | s.name = 'Leanplum-iOS-Location'
3 | version = `cat sdk-version.txt`
4 | s.version = version
5 | s.summary = 'Supplementary Leanplum pod to provide geofencing support.'
6 | s.description = 'Use LeanplumLocationAndBeacons instead if you also want support for iBeacons.'
7 | s.homepage = 'https://www.leanplum.com'
8 | s.license = { :type => 'Commercial', :text => 'See https://www.leanplum.com/tos' }
9 | s.author = { 'Leanplum' => 'support@leanplum.com' }
10 | s.social_media_url = 'https://twitter.com/leanplum'
11 | s.platform = :ios, '9.0'
12 | s.requires_arc = true
13 | s.source = { :git => 'https://github.com/Leanplum/Leanplum-iOS-SDK.git', :tag => s.version.to_s}
14 | s.source_files = 'LeanplumSDKLocation/LeanplumSDKLocation/Classes/**/*'
15 | s.resource_bundles = {'LeanplumLocation' => ['LeanplumSDKLocation/LeanplumSDKLocation/*.{xcprivacy}']}
16 | s.frameworks = 'CoreLocation'
17 | s.documentation_url = 'https://docs.leanplum.com/'
18 | s.dependency 'Leanplum-iOS-SDK', "~> 6.0"
19 | s.module_name = 'LeanplumLocation'
20 | s.swift_versions = '5.0'
21 | end
22 |
--------------------------------------------------------------------------------
/Leanplum-iOS-LocationAndBeacons.podspec:
--------------------------------------------------------------------------------
1 | Pod::Spec.new do |s|
2 | s.name = 'Leanplum-iOS-LocationAndBeacons'
3 | version = `cat sdk-version.txt`
4 | s.version = version
5 | s.summary = 'Supplementary Leanplum pod for geofencing and iBeacons support.'
6 | s.description = 'Use LeanplumLocation instead if you do not need support for iBeacons.'
7 | s.homepage = 'https://www.leanplum.com'
8 | s.license = { :type => 'Commercial', :text => 'See https://www.leanplum.com/tos' }
9 | s.author = { 'Leanplum' => 'support@leanplum.com' }
10 | s.social_media_url = 'https://twitter.com/leanplum'
11 | s.platform = :ios, '9.0'
12 | s.requires_arc = true
13 | s.source = { :git => 'https://github.com/Leanplum/Leanplum-iOS-SDK.git', :tag => s.version.to_s}
14 | s.source_files = 'LeanplumSDKLocation/LeanplumSDKLocation/Classes/**/*'
15 | s.resource_bundles = {'LeanplumLocation' => ['LeanplumSDKLocation/LeanplumSDKLocation/*.{xcprivacy}']}
16 | s.frameworks = 'CoreLocation'
17 | s.documentation_url = 'https://docs.leanplum.com/'
18 | s.dependency 'Leanplum-iOS-SDK', "~> 6.0"
19 | s.module_name = 'LeanplumLocationAndBeacons'
20 | s.pod_target_xcconfig = { 'GCC_PREPROCESSOR_DEFINITIONS' => 'LP_BEACON=1' }
21 | s.swift_versions = '5.0'
22 | end
23 |
--------------------------------------------------------------------------------
/Leanplum-iOS-SDK.podspec:
--------------------------------------------------------------------------------
1 | #
2 | # Be sure to run `pod lib lint Leanplum-SDK.podspec' to ensure this is a
3 | # valid spec before submitting.
4 | #
5 | # Any lines starting with a # are optional, but their use is encouraged
6 | # To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html
7 | #
8 |
9 | Pod::Spec.new do |s|
10 | s.name = 'Leanplum-iOS-SDK'
11 | version = `cat sdk-version.txt`
12 | s.version = version
13 | s.summary = 'Mobile Marketing Platform. Integrated. ROI Engine.'
14 | s.description = <<-DESC
15 | Leanplum’s integrated solution delivers meaningful engagement across messaging and the in-app
16 | experience. We offer Messaging, Automation, App Editing, Personalization, A/B Testing, and
17 | Analytics.
18 | DESC
19 | s.homepage = 'https://www.leanplum.com'
20 | s.license = { :type => 'Commercial', :text => 'See https://www.leanplum.com/tos' }
21 | s.author = { 'Leanplum' => 'support@leanplum.com' }
22 | s.social_media_url = 'https://twitter.com/leanplum'
23 | s.requires_arc = true
24 | s.source = { :git => 'https://github.com/Leanplum/Leanplum-iOS-SDK.git', :tag => s.version.to_s }
25 | s.ios.deployment_target = '9.0'
26 | s.frameworks = 'CFNetwork', 'Foundation', 'Security', 'SystemConfiguration', 'UIKit'
27 | s.weak_frameworks = 'AdSupport', 'StoreKit'
28 | s.library = 'sqlite3'
29 | s.documentation_url = 'https://docs.leanplum.com/'
30 | s.source_files = 'LeanplumSDK/LeanplumSDK/Classes/**/*', 'LeanplumSDK/LeanplumSDK/ClassesSwift/**/*'
31 | s.module_name = 'Leanplum'
32 | s.resource_bundle = {
33 | 'Leanplum-iOS-SDK' => 'LeanplumSDK/LeanplumSDKBundle/Resources/**/*'
34 | }
35 | s.dependency 'CleverTap-iOS-SDK', '~> 7.1'
36 | s.swift_version = '5.0'
37 | end
38 |
39 |
--------------------------------------------------------------------------------
/Leanplum.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/Leanplum.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
12 |
13 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/Leanplum.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Leanplum.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PreviewsEnabled
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/Classes/CleverTapInstanceCallback.h:
--------------------------------------------------------------------------------
1 | //
2 | // CleverTapInstanceCallback.h
3 | // LeanplumSDK
4 | //
5 | // Created by Nikola Zagorchev on 21.11.22.
6 | // Copyright © 2022 Leanplum. All rights reserved.
7 |
8 | #import
9 | // Forward declaration for CleverTap instance
10 | @class CleverTap;
11 |
12 | NS_ASSUME_NONNULL_BEGIN
13 |
14 | typedef void (^LeanplumCleverTapInstanceBlock)(CleverTap* instance);
15 |
16 | @interface CleverTapInstanceCallback : NSObject
17 |
18 | - (instancetype)init NS_UNAVAILABLE;
19 | - (instancetype)initWithCallback:(LeanplumCleverTapInstanceBlock)block;
20 |
21 | - (void)onInstance:(CleverTap *)instance;
22 |
23 | @end
24 |
25 | NS_ASSUME_NONNULL_END
26 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/Classes/CleverTapInstanceCallback.m:
--------------------------------------------------------------------------------
1 | //
2 | // CleverTapInstanceCallback.m
3 | // LeanplumSDK
4 | //
5 | // Created by Nikola Zagorchev on 21.11.22.
6 | // Copyright © 2022 Leanplum. All rights reserved.
7 |
8 | #import "CleverTapInstanceCallback.h"
9 |
10 | @interface CleverTapInstanceCallback()
11 | @property (atomic, nonnull) LeanplumCleverTapInstanceBlock block;
12 | @end
13 |
14 | @implementation CleverTapInstanceCallback
15 |
16 | - (instancetype)initWithCallback:(LeanplumCleverTapInstanceBlock)block
17 | {
18 | self = [super init];
19 | if (self) {
20 | self.block = block;
21 | }
22 | return self;
23 | }
24 |
25 | - (void)onInstance:(CleverTap *)instance
26 | {
27 | self.block(instance);
28 | }
29 |
30 | @end
31 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/Classes/Features/Actions/LPActionContext-Internal.h:
--------------------------------------------------------------------------------
1 | //
2 | // LPActionContext.h
3 | // Leanplum-iOS-SDK-source
4 | //
5 | // Created by Mayank Sanganeria on 4/24/18.
6 | //
7 |
8 | #import "LeanplumInternal.h"
9 | #import "LPActionContext.h"
10 |
11 | NS_ASSUME_NONNULL_BEGIN
12 |
13 | @class LPContextualValues;
14 |
15 | @interface LPActionContext ()
16 |
17 | - (instancetype)init:(NSString *)name
18 | args:(NSDictionary *)args
19 | messageId:(NSString *)messageId
20 | preventRealtimeUpdating:(BOOL)preventRealtimeUpdating;
21 |
22 | + (LPActionContext *)actionContextWithName:(NSString *)name
23 | args:(nullable NSDictionary *)args
24 | messageId:(nullable NSString *)messageId;
25 |
26 | + (LPActionContext *)actionContextWithName:(NSString *)name
27 | args:(nullable NSDictionary *)args
28 | messageId:(nullable NSString *)messageId
29 | originalMessageId:(nullable NSString *)originalMessageId
30 | priority:(nullable NSNumber *)priority;
31 |
32 | @property (readonly, strong) NSString *name;
33 | @property (readonly, strong) NSString *originalMessageId;
34 | @property (readonly, strong) NSNumber *priority;
35 | @property (readonly) int contentVersion;
36 | @property (readonly, strong, nullable) NSString *key;
37 | @property (assign) BOOL preventRealtimeUpdating;
38 | @property (nonatomic, assign) BOOL isRooted;
39 | @property (nonatomic, assign) BOOL isPreview;
40 | @property (nonatomic, strong) LPContextualValues *contextualValues;
41 |
42 | @property (nonatomic, strong, nullable) void (^actionDidExecute)(LPActionContext *context);
43 | @property (nonatomic, strong, nullable) void (^actionDidDismiss)(void);
44 |
45 | - (void)maybeDownloadFiles;
46 | - (void)preventRealtimeUpdating;
47 | + (void)sortByPriority:(NSMutableArray *)actionContexts;
48 |
49 | @end
50 |
51 | NS_ASSUME_NONNULL_END
52 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/Classes/Features/Actions/LPActionContextNotification.h:
--------------------------------------------------------------------------------
1 | //
2 | // LPActionContextNotification.h
3 | // LeanplumSDK
4 | //
5 | // Created by Nikola Zagorchev on 4.08.22.
6 | //
7 |
8 | #import
9 | #import "LPActionContext.h"
10 |
11 | NS_ASSUME_NONNULL_BEGIN
12 |
13 | /**
14 | * LPActionContext subclass used for presenting Push Notification as a Confirm In-app message
15 | * when Notification is received when App is in foreground.
16 | * Do NOT use except for the above-mentioned use case.
17 | */
18 | NS_SWIFT_NAME(ActionContextNotification)
19 | @interface LPActionContextNotification : LPActionContext {
20 | }
21 |
22 | - (void)runTrackedActionNamed:(NSString *)name;
23 | @end
24 |
25 | NS_ASSUME_NONNULL_END
26 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/Classes/Features/Actions/LPActionContextNotification.m:
--------------------------------------------------------------------------------
1 | //
2 | // LPActionContextNotification.m
3 | // LeanplumSDK
4 | //
5 | // Created by Nikola Zagorchev on 4.08.22.
6 | //
7 |
8 | #import "LPActionContextNotification.h"
9 | #import "LPActionContext-Internal.h"
10 | #import "LPMessageTemplateConstants.h"
11 |
12 | @implementation LPActionContextNotification
13 |
14 | - (void)runTrackedActionNamed:(NSString *)name
15 | {
16 | if ([name isEqualToString:LPMT_ARG_ACCEPT_ACTION]) {
17 | [super runTrackedActionNamed:LP_VALUE_DEFAULT_PUSH_ACTION];
18 | return;
19 | }
20 |
21 | [super runTrackedActionNamed:name];
22 | }
23 |
24 | - (LPActionContext *)parentContext {
25 | /**
26 | * Return a parent context
27 | * so action is treated as embedded action by the ActionManager
28 | * hence no impression is tracked.
29 | *
30 | * No impression for this context should be tracked,
31 | * otherwise it will result to another Sent event of the Push Notification.
32 | */
33 | NSString *name = NSStringFromClass([self class]);
34 | return [LPActionContext actionContextWithName:name args:@{} messageId:nil];
35 | }
36 |
37 | @end
38 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/Classes/Features/Events/LPEventCallback.h:
--------------------------------------------------------------------------------
1 | //
2 | // LPEventCallbackManager.h
3 | // Leanplum
4 | //
5 | // Created by Alexis Oyama on 7/11/17.
6 | // Copyright (c) 2017 Leanplum, Inc. All rights reserved.
7 | //
8 | // Licensed to the Apache Software Foundation (ASF) under one
9 | // or more contributor license agreements. See the NOTICE file
10 | // distributed with this work for additional information
11 | // regarding copyright ownership. The ASF licenses this file
12 | // to you under the Apache License, Version 2.0 (the "License");
13 | // you may not use this file except in compliance with the License.
14 | // You may obtain a copy of the License at
15 | //
16 | // http://www.apache.org/licenses/LICENSE-2.0
17 | //
18 | // Unless required by applicable law or agreed to in writing,
19 | // software distributed under the License is distributed on an
20 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21 | // KIND, either express or implied. See the License for the
22 | // specific language governing permissions and limitations
23 | // under the License.
24 |
25 | #import
26 | #import "LPNetworkProtocol.h"
27 |
28 | NS_ASSUME_NONNULL_BEGIN
29 |
30 | @interface LPEventCallback : NSObject
31 |
32 | @property (nonatomic, strong) LPNetworkResponseBlock responseBlock;
33 | @property (nonatomic, strong) LPNetworkErrorBlock errorBlock;
34 |
35 | - (id)initWithResponseBlock:(LPNetworkResponseBlock)responseBlock
36 | errorBlock:(LPNetworkErrorBlock)errorBlock;
37 |
38 | /*
39 | * Invoke response callback.
40 | */
41 | - (void)invokeResponseWithOperation:(id)operation
42 | response:(id)response;
43 |
44 | /*
45 | * Invoke error callback.
46 | */
47 | - (void)invokeError:(NSError *)error;
48 |
49 | @end
50 |
51 | NS_ASSUME_NONNULL_END
52 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/Classes/Features/Events/LPEventDataManager.h:
--------------------------------------------------------------------------------
1 | //
2 | // LPEventDataManager.h
3 | // Leanplum
4 | //
5 | // Created by Alexis Oyama on 6/9/17.
6 | // Copyright (c) 2017 Leanplum, Inc. All rights reserved.
7 | //
8 | // Licensed to the Apache Software Foundation (ASF) under one
9 | // or more contributor license agreements. See the NOTICE file
10 | // distributed with this work for additional information
11 | // regarding copyright ownership. The ASF licenses this file
12 | // to you under the Apache License, Version 2.0 (the "License");
13 | // you may not use this file except in compliance with the License.
14 | // You may obtain a copy of the License at
15 | //
16 | // http://www.apache.org/licenses/LICENSE-2.0
17 | //
18 | // Unless required by applicable law or agreed to in writing,
19 | // software distributed under the License is distributed on an
20 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21 | // KIND, either express or implied. See the License for the
22 | // specific language governing permissions and limitations
23 | // under the License.
24 |
25 | #import
26 |
27 | NS_ASSUME_NONNULL_BEGIN
28 |
29 | @interface LPEventDataManager : NSObject
30 |
31 | /**
32 | * Add event to database.
33 | */
34 | + (void)addEvent:(NSDictionary *)event;
35 |
36 | /**
37 | * Add multiple events to database.
38 | */
39 | + (void)addEvents:(NSArray *)events;
40 |
41 | /**
42 | * Fetch events with limit.
43 | * Usually you pass the maximum events server can handle.
44 | */
45 | + (NSArray *)eventsWithLimit:(NSInteger)limit;
46 |
47 | /**
48 | * Delete first X events using limit.
49 | */
50 | + (void)deleteEventsWithLimit:(NSInteger)limit;
51 |
52 | /**
53 | * Returns the number of total events stored.
54 | */
55 | + (NSInteger)count;
56 |
57 | @end
58 |
59 | NS_ASSUME_NONNULL_END
60 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/Classes/Features/Variables/LPSecuredVars.h:
--------------------------------------------------------------------------------
1 | //
2 | // LPSecuredVars.h
3 | // Leanplum-iOS-SDK
4 | //
5 | // Created by Dejan Krstevski on 5/31/21.
6 | //
7 |
8 | #import
9 |
10 | NS_ASSUME_NONNULL_BEGIN
11 |
12 | @interface LPSecuredVars : NSObject
13 |
14 | - (instancetype)initWithJson:(NSString*)json andSignature:(NSString*)signature;
15 | - (NSString *)varsJson;
16 | - (NSString *)varsSignature;
17 |
18 | @end
19 |
20 | NS_ASSUME_NONNULL_END
21 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/Classes/Features/Variables/LPSecuredVars.m:
--------------------------------------------------------------------------------
1 | //
2 | // LPSecuredVars.m
3 | // Leanplum-iOS-SDK
4 | //
5 | // Created by Dejan Krstevski on 5/31/21.
6 | //
7 |
8 | #import "LPSecuredVars.h"
9 | #import "LeanplumInternal.h"
10 |
11 | @interface LPSecuredVars()
12 | @property (nonatomic, retain) NSString *json;
13 | @property (nonatomic, retain) NSString *signature;
14 | @end
15 |
16 | @implementation LPSecuredVars
17 |
18 | - (instancetype)initWithJson:(NSString*)json andSignature:(NSString*)signature
19 | {
20 | self = [super init];
21 | if (self) {
22 | _json = json;
23 | _signature = signature;
24 | }
25 | return self;
26 | }
27 |
28 | - (NSString *)varsJson
29 | {
30 | return self.json;
31 | }
32 |
33 | - (NSString *)varsSignature
34 | {
35 | return self.signature;
36 | }
37 |
38 | @end
39 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/Classes/Features/Variables/LPVar-Internal.h:
--------------------------------------------------------------------------------
1 | //
2 | // LPVar.h
3 | // Leanplum-iOS-SDK-source
4 | //
5 | // Created by Mayank Sanganeria on 4/24/18.
6 | //
7 |
8 | #import "LeanplumInternal.h"
9 |
10 | NS_ASSUME_NONNULL_BEGIN
11 |
12 | @interface LPVar ()
13 |
14 | - (instancetype)initWithName:(NSString *)name
15 | withComponents:(NSArray *)components
16 | withDefaultValue:(NSObject *)defaultValue
17 | withKind:(NSString *)kind;
18 |
19 | @property (readonly) BOOL isInternal;
20 | @property (readonly, strong) NSString *name;
21 | @property (readonly, strong) NSArray *nameComponents;
22 | @property (readonly) BOOL hadStarted;
23 | @property (readonly, strong) NSString *kind;
24 | @property (readonly, strong) NSMutableArray *fileReadyBlocks;
25 | @property (readonly, strong) NSMutableArray *valueChangedBlocks;
26 | @property (readonly) BOOL fileIsPending;
27 | @property (nonatomic, unsafe_unretained, nullable) id delegate;
28 | @property (readonly) BOOL hasChanged;
29 |
30 | - (void) update;
31 | - (void) cacheComputedValues;
32 | - (void) triggerFileIsReady;
33 | - (void) triggerValueChanged;
34 |
35 | +(BOOL)printedCallbackWarning;
36 | +(void)setPrintedCallbackWarning:(BOOL)newPrintedCallbackWarning;
37 |
38 | @end
39 |
40 | NS_ASSUME_NONNULL_END
41 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/Classes/Internal/FeatureFlag/LPFeatureFlagManager.h:
--------------------------------------------------------------------------------
1 | //
2 | // LPFeatureFlagManager.h
3 | // Leanplum-iOS-SDK-source
4 | //
5 | // Created by Mayank Sanganeria on 7/25/18.
6 | //
7 |
8 | #import
9 | #import "LPFeatureFlags.h"
10 |
11 | @interface LPFeatureFlagManager : NSObject
12 |
13 | @property (nonatomic, strong, nullable) NSSet * enabledFeatureFlags;
14 |
15 | + (nonnull instancetype)sharedManager;
16 |
17 | - (BOOL)isFeatureFlagEnabled:(nonnull NSString *)featureFlagName;
18 |
19 | @end
20 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/Classes/Internal/FeatureFlag/LPFeatureFlagManager.m:
--------------------------------------------------------------------------------
1 | //
2 | // LPFeatureFlagManager.m
3 | // Leanplum-iOS-SDK-source
4 | //
5 | // Created by Mayank Sanganeria on 7/25/18.
6 | //
7 |
8 | #import "LPFeatureFlagManager.h"
9 | #import "LPCountAggregator.h"
10 |
11 | @implementation LPFeatureFlagManager
12 |
13 | static LPFeatureFlagManager *sharedFeatureFlagManager = nil;
14 | static dispatch_once_t leanplum_onceToken;
15 |
16 | + (instancetype)sharedManager {
17 | dispatch_once(&leanplum_onceToken, ^{
18 | sharedFeatureFlagManager = [[self alloc] init];
19 | });
20 | return sharedFeatureFlagManager;
21 | }
22 |
23 | - (BOOL)isFeatureFlagEnabled:(nonnull NSString *)featureFlagName {
24 | [[LPCountAggregator sharedAggregator] incrementCount:@"is_feature_flag_enabled"];
25 | return [self.enabledFeatureFlags containsObject:featureFlagName];
26 | }
27 |
28 | @end
29 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/Classes/Internal/FeatureFlag/LPFeatureFlags.h:
--------------------------------------------------------------------------------
1 | //
2 | // LPFeatureFlags.h
3 | // Pods
4 | //
5 | // Created by Mayank Sanganeria on 8/30/18.
6 | //
7 |
8 | #ifndef LPFeatureFlags_h
9 | #define LPFeatureFlags_h
10 |
11 | #define LP_FEATURE_FLAG_REQUEST_REFACTOR @"request_refactor"
12 |
13 | #endif /* LPFeatureFlags_h */
14 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/Classes/Internal/LPContextualValues.h:
--------------------------------------------------------------------------------
1 | //
2 | // LPContextualValues.h
3 | // Leanplum
4 | //
5 | // Created by Andrew First on 9/12/13.
6 | // Copyright (c) 2013 Leanplum, Inc. All rights reserved.
7 | //
8 | // Licensed to the Apache Software Foundation (ASF) under one
9 | // or more contributor license agreements. See the NOTICE file
10 | // distributed with this work for additional information
11 | // regarding copyright ownership. The ASF licenses this file
12 | // to you under the Apache License, Version 2.0 (the "License");
13 | // you may not use this file except in compliance with the License.
14 | // You may obtain a copy of the License at
15 | //
16 | // http://www.apache.org/licenses/LICENSE-2.0
17 | //
18 | // Unless required by applicable law or agreed to in writing,
19 | // software distributed under the License is distributed on an
20 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21 | // KIND, either express or implied. See the License for the
22 | // specific language governing permissions and limitations
23 | // under the License.
24 |
25 | #import "Leanplum.h"
26 |
27 | #import
28 | #import
29 |
30 | @interface LPContextualValues : NSObject
31 |
32 | @property (nonatomic) NSDictionary *parameters;
33 | @property (nonatomic) NSDictionary *arguments;
34 | @property (nonatomic) id previousAttributeValue;
35 | @property (nonatomic) id attributeValue;
36 |
37 | @end
38 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/Classes/Internal/LPContextualValues.m:
--------------------------------------------------------------------------------
1 | //
2 | // LPContextualValues.m
3 | // Leanplum
4 | //
5 | // Created by Andrew First on 9/12/13.
6 | // Copyright (c) 2013 Leanplum, Inc. All rights reserved.
7 | //
8 | // Licensed to the Apache Software Foundation (ASF) under one
9 | // or more contributor license agreements. See the NOTICE file
10 | // distributed with this work for additional information
11 | // regarding copyright ownership. The ASF licenses this file
12 | // to you under the Apache License, Version 2.0 (the "License");
13 | // you may not use this file except in compliance with the License.
14 | // You may obtain a copy of the License at
15 | //
16 | // http://www.apache.org/licenses/LICENSE-2.0
17 | //
18 | // Unless required by applicable law or agreed to in writing,
19 | // software distributed under the License is distributed on an
20 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21 | // KIND, either express or implied. See the License for the
22 | // specific language governing permissions and limitations
23 | // under the License.
24 |
25 | #import "LPContextualValues.h"
26 |
27 | @implementation LPContextualValues
28 |
29 | @end
30 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/Classes/Internal/LPEnumConstants.h:
--------------------------------------------------------------------------------
1 | //
2 | // LPEnumConstants.h
3 | // Leanplum-SDK
4 | //
5 | // Created by Grace Gu on 12/19/18.
6 | // Copyright © 2018 Leanplum. All rights reserved.
7 | //
8 | // Licensed to the Apache Software Foundation (ASF) under one
9 | // or more contributor license agreements. See the NOTICE file
10 | // distributed with this work for additional information
11 | // regarding copyright ownership. The ASF licenses this file
12 | // to you under the Apache License, Version 2.0 (the “License”);
13 | // you may not use this file except in compliance with the License.
14 | // You may obtain a copy of the License at
15 | //
16 | // http://www.apache.org/licenses/LICENSE-2.0
17 | //
18 | // Unless required by applicable law or agreed to in writing,
19 | // software distributed under the License is distributed on an
20 | // “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21 | // KIND, either express or implied. See the License for the
22 | // specific language governing permissions and limitations
23 | // under the License.
24 |
25 | #include
26 |
27 | #ifndef EnumConstants_h
28 | #define EnumConstants_h
29 |
30 | @interface LPEnumConstants : NSObject {}
31 |
32 | typedef NS_ENUM(NSUInteger, LPGeofenceEventType) {
33 | LPEnterRegion,
34 | LPExitRegion
35 | } NS_SWIFT_NAME(Leanplum.GeofenceEventType);
36 |
37 |
38 | + (NSString *)getEventNameFromGeofenceType:(LPGeofenceEventType)event;
39 | @end
40 |
41 | #endif /* EnumConstants_h */
42 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/Classes/Internal/LPEnumConstants.m:
--------------------------------------------------------------------------------
1 | //
2 | // EnumConstants.m
3 | // Leanplum-SDK
4 | //
5 | // Created by Grace Gu on 12/19/18.
6 | // Copyright © 2018 Leanplum. All rights reserved.
7 | //
8 | // Licensed to the Apache Software Foundation (ASF) under one
9 | // or more contributor license agreements. See the NOTICE file
10 | // distributed with this work for additional information
11 | // regarding copyright ownership. The ASF licenses this file
12 | // to you under the Apache License, Version 2.0 (the “License”);
13 | // you may not use this file except in compliance with the License.
14 | // You may obtain a copy of the License at
15 | //
16 | // http://www.apache.org/licenses/LICENSE-2.0
17 | //
18 | // Unless required by applicable law or agreed to in writing,
19 | // software distributed under the License is distributed on an
20 | // “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21 | // KIND, either express or implied. See the License for the
22 | // specific language governing permissions and limitations
23 | // under the License.
24 |
25 | #import "LPEnumConstants.h"
26 |
27 | @implementation LPEnumConstants
28 |
29 | + (NSString *) getEventNameFromGeofenceType:(LPGeofenceEventType)event {
30 | NSString *result = nil;
31 |
32 | switch(event) {
33 | case LPEnterRegion:
34 | result = @"enter_region";
35 | break;
36 | case LPExitRegion:
37 | result = @"exit_region";
38 | break;
39 | default:
40 | [NSException raise:NSGenericException format:@"Unexpected geofenceEventType."];
41 | }
42 |
43 | return result;
44 | }
45 |
46 | @end
47 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/Classes/Internal/LPInternalState.h:
--------------------------------------------------------------------------------
1 | //
2 | // LPInternalState.h
3 | // Leanplum-iOS-SDK-source
4 | //
5 | // Created by Mayank Sanganeria on 4/24/18.
6 | //
7 |
8 | #import
9 | #import "LPRegisterDevice.h"
10 | #import "LPActionTriggerManager.h"
11 |
12 | @interface LPInternalState : NSObject
13 |
14 | @property(strong, nonatomic) NSMutableArray *startBlocks;
15 | @property(strong, nonatomic) NSMutableArray *variablesChangedBlocks;
16 | @property(strong, nonatomic) NSMutableArray *noDownloadsBlocks;
17 | @property(strong, nonatomic) NSMutableArray *onceNoDownloadsBlocks;
18 | @property(strong, nonatomic) NSMutableArray *startIssuedBlocks;
19 | @property(strong, nonatomic) NSMutableSet *startResponders, *variablesChangedResponders, *noDownloadsResponders;
20 | @property(assign, nonatomic) NSUncaughtExceptionHandler *customExceptionHandler;
21 | @property(strong, nonatomic) LPRegisterDevice *registration;
22 | @property(assign, nonatomic) BOOL calledStart, hasStarted, hasStartedAndRegisteredAsDeveloper, startSuccessful, issuedStart;
23 | @property(strong, nonatomic) LPActionTriggerManager *actionManager;
24 | @property(strong, nonatomic) NSString *appVersion;
25 | @property(strong, nonatomic) NSMutableArray *userAttributeChanges;
26 | @property(assign, nonatomic) BOOL isVariantDebugInfoEnabled;
27 | @property(assign, nonatomic) BOOL calledHandleNotification;
28 |
29 | + (LPInternalState *)sharedState;
30 |
31 | @end
32 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/Classes/Internal/LPInternalState.m:
--------------------------------------------------------------------------------
1 | //
2 | // LPInternalState.m
3 | // Leanplum-iOS-SDK-source
4 | //
5 | // Created by Mayank Sanganeria on 4/24/18.
6 | //
7 |
8 | #import "LPInternalState.h"
9 |
10 | @implementation LPInternalState
11 |
12 | + (LPInternalState *)sharedState {
13 | static LPInternalState *sharedLPInternalState = nil;
14 | static dispatch_once_t onceLPInternalStateToken;
15 | dispatch_once(&onceLPInternalStateToken, ^{
16 | sharedLPInternalState = [[self alloc] init];
17 | });
18 | return sharedLPInternalState;
19 | }
20 |
21 | - (id)init {
22 | if (self = [super init]) {
23 | _startBlocks = nil;
24 | _variablesChangedBlocks = nil;
25 | _noDownloadsBlocks = nil;
26 | _onceNoDownloadsBlocks = nil;
27 | _startResponders = nil;
28 | _variablesChangedResponders = nil;
29 | _noDownloadsResponders = nil;
30 | _customExceptionHandler = nil;
31 | _registration = nil;
32 | _calledStart = NO;
33 | _hasStarted = NO;
34 | _hasStartedAndRegisteredAsDeveloper = NO;
35 | _startSuccessful = NO;
36 | _actionManager = nil;
37 | _userAttributeChanges = [NSMutableArray array];
38 | _calledHandleNotification = NO;
39 | }
40 | return self;
41 | }
42 |
43 | @end
44 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/Classes/LPMessageTemplates.h:
--------------------------------------------------------------------------------
1 | //
2 | // LPMessageTemplates.h
3 | //
4 | // Copyright 2016 Leanplum, Inc.
5 | //
6 | // Permission is hereby granted, free of charge, to any person obtaining a copy
7 | // of this software and associated documentation files (the "Software"), to deal
8 | // in the Software without restriction, including without limitation the rights
9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | // copies of the Software, and to permit persons to whom the Software is
11 | // furnished to do so, subject to the following conditions:
12 | //
13 | // 1. The above copyright notice and this permission notice shall be included in
14 | // all copies or substantial portions of the Software.
15 | // 2. This software and its derivatives may only be used in conjunction with the
16 | // Leanplum SDK within apps that have a valid subscription to the Leanplum platform,
17 | // at http://www.leanplum.com
18 | //
19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 | // THE SOFTWARE.
26 | //
27 | // Standard use (somewhere before [Leanplum start]):
28 | // [LPMessageTemplates sharedTemplates];
29 | // That's it!
30 |
31 | #import
32 | #import
33 | #import "Leanplum.h"
34 |
35 | NS_ASSUME_NONNULL_BEGIN
36 |
37 | NS_SWIFT_NAME(MessageTemplates)
38 | @interface LPMessageTemplatesClass : NSObject
39 |
40 | + (LPMessageTemplatesClass *)sharedTemplates;
41 |
42 | - (void)disableAskToAsk;
43 | - (void)refreshPushPermissions;
44 |
45 | @end
46 |
47 | NS_ASSUME_NONNULL_END
48 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/Classes/LeanplumCompatibility.h:
--------------------------------------------------------------------------------
1 | //
2 | // Leanplum.h
3 | // Leanplum iOS SDK Version 2.0.6
4 | //
5 | // Copyright (c) 2012 Leanplum, Inc. All rights reserved.
6 | //
7 | // Licensed to the Apache Software Foundation (ASF) under one
8 | // or more contributor license agreements. See the NOTICE file
9 | // distributed with this work for additional information
10 | // regarding copyright ownership. The ASF licenses this file
11 | // to you under the Apache License, Version 2.0 (the "License");
12 | // you may not use this file except in compliance with the License.
13 | // You may obtain a copy of the License at
14 | //
15 | // http://www.apache.org/licenses/LICENSE-2.0
16 | //
17 | // Unless required by applicable law or agreed to in writing,
18 | // software distributed under the License is distributed on an
19 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
20 | // KIND, either express or implied. See the License for the
21 | // specific language governing permissions and limitations
22 | // under the License.
23 |
24 | #import
25 |
26 | @interface LeanplumCompatibility : NSObject
27 |
28 | /**
29 | * Used only for compatibility with Google Analytics.
30 | */
31 | + (void)gaTrack:(NSObject *)trackingObject;
32 |
33 | @end
34 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/Classes/Managers/LPAppIconManager.h:
--------------------------------------------------------------------------------
1 | //
2 | // LPAppIconManager.h
3 | // Leanplum
4 | //
5 | // Created by Alexis Oyama on 2/23/17.
6 | // Copyright (c) 2017 Leanplum, Inc. All rights reserved.
7 | //
8 | // Licensed to the Apache Software Foundation (ASF) under one
9 | // or more contributor license agreements. See the NOTICE file
10 | // distributed with this work for additional information
11 | // regarding copyright ownership. The ASF licenses this file
12 | // to you under the Apache License, Version 2.0 (the "License");
13 | // you may not use this file except in compliance with the License.
14 | // You may obtain a copy of the License at
15 | //
16 | // http://www.apache.org/licenses/LICENSE-2.0
17 | //
18 | // Unless required by applicable law or agreed to in writing,
19 | // software distributed under the License is distributed on an
20 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21 | // KIND, either express or implied. See the License for the
22 | // specific language governing permissions and limitations
23 | // under the License.
24 |
25 | #import
26 |
27 | /**
28 | * Manages App Icon features that are supported from 10.3.
29 | */
30 | @interface LPAppIconManager : NSObject
31 |
32 | /**
33 | * Upload all alternative icon as pngs on dev mode. Will do nothing in production.
34 | */
35 | + (void)uploadAppIconsOnDevMode;
36 |
37 | @end
38 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/Classes/Managers/LPCountAggregator.h:
--------------------------------------------------------------------------------
1 | //
2 | // LPCountAggregator.h
3 | // Leanplum
4 | //
5 | // Created by Grace Gu on 8/27/18.
6 | // Copyright (c) 2018 Leanplum, Inc. All rights reserved.
7 | //
8 | // Licensed to the Apache Software Foundation (ASF) under one
9 | // or more contributor license agreements. See the NOTICE file
10 | // distributed with this work for additional information
11 | // regarding copyright ownership. The ASF licenses this file
12 | // to you under the Apache License, Version 2.0 (the "License");
13 | // you may not use this file except in compliance with the License.
14 | // You may obtain a copy of the License at
15 | //
16 | // http://www.apache.org/licenses/LICENSE-2.0
17 | //
18 | // Unless required by applicable law or agreed to in writing,
19 | // software distributed under the License is distributed on an
20 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21 | // KIND, either express or implied. See the License for the
22 | // specific language governing permissions and limitations
23 | // under the License.
24 |
25 | #include
26 |
27 | NS_ASSUME_NONNULL_BEGIN
28 |
29 | @interface LPCountAggregator : NSObject
30 |
31 | @property (nonatomic, strong, nullable) NSSet * enabledCounters;
32 |
33 | + (instancetype)sharedAggregator;
34 |
35 | - (void)incrementCount:(NSString *)name;
36 | - (void)incrementCount:(NSString *)name by:(int) incrementCount;
37 | - (void)sendAllCounts;
38 |
39 | @end
40 |
41 | NS_ASSUME_NONNULL_END
42 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/Classes/Managers/LPLogManager.h:
--------------------------------------------------------------------------------
1 | //
2 | // LPLogManager.h
3 | // Leanplum-iOS-SDK
4 | //
5 | // Created by Dejan Krstevski on 31.07.20.
6 | // Copyright (c) 2020 Leanplum, Inc. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | NS_ASSUME_NONNULL_BEGIN
12 |
13 | typedef NS_ENUM(NSUInteger, LPLogLevel) {
14 | LPLogLevelOff = 0,
15 | LPLogLevelError,
16 | LPLogLevelInfo,
17 | LPLogLevelDebug
18 | } NS_SWIFT_NAME(LeanplumLogLevel);
19 |
20 | typedef NS_ENUM(NSUInteger, LPLogType) {
21 | LPError,
22 | LPInfo,
23 | LPDebug
24 | } NS_SWIFT_NAME(LeanplumLogType);
25 |
26 | @interface LPLogManager : NSObject
27 | @property (nonatomic, assign) LPLogLevel logLevel;
28 | + (void)setLogLevel:(LPLogLevel)level;
29 | + (LPLogLevel)logLevel;
30 | + (void)logInternalError:(NSException *)e;
31 | @end
32 |
33 | NS_ASSUME_NONNULL_END
34 | void LPLog(LPLogType type, NSString * _Nullable format, ...);
35 | void LPLogv(LPLogType type, NSString * _Nullable format, va_list args);
36 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/Classes/Managers/LPRegisterDevice.h:
--------------------------------------------------------------------------------
1 | //
2 | // RegisterDevice.h
3 | // Leanplum
4 | //
5 | // Created by Andrew First on 5/13/12.
6 | // Copyright (c) 2012 Leanplum, Inc. All rights reserved.
7 | //
8 | // Licensed to the Apache Software Foundation (ASF) under one
9 | // or more contributor license agreements. See the NOTICE file
10 | // distributed with this work for additional information
11 | // regarding copyright ownership. The ASF licenses this file
12 | // to you under the Apache License, Version 2.0 (the "License");
13 | // you may not use this file except in compliance with the License.
14 | // You may obtain a copy of the License at
15 | //
16 | // http://www.apache.org/licenses/LICENSE-2.0
17 | //
18 | // Unless required by applicable law or agreed to in writing,
19 | // software distributed under the License is distributed on an
20 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21 | // KIND, either express or implied. See the License for the
22 | // specific language governing permissions and limitations
23 | // under the License.
24 |
25 | #import
26 |
27 | #import "Leanplum.h"
28 |
29 | @interface LPRegisterDevice : NSObject
30 |
31 | - (id)initWithCallback:(LeanplumStartBlock)callback;
32 | - (void)registerDevice:(NSString *)email;
33 |
34 | @end
35 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/Classes/Managers/LPRevenueManager.h:
--------------------------------------------------------------------------------
1 | //
2 | // LPRevenueManager.h
3 | // Leanplum iOS SDK
4 | //
5 | // Created by Atanas Dobrev on 9/9/14
6 | // Copyright (c) 2014 Leanplum, Inc. All rights reserved.
7 | //
8 | // Licensed to the Apache Software Foundation (ASF) under one
9 | // or more contributor license agreements. See the NOTICE file
10 | // distributed with this work for additional information
11 | // regarding copyright ownership. The ASF licenses this file
12 | // to you under the Apache License, Version 2.0 (the "License");
13 | // you may not use this file except in compliance with the License.
14 | // You may obtain a copy of the License at
15 | //
16 | // http://www.apache.org/licenses/LICENSE-2.0
17 | //
18 | // Unless required by applicable law or agreed to in writing,
19 | // software distributed under the License is distributed on an
20 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21 | // KIND, either express or implied. See the License for the
22 | // specific language governing permissions and limitations
23 | // under the License.
24 |
25 | #import
26 | #import
27 |
28 | @interface LPRevenueManager : NSObject
29 |
30 | + (LPRevenueManager *)sharedManager;
31 | - (void)trackRevenue;
32 | - (void)addTransaction:(SKPaymentTransaction *)transaction;
33 |
34 | @property (nonatomic, copy) NSString *eventName;
35 |
36 | @end
37 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/Classes/Managers/Networking/LPFileTransferManager.h:
--------------------------------------------------------------------------------
1 | //
2 | // LPFileTransferManager.h
3 | // LeanplumSDK-iOS
4 | //
5 | // Created by Mayank Sanganeria on 2/1/19.
6 | // Copyright © 2019 Leanplum. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "Leanplum.h"
11 | #import "LPNetworkFactory.h"
12 |
13 | NS_ASSUME_NONNULL_BEGIN
14 |
15 | @interface LPFileTransferManager : NSObject
16 |
17 | @property (nonatomic, strong, nullable) NSString *uploadUrl;
18 | @property (nonatomic, readonly) int numPendingDownloads;
19 | @property (nonatomic, strong) NSDictionary *filenameToURLs;
20 |
21 | + (instancetype)sharedInstance;
22 | - (void)sendFilesNow:(NSArray *)filenames fileData:(NSArray *)fileData;
23 |
24 | - (void)downloadFile:(NSString *)path onResponse:(LPNetworkResponseBlock)responseBlock onError:(LPNetworkErrorBlock)errorBlock;
25 | - (void)onNoPendingDownloads:(LeanplumVariablesChangedBlock)noPendingDownloadsBlock;
26 |
27 | @end
28 |
29 | NS_ASSUME_NONNULL_END
30 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/Classes/Managers/Networking/LPNetworkEngine.h:
--------------------------------------------------------------------------------
1 | //
2 | // LPNetworkEngine.h
3 | // Leanplum
4 | //
5 | // Created by Alexis Oyama on 11/14/16.
6 | // Copyright (c) 2016 Leanplum, Inc. All rights reserved.
7 | //
8 | // Licensed to the Apache Software Foundation (ASF) under one
9 | // or more contributor license agreements. See the NOTICE file
10 | // distributed with this work for additional information
11 | // regarding copyright ownership. The ASF licenses this file
12 | // to you under the Apache License, Version 2.0 (the "License");
13 | // you may not use this file except in compliance with the License.
14 | // You may obtain a copy of the License at
15 | //
16 | // http://www.apache.org/licenses/LICENSE-2.0
17 | //
18 | // Unless required by applicable law or agreed to in writing,
19 | // software distributed under the License is distributed on an
20 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21 | // KIND, either express or implied. See the License for the
22 | // specific language governing permissions and limitations
23 | // under the License.
24 |
25 | #import "LPNetworkProtocol.h"
26 | #import "Leanplum_Reachability.h"
27 |
28 | /**
29 | * Network Engine that uses NSURLSession
30 | */
31 | @interface LPNetworkEngine : NSObject
32 |
33 | @property (nonatomic, strong) NSURLSessionConfiguration *sessionConfiguration;
34 |
35 | /**
36 | * Create Request Headers for network call
37 | */
38 | + (NSDictionary *)createHeaders;
39 | @end
40 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/Classes/Managers/Networking/LPNetworkFactory.h:
--------------------------------------------------------------------------------
1 | //
2 | // LPNetworkFactory.h
3 | // Leanplum
4 | //
5 | // Created by Alexis Oyama on 11/14/16.
6 | // Copyright (c) 2016 Leanplum, Inc. All rights reserved.
7 | //
8 | // Licensed to the Apache Software Foundation (ASF) under one
9 | // or more contributor license agreements. See the NOTICE file
10 | // distributed with this work for additional information
11 | // regarding copyright ownership. The ASF licenses this file
12 | // to you under the Apache License, Version 2.0 (the "License");
13 | // you may not use this file except in compliance with the License.
14 | // You may obtain a copy of the License at
15 | //
16 | // http://www.apache.org/licenses/LICENSE-2.0
17 | //
18 | // Unless required by applicable law or agreed to in writing,
19 | // software distributed under the License is distributed on an
20 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21 | // KIND, either express or implied. See the License for the
22 | // specific language governing permissions and limitations
23 | // under the License.
24 |
25 | #import
26 | #import "LPNetworkProtocol.h"
27 |
28 | /**
29 | * Network Factory that creates an engine depending if
30 | * device has NSURLSession (iOS > 7).
31 | */
32 | @interface LPNetworkFactory : NSObject
33 |
34 | + (id)engineWithCustomHeaderFields:(NSDictionary*)headers;
35 | + (id)engine;
36 |
37 | /**
38 | * Workaround to use POST on new and GET on old networking library.
39 | */
40 | + (NSString *)fileRequestMethod;
41 |
42 | @end
43 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/Classes/Managers/Networking/LPNetworkFactory.m:
--------------------------------------------------------------------------------
1 | //
2 | // LPNetworkFactory.m
3 | // Leanplum
4 | //
5 | // Created by Alexis Oyama on 11/14/16.
6 | // Copyright (c) 2016 Leanplum, Inc. All rights reserved.
7 | //
8 | // Licensed to the Apache Software Foundation (ASF) under one
9 | // or more contributor license agreements. See the NOTICE file
10 | // distributed with this work for additional information
11 | // regarding copyright ownership. The ASF licenses this file
12 | // to you under the Apache License, Version 2.0 (the "License");
13 | // you may not use this file except in compliance with the License.
14 | // You may obtain a copy of the License at
15 | //
16 | // http://www.apache.org/licenses/LICENSE-2.0
17 | //
18 | // Unless required by applicable law or agreed to in writing,
19 | // software distributed under the License is distributed on an
20 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21 | // KIND, either express or implied. See the License for the
22 | // specific language governing permissions and limitations
23 | // under the License.
24 |
25 | #import "LPNetworkFactory.h"
26 | #import "LPNetworkEngine.h"
27 | #import "LPNetworkOperation.h"
28 |
29 | @implementation LPNetworkFactory
30 |
31 | + (id)engineWithCustomHeaderFields:(NSDictionary*)headers
32 | {
33 | return [[LPNetworkEngine alloc] initWithCustomHeaderFields:headers];
34 | }
35 |
36 | + (id)engine
37 | {
38 | return [[LPNetworkEngine alloc] init];
39 | }
40 |
41 | + (NSString *)fileRequestMethod
42 | {
43 | return [LPNetworkOperation fileRequestMethod];
44 | }
45 |
46 | @end
47 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/Classes/Managers/Networking/LPNetworkOperation.h:
--------------------------------------------------------------------------------
1 | //
2 | // LPNetworkOperation.h
3 | // Leanplum
4 | //
5 | // Created by Alexis Oyama on 11/14/16.
6 | // Copyright (c) 2016 Leanplum, Inc. All rights reserved.
7 | //
8 | // Licensed to the Apache Software Foundation (ASF) under one
9 | // or more contributor license agreements. See the NOTICE file
10 | // distributed with this work for additional information
11 | // regarding copyright ownership. The ASF licenses this file
12 | // to you under the Apache License, Version 2.0 (the "License");
13 | // you may not use this file except in compliance with the License.
14 | // You may obtain a copy of the License at
15 | //
16 | // http://www.apache.org/licenses/LICENSE-2.0
17 | //
18 | // Unless required by applicable law or agreed to in writing,
19 | // software distributed under the License is distributed on an
20 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21 | // KIND, either express or implied. See the License for the
22 | // specific language governing permissions and limitations
23 | // under the License.
24 |
25 | #import "LPNetworkProtocol.h"
26 |
27 | /**
28 | * Network Operation
29 | * Uses session task to submit requests.
30 | */
31 | @interface LPNetworkOperation : NSObject
32 |
33 | @property (nonatomic, strong) NSURLSession *session;
34 | @property (nonatomic, strong) NSURLSessionTask *task;
35 | @property (nonatomic, strong) NSMutableURLRequest *request;
36 | @property (nonatomic, strong) NSDictionary *requestParam;
37 |
38 | /**
39 | * Initializer that requires to build the requests.
40 | */
41 | - (id)initWithSessionConfiguration:(NSURLSessionConfiguration *)configuration
42 | request:(NSMutableURLRequest *)request
43 | param:(NSDictionary *)param;
44 |
45 | /**
46 | * Sends the request.
47 | */
48 | - (void)run;
49 | - (void)runSynchronously:(BOOL)synchronous;
50 |
51 | @end
52 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/Classes/Managers/Networking/LPRequestBatch.h:
--------------------------------------------------------------------------------
1 | //
2 | // LPRequestBatch.h
3 | // Leanplum-iOS-SDK
4 | //
5 | // Copyright © 2020 Leanplum. All rights reserved.
6 | //
7 |
8 | #import
9 |
10 | NS_ASSUME_NONNULL_BEGIN
11 |
12 | @interface LPRequestBatch : NSObject
13 |
14 | @property (nonatomic, retain) NSArray *requestsToSend;
15 |
16 | - (instancetype)initWithRequestsToSend:(NSArray *)requestsToSend;
17 | - (int)getEventsCount;
18 | - (BOOL)isFull;
19 | - (BOOL)isEmpty;
20 |
21 | @end
22 |
23 | NS_ASSUME_NONNULL_END
24 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/Classes/Managers/Networking/LPRequestBatch.m:
--------------------------------------------------------------------------------
1 | //
2 | // LPRequestBatch.m
3 | // Leanplum-iOS-SDK
4 | //
5 | // Copyright © 2020 Leanplum. All rights reserved.
6 | //
7 |
8 | #import "LPRequestBatch.h"
9 | #import "LPNetworkConstants.h"
10 |
11 | @implementation LPRequestBatch
12 |
13 |
14 | - (instancetype)initWithRequestsToSend:(NSArray *)requestsToSend
15 | {
16 | if (self = [super init])
17 | {
18 | _requestsToSend = requestsToSend;
19 | }
20 |
21 | return self;
22 | }
23 |
24 | - (int)getEventsCount
25 | {
26 | return (int)self.requestsToSend.count;
27 | }
28 |
29 | - (BOOL)isFull
30 | {
31 | return [self getEventsCount] == LP_MAX_EVENTS_PER_API_CALL;
32 | }
33 |
34 | - (BOOL)isEmpty
35 | {
36 | return self.requestsToSend.count == 0;
37 | }
38 |
39 |
40 | @end
41 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/Classes/Managers/Networking/LPRequestBatchFactory.h:
--------------------------------------------------------------------------------
1 | //
2 | // LPRequestBatchFactory.h
3 | // Leanplum-iOS-SDK
4 | //
5 | // Copyright © 2020 Leanplum. All rights reserved.
6 | //
7 |
8 | #import
9 | #import "LPRequestBatch.h"
10 |
11 | NS_ASSUME_NONNULL_BEGIN
12 |
13 | @interface LPRequestBatchFactory : NSObject
14 |
15 | + (LPRequestBatch *)createNextBatch;
16 | + (void)deleteFinishedBatch:(LPRequestBatch *)batch;
17 |
18 | @end
19 |
20 | NS_ASSUME_NONNULL_END
21 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/Classes/Managers/Networking/LPRequestBatchFactory.m:
--------------------------------------------------------------------------------
1 | //
2 | // LPRequestBatchFactory.m
3 | // Leanplum-iOS-SDK
4 | //
5 | // Copyright © 2020 Leanplum. All rights reserved.
6 | //
7 |
8 | #import "LPRequestBatchFactory.h"
9 | #import "LPEventDataManager.h"
10 | #import "LPNetworkConstants.h"
11 |
12 | @implementation LPRequestBatchFactory
13 |
14 | + (LPRequestBatch *)createNextBatch
15 | {
16 | NSArray *requests = [LPEventDataManager eventsWithLimit:LP_MAX_EVENTS_PER_API_CALL];
17 | return [[LPRequestBatch alloc] initWithRequestsToSend:requests];
18 | }
19 |
20 | + (void)deleteFinishedBatch:(LPRequestBatch *)batch
21 | {
22 | int eventsCount = [batch getEventsCount];
23 | if (eventsCount == 0) {
24 | return;;
25 | }
26 | [LPEventDataManager deleteEventsWithLimit:eventsCount];
27 | }
28 |
29 | @end
30 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/Classes/Managers/Networking/LPRequestSender.h:
--------------------------------------------------------------------------------
1 | //
2 | // LPRequestSender.h
3 | // Leanplum
4 | //
5 | // Created by Mayank Sanganeria on 6/30/18.
6 | // Copyright (c) 2018 Leanplum, Inc. All rights reserved.
7 | //
8 | // Licensed to the Apache Software Foundation (ASF) under one
9 | // or more contributor license agreements. See the NOTICE file
10 | // distributed with this work for additional information
11 | // regarding copyright ownership. The ASF licenses this file
12 | // to you under the Apache License, Version 2.0 (the "License");
13 | // you may not use this file except in compliance with the License.
14 | // You may obtain a copy of the License at
15 | //
16 | // http://www.apache.org/licenses/LICENSE-2.0
17 | //
18 | // Unless required by applicable law or agreed to in writing,
19 | // software distributed under the License is distributed on an
20 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21 | // KIND, either express or implied. See the License for the
22 | // specific language governing permissions and limitations
23 | // under the License.
24 |
25 | #import
26 |
27 | @class LPRequest;
28 |
29 | @interface LPRequestSender : NSObject
30 |
31 | + (instancetype)sharedInstance;
32 |
33 | - (void)send:(LPRequest *)request;
34 |
35 | - (void)sendRequests;
36 |
37 | @end
38 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/Classes/Managers/Networking/LPRequestSenderTimer.h:
--------------------------------------------------------------------------------
1 | //
2 | // LPRequestSenderTimer.h
3 | // Leanplum-iOS-SDK
4 | //
5 | // Copyright © 2020 Leanplum. All rights reserved.
6 | //
7 |
8 | #import
9 |
10 | NS_ASSUME_NONNULL_BEGIN
11 |
12 | /**
13 | The enumeration represents time interval to periodically upload events to server.
14 | Possible values are 5, 10, or 15 minutes.
15 | */
16 | typedef enum : NSUInteger {
17 | AT_MOST_5_MINUTES = 5,
18 | AT_MOST_10_MINUTES = 10,
19 | AT_MOST_15_MINUTES = 15
20 | } LPEventsUploadInterval;
21 |
22 | @interface LPRequestSenderTimer : NSObject
23 | @property (assign) LPEventsUploadInterval timerInterval;
24 | + (instancetype)sharedInstance;
25 | - (void)start;
26 | - (void)invalidate;
27 | @end
28 |
29 | NS_ASSUME_NONNULL_END
30 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/Classes/Managers/Networking/LPRequestSenderTimer.m:
--------------------------------------------------------------------------------
1 | //
2 | // LPRequestSenderTimer.m
3 | // Leanplum-iOS-SDK
4 | //
5 | // Copyright © 2020 Leanplum. All rights reserved.
6 | //
7 |
8 | #import "LPRequestSenderTimer.h"
9 | #import "NSTimer+Blocks.h"
10 | #import "LPConstants.h"
11 | #import "LPRequest.h"
12 | #import "LPRequestFactory.h"
13 | #import "LPRequestSender.h"
14 |
15 | @interface LPRequestSenderTimer()
16 | @property (weak) NSTimer *intervalTimer;
17 | @end
18 |
19 | @implementation LPRequestSenderTimer
20 |
21 | + (instancetype)sharedInstance {
22 | static LPRequestSenderTimer *sharedManager = nil;
23 | static dispatch_once_t onceToken;
24 | dispatch_once(&onceToken, ^{
25 | sharedManager = [[self alloc] init];
26 | });
27 | return sharedManager;
28 | }
29 |
30 | - (instancetype)init
31 | {
32 | if (self = [super init])
33 | {
34 | _timerInterval = AT_MOST_15_MINUTES;
35 | }
36 |
37 | return self;
38 | }
39 |
40 | - (void)start
41 | {
42 | NSTimeInterval heartbeatInterval = self.timerInterval * 60;
43 | // Heartbeat.
44 | _intervalTimer = [LPTimerBlocks scheduledTimerWithTimeInterval:heartbeatInterval block:^() {
45 | RETURN_IF_NOOP;
46 | LP_TRY
47 | if ([[UIApplication sharedApplication] applicationState] == UIApplicationStateActive) {
48 | LPRequest *request = [[LPRequestFactory heartbeatWithParams:nil] andRequestType:Immediate];
49 | [[LPRequestSender sharedInstance] send:request];
50 |
51 | }
52 | LP_END_TRY
53 | } repeats:YES];
54 | }
55 |
56 | - (void)invalidate
57 | {
58 | [_intervalTimer invalidate];
59 | }
60 |
61 | @end
62 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/Classes/Managers/Networking/LPResponse.h:
--------------------------------------------------------------------------------
1 | //
2 | // LPResponse.h
3 | // Leanplum
4 | //
5 | // Created by Andrew First on 4/30/12.
6 | // Copyright (c) 2012 Leanplum, Inc. All rights reserved.
7 | //
8 | // Licensed to the Apache Software Foundation (ASF) under one
9 | // or more contributor license agreements. See the NOTICE file
10 | // distributed with this work for additional information
11 | // regarding copyright ownership. The ASF licenses this file
12 | // to you under the Apache License, Version 2.0 (the "License");
13 | // you may not use this file except in compliance with the License.
14 | // You may obtain a copy of the License at
15 | //
16 | // http://www.apache.org/licenses/LICENSE-2.0
17 | //
18 | // Unless required by applicable law or agreed to in writing,
19 | // software distributed under the License is distributed on an
20 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21 | // KIND, either express or implied. See the License for the
22 | // specific language governing permissions and limitations
23 | // under the License.
24 |
25 | #import
26 | #import "Leanplum.h"
27 | #import "LPNetworkFactory.h"
28 |
29 | @interface LPResponse : NSObject
30 |
31 | + (NSUInteger)numResponsesInDictionary:(NSDictionary *)dictionary;
32 | + (NSDictionary *)getResponseAt:(NSUInteger)index fromDictionary:(NSDictionary *)dictionary;
33 | + (NSDictionary *)getLastResponse:(NSDictionary *)dictionary;
34 | + (BOOL)isResponseSuccess:(NSDictionary *)dictionary;
35 | + (NSString *)getResponseError:(NSDictionary *)dictionary;
36 |
37 | @end
38 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/Classes/Managers/Networking/LeanplumSocket.h:
--------------------------------------------------------------------------------
1 | //
2 | // LeanplumSocket.h
3 | // Leanplum
4 | //
5 | // Created by Andrew First on 5/5/12.
6 | // Copyright (c) 2012 Leanplum, Inc. All rights reserved.
7 | //
8 | // Licensed to the Apache Software Foundation (ASF) under one
9 | // or more contributor license agreements. See the NOTICE file
10 | // distributed with this work for additional information
11 | // regarding copyright ownership. The ASF licenses this file
12 | // to you under the Apache License, Version 2.0 (the "License");
13 | // you may not use this file except in compliance with the License.
14 | // You may obtain a copy of the License at
15 | //
16 | // http://www.apache.org/licenses/LICENSE-2.0
17 | //
18 | // Unless required by applicable law or agreed to in writing,
19 | // software distributed under the License is distributed on an
20 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21 | // KIND, either express or implied. See the License for the
22 | // specific language governing permissions and limitations
23 | // under the License.
24 |
25 | #import
26 | #import "Leanplum_SocketIO.h"
27 |
28 | @interface LeanplumSocket : NSObject {
29 | @private
30 | Leanplum_SocketIO *_socketIO;
31 | NSString *_appId;
32 | NSString *_deviceId;
33 | BOOL _authSent;
34 | NSTimer *_reconnectTimer;
35 | }
36 | @property (readonly) BOOL connected;
37 |
38 | + (LeanplumSocket *)sharedSocket;
39 |
40 | - (void)connectToAppId:(NSString *)appId deviceId:(NSString *)deviceId;
41 | - (void)connectToNewSocket;
42 | - (void)sendEvent:(NSString *)eventName withData:(NSDictionary *)data;
43 |
44 | @end
45 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/Classes/MessageTemplates/LPAlertMessageTemplate.h:
--------------------------------------------------------------------------------
1 | //
2 | // LPAlertMessageTemplate.h
3 | // LeanplumSDK-iOS
4 | //
5 | // Created by Milos Jakovljevic on 06/04/2020.
6 | // Copyright © 2020 Leanplum. All rights reserved.
7 | //
8 |
9 | #import "LPMessageTemplateProtocol.h"
10 |
11 | NS_ASSUME_NONNULL_BEGIN
12 |
13 | @interface LPAlertMessageTemplate : NSObject
14 |
15 | @end
16 |
17 | NS_ASSUME_NONNULL_END
18 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/Classes/MessageTemplates/LPAppRatingMessageTemplate.h:
--------------------------------------------------------------------------------
1 | //
2 | // LPAppRatingMessageTemplate.h
3 | // LeanplumSDK-iOS
4 | //
5 | // Created by Mayank Sanganeria on 2/7/20.
6 | // Copyright © 2020 Leanplum. All rights reserved.
7 | //
8 |
9 | #import "LPMessageTemplateProtocol.h"
10 |
11 | NS_ASSUME_NONNULL_BEGIN
12 |
13 | @interface LPAppRatingMessageTemplate : NSObject
14 |
15 | @end
16 |
17 | NS_ASSUME_NONNULL_END
18 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/Classes/MessageTemplates/LPCenterPopupMessageTemplate.h:
--------------------------------------------------------------------------------
1 | //
2 | // LPCenterPopupMessageTemplate.h
3 | // LeanplumSDK-iOS
4 | //
5 | // Created by Milos Jakovljevic on 06/04/2020.
6 | // Copyright © 2020 Leanplum. All rights reserved.
7 | //
8 |
9 | #import "LPMessageTemplateProtocol.h"
10 |
11 | NS_ASSUME_NONNULL_BEGIN
12 |
13 | @interface LPCenterPopupMessageTemplate : NSObject
14 |
15 | @end
16 |
17 | NS_ASSUME_NONNULL_END
18 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/Classes/MessageTemplates/LPConfirmMessageTemplate.h:
--------------------------------------------------------------------------------
1 | //
2 | // LPConfirmMessageTemplate.h
3 | // LeanplumSDK-iOS
4 | //
5 | // Created by Milos Jakovljevic on 15/04/2020.
6 | // Copyright © 2020 Leanplum. All rights reserved.
7 | //
8 |
9 | #import "LPMessageTemplateProtocol.h"
10 |
11 | NS_ASSUME_NONNULL_BEGIN
12 |
13 | @interface LPConfirmMessageTemplate : NSObject
14 |
15 | @end
16 |
17 | NS_ASSUME_NONNULL_END
18 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/Classes/MessageTemplates/LPIconChangeMessageTemplate.h:
--------------------------------------------------------------------------------
1 | //
2 | // LPIconChangeMessageTemplate.h
3 | // LeanplumSDK-iOS
4 | //
5 | // Created by Mayank Sanganeria on 2/7/20.
6 | // Copyright © 2020 Leanplum. All rights reserved.
7 | //
8 |
9 | #import "LPMessageTemplateProtocol.h"
10 |
11 | NS_ASSUME_NONNULL_BEGIN
12 |
13 | @interface LPIconChangeMessageTemplate : NSObject
14 |
15 | @end
16 |
17 | NS_ASSUME_NONNULL_END
18 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/Classes/MessageTemplates/LPInterstitialMessageTemplate.h:
--------------------------------------------------------------------------------
1 | //
2 | // LPInterstitialMessageTemplate.h
3 | // LeanplumSDK-iOS
4 | //
5 | // Created by Milos Jakovljevic on 06/04/2020.
6 | // Copyright © 2020 Leanplum. All rights reserved.
7 | //
8 |
9 | #import "LPMessageTemplateProtocol.h"
10 |
11 | NS_ASSUME_NONNULL_BEGIN
12 |
13 | @interface LPInterstitialMessageTemplate : NSObject
14 |
15 | @end
16 |
17 | NS_ASSUME_NONNULL_END
18 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/Classes/MessageTemplates/LPMessageTemplateProtocol.h:
--------------------------------------------------------------------------------
1 | //
2 | // LPBaseMessageTemplate.h
3 | // LeanplumSDK-iOS
4 | //
5 | // Created by Mayank Sanganeria on 1/27/20.
6 | // Copyright © 2020 Leanplum. All rights reserved.
7 | //
8 |
9 | #import "LPMessageTemplateConstants.h"
10 | #import "LPMessageTemplateUtilities.h"
11 |
12 | @class LPActionContext;
13 |
14 | NS_ASSUME_NONNULL_BEGIN
15 |
16 | @protocol LPMessageTemplateProtocol
17 |
18 | + (void)defineAction;
19 |
20 | @optional
21 | @property (nonatomic, strong) LPActionContext *context;
22 | - (UIViewController *)viewControllerWithContext:(LPActionContext *) context;
23 | @end
24 |
25 | NS_ASSUME_NONNULL_END
26 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/Classes/MessageTemplates/LPOpenUrlMessageTemplate.h:
--------------------------------------------------------------------------------
1 | //
2 | // LPOpenUrlMessageTemplate.h
3 | // Leanplum-iOS-SDK
4 | //
5 | // Created by Mayank Sanganeria on 2/6/20.
6 | //
7 |
8 | #import "LPMessageTemplateProtocol.h"
9 |
10 | NS_ASSUME_NONNULL_BEGIN
11 |
12 | @interface LPOpenUrlMessageTemplate : NSObject
13 |
14 | @end
15 |
16 | NS_ASSUME_NONNULL_END
17 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/Classes/MessageTemplates/LPPushAskToAskMessageTemplate.h:
--------------------------------------------------------------------------------
1 | //
2 | // LPPushAskToAskMessageTemplate.h
3 | // LeanplumSDK-iOS
4 | //
5 | // Created by Mayank Sanganeria on 2/6/20.
6 | // Copyright © 2020 Leanplum. All rights reserved.
7 | //
8 |
9 | #import "LPMessageTemplateProtocol.h"
10 | #import "LPPushMessageTemplate.h"
11 |
12 | NS_ASSUME_NONNULL_BEGIN
13 |
14 | @interface LPPushAskToAskMessageTemplate : LPPushMessageTemplate
15 |
16 | @end
17 |
18 | NS_ASSUME_NONNULL_END
19 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/Classes/MessageTemplates/LPPushMessageTemplate.h:
--------------------------------------------------------------------------------
1 | //
2 | // LPPushMessageTemplate.h
3 | // Leanplum-iOS-SDK
4 | //
5 | // Created by Nikola Zagorchev on 19.08.20.
6 | //
7 |
8 | #import
9 |
10 | NS_ASSUME_NONNULL_BEGIN
11 |
12 | @interface LPPushMessageTemplate : NSObject
13 |
14 | - (BOOL)shouldShowPushMessage;
15 |
16 | - (void)showNativePushPrompt;
17 |
18 | - (BOOL)isPushEnabled;
19 |
20 | - (BOOL)hasDisabledAskToAsk;
21 |
22 | @end
23 |
24 | NS_ASSUME_NONNULL_END
25 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/Classes/MessageTemplates/LPPushMessageTemplate.m:
--------------------------------------------------------------------------------
1 | //
2 | // LPPushMessageTemplate.m
3 | // Leanplum-iOS-SDK
4 | //
5 | // Created by Nikola Zagorchev on 19.08.20.
6 | //
7 |
8 | #import "LPPushMessageTemplate.h"
9 | #import "LPActionTriggerManager.h"
10 | #import "LPLogManager.h"
11 | #import "LeanplumInternal.h"
12 | #import
13 |
14 | @implementation LPPushMessageTemplate
15 |
16 | -(BOOL)shouldShowPushMessage
17 | {
18 | if ([self isPushEnabled]) {
19 | LPLog(LPDebug, @"Pushes already enabled");
20 | return NO;
21 | } else if ([self hasDisabledAskToAsk]) {
22 | LPLog(LPDebug, @" Already asked to push");
23 | return NO;
24 | } else {
25 | return YES;
26 | }
27 | }
28 |
29 | -(void)showNativePushPrompt
30 | {
31 | [[Leanplum notificationsManager] enableSystemPush];
32 | }
33 |
34 | - (BOOL)isPushEnabled
35 | {
36 | return [[Leanplum notificationsManager] isPushEnabled];
37 | }
38 |
39 | - (BOOL)hasDisabledAskToAsk
40 | {
41 | return [Leanplum notificationsManager].isAskToAskDisabled;
42 | }
43 |
44 | @end
45 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/Classes/MessageTemplates/LPRegisterForPushMessageTemplate.h:
--------------------------------------------------------------------------------
1 | //
2 | // LPRegisterForPushMessageTemplate.h
3 | // LeanplumSDK-iOS
4 | //
5 | // Created by Mayank Sanganeria on 2/7/20.
6 | // Copyright © 2020 Leanplum. All rights reserved.
7 | //
8 |
9 | #import "LPMessageTemplateProtocol.h"
10 | #import "LPPushMessageTemplate.h"
11 |
12 | NS_ASSUME_NONNULL_BEGIN
13 |
14 | @interface LPRegisterForPushMessageTemplate : LPPushMessageTemplate
15 |
16 | @end
17 |
18 | NS_ASSUME_NONNULL_END
19 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/Classes/MessageTemplates/LPRegisterForPushMessageTemplate.m:
--------------------------------------------------------------------------------
1 | //
2 | // LPRegisterForPushMessageTemplate.m
3 | // LeanplumSDK-iOS
4 | //
5 | // Created by Mayank Sanganeria on 2/7/20.
6 | // Copyright © 2020 Leanplum. All rights reserved.
7 | //
8 |
9 | #import "LPRegisterForPushMessageTemplate.h"
10 | #import "LPPushMessageTemplate.h"
11 | #import "LPActionContext.h"
12 |
13 | @implementation LPRegisterForPushMessageTemplate
14 |
15 | +(void)defineAction
16 | {
17 | [Leanplum defineAction:LPMT_REGISTER_FOR_PUSH
18 | ofKind:kLeanplumActionKindAction
19 | withArguments:@[]
20 | withOptions:@{}
21 | presentHandler:^BOOL(LPActionContext *context) {
22 | LPRegisterForPushMessageTemplate *template = [[LPRegisterForPushMessageTemplate alloc] init];
23 |
24 | if ([template shouldShowPushMessage]) {
25 | [template showNativePushPrompt];
26 | // Will count View event
27 | return YES;
28 | } else {
29 | return NO;
30 | }
31 |
32 | return YES;
33 | }
34 | dismissHandler:nil];
35 | }
36 |
37 | @end
38 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/Classes/MessageTemplates/LPRichInterstitialMessageTemplate.h:
--------------------------------------------------------------------------------
1 | //
2 | // LPRichInterstitialMessageTemplate.h
3 | // LeanplumSDK-iOS
4 | //
5 | // Created by Milos Jakovljevic on 06/04/2020.
6 | // Copyright © 2020 Leanplum. All rights reserved.
7 | //
8 |
9 | #import "LPMessageTemplateProtocol.h"
10 |
11 | NS_ASSUME_NONNULL_BEGIN
12 |
13 | @interface LPRichInterstitialMessageTemplate : NSObject
14 | +(BOOL)isBannerTemplate:(LPActionContext *)context;
15 | @end
16 |
17 | NS_ASSUME_NONNULL_END
18 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/Classes/MessageTemplates/LPWebInterstitialMessageTemplate.h:
--------------------------------------------------------------------------------
1 | //
2 | // LPWebInterstitialMessageTemplate.h
3 | // LeanplumSDK-iOS
4 | //
5 | // Created by Milos Jakovljevic on 06/04/2020.
6 | // Copyright © 2020 Leanplum. All rights reserved.
7 | //
8 |
9 | #import "LPMessageTemplateProtocol.h"
10 |
11 | NS_ASSUME_NONNULL_BEGIN
12 |
13 | @interface LPWebInterstitialMessageTemplate : NSObject
14 |
15 | @end
16 |
17 | NS_ASSUME_NONNULL_END
18 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/Classes/MessageTemplates/LPWebInterstitialMessageTemplate.m:
--------------------------------------------------------------------------------
1 | //
2 | // LPWebInterstitialMessageTemplate.m
3 | // LeanplumSDK-iOS
4 | //
5 | // Created by Milos Jakovljevic on 06/04/2020.
6 | // Copyright © 2020 Leanplum. All rights reserved.
7 | //
8 |
9 | #import "LPWebInterstitialMessageTemplate.h"
10 | #import "LPActionContext.h"
11 |
12 | @implementation LPWebInterstitialMessageTemplate
13 |
14 | + (void)defineAction
15 | {
16 | __block UIViewController *viewController = NULL;
17 |
18 | BOOL (^presentHandler)(LPActionContext *) = ^(LPActionContext *context) {
19 | @try {
20 | LPWebInterstitialMessageTemplate *template = [[LPWebInterstitialMessageTemplate alloc] init];
21 | viewController = [template viewControllerWithContext:context];
22 |
23 | [LPMessageTemplateUtilities presentOverVisible:viewController];
24 | return YES;
25 | } @catch (NSException *exception) {
26 | LOG_LP_MESSAGE_EXCEPTION;
27 | return NO;
28 | }
29 | };
30 | [Leanplum defineAction:LPMT_WEB_INTERSTITIAL_NAME
31 | ofKind:kLeanplumActionKindAction | kLeanplumActionKindMessage
32 | withArguments:@[
33 | [LPActionArg argNamed:LPMT_ARG_URL withString:LPMT_DEFAULT_URL],
34 | [LPActionArg argNamed:LPMT_ARG_URL_CLOSE withString:LPMT_DEFAULT_CLOSE_URL],
35 | [LPActionArg argNamed:LPMT_HAS_DISMISS_BUTTON withBool:LPMT_DEFAULT_HAS_DISMISS_BUTTON]
36 | ]
37 | withOptions:@{}
38 | presentHandler:presentHandler
39 | dismissHandler:^BOOL(LPActionContext * _Nonnull context) {
40 | [viewController dismissViewControllerAnimated:YES completion:nil];
41 | return YES;
42 | }];
43 | }
44 |
45 | - (UIViewController *)viewControllerWithContext:(LPActionContext *)context
46 | {
47 | LPWebInterstitialViewController *viewController = [LPWebInterstitialViewController instantiateFromStoryboard];
48 | viewController.modalPresentationStyle = UIModalPresentationOverFullScreen;
49 | viewController.context = context;
50 | return viewController;
51 | }
52 |
53 | @end
54 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/Classes/MessageTemplates/ViewControllers/LPInterstitialViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // LPInterstitialViewController.h
3 | // LeanplumSDK-iOS
4 | //
5 | // Created by Milos Jakovljevic on 31/03/2020.
6 | // Copyright © 2020 Leanplum. All rights reserved.
7 | //
8 |
9 | #import
10 | @class LPActionContext;
11 |
12 | NS_ASSUME_NONNULL_BEGIN
13 |
14 | @interface LPInterstitialViewController : UIViewController
15 |
16 | @property (strong, nonatomic) LPActionContext *context;
17 |
18 | @property (weak, nonatomic) IBOutlet UILabel *titleLabel;
19 | @property (weak, nonatomic) IBOutlet UILabel *messageLabel;
20 | @property (weak, nonatomic) IBOutlet UIButton *acceptButton;
21 | @property (weak, nonatomic) IBOutlet UIButton *dismissButton;
22 | @property (weak, nonatomic) IBOutlet UIImageView *backgroundImageView;
23 |
24 | +(nullable LPInterstitialViewController *)instantiateFromStoryboard;
25 |
26 | @end
27 |
28 | NS_ASSUME_NONNULL_END
29 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/Classes/MessageTemplates/ViewControllers/LPMessageTemplateUtilities.h:
--------------------------------------------------------------------------------
1 | //
2 | // LPMessageTemplateUtilities.h
3 | // LeanplumSDK-iOS
4 | //
5 | // Created by Milos Jakovljevic on 09/04/2020.
6 | // Copyright © 2022 Leanplum. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "LPPopupViewController.h"
11 | #import "LPInterstitialViewController.h"
12 | #import "LPWebInterstitialViewController.h"
13 |
14 | NS_ASSUME_NONNULL_BEGIN
15 |
16 | @interface LPMessageTemplateUtilities: NSObject
17 |
18 | +(void)presentOverVisible:(UIViewController *) viewController;
19 | +(void)dismissExisitingViewController:(nullable void (^)(void)) completion;
20 | +(UIViewController *) visibleViewController;
21 | @end
22 |
23 | NS_ASSUME_NONNULL_END
24 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/Classes/MessageTemplates/ViewControllers/LPPopupViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // LPPopupViewController.h
3 | // LeanplumSDK-iOS
4 | //
5 | // Created by Milos Jakovljevic on 31/03/2020.
6 | // Copyright © 2020 Leanplum. All rights reserved.
7 | //
8 |
9 | #import
10 | @class LPActionContext;
11 |
12 | NS_ASSUME_NONNULL_BEGIN
13 |
14 | @interface LPPopupViewController : UIViewController
15 |
16 | @property (strong, nonatomic) LPActionContext *context;
17 | @property (copy) void (^acceptCompletionBlock)(void);
18 | @property BOOL shouldShowCancelButton;
19 |
20 | @property (weak, nonatomic) IBOutlet UIView *containerView;
21 | @property (weak, nonatomic) IBOutlet UIButton *dismissButton;
22 | @property (weak, nonatomic) IBOutlet UIButton *acceptButton;
23 | @property (weak, nonatomic) IBOutlet UIButton *cancelButton;
24 | @property (weak, nonatomic) IBOutlet UILabel *titleLabel;
25 | @property (weak, nonatomic) IBOutlet UILabel *messageLabel;
26 | @property (weak, nonatomic) IBOutlet UIImageView *backgroundImageView;
27 |
28 | +(nullable LPPopupViewController *)instantiateFromStoryboard;
29 |
30 | @end
31 |
32 | NS_ASSUME_NONNULL_END
33 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/Classes/MessageTemplates/ViewControllers/LPWebInterstitialViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // LPWebInterstitialViewController.h
3 | // LeanplumSDK-iOS
4 | //
5 | // Created by Milos Jakovljevic on 03/04/2020.
6 | // Copyright © 2020 Leanplum. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 |
12 | @class LPActionContext;
13 |
14 | NS_ASSUME_NONNULL_BEGIN
15 |
16 | @interface LPWebInterstitialViewController : UIViewController
17 |
18 | @property (strong, nonatomic) LPActionContext *context;
19 |
20 | @property (weak, nonatomic) IBOutlet UIButton *dismissButton;
21 |
22 | +(nullable LPWebInterstitialViewController *)instantiateFromStoryboard;
23 |
24 | @end
25 |
26 | NS_ASSUME_NONNULL_END
27 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/Classes/MessageTemplates/Views/LPHitView.h:
--------------------------------------------------------------------------------
1 | //
2 | // LPHitView.h
3 | // LeanplumSDK-iOS
4 | //
5 | // Created by Mayank Sanganeria on 2/6/20.
6 | // Copyright © 2020 Leanplum. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface LPHitView : UIView
12 |
13 | @property (weak, nonatomic) UIView *touchDelegate;
14 | @property (assign) BOOL shouldAllowTapToClose;
15 |
16 | - (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event;
17 |
18 | @end
19 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/Classes/MessageTemplates/Views/LPHitView.m:
--------------------------------------------------------------------------------
1 | //
2 | // LPHitView.m
3 | // LeanplumSDK-iOS
4 | //
5 | // Created by Mayank Sanganeria on 2/6/20.
6 | // Copyright © 2020 Leanplum. All rights reserved.
7 | //
8 |
9 | #import "LPHitView.h"
10 |
11 | @implementation LPHitView
12 |
13 | - (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event
14 | {
15 | UIView *hitView = [super hitTest:point withEvent:event];
16 |
17 | if (!hitView) {
18 | return nil;
19 | }
20 |
21 | if (hitView != self || _shouldAllowTapToClose) {
22 | return hitView;
23 | }
24 |
25 | CGPoint convertedPoint = [self.touchDelegate convertPoint:point toView:self];
26 |
27 | return [self.touchDelegate hitTest:convertedPoint withEvent:event];
28 | }
29 |
30 | @end
31 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/Classes/Notifications/LPNotificationsConstants.h:
--------------------------------------------------------------------------------
1 | //
2 | // LPNotificationsConstants.h
3 | // Leanplum-iOS-SDK
4 | //
5 | // Created by Dejan Krstevski on 13.05.20.
6 | // Copyright © 2021 Leanplum. All rights reserved.
7 | //
8 |
9 | #ifndef LPNotificationsConstants_h
10 | #define LPNotificationsConstants_h
11 |
12 |
13 | #endif /* LPNotificationsConstants_h */
14 |
15 | static NSString *LP_KEY_PUSH_MESSAGE_ID = @"_lpm";
16 | static NSString *LP_KEY_PUSH_MUTE_IN_APP = @"_lpu";
17 | static NSString *LP_KEY_PUSH_NO_ACTION = @"_lpn";
18 | static NSString *LP_KEY_PUSH_NO_ACTION_MUTE = @"_lpv";
19 | static NSString *LP_KEY_PUSH_ACTION = @"_lpx";
20 | static NSString *LP_KEY_PUSH_CUSTOM_ACTIONS = @"_lpc";
21 | static NSString *LP_KEY_PUSH_OCCURRENCE_ID = @"lp_occurrence_id";
22 | static NSString *LP_KEY_PUSH_SENT_TIME = @"lp_sent_time";
23 | static NSString *LP_KEY_LOCAL_NOTIF = @"_lpl";
24 |
25 | static NSString *LP_KEY_PUSH_METRIC_SENT_TIME = @"sentTime";
26 | static NSString *LP_KEY_PUSH_METRIC_OCCURRENCE_ID = @"occurrenceId";
27 | static NSString *LP_KEY_PUSH_METRIC_CHANNEL = @"channel";
28 | static NSString *LP_KEY_PUSH_METRIC_MESSAGE_ID = @"messageID";
29 |
30 | static NSString *DEFAULTS_ASKED_TO_PUSH = @"__Leanplum_asked_to_push";
31 | static NSString *DEFAULTS_LEANPLUM_ENABLED_PUSH = @"__Leanplum_enabled_push";
32 | static NSString *DEFAULT_PUSH_CHANNEL = @"APNS";
33 | static NSString *PUSH_DELIVERED_EVENT_NAME = @"Push Delivered";
34 |
35 |
36 | #define LP_PUSH_NOTIFICATION_ACTION @"__Push Notification"
37 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/Classes/Notifications/Local/LPLocalNotificationsManager.h:
--------------------------------------------------------------------------------
1 | //
2 | // LPLocalNotificationsManager.h
3 | // Leanplum-iOS-Location
4 | //
5 | // Created by Dejan Krstevski on 12.05.20.
6 | // Copyright © 2020 Leanplum. All rights reserved.
7 | //
8 |
9 | #import
10 | NS_ASSUME_NONNULL_BEGIN
11 | @class LPActionContext;
12 |
13 | @interface LPLocalNotificationsManager : NSObject
14 |
15 | + (LPLocalNotificationsManager *)sharedManager;
16 | - (void)scheduleLocalNotification:(LPActionContext *)context;
17 | - (void)cancelLocalNotification:(NSString *)context;
18 | @end
19 |
20 | NS_ASSUME_NONNULL_END
21 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/Classes/Utilities/Encryption/LPAES.h:
--------------------------------------------------------------------------------
1 | //
2 | // LPAES.h
3 | // Leanplum
4 | //
5 | // Created by Alexis Oyama on 4/25/17.
6 | // Copyright (c) 2017 Leanplum, Inc. All rights reserved.
7 | //
8 | // Licensed to the Apache Software Foundation (ASF) under one
9 | // or more contributor license agreements. See the NOTICE file
10 | // distributed with this work for additional information
11 | // regarding copyright ownership. The ASF licenses this file
12 | // to you under the Apache License, Version 2.0 (the "License");
13 | // you may not use this file except in compliance with the License.
14 | // You may obtain a copy of the License at
15 | //
16 | // http://www.apache.org/licenses/LICENSE-2.0
17 | //
18 | // Unless required by applicable law or agreed to in writing,
19 | // software distributed under the License is distributed on an
20 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21 | // KIND, either express or implied. See the License for the
22 | // specific language governing permissions and limitations
23 | // under the License.
24 |
25 | #import
26 |
27 | @interface LPAES : NSObject
28 |
29 | /**
30 | * Returns AES128 encrypted data using the crypto framework.
31 | */
32 | + (NSData *)encryptedDataFromData:(NSData *)data;
33 |
34 | /**
35 | * Returns AES128 decrypted data using the crypto framework.
36 | */
37 | + (NSData *)decryptedDataFromData:(NSData *)data;
38 |
39 | @end
40 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/Classes/Utilities/FileMD5Hash.h:
--------------------------------------------------------------------------------
1 | //
2 | // FileMD5Hash.h
3 | // Leanplum
4 | //
5 | // Created by Andrew First on 5/29/12.
6 | // Copyright (c) 2012 Leanplum, Inc. All rights reserved.
7 | //
8 | // Licensed to the Apache Software Foundation (ASF) under one
9 | // or more contributor license agreements. See the NOTICE file
10 | // distributed with this work for additional information
11 | // regarding copyright ownership. The ASF licenses this file
12 | // to you under the Apache License, Version 2.0 (the "License");
13 | // you may not use this file except in compliance with the License.
14 | // You may obtain a copy of the License at
15 | //
16 | // http://www.apache.org/licenses/LICENSE-2.0
17 | //
18 | // Unless required by applicable law or agreed to in writing,
19 | // software distributed under the License is distributed on an
20 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21 | // KIND, either express or implied. See the License for the
22 | // specific language governing permissions and limitations
23 | // under the License.
24 |
25 | #ifndef Leanplum_FileMD5Hash_h
26 | #define Leanplum_FileMD5Hash_h
27 |
28 | // In bytes
29 | #define FileHashDefaultChunkSizeForReadingData 4096
30 |
31 | // Core Foundation
32 | #include
33 |
34 | CFStringRef Leanplum_FileMD5HashCreateWithPath(CFStringRef filePath,
35 | size_t chunkSizeForReadingData);
36 |
37 | #endif
38 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/Classes/Utilities/LPJSON.h:
--------------------------------------------------------------------------------
1 | //
2 | // LPJSON.h
3 | // Leanplum
4 | //
5 | // Created by Alexis Oyama on 2/1/17.
6 | // Copyright (c) 2017 Leanplum, Inc. All rights reserved.
7 | //
8 | // Licensed to the Apache Software Foundation (ASF) under one
9 | // or more contributor license agreements. See the NOTICE file
10 | // distributed with this work for additional information
11 | // regarding copyright ownership. The ASF licenses this file
12 | // to you under the Apache License, Version 2.0 (the "License");
13 | // you may not use this file except in compliance with the License.
14 | // You may obtain a copy of the License at
15 | //
16 | // http://www.apache.org/licenses/LICENSE-2.0
17 | //
18 | // Unless required by applicable law or agreed to in writing,
19 | // software distributed under the License is distributed on an
20 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21 | // KIND, either express or implied. See the License for the
22 | // specific language governing permissions and limitations
23 | // under the License.
24 |
25 | #import
26 |
27 | /**
28 | * LPJSON
29 | * Converts between JSON and string/data using NSJSONSerialization class.
30 | * Made for convenience and readability.
31 | */
32 | @interface LPJSON : NSObject
33 |
34 | /**
35 | * Returns a string from JSON. nil when errored.
36 | */
37 | + (NSString *)stringFromJSON : (id)object;
38 |
39 | /**
40 | * Returns a JSON from NSString. nil when errored.
41 | */
42 | + (id)JSONFromString : (NSString *)string;
43 |
44 | /**
45 | * Returns a JSON from NSData. nil when errored.
46 | */
47 | + (id)JSONFromData: (NSData *)data;
48 |
49 | @end
50 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/Classes/Utilities/LPJSON.m:
--------------------------------------------------------------------------------
1 | //
2 | // LPJSON.m
3 | // Leanplum
4 | //
5 | // Created by Alexis Oyama on 2/1/17.
6 | // Copyright (c) 2017 Leanplum, Inc. All rights reserved.
7 | //
8 | // Licensed to the Apache Software Foundation (ASF) under one
9 | // or more contributor license agreements. See the NOTICE file
10 | // distributed with this work for additional information
11 | // regarding copyright ownership. The ASF licenses this file
12 | // to you under the Apache License, Version 2.0 (the "License");
13 | // you may not use this file except in compliance with the License.
14 | // You may obtain a copy of the License at
15 | //
16 | // http://www.apache.org/licenses/LICENSE-2.0
17 | //
18 | // Unless required by applicable law or agreed to in writing,
19 | // software distributed under the License is distributed on an
20 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21 | // KIND, either express or implied. See the License for the
22 | // specific language governing permissions and limitations
23 | // under the License.
24 |
25 | #import "LPJSON.h"
26 | #import "LeanplumInternal.h"
27 |
28 | @implementation LPJSON
29 |
30 | + (NSString *)stringFromJSON : (id)object
31 | {
32 | if (![NSJSONSerialization isValidJSONObject:object]) {
33 | return nil;
34 | }
35 | NSError *error;
36 | NSData *data = [NSJSONSerialization dataWithJSONObject:object options:0
37 | error:&error];
38 | if (error) {
39 | return nil;
40 | }
41 | return [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
42 | }
43 |
44 | + (id)JSONFromString : (NSString *)string
45 | {
46 | NSData *data = [string dataUsingEncoding:NSUTF8StringEncoding];
47 | return [LPJSON JSONFromData:data];
48 | }
49 |
50 | + (id)JSONFromData: (NSData *)data
51 | {
52 | if (!data) {
53 | return nil;
54 | }
55 |
56 | NSError *error;
57 | id json = [NSJSONSerialization JSONObjectWithData:data options:0 error:&error];
58 | if (error) {
59 | return nil;
60 | }
61 | return json;
62 | }
63 |
64 | @end
65 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/Classes/Utilities/LPKeychainWrapper.h:
--------------------------------------------------------------------------------
1 | //
2 | // LPKeychainWrapper.h
3 | // Leanplum
4 | //
5 | // Copyright (c) 2017 Leanplum, Inc. All rights reserved.
6 | //
7 | // Licensed to the Apache Software Foundation (ASF) under one
8 | // or more contributor license agreements. See the NOTICE file
9 | // distributed with this work for additional information
10 | // regarding copyright ownership. The ASF licenses this file
11 | // to you under the Apache License, Version 2.0 (the "License");
12 | // you may not use this file except in compliance with the License.
13 | // You may obtain a copy of the License at
14 | //
15 | // http://www.apache.org/licenses/LICENSE-2.0
16 | //
17 | // Unless required by applicable law or agreed to in writing,
18 | // software distributed under the License is distributed on an
19 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
20 | // KIND, either express or implied. See the License for the
21 | // specific language governing permissions and limitations
22 | // under the License.
23 |
24 | #import
25 |
26 | @interface LPKeychainWrapper : NSObject {}
27 |
28 | + (NSString *) getPasswordForUsername: (NSString *) username andServiceName: (NSString *) serviceName error: (NSError **) error;
29 | + (BOOL) storeUsername: (NSString *) username andPassword: (NSString *) password forServiceName: (NSString *) serviceName updateExisting: (BOOL) updateExisting error: (NSError **) error;
30 | + (BOOL) deleteItemForUsername: (NSString *) username andServiceName: (NSString *) serviceName error: (NSError **) error;
31 |
32 | + (NSData *)cipherData:(NSData *)data withKey:(NSData*)cipherKey;
33 | + (NSData *)decipherData:(NSData *)data withKey:(NSData*)cipherKey;
34 | + (NSData *)cipherString:(NSString *)data withKey:(NSString*)cipherKey;
35 | + (NSString *)decipherString:(NSData *)data withKey:(NSString*)cipherKey;
36 |
37 | @end
38 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/Classes/Utilities/LPOperationQueue.h:
--------------------------------------------------------------------------------
1 | //
2 | // LPOperationQueue.h
3 | // Leanplum
4 | //
5 | // Created by Milos Jakovljevic on 10/3/19.
6 | // Copyright (c) 2019 Leanplum, Inc. All rights reserved.
7 | //
8 | // Licensed to the Apache Software Foundation (ASF) under one
9 | // or more contributor license agreements. See the NOTICE file
10 | // distributed with this work for additional information
11 | // regarding copyright ownership. The ASF licenses this file
12 | // to you under the Apache License, Version 2.0 (the "License");
13 | // you may not use this file except in compliance with the License.
14 | // You may obtain a copy of the License at
15 | //
16 | // http://www.apache.org/licenses/LICENSE-2.0
17 | //
18 | // Unless required by applicable law or agreed to in writing,
19 | // software distributed under the License is distributed on an
20 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21 | // KIND, either express or implied. See the License for the
22 | // specific language governing permissions and limitations
23 | // under the License.
24 |
25 | #import
26 |
27 | NS_ASSUME_NONNULL_BEGIN
28 |
29 | @interface LPOperationQueue : NSObject
30 |
31 | /**
32 | * Serial Operation Queue should be used to run operations and
33 | * to make sure that requests are sent serially.
34 | */
35 | + (NSOperationQueue *) serialQueue;
36 |
37 | @end
38 |
39 | NS_ASSUME_NONNULL_END
40 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/Classes/Utilities/LPOperationQueue.m:
--------------------------------------------------------------------------------
1 | //
2 | // LPOperationQueue.m
3 | // Leanplum
4 | //
5 | // Created by Milos Jakovljevic on 10/3/19.
6 | // Copyright (c) 2019 Leanplum, Inc. All rights reserved.
7 | //
8 | // Licensed to the Apache Software Foundation (ASF) under one
9 | // or more contributor license agreements. See the NOTICE file
10 | // distributed with this work for additional information
11 | // regarding copyright ownership. The ASF licenses this file
12 | // to you under the Apache License, Version 2.0 (the "License");
13 | // you may not use this file except in compliance with the License.
14 | // You may obtain a copy of the License at
15 | //
16 | // http://www.apache.org/licenses/LICENSE-2.0
17 | //
18 | // Unless required by applicable law or agreed to in writing,
19 | // software distributed under the License is distributed on an
20 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21 | // KIND, either express or implied. See the License for the
22 | // specific language governing permissions and limitations
23 | // under the License.
24 |
25 | #import "LPOperationQueue.h"
26 |
27 | @implementation LPOperationQueue
28 |
29 | + (NSOperationQueue *) serialQueue
30 | {
31 | static NSOperationQueue *_operationQueue;
32 | static dispatch_once_t token;
33 | dispatch_once(&token, ^{
34 | _operationQueue = [NSOperationQueue new];
35 | _operationQueue.maxConcurrentOperationCount = 1;
36 | });
37 | return _operationQueue;
38 | }
39 |
40 | @end
41 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/Classes/Utilities/Vendor/NSTimer-Blocks/NSTimer+Blocks.h:
--------------------------------------------------------------------------------
1 | //
2 | // NSTimer+Blocks.h
3 | //
4 | // Created by Jiva DeVoe on 1/14/11.
5 | // Copyright (C) 2011 by Random Ideas, LLC
6 | //
7 | // Permission is hereby granted, free of charge, to any person obtaining a copy
8 | // of this software and associated documentation files (the "Software"), to deal
9 | // in the Software without restriction, including without limitation the rights
10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 | // copies of the Software, and to permit persons to whom the Software is
12 | // furnished to do so, subject to the following conditions:
13 | //
14 | // The above copyright notice and this permission notice shall be included in
15 | // all copies or substantial portions of the Software.
16 | //
17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23 | // THE SOFTWARE.
24 |
25 | #import
26 |
27 | @interface LPTimerBlocks : NSObject
28 |
29 | +(id)scheduledTimerWithTimeInterval:(NSTimeInterval)inTimeInterval block:(void (^)(void))inBlock repeats:(BOOL)inRepeats;
30 | +(id)timerWithTimeInterval:(NSTimeInterval)inTimeInterval block:(void (^)(void))inBlock repeats:(BOOL)inRepeats;
31 |
32 | @end
33 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/Classes/Utilities/Vendor/UniqueIdentifier/NSString+MD5Addition.h:
--------------------------------------------------------------------------------
1 | //
2 | // NSString+MD5Addition.h
3 | // UIDeviceAddition
4 | //
5 | // Created by Georg Kitz on 20.08.11.
6 | // Copyright 2011 Aurora Apps. All rights reserved.
7 | // Copyright (C) 2012, Georg Kitz, @gekitz
8 | //
9 | // Permission is hereby granted, free of charge, to any person obtaining a copy of
10 | // this software and associated documentation files (the "Software"), to deal in
11 | // the Software without restriction, including without limitation the rights to
12 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
13 | // of the Software, and to permit persons to whom the Software is furnished to do
14 | // so, subject to the following conditions:
15 | //
16 | // The above copyright notice and this permission notice shall be included in all
17 | // copies or substantial portions of the Software.
18 | //
19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 | // SOFTWARE.
26 |
27 | #import
28 |
29 | @interface NSString(MD5Addition)
30 |
31 | - (NSString *) leanplum_stringFromMD5;
32 |
33 | @end
34 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/Classes/Utilities/Vendor/WebSocket/Leanplum_WebSocket+Utils.h:
--------------------------------------------------------------------------------
1 | //
2 | // Leanplum_WebSocket+Utils.h
3 | // LeanplumSDK
4 | //
5 | // Created by Nikola Zagorchev on 31.01.24.
6 | // Copyright © 2024 Leanplum. All rights reserved.
7 |
8 | #import
9 | #import "Leanplum_WebSocket.h"
10 |
11 | NS_ASSUME_NONNULL_BEGIN
12 |
13 | @interface Leanplum_WebSocket (Utils)
14 |
15 | /**
16 | * Checks if the socket handshake response is successful.
17 | * Validates the HTTP status code, Upgrade and Connection headers.
18 | * @param response The handshake string response.
19 | */
20 | + (BOOL)isHandshakeSuccessful:(NSString *)response;
21 |
22 | @end
23 |
24 | NS_ASSUME_NONNULL_END
25 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/ClassesSwift/Actions/ActionManager+Configuration.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ActionManager+Configuration.swift
3 | // LeanplumSDK
4 | //
5 | // Created by Milos Jakovljevic on 4.5.22.
6 | // Copyright © 2022 Leanplum. All rights reserved.
7 |
8 | import Foundation
9 | import UIKit
10 |
11 | extension ActionManager {
12 | /// Configuration of the `ActionManager`
13 | /// - Precondition: set a new `Configuration` to the `ActionManager` with the defined options
14 | public class Configuration {
15 |
16 | /// Keep or dismiss in-app message when push notification is opened. If kept, the action from the
17 | /// push notification will go into the queue and will be presented after in-app dismissal, otherwise
18 | /// the in-app is dismissed and the push notification's action is presented.
19 | ///
20 | /// If `useAsyncHandlers` is `true`, this configuration will not have any effect and
21 | /// push notification open will not dismiss the currently shown message.
22 | ///
23 | /// - Default value: `true`
24 | public let dismissOnPushArrival: Bool
25 |
26 | /// Message queue is paused when app is backgrounded and resumed when app is foregrounded
27 | /// Set to `false` to prevent resuming the message queue when app enters foreground
28 | ///
29 | /// - Default value: `true`
30 | public let resumeOnEnterForeground: Bool
31 |
32 | public init(dismissOnPushArrival: Bool,
33 | resumeOnEnterForeground: Bool) {
34 | self.dismissOnPushArrival = dismissOnPushArrival
35 | self.resumeOnEnterForeground = resumeOnEnterForeground
36 | }
37 | }
38 | }
39 |
40 | extension ActionManager.Configuration {
41 | public static var `default`: ActionManager.Configuration {
42 | .init(
43 | dismissOnPushArrival: true,
44 | resumeOnEnterForeground: true
45 | )
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/ClassesSwift/Actions/ActionManager+Definition.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ActionManager+Definition.swift
3 | // Leanplum
4 | //
5 | // Created by Nikola Zagorchev on 2.01.22.
6 | // Copyright © 2022 Leanplum. All rights reserved.
7 |
8 | import Foundation
9 |
10 | extension ActionManager {
11 |
12 | @objc public func defineAction(definition: ActionDefinition) {
13 | definitions.append(definition)
14 | }
15 |
16 | @objc public func definition(withName name: String) -> ActionDefinition? {
17 | return self.definitions.first(where: { $0.name == name })
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/ClassesSwift/Actions/ActionManager+Processor.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ActionManager+Processor.swift
3 | // LeanplumSDK
4 | //
5 | // Created by Nikola Zagorchev on 3.02.22.
6 | // Copyright © 2022 Leanplum. All rights reserved.
7 |
8 | import Foundation
9 |
10 | extension ActionManager {
11 |
12 | /// Merges in-app messages and actions arguments with default ones from ActionDefinition
13 | /// Downloads files for action arguments
14 | @objc public func processMessagesAndDownloadFiles(_ messages: [AnyHashable: Any]) {
15 | // Set messages
16 | self.messages = messages
17 |
18 | for messageId in messages.keys {
19 | let messageConfig = messages[messageId] as? [AnyHashable: Any]
20 | var newConfig = messageConfig
21 | let actionArgs = messageConfig?[LP_KEY_VARS] as? [AnyHashable: Any] ?? [:]
22 | let actionName = newConfig?[LP_PARAM_ACTION] as? String
23 | let definition = self.definitions.first(where: { $0.name == actionName })
24 |
25 | guard let definition = definition else {
26 | // No definition found, use diff
27 | newConfig?[LP_KEY_VARS] = actionArgs
28 | self.messages[messageId] = newConfig
29 | continue
30 | }
31 |
32 | let defaultArgs = definition.values
33 | let messageVars = ContentMerger.merge(vars: defaultArgs, diff: actionArgs) as? [AnyHashable: Any] ?? [:]
34 | newConfig?[LP_KEY_VARS] = messageVars
35 | self.messages[messageId] = newConfig
36 |
37 | downloadFiles(actionArgs: messageVars,
38 | defaultValues: defaultArgs,
39 | definitionKinds: definition.kinds)
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/ClassesSwift/Actions/ActionManager+Queue.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ActionManager+Queue.swift
3 | // Leanplum
4 | //
5 | // Created by Milos Jakovljevic on 2.01.22.
6 | // Copyright © 2022 Leanplum. All rights reserved.
7 |
8 | import Foundation
9 |
10 | extension ActionManager {
11 | final class Queue {
12 | let lock = DispatchQueue(label: "leanplum.access_dispatch_queue", attributes: .concurrent)
13 | var queue: [Action] = []
14 |
15 | func pushBack(_ item: Action) {
16 | lock.async(flags: .barrier) {
17 | self.queue.append(item)
18 | }
19 | }
20 |
21 | func pushFront(_ item: Action) {
22 | lock.async(flags: .barrier) {
23 | self.queue.insert(item, at: 0)
24 | }
25 | }
26 |
27 | func pop() -> Action? {
28 | return lock.sync {
29 | if !queue.isEmpty {
30 | return queue.remove(at: 0)
31 | }
32 | return nil
33 | }
34 | }
35 |
36 | func first() -> Action? {
37 | return lock.sync {
38 | return queue.first
39 | }
40 | }
41 |
42 | func last() -> Action? {
43 | return lock.sync {
44 | return queue.last
45 | }
46 | }
47 |
48 | func empty() -> Bool {
49 | return lock.sync {
50 | queue.isEmpty
51 | }
52 | }
53 |
54 | func count() -> Int {
55 | return lock.sync {
56 | queue.count
57 | }
58 | }
59 |
60 | func popAll() -> [Action] {
61 | return lock.sync {
62 | var all = [Action]()
63 | while let action = pop() {
64 | all.append(action)
65 | }
66 | return all
67 | }
68 | }
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/ClassesSwift/Actions/ActionManager+Scheduler.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ActionManager+Scheduler.swift
3 | // Leanplum
4 | //
5 | // Created by Milos Jakovljevic on 2.01.22.
6 | // Copyright © 2022 Leanplum. All rights reserved.
7 |
8 | import Foundation
9 |
10 | extension ActionManager {
11 | public class Scheduler {
12 | var actionDelayed: ((Action) -> ())?
13 |
14 | func schedule(action: Action, delay: Int) {
15 | DispatchQueue.main.asyncAfter(deadline: .now() + .seconds(delay)) {
16 | self.actionDelayed?(action)
17 | }
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/ClassesSwift/Actions/ActionManager+State.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ActionManager+State.swift
3 | // Leanplum
4 | //
5 | // Created by Milos Jakovljevic on 2.01.22.
6 | // Copyright © 2022 Leanplum. All rights reserved.
7 |
8 | import Foundation
9 |
10 | extension ActionManager {
11 | struct State {
12 | var currentAction: Action?
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/ClassesSwift/Actions/ActionManager+Tracking.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ActionManager+Tracking.swift
3 | // Leanplum
4 | //
5 | // Created by Milos Jakovljevic on 2.01.22.
6 | // Copyright © 2022 Leanplum. All rights reserved.
7 |
8 | import Foundation
9 |
10 | extension ActionManager {
11 | func recordImpression(action: Action) {
12 | typealias Kind = LeanplumActionKind
13 |
14 | switch action.type {
15 |
16 | case .single:
17 | LPActionTriggerManager.shared().recordMessageImpression(action.context.messageId)
18 |
19 | case .chained:
20 | // We do not want to count occurrences for action kind, because in multi message
21 | // campaigns the Open URL action is not a message. Also if the user has defined
22 | // actions of type Action we do not want to count them.
23 | guard let actionKind = definition(withName: action.context.name)?.kind else {
24 | break
25 | }
26 |
27 | switch actionKind {
28 | case .action:
29 | LPActionTriggerManager.shared().recordChainedActionImpression(action.context.messageId)
30 | case .message, [.action, .message]:
31 | LPActionTriggerManager.shared().recordMessageImpression(action.context.messageId)
32 | default:
33 | break
34 | }
35 |
36 | case .embedded:
37 | break
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/ClassesSwift/Actions/Models/ActionManager+Action.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ActionManager+Action.swift
3 | // Leanplum
4 | //
5 | // Created by Milos Jakovljevic on 2.01.22.
6 | // Copyright © 2022 Leanplum. All rights reserved.
7 |
8 | import Foundation
9 |
10 | extension ActionManager {
11 | struct Action {
12 | enum ActionType {
13 | /// Default action
14 | case single
15 | /// Chained to exisiting action
16 | case chained
17 | /// Embedded inside existing action
18 | case embedded
19 | }
20 |
21 | var type: ActionType = .single
22 | var context: ActionContext
23 |
24 | var notification: Bool {
25 | context.parent != nil && context.parent?.name == LP_PUSH_NOTIFICATION_ACTION
26 | }
27 | }
28 | }
29 |
30 | extension ActionManager.Action {
31 | static func single(context: ActionContext) -> Self {
32 | .init(type: .single, context: context)
33 | }
34 |
35 | static func chained(context: ActionContext) -> Self {
36 | .init(type: .chained, context: context)
37 | }
38 |
39 | static func embedded(context: ActionContext) -> Self {
40 | .init(type: .embedded, context: context)
41 | }
42 |
43 | static func action(context: ActionContext) -> Self {
44 | if context.parent != nil && !context.isChainedMessage {
45 | return .embedded(context: context)
46 | }
47 | if context.isChainedMessage {
48 | return .chained(context: context)
49 | }
50 | return .single(context: context)
51 | }
52 | }
53 |
54 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/ClassesSwift/Actions/Models/ActionManager+ActionsTrigger.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ActionManager+ActionsTrigger.swift
3 | // Leanplum
4 | //
5 | // Created by Milos Jakovljevic on 2.01.22.
6 | // Copyright © 2022 Leanplum. All rights reserved.
7 |
8 | import Foundation
9 |
10 | extension ActionManager {
11 | @objc public class ActionsTrigger: NSObject {
12 | @objc public let eventName: String?
13 | @objc public let condition: [String]?
14 | @objc public let contextualValues: LPContextualValues?
15 |
16 | @objc public required init(eventName: String?,
17 | condition: [String]?,
18 | contextualValues: LPContextualValues?) {
19 | self.eventName = eventName
20 | self.condition = condition
21 | self.contextualValues = contextualValues
22 | super.init()
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/ClassesSwift/Extensions/Bundle+Extensions.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Bundle+Extensions.swift
3 | // LeanplumSDK
4 | //
5 | // Created by Milos Jakovljevic on 24.12.21.
6 | // Copyright © 2021 Leanplum. All rights reserved.
7 |
8 | import Foundation
9 |
10 | extension Bundle {
11 | static var appName: String {
12 | Bundle.main.object(forInfoDictionaryKey: "CFBundleDisplayName") as? String ??
13 | Bundle.main.object(forInfoDictionaryKey: "CFBundleName") as? String ?? ""
14 | }
15 |
16 | static var identifier: String {
17 | Bundle.main.bundleIdentifier ?? ""
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/ClassesSwift/Extensions/Data+EncodedString.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Data+EncodedString.swift
3 | // LeanplumSDK
4 | //
5 | // Copyright (c) 2021 Leanplum, Inc. All rights reserved.
6 | //
7 |
8 | import Foundation
9 |
10 | extension Data {
11 | struct HexEncodingOptions: OptionSet {
12 | let rawValue: Int
13 | static let upperCase = HexEncodingOptions(rawValue: 1 << 0)
14 | }
15 |
16 | func hexEncodedString(options: HexEncodingOptions = []) -> String {
17 | let format = options.contains(.upperCase) ? "%02hhX" : "%02hhx"
18 | return self.map { String(format: format, $0) }.joined()
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/ClassesSwift/Extensions/Dictionary+Equatable.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Dictionary+Equatable.swift
3 | // LeanplumSDK
4 | //
5 | // Copyright (c) 2021 Leanplum, Inc. All rights reserved.
6 | //
7 |
8 | import Foundation
9 |
10 | extension Dictionary {
11 | func isEqual(_ dictionary: [AnyHashable: Any]) -> Bool {
12 | return NSDictionary(dictionary: self).isEqual(to: dictionary)
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/ClassesSwift/Extensions/LPRequestSender+UUID.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ApiConfig.swift
3 | // LeanplumSDK
4 | //
5 | // Created by Nikola Zagorchev on 10.02.22.
6 | //
7 |
8 | import Foundation
9 |
10 | extension LPRequestSender {
11 | enum Constants {
12 | // LEANPLUM_DEFAULTS_UUID_KEY
13 | static let uuidKey = "__leanplum_uuid"
14 | }
15 |
16 | @objc public var uuid: String {
17 | get {
18 | if let uuid = UserDefaults.standard.string(forKey: Constants.uuidKey) {
19 | return uuid
20 | }
21 | // Ensure UUID is set and returned
22 | self.uuid = UUID().uuidString.lowercased()
23 | return self.uuid
24 | }
25 | set {
26 | UserDefaults.standard.setValue(newValue, forKey: Constants.uuidKey)
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/ClassesSwift/Extensions/NSRegularExpression+Matches.swift:
--------------------------------------------------------------------------------
1 | //
2 | // NSRegularExpression+Matches.swift
3 | // LeanplumSDK
4 | //
5 | // Created by Nikola Zagorchev on 19.04.22.
6 | //
7 |
8 | import Foundation
9 |
10 | extension NSRegularExpression {
11 | func matches(_ string: String?) -> Bool {
12 | guard let string = string else {
13 | return false
14 | }
15 |
16 | let range = NSRange(location: 0, length: string.utf16.count)
17 | return firstMatch(in: string, options: [], range: range) != nil
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/ClassesSwift/Extensions/Thread+Name.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Thread+Name.swift
3 | // LeanplumSDK
4 | //
5 | // Created by Nikola Zagorchev on 19.04.23.
6 | // Copyright © 2023 Leanplum. All rights reserved.
7 |
8 | import Foundation
9 |
10 | extension Thread {
11 | var threadName: String {
12 | if isMainThread {
13 | return "main"
14 | } else if let threadName = Thread.current.name, !threadName.isEmpty {
15 | return threadName
16 | } else {
17 | return "background"
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/ClassesSwift/Extensions/UIUserNotificationSettings+Transform.swift:
--------------------------------------------------------------------------------
1 | //
2 | // UIUserNotificationSettings+Transform.swift
3 | // LeanplumSDK
4 | //
5 | // Copyright (c) 2021 Leanplum, Inc. All rights reserved.
6 | //
7 |
8 | import Foundation
9 |
10 | extension UIUserNotificationSettings {
11 | var dictionary: [AnyHashable: Any] {
12 | let types = self.types
13 | var categories: [String] = []
14 | if let tmpCategories = self.categories {
15 | for category in tmpCategories {
16 | if let categoryIdentifier = category.identifier {
17 | categories.append(categoryIdentifier)
18 | }
19 | }
20 | }
21 | let sortedCategories = categories.sorted { (lhs: String, rhs: String) -> Bool in
22 | return lhs.caseInsensitiveCompare(rhs) == .orderedAscending
23 | }
24 | let settings = [
25 | LP_PARAM_DEVICE_USER_NOTIFICATION_TYPES: types.rawValue,
26 | LP_PARAM_DEVICE_USER_NOTIFICATION_CATEGORIES: sortedCategories
27 | ] as [AnyHashable: Any]
28 | return settings
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/ClassesSwift/Extensions/UNNotificationSettings+Transform.swift:
--------------------------------------------------------------------------------
1 | //
2 | // UNNotificationSettings+Transform.swift
3 | // LeanplumSDK
4 | //
5 | // Copyright (c) 2021 Leanplum, Inc. All rights reserved.
6 | //
7 |
8 | import Foundation
9 |
10 | @available(iOS 10.0, *)
11 | extension UNNotificationSettings {
12 | func toInt() -> UInt? {
13 |
14 | let settings = self
15 |
16 | var result: UInt = 0
17 |
18 | // Authorization Status
19 | if #available(iOS 12.0, *) {
20 | if settings.authorizationStatus == .provisional {
21 | return UNAuthorizationOptions.provisional.rawValue
22 | }
23 | }
24 | if settings.authorizationStatus == .notDetermined {
25 | return nil
26 | }
27 | if settings.authorizationStatus == .denied {
28 | return 0
29 | }
30 |
31 | // Authorization Status Enabled
32 | if settings.soundSetting == .enabled {
33 | result |= UNAuthorizationOptions.sound.rawValue
34 | }
35 | if settings.badgeSetting == .enabled {
36 | result |= UNAuthorizationOptions.badge.rawValue
37 | }
38 | if settings.alertSetting == .enabled {
39 | result |= UNAuthorizationOptions.alert.rawValue
40 | }
41 | if settings.lockScreenSetting == .enabled {
42 | result |= (1 << 3)
43 | }
44 | if settings.notificationCenterSetting == .enabled {
45 | result |= (1 << 4)
46 | }
47 | if #available(iOS 15.0, *) {
48 | if settings.timeSensitiveSetting == .enabled {
49 | result |= (1 << 5)
50 | }
51 | }
52 |
53 | return result
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/ClassesSwift/Leanplum.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Leanplum.swift
3 | // LeanplumSDK
4 | //
5 | // Created by Milos Jakovljevic on 4.5.22.
6 | // Copyright © 2022 Leanplum. All rights reserved.
7 |
8 | import Foundation
9 |
10 | extension Leanplum {
11 | @objc static public var actionManager: ActionManager {
12 | .shared
13 | }
14 | }
15 |
16 |
17 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/ClassesSwift/Migration/MigrationManager+Constants.swift:
--------------------------------------------------------------------------------
1 | //
2 | // MigrationManager+Constants.swift
3 | // LeanplumSDK
4 | //
5 | // Created by Nikola Zagorchev on 2.10.22.
6 | // Copyright © 2023 Leanplum. All rights reserved.
7 |
8 | import Foundation
9 |
10 | @objc extension MigrationManager {
11 | enum Constants {
12 | static let AccountIdKey = "__leanplum_ct_account_key"
13 | static let HashKey = "__leanplum_ct_hash_key"
14 | static let AccountTokenKey = "__leanplum_ct_account_token"
15 | static let MigrationStateKey = "__leanplum_migration_state"
16 | static let RegionCodeKey = "__leanplum_region_code"
17 | static let AttributeMappingsKey = "__leanplum_attribute_mappings"
18 | static let IdentityKeysKey = "__leanplum_identity_keys"
19 | static let LoggedInUserIdKey = "__leanplum_logged_in_user_id"
20 |
21 | static let DefaultIdentityKeys = [IdentityManager.Constants.Identity]
22 |
23 | static let CleverTapRequestArg = "ct"
24 | }
25 |
26 | @objc
27 | public class func lpCleverTapRequestArg() -> String {
28 | return Constants.CleverTapRequestArg
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/ClassesSwift/Migration/MigrationState.swift:
--------------------------------------------------------------------------------
1 | //
2 | // MigrationState.swift
3 | // LeanplumSDK
4 | //
5 | // Created by Nikola Zagorchev on 2.10.22.
6 | // Copyright © 2022 Leanplum. All rights reserved.
7 |
8 | import Foundation
9 |
10 | @objc public enum MigrationState: Int, CustomStringConvertible, CaseIterable {
11 |
12 | case undefined = 0,
13 | leanplum,
14 | duplicate,
15 | cleverTap
16 |
17 | public var description: String {
18 | switch self {
19 | case .undefined:
20 | return "undefined"
21 | case .leanplum:
22 | return "lp"
23 | case .duplicate:
24 | return "lp+ct"
25 | case .cleverTap:
26 | return "ct"
27 | }
28 | }
29 |
30 | public init(stringValue: String) {
31 | let value = Self.allCases.first {
32 | $0.description == stringValue
33 | }
34 | self = value ?? .undefined
35 | }
36 |
37 | var useLeanplum: Bool {
38 | self != .cleverTap
39 | }
40 |
41 | var useCleverTap: Bool {
42 | self == .cleverTap || self == .duplicate
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/ClassesSwift/Migration/Wrapper/CTWrapper+Utilities.swift:
--------------------------------------------------------------------------------
1 | //
2 | // CTWrapper+Utilities.swift
3 | // LeanplumSDK
4 | //
5 | // Created by Nikola Zagorchev on 6.10.22.
6 | // Copyright © 2022 Leanplum. All rights reserved.
7 |
8 | import Foundation
9 | // Use @_implementationOnly to *not* expose CleverTapSDK to the Leanplum-Swift header
10 | @_implementationOnly import CleverTapSDK
11 |
12 | extension CTWrapper {
13 | func isAnyNil(_ value: Any) -> Bool {
14 | if case Optional.none = value {
15 | return true
16 | }
17 | return false
18 | }
19 |
20 | var transformArrayValues: ((Any) -> Any) {
21 | return { value in
22 | if let arr = value as? Array {
23 | let arrString = arr
24 | .compactMap{ $0 }
25 | .map {
26 | String(describing: $0!)
27 | }
28 | return ("[\(arrString.joined(separator: ","))]") as Any
29 | }
30 | return value
31 | }
32 | }
33 |
34 | var transformAttributeKeys: ((AnyHashable) -> AnyHashable) {
35 | return { key in
36 | guard let keyStr = key as? String,
37 | let newKey = MigrationManager.shared.attributeMappings[keyStr]
38 | else {
39 | return key
40 | }
41 |
42 | return newKey
43 | }
44 | }
45 | }
46 |
47 | extension CleverTapLogLevel {
48 | init(_ level: LeanplumLogLevel) {
49 | switch level {
50 | case .off:
51 | self = .off
52 | case .error, .info:
53 | self = .info
54 | case .debug:
55 | self = .debug
56 | default:
57 | self = .info
58 | }
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/ClassesSwift/Migration/Wrapper/Wrapper.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Wrapper.swift
3 | // LeanplumSDK
4 | //
5 | // Created by Nikola Zagorchev on 6.10.22.
6 | // Copyright © 2022 Leanplum. All rights reserved.
7 |
8 | protocol Wrapper {
9 | /// Launches the wrapper instance,
10 | /// equivalent to Leanplum start
11 | func launch()
12 |
13 | var hasLaunched: Bool { get }
14 |
15 | /// Adds instance callback, executed when wrapper has initialized
16 | func addInstanceCallback(_ callback: CleverTapInstanceCallback)
17 |
18 | func removeInstanceCallback(_ callback: CleverTapInstanceCallback)
19 |
20 | func track(_ eventName: String?, value: Double, params: [String: Any])
21 |
22 | func trackPurchase(_ eventName: String?, value: Double, currencyCode: String?, params: [String: Any])
23 |
24 | func advance(_ stateName: String?, params: [String: Any])
25 |
26 | func trackInAppPurchase(_ eventName: String?,
27 | value: Double,
28 | currencyCode: String?,
29 | iOSTransactionIdentifier: String?,
30 | iOSReceiptData: String?,
31 | iOSSandbox: Bool,
32 | params: [String: Any])
33 |
34 | func setUserAttributes(_ attributes: [AnyHashable: Any])
35 |
36 | func setUserId(_ userId: String)
37 |
38 | func setPushToken(_ token: Data)
39 |
40 | func setTrafficSourceInfo(_ info: [AnyHashable: Any])
41 |
42 | func setLogLevel(_ level: LeanplumLogLevel)
43 | }
44 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/ClassesSwift/Notifications/Proxy/NotificationsProxy+Utilities.swift:
--------------------------------------------------------------------------------
1 | //
2 | // NotificationsProxy+Utilities.swift
3 | // LeanplumSDK
4 | //
5 | // Created by Nikola Zagorchev on 23.12.21.
6 | // Copyright © 2023 Leanplum. All rights reserved.
7 |
8 | import Foundation
9 |
10 | extension NotificationsProxy {
11 |
12 | func isEqualToHandledNotification(userInfo: [AnyHashable: Any]) -> Bool {
13 | if let fromStart = notificationHandledFromStart {
14 | let idA = Leanplum.notificationsManager().getNotificationId(fromStart)
15 | let idB = Leanplum.notificationsManager().getNotificationId(userInfo)
16 | // CleverTap notifications do not have notification Id
17 | return idA == idB && idA != "-1"
18 | }
19 | return false
20 | }
21 |
22 | @objc public func setCustomAppDelegate(_ delegate: UIApplicationDelegate) {
23 | isCustomAppDelegateUsed = true
24 | appDelegate = delegate
25 | }
26 |
27 | /// Ensures the original AppDelegate is swizzled when using mParticle
28 | /// or another library that proxies the AppDelegate that way
29 | func ensureOriginalAppDelegate() {
30 | if let delegate = appDelegate, String(describing: delegate.self).contains("AppDelegateProxy") {
31 | let sel = Selector(("originalAppDelegate"))
32 | let method = class_getInstanceMethod(object_getClass(delegate), sel)
33 | if let instanceMethod = method {
34 | let imp = method_getImplementation(instanceMethod)
35 | typealias OriginalAppDelegateGetter = @convention(c) (AnyObject, Selector) -> UIApplicationDelegate?
36 | let curriedImplementation: OriginalAppDelegateGetter =
37 | unsafeBitCast(imp, to: OriginalAppDelegateGetter.self)
38 | let originalAppDelegate = curriedImplementation(delegate, sel)
39 | if originalAppDelegate != nil {
40 | appDelegate = originalAppDelegate
41 | }
42 | }
43 | }
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/ClassesSwift/Utilities/Logging.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Logging.swift
3 | // LeanplumSDK
4 | //
5 | // Created by Nikola Zagorchev on 23.12.21.
6 | // Copyright (c) 2021 Leanplum, Inc. All rights reserved.
7 |
8 | /**
9 | * Swift equivalent of the LPLog C function
10 | */
11 | enum Log {
12 | static func info(_ msg: String) {
13 | LPLogv(.info, msg, getVaList([]))
14 | }
15 |
16 | static func debug(_ msg: String) {
17 | LPLogv(.debug, msg, getVaList([]))
18 | }
19 |
20 | static func error(_ msg: String) {
21 | LPLogv(.error, msg, getVaList([]))
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/ClassesSwift/Utilities/PropertyWrappers.swift:
--------------------------------------------------------------------------------
1 | //
2 | // PropertyWrappers.swift
3 | // LeanplumSDK
4 | //
5 | // Created by Nikola Zagorchev on 2.10.22.
6 | //
7 |
8 | import Foundation
9 |
10 | @propertyWrapper
11 | struct StringOptionalUserDefaults {
12 | private var key: String
13 |
14 | var wrappedValue: String? {
15 | get { UserDefaults.standard.string(forKey: key) }
16 | set { UserDefaults.standard.setValue(newValue, forKey: key) }
17 | }
18 |
19 | init(key: String) {
20 | self.key = key
21 | }
22 | }
23 |
24 | @propertyWrapper
25 | struct MigrationStateUserDefaults {
26 | private var key: String
27 | private var defaultValue: MigrationState
28 |
29 | public var wrappedValue: MigrationState {
30 | get {
31 | if let value = UserDefaults.standard.string(forKey: key) {
32 | return MigrationState(stringValue: value)
33 | }
34 | return defaultValue
35 | }
36 | set { UserDefaults.standard.setValue(newValue.description, forKey: key) }
37 | }
38 |
39 | init(key: String, defaultValue: MigrationState) {
40 | self.key = key
41 | self.defaultValue = defaultValue
42 | }
43 | }
44 |
45 | @propertyWrapper
46 | struct PropUserDefaults {
47 | private var key: String
48 | private var defaultValue: T
49 |
50 | var wrappedValue: T {
51 | get {
52 | guard let value = UserDefaults.standard.object(forKey: key) as? T
53 | else { return defaultValue }
54 |
55 | return value
56 | }
57 | set { UserDefaults.standard.setValue(newValue, forKey: key) }
58 | }
59 |
60 | init(key: String, defaultValue: T) {
61 | self.key = key
62 | self.defaultValue = defaultValue
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/ClassesSwift/Utilities/WeakTimer.swift:
--------------------------------------------------------------------------------
1 | //
2 | // WeakTimer.swift
3 | // LeanplumSDK
4 | //
5 | // Created by Nikola Zagorchev on 23.02.22.
6 | // Copyright © 2022 Leanplum. All rights reserved.
7 |
8 | import Foundation
9 |
10 | @objc(LPWeakTimer)
11 | public class WeakTimer: NSObject {
12 | private weak var target: AnyObject?
13 | private let action: (Timer) -> Void
14 |
15 | private init(target: AnyObject,
16 | action: @escaping (Timer) -> Void) {
17 | self.target = target
18 | self.action = action
19 | }
20 |
21 | @objc fileprivate func fire(timer: Timer) {
22 | if target != nil {
23 | action(timer)
24 | } else {
25 | timer.invalidate()
26 | }
27 | }
28 |
29 | @objc(scheduledTimerWithTimeInterval:target:userInfo:repeats:block:)
30 | public static func scheduledTimer(timeInterval: TimeInterval,
31 | target: AnyObject,
32 | userInfo:Any?,
33 | repeats: Bool,
34 | action: @escaping (Timer) -> Void) -> Timer {
35 |
36 | let target = WeakTimer(target: target, action: action)
37 | return .scheduledTimer(timeInterval: timeInterval,
38 | target: target,
39 | selector: #selector(fire),
40 | userInfo: userInfo,
41 | repeats: repeats)
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/Resources:
--------------------------------------------------------------------------------
1 | ../LeanplumSDKBundle/Resources
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/Supporting Files/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | MinimumOSVersion
6 | 100.0
7 | CFBundleDevelopmentRegion
8 | $(DEVELOPMENT_LANGUAGE)
9 | CFBundleExecutable
10 | $(EXECUTABLE_NAME)
11 | CFBundleIdentifier
12 | $(PRODUCT_BUNDLE_IDENTIFIER)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | $(PRODUCT_NAME)
17 | CFBundlePackageType
18 | $(PRODUCT_BUNDLE_PACKAGE_TYPE)
19 | CFBundleShortVersionString
20 | 1.0
21 | CFBundleVersion
22 | $(CURRENT_PROJECT_VERSION)
23 |
24 |
25 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/Supporting Files/Leanplum.modulemap:
--------------------------------------------------------------------------------
1 | framework module Leanplum {
2 | umbrella header "LeanplumSDK.h"
3 |
4 | export *
5 | module * { export * }
6 | }
7 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/include/FileMD5Hash.h:
--------------------------------------------------------------------------------
1 | ../Classes/Utilities/FileMD5Hash.h
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/include/LPAES.h:
--------------------------------------------------------------------------------
1 | ../Classes/Utilities/Encryption/LPAES.h
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/include/LPAPIConfig.h:
--------------------------------------------------------------------------------
1 | ../Classes/Managers/Networking/LPAPIConfig.h
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/include/LPActionArg.h:
--------------------------------------------------------------------------------
1 | ../Classes/LPActionArg.h
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/include/LPActionContext-Internal.h:
--------------------------------------------------------------------------------
1 | ../Classes/Features/Actions/LPActionContext-Internal.h
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/include/LPActionContext.h:
--------------------------------------------------------------------------------
1 | ../Classes/LPActionContext.h
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/include/LPActionManager.h:
--------------------------------------------------------------------------------
1 | ../Classes/Features/Actions/LPActionManager.h
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/include/LPAlertMessageTemplate.h:
--------------------------------------------------------------------------------
1 | ../Classes/MessageTemplates/LPAlertMessageTemplate.h
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/include/LPAppIconManager.h:
--------------------------------------------------------------------------------
1 | ../Classes/Managers/LPAppIconManager.h
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/include/LPAppRatingMessageTemplate.h:
--------------------------------------------------------------------------------
1 | ../Classes/MessageTemplates/LPAppRatingMessageTemplate.h
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/include/LPCenterPopupMessageTemplate.h:
--------------------------------------------------------------------------------
1 | ../Classes/MessageTemplates/LPCenterPopupMessageTemplate.h
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/include/LPConfirmMessageTemplate.h:
--------------------------------------------------------------------------------
1 | ../Classes/MessageTemplates/LPConfirmMessageTemplate.h
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/include/LPConstants.h:
--------------------------------------------------------------------------------
1 | ../Classes/Internal/LPConstants.h
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/include/LPContextualValues.h:
--------------------------------------------------------------------------------
1 | ../Classes/Internal/LPContextualValues.h
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/include/LPCountAggregator.h:
--------------------------------------------------------------------------------
1 | ../Classes/Managers/LPCountAggregator.h
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/include/LPDatabase.h:
--------------------------------------------------------------------------------
1 | ../Classes/Utilities/LPDatabase.h
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/include/LPDeferMessageManager.h:
--------------------------------------------------------------------------------
1 | ../Classes/Managers/LPDeferMessageManager.h
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/include/LPEnumConstants.h:
--------------------------------------------------------------------------------
1 | ../Classes/Internal/LPEnumConstants.h
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/include/LPEventCallback.h:
--------------------------------------------------------------------------------
1 | ../Classes/Features/Events/LPEventCallback.h
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/include/LPEventCallbackManager.h:
--------------------------------------------------------------------------------
1 | ../Classes/Features/Events/LPEventCallbackManager.h
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/include/LPEventDataManager.h:
--------------------------------------------------------------------------------
1 | ../Classes/Features/Events/LPEventDataManager.h
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/include/LPExceptionHandler.h:
--------------------------------------------------------------------------------
1 | ../Classes/Internal/Monitoring/LPExceptionHandler.h
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/include/LPFeatureFlagManager.h:
--------------------------------------------------------------------------------
1 | ../Classes/Internal/FeatureFlag/LPFeatureFlagManager.h
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/include/LPFeatureFlags.h:
--------------------------------------------------------------------------------
1 | ../Classes/Internal/FeatureFlag/LPFeatureFlags.h
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/include/LPFileManager.h:
--------------------------------------------------------------------------------
1 | ../Classes/Managers/LPFileManager.h
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/include/LPFileTransferManager.h:
--------------------------------------------------------------------------------
1 | ../Classes/Managers/Networking/LPFileTransferManager.h
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/include/LPHitView.h:
--------------------------------------------------------------------------------
1 | ../Classes/MessageTemplates/Views/LPHitView.h
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/include/LPIconChangeMessageTemplate.h:
--------------------------------------------------------------------------------
1 | ../Classes/MessageTemplates/LPIconChangeMessageTemplate.h
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/include/LPInbox.h:
--------------------------------------------------------------------------------
1 | ../Classes/LPInbox.h
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/include/LPInternalState.h:
--------------------------------------------------------------------------------
1 | ../Classes/Internal/LPInternalState.h
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/include/LPInterstitialMessageTemplate.h:
--------------------------------------------------------------------------------
1 | ../Classes/MessageTemplates/LPInterstitialMessageTemplate.h
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/include/LPInterstitialViewController.h:
--------------------------------------------------------------------------------
1 | ../Classes/MessageTemplates/ViewControllers/LPInterstitialViewController.h
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/include/LPJSON.h:
--------------------------------------------------------------------------------
1 | ../Classes/Utilities/LPJSON.h
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/include/LPKeychainWrapper.h:
--------------------------------------------------------------------------------
1 | ../Classes/Utilities/LPKeychainWrapper.h
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/include/LPLocalNotificationsHandler.h:
--------------------------------------------------------------------------------
1 | ../Classes/Notifications/Local/LPLocalNotificationsHandler.h
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/include/LPLocalNotificationsManager.h:
--------------------------------------------------------------------------------
1 | ../Classes/Notifications/Local/LPLocalNotificationsManager.h
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/include/LPLogManager.h:
--------------------------------------------------------------------------------
1 | ../Classes/Managers/LPLogManager.h
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/include/LPMessageArchiveData.h:
--------------------------------------------------------------------------------
1 | ../Classes/Models/LPMessageArchiveData.h
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/include/LPMessageTemplateConstants.h:
--------------------------------------------------------------------------------
1 | ../Classes/MessageTemplates/LPMessageTemplateConstants.h
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/include/LPMessageTemplateProtocol.h:
--------------------------------------------------------------------------------
1 | ../Classes/MessageTemplates/LPMessageTemplateProtocol.h
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/include/LPMessageTemplateUtilities.h:
--------------------------------------------------------------------------------
1 | ../Classes/MessageTemplates/ViewControllers/LPMessageTemplateUtilities.h
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/include/LPMessageTemplates.h:
--------------------------------------------------------------------------------
1 | ../Classes/LPMessageTemplates.h
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/include/LPNetworkConstants.h:
--------------------------------------------------------------------------------
1 | ../Classes/Managers/Networking/LPNetworkConstants.h
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/include/LPNetworkEngine.h:
--------------------------------------------------------------------------------
1 | ../Classes/Managers/Networking/LPNetworkEngine.h
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/include/LPNetworkFactory.h:
--------------------------------------------------------------------------------
1 | ../Classes/Managers/Networking/LPNetworkFactory.h
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/include/LPNetworkOperation.h:
--------------------------------------------------------------------------------
1 | ../Classes/Managers/Networking/LPNetworkOperation.h
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/include/LPNetworkProtocol.h:
--------------------------------------------------------------------------------
1 | ../Classes/Managers/Networking/LPNetworkProtocol.h
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/include/LPNotificationsConstants.h:
--------------------------------------------------------------------------------
1 | ../Classes/Notifications/LPNotificationsConstants.h
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/include/LPNotificationsManager.h:
--------------------------------------------------------------------------------
1 | ../Classes/Notifications/LPNotificationsManager.h
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/include/LPOpenUrlMessageTemplate.h:
--------------------------------------------------------------------------------
1 | ../Classes/MessageTemplates/LPOpenUrlMessageTemplate.h
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/include/LPOperationQueue.h:
--------------------------------------------------------------------------------
1 | ../Classes/Utilities/LPOperationQueue.h
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/include/LPPopupViewController.h:
--------------------------------------------------------------------------------
1 | ../Classes/MessageTemplates/ViewControllers/LPPopupViewController.h
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/include/LPPushAskToAskMessageTemplate.h:
--------------------------------------------------------------------------------
1 | ../Classes/MessageTemplates/LPPushAskToAskMessageTemplate.h
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/include/LPPushMessageTemplate.h:
--------------------------------------------------------------------------------
1 | ../Classes/MessageTemplates/LPPushMessageTemplate.h
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/include/LPPushNotificationsHandler.h:
--------------------------------------------------------------------------------
1 | ../Classes/Notifications/Push/LPPushNotificationsHandler.h
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/include/LPPushNotificationsManager.h:
--------------------------------------------------------------------------------
1 | ../Classes/Notifications/Push/LPPushNotificationsManager.h
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/include/LPRegisterDevice.h:
--------------------------------------------------------------------------------
1 | ../Classes/Managers/LPRegisterDevice.h
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/include/LPRegisterForPushMessageTemplate.h:
--------------------------------------------------------------------------------
1 | ../Classes/MessageTemplates/LPRegisterForPushMessageTemplate.h
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/include/LPRequest.h:
--------------------------------------------------------------------------------
1 | ../Classes/Managers/Networking/LPRequest.h
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/include/LPRequestBatch.h:
--------------------------------------------------------------------------------
1 | ../Classes/Managers/Networking/LPRequestBatch.h
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/include/LPRequestBatchFactory.h:
--------------------------------------------------------------------------------
1 | ../Classes/Managers/Networking/LPRequestBatchFactory.h
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/include/LPRequestFactory.h:
--------------------------------------------------------------------------------
1 | ../Classes/Managers/Networking/LPRequestFactory.h
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/include/LPRequestSender.h:
--------------------------------------------------------------------------------
1 | ../Classes/Managers/Networking/LPRequestSender.h
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/include/LPRequestSenderTimer.h:
--------------------------------------------------------------------------------
1 | ../Classes/Managers/Networking/LPRequestSenderTimer.h
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/include/LPRequestUUIDHelper.h:
--------------------------------------------------------------------------------
1 | ../Classes/Managers/Networking/LPRequestUUIDHelper.h
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/include/LPResponse.h:
--------------------------------------------------------------------------------
1 | ../Classes/Managers/Networking/LPResponse.h
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/include/LPRevenueManager.h:
--------------------------------------------------------------------------------
1 | ../Classes/Managers/LPRevenueManager.h
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/include/LPRichInterstitialMessageTemplate.h:
--------------------------------------------------------------------------------
1 | ../Classes/MessageTemplates/LPRichInterstitialMessageTemplate.h
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/include/LPSecuredVars.h:
--------------------------------------------------------------------------------
1 | ../Classes/Features/Variables/LPSecuredVars.h
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/include/LPSwizzle.h:
--------------------------------------------------------------------------------
1 | ../Classes/Utilities/LPSwizzle.h
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/include/LPUIAlert.h:
--------------------------------------------------------------------------------
1 | ../Classes/Features/Actions/LPUIAlert.h
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/include/LPUtils.h:
--------------------------------------------------------------------------------
1 | ../Classes/Utilities/LPUtils.h
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/include/LPVar-Internal.h:
--------------------------------------------------------------------------------
1 | ../Classes/Features/Variables/LPVar-Internal.h
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/include/LPVar.h:
--------------------------------------------------------------------------------
1 | ../Classes/LPVar.h
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/include/LPVarCache.h:
--------------------------------------------------------------------------------
1 | ../Classes/Features/Variables/LPVarCache.h
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/include/LPWebInterstitialMessageTemplate.h:
--------------------------------------------------------------------------------
1 | ../Classes/MessageTemplates/LPWebInterstitialMessageTemplate.h
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/include/LPWebInterstitialViewController.h:
--------------------------------------------------------------------------------
1 | ../Classes/MessageTemplates/ViewControllers/LPWebInterstitialViewController.h
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/include/Leanplum.h:
--------------------------------------------------------------------------------
1 | ../Classes/Leanplum.h
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/include/LeanplumCompatibility.h:
--------------------------------------------------------------------------------
1 | ../Classes/LeanplumCompatibility.h
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/include/LeanplumInternal.h:
--------------------------------------------------------------------------------
1 | ../Classes/Internal/LeanplumInternal.h
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/include/LeanplumSDK.h:
--------------------------------------------------------------------------------
1 | ../Classes/LeanplumSDK.h
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/include/LeanplumSocket.h:
--------------------------------------------------------------------------------
1 | ../Classes/Managers/Networking/LeanplumSocket.h
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/include/Leanplum_AsyncSocket.h:
--------------------------------------------------------------------------------
1 | ../Classes/Utilities/Vendor/WebSocket/AsyncSocket/Leanplum_AsyncSocket.h
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/include/Leanplum_Reachability.h:
--------------------------------------------------------------------------------
1 | ../Classes/Utilities/Vendor/Reachability/Leanplum_Reachability.h
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/include/Leanplum_SocketIO.h:
--------------------------------------------------------------------------------
1 | ../Classes/Utilities/Vendor/SocketIO/Leanplum_SocketIO.h
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/include/Leanplum_WebSocket.h:
--------------------------------------------------------------------------------
1 | ../Classes/Utilities/Vendor/WebSocket/Leanplum_WebSocket.h
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/include/NSString+MD5Addition.h:
--------------------------------------------------------------------------------
1 | ../Classes/Utilities/Vendor/UniqueIdentifier/NSString+MD5Addition.h
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/include/NSTimer+Blocks.h:
--------------------------------------------------------------------------------
1 | ../Classes/Utilities/Vendor/NSTimer-Blocks/NSTimer+Blocks.h
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDK/include/UIDevice+IdentifierAddition.h:
--------------------------------------------------------------------------------
1 | ../Classes/Utilities/Vendor/UniqueIdentifier/UIDevice+IdentifierAddition.h
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDKBundle/Resources/Assets.xcassets/Buttons/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "author" : "xcode",
4 | "version" : 1
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDKBundle/Resources/Assets.xcassets/Buttons/close.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "filename" : "close.png",
5 | "idiom" : "universal",
6 | "scale" : "1x"
7 | },
8 | {
9 | "filename" : "close@2x.png",
10 | "idiom" : "universal",
11 | "scale" : "2x"
12 | },
13 | {
14 | "filename" : "close@3x.png",
15 | "idiom" : "universal",
16 | "scale" : "3x"
17 | }
18 | ],
19 | "info" : {
20 | "author" : "xcode",
21 | "version" : 1
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDKBundle/Resources/Assets.xcassets/Buttons/close.imageset/close.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Leanplum/Leanplum-iOS-SDK/0a1f2142bab6db644bb96b7b474e42c1285b1001/LeanplumSDK/LeanplumSDKBundle/Resources/Assets.xcassets/Buttons/close.imageset/close.png
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDKBundle/Resources/Assets.xcassets/Buttons/close.imageset/close@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Leanplum/Leanplum-iOS-SDK/0a1f2142bab6db644bb96b7b474e42c1285b1001/LeanplumSDK/LeanplumSDKBundle/Resources/Assets.xcassets/Buttons/close.imageset/close@2x.png
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDKBundle/Resources/Assets.xcassets/Buttons/close.imageset/close@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Leanplum/Leanplum-iOS-SDK/0a1f2142bab6db644bb96b7b474e42c1285b1001/LeanplumSDK/LeanplumSDKBundle/Resources/Assets.xcassets/Buttons/close.imageset/close@3x.png
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDKBundle/Resources/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "author" : "xcode",
4 | "version" : 1
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/LeanplumSDK/LeanplumSDKBundle/Supporting Files/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleIdentifier
8 | $(PRODUCT_BUNDLE_IDENTIFIER)
9 | CFBundleInfoDictionaryVersion
10 | 6.0
11 | CFBundleName
12 | $(PRODUCT_NAME)
13 | CFBundlePackageType
14 | $(PRODUCT_BUNDLE_PACKAGE_TYPE)
15 | CFBundleShortVersionString
16 | 1.0
17 | CFBundleVersion
18 | 1
19 | NSPrincipalClass
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/LeanplumSDKApp/LeanplumSDKApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/LeanplumSDKApp/LeanplumSDKApp.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/LeanplumSDKApp/LeanplumSDKApp/Classes/ViewController.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.swift
3 | // LeanplumSDKApp
4 | //
5 | // Created by Milos Jakovljevic on 6/24/21.
6 | // Copyright (c) 2021 Leanplum, Inc. All rights reserved.
7 | //
8 | // Licensed to the Apache Software Foundation (ASF) under one
9 | // or more contributor license agreements. See the NOTICE file
10 | // distributed with this work for additional information
11 | // regarding copyright ownership. The ASF licenses this file
12 | // to you under the Apache License, Version 2.0 (the "License");
13 | // you may not use this file except in compliance with the License.
14 | // You may obtain a copy of the License at
15 | //
16 | // http://www.apache.org/licenses/LICENSE-2.0
17 | //
18 | // Unless required by applicable law or agreed to in writing,
19 | // software distributed under the License is distributed on an
20 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21 | // KIND, either express or implied. See the License for the
22 | // specific language governing permissions and limitations
23 | // under the License.
24 |
25 | import UIKit
26 |
27 | class ViewController: UIViewController {
28 |
29 | override func viewDidLoad() {
30 | super.viewDidLoad()
31 | // Do any additional setup after loading the view.
32 | }
33 | }
34 |
35 |
--------------------------------------------------------------------------------
/LeanplumSDKApp/LeanplumSDKApp/Supporting Files/Assets.xcassets/AccentColor.colorset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "colors" : [
3 | {
4 | "idiom" : "universal"
5 | }
6 | ],
7 | "info" : {
8 | "author" : "xcode",
9 | "version" : 1
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/LeanplumSDKApp/LeanplumSDKApp/Supporting Files/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "iphone",
5 | "scale" : "2x",
6 | "size" : "20x20"
7 | },
8 | {
9 | "idiom" : "iphone",
10 | "scale" : "3x",
11 | "size" : "20x20"
12 | },
13 | {
14 | "idiom" : "iphone",
15 | "scale" : "2x",
16 | "size" : "29x29"
17 | },
18 | {
19 | "idiom" : "iphone",
20 | "scale" : "3x",
21 | "size" : "29x29"
22 | },
23 | {
24 | "idiom" : "iphone",
25 | "scale" : "2x",
26 | "size" : "40x40"
27 | },
28 | {
29 | "idiom" : "iphone",
30 | "scale" : "3x",
31 | "size" : "40x40"
32 | },
33 | {
34 | "idiom" : "iphone",
35 | "scale" : "2x",
36 | "size" : "60x60"
37 | },
38 | {
39 | "idiom" : "iphone",
40 | "scale" : "3x",
41 | "size" : "60x60"
42 | },
43 | {
44 | "idiom" : "ipad",
45 | "scale" : "1x",
46 | "size" : "20x20"
47 | },
48 | {
49 | "idiom" : "ipad",
50 | "scale" : "2x",
51 | "size" : "20x20"
52 | },
53 | {
54 | "idiom" : "ipad",
55 | "scale" : "1x",
56 | "size" : "29x29"
57 | },
58 | {
59 | "idiom" : "ipad",
60 | "scale" : "2x",
61 | "size" : "29x29"
62 | },
63 | {
64 | "idiom" : "ipad",
65 | "scale" : "1x",
66 | "size" : "40x40"
67 | },
68 | {
69 | "idiom" : "ipad",
70 | "scale" : "2x",
71 | "size" : "40x40"
72 | },
73 | {
74 | "idiom" : "ipad",
75 | "scale" : "1x",
76 | "size" : "76x76"
77 | },
78 | {
79 | "idiom" : "ipad",
80 | "scale" : "2x",
81 | "size" : "76x76"
82 | },
83 | {
84 | "idiom" : "ipad",
85 | "scale" : "2x",
86 | "size" : "83.5x83.5"
87 | },
88 | {
89 | "idiom" : "ios-marketing",
90 | "scale" : "1x",
91 | "size" : "1024x1024"
92 | }
93 | ],
94 | "info" : {
95 | "author" : "xcode",
96 | "version" : 1
97 | }
98 | }
99 |
--------------------------------------------------------------------------------
/LeanplumSDKApp/LeanplumSDKApp/Supporting Files/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "author" : "xcode",
4 | "version" : 1
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/LeanplumSDKApp/LeanplumSDKApp/Supporting Files/Base.lproj/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/LeanplumSDKApp/LeanplumSDKApp/Supporting Files/Base.lproj/Main.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/LeanplumSDKApp/LeanplumSDKTests/Classes/Extensions/LPNetworkEngine+Category.h:
--------------------------------------------------------------------------------
1 | //
2 | // LPNetworkEngine+Category.h
3 | // Leanplum-SDK
4 | //
5 | // Created by Alexis Oyama on 12/5/16.
6 | // Copyright © 2016 Leanplum. All rights reserved.
7 | //
8 | // Licensed to the Apache Software Foundation (ASF) under one
9 | // or more contributor license agreements. See the NOTICE file
10 | // distributed with this work for additional information
11 | // regarding copyright ownership. The ASF licenses this file
12 | // to you under the Apache License, Version 2.0 (the "License");
13 | // you may not use this file except in compliance with the License.
14 | // You may obtain a copy of the License at
15 | //
16 | // http://www.apache.org/licenses/LICENSE-2.0
17 | //
18 | // Unless required by applicable law or agreed to in writing,
19 | // software distributed under the License is distributed on an
20 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21 | // KIND, either express or implied. See the License for the
22 | // specific language governing permissions and limitations
23 | // under the License.
24 |
25 |
26 | #import
27 | #import
28 | #import
29 |
30 | @interface LPNetworkEngine (MethodSwizzling)
31 |
32 | + (void)setupValidateOperation;
33 |
34 | + (void)enableForceSynchronous;
35 | + (void)disableForceSynchronous;
36 |
37 | + (void)validate_operation:(BOOL (^)(LPNetworkOperation *))callback;
38 |
39 | @end
40 |
--------------------------------------------------------------------------------
/LeanplumSDKApp/LeanplumSDKTests/Classes/Extensions/LPNetworkOperation+Category.h:
--------------------------------------------------------------------------------
1 | //
2 | // LPNetworkOperation+Category.h
3 | // Leanplum-SDK-Tests
4 | //
5 | // Created by Alexis Oyama on 6/15/17.
6 | // Copyright © 2017 Leanplum. All rights reserved.
7 | //
8 | // Licensed to the Apache Software Foundation (ASF) under one
9 | // or more contributor license agreements. See the NOTICE file
10 | // distributed with this work for additional information
11 | // regarding copyright ownership. The ASF licenses this file
12 | // to you under the Apache License, Version 2.0 (the "License");
13 | // you may not use this file except in compliance with the License.
14 | // You may obtain a copy of the License at
15 | //
16 | // http://www.apache.org/licenses/LICENSE-2.0
17 | //
18 | // Unless required by applicable law or agreed to in writing,
19 | // software distributed under the License is distributed on an
20 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21 | // KIND, either express or implied. See the License for the
22 | // specific language governing permissions and limitations
23 | // under the License.
24 |
25 |
26 | #import
27 | #import
28 |
29 | @interface LPNetworkOperation (MethodSwizzling)
30 |
31 | + (void)swizzle_methods;
32 | + (void)unswizzle_methods;
33 |
34 | @end
35 |
--------------------------------------------------------------------------------
/LeanplumSDKApp/LeanplumSDKTests/Classes/Extensions/LPOpenUrlMessageTemplate+Extenstion.h:
--------------------------------------------------------------------------------
1 | //
2 | // LPOpenUrlMessageTemplate+Extenstion.h
3 | // Leanplum-SDK_Tests
4 | //
5 | // Created by Dejan . Krstevski on 16.04.20.
6 | // Copyright © 2020 Leanplum. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | #ifndef LPOpenUrlMessageTemplate_Extenstion_h
12 | #define LPOpenUrlMessageTemplate_Extenstion_h
13 |
14 | @interface LPOpenUrlMessageTemplate(UnitTest)
15 |
16 | - (NSString *)urlEncodedStringFromString:(NSString *)urlString;
17 |
18 | @end
19 |
20 | #endif /* LPOpenUrlMessageTemplate_Extenstion_h */
21 |
--------------------------------------------------------------------------------
/LeanplumSDKApp/LeanplumSDKTests/Classes/Extensions/LPRequest+Extension.h:
--------------------------------------------------------------------------------
1 | //
2 | // LPRequest+Extension.h
3 | // Leanplum-SDK_Tests
4 | //
5 | // Created by Dejan Krstevski on 28.07.20.
6 | // Copyright © 2020 Leanplum. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | NS_ASSUME_NONNULL_BEGIN
12 |
13 | @interface LPRequest (Extension)
14 | + (void)validate_onResponse:(LPNetworkResponseBlock)response;
15 | + (void)swizzle_methods;
16 | + (void)unswizzle_methods;
17 | + (void)reset;
18 | @end
19 |
20 | NS_ASSUME_NONNULL_END
21 |
--------------------------------------------------------------------------------
/LeanplumSDKApp/LeanplumSDKTests/Classes/Extensions/LPRequestFactory+Extension.h:
--------------------------------------------------------------------------------
1 | //
2 | // LPRequestFactory+Extension.h
3 | // Leanplum-SDK_Tests
4 | //
5 | // Created by Dejan . Krstevski on 28.07.20.
6 | // Copyright © 2020 Leanplum. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | NS_ASSUME_NONNULL_BEGIN
12 |
13 | @interface LPRequestFactory (Extension)
14 | + (void)swizzle_methods;
15 | + (void)unswizzle_methods;
16 | @end
17 |
18 | NS_ASSUME_NONNULL_END
19 |
--------------------------------------------------------------------------------
/LeanplumSDKApp/LeanplumSDKTests/Classes/Extensions/LPRequestSender+Categories.h:
--------------------------------------------------------------------------------
1 | //
2 | // LPRequestSender+Extensions.h
3 | // Leanplum-SDK
4 | //
5 | // Created by Milos Jakovljevic on 10/17/16.
6 | // Copyright © 2016 Leanplum. All rights reserved.
7 | //
8 | // Licensed to the Apache Software Foundation (ASF) under one
9 | // or more contributor license agreements. See the NOTICE file
10 | // distributed with this work for additional information
11 | // regarding copyright ownership. The ASF licenses this file
12 | // to you under the Apache License, Version 2.0 (the "License");
13 | // you may not use this file except in compliance with the License.
14 | // You may obtain a copy of the License at
15 | //
16 | // http://www.apache.org/licenses/LICENSE-2.0
17 | //
18 | // Unless required by applicable law or agreed to in writing,
19 | // software distributed under the License is distributed on an
20 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21 | // KIND, either express or implied. See the License for the
22 | // specific language governing permissions and limitations
23 | // under the License.
24 |
25 |
26 | #import
27 |
28 | @interface LPRequestSender(MethodSwizzling)
29 |
30 | @property (assign) BOOL (^requestCallback)(NSString *method, NSString *apiMethod, NSDictionary *params);
31 | @property (assign) void (^createArgsCallback)(NSDictionary *args);
32 |
33 | - (void)setRequestCallback:(BOOL (^)(NSString *, NSString *, NSDictionary *))requestCallback;
34 | - (BOOL (^)(NSString *, NSString *, NSDictionary *))requestCallback;
35 |
36 | - (void)setCreateArgsCallback:(void (^)(NSDictionary *))createArgsCallback;
37 | - (void (^)(NSDictionary *))createArgsCallback;
38 |
39 | + (void)validate_request:(BOOL (^)(NSString *, NSString *, NSDictionary *))callback;
40 | + (void)validate_request_args_dictionary:(void (^)(NSDictionary *))callback;
41 | + (void)swizzle_methods;
42 | + (void)unswizzle_methods;
43 | + (void)reset;
44 |
45 | @end
46 |
--------------------------------------------------------------------------------
/LeanplumSDKApp/LeanplumSDKTests/Classes/Extensions/LPVarCache+Extensions.h:
--------------------------------------------------------------------------------
1 | //
2 | // LPVarCache+Extensions.h
3 | // Leanplum-SDK
4 | //
5 | // Created by Milos Jakovljevic on 10/17/16.
6 | // Copyright © 2016 Leanplum. All rights reserved.
7 | //
8 | // Licensed to the Apache Software Foundation (ASF) under one
9 | // or more contributor license agreements. See the NOTICE file
10 | // distributed with this work for additional information
11 | // regarding copyright ownership. The ASF licenses this file
12 | // to you under the Apache License, Version 2.0 (the "License");
13 | // you may not use this file except in compliance with the License.
14 | // You may obtain a copy of the License at
15 | //
16 | // http://www.apache.org/licenses/LICENSE-2.0
17 | //
18 | // Unless required by applicable law or agreed to in writing,
19 | // software distributed under the License is distributed on an
20 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21 | // KIND, either express or implied. See the License for the
22 | // specific language governing permissions and limitations
23 | // under the License.
24 |
25 |
26 | #import
27 |
28 | @interface LPVarCache(UnitTest)
29 |
30 | - (void)setHasReceivedDiffs:(BOOL) value;
31 |
32 | - (void)reset;
33 |
34 | - (void)initialize;
35 |
36 | @end
37 |
--------------------------------------------------------------------------------
/LeanplumSDKApp/LeanplumSDKTests/Classes/Extensions/LeanplumReachability+Category.h:
--------------------------------------------------------------------------------
1 | //
2 | // LeanplumReachability+Category.h
3 | // Leanplum-SDK
4 | //
5 | // Created by Milos Jakovljevic on 10/19/16.
6 | // Copyright © 2016 Leanplum. All rights reserved.
7 | //
8 | // Licensed to the Apache Software Foundation (ASF) under one
9 | // or more contributor license agreements. See the NOTICE file
10 | // distributed with this work for additional information
11 | // regarding copyright ownership. The ASF licenses this file
12 | // to you under the Apache License, Version 2.0 (the "License");
13 | // you may not use this file except in compliance with the License.
14 | // You may obtain a copy of the License at
15 | //
16 | // http://www.apache.org/licenses/LICENSE-2.0
17 | //
18 | // Unless required by applicable law or agreed to in writing,
19 | // software distributed under the License is distributed on an
20 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21 | // KIND, either express or implied. See the License for the
22 | // specific language governing permissions and limitations
23 | // under the License.
24 |
25 |
26 | #import
27 | #import
28 |
29 | @interface Leanplum_Reachability(UnitTest)
30 |
31 | + (void)online:(BOOL)online;
32 |
33 | + (void)swizzle_methods;
34 |
35 | + (void)unswizzle_methods;
36 |
37 | @end
38 |
--------------------------------------------------------------------------------
/LeanplumSDKApp/LeanplumSDKTests/Classes/LPFeatureFlagManagerTest.m:
--------------------------------------------------------------------------------
1 | //
2 | // LPFeatureFlagsManagerTest.m
3 | // Leanplum-SDK_Tests
4 | //
5 | // Created by Grace on 9/18/18.
6 | // Copyright © 2018 Leanplum. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 | #import
12 |
13 | @interface LPFeatureFlagManagerTest : XCTestCase
14 |
15 | @end
16 |
17 | @implementation LPFeatureFlagManagerTest
18 |
19 | - (void)setUp {
20 | [super setUp];
21 | }
22 |
23 | - (void)tearDown {
24 | [super tearDown];
25 | }
26 |
27 | - (void)test_isFeatureFlagEnabledShouldBeTrueForEnabledFlag {
28 | LPFeatureFlagManager *featureFlagManager = [[LPFeatureFlagManager alloc] init];
29 | NSString *testString = @"test";
30 | featureFlagManager.enabledFeatureFlags = [NSSet setWithObjects:testString, nil];
31 | XCTAssert([featureFlagManager isFeatureFlagEnabled:testString] == true);
32 | }
33 |
34 | - (void)test_isFeatureFlagEnabledShouldBeFalseForDisabledFlag {
35 | LPFeatureFlagManager *featureFlagManager = [[LPFeatureFlagManager alloc] init];
36 | NSString *testString = @"test";
37 | XCTAssert([featureFlagManager isFeatureFlagEnabled:testString] == false);
38 | }
39 |
40 | - (void)test_isFeatureFlagEnabledShouldResetWhenSetToNil {
41 | LPFeatureFlagManager *featureFlagManager = [[LPFeatureFlagManager alloc] init];
42 | NSString *testString = @"test";
43 | featureFlagManager.enabledFeatureFlags = [NSSet setWithObjects:testString, nil];
44 | XCTAssert([featureFlagManager isFeatureFlagEnabled:testString] == true);
45 | featureFlagManager.enabledFeatureFlags = nil;
46 | XCTAssert([featureFlagManager isFeatureFlagEnabled:testString] == false);
47 | }
48 |
49 | @end
50 |
--------------------------------------------------------------------------------
/LeanplumSDKApp/LeanplumSDKTests/Classes/LPNetworkOperationTest.m:
--------------------------------------------------------------------------------
1 | //
2 | // LPNetworkOperationTest.m
3 | // Leanplum-SDK_Tests
4 | //
5 | // Created by Mayank Sanganeria on 4/16/20.
6 | // Copyright © 2020 Leanplum. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 |
12 | @interface LPNetworkOperation(Test)
13 | - (NSString *)urlEncodedString:(NSString *)string;
14 | @end
15 |
16 | @interface LPNetworkOperationTest : XCTestCase
17 |
18 | @end
19 |
20 | @implementation LPNetworkOperationTest
21 |
22 | - (void)setUp {
23 | // Put setup code here. This method is called before the invocation of each test method in the class.
24 | }
25 |
26 | - (void)tearDown {
27 | // Put teardown code here. This method is called after the invocation of each test method in the class.
28 | }
29 |
30 | - (void)testUrlEncodedString {
31 | LPNetworkOperation *operation = [[LPNetworkOperation alloc] init];
32 | NSString *url = @"http://www.leanplum.com";
33 | NSString *encodedUrl = [operation urlEncodedString:url];
34 | XCTAssert([encodedUrl isEqualToString:@"http%3A%2F%2Fwww.leanplum.com"]);
35 | }
36 |
37 | @end
38 |
--------------------------------------------------------------------------------
/LeanplumSDKApp/LeanplumSDKTests/Classes/LPRequestSenderTimerTest.m:
--------------------------------------------------------------------------------
1 | //
2 | // LPRequestSenderTimerTest.m
3 | // Leanplum-SDK_Tests
4 | //
5 | // Copyright © 2020 Leanplum. All rights reserved.
6 | //
7 |
8 | #import
9 | #import
10 | #import
11 | //#import "LeanplumHelper.h"
12 |
13 | @interface LPRequestSenderTimerTest : XCTestCase
14 |
15 | @end
16 |
17 | @implementation LPRequestSenderTimerTest
18 |
19 | - (void)setUp
20 | {
21 | // Put setup code here. This method is called before the invocation of each test method in the class.
22 | }
23 |
24 | - (void)tearDown
25 | {
26 | // Put teardown code here. This method is called after the invocation of each test method in the class.
27 | }
28 |
29 | - (void)testDefaultTimerIsSetTo15Min
30 | {
31 | LPRequestSenderTimer *timer = [[LPRequestSenderTimer alloc] init];
32 | XCTAssertTrue(timer.timerInterval == AT_MOST_15_MINUTES);
33 | }
34 |
35 | - (void)testStartTimerWillFireForTimeInterval
36 | {
37 | LPRequestSenderTimer *timer = [LPRequestSenderTimer sharedInstance];
38 | [timer setTimerInterval:AT_MOST_5_MINUTES];
39 | NSTimeInterval heartbeatInterval = timer.timerInterval; //testing in sec
40 | XCTestExpectation *timerExpectation = [self expectationWithDescription:@"timerExpectation"];
41 | [LPTimerBlocks scheduledTimerWithTimeInterval:heartbeatInterval block:^() {
42 | [timerExpectation fulfill];
43 | } repeats:NO];
44 |
45 | [self waitForExpectationsWithTimeout:6 handler:nil];
46 |
47 | }
48 |
49 | @end
50 |
--------------------------------------------------------------------------------
/LeanplumSDKApp/LeanplumSDKTests/Classes/LeanplumSDKTests-Bridging-Header.h:
--------------------------------------------------------------------------------
1 | //
2 | // Use this file to import your target's public headers that you would like to expose to Swift.
3 | //
4 |
5 | #import
6 | #import "LPRequestSender+Categories.h"
7 | #import "LPRequestFactory+Extension.h"
8 | #import "LPVarCache+Extensions.h"
9 | #import "LeanplumHelper.h"
10 |
--------------------------------------------------------------------------------
/LeanplumSDKApp/LeanplumSDKTests/Classes/Migration/IdentityManagerMocks.swift:
--------------------------------------------------------------------------------
1 | //
2 | // IdentityManagerMocks.swift
3 | // LeanplumSDKTests
4 | //
5 | // Created by Nikola Zagorchev on 7.10.22.
6 | //
7 |
8 | import Foundation
9 | @testable import Leanplum
10 |
11 | class IdentityManagerMock: IdentityManager {
12 | var _anonymousLoginUserId: String?
13 | override var anonymousLoginUserId: String? {
14 | get {
15 | return _anonymousLoginUserId
16 | }
17 | set {
18 | _anonymousLoginUserId = newValue
19 | }
20 | }
21 |
22 | var _state: String?
23 | override var state: String? {
24 | get {
25 | return _state
26 | }
27 | set {
28 | _state = newValue
29 | }
30 | }
31 | }
32 |
33 | class IdentityManagerMockStatic: IdentityManager {
34 | static var _anonymousLoginUserId: String?
35 | override var anonymousLoginUserId: String? {
36 | get {
37 | return IdentityManagerMockStatic._anonymousLoginUserId
38 | }
39 | set {
40 | IdentityManagerMockStatic._anonymousLoginUserId = newValue
41 | }
42 | }
43 |
44 | static var _state: String?
45 | override var state: String? {
46 | get {
47 | return IdentityManagerMockStatic._state
48 | }
49 | set {
50 | IdentityManagerMockStatic._state = newValue
51 | }
52 | }
53 |
54 | init(userId: String, deviceId: String, anonymousLoginUserId: String?, state: String?, loggedInUserId: String? = nil) {
55 | // Needs to be set before call to super.init
56 | IdentityManagerMockStatic._anonymousLoginUserId = anonymousLoginUserId
57 | IdentityManagerMockStatic._state = state
58 |
59 | super.init(userId: userId, deviceId: deviceId, loggedInUserId: loggedInUserId)
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/LeanplumSDKApp/LeanplumSDKTests/Classes/Migration/Migration+Extensions.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Migration+Extensions.swift
3 | // LeanplumSDKTests
4 | //
5 | // Created by Nikola Zagorchev on 7.10.22.
6 | //
7 |
8 | import Foundation
9 | @testable import Leanplum
10 |
11 | @objc public extension MigrationManager {
12 | @available(iOS 13.0, *)
13 | func setMigrationState(_ state: MigrationState) {
14 | migrationState = state
15 | }
16 | }
17 |
18 | @objcMembers public class MigrationManagerUtil: NSObject {
19 | static func setSharedMigrateState(_ state: MigrationState) {
20 | MigrationManager.shared.migrationState = state
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/LeanplumSDKApp/LeanplumSDKTests/Classes/Notifications/NotificationsManagerMock.swift:
--------------------------------------------------------------------------------
1 | //
2 | // NotificationsManagerMock.swift
3 | // LeanplumSDKTests
4 | //
5 | // Created by Nikola Zagorchev on 4.11.21.
6 | // Copyright © 2021 Leanplum. All rights reserved.
7 |
8 | import Foundation
9 | @testable import Leanplum
10 |
11 | class NotificationsManagerMock: NotificationsManager {
12 |
13 | static var notificationsManagerManagerInstance = NotificationsManagerMock()
14 |
15 | class func notificationsManager() -> NotificationsManagerMock {
16 | return notificationsManagerManagerInstance
17 | }
18 |
19 | public var userInfoProcessed: [AnyHashable : Any]?
20 | public var actionName: String?
21 | public var foreground: Bool?
22 | public var methodInvocations = 0
23 | public var isPushEnabled: Bool?
24 |
25 | override func notificationOpened(userInfo: [AnyHashable : Any],
26 | action: String = LP_VALUE_DEFAULT_PUSH_ACTION,
27 | fromLaunch: Bool = false) {
28 | userInfoProcessed = userInfo
29 | actionName = action
30 | methodInvocations += 1
31 | }
32 |
33 | override func notificationReceived(userInfo: [AnyHashable : Any], isForeground: Bool) {
34 | userInfoProcessed = userInfo
35 | foreground = isForeground
36 | methodInvocations += 1
37 | }
38 |
39 | override func enableSystemPush() {
40 | isPushEnabled = true
41 | UserDefaults.standard.set(true, forKey: DEFAULTS_LEANPLUM_ENABLED_PUSH)
42 | isAskToAskDisabled = true
43 | methodInvocations += 1
44 | }
45 |
46 | class func reset() {
47 | notificationsManagerManagerInstance = NotificationsManagerMock()
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/LeanplumSDKApp/LeanplumSDKTests/Resources/Files/GoldIcon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Leanplum/Leanplum-iOS-SDK/0a1f2142bab6db644bb96b7b474e42c1285b1001/LeanplumSDKApp/LeanplumSDKTests/Resources/Files/GoldIcon.png
--------------------------------------------------------------------------------
/LeanplumSDKApp/LeanplumSDKTests/Resources/Files/MainAppIcon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Leanplum/Leanplum-iOS-SDK/0a1f2142bab6db644bb96b7b474e42c1285b1001/LeanplumSDKApp/LeanplumSDKTests/Resources/Files/MainAppIcon.png
--------------------------------------------------------------------------------
/LeanplumSDKApp/LeanplumSDKTests/Resources/Files/test.file:
--------------------------------------------------------------------------------
1 | {
2 | "test" = "test";
3 | }
4 |
--------------------------------------------------------------------------------
/LeanplumSDKApp/LeanplumSDKTests/Resources/Files/test.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Leanplum/Leanplum-iOS-SDK/0a1f2142bab6db644bb96b7b474e42c1285b1001/LeanplumSDKApp/LeanplumSDKTests/Resources/Files/test.pdf
--------------------------------------------------------------------------------
/LeanplumSDKApp/LeanplumSDKTests/Resources/Responses/Malformed/malformed_track_event_response.json:
--------------------------------------------------------------------------------
1 | {
2 | "response": [
3 | {
4 | "success": false
5 | },
6 | {
7 | "vars": {
8 |
9 | },
10 | "interfaceRules": [
11 |
12 | ],
13 | "variants": [
14 |
15 | ],
16 | "regions": {
17 |
18 | },
19 | "syncNewsfeed": false,
20 | "success": false,
21 | "messages": {
22 |
23 | },
24 | "interfaceEvents": [
25 |
26 | ]
27 | }
28 | ]
29 | }
30 |
--------------------------------------------------------------------------------
/LeanplumSDKApp/LeanplumSDKTests/Resources/Responses/action_response.json:
--------------------------------------------------------------------------------
1 | {
2 | "response": [
3 | {
4 | "success": true
5 | }
6 | ]
7 | }
8 |
--------------------------------------------------------------------------------
/LeanplumSDKApp/LeanplumSDKTests/Resources/Responses/batch_response.json:
--------------------------------------------------------------------------------
1 | {
2 | "response": [{
3 | "index": 1,
4 | "success": true
5 | }, {
6 | "index": 2,
7 | "success": true
8 | }, {
9 | "index": 3,
10 | "success": true
11 | }]
12 | }
13 |
--------------------------------------------------------------------------------
/LeanplumSDKApp/LeanplumSDKTests/Resources/Responses/change_host_response.json:
--------------------------------------------------------------------------------
1 | {
2 | "response": [
3 | {
4 | "success": false,
5 | "apiHost": "api2.leanplum.com",
6 | "apiPath": "new-api",
7 | "devServerHost": "dev2.leanplum.com",
8 | "error": {
9 | "message": "App endpoint configuration mismatch."
10 | }
11 | }
12 | ]
13 | }
14 |
--------------------------------------------------------------------------------
/LeanplumSDKApp/LeanplumSDKTests/Resources/Responses/get_migrate_state_response.json:
--------------------------------------------------------------------------------
1 | {
2 | "api": {
3 | "events": "lp+ct",
4 | "profile": "lp+ct",
5 | },
6 | "ct": {
7 | "accountId": "accId",
8 | "attributeMappings": {
9 | "name1": "ct-name1",
10 | },
11 | "identityKeys": ["Identity", "Email"],
12 | "regionCode": "eu1",
13 | "token": "token",
14 | },
15 | "eventsUploadStartedTs": "2022-10-02T17:46:01.356Z",
16 | "profileUploadStartedTs": "2022-10-02T17:46:01.356Z",
17 | "reqId": "A285641F-9903-4182-8A10-EB42782CAE69",
18 | "sdk": "lp+ct",
19 | "sha256": "31484a565dcd3e1672922c7c4166bfeee0f500b6d6473fc412091304cc162ca8",
20 | "state": "EVENTS_UPLOAD_STARTED",
21 | "success": 1,
22 | }
23 |
--------------------------------------------------------------------------------
/LeanplumSDKApp/LeanplumSDKTests/Resources/Responses/get_migrate_state_response_error.json:
--------------------------------------------------------------------------------
1 | {
2 | "api": {
3 | "events": "lp+ct",
4 | "profile": "lp+ct",
5 | },
6 | "ct": {
7 | "accountId": "accId",
8 | "attributeMappings": {
9 | "name1": "ct-name1",
10 | },
11 | "identityKeys": "",
12 | "regionCode": "eu1",
13 | "token": "token",
14 | },
15 | "eventsUploadStartedTs": "2022-10-02T17:46:01.356Z",
16 | "profileUploadStartedTs": "2022-10-02T17:46:01.356Z",
17 | "reqId": "A285641F-9903-4182-8A10-EB42782CAE69",
18 | "sdk": "lp+ct",
19 | "sha256": "31484a565dcd3e1672922c7c4166bfeee0f500b6d6473fc412091304cc162ca8",
20 | "state": "EVENTS_UPLOAD_STARTED",
21 | "success": 1,
22 | }
23 |
--------------------------------------------------------------------------------
/LeanplumSDKApp/LeanplumSDKTests/Resources/Responses/get_migrate_state_response_missing.json:
--------------------------------------------------------------------------------
1 | {
2 | "api": {
3 | "events": "lp+ct",
4 | "profile": "lp+ct",
5 | },
6 | "ct": {
7 | "attributeMappings": {
8 | "name1": "ct-name1",
9 | },
10 | "regionCode": "eu1",
11 | "token": "token",
12 | },
13 | "success": 1,
14 | }
15 |
--------------------------------------------------------------------------------
/LeanplumSDKApp/LeanplumSDKTests/Resources/Responses/local_caps_day_response.json:
--------------------------------------------------------------------------------
1 | {
2 | "response": [
3 | {
4 | "regions": {},
5 | "fileAttributes": {},
6 | "success": true,
7 | "messages": {},
8 | "vars": {
9 | "intVariable": 100,
10 | "stringVariable": "test_string"
11 | },
12 | "variants": [],
13 | "localCaps": [
14 | {
15 | "channel": "IN_APP",
16 | "limit": 25,
17 | "type": "DAY"
18 | }
19 | ],
20 | "token": "juKUmiXERlO4kmTfEL6xEsfUMpg9WUlFrHOvp6H2w4Q"
21 | }
22 | ]
23 | }
24 |
--------------------------------------------------------------------------------
/LeanplumSDKApp/LeanplumSDKTests/Resources/Responses/local_caps_response.json:
--------------------------------------------------------------------------------
1 | {
2 | "response": [
3 | {
4 | "regions": {},
5 | "fileAttributes": {},
6 | "success": true,
7 | "messages": {},
8 | "vars": {
9 | "intVariable": 100,
10 | "stringVariable": "test_string"
11 | },
12 | "variants": [],
13 | "localCaps": [
14 | {
15 | "channel": "IN_APP",
16 | "limit": 1,
17 | "type": "SESSION"
18 | },
19 | {
20 | "channel": "IN_APP",
21 | "limit": 2,
22 | "type": "DAY"
23 | },
24 | {
25 | "channel": "IN_APP",
26 | "limit": 3,
27 | "type": "WEEK"
28 | }
29 | ],
30 | "token": "juKUmiXERlO4kmTfEL6xEsfUMpg9WUlFrHOvp6H2w4Q"
31 | }
32 | ]
33 | }
34 |
--------------------------------------------------------------------------------
/LeanplumSDKApp/LeanplumSDKTests/Resources/Responses/local_caps_session_response.json:
--------------------------------------------------------------------------------
1 | {
2 | "response": [
3 | {
4 | "regions": {},
5 | "fileAttributes": {},
6 | "success": true,
7 | "messages": {},
8 | "vars": {
9 | "intVariable": 100,
10 | "stringVariable": "test_string"
11 | },
12 | "variants": [],
13 | "localCaps": [
14 | {
15 | "channel": "IN_APP",
16 | "limit": 5,
17 | "type": "SESSION"
18 | }
19 | ],
20 | "token": "juKUmiXERlO4kmTfEL6xEsfUMpg9WUlFrHOvp6H2w4Q"
21 | }
22 | ]
23 | }
24 |
--------------------------------------------------------------------------------
/LeanplumSDKApp/LeanplumSDKTests/Resources/Responses/local_caps_week_response.json:
--------------------------------------------------------------------------------
1 | {
2 | "response": [
3 | {
4 | "regions": {},
5 | "fileAttributes": {},
6 | "success": true,
7 | "messages": {},
8 | "vars": {
9 | "intVariable": 100,
10 | "stringVariable": "test_string"
11 | },
12 | "variants": [],
13 | "localCaps": [
14 | {
15 | "channel": "IN_APP",
16 | "limit": 100,
17 | "type": "WEEK"
18 | }
19 | ],
20 | "token": "juKUmiXERlO4kmTfEL6xEsfUMpg9WUlFrHOvp6H2w4Q"
21 | }
22 | ]
23 | }
24 |
--------------------------------------------------------------------------------
/LeanplumSDKApp/LeanplumSDKTests/Resources/Responses/registration_response.json:
--------------------------------------------------------------------------------
1 | {
2 | "response": [
3 | {
4 | "success": true
5 | }
6 | ]
7 | }
8 |
--------------------------------------------------------------------------------
/LeanplumSDKApp/LeanplumSDKTests/Resources/Responses/secured_vars_empty_response.json:
--------------------------------------------------------------------------------
1 | {
2 | "response": [
3 | {
4 | "regions": {},
5 | "fileAttributes": {},
6 | "success": true,
7 | "messages": {},
8 | "vars": {},
9 | "variants": [],
10 | "token": "juKUmiXERlO4kmTfEL6xEsfUMpg9WUlFrHOvp6H2w4Q"
11 | }
12 | ]
13 | }
14 |
--------------------------------------------------------------------------------
/LeanplumSDKApp/LeanplumSDKTests/Resources/Responses/secured_vars_no_sign_response.json:
--------------------------------------------------------------------------------
1 | {
2 | "response": [
3 | {
4 | "regions": {},
5 | "fileAttributes": {},
6 | "success": true,
7 | "messages": {},
8 | "vars": {
9 | "intVariable": 100,
10 | "stringVariable": "test_string"
11 | },
12 | "variants": [],
13 | "token": "juKUmiXERlO4kmTfEL6xEsfUMpg9WUlFrHOvp6H2w4Q"
14 | }
15 | ]
16 | }
17 |
--------------------------------------------------------------------------------
/LeanplumSDKApp/LeanplumSDKTests/Resources/Responses/secured_vars_response.json:
--------------------------------------------------------------------------------
1 | {
2 | "response": [
3 | {
4 | "regions": {},
5 | "fileAttributes": {},
6 | "success": true,
7 | "messages": {},
8 | "vars": {
9 | "intVariable": 100,
10 | "stringVariable": "test_string"
11 | },
12 | "varsSignature": "sign_of_vars",
13 | "variants": [],
14 | "token": "juKUmiXERlO4kmTfEL6xEsfUMpg9WUlFrHOvp6H2w4Q"
15 | }
16 | ]
17 | }
18 |
--------------------------------------------------------------------------------
/LeanplumSDKApp/LeanplumSDKTests/Resources/Responses/state_response.json:
--------------------------------------------------------------------------------
1 | {
2 | "response": [
3 | {
4 | "success": true
5 | }
6 | ]
7 | }
8 |
--------------------------------------------------------------------------------
/LeanplumSDKApp/LeanplumSDKTests/Resources/Responses/track_event_response.json:
--------------------------------------------------------------------------------
1 | {
2 | "response": [
3 | {
4 | "success": true
5 | },
6 | {
7 | "vars": {
8 |
9 | },
10 | "interfaceRules": [
11 |
12 | ],
13 | "variants": [
14 |
15 | ],
16 | "regions": {
17 |
18 | },
19 | "syncNewsfeed": false,
20 | "success": true,
21 | "messages": {
22 |
23 | },
24 | "interfaceEvents": [
25 |
26 | ]
27 | }
28 | ]
29 | }
30 |
--------------------------------------------------------------------------------
/LeanplumSDKApp/LeanplumSDKTests/Resources/Responses/variables_response.json:
--------------------------------------------------------------------------------
1 | {
2 | "response": [
3 | {
4 | "success": true
5 | },
6 | {
7 | "success": true
8 | },
9 | {
10 | "vars": {
11 |
12 | },
13 | "interfaceRules": [
14 |
15 | ],
16 | "variants": [
17 |
18 | ],
19 | "regions": {
20 |
21 | },
22 | "syncNewsfeed": false,
23 | "success": true,
24 | "messages": {
25 |
26 | },
27 | "interfaceEvents": [
28 |
29 | ]
30 | }
31 | ]
32 | }
33 |
--------------------------------------------------------------------------------
/LeanplumSDKApp/LeanplumSDKTests/Resources/Responses/variables_with_newsfeed_response.json:
--------------------------------------------------------------------------------
1 | {
2 | "response": [{
3 | "success": true
4 | }, {
5 | "success": true
6 | }, {
7 | "vars": {
8 |
9 | },
10 | "interfaceRules": [
11 |
12 | ],
13 | "variants": [
14 |
15 | ],
16 | "regions": {
17 |
18 | },
19 | "syncNewsfeed": true,
20 | "success": true,
21 | "messages": {
22 |
23 | },
24 | "interfaceEvents": [
25 |
26 | ]
27 | }]
28 | }
--------------------------------------------------------------------------------
/LeanplumSDKApp/LeanplumSDKTests/Resources/Responses/variants_response.json:
--------------------------------------------------------------------------------
1 | {
2 | "response": [{
3 | "variants": [{
4 | "id": 5743821076168704
5 | }, {
6 | "id": 4829025522810880
7 | }, {
8 | "id": 4569306098958336
9 | }, {
10 | "id": 6224480731267072
11 | }],
12 | "success": true,
13 | }]
14 | }
15 |
--------------------------------------------------------------------------------
/LeanplumSDKApp/LeanplumSDKTests/Resources/TestData/ChainedMessage.json:
--------------------------------------------------------------------------------
1 | {
2 | "1": {
3 | "action": "Alert",
4 | "countdown": 86400,
5 | "vars": {
6 | "Dismiss action": "",
7 | "Message": "priority-10-a",
8 | "Title": "priority-10-a",
9 | "Dismiss text": "OK",
10 | "__name__": "Alert"
11 | },
12 | "whenLimits": {
13 | "verb": "AND",
14 | "children": [
15 | {
16 | "objects": [],
17 | "noun": "999",
18 | "subject": "times",
19 | "verb": "limitUser"
20 | }
21 | ]
22 | },
23 | "priority": 10,
24 | "whenTriggers": {
25 | "verb": "OR",
26 | "children": [
27 | {
28 | "objects": [],
29 | "subject": "start",
30 | "verb": ""
31 | }
32 | ]
33 | }
34 | },
35 | "2": {
36 | "action": "Alert",
37 | "countdown": 86400,
38 | "vars": {
39 | "Dismiss action": {
40 | "Chained message": "1",
41 | "__name__": "Chain to Existing Message"
42 | },
43 | "Message": "NO-priority",
44 | "Title": "NO-priority",
45 | "Dismiss text": "OK",
46 | "__name__": "Alert"
47 | },
48 | "whenLimits": {
49 | "verb": "AND",
50 | "children": [
51 | {
52 | "objects": [],
53 | "noun": "999",
54 | "subject": "times",
55 | "verb": "limitUser"
56 | }
57 | ]
58 | },
59 | "priority": 1000
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/LeanplumSDKApp/LeanplumSDKTests/Resources/TestData/SingleMessage.json:
--------------------------------------------------------------------------------
1 | {
2 | "1": {
3 | "action": "Alert",
4 | "countdown": 86400,
5 | "vars": {
6 | "Dismiss action": "",
7 | "Message": "priority-10-a",
8 | "Title": "priority-10-a",
9 | "Dismiss text": "OK",
10 | "__name__": "Alert"
11 | },
12 | "whenLimits": {
13 | "verb": "AND",
14 | "children": [
15 | {
16 | "objects": [],
17 | "noun": "999",
18 | "subject": "times",
19 | "verb": "limitUser"
20 | }
21 | ]
22 | },
23 | "priority": 10,
24 | "whenTriggers": {
25 | "verb": "OR",
26 | "children": [
27 | {
28 | "objects": [],
29 | "subject": "start",
30 | "verb": ""
31 | }
32 | ]
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/LeanplumSDKApp/LeanplumSDKTests/Resources/TestData/regionData.json:
--------------------------------------------------------------------------------
1 | {
2 | "NYC": {
3 | "lat": "40.7564",
4 | "lon": "-73.9854",
5 | "name": "NYC",
6 | "radius": "500",
7 | "version": "4"
8 | },
9 | "Las Vegas": {
10 | "lat": "36.1699",
11 | "lon": "-115.1398",
12 | "name": "Las Vegas",
13 | "radius": "500",
14 | "version": "0"
15 | },
16 | "Chicago": {
17 | "lat": "41.8781",
18 | "lon": "-87.6231",
19 | "name": "Chicago",
20 | "radius": "500",
21 | "version": "100"
22 | },
23 | "SF": {
24 | "lat": "37.7749",
25 | "lon": "-122.4194",
26 | "name": "SF",
27 | "radius": "700",
28 | "version": "0"
29 | },
30 | "Philadelphia": {
31 | "lat": "39.9526",
32 | "lon": "-75.1652",
33 | "name": "Philadelphia",
34 | "radius": "100",
35 | "version": "0"
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/LeanplumSDKApp/LeanplumSDKTests/Resources/TestData/sample_action_notification.json:
--------------------------------------------------------------------------------
1 | {
2 | "aps": {
3 | "alert": "Message Push With Test Data",
4 | "content-available": 1
5 | },
6 | "_lpx": {
7 | "bool_argument": true,
8 | "string_argument": "test_string_2",
9 | "__name__": "test_action",
10 | "color_argument": -16777216,
11 | "dictionary_argument": {
12 | "test_value": "test_value_2"
13 | },
14 | "array_argument": {
15 | "[2]": 7,
16 | "[0]": 9,
17 | "[3]": 6,
18 | "[1]": 8
19 | },
20 | "file_argument": "back.pdf",
21 | "number_argument": 15
22 | },
23 | "_lpm": 5.571215811412e+15
24 | }
25 |
--------------------------------------------------------------------------------
/LeanplumSDKApp/LeanplumSDKTests/Supporting Files/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE)
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleVersion
20 | 1
21 |
22 |
23 |
--------------------------------------------------------------------------------
/LeanplumSDKApp/LeanplumSDKTests/Supporting Files/Leanplum-Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | APP_ID
6 | app_nLiaLr3lXvCjXhsztS1Gw8j281cPLO6sZetTDxYnaSk
7 | DEV_KEY
8 | dev_2bbeWLmVJyNrqI8F21Kn9nqyUPRkVCUoLddBkHEyzmk
9 | PROD_KEY
10 | prod_XYpURdwPAaxJyYLclXNfACe9Y8hs084dBx2pB8wOnqU
11 |
12 |
13 |
--------------------------------------------------------------------------------
/LeanplumSDKLocation/LeanplumSDKLocation/PrivacyInfo.xcprivacy:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | NSPrivacyCollectedDataTypes
6 |
7 |
8 | NSPrivacyCollectedDataType
9 | NSPrivacyCollectedDataTypeCoarseLocation
10 | NSPrivacyCollectedDataTypeLinked
11 |
12 | NSPrivacyCollectedDataTypeTracking
13 |
14 | NSPrivacyCollectedDataTypePurposes
15 |
16 | NSPrivacyCollectedDataTypePurposeProductPersonalization
17 | NSPrivacyCollectedDataTypePurposeAnalytics
18 |
19 |
20 |
21 | NSPrivacyAccessedAPITypes
22 |
23 |
24 | NSPrivacyAccessedAPIType
25 | NSPrivacyAccessedAPICategoryUserDefaults
26 | NSPrivacyAccessedAPITypeReasons
27 |
28 | CA92.1
29 |
30 |
31 |
32 | NSPrivacyTracking
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/LeanplumSDKLocation/LeanplumSDKLocation/include/LPLocationManager.h:
--------------------------------------------------------------------------------
1 | ../Classes/LPLocationManager.h
--------------------------------------------------------------------------------
/LeanplumTargetWrapper/Dummy.swift:
--------------------------------------------------------------------------------
1 | // Empty source file for SwiftPM binary target dependencies wrapper
--------------------------------------------------------------------------------
/Makefile:
--------------------------------------------------------------------------------
1 | ####################################################################
2 | #
3 | # Rules used to build and release the SDK.
4 | #
5 | ####################################################################
6 |
7 | spm:
8 | sh Tools/spm.sh
9 |
10 | updateVersion:
11 | sed -i '' -e "s/#define LEANPLUM_SDK_VERSION @.*/#define LEANPLUM_SDK_VERSION @\"`cat sdk-version.txt`\"/g" "./LeanplumSDK/LeanplumSDK/Classes/Internal/LPConstants.h";\
12 | minVersion=6.0; version=`cat sdk-version.txt`;\
13 | if [[ "$$version" != *"beta"* ]]; then \
14 | sed -i '' -e "s/s.dependency 'Leanplum-iOS-SDK', .*/s.dependency 'Leanplum-iOS-SDK', \"~> $$minVersion\"/g" "./Leanplum-iOS-Location.podspec";\
15 | sed -i '' -e "s/s.dependency 'Leanplum-iOS-SDK', .*/s.dependency 'Leanplum-iOS-SDK', \"~> $$minVersion\"/g" "./Leanplum-iOS-LocationAndBeacons.podspec";\
16 | else \
17 | sed -i '' -e "s/s.dependency 'Leanplum-iOS-SDK', .*/s.dependency 'Leanplum-iOS-SDK', \"~> $$minVersion-beta\"/g" "./Leanplum-iOS-Location.podspec";\
18 | sed -i '' -e "s/s.dependency 'Leanplum-iOS-SDK', .*/s.dependency 'Leanplum-iOS-SDK', \"~> $$minVersion-beta\"/g" "./Leanplum-iOS-LocationAndBeacons.podspec";\
19 | fi;
20 |
21 | tagCommit:
22 | git add LeanplumSDK/LeanplumSDK/Classes/Internal/LPConstants.h; git commit -am 'update version'; git tag `cat sdk-version.txt`; git push; git push origin `cat sdk-version.txt`
23 |
24 | deploy: updateVersion tagCommit
25 |
--------------------------------------------------------------------------------
/Package.swift:
--------------------------------------------------------------------------------
1 | // swift-tools-version:5.3
2 | import PackageDescription
3 |
4 | let package = Package(
5 | name: "Leanplum",
6 | platforms: [
7 | .iOS(.v9)
8 | ],
9 | products: [
10 | .library(name: "Leanplum", targets: ["LeanplumTargetWrapper"]),
11 | .library(name: "LeanplumLocation", targets: ["LeanplumLocation"])
12 | ],
13 | dependencies: [
14 | .package(url: "https://github.com/CleverTap/clevertap-ios-sdk", from: "7.1.1")
15 | ],
16 | targets: [
17 | .binaryTarget(
18 | name: "Leanplum",
19 | url: "https://github.com/Leanplum/Leanplum-iOS-SDK/releases/download/6.6.1/Leanplum.xcframework.zip",
20 | checksum: "47e4d86508c83255241219f89441ea007b3683fc2569384d2928b6b45e91db01"
21 | ),
22 | .target(
23 | name: "LeanplumLocation",
24 | dependencies: ["Leanplum"],
25 | path: "LeanplumSDKLocation",
26 | resources: [
27 | .copy("LeanplumSDKLocation/PrivacyInfo.xcprivacy")
28 | ],
29 | publicHeadersPath: "LeanplumSDKLocation/include"
30 | ),
31 | .target(name: "LeanplumTargetWrapper",
32 | dependencies: ["Leanplum", .product(name: "CleverTapSDK", package: "clevertap-ios-sdk")],
33 | path: "LeanplumTargetWrapper"
34 | )
35 | ]
36 | )
37 |
--------------------------------------------------------------------------------
/Podfile:
--------------------------------------------------------------------------------
1 | platform :ios, '9.0'
2 | use_modular_headers!
3 |
4 | workspace 'Leanplum.xcworkspace'
5 |
6 | def clever_tap
7 | pod 'CleverTap-iOS-SDK', '~> 7.1'
8 | end
9 |
10 | target 'LeanplumSDKApp' do
11 | project 'LeanplumSDKApp/LeanplumSDKApp.xcodeproj'
12 | use_frameworks!
13 |
14 | clever_tap
15 | end
16 |
17 | target 'LeanplumSDKTests' do
18 | project 'LeanplumSDKApp/LeanplumSDKApp.xcodeproj'
19 | use_frameworks!
20 |
21 | pod 'OCMock', '~> 3.3.1'
22 | pod 'OHHTTPStubs', '~> 9.0.0'
23 | end
24 |
25 | target 'Leanplum' do
26 | project 'LeanplumSDK/LeanplumSDK.xcodeproj'
27 | workspace 'Leanplum.xcworkspace'
28 | # Comment the next line if you don't want to use dynamic frameworks
29 | use_frameworks!
30 |
31 | # Pods for Leanplum
32 | clever_tap
33 | end
34 | #
35 |
36 | target 'Leanplum-Static' do
37 | project 'LeanplumSDK/LeanplumSDK.xcodeproj'
38 |
39 | # Pods for Leanplum-Static
40 | clever_tap
41 | end
42 |
43 | post_install do |installer|
44 | installer.pods_project.targets.each do |target|
45 | if target.respond_to?(:product_type) and target.product_type == "com.apple.product-type.bundle"
46 | target.build_configurations.each do |config|
47 | config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
48 | end
49 | end
50 | end
51 | end
52 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | 
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 | ## Installation & Usage
15 | - Please refer to: https://www.leanplum.com/docs#/setup/ios for how to setup Leanplum SDK in your project.
16 | - To run the example project:
17 | ```bash
18 | pod install
19 | open "Leanplum.xcworkspace"
20 | ```
21 | ## Development Workflow
22 | - We use feature branches that get merged to `master`.
23 | ## Build the SDK
24 | To build the sdk run:
25 | ```bash
26 | ./build.sh
27 | ```
28 | ## Contributing
29 | Please follow the guidelines under https://github.com/Leanplum/Leanplum-iOS-SDK/blob/master/CONTRIBUTING.md
30 | ## License
31 | See LICENSE file.
32 | ## Support
33 | Leanplum does not support custom modifications to the SDK, without an approved pull request (PR). If you wish to include your changes, please fork the repo and send a PR to the develop branch. After the PR has been reviewed and merged into develop it will go into our regular release cycle which includes QA. Once QA has passed the PR will be available in master and your changes are now officialy supported by Leanplum.
34 |
--------------------------------------------------------------------------------
/Tools/push.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | source ~/.rvm/scripts/rvm
4 | rvm use default
5 | pod trunk push Leanplum-iOS-SDK.podspec --allow-warnings
6 | pod trunk push Leanplum-iOS-Location.podspec --allow-warnings
7 | pod trunk push Leanplum-iOS-LocationAndBeacons.podspec --allow-warnings
8 |
--------------------------------------------------------------------------------
/Tools/pushSPM.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | git config --local user.email "$GITHUB_EMAIL"
3 | git config --local user.name "$GITHUB_NAME"
4 | git config pull.rebase false
5 | git remote set-url origin https://$GITHUB_NAME:$GITHUB_TOKEN@github.com/Leanplum/Leanplum-iOS-SDK.git
6 | RELEASE_VERSION=${TRAVIS_TAG%-*}
7 | echo $RELEASE_VERSION
8 | git checkout -b release/$RELEASE_VERSION
9 | git restore --staged .
10 | git add Package.swift
11 | git commit -m 'update spm'
12 | git pull origin release/$RELEASE_VERSION
13 | git push --set-upstream origin release/$RELEASE_VERSION
14 | git tag -f `cat sdk-version.txt`
15 | git push -f origin `cat sdk-version.txt`
--------------------------------------------------------------------------------
/Tools/triggerLocation.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | version=`cat sdk-version.txt`
3 |
4 | git clone https://${GITHUB_TOKEN}@github.com/Leanplum/Leanplum-iOS-Location.git
5 | cd Leanplum-iOS-Location
6 | git checkout master
7 | rm sdk-version.txt
8 | cp ../sdk-version.txt .
9 | git add sdk-version.txt
10 | git commit -m "update version"
11 | git tag `cat sdk-version.txt`
12 | git push https://${GITHUB_TOKEN}@github.com/Leanplum/Leanplum-iOS-Location.git master
13 | git push https://${GITHUB_TOKEN}@github.com/Leanplum/Leanplum-iOS-Location.git master `cat sdk-version.txt`
14 |
--------------------------------------------------------------------------------
/Tools/triggerRN.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | version=`cat sdk-version.txt`
3 |
4 | body="{
5 | \"request\": {
6 | \"branch\":\"master\",
7 | \"message\" : \"Building iOS SDK $version\",
8 | \"config\": {
9 | \"env\": {
10 | \"LEANPLUM_IOS_SDK_VERSION\": \"$version\"
11 | }
12 | }
13 | }}"
14 |
15 | echo "triggering Rondo-ReactNative build"
16 |
17 | curl -s -X POST \
18 | -H "Content-Type: application/json" \
19 | -H "Accept: application/json" \
20 | -H "Travis-API-Version: 3" \
21 | -H "Authorization: token $TRAVIS_TOKEN" \
22 | -d "$body" \
23 | https://api.travis-ci.com/repo/Leanplum%2FLeanplum-ReactNative-SDK/requests
24 |
--------------------------------------------------------------------------------
/Tools/triggerRondo.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | version=`cat sdk-version.txt`
3 | body="{
4 | \"request\":{
5 | \"branch\":\"master\",
6 | \"message\": \"Building and uploading $version\",
7 | \"config\": {
8 | \"env\": {
9 | \"LEANPLUM_SDK_VERSION\": \"$version\"
10 | }
11 | }
12 | }}"
13 |
14 | echo "triggering Rondo-iOS build"
15 |
16 | curl -s -X POST \
17 | -H "Content-Type: application/json" \
18 | -H "Accept: application/json" \
19 | -H "Travis-API-Version: 3" \
20 | -H "Authorization: token $TRAVIS_TOKEN" \
21 | -d "$body" \
22 | https://api.travis-ci.com/repo/Leanplum%2FRondo-iOS/requests
23 |
--------------------------------------------------------------------------------
/Tools/verifyTag.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | tag=`git tag --points-at HEAD`
3 | version=`cat sdk-version.txt`
4 | echo $tag
5 | echo $version
6 | if [ "$tag" == "$version" ]; then
7 | echo "Tag matches version. Moving forward with deploy"
8 | else
9 | echo "Tag verification failed"
10 | exit 1
11 | fi
12 |
--------------------------------------------------------------------------------
/sdk-version.txt:
--------------------------------------------------------------------------------
1 | 6.6.1
--------------------------------------------------------------------------------