From 0d002159fb7ff43d91e01eb83ce4f10d9c2efa9f Mon Sep 17 00:00:00 2001 From: Tony Li Date: Fri, 9 Dec 2022 13:05:09 +1300 Subject: [PATCH 1/3] Re-implement a few remote post related types --- WordPressKit.xcodeproj/project.pbxproj | 52 +++++------- WordPressKit/BlogServiceRemoteREST.m | 1 - WordPressKit/BlogServiceRemoteXMLRPC.m | 1 - WordPressKit/NSObject+Debug.swift | 16 ++++ WordPressKit/PostServiceRemoteREST.m | 2 - WordPressKit/PostServiceRemoteXMLRPC.m | 21 +++-- WordPressKit/RemotePost.h | 65 --------------- WordPressKit/RemotePost.m | 50 ------------ WordPressKit/RemotePost.swift | 81 +++++++++++++++++++ WordPressKit/RemotePostCategory.h | 7 -- WordPressKit/RemotePostCategory.m | 18 ----- WordPressKit/RemotePostCategory.swift | 15 ++++ WordPressKit/RemotePostTag.h | 11 --- WordPressKit/RemotePostTag.m | 19 ----- WordPressKit/RemotePostTag.swift | 19 +++++ WordPressKit/RemotePostType.h | 9 --- WordPressKit/RemotePostType.m | 20 ----- WordPressKit/RemotePostType.swift | 17 ++++ WordPressKit/TaxonomyServiceRemoteREST.m | 2 - WordPressKit/TaxonomyServiceRemoteXMLRPC.m | 1 - WordPressKit/WordPressKit.h | 4 - .../PostServiceRemoteRESTAutosaveTests.swift | 16 ++-- .../PostServiceRemoteRESTTests.m | 1 - .../TaxonomyServiceRemoteRESTTests.m | 1 - 24 files changed, 189 insertions(+), 260 deletions(-) create mode 100644 WordPressKit/NSObject+Debug.swift delete mode 100644 WordPressKit/RemotePost.h delete mode 100644 WordPressKit/RemotePost.m create mode 100644 WordPressKit/RemotePost.swift delete mode 100644 WordPressKit/RemotePostCategory.h delete mode 100644 WordPressKit/RemotePostCategory.m create mode 100644 WordPressKit/RemotePostCategory.swift delete mode 100644 WordPressKit/RemotePostTag.h delete mode 100644 WordPressKit/RemotePostTag.m create mode 100644 WordPressKit/RemotePostTag.swift delete mode 100644 WordPressKit/RemotePostType.h delete mode 100644 WordPressKit/RemotePostType.m create mode 100644 WordPressKit/RemotePostType.swift diff --git a/WordPressKit.xcodeproj/project.pbxproj b/WordPressKit.xcodeproj/project.pbxproj index 76b36481..894bb7a5 100644 --- a/WordPressKit.xcodeproj/project.pbxproj +++ b/WordPressKit.xcodeproj/project.pbxproj @@ -129,6 +129,11 @@ 4A68E3D329406AA0004AC3DC /* RemoteMenu.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4A68E3D029406AA0004AC3DC /* RemoteMenu.swift */; }; 4A68E3D429406AA0004AC3DC /* RemoteMenuItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4A68E3D129406AA0004AC3DC /* RemoteMenuItem.swift */; }; 4A68E3D529406AA0004AC3DC /* RemoteMenuLocation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4A68E3D229406AA0004AC3DC /* RemoteMenuLocation.swift */; }; + 4A68E3E52942910B004AC3DC /* RemotePostType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4A68E3E42942910B004AC3DC /* RemotePostType.swift */; }; + 4A68E3E729429392004AC3DC /* RemotePostTag.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4A68E3E629429392004AC3DC /* RemotePostTag.swift */; }; + 4A68E3E9294296EF004AC3DC /* RemotePostCategory.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4A68E3E8294296EF004AC3DC /* RemotePostCategory.swift */; }; + 4A68E3EB294297B8004AC3DC /* RemotePost.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4A68E3EA294297B8004AC3DC /* RemotePost.swift */; }; + 4A68E3ED2942A196004AC3DC /* NSObject+Debug.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4A68E3EC2942A196004AC3DC /* NSObject+Debug.swift */; }; 57BCD3D426209D9500292CB3 /* AppTransportSecuritySettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57BCD3D326209D9500292CB3 /* AppTransportSecuritySettings.swift */; }; 730E869F21E44EFD00753E1A /* WordPressComServiceRemote+SiteVerticals.swift in Sources */ = {isa = PBXBuildFile; fileRef = 730E869E21E44EFD00753E1A /* WordPressComServiceRemote+SiteVerticals.swift */; }; 731BA83621DECD61000FDFCD /* SiteCreationRequestEncodingTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 731BA83521DECD61000FDFCD /* SiteCreationRequestEncodingTests.swift */; }; @@ -170,10 +175,6 @@ 740B23BA1F17EC7300067A2A /* PostServiceRemoteXMLRPC.h in Headers */ = {isa = PBXBuildFile; fileRef = 740B23B51F17EC7300067A2A /* PostServiceRemoteXMLRPC.h */; settings = {ATTRIBUTES = (Public, ); }; }; 740B23BB1F17EC7300067A2A /* PostServiceRemoteXMLRPC.m in Sources */ = {isa = PBXBuildFile; fileRef = 740B23B61F17EC7300067A2A /* PostServiceRemoteXMLRPC.m */; }; 740B23BD1F17ECB500067A2A /* PostServiceRemoteOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 740B23BC1F17ECB500067A2A /* PostServiceRemoteOptions.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 740B23C21F17EE8000067A2A /* RemotePostCategory.h in Headers */ = {isa = PBXBuildFile; fileRef = 740B23BE1F17EE8000067A2A /* RemotePostCategory.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 740B23C31F17EE8000067A2A /* RemotePostCategory.m in Sources */ = {isa = PBXBuildFile; fileRef = 740B23BF1F17EE8000067A2A /* RemotePostCategory.m */; }; - 740B23C41F17EE8000067A2A /* RemotePost.h in Headers */ = {isa = PBXBuildFile; fileRef = 740B23C01F17EE8000067A2A /* RemotePost.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 740B23C51F17EE8000067A2A /* RemotePost.m in Sources */ = {isa = PBXBuildFile; fileRef = 740B23C11F17EE8000067A2A /* RemotePost.m */; }; 740B23D21F17F6BB00067A2A /* PostServiceRemoteRESTTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 740B23D01F17F6BB00067A2A /* PostServiceRemoteRESTTests.m */; }; 740B23D31F17F6BB00067A2A /* PostServiceRemoteXMLRPCTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 740B23D11F17F6BB00067A2A /* PostServiceRemoteXMLRPCTests.swift */; }; 740B23D61F17F7C100067A2A /* XMLRPCTestable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 740B23D51F17F7C100067A2A /* XMLRPCTestable.swift */; }; @@ -253,8 +254,6 @@ 74B5F0DE1EF82A9600B411E7 /* BlogServiceRemoteRESTTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 74B5F0DD1EF82A9600B411E7 /* BlogServiceRemoteRESTTests.m */; }; 74B5F0E21EF82D2100B411E7 /* SiteServiceRemoteWordPressComREST.h in Headers */ = {isa = PBXBuildFile; fileRef = 74B5F0E01EF82D2100B411E7 /* SiteServiceRemoteWordPressComREST.h */; settings = {ATTRIBUTES = (Public, ); }; }; 74B5F0E31EF82D2100B411E7 /* SiteServiceRemoteWordPressComREST.m in Sources */ = {isa = PBXBuildFile; fileRef = 74B5F0E11EF82D2100B411E7 /* SiteServiceRemoteWordPressComREST.m */; }; - 74B5F0E61EF8699C00B411E7 /* RemotePostType.h in Headers */ = {isa = PBXBuildFile; fileRef = 74B5F0E41EF8699C00B411E7 /* RemotePostType.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 74B5F0E71EF8699C00B411E7 /* RemotePostType.m in Sources */ = {isa = PBXBuildFile; fileRef = 74B5F0E51EF8699C00B411E7 /* RemotePostType.m */; }; 74BA04F21F06DC0A00ED5CD8 /* CommentServiceRemote.h in Headers */ = {isa = PBXBuildFile; fileRef = 74BA04ED1F06DC0A00ED5CD8 /* CommentServiceRemote.h */; settings = {ATTRIBUTES = (Public, ); }; }; 74BA04F31F06DC0A00ED5CD8 /* CommentServiceRemoteREST.h in Headers */ = {isa = PBXBuildFile; fileRef = 74BA04EE1F06DC0A00ED5CD8 /* CommentServiceRemoteREST.h */; settings = {ATTRIBUTES = (Public, ); }; }; 74BA04F41F06DC0A00ED5CD8 /* CommentServiceRemoteREST.m in Sources */ = {isa = PBXBuildFile; fileRef = 74BA04EF1F06DC0A00ED5CD8 /* CommentServiceRemoteREST.m */; }; @@ -390,8 +389,6 @@ 9311A6891F22625A00704AC9 /* TaxonomyServiceRemoteREST.m in Sources */ = {isa = PBXBuildFile; fileRef = 9311A6821F22625A00704AC9 /* TaxonomyServiceRemoteREST.m */; }; 9311A68A1F22625A00704AC9 /* TaxonomyServiceRemoteXMLRPC.h in Headers */ = {isa = PBXBuildFile; fileRef = 9311A6831F22625A00704AC9 /* TaxonomyServiceRemoteXMLRPC.h */; settings = {ATTRIBUTES = (Public, ); }; }; 9311A68B1F22625A00704AC9 /* TaxonomyServiceRemoteXMLRPC.m in Sources */ = {isa = PBXBuildFile; fileRef = 9311A6841F22625A00704AC9 /* TaxonomyServiceRemoteXMLRPC.m */; }; - 93188D1E1F2262BF0028ED4D /* RemotePostTag.h in Headers */ = {isa = PBXBuildFile; fileRef = 93188D1C1F2262BF0028ED4D /* RemotePostTag.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 93188D1F1F2262BF0028ED4D /* RemotePostTag.m in Sources */ = {isa = PBXBuildFile; fileRef = 93188D1D1F2262BF0028ED4D /* RemotePostTag.m */; }; 93188D221F2264E60028ED4D /* TaxonomyServiceRemoteRESTTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 93188D211F2264E60028ED4D /* TaxonomyServiceRemoteRESTTests.m */; }; 931924241F1662FA0069CBCC /* JSONLoader.swift in Sources */ = {isa = PBXBuildFile; fileRef = 931924231F1662FA0069CBCC /* JSONLoader.swift */; }; 9368C7851EC5EF1B0092CE8E /* WordPressKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9368C77B1EC5EF1B0092CE8E /* WordPressKit.framework */; }; @@ -786,6 +783,11 @@ 4A68E3D029406AA0004AC3DC /* RemoteMenu.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RemoteMenu.swift; sourceTree = ""; }; 4A68E3D129406AA0004AC3DC /* RemoteMenuItem.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RemoteMenuItem.swift; sourceTree = ""; }; 4A68E3D229406AA0004AC3DC /* RemoteMenuLocation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RemoteMenuLocation.swift; sourceTree = ""; }; + 4A68E3E42942910B004AC3DC /* RemotePostType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RemotePostType.swift; sourceTree = ""; }; + 4A68E3E629429392004AC3DC /* RemotePostTag.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RemotePostTag.swift; sourceTree = ""; }; + 4A68E3E8294296EF004AC3DC /* RemotePostCategory.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RemotePostCategory.swift; sourceTree = ""; }; + 4A68E3EA294297B8004AC3DC /* RemotePost.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RemotePost.swift; sourceTree = ""; }; + 4A68E3EC2942A196004AC3DC /* NSObject+Debug.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSObject+Debug.swift"; sourceTree = ""; }; 57BCD3D326209D9500292CB3 /* AppTransportSecuritySettings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppTransportSecuritySettings.swift; sourceTree = ""; }; 6C2A33D76FD1052D6F30466D /* Pods-WordPressKit.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-WordPressKit.debug.xcconfig"; path = "Pods/Target Support Files/Pods-WordPressKit/Pods-WordPressKit.debug.xcconfig"; sourceTree = ""; }; 6F2E0CC4FA01B5475A378DA2 /* Pods-WordPressKitTests.release-alpha.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-WordPressKitTests.release-alpha.xcconfig"; path = "Pods/Target Support Files/Pods-WordPressKitTests/Pods-WordPressKitTests.release-alpha.xcconfig"; sourceTree = ""; }; @@ -829,10 +831,6 @@ 740B23B51F17EC7300067A2A /* PostServiceRemoteXMLRPC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PostServiceRemoteXMLRPC.h; sourceTree = ""; }; 740B23B61F17EC7300067A2A /* PostServiceRemoteXMLRPC.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PostServiceRemoteXMLRPC.m; sourceTree = ""; }; 740B23BC1F17ECB500067A2A /* PostServiceRemoteOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PostServiceRemoteOptions.h; sourceTree = ""; }; - 740B23BE1F17EE8000067A2A /* RemotePostCategory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RemotePostCategory.h; sourceTree = ""; }; - 740B23BF1F17EE8000067A2A /* RemotePostCategory.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RemotePostCategory.m; sourceTree = ""; }; - 740B23C01F17EE8000067A2A /* RemotePost.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RemotePost.h; sourceTree = ""; }; - 740B23C11F17EE8000067A2A /* RemotePost.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RemotePost.m; sourceTree = ""; }; 740B23D01F17F6BB00067A2A /* PostServiceRemoteRESTTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PostServiceRemoteRESTTests.m; sourceTree = ""; }; 740B23D11F17F6BB00067A2A /* PostServiceRemoteXMLRPCTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PostServiceRemoteXMLRPCTests.swift; sourceTree = ""; }; 740B23D51F17F7C100067A2A /* XMLRPCTestable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = XMLRPCTestable.swift; sourceTree = ""; }; @@ -911,8 +909,6 @@ 74B5F0DD1EF82A9600B411E7 /* BlogServiceRemoteRESTTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BlogServiceRemoteRESTTests.m; sourceTree = ""; }; 74B5F0E01EF82D2100B411E7 /* SiteServiceRemoteWordPressComREST.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SiteServiceRemoteWordPressComREST.h; sourceTree = ""; }; 74B5F0E11EF82D2100B411E7 /* SiteServiceRemoteWordPressComREST.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SiteServiceRemoteWordPressComREST.m; sourceTree = ""; }; - 74B5F0E41EF8699C00B411E7 /* RemotePostType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RemotePostType.h; sourceTree = ""; }; - 74B5F0E51EF8699C00B411E7 /* RemotePostType.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RemotePostType.m; sourceTree = ""; }; 74BA04ED1F06DC0A00ED5CD8 /* CommentServiceRemote.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CommentServiceRemote.h; sourceTree = ""; }; 74BA04EE1F06DC0A00ED5CD8 /* CommentServiceRemoteREST.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CommentServiceRemoteREST.h; sourceTree = ""; }; 74BA04EF1F06DC0A00ED5CD8 /* CommentServiceRemoteREST.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CommentServiceRemoteREST.m; sourceTree = ""; }; @@ -1049,8 +1045,6 @@ 9311A6821F22625A00704AC9 /* TaxonomyServiceRemoteREST.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TaxonomyServiceRemoteREST.m; sourceTree = ""; }; 9311A6831F22625A00704AC9 /* TaxonomyServiceRemoteXMLRPC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TaxonomyServiceRemoteXMLRPC.h; sourceTree = ""; }; 9311A6841F22625A00704AC9 /* TaxonomyServiceRemoteXMLRPC.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TaxonomyServiceRemoteXMLRPC.m; sourceTree = ""; }; - 93188D1C1F2262BF0028ED4D /* RemotePostTag.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RemotePostTag.h; sourceTree = ""; }; - 93188D1D1F2262BF0028ED4D /* RemotePostTag.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RemotePostTag.m; sourceTree = ""; }; 93188D211F2264E60028ED4D /* TaxonomyServiceRemoteRESTTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TaxonomyServiceRemoteRESTTests.m; sourceTree = ""; }; 931924231F1662FA0069CBCC /* JSONLoader.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = JSONLoader.swift; sourceTree = ""; }; 9368C77B1EC5EF1B0092CE8E /* WordPressKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = WordPressKit.framework; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -1612,6 +1606,7 @@ 8B2F4BEC24ABCAEF0056C08A /* Decodable+Dictionary.swift */, 8C5734F825681A6A005E61EE /* Enum+UnknownCaseRepresentable.swift */, 8B52B900257AC5A200221663 /* Date+endOfDay.swift */, + 4A68E3EC2942A196004AC3DC /* NSObject+Debug.swift */, ); name = Extensions; sourceTree = ""; @@ -1942,14 +1937,10 @@ 74D67F071F15BEB70010C5ED /* RemotePerson.swift */, 439A44D92107C93000795ED7 /* RemotePlan_ApiVersion1_3.swift */, E61A51A521B172A900A5F902 /* RemoteWpcomPlan.swift */, - 740B23C01F17EE8000067A2A /* RemotePost.h */, - 740B23C11F17EE8000067A2A /* RemotePost.m */, - 740B23BE1F17EE8000067A2A /* RemotePostCategory.h */, - 740B23BF1F17EE8000067A2A /* RemotePostCategory.m */, - 93188D1C1F2262BF0028ED4D /* RemotePostTag.h */, - 93188D1D1F2262BF0028ED4D /* RemotePostTag.m */, - 74B5F0E41EF8699C00B411E7 /* RemotePostType.h */, - 74B5F0E51EF8699C00B411E7 /* RemotePostType.m */, + 4A68E3EA294297B8004AC3DC /* RemotePost.swift */, + 4A68E3E8294296EF004AC3DC /* RemotePostCategory.swift */, + 4A68E3E629429392004AC3DC /* RemotePostTag.swift */, + 4A68E3E42942910B004AC3DC /* RemotePostType.swift */, 93F50A401F227C9700B5BEBA /* RemoteProfile.swift */, 74E2294F1F1E741B0085F7F2 /* RemotePublicizeConnection.swift */, 74E2294D1F1E73FE0085F7F2 /* RemotePublicizeService.swift */, @@ -2527,7 +2518,6 @@ 93BD27691EE736A8002BB00B /* RemoteUser.h in Headers */, 74B5F0DC1EF829B800B411E7 /* BlogServiceRemote.h in Headers */, 74B5F0D71EF8299B00B411E7 /* BlogServiceRemoteREST.h in Headers */, - 74B5F0E61EF8699C00B411E7 /* RemotePostType.h in Headers */, 74B5F0D91EF8299B00B411E7 /* BlogServiceRemoteXMLRPC.h in Headers */, 74B5F0E21EF82D2100B411E7 /* SiteServiceRemoteWordPressComREST.h in Headers */, 74DA56341F06EAF000FE9BF4 /* MediaServiceRemoteXMLRPC.h in Headers */, @@ -2557,12 +2547,9 @@ 9311A6851F22625A00704AC9 /* RemoteTaxonomyPaging.h in Headers */, 9311A68A1F22625A00704AC9 /* TaxonomyServiceRemoteXMLRPC.h in Headers */, 9311A6881F22625A00704AC9 /* TaxonomyServiceRemoteREST.h in Headers */, - 93188D1E1F2262BF0028ED4D /* RemotePostTag.h in Headers */, 9311A6871F22625A00704AC9 /* TaxonomyServiceRemote.h in Headers */, 9309994D1F1657C600F006A1 /* ThemeServiceRemote.h in Headers */, B5969E1C20A49AC4005E9DF1 /* NSString+MD5.h in Headers */, - 740B23C41F17EE8000067A2A /* RemotePost.h in Headers */, - 740B23C21F17EE8000067A2A /* RemotePostCategory.h in Headers */, B5A4822F20AC6C1A009D95F6 /* WPKitLogging.h in Headers */, 9309995B1F16616A00F006A1 /* RemoteTheme.h in Headers */, 1A4F98672279A87D00D86E8E /* WPKit-Swift.h in Headers */, @@ -3039,7 +3026,9 @@ 464BAB0B262F6736006AEED5 /* RemoteBlockEditorSettings.swift in Sources */, 7430C9B41F1927C50051B8E6 /* RemoteReaderSite.m in Sources */, FEFFD99126C1347D00F34231 /* ShareAppContentServiceRemote.swift in Sources */, + 4A68E3ED2942A196004AC3DC /* NSObject+Debug.swift in Sources */, 74585B8E1F0D51A100E7E667 /* DomainsServiceRemote.swift in Sources */, + 4A68E3E9294296EF004AC3DC /* RemotePostCategory.swift in Sources */, 4625B965253A343900C04AAD /* RemotePageLayouts.swift in Sources */, FEF7419B2808591C002C4203 /* BloggingPromptsServiceRemote.swift in Sources */, 7430C9A41F1927180051B8E6 /* ReaderPostServiceRemote.m in Sources */, @@ -3060,6 +3049,7 @@ 4625B96C253A357500C04AAD /* PageLayoutServiceRemote.swift in Sources */, E6B0460925E5B4DD00DF6F4F /* RemoteInviteLink.swift in Sources */, 436D56332118D7AA00CEAA33 /* TransactionsServiceRemote.swift in Sources */, + 4A68E3EB294297B8004AC3DC /* RemotePost.swift in Sources */, 93BD27721EE737A9002BB00B /* ServiceRemoteWordPressXMLRPC.m in Sources */, C76F456825B9F30E00BFEC87 /* JetpackScanHistory.swift in Sources */, E1D6B556200E46F300325669 /* WPTimeZone.swift in Sources */, @@ -3077,6 +3067,7 @@ E11C2AD21FA77FB90023BDE2 /* SitePlugin.swift in Sources */, 74A44DCC1F13C533006CD8F4 /* NotificationSyncServiceRemote.swift in Sources */, 8BB66DB02523C181000B29DA /* ReaderPostServiceRemote+V2.swift in Sources */, + 4A68E3E52942910B004AC3DC /* RemotePostType.swift in Sources */, 74E229501F1E741B0085F7F2 /* RemotePublicizeConnection.swift in Sources */, 40E7FEB722106A8D0032834E /* StatsCommentsInsight.swift in Sources */, 9856BE962630B5C200C12FEB /* RemoteUser+Likes.swift in Sources */, @@ -3160,10 +3151,7 @@ 74D67F061F1528470010C5ED /* PeopleServiceRemote.swift in Sources */, 467C20692626243D00DB5A38 /* WordPressRestApi.swift in Sources */, 98DC787522BAEBF200267279 /* StatsAllAnnualInsight.swift in Sources */, - 740B23C31F17EE8000067A2A /* RemotePostCategory.m in Sources */, 8B2F4BF124ACE3C30056C08A /* RemoteReaderInterest.swift in Sources */, - 74B5F0E71EF8699C00B411E7 /* RemotePostType.m in Sources */, - 93188D1F1F2262BF0028ED4D /* RemotePostTag.m in Sources */, 74D67F081F15BEB70010C5ED /* RemotePerson.swift in Sources */, FEE4EF59272FF78C003CDA3C /* CommentServiceRemoteREST+ApiV2.swift in Sources */, 984E34EB22EF7209005C3F92 /* StatsFileDownloadsTimeIntervalData.swift in Sources */, @@ -3213,7 +3201,6 @@ F9E56DF824EB125600916770 /* FeatureFlagRemote.swift in Sources */, 40247DFC2120E69600AE1C3C /* AutomatedTransferStatus.swift in Sources */, 730E869F21E44EFD00753E1A /* WordPressComServiceRemote+SiteVerticals.swift in Sources */, - 740B23C51F17EE8000067A2A /* RemotePost.m in Sources */, 404057C5221B30400060250C /* StatsSearchTermTimeIntervalData.swift in Sources */, 40247DFA2120D8E100AE1C3C /* AutomatedTransferService.swift in Sources */, 74E2295B1F1E77290085F7F2 /* KeyringConnection.swift in Sources */, @@ -3227,6 +3214,7 @@ 439A44D82107C85E00795ED7 /* PlanServiceRemote_ApiVersion1_3.swift in Sources */, 93C674EE1EE834B700BFAF05 /* RemoteBlogSettings.swift in Sources */, 436D5641211B7F4400CEAA33 /* DomainContactInformation.swift in Sources */, + 4A68E3E729429392004AC3DC /* RemotePostTag.swift in Sources */, FA28A3D6259079960082C7B0 /* JetpackRestoreTypes.swift in Sources */, 32FC20CE255DCC6100CD0A7B /* JetpackScanThreat.swift in Sources */, 3F3195AD266FF94B00397EE7 /* ZendeskMetadata.swift in Sources */, diff --git a/WordPressKit/BlogServiceRemoteREST.m b/WordPressKit/BlogServiceRemoteREST.m index 5fcf08e1..d88669d3 100644 --- a/WordPressKit/BlogServiceRemoteREST.m +++ b/WordPressKit/BlogServiceRemoteREST.m @@ -1,7 +1,6 @@ #import #import "BlogServiceRemoteREST.h" #import "NSMutableDictionary+Helpers.h" -#import "RemotePostType.h" #import "WPKit-Swift.h" @import NSObject_SafeExpectations; @import WordPressShared; diff --git a/WordPressKit/BlogServiceRemoteXMLRPC.m b/WordPressKit/BlogServiceRemoteXMLRPC.m index 9870919d..0226b80b 100644 --- a/WordPressKit/BlogServiceRemoteXMLRPC.m +++ b/WordPressKit/BlogServiceRemoteXMLRPC.m @@ -1,6 +1,5 @@ #import "BlogServiceRemoteXMLRPC.h" #import "NSMutableDictionary+Helpers.h" -#import "RemotePostType.h" #import "WPKit-Swift.h" @import NSObject_SafeExpectations; @import WordPressShared; diff --git a/WordPressKit/NSObject+Debug.swift b/WordPressKit/NSObject+Debug.swift new file mode 100644 index 00000000..c02b175d --- /dev/null +++ b/WordPressKit/NSObject+Debug.swift @@ -0,0 +1,16 @@ +extension NSObject { + + var allProperties: [String: Any] { + let properties = Mirror(reflecting: self) + .children + .compactMap { child in + if let label = child.label { + return (label, child.value) + } else { + return nil + } + } + return Dictionary(properties) { (_, new) in new } + } + +} diff --git a/WordPressKit/PostServiceRemoteREST.m b/WordPressKit/PostServiceRemoteREST.m index 7deaca92..258b1f69 100644 --- a/WordPressKit/PostServiceRemoteREST.m +++ b/WordPressKit/PostServiceRemoteREST.m @@ -1,6 +1,4 @@ #import "PostServiceRemoteREST.h" -#import "RemotePost.h" -#import "RemotePostCategory.h" #import "RemoteUser.h" #import "WPKit-Swift.h" @import WordPressShared; diff --git a/WordPressKit/PostServiceRemoteXMLRPC.m b/WordPressKit/PostServiceRemoteXMLRPC.m index e9339a62..199f486c 100644 --- a/WordPressKit/PostServiceRemoteXMLRPC.m +++ b/WordPressKit/PostServiceRemoteXMLRPC.m @@ -1,6 +1,4 @@ #import "PostServiceRemoteXMLRPC.h" -#import "RemotePost.h" -#import "RemotePostCategory.h" #import "NSMutableDictionary+Helpers.h" #import "WPKit-Swift.h" @import NSObject_SafeExpectations; @@ -54,7 +52,14 @@ - (void)getPostsOfType:(NSString *)postType options:(NSDictionary *)options success:(void (^)(NSArray *remotePosts))success failure:(void (^)(NSError *error))failure { - NSArray *statuses = @[PostStatusDraft, PostStatusPending, PostStatusPrivate, PostStatusPublish, PostStatusScheduled, PostStatusTrash]; + NSArray *statuses = @[ + RemotePost.statusDraft, + RemotePost.statusPending, + RemotePost.statusPrivate, + RemotePost.statusPublish, + RemotePost.statusScheduled, + RemotePost.statusTrash + ]; NSString *postStatus = [statuses componentsJoinedByString:@","]; NSDictionary *extraParameters = @{ @"number": @40, @@ -343,8 +348,8 @@ - (NSString *)statusForPostStatus:(NSString *)status andDate:(NSDate *)date { // Scheduled posts are synced with a post_status of 'publish' but we want to // work with a status of 'future' from within the app. - if ([status isEqualToString:PostStatusPublish] && date == [date laterDate:[NSDate date]]) { - return PostStatusScheduled; + if ([status isEqualToString:RemotePost.statusPublish] && date == [date laterDate:[NSDate date]]) { + return RemotePost.statusScheduled; } return status; } @@ -426,8 +431,8 @@ - (NSDictionary *)parametersWithRemotePost:(RemotePost *)post // This is an apparent inconsistency in the XML-RPC API as 'future' should // be a valid status. // https://codex.wordpress.org/Post_Status_Transitions - if (post.status == nil || [post.status isEqualToString:PostStatusScheduled]) { - post.status = PostStatusPublish; + if (post.status == nil || [post.status isEqualToString:RemotePost.statusScheduled]) { + post.status = RemotePost.statusPublish; } // At least as of 5.2.2, Private and/or Password Protected posts can't be stickied. @@ -439,7 +444,7 @@ - (NSDictionary *)parametersWithRemotePost:(RemotePost *)post // // https://github.com/WordPress/WordPress/blob/master/wp-includes/class-wp-xmlrpc-server.php // - BOOL shouldIncludeStickyField = ![post.status isEqualToString:PostStatusPrivate] && post.password == nil; + BOOL shouldIncludeStickyField = ![post.status isEqualToString:RemotePost.statusPrivate] && post.password == nil; if (post.isStickyPost != nil && shouldIncludeStickyField) { postParams[@"sticky"] = post.isStickyPost.boolValue ? @"true" : @"false"; diff --git a/WordPressKit/RemotePost.h b/WordPressKit/RemotePost.h deleted file mode 100644 index d4fa0ac2..00000000 --- a/WordPressKit/RemotePost.h +++ /dev/null @@ -1,65 +0,0 @@ -#import -@class RemotePostAutosave; - -extern NSString * const PostStatusDraft; -extern NSString * const PostStatusPending; -extern NSString * const PostStatusPrivate; -extern NSString * const PostStatusPublish; -extern NSString * const PostStatusScheduled; -extern NSString * const PostStatusTrash; -extern NSString * const PostStatusDeleted; - -@interface RemotePost : NSObject -- (id)initWithSiteID:(NSNumber *)siteID status:(NSString *)status title:(NSString *)title content:(NSString *)content; - -@property (nonatomic, strong) NSNumber *postID; -@property (nonatomic, strong) NSNumber *siteID; -@property (nonatomic, strong) NSString *authorAvatarURL; -@property (nonatomic, strong) NSString *authorDisplayName; -@property (nonatomic, strong) NSString *authorEmail; -@property (nonatomic, strong) NSString *authorURL; -@property (nonatomic, strong) NSNumber *authorID; -@property (nonatomic, strong) NSDate *date; -@property (nonatomic, strong) NSDate *dateModified; -@property (nonatomic, strong) NSString *title; -@property (nonatomic, strong) NSURL *URL; -@property (nonatomic, strong) NSURL *shortURL; -@property (nonatomic, strong) NSString *content; -@property (nonatomic, strong) NSString *excerpt; -@property (nonatomic, strong) NSString *slug; -@property (nonatomic, strong) NSString *suggestedSlug; -@property (nonatomic, strong) NSString *status; -@property (nonatomic, strong) NSString *password; -@property (nonatomic, strong) NSNumber *parentID; -@property (nonatomic, strong) NSNumber *postThumbnailID; -@property (nonatomic, strong) NSString *postThumbnailPath; -@property (nonatomic, strong) NSString *type; -@property (nonatomic, strong) NSString *format; - -/** -* A snapshot of the post at the last autosave. -* -* This is nullable. -*/ -@property (nonatomic, strong) RemotePostAutosave *autosave; - -@property (nonatomic, strong) NSNumber *commentCount; -@property (nonatomic, strong) NSNumber *likeCount; - -@property (nonatomic, strong) NSArray *categories; -@property (nonatomic, strong) NSArray *revisions; -@property (nonatomic, strong) NSArray *tags; -@property (nonatomic, strong) NSString *pathForDisplayImage; -@property (nonatomic, assign) NSNumber *isStickyPost; -@property (nonatomic, assign) BOOL isFeaturedImageChanged; - -/** - Array of custom fields. Each value is a dictionary containing {ID, key, value} - */ -@property (nonatomic, strong) NSArray *metadata; - -// Featured images? -// Geolocation? -// Attachments? -// Metadata? -@end diff --git a/WordPressKit/RemotePost.m b/WordPressKit/RemotePost.m deleted file mode 100644 index ef7960fe..00000000 --- a/WordPressKit/RemotePost.m +++ /dev/null @@ -1,50 +0,0 @@ -#import "RemotePost.h" -#import - -NSString * const PostStatusDraft = @"draft"; -NSString * const PostStatusPending = @"pending"; -NSString * const PostStatusPrivate = @"private"; -NSString * const PostStatusPublish = @"publish"; -NSString * const PostStatusScheduled = @"future"; -NSString * const PostStatusTrash = @"trash"; -NSString * const PostStatusDeleted = @"deleted"; // Returned by wpcom REST API when a post is permanently deleted. - -@implementation RemotePost - -- (id)initWithSiteID:(NSNumber *)siteID status:(NSString *)status title:(NSString *)title content:(NSString *)content -{ - self = [super init]; - if (self) { - _siteID = siteID; - _status = status; - _title = title; - _content = content; - } - return self; -} - -- (NSString *)debugDescription { - NSDictionary *properties = [self debugProperties]; - return [NSString stringWithFormat:@"<%@: %p> (%@)", NSStringFromClass([self class]), self, properties]; -} - -- (NSDictionary *)debugProperties { - unsigned int propertyCount; - objc_property_t *properties = class_copyPropertyList([RemotePost class], &propertyCount); - NSMutableDictionary *debugProperties = [NSMutableDictionary dictionaryWithCapacity:propertyCount]; - for (int i = 0; i < propertyCount; i++) - { - // Add property name to array - objc_property_t property = properties[i]; - const char *propertyName = property_getName(property); - id value = [self valueForKey:@(propertyName)]; - if (value == nil) { - value = [NSNull null]; - } - [debugProperties setObject:value forKey:@(propertyName)]; - } - free(properties); - return [NSDictionary dictionaryWithDictionary:debugProperties]; -} - -@end diff --git a/WordPressKit/RemotePost.swift b/WordPressKit/RemotePost.swift new file mode 100644 index 00000000..46a3fcde --- /dev/null +++ b/WordPressKit/RemotePost.swift @@ -0,0 +1,81 @@ +import Foundation +import ObjectiveC + +@objcMembers public class RemotePost: NSObject { + + public static let statusDraft = "draft" + public static let statusPending = "pending" + public static let statusPrivate = "private" + public static let statusPublish = "publish" + public static let statusScheduled = "future" + public static let statusTrash = "trash" + public static let statusDeleted = "deleted" // Returned by wpcom REST API when a post is permanently deleted. + + public var postID: NSNumber? + public var siteID: NSNumber? + public var authorAvatarURL: String? + public var authorDisplayName: String? + public var authorEmail: String? + public var authorURL: String? + public var authorID: NSNumber? + public var date: NSDate? + public var dateModified: NSDate? + public var title: String? + public var URL: NSURL? + public var shortURL: NSURL? + public var content: String? + public var excerpt: String? + public var slug: String? + public var suggestedSlug: String? + public var status: String? + public var password: String? + public var parentID: NSNumber? + public var postThumbnailID: NSNumber? + public var postThumbnailPath: String? + public var type: String? + public var format: String? + + /** + * A snapshot of the post at the last autosave. + * + * This is nullable. + */ + public var autosave: RemotePostAutosave? + + public var commentCount: NSNumber? + public var likeCount: NSNumber? + + public var categories: NSArray? + public var revisions: NSArray? + public var tags: NSArray? + public var pathForDisplayImage: String? + public var isStickyPost: NSNumber? + public var isFeaturedImageChanged: Bool = false + + /** + Array of custom fields. Each value is a dictionary containing {ID, key, value} + */ + public var metadata: [[String: Any]]? + + // Featured images? + // Geolocation? + // Attachments? + // Metadata? + + public override init() { + super.init() + } + + public init(siteID: NSNumber, status: String, title: String?, content: String?) { + super.init() + self.siteID = siteID + self.status = status + self.title = title + self.content = content + } + + public override var debugDescription: String { + "\(super.description) (\(allProperties))" + } + +} diff --git a/WordPressKit/RemotePostCategory.h b/WordPressKit/RemotePostCategory.h deleted file mode 100644 index 21f189e9..00000000 --- a/WordPressKit/RemotePostCategory.h +++ /dev/null @@ -1,7 +0,0 @@ -#import - -@interface RemotePostCategory : NSObject -@property (nonatomic, strong) NSNumber *categoryID; -@property (nonatomic, strong) NSString *name; -@property (nonatomic, strong) NSNumber *parentID; -@end diff --git a/WordPressKit/RemotePostCategory.m b/WordPressKit/RemotePostCategory.m deleted file mode 100644 index 235fd1d8..00000000 --- a/WordPressKit/RemotePostCategory.m +++ /dev/null @@ -1,18 +0,0 @@ -#import "RemotePostCategory.h" - -@implementation RemotePostCategory - -- (NSString *)debugDescription { - NSDictionary *properties = @{ - @"ID": self.categoryID, - @"name": self.name, - @"parent": self.parentID, - }; - return [NSString stringWithFormat:@"<%@: %p> (%@)", NSStringFromClass([self class]), self, properties]; -} - -- (NSString *)description { - return [NSString stringWithFormat:@"<%@: %p> %@[%@]", NSStringFromClass([self class]), self, self.name, self.categoryID]; -} - -@end diff --git a/WordPressKit/RemotePostCategory.swift b/WordPressKit/RemotePostCategory.swift new file mode 100644 index 00000000..55944edb --- /dev/null +++ b/WordPressKit/RemotePostCategory.swift @@ -0,0 +1,15 @@ +import Foundation + +@objcMembers public class RemotePostCategory: NSObject { + public var categoryID: NSNumber? + public var name: String? + public var parentID: NSNumber? + + public override var debugDescription: String { + "\(super.description) (\(allProperties))" + } + + public override var description: String { + return "\(super.description) \(String(describing: name))[\(String(describing: categoryID))]" + } +} diff --git a/WordPressKit/RemotePostTag.h b/WordPressKit/RemotePostTag.h deleted file mode 100644 index e6a84f59..00000000 --- a/WordPressKit/RemotePostTag.h +++ /dev/null @@ -1,11 +0,0 @@ -#import - -@interface RemotePostTag : NSObject - -@property (nonatomic, strong) NSNumber *tagID; -@property (nonatomic, strong) NSString *name; -@property (nonatomic, strong) NSString *slug; -@property (nonatomic, strong) NSString *tagDescription; -@property (nonatomic, strong) NSNumber *postCount; - -@end diff --git a/WordPressKit/RemotePostTag.m b/WordPressKit/RemotePostTag.m deleted file mode 100644 index 4f4466ac..00000000 --- a/WordPressKit/RemotePostTag.m +++ /dev/null @@ -1,19 +0,0 @@ -#import "RemotePostTag.h" - -@implementation RemotePostTag - -- (NSString *)debugDescription -{ - NSDictionary *properties = @{ - @"ID": self.tagID, - @"name": self.name - }; - return [NSString stringWithFormat:@"<%@: %p> (%@)", NSStringFromClass([self class]), self, properties]; -} - -- (NSString *)description -{ - return [NSString stringWithFormat:@"<%@: %p> %@[%@]", NSStringFromClass([self class]), self, self.name, self.tagID]; -} - -@end diff --git a/WordPressKit/RemotePostTag.swift b/WordPressKit/RemotePostTag.swift new file mode 100644 index 00000000..a97378b5 --- /dev/null +++ b/WordPressKit/RemotePostTag.swift @@ -0,0 +1,19 @@ +import Foundation + +@objcMembers public class RemotePostTag: NSObject { + + public var tagID: NSNumber? + public var name: String? + public var slug: String? + public var tagDescription: String? + public var postCount: NSNumber? + + public override var debugDescription: String { + "\(super.description) (\(allProperties))" + } + + public override var description: String { + return "\(super.description) \(String(describing: name))[\(String(describing: tagID))]" + } + +} diff --git a/WordPressKit/RemotePostType.h b/WordPressKit/RemotePostType.h deleted file mode 100644 index 895e9117..00000000 --- a/WordPressKit/RemotePostType.h +++ /dev/null @@ -1,9 +0,0 @@ -#import - -@interface RemotePostType : NSObject - -@property (nonatomic, strong) NSNumber *apiQueryable; -@property (nonatomic, strong) NSString *name; -@property (nonatomic, strong) NSString *label; - -@end diff --git a/WordPressKit/RemotePostType.m b/WordPressKit/RemotePostType.m deleted file mode 100644 index 4d1cc15c..00000000 --- a/WordPressKit/RemotePostType.m +++ /dev/null @@ -1,20 +0,0 @@ -#import "RemotePostType.h" - -@implementation RemotePostType - -- (NSString *)debugDescription -{ - NSDictionary *properties = @{ - @"name": self.name, - @"label": self.label, - @"apiQueryable": self.apiQueryable - }; - return [NSString stringWithFormat:@"<%@: %p> (%@)", NSStringFromClass([self class]), self, properties]; -} - -- (NSString *)description -{ - return [NSString stringWithFormat:@"<%@: %p> %@[%@], apiQueryable=%@", NSStringFromClass([self class]), self, self.name, self.label, self.apiQueryable]; -} - -@end diff --git a/WordPressKit/RemotePostType.swift b/WordPressKit/RemotePostType.swift new file mode 100644 index 00000000..7bfcd39f --- /dev/null +++ b/WordPressKit/RemotePostType.swift @@ -0,0 +1,17 @@ +import Foundation + +@objcMembers public class RemotePostType: NSObject { + + public var apiQueryable: NSNumber? + public var name: String? + public var label: String? + + public override var debugDescription: String { + "\(super.description) (\(allProperties))" + } + + public override var description: String { + return "\(super.description) \(String(describing: name))[\(String(describing: label))] apiQueryable=\(String(describing: apiQueryable))" + } + +} diff --git a/WordPressKit/TaxonomyServiceRemoteREST.m b/WordPressKit/TaxonomyServiceRemoteREST.m index 60975de6..de58a44c 100644 --- a/WordPressKit/TaxonomyServiceRemoteREST.m +++ b/WordPressKit/TaxonomyServiceRemoteREST.m @@ -1,7 +1,5 @@ #import "TaxonomyServiceRemoteREST.h" -#import "RemotePostTag.h" #import "RemoteTaxonomyPaging.h" -#import "RemotePostCategory.h" #import "WPKit-Swift.h" @import NSObject_SafeExpectations; @import WordPressShared; diff --git a/WordPressKit/TaxonomyServiceRemoteXMLRPC.m b/WordPressKit/TaxonomyServiceRemoteXMLRPC.m index 9bf54e74..0f826bcd 100644 --- a/WordPressKit/TaxonomyServiceRemoteXMLRPC.m +++ b/WordPressKit/TaxonomyServiceRemoteXMLRPC.m @@ -1,5 +1,4 @@ #import "TaxonomyServiceRemoteXMLRPC.h" -#import "RemotePostTag.h" #import "RemoteTaxonomyPaging.h" #import "WPKit-Swift.h" @import WordPressShared; diff --git a/WordPressKit/WordPressKit.h b/WordPressKit/WordPressKit.h index 8a106a0f..e7f89bbf 100644 --- a/WordPressKit/WordPressKit.h +++ b/WordPressKit/WordPressKit.h @@ -37,10 +37,6 @@ FOUNDATION_EXPORT const unsigned char WordPressKitVersionString[]; #import #import -#import -#import -#import -#import #import #import #import diff --git a/WordPressKitTests/PostServiceRemoteRESTAutosaveTests.swift b/WordPressKitTests/PostServiceRemoteRESTAutosaveTests.swift index 8b85dfbd..25e63030 100644 --- a/WordPressKitTests/PostServiceRemoteRESTAutosaveTests.swift +++ b/WordPressKitTests/PostServiceRemoteRESTAutosaveTests.swift @@ -34,14 +34,14 @@ class PostServiceRemoteRESTAutosaveTests: RemoteTestCase, RESTTestable { return } - XCTAssertEqual(remotePost.autosave.identifier?.intValue, 100) - XCTAssertEqual(remotePost.autosave.authorID, "12345678") - XCTAssertEqual(remotePost.autosave.postID, 102) - XCTAssertEqual(remotePost.autosave.title, "Hello, world!") - XCTAssertEqual(remotePost.autosave.content, "\n

Uno.

\n") - XCTAssertEqual(remotePost.autosave.excerpt, "abc") - XCTAssertEqual(remotePost.autosave.previewURL, "https://hello.wordpress.com/2019/10/28/hello-world/?preview=true&preview_nonce=07346f4e5d") - XCTAssertEqual(remotePost.autosave.modifiedDate, NSDate(wordPressComJSONString: "2019-10-28T02:06:39+00:00") as Date?) + XCTAssertEqual(remotePost.autosave?.identifier?.intValue, 100) + XCTAssertEqual(remotePost.autosave?.authorID, "12345678") + XCTAssertEqual(remotePost.autosave?.postID, 102) + XCTAssertEqual(remotePost.autosave?.title, "Hello, world!") + XCTAssertEqual(remotePost.autosave?.content, "\n

Uno.

\n") + XCTAssertEqual(remotePost.autosave?.excerpt, "abc") + XCTAssertEqual(remotePost.autosave?.previewURL, "https://hello.wordpress.com/2019/10/28/hello-world/?preview=true&preview_nonce=07346f4e5d") + XCTAssertEqual(remotePost.autosave?.modifiedDate, NSDate(wordPressComJSONString: "2019-10-28T02:06:39+00:00") as Date?) expect.fulfill() }, failure: { _ in XCTFail("This callback shouldn't get called") diff --git a/WordPressKitTests/PostServiceRemoteRESTTests.m b/WordPressKitTests/PostServiceRemoteRESTTests.m index ccc5a2e4..0e606392 100644 --- a/WordPressKitTests/PostServiceRemoteRESTTests.m +++ b/WordPressKitTests/PostServiceRemoteRESTTests.m @@ -2,7 +2,6 @@ #import #import #import "PostServiceRemoteREST.h" -#import "RemotePost.h" #import "WPKit-Swift.h" @interface PostServiceRemoteRESTTests : XCTestCase diff --git a/WordPressKitTests/TaxonomyServiceRemoteRESTTests.m b/WordPressKitTests/TaxonomyServiceRemoteRESTTests.m index 6e0f71d5..a9443406 100644 --- a/WordPressKitTests/TaxonomyServiceRemoteRESTTests.m +++ b/WordPressKitTests/TaxonomyServiceRemoteRESTTests.m @@ -1,7 +1,6 @@ #import #import #import "TaxonomyServiceRemoteREST.h" -#import "RemotePostTag.h" @import WordPressKit; @interface TaxonomyServiceRemoteRESTTests : XCTestCase From d033e686481296d1e0ba2cecac117722ddb3952a Mon Sep 17 00:00:00 2001 From: Tony Li Date: Fri, 9 Dec 2022 13:21:50 +1300 Subject: [PATCH 2/3] Explicitily declare a closure return type --- WordPressKit/NSObject+Debug.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WordPressKit/NSObject+Debug.swift b/WordPressKit/NSObject+Debug.swift index c02b175d..7743f169 100644 --- a/WordPressKit/NSObject+Debug.swift +++ b/WordPressKit/NSObject+Debug.swift @@ -3,7 +3,7 @@ extension NSObject { var allProperties: [String: Any] { let properties = Mirror(reflecting: self) .children - .compactMap { child in + .compactMap { child -> (String, Any)? in if let label = child.label { return (label, child.value) } else { From 3b3f84f259bd42a7efe3f9082eb0694f6bc6e0ab Mon Sep 17 00:00:00 2001 From: Tony Li Date: Fri, 16 Dec 2022 10:03:18 +1300 Subject: [PATCH 3/3] Change a comment to API doc Co-authored-by: Gio Lodi --- WordPressKit/RemotePost.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/WordPressKit/RemotePost.swift b/WordPressKit/RemotePost.swift index 46a3fcde..774ade7a 100644 --- a/WordPressKit/RemotePost.swift +++ b/WordPressKit/RemotePost.swift @@ -9,7 +9,8 @@ import ObjectiveC public static let statusPublish = "publish" public static let statusScheduled = "future" public static let statusTrash = "trash" - public static let statusDeleted = "deleted" // Returned by wpcom REST API when a post is permanently deleted. + /// Returned by the WordPress.com REST API when a post is permanently deleted. + public static let statusDeleted = "deleted" public var postID: NSNumber? public var siteID: NSNumber?