summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2020-09-16 17:39:47 +0300
committerGravatar Vitaly Takmazov2020-12-10 18:59:55 +0300
commit77cd2d89c49285f02efabb42c46a4f81e61d5e6f (patch)
tree8f11e91d4c60ec3d493d6b64e8f35bf8985e9091
parentaa6e2444af3bb07180550b646ad8f0d3ca78ddfb (diff)
NotificationService rewritten in Swift, added dummy test target
-rw-r--r--Juick.xcodeproj/project.pbxproj207
-rw-r--r--JuickPush/Info.plist2
-rw-r--r--JuickPush/JuickPush-Bridging-Header.h4
-rw-r--r--JuickPush/NotificationService.h13
-rw-r--r--JuickPush/NotificationService.m46
-rw-r--r--JuickPush/NotificationService.swift48
-rw-r--r--JuickTests/Info.plist22
-rw-r--r--JuickTests/JuickTests.swift43
8 files changed, 313 insertions, 72 deletions
diff --git a/Juick.xcodeproj/project.pbxproj b/Juick.xcodeproj/project.pbxproj
index 657e2e6..1599a41 100644
--- a/Juick.xcodeproj/project.pbxproj
+++ b/Juick.xcodeproj/project.pbxproj
@@ -8,6 +8,7 @@
/* Begin PBXBuildFile section */
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 */; };
@@ -36,7 +37,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 App 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 */; };
@@ -62,6 +62,7 @@
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 */
@@ -73,6 +74,13 @@
remoteGlobalIDString = 7761135421790B0200D350CD;
remoteInfo = JuickPush;
};
+ 77F2B6A4251249F300E42F6F /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 77317BA0181BBE8500D60005 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 77317BA7181BBE8500D60005;
+ remoteInfo = Juick;
+ };
/* End PBXContainerItemProxy section */
/* Begin PBXCopyFilesBuildPhase section */
@@ -93,6 +101,8 @@
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; };
@@ -140,8 +150,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>"; };
@@ -187,6 +195,9 @@
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 */
@@ -214,6 +225,13 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
+ 77F2B69C251249F300E42F6F /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
@@ -222,6 +240,7 @@
children = (
774746B1239F85920001C7F9 /* Vendor */,
7761135621790B0300D350CD /* JuickPush */,
+ 77F2B6A0251249F300E42F6F /* JuickTests */,
77317BAA181BBE8500D60005 /* Frameworks */,
77317BB1181BBE8500D60005 /* Juick */,
77317BA9181BBE8500D60005 /* Products */,
@@ -233,6 +252,7 @@
children = (
77317BA8181BBE8500D60005 /* Juick.app */,
7761135521790B0200D350CD /* JuickPush.appex */,
+ 77F2B69F251249F300E42F6F /* JuickTests.xctest */,
);
name = Products;
sourceTree = "<group>";
@@ -370,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 = (
@@ -441,12 +470,31 @@
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 = {
+ LastSwiftUpdateCheck = 1200;
LastUpgradeCheck = 1200;
ORGANIZATIONNAME = com.juick;
TargetAttributes = {
@@ -467,7 +515,14 @@
7761135421790B0200D350CD = {
CreatedOnToolsVersion = 10.0;
DevelopmentTeam = KH4MX79ZK7;
+ LastSwiftMigration = 1200;
+ ProvisioningStyle = Automatic;
+ };
+ 77F2B69E251249F300E42F6F = {
+ CreatedOnToolsVersion = 12.0;
+ DevelopmentTeam = KH4MX79ZK7;
ProvisioningStyle = Automatic;
+ TestTargetID = 77317BA7181BBE8500D60005;
};
};
};
@@ -486,6 +541,7 @@
targets = (
77317BA7181BBE8500D60005 /* Juick */,
7761135421790B0200D350CD /* JuickPush */,
+ 77F2B69E251249F300E42F6F /* JuickTests */,
);
};
/* End PBXProject section */
@@ -520,6 +576,13 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
+ 77F2B69D251249F300E42F6F /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
@@ -565,7 +628,15 @@
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;
};
@@ -577,6 +648,11 @@
target = 7761135421790B0200D350CD /* JuickPush */;
targetProxy = 7761135B21790B0300D350CD /* PBXContainerItemProxy */;
};
+ 77F2B6A5251249F300E42F6F /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = 77317BA7181BBE8500D60005 /* Juick */;
+ targetProxy = 77F2B6A4251249F300E42F6F /* PBXContainerItemProxy */;
+ };
/* End PBXTargetDependency section */
/* Begin PBXVariantGroup section */
@@ -702,11 +778,12 @@
77317BDE181BBE8500D60005 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
+ ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = Juick/Juick.entitlements;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
- CURRENT_PROJECT_VERSION = 146;
+ CURRENT_PROJECT_VERSION = 147;
DERIVE_MACCATALYST_PRODUCT_BUNDLE_IDENTIFIER = YES;
DEVELOPMENT_TEAM = KH4MX79ZK7;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
@@ -724,10 +801,11 @@
77317BDF181BBE8500D60005 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
+ ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = Juick/Juick.entitlements;
CODE_SIGN_IDENTITY = "iPhone Developer";
- CURRENT_PROJECT_VERSION = 146;
+ CURRENT_PROJECT_VERSION = 147;
DERIVE_MACCATALYST_PRODUCT_BUNDLE_IDENTIFIER = YES;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "Juick/Supporting Files/Juick-Prefix.pch";
@@ -747,6 +825,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;
@@ -754,7 +833,7 @@
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
- CURRENT_PROJECT_VERSION = 146;
+ CURRENT_PROJECT_VERSION = 147;
DEBUG_INFORMATION_FORMAT = dwarf;
DERIVE_MACCATALYST_PRODUCT_BUNDLE_IDENTIFIER = YES;
DEVELOPMENT_TEAM = KH4MX79ZK7;
@@ -768,6 +847,9 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SUPPORTS_MACCATALYST = YES;
+ SWIFT_OBJC_BRIDGING_HEADER = "JuickPush/JuickPush-Bridging-Header.h";
+ SWIFT_OPTIMIZATION_LEVEL = "-Onone";
+ SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
@@ -778,13 +860,14 @@
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;
CODE_SIGN_ENTITLEMENTS = JuickPush/JuickPush.entitlements;
CODE_SIGN_IDENTITY = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
- CURRENT_PROJECT_VERSION = 146;
+ CURRENT_PROJECT_VERSION = 147;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DERIVE_MACCATALYST_PRODUCT_BUNDLE_IDENTIFIER = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
@@ -797,6 +880,8 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SUPPORTS_MACCATALYST = YES;
+ SWIFT_OBJC_BRIDGING_HEADER = "JuickPush/JuickPush-Bridging-Header.h";
+ SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
@@ -861,11 +946,12 @@
77D40ABD218B70570074E14F /* Debug (local) */ = {
isa = XCBuildConfiguration;
buildSettings = {
+ ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = Juick/Juick.entitlements;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
- CURRENT_PROJECT_VERSION = 146;
+ CURRENT_PROJECT_VERSION = 147;
DERIVE_MACCATALYST_PRODUCT_BUNDLE_IDENTIFIER = YES;
DEVELOPMENT_TEAM = KH4MX79ZK7;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
@@ -886,6 +972,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;
@@ -893,7 +980,7 @@
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
- CURRENT_PROJECT_VERSION = 146;
+ CURRENT_PROJECT_VERSION = 147;
DEBUG_INFORMATION_FORMAT = dwarf;
DERIVE_MACCATALYST_PRODUCT_BUNDLE_IDENTIFIER = YES;
DEVELOPMENT_TEAM = KH4MX79ZK7;
@@ -907,10 +994,96 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SUPPORTS_MACCATALYST = YES;
+ SWIFT_OBJC_BRIDGING_HEADER = "JuickPush/JuickPush-Bridging-Header.h";
+ SWIFT_OPTIMIZATION_LEVEL = "-Onone";
+ SWIFT_VERSION = 5.0;
+ 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 */
@@ -944,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 82dead8..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 sessionWithConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration]];
-
- [[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/Info.plist b/JuickTests/Info.plist
new file mode 100644
index 0000000..64d65ca
--- /dev/null
+++ b/JuickTests/Info.plist
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>$(DEVELOPMENT_LANGUAGE)</string>
+ <key>CFBundleExecutable</key>
+ <string>$(EXECUTABLE_NAME)</string>
+ <key>CFBundleIdentifier</key>
+ <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>$(PRODUCT_NAME)</string>
+ <key>CFBundlePackageType</key>
+ <string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
+ <key>CFBundleShortVersionString</key>
+ <string>1.0</string>
+ <key>CFBundleVersion</key>
+ <string>1</string>
+</dict>
+</plist>
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()
+ }
+ }
+ }
+}