diff options
author | Vitaly Takmazov | 2020-09-16 17:39:47 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2023-05-14 01:15:35 +0300 |
commit | 7165263963d046fe8bd8a8abb542cb0bb34866b9 (patch) | |
tree | 8f464b64432aa4b609e7f3b15f5eaa025cf1bd68 | |
parent | 7a36ade3636ede2781630b2d2d5e77fb82b39d69 (diff) |
NotificationService rewritten in Swift, added dummy test target
# Conflicts:
# Juick.xcodeproj/project.pbxproj
# JuickPush/NotificationService.m
-rw-r--r-- | Juick.xcodeproj/project.pbxproj | 360 | ||||
-rw-r--r-- | JuickPush/Info.plist | 2 | ||||
-rw-r--r-- | JuickPush/JuickPush-Bridging-Header.h | 4 | ||||
-rw-r--r-- | JuickPush/NotificationService.h | 13 | ||||
-rw-r--r-- | JuickPush/NotificationService.m | 46 | ||||
-rw-r--r-- | JuickPush/NotificationService.swift | 48 | ||||
-rw-r--r-- | JuickTests/JuickTests.swift | 43 |
7 files changed, 283 insertions, 233 deletions
diff --git a/Juick.xcodeproj/project.pbxproj b/Juick.xcodeproj/project.pbxproj index d53b351..ffe6e41 100644 --- a/Juick.xcodeproj/project.pbxproj +++ b/Juick.xcodeproj/project.pbxproj @@ -7,9 +7,9 @@ objects = { /* Begin PBXBuildFile section */ - 77052FFF25D43C9D0058DCE6 /* JuickTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 77052FFE25D43C9D0058DCE6 /* JuickTests.m */; }; 7705301B25D4414D0058DCE6 /* User+UIView.m in Sources */ = {isa = PBXBuildFile; fileRef = 7705301A25D4414D0058DCE6 /* User+UIView.m */; }; 770C86E325117D78009B6404 /* UIView+Shimmer.m in Sources */ = {isa = PBXBuildFile; fileRef = 770C86E125117D78009B6404 /* UIView+Shimmer.m */; }; + 770C86F0251211B6009B6404 /* NotificationService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 770C86EF251211B6009B6404 /* NotificationService.swift */; }; 772B4E6C2199811E0029706E /* Entity.m in Sources */ = {isa = PBXBuildFile; fileRef = 772B4E6B2199811E0029706E /* Entity.m */; }; 77317BAC181BBE8500D60005 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 77317BAB181BBE8500D60005 /* Foundation.framework */; }; 77317BAE181BBE8500D60005 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 77317BAD181BBE8500D60005 /* CoreGraphics.framework */; }; @@ -38,7 +38,6 @@ 774746B6239F872A0001C7F9 /* CoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 774746B5239F872A0001C7F9 /* CoreServices.framework */; }; 7761133821766A3000D350CD /* ContentLoadingCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 7761133621766A3000D350CD /* ContentLoadingCell.m */; }; 7761133921766A3000D350CD /* ContentLoadingCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 7761133721766A3000D350CD /* ContentLoadingCell.xib */; }; - 7761135921790B0300D350CD /* NotificationService.m in Sources */ = {isa = PBXBuildFile; fileRef = 7761135821790B0300D350CD /* NotificationService.m */; }; 7761135D21790B0300D350CD /* JuickPush.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = 7761135521790B0200D350CD /* JuickPush.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; 776C41BD1FD3EF180063B82E /* MessageCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 776C41BB1FD3EF180063B82E /* MessageCell.m */; }; 776C41BE1FD3EF180063B82E /* MessageCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 776C41BC1FD3EF180063B82E /* MessageCell.xib */; }; @@ -63,23 +62,24 @@ 77E35A82189A5B5A00B2D216 /* LoginViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 77E35A81189A5B5A00B2D216 /* LoginViewController.m */; }; 77E61A5B1FD467FC00B4E304 /* QuoteView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 77E61A5A1FD467FC00B4E304 /* QuoteView.xib */; }; 77E61A5E1FD4682B00B4E304 /* QuoteView.m in Sources */ = {isa = PBXBuildFile; fileRef = 77E61A5D1FD4682B00B4E304 /* QuoteView.m */; }; + 77F2B6A2251249F300E42F6F /* JuickTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 77F2B6A1251249F300E42F6F /* JuickTests.swift */; }; 77FCADDF1D6A50DA00CBA649 /* API.m in Sources */ = {isa = PBXBuildFile; fileRef = 77FCADDE1D6A50DA00CBA649 /* API.m */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ - 7705300125D43C9D0058DCE6 /* PBXContainerItemProxy */ = { + 7761135B21790B0300D350CD /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 77317BA0181BBE8500D60005 /* Project object */; proxyType = 1; - remoteGlobalIDString = 77317BA7181BBE8500D60005; - remoteInfo = Juick; + remoteGlobalIDString = 7761135421790B0200D350CD; + remoteInfo = JuickPush; }; - 7761135B21790B0300D350CD /* PBXContainerItemProxy */ = { + 77F2B6A4251249F300E42F6F /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 77317BA0181BBE8500D60005 /* Project object */; proxyType = 1; - remoteGlobalIDString = 7761135421790B0200D350CD; - remoteInfo = JuickPush; + remoteGlobalIDString = 77317BA7181BBE8500D60005; + remoteInfo = Juick; }; /* End PBXContainerItemProxy section */ @@ -98,14 +98,13 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ - 77052FFC25D43C9D0058DCE6 /* JuickTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = JuickTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - 77052FFE25D43C9D0058DCE6 /* JuickTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = JuickTests.m; sourceTree = "<group>"; }; - 7705300025D43C9D0058DCE6 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; 7705301925D4414D0058DCE6 /* User+UIView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "User+UIView.h"; sourceTree = "<group>"; }; 7705301A25D4414D0058DCE6 /* User+UIView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "User+UIView.m"; sourceTree = "<group>"; }; 770A428F1E8881CB000B206A /* DeviceRegistration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DeviceRegistration.h; sourceTree = "<group>"; }; 770C86E125117D78009B6404 /* UIView+Shimmer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "UIView+Shimmer.m"; path = "Vendor/UIView-Shimmer/Classes/UIView+Shimmer.m"; sourceTree = "<group>"; }; 770C86E225117D78009B6404 /* UIView+Shimmer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "UIView+Shimmer.h"; path = "Vendor/UIView-Shimmer/Classes/UIView+Shimmer.h"; sourceTree = "<group>"; }; + 770C86EE251211B6009B6404 /* JuickPush-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "JuickPush-Bridging-Header.h"; sourceTree = "<group>"; }; + 770C86EF251211B6009B6404 /* NotificationService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationService.swift; sourceTree = "<group>"; }; 772B4E6A2199811E0029706E /* Entity.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Entity.h; sourceTree = "<group>"; }; 772B4E6B2199811E0029706E /* Entity.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Entity.m; sourceTree = "<group>"; }; 77317BA8181BBE8500D60005 /* Juick.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Juick.app; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -153,8 +152,6 @@ 7761133621766A3000D350CD /* ContentLoadingCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ContentLoadingCell.m; sourceTree = "<group>"; }; 7761133721766A3000D350CD /* ContentLoadingCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = ContentLoadingCell.xib; sourceTree = "<group>"; }; 7761135521790B0200D350CD /* JuickPush.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = JuickPush.appex; sourceTree = BUILT_PRODUCTS_DIR; }; - 7761135721790B0300D350CD /* NotificationService.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NotificationService.h; sourceTree = "<group>"; }; - 7761135821790B0300D350CD /* NotificationService.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NotificationService.m; sourceTree = "<group>"; }; 7761135A21790B0300D350CD /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; 7761136821790C2D00D350CD /* UserNotificationsUI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UserNotificationsUI.framework; path = System/Library/Frameworks/UserNotificationsUI.framework; sourceTree = SDKROOT; }; 776C41BA1FD3EF180063B82E /* MessageCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MessageCell.h; sourceTree = "<group>"; }; @@ -198,18 +195,14 @@ 77E61A5A1FD467FC00B4E304 /* QuoteView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = QuoteView.xib; sourceTree = "<group>"; }; 77E61A5C1FD4682B00B4E304 /* QuoteView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = QuoteView.h; sourceTree = "<group>"; }; 77E61A5D1FD4682B00B4E304 /* QuoteView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = QuoteView.m; sourceTree = "<group>"; }; + 77F2B69F251249F300E42F6F /* JuickTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = JuickTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 77F2B6A1251249F300E42F6F /* JuickTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JuickTests.swift; sourceTree = "<group>"; }; + 77F2B6A3251249F300E42F6F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; 77FCADDE1D6A50DA00CBA649 /* API.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = API.m; sourceTree = "<group>"; }; 77FCADE01D6A50EC00CBA649 /* API.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = API.h; sourceTree = "<group>"; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ - 77052FF925D43C9D0058DCE6 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; 77317BA5181BBE8500D60005 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; @@ -232,24 +225,22 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 77F2B69C251249F300E42F6F /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - 77052FFD25D43C9D0058DCE6 /* JuickTests */ = { - isa = PBXGroup; - children = ( - 77052FFE25D43C9D0058DCE6 /* JuickTests.m */, - 7705300025D43C9D0058DCE6 /* Info.plist */, - ); - path = JuickTests; - sourceTree = "<group>"; - }; 77317B9F181BBE8500D60005 = { isa = PBXGroup; children = ( 774746B1239F85920001C7F9 /* Vendor */, 7761135621790B0300D350CD /* JuickPush */, - 77052FFD25D43C9D0058DCE6 /* JuickTests */, + 77F2B6A0251249F300E42F6F /* JuickTests */, 77317BAA181BBE8500D60005 /* Frameworks */, 77317BB1181BBE8500D60005 /* Juick */, 77317BA9181BBE8500D60005 /* Products */, @@ -261,7 +252,7 @@ children = ( 77317BA8181BBE8500D60005 /* Juick.app */, 7761135521790B0200D350CD /* JuickPush.appex */, - 77052FFC25D43C9D0058DCE6 /* JuickTests.xctest */, + 77F2B69F251249F300E42F6F /* JuickTests.xctest */, ); name = Products; sourceTree = "<group>"; @@ -399,13 +390,22 @@ isa = PBXGroup; children = ( 774746B4239F86EA0001C7F9 /* JuickPush.entitlements */, - 7761135721790B0300D350CD /* NotificationService.h */, - 7761135821790B0300D350CD /* NotificationService.m */, 7761135A21790B0300D350CD /* Info.plist */, + 770C86EF251211B6009B6404 /* NotificationService.swift */, + 770C86EE251211B6009B6404 /* JuickPush-Bridging-Header.h */, ); path = JuickPush; sourceTree = "<group>"; }; + 77F2B6A0251249F300E42F6F /* JuickTests */ = { + isa = PBXGroup; + children = ( + 77F2B6A1251249F300E42F6F /* JuickTests.swift */, + 77F2B6A3251249F300E42F6F /* Info.plist */, + ); + path = JuickTests; + sourceTree = "<group>"; + }; 77FFC0151D5FD13C003BD81A /* Views */ = { isa = PBXGroup; children = ( @@ -434,24 +434,6 @@ /* End PBXGroup section */ /* Begin PBXNativeTarget section */ - 77052FFB25D43C9D0058DCE6 /* JuickTests */ = { - isa = PBXNativeTarget; - buildConfigurationList = 7705300625D43C9D0058DCE6 /* Build configuration list for PBXNativeTarget "JuickTests" */; - buildPhases = ( - 77052FF825D43C9D0058DCE6 /* Sources */, - 77052FF925D43C9D0058DCE6 /* Frameworks */, - 77052FFA25D43C9D0058DCE6 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - 7705300225D43C9D0058DCE6 /* PBXTargetDependency */, - ); - name = JuickTests; - productName = JuickTests; - productReference = 77052FFC25D43C9D0058DCE6 /* JuickTests.xctest */; - productType = "com.apple.product-type.bundle.unit-test"; - }; 77317BA7181BBE8500D60005 /* Juick */ = { isa = PBXNativeTarget; buildConfigurationList = 77317BDD181BBE8500D60005 /* Build configuration list for PBXNativeTarget "Juick" */; @@ -488,21 +470,34 @@ productReference = 7761135521790B0200D350CD /* JuickPush.appex */; productType = "com.apple.product-type.app-extension"; }; + 77F2B69E251249F300E42F6F /* JuickTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 77F2B6A9251249F300E42F6F /* Build configuration list for PBXNativeTarget "JuickTests" */; + buildPhases = ( + 77F2B69B251249F300E42F6F /* Sources */, + 77F2B69C251249F300E42F6F /* Frameworks */, + 77F2B69D251249F300E42F6F /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 77F2B6A5251249F300E42F6F /* PBXTargetDependency */, + ); + name = JuickTests; + productName = JuickTests; + productReference = 77F2B69F251249F300E42F6F /* JuickTests.xctest */; + productType = "com.apple.product-type.bundle.ui-testing"; + }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ 77317BA0181BBE8500D60005 /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 1400; + LastSwiftUpdateCheck = 1200; + LastUpgradeCheck = 1200; ORGANIZATIONNAME = com.juick; TargetAttributes = { - 77052FFB25D43C9D0058DCE6 = { - CreatedOnToolsVersion = 12.4; - DevelopmentTeam = KH4MX79ZK7; - ProvisioningStyle = Automatic; - TestTargetID = 77317BA7181BBE8500D60005; - }; 77317BA7181BBE8500D60005 = { DevelopmentTeam = KH4MX79ZK7; SystemCapabilities = { @@ -520,8 +515,15 @@ 7761135421790B0200D350CD = { CreatedOnToolsVersion = 10.0; DevelopmentTeam = KH4MX79ZK7; + LastSwiftMigration = 1200; ProvisioningStyle = Automatic; }; + 77F2B69E251249F300E42F6F = { + CreatedOnToolsVersion = 12.0; + DevelopmentTeam = KH4MX79ZK7; + ProvisioningStyle = Automatic; + TestTargetID = 77317BA7181BBE8500D60005; + }; }; }; buildConfigurationList = 77317BA3181BBE8500D60005 /* Build configuration list for PBXProject "Juick" */; @@ -539,19 +541,12 @@ targets = ( 77317BA7181BBE8500D60005 /* Juick */, 7761135421790B0200D350CD /* JuickPush */, - 77052FFB25D43C9D0058DCE6 /* JuickTests */, + 77F2B69E251249F300E42F6F /* JuickTests */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ - 77052FFA25D43C9D0058DCE6 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; 77317BA6181BBE8500D60005 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; @@ -581,17 +576,16 @@ ); runOnlyForDeploymentPostprocessing = 0; }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 77052FF825D43C9D0058DCE6 /* Sources */ = { - isa = PBXSourcesBuildPhase; + 77F2B69D251249F300E42F6F /* Resources */ = { + isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - 77052FFF25D43C9D0058DCE6 /* JuickTests.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ 77317BA4181BBE8500D60005 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -634,23 +628,31 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 7761135921790B0300D350CD /* NotificationService.m in Sources */, + 770C86F0251211B6009B6404 /* NotificationService.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 77F2B69B251249F300E42F6F /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 77F2B6A2251249F300E42F6F /* JuickTests.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ - 7705300225D43C9D0058DCE6 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 77317BA7181BBE8500D60005 /* Juick */; - targetProxy = 7705300125D43C9D0058DCE6 /* PBXContainerItemProxy */; - }; 7761135C21790B0300D350CD /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = 7761135421790B0200D350CD /* JuickPush */; targetProxy = 7761135B21790B0300D350CD /* PBXContainerItemProxy */; }; + 77F2B6A5251249F300E42F6F /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 77317BA7181BBE8500D60005 /* Juick */; + targetProxy = 77F2B6A4251249F300E42F6F /* PBXContainerItemProxy */; + }; /* End PBXTargetDependency section */ /* Begin PBXVariantGroup section */ @@ -666,87 +668,6 @@ /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ - 7705300325D43C9D0058DCE6 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - BUNDLE_LOADER = "$(TEST_HOST)"; - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; - CLANG_ENABLE_OBJC_WEAK = YES; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CODE_SIGN_STYLE = Automatic; - DEBUG_INFORMATION_FORMAT = dwarf; - DEVELOPMENT_TEAM = KH4MX79ZK7; - GCC_C_LANGUAGE_STANDARD = gnu11; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - INFOPLIST_FILE = JuickTests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 14.4; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; - MTL_FAST_MATH = YES; - PRODUCT_BUNDLE_IDENTIFIER = com.juick.JuickTests; - PRODUCT_NAME = "$(TARGET_NAME)"; - TARGETED_DEVICE_FAMILY = "1,2"; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Juick.app/Juick"; - }; - name = Debug; - }; - 7705300425D43C9D0058DCE6 /* Debug (local) */ = { - isa = XCBuildConfiguration; - buildSettings = { - BUNDLE_LOADER = "$(TEST_HOST)"; - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; - CLANG_ENABLE_OBJC_WEAK = YES; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CODE_SIGN_STYLE = Automatic; - DEBUG_INFORMATION_FORMAT = dwarf; - DEVELOPMENT_TEAM = KH4MX79ZK7; - GCC_C_LANGUAGE_STANDARD = gnu11; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - INFOPLIST_FILE = JuickTests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 14.4; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; - MTL_FAST_MATH = YES; - PRODUCT_BUNDLE_IDENTIFIER = com.juick.JuickTests; - PRODUCT_NAME = "$(TARGET_NAME)"; - TARGETED_DEVICE_FAMILY = "1,2"; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Juick.app/Juick"; - }; - name = "Debug (local)"; - }; - 7705300525D43C9D0058DCE6 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - BUNDLE_LOADER = "$(TEST_HOST)"; - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; - CLANG_ENABLE_OBJC_WEAK = YES; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CODE_SIGN_STYLE = Automatic; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DEVELOPMENT_TEAM = KH4MX79ZK7; - GCC_C_LANGUAGE_STANDARD = gnu11; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - INFOPLIST_FILE = JuickTests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 14.4; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MTL_ENABLE_DEBUG_INFO = NO; - MTL_FAST_MATH = YES; - PRODUCT_BUNDLE_IDENTIFIER = com.juick.JuickTests; - PRODUCT_NAME = "$(TARGET_NAME)"; - TARGETED_DEVICE_FAMILY = "1,2"; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Juick.app/Juick"; - }; - name = Release; - }; 77317BDB181BBE8500D60005 /* Debug */ = { isa = XCBuildConfiguration; baseConfigurationReference = 77D40ABB218B5CC90074E14F /* Production.xcconfig */; @@ -801,6 +722,7 @@ IPHONEOS_DEPLOYMENT_TARGET = 13.0; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -850,6 +772,7 @@ GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 13.0; SDKROOT = iphoneos; + SWIFT_VERSION = 5.0; VALIDATE_PRODUCT = YES; }; name = Release; @@ -884,7 +807,6 @@ CODE_SIGN_ENTITLEMENTS = Juick/Juick.entitlements; CODE_SIGN_IDENTITY = "iPhone Developer"; CURRENT_PROJECT_VERSION = 173; - DEVELOPMENT_TEAM = KH4MX79ZK7; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "Juick/Supporting Files/Juick-Prefix.pch"; INFOPLIST_FILE = "Juick/Supporting Files/Juick-Info.plist"; @@ -905,6 +827,7 @@ CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_WEAK = YES; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; @@ -926,7 +849,9 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; SUPPORTS_MACCATALYST = YES; - TARGETED_DEVICE_FAMILY = "1,2,6"; + SWIFT_OBJC_BRIDGING_HEADER = "JuickPush/JuickPush-Bridging-Header.h"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; }; @@ -936,6 +861,7 @@ CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_WEAK = YES; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; @@ -955,7 +881,8 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; SUPPORTS_MACCATALYST = YES; - TARGETED_DEVICE_FAMILY = "1,2,6"; + SWIFT_OBJC_BRIDGING_HEADER = "JuickPush/JuickPush-Bridging-Header.h"; + TARGETED_DEVICE_FAMILY = "1,2"; }; name = Release; }; @@ -1013,6 +940,7 @@ IPHONEOS_DEPLOYMENT_TARGET = 13.0; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; + SWIFT_VERSION = 5.0; }; name = "Debug (local)"; }; @@ -1045,6 +973,7 @@ CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_WEAK = YES; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; @@ -1066,23 +995,98 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; SUPPORTS_MACCATALYST = YES; - TARGETED_DEVICE_FAMILY = "1,2,6"; + SWIFT_OBJC_BRIDGING_HEADER = "JuickPush/JuickPush-Bridging-Header.h"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = "Debug (local)"; + }; + 77F2B6A6251249F300E42F6F /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_STYLE = Automatic; + DEBUG_INFORMATION_FORMAT = dwarf; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + INFOPLIST_FILE = JuickTests/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 14.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = com.juick.JuickTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_TARGET_NAME = Juick; + }; + name = Debug; + }; + 77F2B6A7251249F300E42F6F /* Debug (local) */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_STYLE = Automatic; + DEBUG_INFORMATION_FORMAT = dwarf; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + INFOPLIST_FILE = JuickTests/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 14.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = com.juick.JuickTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_TARGET_NAME = Juick; }; name = "Debug (local)"; }; + 77F2B6A8251249F300E42F6F /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_STYLE = Automatic; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + INFOPLIST_FILE = JuickTests/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 14.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = com.juick.JuickTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_TARGET_NAME = Juick; + }; + name = Release; + }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ - 7705300625D43C9D0058DCE6 /* Build configuration list for PBXNativeTarget "JuickTests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 7705300325D43C9D0058DCE6 /* Debug */, - 7705300425D43C9D0058DCE6 /* Debug (local) */, - 7705300525D43C9D0058DCE6 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; 77317BA3181BBE8500D60005 /* Build configuration list for PBXProject "Juick" */ = { isa = XCConfigurationList; buildConfigurations = ( @@ -1113,6 +1117,16 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + 77F2B6A9251249F300E42F6F /* Build configuration list for PBXNativeTarget "JuickTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 77F2B6A6251249F300E42F6F /* Debug */, + 77F2B6A7251249F300E42F6F /* Debug (local) */, + 77F2B6A8251249F300E42F6F /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; /* End XCConfigurationList section */ }; rootObject = 77317BA0181BBE8500D60005 /* Project object */; diff --git a/JuickPush/Info.plist b/JuickPush/Info.plist index 9aeee3f..721973c 100644 --- a/JuickPush/Info.plist +++ b/JuickPush/Info.plist @@ -25,7 +25,7 @@ <key>NSExtensionPointIdentifier</key> <string>com.apple.usernotifications.service</string> <key>NSExtensionPrincipalClass</key> - <string>NotificationService</string> + <string>$(PRODUCT_MODULE_NAME).NotificationService</string> </dict> </dict> </plist> diff --git a/JuickPush/JuickPush-Bridging-Header.h b/JuickPush/JuickPush-Bridging-Header.h new file mode 100644 index 0000000..1b2cb5d --- /dev/null +++ b/JuickPush/JuickPush-Bridging-Header.h @@ -0,0 +1,4 @@ +// +// Use this file to import your target's public headers that you would like to expose to Swift. +// + diff --git a/JuickPush/NotificationService.h b/JuickPush/NotificationService.h deleted file mode 100644 index 91ca27a..0000000 --- a/JuickPush/NotificationService.h +++ /dev/null @@ -1,13 +0,0 @@ -// -// NotificationService.h -// JuickPush -// -// Created by Vitaly Takmazov on 18/10/2018. -// Copyright © 2018 com.juick. All rights reserved. -// - -#import <UserNotifications/UserNotifications.h> - -@interface NotificationService : UNNotificationServiceExtension - -@end diff --git a/JuickPush/NotificationService.m b/JuickPush/NotificationService.m deleted file mode 100644 index afeec55..0000000 --- a/JuickPush/NotificationService.m +++ /dev/null @@ -1,46 +0,0 @@ -// -// NotificationService.m -// JuickPush -// -// Created by Vitaly Takmazov on 18/10/2018. -// Copyright © 2018 com.juick. All rights reserved. -// - -#import "NotificationService.h" - -@interface NotificationService () - -@property (nonatomic, strong) void (^contentHandler)(UNNotificationContent *contentToDeliver); -@property (nonatomic, strong) UNMutableNotificationContent *bestAttemptContent; - -@end - -@implementation NotificationService - -- (void)didReceiveNotificationRequest:(UNNotificationRequest *)request withContentHandler:(void (^)(UNNotificationContent * _Nonnull))contentHandler { - self.contentHandler = contentHandler; - self.bestAttemptContent = [request.content mutableCopy]; - - NSURL *avatarURL = [NSURL URLWithString:request.content.userInfo[@"avatarUrl"]]; - - NSURLSession* downloadSession = [NSURLSession sharedSession]; - - [[downloadSession downloadTaskWithURL:avatarURL completionHandler:^(NSURL * _Nullable location, NSURLResponse * _Nullable response, NSError * _Nullable error) { - if (!error) { - NSError *err = nil; - NSString *temporaryDirectory = [NSTemporaryDirectory() stringByAppendingPathComponent:[response suggestedFilename]]; - [[NSFileManager defaultManager] moveItemAtPath:location.path toPath:temporaryDirectory error:&err]; - UNNotificationAttachment *avatarAttachment = [UNNotificationAttachment attachmentWithIdentifier:avatarURL.lastPathComponent URL:[NSURL fileURLWithPath:temporaryDirectory] options:nil error:&err]; - self.bestAttemptContent.attachments = @[avatarAttachment]; - self.contentHandler(self.bestAttemptContent); - } - }] resume]; -} - -- (void)serviceExtensionTimeWillExpire { - // Called just before the extension will be terminated by the system. - // Use this as an opportunity to deliver your "best attempt" at modified content, otherwise the original push payload will be used. - self.contentHandler(self.bestAttemptContent); -} - -@end diff --git a/JuickPush/NotificationService.swift b/JuickPush/NotificationService.swift new file mode 100644 index 0000000..380d2b0 --- /dev/null +++ b/JuickPush/NotificationService.swift @@ -0,0 +1,48 @@ +// +// NotificationService.swift +// JuickPush +// +// Created by Vitaly Takmazov on 16.09.2020. +// Copyright © 2020 com.juick. All rights reserved. +// + +import Foundation +import UserNotifications + +class NotificationService : UNNotificationServiceExtension { + var contentHandler: ((UNNotificationContent) -> Void)? + var bestAttemptContent: UNMutableNotificationContent? + override func didReceive(_ request: UNNotificationRequest, withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) { + self.contentHandler = contentHandler; + self.bestAttemptContent = request.content.mutableCopy() as? UNMutableNotificationContent + if let bestAttemptContent = self.bestAttemptContent { + if let avatarURL = URL(string: (request.content.userInfo["avatarUrl"] as? String)!) { + let task = URLSession.shared.downloadTask(with: avatarURL) { + (location, response, error) in + if error == nil { + if let suggestedName = response?.suggestedFilename { + let temporaryDirectory = URL(fileURLWithPath: NSTemporaryDirectory()).appendingPathComponent(suggestedName) + if let currentPath = location?.path { + do { + try FileManager.default.moveItem(atPath: currentPath, toPath: temporaryDirectory.path) + if let avatarAttachment = try? UNNotificationAttachment(identifier: avatarURL.lastPathComponent, url: temporaryDirectory, options: nil) { + bestAttemptContent.attachments = [avatarAttachment] + self.contentHandler?(bestAttemptContent) + } + } catch { + self.contentHandler?(bestAttemptContent) + } + } + } + } + } + task.resume() + } + } + } + override func serviceExtensionTimeWillExpire() { + if let bestAttemptContent = bestAttemptContent, let contentHandler = contentHandler { + contentHandler(bestAttemptContent) + } + } +} diff --git a/JuickTests/JuickTests.swift b/JuickTests/JuickTests.swift new file mode 100644 index 0000000..db40885 --- /dev/null +++ b/JuickTests/JuickTests.swift @@ -0,0 +1,43 @@ +// +// JuickTests.swift +// JuickTests +// +// Created by Vitaly Takmazov on 16.09.2020. +// Copyright © 2020 com.juick. All rights reserved. +// + +import XCTest + +class JuickTests: XCTestCase { + + override func setUpWithError() throws { + // Put setup code here. This method is called before the invocation of each test method in the class. + + // In UI tests it is usually best to stop immediately when a failure occurs. + continueAfterFailure = false + + // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. + } + + override func tearDownWithError() throws { + // Put teardown code here. This method is called after the invocation of each test method in the class. + } + + func testExample() throws { + // UI tests must launch the application that they test. + let app = XCUIApplication() + app.launch() + + // Use recording to get started writing UI tests. + // Use XCTAssert and related functions to verify your tests produce the correct results. + } + + func testLaunchPerformance() throws { + if #available(macOS 10.15, iOS 13.0, tvOS 13.0, *) { + // This measures how long it takes to launch your application. + measure(metrics: [XCTApplicationLaunchMetric()]) { + XCUIApplication().launch() + } + } + } +} |