Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

chore: rename confusing classes #303

Merged
merged 1 commit into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions RInAppMessaging.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
4592B4CA27026FB7004FF27B /* istockphoto-1047234038.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 4592B4C627026AE8004FF27B /* istockphoto-1047234038.jpg */; };
4595F4F4262DE12C0001F30B /* KeyHasherSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4595F4F3262DE12C0001F30B /* KeyHasherSpec.swift */; };
459B227C245289F300D218CE /* ConfigurationServiceSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 459B227B245289F300D218CE /* ConfigurationServiceSpec.swift */; };
459B227E24528A5100D218CE /* MessageMixerServiceSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 459B227D24528A5000D218CE /* MessageMixerServiceSpec.swift */; };
459B227E24528A5100D218CE /* PingServiceSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 459B227D24528A5000D218CE /* PingServiceSpec.swift */; };
459B228024528A6900D218CE /* ImpressionServiceSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 459B227F24528A6900D218CE /* ImpressionServiceSpec.swift */; };
459B228224528A7D00D218CE /* DisplayPermissionServiceSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 459B228124528A7D00D218CE /* DisplayPermissionServiceSpec.swift */; };
459C1FAB28572DD90019AB34 /* test-image.png in Resources */ = {isa = PBXBuildFile; fileRef = 459C1FAA28572DD90019AB34 /* test-image.png */; };
Expand Down Expand Up @@ -199,7 +199,7 @@
4592B4C627026AE8004FF27B /* istockphoto-1047234038.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = "istockphoto-1047234038.jpg"; sourceTree = "<group>"; };
4595F4F3262DE12C0001F30B /* KeyHasherSpec.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KeyHasherSpec.swift; sourceTree = "<group>"; };
459B227B245289F300D218CE /* ConfigurationServiceSpec.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConfigurationServiceSpec.swift; sourceTree = "<group>"; };
459B227D24528A5000D218CE /* MessageMixerServiceSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MessageMixerServiceSpec.swift; sourceTree = "<group>"; };
459B227D24528A5000D218CE /* PingServiceSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PingServiceSpec.swift; sourceTree = "<group>"; };
459B227F24528A6900D218CE /* ImpressionServiceSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ImpressionServiceSpec.swift; sourceTree = "<group>"; };
459B228124528A7D00D218CE /* DisplayPermissionServiceSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DisplayPermissionServiceSpec.swift; sourceTree = "<group>"; };
459C1FAA28572DD90019AB34 /* test-image.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "test-image.png"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -487,7 +487,7 @@
45AFB307246CFB640080D21B /* LocaleSpec.swift */,
4516601C23CD740300310181 /* MainContainerSpec.swift */,
45AFB2F5245C18660080D21B /* MatchingUtilitySpec.swift */,
459B227D24528A5000D218CE /* MessageMixerServiceSpec.swift */,
459B227D24528A5000D218CE /* PingServiceSpec.swift */,
455A7D4A2889D8550059F291 /* OptOutMessageViewSpec.swift */,
45BDFD0624232714004DEA0C /* PublicAPISpec.swift */,
45563B02240614AE004EAFD3 /* ReadyCampaignDispatcherSpec.swift */,
Expand Down Expand Up @@ -906,7 +906,7 @@
C9827558262C423C00476505 /* BackoffSpec.swift in Sources */,
45ADA53E247CFE9E00A9E2A3 /* ConfigurationRepositorySpec.swift in Sources */,
45EA720D25B72002001B2049 /* UIViewExtensionSpec.swift in Sources */,
459B227E24528A5100D218CE /* MessageMixerServiceSpec.swift in Sources */,
459B227E24528A5100D218CE /* PingServiceSpec.swift in Sources */,
4560062C26FB968B003227FE /* UserInfoProviderSpec.swift in Sources */,
45491059247F58660019864D /* CustomAttributeSpec.swift in Sources */,
);
Expand Down
8 changes: 4 additions & 4 deletions SampleSPM/SampleSPM.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
D234A72F291C62CF0086AC80 /* MatchingUtilitySpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = D234A701291C62CB0086AC80 /* MatchingUtilitySpec.swift */; };
D234A730291C62CF0086AC80 /* KeyHasherSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = D234A702291C62CC0086AC80 /* KeyHasherSpec.swift */; };
D234A731291C62CF0086AC80 /* DisplayPermissionServiceSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = D234A703291C62CC0086AC80 /* DisplayPermissionServiceSpec.swift */; };
D234A732291C62CF0086AC80 /* MessageMixerServiceSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = D234A704291C62CC0086AC80 /* MessageMixerServiceSpec.swift */; };
D234A732291C62CF0086AC80 /* PingServiceSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = D234A704291C62CC0086AC80 /* PingServiceSpec.swift */; };
D234A733291C62CF0086AC80 /* LocaleSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = D234A705291C62CC0086AC80 /* LocaleSpec.swift */; };
D234A734291C62CF0086AC80 /* CommonUtilitySpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = D234A706291C62CC0086AC80 /* CommonUtilitySpec.swift */; };
D234A735291C62CF0086AC80 /* ConfigurationServiceSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = D234A707291C62CD0086AC80 /* ConfigurationServiceSpec.swift */; };
Expand Down Expand Up @@ -239,7 +239,7 @@
D234A701291C62CB0086AC80 /* MatchingUtilitySpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MatchingUtilitySpec.swift; sourceTree = "<group>"; };
D234A702291C62CC0086AC80 /* KeyHasherSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KeyHasherSpec.swift; sourceTree = "<group>"; };
D234A703291C62CC0086AC80 /* DisplayPermissionServiceSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DisplayPermissionServiceSpec.swift; sourceTree = "<group>"; };
D234A704291C62CC0086AC80 /* MessageMixerServiceSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MessageMixerServiceSpec.swift; sourceTree = "<group>"; };
D234A704291C62CC0086AC80 /* PingServiceSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PingServiceSpec.swift; sourceTree = "<group>"; };
D234A705291C62CC0086AC80 /* LocaleSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LocaleSpec.swift; sourceTree = "<group>"; };
D234A706291C62CC0086AC80 /* CommonUtilitySpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CommonUtilitySpec.swift; sourceTree = "<group>"; };
D234A707291C62CD0086AC80 /* ConfigurationServiceSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConfigurationServiceSpec.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -527,7 +527,7 @@
D234A705291C62CC0086AC80 /* LocaleSpec.swift */,
D234A6ED291C62C90086AC80 /* MainContainerSpec.swift */,
D234A701291C62CB0086AC80 /* MatchingUtilitySpec.swift */,
D234A704291C62CC0086AC80 /* MessageMixerServiceSpec.swift */,
D234A704291C62CC0086AC80 /* PingServiceSpec.swift */,
D234A70D291C62CD0086AC80 /* OptOutMessageViewSpec.swift */,
D234A6F6291C62CA0086AC80 /* PublicAPISpec.swift */,
D234A710291C62CE0086AC80 /* ReadyCampaignDispatcherSpec.swift */,
Expand Down Expand Up @@ -915,7 +915,7 @@
D234A72D291C62CF0086AC80 /* CampaignTriggerAgentSpec.swift in Sources */,
D234A724291C62CF0086AC80 /* PublicAPISpec.swift in Sources */,
D234A73C291C62CF0086AC80 /* ConfigurationManagerSpec.swift in Sources */,
D234A732291C62CF0086AC80 /* MessageMixerServiceSpec.swift in Sources */,
D234A732291C62CF0086AC80 /* PingServiceSpec.swift in Sources */,
D234A73F291C62CF0086AC80 /* TooltipPresenterSpec.swift in Sources */,
D234A73E291C62CF0086AC80 /* ReadyCampaignDispatcherSpec.swift in Sources */,
D234A741291C62CF0086AC80 /* ViewModelSpec.swift in Sources */,
Expand Down
18 changes: 9 additions & 9 deletions Sources/RInAppMessaging/CampaignsListManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ internal class CampaignsListManager: CampaignsListManagerType, TaskSchedulable {

private var campaignRepository: CampaignRepositoryType
private let campaignTriggerAgent: CampaignTriggerAgentType
private let messageMixerService: MessageMixerServiceType
private let pingService: PingServiceType
private let configurationRepository: ConfigurationRepositoryType

weak var errorDelegate: ErrorDelegate?
Expand All @@ -20,12 +20,12 @@ internal class CampaignsListManager: CampaignsListManagerType, TaskSchedulable {

init(campaignRepository: CampaignRepositoryType,
campaignTriggerAgent: CampaignTriggerAgentType,
messageMixerService: MessageMixerServiceType,
pingService: PingServiceType,
configurationRepository: ConfigurationRepositoryType) {

self.campaignRepository = campaignRepository
self.campaignTriggerAgent = campaignTriggerAgent
self.messageMixerService = messageMixerService
self.pingService = pingService
self.configurationRepository = configurationRepository
}

Expand All @@ -45,7 +45,7 @@ internal class CampaignsListManager: CampaignsListManagerType, TaskSchedulable {
return
}

let pingResult = messageMixerService.ping()
let pingResult = pingService.ping()
let decodedResponse: PingResponse
do {
decodedResponse = try pingResult.get()
Expand Down Expand Up @@ -74,24 +74,24 @@ internal class CampaignsListManager: CampaignsListManagerType, TaskSchedulable {
responseStateMachine.push(state: .error)

switch error {
case MessageMixerServiceError.invalidConfiguration:
case PingServiceError.invalidConfiguration:
reportError(description: "Error retrieving InAppMessaging Mixer Server URL", data: nil)

case MessageMixerServiceError.jsonDecodingError(let decodingError):
case PingServiceError.jsonDecodingError(let decodingError):
reportError(description: "Ping request error: Failed to parse json", data: decodingError)

case MessageMixerServiceError.tooManyRequestsError:
case PingServiceError.tooManyRequestsError:
scheduleNextPingCallWithRandomizedBackoff()

case MessageMixerServiceError.internalServerError(let code):
case PingServiceError.internalServerError(let code):
guard responseStateMachine.consecutiveErrorCount <= Constants.Retry.retryCount else {
reportError(description: "Ping request error: Response Code \(code): Internal server error", data: nil)
return
}
scheduleNextPingCallWithRandomizedBackoff()
reportError(description: "Ping request error: Response Code \(code): Internal server error. Retry scheduled", data: nil)

case MessageMixerServiceError.invalidRequestError(let code):
case PingServiceError.invalidRequestError(let code):
reportError(description: "Ping request error: Response Code \(code): Invalid request error", data: nil)

default:
Expand Down
2 changes: 1 addition & 1 deletion Sources/RInAppMessaging/CampaignsValidator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ internal protocol CampaignsValidatorType {
/// if any campaigns are ready to be displayed.
///
/// This method is called when:
/// 1) MessageMixerService retrieves a new list from the ping endpoint.
/// 1) PingService retrieves a new list from the ping endpoint.
/// 2) Hostapp logs an event.
/// 3) Campaign's button logs an event.
/// - Parameter validatedCampaignHandler: Handler that will be called synchronously.
Expand Down
22 changes: 11 additions & 11 deletions Sources/RInAppMessaging/DependencyManager/MainContainer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ internal enum MainContainerFactory {
permissionService: manager.resolve(type: DisplayPermissionServiceType.self)!,
campaignRepository: manager.resolve(type: CampaignRepositoryType.self)!)
}),
ContainerElement(type: MessageMixerServiceType.self, factory: {
MessageMixerService(accountRepository: manager.resolve(type: AccountRepositoryType.self)!,
configurationRepository: manager.resolve(type: ConfigurationRepositoryType.self)!)
ContainerElement(type: PingServiceType.self, factory: {
PingService(accountRepository: manager.resolve(type: AccountRepositoryType.self)!,
configurationRepository: manager.resolve(type: ConfigurationRepositoryType.self)!)
}),
ContainerElement(type: ImpressionServiceType.self, factory: {
ImpressionService(accountRepository: manager.resolve(type: AccountRepositoryType.self)!,
Expand All @@ -71,7 +71,7 @@ internal enum MainContainerFactory {
ContainerElement(type: CampaignsListManagerType.self, factory: {
CampaignsListManager(campaignRepository: manager.resolve(type: CampaignRepositoryType.self)!,
campaignTriggerAgent: manager.resolve(type: CampaignTriggerAgentType.self)!,
messageMixerService: manager.resolve(type: MessageMixerServiceType.self)!,
pingService: manager.resolve(type: PingServiceType.self)!,
configurationRepository: manager.resolve(type: ConfigurationRepositoryType.self)!)
}),
ContainerElement(type: TooltipDispatcherType.self, factory: {
Expand Down Expand Up @@ -100,13 +100,13 @@ internal enum MainContainerFactory {
CampaignsValidator(campaignRepository: manager.resolve(type: CampaignRepositoryType.self)!,
eventMatcher: manager.resolve(type: EventMatcherType.self)!)
}, transient: true),
ContainerElement(type: FullViewPresenterType.self, factory: {
FullViewPresenter(campaignRepository: manager.resolve(type: CampaignRepositoryType.self)!,
impressionService: manager.resolve(type: ImpressionServiceType.self)!,
eventMatcher: manager.resolve(type: EventMatcherType.self)!,
campaignTriggerAgent: manager.resolve(type: CampaignTriggerAgentType.self)!,
pushPrimerOptions: RInAppMessaging.pushPrimerAuthorizationOptions,
configurationRepository: manager.resolve(type: ConfigurationRepositoryType.self)!)
ContainerElement(type: OverlayViewPresenterType.self, factory: {
OverlayViewPresenter(campaignRepository: manager.resolve(type: CampaignRepositoryType.self)!,
impressionService: manager.resolve(type: ImpressionServiceType.self)!,
eventMatcher: manager.resolve(type: EventMatcherType.self)!,
campaignTriggerAgent: manager.resolve(type: CampaignTriggerAgentType.self)!,
pushPrimerOptions: RInAppMessaging.pushPrimerAuthorizationOptions,
configurationRepository: manager.resolve(type: ConfigurationRepositoryType.self)!)
}, transient: true),
ContainerElement(type: SlideUpViewPresenterType.self, factory: {
SlideUpViewPresenter(campaignRepository: manager.resolve(type: CampaignRepositoryType.self)!,
Expand Down
4 changes: 1 addition & 3 deletions Sources/RInAppMessaging/RInAppMessaging.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,10 @@ import RSDKUtils
internal static var swiftUIEventHandler: SwiftUIViewEventHandlerType? {
dependencyManager?.resolve(type: SwiftUIViewEventHandlerType.self)
}

internal static var bundleInfo = BundleInfo.self

internal static var isInitialized: Bool {
interactor.iamModule != nil
}
internal static var bundleInfo = BundleInfo.self
internal static let interactor = InAppMessagingInteractor()

/// Returns `true` when RMC module is integrated in the host app
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="19529" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="21507" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="19519"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21505"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="FullView" customModule="RInAppMessaging">
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="OverlayView" customModule="RInAppMessaging">
<connections>
<outlet property="backgroundView" destination="iN0-l3-epB" id="9Bp-F7-OLM"/>
<outlet property="bodyContainerView" destination="R2i-po-Za0" id="2Gd-PQ-MhX"/>
Expand Down
4 changes: 2 additions & 2 deletions Sources/RInAppMessaging/Router.swift
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ internal class Router: RouterType, ViewListenerObserver {
var presenter: BaseViewPresenterType?
switch type {
case .modal, .full:
guard let resolvedPresenter = resolvePresenter(type: FullViewPresenterType.self) else {
guard let resolvedPresenter = resolvePresenter(type: OverlayViewPresenterType.self) else {
return nil
}
presenter = resolvedPresenter
Expand Down Expand Up @@ -173,7 +173,7 @@ internal class Router: RouterType, ViewListenerObserver {

switch type {
case .modal, .full:
let presenter = presenter as! FullViewPresenterType
let presenter = presenter as! OverlayViewPresenterType
presenter.campaign = campaign
if let associatedImageData = associatedImageData {
presenter.associatedImage = UIImage(data: associatedImageData)
Expand Down
Loading
Loading