Skip to content
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
20 changes: 20 additions & 0 deletions Mindbox.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,7 @@
A153E03B29BAFE01003C34D4 /* CustomOperationTargeting.swift in Sources */ = {isa = PBXBuildFile; fileRef = A153E03A29BAFE01003C34D4 /* CustomOperationTargeting.swift */; };
A153E03D29BAFEC1003C34D4 /* CustomOperationChecker.swift in Sources */ = {isa = PBXBuildFile; fileRef = A153E03C29BAFEC0003C34D4 /* CustomOperationChecker.swift */; };
A153E03F29BB002A003C34D4 /* SessionTemporaryStorage.swift in Sources */ = {isa = PBXBuildFile; fileRef = A153E03E29BB002A003C34D4 /* SessionTemporaryStorage.swift */; };
DC36B591F6608E7D1196C936 /* InappSessionLedger.swift in Sources */ = {isa = PBXBuildFile; fileRef = E4ADBBEBCF7E68E56565FEA9 /* InappSessionLedger.swift */; };
A153E04129BB0A8B003C34D4 /* InAppConfigurationWithOperations.json in Resources */ = {isa = PBXBuildFile; fileRef = A153E04029BB0A8B003C34D4 /* InAppConfigurationWithOperations.json */; };
A154E32E299E0D8900F8F074 /* SDKLogManagerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = A154E32D299E0D8900F8F074 /* SDKLogManagerTests.swift */; };
A154E330299E0F1600F8F074 /* InAppGeoResponse.swift in Sources */ = {isa = PBXBuildFile; fileRef = A154E32F299E0F1600F8F074 /* InAppGeoResponse.swift */; };
Expand Down Expand Up @@ -531,6 +532,8 @@
F3266A392F6295A600CE6137 /* FirstInitializationDateTimeMigration.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3266A382F6295A600CE6137 /* FirstInitializationDateTimeMigration.swift */; };
F32B68882CF83B030088BCDD /* InappConfigurationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F32B68872CF83B030088BCDD /* InappConfigurationTests.swift */; };
F32CA1762E17625200CE7E63 /* InappScheduleManagerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F32CA1752E17625200CE7E63 /* InappScheduleManagerTests.swift */; };
03F556ABF25843F4E03B12D9 /* InappSessionLedgerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B7A74E65031C00E64367BA99 /* InappSessionLedgerTests.swift */; };
D8884D732391D8DEFC19A4C1 /* InappShowAccountantTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA57EA9FD870B3E7E22BE75D /* InappShowAccountantTests.swift */; };
F32CFFA42BB403C700A41E04 /* PushEnabledTargeting.swift in Sources */ = {isa = PBXBuildFile; fileRef = F32CFFA32BB403C700A41E04 /* PushEnabledTargeting.swift */; };
F32CFFA62BB4044E00A41E04 /* PushEnabledTargetingChecker.swift in Sources */ = {isa = PBXBuildFile; fileRef = F32CFFA52BB4044E00A41E04 /* PushEnabledTargetingChecker.swift */; };
F32E536F2C3F2B05002C7CA0 /* DITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F32E536E2C3F2B05002C7CA0 /* DITests.swift */; };
Expand Down Expand Up @@ -607,6 +610,7 @@
F34A45AE2B7628B700634C8B /* MBPushNotification.swift in Sources */ = {isa = PBXBuildFile; fileRef = F34A45AD2B7628B700634C8B /* MBPushNotification.swift */; };
F34A45B02B762A6100634C8B /* MindboxPushValidator.swift in Sources */ = {isa = PBXBuildFile; fileRef = F34A45AF2B762A6100634C8B /* MindboxPushValidator.swift */; };
F351F1C02CE380A40053423E /* InappMapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = F351F1BF2CE380A40053423E /* InappMapper.swift */; };
D449F3534453BD50D93B5E72 /* InappFormBuilder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4761BB2323EB5B1C72894561 /* InappFormBuilder.swift */; };
F351F1C22CE5F23A0053423E /* InappMapperTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F351F1C12CE5F23A0053423E /* InappMapperTests.swift */; };
F351F1C42CE60CA90053423E /* 1-Targeting.json in Resources */ = {isa = PBXBuildFile; fileRef = F351F1C32CE60CA90053423E /* 1-Targeting.json */; };
F351F1C62CE626450053423E /* 15-Targeting.json in Resources */ = {isa = PBXBuildFile; fileRef = F351F1C52CE626450053423E /* 15-Targeting.json */; };
Expand Down Expand Up @@ -670,6 +674,7 @@
F39B67B82A3FAA75005C0CCA /* ABTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F39B67B72A3FAA75005C0CCA /* ABTests.swift */; };
F3A0B0022F28A00100CE7E63 /* TransparentViewTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3A0B0012F28A00100CE7E63 /* TransparentViewTests.swift */; };
F3A22CBA2E169F3F005817F2 /* InappScheduleManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3A22CB92E169F3F005817F2 /* InappScheduleManager.swift */; };
C150E6672EC2831BFA85D12B /* InappShowAccountant.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8A674E9219591468A9FE335 /* InappShowAccountant.swift */; };
F3A49BE32DDF070D00C52AB6 /* InAppSettingsModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3A49BE22DDF070D00C52AB6 /* InAppSettingsModel.swift */; };
F3A4EFDC2D5224C700DB96A8 /* SlidingExpirationModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3A4EFDB2D5224C700DB96A8 /* SlidingExpirationModel.swift */; };
F3A8B9452A38870100E9C055 /* MixerUUIDS.json in Resources */ = {isa = PBXBuildFile; fileRef = F3A8B9442A38870100E9C055 /* MixerUUIDS.json */; };
Expand Down Expand Up @@ -1168,6 +1173,7 @@
A153E03A29BAFE01003C34D4 /* CustomOperationTargeting.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomOperationTargeting.swift; sourceTree = "<group>"; };
A153E03C29BAFEC0003C34D4 /* CustomOperationChecker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomOperationChecker.swift; sourceTree = "<group>"; };
A153E03E29BB002A003C34D4 /* SessionTemporaryStorage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SessionTemporaryStorage.swift; sourceTree = "<group>"; };
E4ADBBEBCF7E68E56565FEA9 /* InappSessionLedger.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InappSessionLedger.swift; sourceTree = "<group>"; };
A153E04029BB0A8B003C34D4 /* InAppConfigurationWithOperations.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = InAppConfigurationWithOperations.json; sourceTree = "<group>"; };
A154E32D299E0D8900F8F074 /* SDKLogManagerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SDKLogManagerTests.swift; sourceTree = "<group>"; };
A154E32F299E0F1600F8F074 /* InAppGeoResponse.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = InAppGeoResponse.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1310,6 +1316,8 @@
F3266A382F6295A600CE6137 /* FirstInitializationDateTimeMigration.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FirstInitializationDateTimeMigration.swift; sourceTree = "<group>"; };
F32B68872CF83B030088BCDD /* InappConfigurationTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InappConfigurationTests.swift; sourceTree = "<group>"; };
F32CA1752E17625200CE7E63 /* InappScheduleManagerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InappScheduleManagerTests.swift; sourceTree = "<group>"; };
B7A74E65031C00E64367BA99 /* InappSessionLedgerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InappSessionLedgerTests.swift; sourceTree = "<group>"; };
AA57EA9FD870B3E7E22BE75D /* InappShowAccountantTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InappShowAccountantTests.swift; sourceTree = "<group>"; };
F32CFFA32BB403C700A41E04 /* PushEnabledTargeting.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PushEnabledTargeting.swift; sourceTree = "<group>"; };
F32CFFA52BB4044E00A41E04 /* PushEnabledTargetingChecker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PushEnabledTargetingChecker.swift; sourceTree = "<group>"; };
F32E536E2C3F2B05002C7CA0 /* DITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DITests.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1386,6 +1394,7 @@
F34A45AD2B7628B700634C8B /* MBPushNotification.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MBPushNotification.swift; sourceTree = "<group>"; };
F34A45AF2B762A6100634C8B /* MindboxPushValidator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MindboxPushValidator.swift; sourceTree = "<group>"; };
F351F1BF2CE380A40053423E /* InappMapper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InappMapper.swift; sourceTree = "<group>"; };
4761BB2323EB5B1C72894561 /* InappFormBuilder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InappFormBuilder.swift; sourceTree = "<group>"; };
F351F1C12CE5F23A0053423E /* InappMapperTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InappMapperTests.swift; sourceTree = "<group>"; };
F351F1C32CE60CA90053423E /* 1-Targeting.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = "1-Targeting.json"; sourceTree = "<group>"; };
F351F1C52CE626450053423E /* 15-Targeting.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = "15-Targeting.json"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1448,6 +1457,7 @@
F39B67B72A3FAA75005C0CCA /* ABTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ABTests.swift; sourceTree = "<group>"; };
F3A0B0012F28A00100CE7E63 /* TransparentViewTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TransparentViewTests.swift; sourceTree = "<group>"; };
F3A22CB92E169F3F005817F2 /* InappScheduleManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InappScheduleManager.swift; sourceTree = "<group>"; };
B8A674E9219591468A9FE335 /* InappShowAccountant.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InappShowAccountant.swift; sourceTree = "<group>"; };
F3A49BE22DDF070D00C52AB6 /* InAppSettingsModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InAppSettingsModel.swift; sourceTree = "<group>"; };
F3A4EFDB2D5224C700DB96A8 /* SlidingExpirationModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SlidingExpirationModel.swift; sourceTree = "<group>"; };
F3A8B9442A38870100E9C055 /* MixerUUIDS.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = MixerUUIDS.json; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1786,6 +1796,7 @@
3328FE4326303F30000A30D0 /* TimeInterval+TimeSpan.swift */,
F78E92EE282E63320003B4A3 /* DispatchSemaphore.swift */,
A153E03E29BB002A003C34D4 /* SessionTemporaryStorage.swift */,
E4ADBBEBCF7E68E56565FEA9 /* InappSessionLedger.swift */,
);
path = Utilities;
sourceTree = "<group>";
Expand Down Expand Up @@ -2735,6 +2746,7 @@
9B24FAB328C751CB00F10B5D /* Images */,
F34975692DEF2C8400BEC667 /* InappTrackingService.swift */,
F3A22CB92E169F3F005817F2 /* InappScheduleManager.swift */,
B8A674E9219591468A9FE335 /* InappShowAccountant.swift */,
F3B70A002F250A0100AABB01 /* ForegroundStopwatch.swift */,
F3C1A0012F5B100100ABC001 /* InappShowFailureManager.swift */,
A1B2C3D400000016E1010101 /* Permissions */,
Expand Down Expand Up @@ -2822,6 +2834,8 @@
9BC24E7828F6BFEC00C2619C /* InAppConfigResponseTests */,
F3D925AC2A1236F400135C87 /* URLSessionImageDownloaderTests.swift */,
F32CA1752E17625200CE7E63 /* InappScheduleManagerTests.swift */,
B7A74E65031C00E64367BA99 /* InappSessionLedgerTests.swift */,
AA57EA9FD870B3E7E22BE75D /* InappShowAccountantTests.swift */,
327A85474E7AB7AC1884A890 /* InAppConfigurationManagerTests.swift */,
D55C134D9E499E94D099CD09 /* InAppCoreManagerTests.swift */,
F3B70A022F250A0100AABB02 /* ForegroundStopwatchTests.swift */,
Expand Down Expand Up @@ -3813,6 +3827,7 @@
children = (
F3A8B9562A389D9300E9C055 /* Services */,
F351F1BF2CE380A40053423E /* InappMapper.swift */,
4761BB2323EB5B1C72894561 /* InappFormBuilder.swift */,
);
path = InAppConfigurationMapper;
sourceTree = "<group>";
Expand Down Expand Up @@ -4492,6 +4507,7 @@
334F3A67264AA18500A6AC00 /* MindboxAppDelegate.swift in Sources */,
B3A6254C2689F83100B6A3B7 /* PersonalOffersResponse.swift in Sources */,
F3A22CBA2E169F3F005817F2 /* InappScheduleManager.swift in Sources */,
C150E6672EC2831BFA85D12B /* InappShowAccountant.swift in Sources */,
F3B70A012F250A0100AABB01 /* ForegroundStopwatch.swift in Sources */,
84F565212628304A00269FD6 /* TrackVisit.swift in Sources */,
F34975382DEE2C6A00BEC667 /* ShownInAppsDictionaryMigration.swift in Sources */,
Expand Down Expand Up @@ -4561,6 +4577,7 @@
317AF8FC25B844DB006348FA /* UtilitiesFetcher.swift in Sources */,
B36D57852696E59400FEDFD6 /* RetailOrderStatisticsResponse.swift in Sources */,
A153E03F29BB002A003C34D4 /* SessionTemporaryStorage.swift in Sources */,
DC36B591F6608E7D1196C936 /* InappSessionLedger.swift in Sources */,
840C387325CC1AF200D50183 /* CDEvent+CoreDataProperties.swift in Sources */,
F3482F1D2A65DC11002A41EC /* CompositeInappMessageDelegate.swift in Sources */,
33072F3C2664C713001F1AB2 /* CustomerSegmentationsResponse.swift in Sources */,
Expand All @@ -4569,6 +4586,7 @@
A1D017E92976CC1C00CD9F99 /* TargetingChecker.swift in Sources */,
F397EEB52A44573600D48CEC /* Status.swift in Sources */,
F351F1C02CE380A40053423E /* InappMapper.swift in Sources */,
D449F3534453BD50D93B5E72 /* InappFormBuilder.swift in Sources */,
6FDD1455266F7C9A00A50C35 /* PromotionTypeResponse.swift in Sources */,
334F3AEB264C199900A6AC00 /* DiscountCardRequest.swift in Sources */,
31A20D4E25B6EFB600AAA0A3 /* MindboxDelegate.swift in Sources */,
Expand Down Expand Up @@ -4878,6 +4896,8 @@
47B90E312C626B9300BD93E7 /* TestProtocolMigrations.swift in Sources */,
F3A8B9982A3A421C00E9C055 /* SDKVersionValidatorTests.swift in Sources */,
F32CA1762E17625200CE7E63 /* InappScheduleManagerTests.swift in Sources */,
03F556ABF25843F4E03B12D9 /* InappSessionLedgerTests.swift in Sources */,
D8884D732391D8DEFC19A4C1 /* InappShowAccountantTests.swift in Sources */,
C560714312DC9ADC194C8714 /* InAppConfigurationManagerTests.swift in Sources */,
BD92D11B0743EEAE2024318A /* InAppCoreManagerTests.swift in Sources */,
F3B70A032F250A0100AABB02 /* ForegroundStopwatchTests.swift in Sources */,
Expand Down
9 changes: 5 additions & 4 deletions Mindbox/DI/Injections/InjectEmbeddedBlocks.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@ extension MBContainer {
EmbeddedBlockPlaceRegistry(resolver: DI.injectOrFail(EmbeddedBlockResolving.self))
}

register(EmbeddedBlockFeedServing.self) {
EmbeddedBlockFeedService()
register(EmbeddedBlockInappServing.self) {
EmbeddedBlockInappService()
}

register(EmbeddedBlockContentProviderMaking.self) {
EmbeddedBlockContentProviderFactory(registry: DI.injectOrFail(EmbeddedBlockPlaceRegistering.self),
feed: DI.injectOrFail(EmbeddedBlockFeedServing.self),
failureManager: DI.injectOrFail(InappShowFailureManagerProtocol.self))
inappService: DI.injectOrFail(EmbeddedBlockInappServing.self),
failureManager: DI.injectOrFail(InappShowFailureManagerProtocol.self),
accounting: DI.injectOrFail(InappShowAccounting.self))
}

return self
Expand Down
22 changes: 10 additions & 12 deletions Mindbox/DI/Injections/InjectInappTools.swift
Original file line number Diff line number Diff line change
Expand Up @@ -113,19 +113,17 @@ extension MBContainer {
return InAppTrackingService(persistenceStorage: persistenceStorage)
}

register(InappShowAccounting.self) {
InappShowAccountant(tracker: DI.injectOrFail(InAppMessagesTracker.self),
trackingService: DI.injectOrFail(InAppTrackingServiceProtocol.self))
}

register(InappScheduleManagerProtocol.self) {
let presentationManager = DI.injectOrFail(InAppPresentationManagerProtocol.self)
let presentationValidator = DI.injectOrFail(InAppPresentationValidatorProtocol.self)
let inappTrackingService = DI.injectOrFail(InAppTrackingServiceProtocol.self)
let tracker = DI.injectOrFail(InAppMessagesTracker.self)
let failureManager = DI.injectOrFail(InappShowFailureManagerProtocol.self)

return InappScheduleManager(
presentationManager: presentationManager,
presentationValidator: presentationValidator,
trackingService: inappTrackingService,
tracker: tracker,
failureManager: failureManager
InappScheduleManager(
presentationManager: DI.injectOrFail(InAppPresentationManagerProtocol.self),
presentationValidator: DI.injectOrFail(InAppPresentationValidatorProtocol.self),
accountant: DI.injectOrFail(InappShowAccounting.self),
failureManager: DI.injectOrFail(InappShowFailureManagerProtocol.self)
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,38 +20,35 @@ protocol EmbeddedBlockContentProviderMaking {
final class EmbeddedBlockContentProviderFactory: EmbeddedBlockContentProviderMaking {

private let registry: EmbeddedBlockPlaceRegistering
private let feed: EmbeddedBlockFeedServing
private let inappService: EmbeddedBlockInappServing
private let failureManager: InappShowFailureManagerProtocol
private let accounting: InappShowAccounting

init(registry: EmbeddedBlockPlaceRegistering,
feed: EmbeddedBlockFeedServing,
failureManager: InappShowFailureManagerProtocol) {
inappService: EmbeddedBlockInappServing,
failureManager: InappShowFailureManagerProtocol,
accounting: InappShowAccounting) {
self.registry = registry
self.feed = feed
self.inappService = inappService
self.failureManager = failureManager
self.accounting = accounting
}

func makeProvider(placeSystemName: String) -> EmbeddedBlockWebViewProvider {
EmbeddedBlockWebViewProvider(placeSystemName: placeSystemName,
registry: registry,
feed: feed,
inappService: inappService,
makePage: { EmbeddedBlockWebViewPage(content: $0) },
recordShow: { DI.injectOrFail(InAppTrackingServiceProtocol.self).trackInAppShown(id: $0) },
reportShow: { content, timeToDisplay in
do {
try DI.injectOrFail(InAppMessagesTracker.self)
.trackView(id: content.inAppId,
timeToDisplay: timeToDisplay,
tags: content.tags)
} catch {
Logger.common(message: "[EmbeddedBlock] Failed to track a show of in-app \(content.inAppId): \(error)",
level: .error, category: .embeddedBlocks)
}
},
accounting: accounting,
reportFailure: { [failureManager] content, reason, details in
// Captured, not read through the factory: a provider outliving it
// would otherwise drop the failure it is reporting.
Self.report(failure: reason, details: details, for: content, to: failureManager)
},
reportUnansweredWait: { [failureManager, inappService] waited in
failureManager.sendWaitBudgetExceeded(place: placeSystemName,
waited: waited,
phase: inappService.hasConfig ? .resolvePending : .configMissing)
})
}

Expand Down
Loading