From ed3b31037e8aaefabafae9a4e168897d3fce65f6 Mon Sep 17 00:00:00 2001 From: Diego Rey Mendez Date: Mon, 6 Apr 2020 20:33:45 -0300 Subject: [PATCH 1/4] Wires site_is_atomic from the reader endpoint. --- Podfile | 4 +- Podfile.lock | 15 +- WordPress/Classes/Models/ReaderPost.h | 1 + WordPress/Classes/Models/ReaderPost.m | 1 + .../Classes/Services/ReaderPostService.m | 1 + .../WordPress.xcdatamodeld/.xccurrentversion | 2 +- .../WordPress 95.xcdatamodel/contents | 844 ++++++++++++++++++ WordPress/WordPress.xcodeproj/project.pbxproj | 4 +- 8 files changed, 863 insertions(+), 9 deletions(-) create mode 100644 WordPress/Classes/WordPress.xcdatamodeld/WordPress 95.xcdatamodel/contents diff --git a/Podfile b/Podfile index 4ed8d4d60af9..a77339986a3c 100644 --- a/Podfile +++ b/Podfile @@ -43,11 +43,11 @@ def wordpress_ui end def wordpress_kit - pod 'WordPressKit', '~> 4.7.0' + #pod 'WordPressKit', '~> 4.7.0' #pod 'WordPressKit', :git => 'https://github.com/wordpress-mobile/WordPressKit-iOS.git', :tag => '4.6.0-beta.3' #pod 'WordPressKit', :git => 'https://github.com/wordpress-mobile/WordPressKit-iOS.git', :branch => '' - #pod 'WordPressKit', :git => 'https://github.com/wordpress-mobile/WordPressKit-iOS.git', :commit => '' + pod 'WordPressKit', :git => 'https://github.com/wordpress-mobile/WordPressKit-iOS.git', :commit => '5c697bd1aa74bb2aa11ba6f5ef62d1aaf1ab1dde' #pod 'WordPressKit', :path => '../WordPressKit-iOS' end diff --git a/Podfile.lock b/Podfile.lock index 46b08b7b5c13..cb8891832657 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -386,7 +386,7 @@ PODS: - WordPressKit (~> 4.7.0) - WordPressShared (~> 1.8.16) - WordPressUI (~> 1.5.2) - - WordPressKit (4.7.0): + - WordPressKit (4.7.1-beta.1): - Alamofire (~> 4.8.0) - CocoaLumberjack (~> 3.4) - NSObject-SafeExpectations (= 0.0.4) @@ -477,7 +477,7 @@ DEPENDENCIES: - SVProgressHUD (= 2.2.5) - WordPress-Editor-iOS (~> 1.17.1) - WordPressAuthenticator (~> 1.12.0) - - WordPressKit (~> 4.7.0) + - WordPressKit (from `https://github.com/wordpress-mobile/WordPressKit-iOS.git`, commit `5c697bd1aa74bb2aa11ba6f5ef62d1aaf1ab1dde`) - WordPressMocks (~> 0.0.8) - WordPressShared (~> 1.8.16) - WordPressUI (~> 1.5.2) @@ -524,7 +524,6 @@ SPEC REPOS: - WordPress-Aztec-iOS - WordPress-Editor-iOS - WordPressAuthenticator - - WordPressKit - WordPressMocks - WordPressShared - WordPressUI @@ -609,6 +608,9 @@ EXTERNAL SOURCES: RNTAztecView: :git: http://github.com/wordpress-mobile/gutenberg-mobile/ :tag: v1.25.0 + WordPressKit: + :commit: 5c697bd1aa74bb2aa11ba6f5ef62d1aaf1ab1dde + :git: https://github.com/wordpress-mobile/WordPressKit-iOS.git Yoga: :podspec: https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/v1.25.0/react-native-gutenberg-bridge/third-party-podspecs/Yoga.podspec.json @@ -622,6 +624,9 @@ CHECKOUT OPTIONS: RNTAztecView: :git: http://github.com/wordpress-mobile/gutenberg-mobile/ :tag: v1.25.0 + WordPressKit: + :commit: 5c697bd1aa74bb2aa11ba6f5ef62d1aaf1ab1dde + :git: https://github.com/wordpress-mobile/WordPressKit-iOS.git SPEC CHECKSUMS: 1PasswordExtension: f97cc80ae58053c331b2b6dc8843ba7103b33794 @@ -693,7 +698,7 @@ SPEC CHECKSUMS: WordPress-Aztec-iOS: 319620514af963ca519bd83b96a2c0ebdf3a0f03 WordPress-Editor-iOS: 497b55838ef0030cc6ca82eb92da84e661423521 WordPressAuthenticator: 593bbdad097e4752cc464ac1c6ef460e1a9801a8 - WordPressKit: 0602e8188245b3267269570d3d78c138e64a4eba + WordPressKit: dde0a214279fb70d7150b69ae90c7224c18fe2d0 WordPressMocks: b4064b99a073117bbc304abe82df78f2fbe60992 WordPressShared: 1bc316ed162f42af4e0fa2869437e9e28b532b01 WordPressUI: 70cc58a253c352330b23cd8fa6dd6a2021570e18 @@ -709,6 +714,6 @@ SPEC CHECKSUMS: ZendeskSupportSDK: a87ab1e4badace92c75eb11dc77ede1e995b2adc ZIPFoundation: 249fa8890597086cd536bb2df5c9804d84e122b0 -PODFILE CHECKSUM: 0686708ae420e1e60b9eb397c6ca36e04241a8c6 +PODFILE CHECKSUM: 496ae937cce078bdb658397d8f82e03fd0345721 COCOAPODS: 1.8.4 diff --git a/WordPress/Classes/Models/ReaderPost.h b/WordPress/Classes/Models/ReaderPost.h index 9ed8f8b7d1b3..130c20ebd7a1 100644 --- a/WordPress/Classes/Models/ReaderPost.h +++ b/WordPress/Classes/Models/ReaderPost.h @@ -26,6 +26,7 @@ extern NSString * const ReaderPostStoredCommentTextKey; @property (nonatomic, strong) NSNumber *feedID; @property (nonatomic, strong) NSNumber *feedItemID; @property (nonatomic, strong) NSString *globalID; +@property (nonatomic) BOOL isBlogAtomic; @property (nonatomic) BOOL isBlogPrivate; @property (nonatomic) BOOL isFollowing; @property (nonatomic) BOOL isLiked; diff --git a/WordPress/Classes/Models/ReaderPost.m b/WordPress/Classes/Models/ReaderPost.m index fb67c389fc34..f250c7d117b0 100644 --- a/WordPress/Classes/Models/ReaderPost.m +++ b/WordPress/Classes/Models/ReaderPost.m @@ -26,6 +26,7 @@ @implementation ReaderPost @dynamic featuredImage; @dynamic feedID; @dynamic feedItemID; +@dynamic isBlogAtomic; @dynamic isBlogPrivate; @dynamic isFollowing; @dynamic isLiked; diff --git a/WordPress/Classes/Services/ReaderPostService.m b/WordPress/Classes/Services/ReaderPostService.m index a40f3c826f26..8de9c22db52a 100644 --- a/WordPress/Classes/Services/ReaderPostService.m +++ b/WordPress/Classes/Services/ReaderPostService.m @@ -1159,6 +1159,7 @@ - (ReaderPost *)createOrReplaceFromRemotePost:(RemoteReaderPost *)remotePost for post.feedID = remotePost.feedID; post.feedItemID = remotePost.feedItemID; post.globalID = remotePost.globalID; + post.isBlogAtomic = remotePost.isBlogAtomic; post.isBlogPrivate = remotePost.isBlogPrivate; post.isFollowing = remotePost.isFollowing; post.isLiked = remotePost.isLiked; diff --git a/WordPress/Classes/WordPress.xcdatamodeld/.xccurrentversion b/WordPress/Classes/WordPress.xcdatamodeld/.xccurrentversion index 8f55dabda40d..b2610f0a8915 100644 --- a/WordPress/Classes/WordPress.xcdatamodeld/.xccurrentversion +++ b/WordPress/Classes/WordPress.xcdatamodeld/.xccurrentversion @@ -3,6 +3,6 @@ _XCCurrentVersionName - WordPress 94.xcdatamodel + WordPress 95.xcdatamodel diff --git a/WordPress/Classes/WordPress.xcdatamodeld/WordPress 95.xcdatamodel/contents b/WordPress/Classes/WordPress.xcdatamodeld/WordPress 95.xcdatamodel/contents new file mode 100644 index 000000000000..fbf79e66e09f --- /dev/null +++ b/WordPress/Classes/WordPress.xcdatamodeld/WordPress 95.xcdatamodel/contents @@ -0,0 +1,844 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/WordPress/WordPress.xcodeproj/project.pbxproj b/WordPress/WordPress.xcodeproj/project.pbxproj index c2aa85b6117e..cf2c127fa362 100644 --- a/WordPress/WordPress.xcodeproj/project.pbxproj +++ b/WordPress/WordPress.xcodeproj/project.pbxproj @@ -4620,6 +4620,7 @@ F18B43771F849F580089B817 /* PostAttachmentTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = PostAttachmentTests.swift; path = Posts/PostAttachmentTests.swift; sourceTree = ""; }; F1ADCAF6241FEF0C00F150D2 /* AtomicAuthenticationService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AtomicAuthenticationService.swift; sourceTree = ""; }; F1B1E7A224098FA100549E2A /* BlogTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BlogTests.swift; sourceTree = ""; }; + F1BBA95E243BEFC500E9E5E6 /* WordPress 95.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = "WordPress 95.xcdatamodel"; sourceTree = ""; }; F1D690141F828FF000200E30 /* BuildConfiguration.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BuildConfiguration.swift; sourceTree = ""; }; F1D690151F828FF000200E30 /* FeatureFlag.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FeatureFlag.swift; sourceTree = ""; }; F1DB8D282288C14400906E2F /* Uploader.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Uploader.swift; sourceTree = ""; }; @@ -16448,6 +16449,7 @@ E125443B12BF5A7200D87A0A /* WordPress.xcdatamodeld */ = { isa = XCVersionGroup; children = ( + F1BBA95E243BEFC500E9E5E6 /* WordPress 95.xcdatamodel */, 32282CF82390B614003378A7 /* WordPress 94.xcdatamodel */, 32A29A16236BC8BC009488C2 /* WordPress 93.xcdatamodel */, 57CCB37E2358E5DC003ECD0C /* WordPress 92.xcdatamodel */, @@ -16543,7 +16545,7 @@ 8350E15911D28B4A00A7B073 /* WordPress.xcdatamodel */, E125443D12BF5A7200D87A0A /* WordPress 2.xcdatamodel */, ); - currentVersion = 32282CF82390B614003378A7 /* WordPress 94.xcdatamodel */; + currentVersion = F1BBA95E243BEFC500E9E5E6 /* WordPress 95.xcdatamodel */; name = WordPress.xcdatamodeld; path = Classes/WordPress.xcdatamodeld; sourceTree = ""; From c9177c72db3faa90235eaa6980250765ad500211 Mon Sep 17 00:00:00 2001 From: Diego Rey Mendez Date: Wed, 8 Apr 2020 08:31:45 -0300 Subject: [PATCH 2/4] Updates to WPKit 4.7.1-beta.1 --- Podfile | 4 ++-- Podfile.lock | 11 +++-------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/Podfile b/Podfile index a77339986a3c..acf4fe27ff18 100644 --- a/Podfile +++ b/Podfile @@ -43,11 +43,11 @@ def wordpress_ui end def wordpress_kit - #pod 'WordPressKit', '~> 4.7.0' + pod 'WordPressKit', '~> 4.7.1-beta.1' #pod 'WordPressKit', :git => 'https://github.com/wordpress-mobile/WordPressKit-iOS.git', :tag => '4.6.0-beta.3' #pod 'WordPressKit', :git => 'https://github.com/wordpress-mobile/WordPressKit-iOS.git', :branch => '' - pod 'WordPressKit', :git => 'https://github.com/wordpress-mobile/WordPressKit-iOS.git', :commit => '5c697bd1aa74bb2aa11ba6f5ef62d1aaf1ab1dde' + #pod 'WordPressKit', :git => 'https://github.com/wordpress-mobile/WordPressKit-iOS.git', :commit => '' #pod 'WordPressKit', :path => '../WordPressKit-iOS' end diff --git a/Podfile.lock b/Podfile.lock index cb8891832657..0b1f96fc0cdf 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -477,7 +477,7 @@ DEPENDENCIES: - SVProgressHUD (= 2.2.5) - WordPress-Editor-iOS (~> 1.17.1) - WordPressAuthenticator (~> 1.12.0) - - WordPressKit (from `https://github.com/wordpress-mobile/WordPressKit-iOS.git`, commit `5c697bd1aa74bb2aa11ba6f5ef62d1aaf1ab1dde`) + - WordPressKit (~> 4.7.1-beta.1) - WordPressMocks (~> 0.0.8) - WordPressShared (~> 1.8.16) - WordPressUI (~> 1.5.2) @@ -524,6 +524,7 @@ SPEC REPOS: - WordPress-Aztec-iOS - WordPress-Editor-iOS - WordPressAuthenticator + - WordPressKit - WordPressMocks - WordPressShared - WordPressUI @@ -608,9 +609,6 @@ EXTERNAL SOURCES: RNTAztecView: :git: http://github.com/wordpress-mobile/gutenberg-mobile/ :tag: v1.25.0 - WordPressKit: - :commit: 5c697bd1aa74bb2aa11ba6f5ef62d1aaf1ab1dde - :git: https://github.com/wordpress-mobile/WordPressKit-iOS.git Yoga: :podspec: https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/v1.25.0/react-native-gutenberg-bridge/third-party-podspecs/Yoga.podspec.json @@ -624,9 +622,6 @@ CHECKOUT OPTIONS: RNTAztecView: :git: http://github.com/wordpress-mobile/gutenberg-mobile/ :tag: v1.25.0 - WordPressKit: - :commit: 5c697bd1aa74bb2aa11ba6f5ef62d1aaf1ab1dde - :git: https://github.com/wordpress-mobile/WordPressKit-iOS.git SPEC CHECKSUMS: 1PasswordExtension: f97cc80ae58053c331b2b6dc8843ba7103b33794 @@ -714,6 +709,6 @@ SPEC CHECKSUMS: ZendeskSupportSDK: a87ab1e4badace92c75eb11dc77ede1e995b2adc ZIPFoundation: 249fa8890597086cd536bb2df5c9804d84e122b0 -PODFILE CHECKSUM: 496ae937cce078bdb658397d8f82e03fd0345721 +PODFILE CHECKSUM: b123d3845aea68ad2718a1c6636e0a92e881b7f1 COCOAPODS: 1.8.4 From 36a94d02911bc536473088ffd233af9d4cbb309a Mon Sep 17 00:00:00 2001 From: Diego Rey Mendez Date: Wed, 8 Apr 2020 08:35:50 -0300 Subject: [PATCH 3/4] Wires isAtomic in ReaderPost. --- WordPress/Classes/Models/ReaderPost.m | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/WordPress/Classes/Models/ReaderPost.m b/WordPress/Classes/Models/ReaderPost.m index f250c7d117b0..56fb70cea524 100644 --- a/WordPress/Classes/Models/ReaderPost.m +++ b/WordPress/Classes/Models/ReaderPost.m @@ -68,11 +68,7 @@ - (BOOL)isCrossPost - (BOOL)isAtomic { - // TODO: This is temporary until we start parsing a new value from the reader endpoint. - // - // Issue: https://git.io/JvNAN - // - return false; + return self.isBlogAtomic; } - (BOOL)isPrivate From bb7d122e8b23edc75c1cea27bdc143d6ef3204e3 Mon Sep 17 00:00:00 2001 From: Diego Rey Mendez Date: Wed, 8 Apr 2020 17:38:24 -0300 Subject: [PATCH 4/4] Fixes the blog icons for Atomic Private sites in the reader. --- .../Reader/ReaderCrossPostCell.swift | 24 +++++++++++++++---- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/WordPress/Classes/ViewRelated/Reader/ReaderCrossPostCell.swift b/WordPress/Classes/ViewRelated/Reader/ReaderCrossPostCell.swift index 9d268b7ac65f..deb3e25840b5 100644 --- a/WordPress/Classes/ViewRelated/Reader/ReaderCrossPostCell.swift +++ b/WordPress/Classes/ViewRelated/Reader/ReaderCrossPostCell.swift @@ -1,4 +1,6 @@ +import AlamofireImage import Foundation +import AutomatticTracks import WordPressShared.WPStyleGuide open class ReaderCrossPostCell: UITableViewCell { @@ -90,11 +92,23 @@ open class ReaderCrossPostCell: UITableViewCell { let placeholder = UIImage(named: blavatarPlaceholder) let size = blavatarImageView.frame.size.width * UIScreen.main.scale - let url = contentProvider?.siteIconForDisplay(ofSize: Int(size)) - if url != nil { - blavatarImageView.downloadImage(from: url, placeholderImage: placeholder) - } else { - blavatarImageView.image = placeholder + + guard let contentProvider = contentProvider, + let url = contentProvider.siteIconForDisplay(ofSize: Int(size)) else { + blavatarImageView.image = placeholder + return + } + + let host = MediaHost(with: contentProvider) { error in + CrashLogging.logError(error) + } + + let mediaAuthenticator = MediaRequestAuthenticator() + mediaAuthenticator.authenticatedRequest(for: url, from: host, onComplete: { [weak self] request in + self?.blavatarImageView.af_setImage(withURLRequest: request, placeholderImage: placeholder) + }) { [weak self] error in + CrashLogging.logError(error) + self?.blavatarImageView.image = placeholder } }