diff --git a/Mindbox.xcodeproj/project.pbxproj b/Mindbox.xcodeproj/project.pbxproj index 5cf324c2..f476e53d 100644 --- a/Mindbox.xcodeproj/project.pbxproj +++ b/Mindbox.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 50; + objectVersion = 54; objects = { /* Begin PBXBuildFile section */ @@ -164,6 +164,7 @@ 47BD5BFB2C578BC600F965C0 /* MigrationManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 47BD5BFA2C578BC600F965C0 /* MigrationManager.swift */; }; 47BD5BFE2C578FB400F965C0 /* BaseMigration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 47BD5BFD2C578FB400F965C0 /* BaseMigration.swift */; }; 47D63E2B2C2EABDF0055E7D8 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = F3EC93BA2AF105DA0030D107 /* PrivacyInfo.xcprivacy */; }; + 47EFBB2F2CB92B240023A4B9 /* SegmentationCheckResponse.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B4F9DEE28D08897002C9CF0 /* SegmentationCheckResponse.swift */; }; 47FDF0BA2C5BDAB80051F08C /* MigrationManagerProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 47FDF0B92C5BDAB80051F08C /* MigrationManagerProtocol.swift */; }; 47FDF0BC2C5BE8BB0051F08C /* MigrationProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 47FDF0BB2C5BE8BB0051F08C /* MigrationProtocol.swift */; }; 6F1EAA16266A670E007A335B /* ProductListItemsResponse.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6F1EAA15266A670E007A335B /* ProductListItemsResponse.swift */; }; @@ -253,7 +254,6 @@ 9B24FABD28C757A700F10B5D /* InAppResponse.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B24FABC28C757A700F10B5D /* InAppResponse.swift */; }; 9B2F5F752902975B00F28A96 /* InAppMessagesTracker.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B2F5F742902975B00F28A96 /* InAppMessagesTracker.swift */; }; 9B33F3CD28D0986900A3FFF9 /* CustomerSegmentsAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B33F3CC28D0986900A3FFF9 /* CustomerSegmentsAPI.swift */; }; - 9B4F9DEF28D08897002C9CF0 /* SegmentationCheckResponse.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B4F9DEE28D08897002C9CF0 /* SegmentationCheckResponse.swift */; }; 9B4F9DF228D088A0002C9CF0 /* InAppsCheckRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B4F9DF028D088A0002C9CF0 /* InAppsCheckRequest.swift */; }; 9B4F9DF328D088A0002C9CF0 /* InAppFormData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B4F9DF128D088A0002C9CF0 /* InAppFormData.swift */; }; 9B4F9DF828D088A9002C9CF0 /* InAppConfigutationMapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B4F9DF528D088A8002C9CF0 /* InAppConfigutationMapper.swift */; }; @@ -3273,8 +3273,9 @@ 313B232725ADEA0F00A1CB72 /* Project object */ = { isa = PBXProject; attributes = { + BuildIndependentTargetsInParallel = YES; LastSwiftUpdateCheck = 1410; - LastUpgradeCheck = 1250; + LastUpgradeCheck = 1600; ORGANIZATIONNAME = Mindbox; TargetAttributes = { 313B232F25ADEA0F00A1CB72 = { @@ -3482,7 +3483,7 @@ /* Begin PBXShellScriptBuildPhase section */ 3159FFB425B5AAF300EE80E9 /* Increment Build Number Script */ = { isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; + buildActionMask = 8; files = ( ); inputFileListPaths = ( @@ -3494,7 +3495,7 @@ ); outputPaths = ( ); - runOnlyForDeploymentPostprocessing = 0; + runOnlyForDeploymentPostprocessing = 1; shellPath = /bin/sh; shellScript = "buildNumber=$(/usr/libexec/PlistBuddy -c \"Print CFBundleVersion\" \"${PROJECT_DIR}/${INFOPLIST_FILE}\")\nbuildNumber=$(($buildNumber + 1))\n/usr/libexec/PlistBuddy -c \"Set :CFBundleVersion $buildNumber\" \"${PROJECT_DIR}/${INFOPLIST_FILE}\"\n"; }; @@ -3505,6 +3506,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 47EFBB2F2CB92B240023A4B9 /* SegmentationCheckResponse.swift in Sources */, F331DD062A83A56500222120 /* ModalViewController.swift in Sources */, F331DCC12A80993600222120 /* ContentElement.swift in Sources */, 847F581725C8981F00147A9A /* HTTPURLResponseStatusCodeValidator.swift in Sources */, @@ -3741,8 +3743,6 @@ F33608122A8A151C00C7C9B7 /* ContentPosition.swift in Sources */, 337A474026553938000DC613 /* Sex.swift in Sources */, F3A8B9922A3A408C00E9C055 /* SDKVersionValidator.swift in Sources */, - 9B4F9DEF28D08897002C9CF0 /* SegmentationCheckResponse.swift in Sources */, - 9B4F9DEF28D08897002C9CF0 /* SegmentationCheckResponse.swift in Sources */, F31A94782BC6995500E6C978 /* InappFrequency.swift in Sources */, F3482F212A65DC2C002A41EC /* URLInappMessageDelegate.swift in Sources */, BB6563102BE3BA430090C473 /* UIApplication+Extensions.swift in Sources */, @@ -4039,6 +4039,7 @@ DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; GCC_C_LANGUAGE_STANDARD = gnu11; GCC_DYNAMIC_NO_PIC = NO; GCC_NO_COMMON_BLOCKS = YES; @@ -4062,7 +4063,7 @@ SUPPORTED_PLATFORMS = "iphonesimulator iphoneos"; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - TVOS_DEPLOYMENT_TARGET = 10.0; + TVOS_DEPLOYMENT_TARGET = 12.0; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; WATCHOS_DEPLOYMENT_TARGET = 6.0; @@ -4108,6 +4109,7 @@ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; GCC_C_LANGUAGE_STANDARD = gnu11; GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; @@ -4124,7 +4126,7 @@ SUPPORTED_PLATFORMS = "iphonesimulator iphoneos"; SWIFT_COMPILATION_MODE = wholemodule; SWIFT_OPTIMIZATION_LEVEL = "-O"; - TVOS_DEPLOYMENT_TARGET = 10.0; + TVOS_DEPLOYMENT_TARGET = 12.0; VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -4136,12 +4138,14 @@ isa = XCBuildConfiguration; buildSettings = { CLANG_ENABLE_MODULES = YES; + CODE_SIGN_IDENTITY = ""; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 2; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_MODULE_VERIFIER = YES; INFOPLIST_FILE = Mindbox/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = ( @@ -4149,7 +4153,9 @@ "@executable_path/Frameworks", "@loader_path/Frameworks", ); + MACOSX_DEPLOYMENT_TARGET = 11.0; MARKETING_VERSION = 2.7.0; + MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu11 gnu++14"; PRODUCT_BUNDLE_IDENTIFIER = cloud.Mindbox; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; SKIP_INSTALL = YES; @@ -4164,12 +4170,14 @@ isa = XCBuildConfiguration; buildSettings = { CLANG_ENABLE_MODULES = YES; + CODE_SIGN_IDENTITY = ""; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 2; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_MODULE_VERIFIER = YES; INFOPLIST_FILE = Mindbox/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = ( @@ -4177,7 +4185,9 @@ "@executable_path/Frameworks", "@loader_path/Frameworks", ); + MACOSX_DEPLOYMENT_TARGET = 11.0; MARKETING_VERSION = 2.7.0; + MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu11 gnu++14"; PRODUCT_BUNDLE_IDENTIFIER = cloud.Mindbox; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; SKIP_INSTALL = YES; @@ -4190,7 +4200,6 @@ 313B234825ADEA0F00A1CB72 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; CODE_SIGN_STYLE = Automatic; INFOPLIST_FILE = MindboxTests/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( @@ -4198,6 +4207,7 @@ "@executable_path/Frameworks", "@loader_path/Frameworks", ); + MACOSX_DEPLOYMENT_TARGET = 11.0; PRODUCT_BUNDLE_IDENTIFIER = Mindbox.MindboxTests; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 5.0; @@ -4208,7 +4218,6 @@ 313B234925ADEA0F00A1CB72 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; CODE_SIGN_STYLE = Automatic; INFOPLIST_FILE = MindboxTests/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( @@ -4216,6 +4225,7 @@ "@executable_path/Frameworks", "@loader_path/Frameworks", ); + MACOSX_DEPLOYMENT_TARGET = 11.0; PRODUCT_BUNDLE_IDENTIFIER = Mindbox.MindboxTests; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 5.0; @@ -4227,12 +4237,14 @@ isa = XCBuildConfiguration; buildSettings = { APPLICATION_EXTENSION_API_ONLY = YES; + CODE_SIGN_IDENTITY = ""; CODE_SIGN_STYLE = Automatic; DEFINES_MODULE = YES; DEVELOPMENT_TEAM = N39VVWZXXP; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_MODULE_VERIFIER = YES; INFOPLIST_FILE = MindboxNotifications/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 12.0; @@ -4241,7 +4253,9 @@ "@executable_path/Frameworks", "@loader_path/Frameworks", ); + MACOSX_DEPLOYMENT_TARGET = 11.0; MARKETING_VERSION = 2.7.0; + MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu11 gnu++14"; PRODUCT_BUNDLE_IDENTIFIER = cloud.MindboxNotifications; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; SKIP_INSTALL = YES; @@ -4255,12 +4269,14 @@ isa = XCBuildConfiguration; buildSettings = { APPLICATION_EXTENSION_API_ONLY = YES; + CODE_SIGN_IDENTITY = ""; CODE_SIGN_STYLE = Automatic; DEFINES_MODULE = YES; DEVELOPMENT_TEAM = N39VVWZXXP; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_MODULE_VERIFIER = YES; INFOPLIST_FILE = MindboxNotifications/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 12.0; @@ -4269,7 +4285,9 @@ "@executable_path/Frameworks", "@loader_path/Frameworks", ); + MACOSX_DEPLOYMENT_TARGET = 11.0; MARKETING_VERSION = 2.7.0; + MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu11 gnu++14"; PRODUCT_BUNDLE_IDENTIFIER = cloud.MindboxNotifications; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; SKIP_INSTALL = YES; @@ -4282,7 +4300,6 @@ 3333C1AB2681D3CF00B60D84 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; CODE_SIGN_STYLE = Automatic; DEVELOPMENT_TEAM = N39VVWZXXP; INFOPLIST_FILE = MindboxNotificationsTests/Info.plist; @@ -4292,6 +4309,7 @@ "@executable_path/Frameworks", "@loader_path/Frameworks", ); + MACOSX_DEPLOYMENT_TARGET = 11.0; PRODUCT_BUNDLE_IDENTIFIER = cloud.MindboxNotificationsTests; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 5.0; @@ -4302,7 +4320,6 @@ 3333C1AC2681D3CF00B60D84 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; CODE_SIGN_STYLE = Automatic; DEVELOPMENT_TEAM = N39VVWZXXP; INFOPLIST_FILE = MindboxNotificationsTests/Info.plist; @@ -4312,6 +4329,7 @@ "@executable_path/Frameworks", "@loader_path/Frameworks", ); + MACOSX_DEPLOYMENT_TARGET = 11.0; PRODUCT_BUNDLE_IDENTIFIER = cloud.MindboxNotificationsTests; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 5.0; @@ -4323,6 +4341,7 @@ isa = XCBuildConfiguration; buildSettings = { CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CODE_SIGN_IDENTITY = ""; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; DEFINES_MODULE = YES; @@ -4330,6 +4349,7 @@ DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_MODULE_VERIFIER = YES; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_KEY_NSHumanReadableCopyright = "Copyright © 2023 Mindbox. All rights reserved."; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; @@ -4339,7 +4359,9 @@ "@executable_path/Frameworks", "@loader_path/Frameworks", ); + MACOSX_DEPLOYMENT_TARGET = 11.0; MARKETING_VERSION = 1.0; + MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu11 gnu++20"; PRODUCT_BUNDLE_IDENTIFIER = cloud.organization.MindboxLogger; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; SKIP_INSTALL = YES; @@ -4353,6 +4375,7 @@ isa = XCBuildConfiguration; buildSettings = { CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CODE_SIGN_IDENTITY = ""; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; DEFINES_MODULE = YES; @@ -4360,6 +4383,7 @@ DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_MODULE_VERIFIER = YES; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_KEY_NSHumanReadableCopyright = "Copyright © 2023 Mindbox. All rights reserved."; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; @@ -4369,7 +4393,9 @@ "@executable_path/Frameworks", "@loader_path/Frameworks", ); + MACOSX_DEPLOYMENT_TARGET = 11.0; MARKETING_VERSION = 1.0; + MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu11 gnu++20"; PRODUCT_BUNDLE_IDENTIFIER = cloud.organization.MindboxLogger; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; SKIP_INSTALL = YES; @@ -4382,13 +4408,13 @@ A17853CF29AF7E950072578F /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_TEAM = N39VVWZXXP; GENERATE_INFOPLIST_FILE = YES; IPHONEOS_DEPLOYMENT_TARGET = 12.0; + MACOSX_DEPLOYMENT_TARGET = 11.0; MARKETING_VERSION = 1.0; PRODUCT_BUNDLE_IDENTIFIER = cloud.organization.MindboxLoggerTests; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -4401,13 +4427,13 @@ A17853D029AF7E950072578F /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_TEAM = N39VVWZXXP; GENERATE_INFOPLIST_FILE = YES; IPHONEOS_DEPLOYMENT_TARGET = 12.0; + MACOSX_DEPLOYMENT_TARGET = 11.0; MARKETING_VERSION = 1.0; PRODUCT_BUNDLE_IDENTIFIER = cloud.organization.MindboxLoggerTests; PRODUCT_NAME = "$(TARGET_NAME)"; diff --git a/Mindbox.xcodeproj/xcshareddata/xcschemes/Mindbox.xcscheme b/Mindbox.xcodeproj/xcshareddata/xcschemes/Mindbox.xcscheme index e1a5f907..424ec3ef 100644 --- a/Mindbox.xcodeproj/xcshareddata/xcschemes/Mindbox.xcscheme +++ b/Mindbox.xcodeproj/xcshareddata/xcschemes/Mindbox.xcscheme @@ -1,6 +1,6 @@ MBPushNotification? { guard let data = try? JSONSerialization.data(withJSONObject: userInfo), let notificationModel = try? JSONDecoder().decode(MBPushNotification.self, from: data), - let clickUrl = notificationModel.clickUrl, + notificationModel.clickUrl != nil, let alert = notificationModel.aps?.alert, - let body = alert.body else { + alert.body != nil else { Logger.common(message: "CurrentFormatStrategy: Failed to parse current notification format. userInfo: \(userInfo)", level: .error, category: .notification) return nil } diff --git a/Mindbox/Utilities/Migrations/ImplementationOfMigrations/ShownInAppsIdsMigration.swift b/Mindbox/Utilities/Migrations/ImplementationOfMigrations/ShownInAppsIdsMigration.swift index 78435e6d..39839072 100644 --- a/Mindbox/Utilities/Migrations/ImplementationOfMigrations/ShownInAppsIdsMigration.swift +++ b/Mindbox/Utilities/Migrations/ImplementationOfMigrations/ShownInAppsIdsMigration.swift @@ -16,6 +16,7 @@ final class MigrationShownInAppsIds: MigrationProtocol { "Migration shownInAppsIds to shownInappsDictionary. Starting with SDK 2.10.0." } + @available(*, deprecated, message: "Suppress `deprecated` shownInAppsIds warning") var isNeeded: Bool { persistenceStorage.shownInAppsIds?.isEmpty == false } @@ -24,6 +25,7 @@ final class MigrationShownInAppsIds: MigrationProtocol { 0 } + @available(*, deprecated, message: "Suppress deprecated `shownInAppsIds` warning") func run() throws { guard let oldShownInAppsIds = persistenceStorage.shownInAppsIds else { return diff --git a/MindboxLogger/Shared/LoggerRepository/MBPersistentContainer.swift b/MindboxLogger/Shared/LoggerRepository/MBPersistentContainer.swift index 01769524..98dec6c3 100644 --- a/MindboxLogger/Shared/LoggerRepository/MBPersistentContainer.swift +++ b/MindboxLogger/Shared/LoggerRepository/MBPersistentContainer.swift @@ -9,7 +9,7 @@ import Foundation import CoreData -public class MBPersistentContainer: NSPersistentContainer { +public class MBPersistentContainer: NSPersistentContainer, @unchecked Sendable { public static var applicationGroupIdentifier: String? = nil diff --git a/MindboxLogger/Shared/MBLogger.swift b/MindboxLogger/Shared/MBLogger.swift index fa1c9e75..73cdd510 100644 --- a/MindboxLogger/Shared/MBLogger.swift +++ b/MindboxLogger/Shared/MBLogger.swift @@ -116,10 +116,6 @@ private extension MBLogger { } private func writeToCD(message: String, timestamp: Date = Date()) { - do { - try MBLoggerCoreDataManager.shared.create(message: message, timestamp: timestamp) - } catch { - - } + MBLoggerCoreDataManager.shared.create(message: message, timestamp: timestamp) } } diff --git a/MindboxNotifications/PushNotifications/PushNotificationFormatStrategies/NotificationFormatStrategy.swift b/MindboxNotifications/PushNotifications/PushNotificationFormatStrategies/NotificationFormatStrategy.swift index 6cc94955..04ad29ea 100644 --- a/MindboxNotifications/PushNotifications/PushNotificationFormatStrategies/NotificationFormatStrategy.swift +++ b/MindboxNotifications/PushNotifications/PushNotificationFormatStrategies/NotificationFormatStrategy.swift @@ -57,9 +57,9 @@ final class CurrentFormatStrategy: NotificationFormatStrategy { func handle(userInfo: [AnyHashable : Any]) -> MBPushNotification? { guard let data = try? JSONSerialization.data(withJSONObject: userInfo), let notificationModel = try? JSONDecoder().decode(MBPushNotification.self, from: data), - let clickUrl = notificationModel.clickUrl, + notificationModel.clickUrl != nil, let alert = notificationModel.aps?.alert, - let body = alert.body else { + alert.body != nil else { Logger.common(message: "CurrentFormatStrategy: Failed to parse current notification format. userInfo: \(userInfo)", level: .error, category: .notification) return nil } diff --git a/MindboxNotifications/PushNotifications/PushValidator.swift b/MindboxNotifications/PushNotifications/PushValidator.swift index f517efc7..2f42d93d 100644 --- a/MindboxNotifications/PushNotifications/PushValidator.swift +++ b/MindboxNotifications/PushNotifications/PushValidator.swift @@ -15,7 +15,7 @@ protocol PushValidator { final class MindboxPushValidator: PushValidator { func isValid(item: [AnyHashable : Any]) -> Bool { - guard let pushModel = NotificationFormatter.formatNotification(item) else { + guard NotificationFormatter.formatNotification(item) != nil else { Logger.common(message: "MindboxPushValidator: Failed to convert item to Mindbox push model. Validation failed.", level: .error, category: .notification) return false } diff --git a/MindboxTests/Extensions/StringExtensionsTests.swift b/MindboxTests/Extensions/StringExtensionsTests.swift index e686b628..070ace20 100644 --- a/MindboxTests/Extensions/StringExtensionsTests.swift +++ b/MindboxTests/Extensions/StringExtensionsTests.swift @@ -89,12 +89,9 @@ final class StringExtensionsTests: XCTestCase { ] for str in testCases { - XCTContext.runActivity(named: "string(\(str)) parse with error") { activity in - do { - XCTAssertThrowsError(try String(str).parseTimeSpanToMillis()) { error in - XCTAssertEqual((error as NSError).domain, "Invalid timeSpan format") - } - } catch { + try XCTContext.runActivity(named: "string(\(str)) parse with error") { activity in + XCTAssertThrowsError(try String(str).parseTimeSpanToMillis()) { error in + XCTAssertEqual((error as NSError).domain, "Invalid timeSpan format") } } } diff --git a/MindboxTests/InApp/Tests/InAppConfigResponseTests/InAppTargetingRequestsTests.swift b/MindboxTests/InApp/Tests/InAppConfigResponseTests/InAppTargetingRequestsTests.swift index 6767db10..c39e4606 100644 --- a/MindboxTests/InApp/Tests/InAppConfigResponseTests/InAppTargetingRequestsTests.swift +++ b/MindboxTests/InApp/Tests/InAppConfigResponseTests/InAppTargetingRequestsTests.swift @@ -56,7 +56,6 @@ class InAppTargetingRequestsTests: XCTestCase { func test_TwoInappsTrue_FirstShownBefore() { let expectation = XCTestExpectation(description: "Waiting for sendRemainingInappsTargeting to complete") - persistenceStorage.shownInAppsIds = ["1"] do { let config = try getConfig(name: "3-4-5-TargetingRequests") mapper.mapConfigResponse(nil, config) { _ in @@ -115,7 +114,6 @@ class InAppTargetingRequestsTests: XCTestCase { let expectationForsendRemainingInappsTargeting = XCTestExpectation(description: "Waiting for first sendRemainingInappsTargeting to complete") let expectationForMapConfigResponse = XCTestExpectation(description: "Waiting for mapConfigResponse to complete") - persistenceStorage.shownInAppsIds = ["1"] do { let config = try getConfig(name: "9-TargetingRequests") targetingChecker.geoModels = .init(city: 1, region: 2, country: 3) @@ -184,8 +182,6 @@ class InAppTargetingRequestsTests: XCTestCase { let expectationTrue = XCTestExpectation(description: "True") let expectationTest = XCTestExpectation(description: "Operation test") let expectationTestAgain = XCTestExpectation(description: "Operation test again") - - persistenceStorage.shownInAppsIds = ["1"] do { let config = try getConfig(name: "16-17-TargetingRequests") diff --git a/MindboxTests/MigrationsTests/MigrationManagerTests.swift b/MindboxTests/MigrationsTests/MigrationManagerTests.swift index 4dc3c4dd..5a385e99 100644 --- a/MindboxTests/MigrationsTests/MigrationManagerTests.swift +++ b/MindboxTests/MigrationsTests/MigrationManagerTests.swift @@ -44,6 +44,7 @@ final class MigrationManagerTests: XCTestCase { super.tearDown() } + @available(*, deprecated, message: "Suppress `deprecated` shownInAppsIds warning") func testGeneralProductionMigrations() { migrationManager = MigrationManager(persistenceStorage: persistenceStorageMock) XCTAssertTrue(persistenceStorageMock.versionCodeForMigration == 0) diff --git a/MindboxTests/MigrationsTests/ShownInAppsIdsMigrationTests.swift b/MindboxTests/MigrationsTests/ShownInAppsIdsMigrationTests.swift index d34a4dfd..52ddf72b 100644 --- a/MindboxTests/MigrationsTests/ShownInAppsIdsMigrationTests.swift +++ b/MindboxTests/MigrationsTests/ShownInAppsIdsMigrationTests.swift @@ -23,6 +23,7 @@ final class ShownInAppsIdsMigrationTests: XCTestCase { "37bed734-aa34-4c10-918b-873f67505d46" ] + @available(*, deprecated, message: "Suppress `deprecated` shownInAppsIds warning") override func setUp() { super.setUp() shownInAppsIdsMigration = MigrationShownInAppsIds() @@ -54,6 +55,7 @@ final class ShownInAppsIdsMigrationTests: XCTestCase { super.tearDown() } + @available(*, deprecated, message: "Suppress `deprecated` shownInAppsIds warning") func test_ShownInAppsIdsMigration_withIsNeededTrue_shouldPerfromSuccessfully() throws { try mbLoggerCDManager.deleteAll() @@ -81,6 +83,7 @@ final class ShownInAppsIdsMigrationTests: XCTestCase { XCTAssertEqual(lastLog?.message, expectedLogMessage) } + @available(*, deprecated, message: "Suppress `deprecated` shownInAppsIds warning") func test_ShownInAppsIdsMigration_withIsNeededFalse_shouldHaveBeenSkipped() throws { try mbLoggerCDManager.deleteAll() diff --git a/MindboxTests/MigrationsTests/TestsMigrations/TestProtocolMigrations.swift b/MindboxTests/MigrationsTests/TestsMigrations/TestProtocolMigrations.swift index 7dad412c..d3a6fba4 100644 --- a/MindboxTests/MigrationsTests/TestsMigrations/TestProtocolMigrations.swift +++ b/MindboxTests/MigrationsTests/TestsMigrations/TestProtocolMigrations.swift @@ -73,8 +73,8 @@ final class TestProtocolMigration_3: MigrationProtocol { func run() throws { // Do some code throw NSError(domain: "com.sdk.migration", code: -1, userInfo: [NSLocalizedDescriptionKey: "Invalid version for migration"]) - let versionCodeForMigration = persistenceStorage.versionCodeForMigration! - persistenceStorage.versionCodeForMigration = versionCodeForMigration + 1 + // let versionCodeForMigration = persistenceStorage.versionCodeForMigration! + // persistenceStorage.versionCodeForMigration = versionCodeForMigration + 1 } init(persistenceStorage: PersistenceStorage) { diff --git a/MindboxTests/MindboxLogger/MBLoggerCoreDataManagerTests.swift b/MindboxTests/MindboxLogger/MBLoggerCoreDataManagerTests.swift index 2acbe92d..f3f085c0 100644 --- a/MindboxTests/MindboxLogger/MBLoggerCoreDataManagerTests.swift +++ b/MindboxTests/MindboxLogger/MBLoggerCoreDataManagerTests.swift @@ -44,7 +44,7 @@ final class MBLoggerCoreDataManagerTests: XCTestCase { fetchExpectation.expectedFulfillmentCount = logsCount let message = "Test message" let timestamp = Date() - for i in 0..