diff --git a/WordPress/Classes/Models/Blog/BlogSettings.swift b/WordPress/Classes/Models/Blog/BlogSettings.swift index d07e8368719d..ff1f175d26b8 100644 --- a/WordPress/Classes/Models/Blog/BlogSettings.swift +++ b/WordPress/Classes/Models/Blog/BlogSettings.swift @@ -71,6 +71,7 @@ open class BlogSettings: NSManagedObject { /// Jetpack Setting: lazy load images. /// + @available(*, deprecated) @NSManaged var jetpackLazyLoadImages: Bool // MARK: - Discussion diff --git a/WordPress/Classes/Services/BlogJetpackSettingsService.swift b/WordPress/Classes/Services/BlogJetpackSettingsService.swift index e8a58a197868..f300c8aae2ef 100644 --- a/WordPress/Classes/Services/BlogJetpackSettingsService.swift +++ b/WordPress/Classes/Services/BlogJetpackSettingsService.swift @@ -142,29 +142,6 @@ struct BlogJetpackSettingsService { ) } - func updateJetpackLazyImagesModuleSettingForBlog(_ blog: Blog, success: @escaping () -> Void, failure: @escaping (Error?) -> Void) { - guard let blogSettings = blog.settings else { - failure(nil) - return - } - - let isActive = blogSettings.jetpackLazyLoadImages - updateJetpackModuleActiveSettingForBlog( - blog, - module: BlogJetpackSettingsServiceRemote.Keys.lazyLoadImages, - active: isActive, - success: { - self.coreDataStack.performAndSave({ context in - guard let blogSettingsInContext = Blog.lookup(withObjectID: blog.objectID, in: context)?.settings else { - return - } - blogSettingsInContext.jetpackLazyLoadImages = isActive - }, completion: success, on: .main) - }, - failure: failure - ) - } - func updateJetpackServeImagesFromOurServersModuleSettingForBlog(_ blog: Blog, success: @escaping () -> Void, failure: @escaping (Error?) -> Void) { guard let blogSettings = blog.settings else { failure(nil) @@ -235,7 +212,6 @@ private extension BlogJetpackSettingsService { } func updateJetpackModulesSettings(_ settings: BlogSettings, remoteSettings: RemoteBlogJetpackModulesSettings) { - settings.jetpackLazyLoadImages = remoteSettings.lazyLoadImages settings.jetpackServeImagesFromOurServers = remoteSettings.serveImagesFromOurServers } diff --git a/WordPress/Classes/ViewRelated/Jetpack/Jetpack Settings/JetpackSpeedUpSiteSettingsViewController.swift b/WordPress/Classes/ViewRelated/Jetpack/Jetpack Settings/JetpackSpeedUpSiteSettingsViewController.swift index 38741318ab74..a5b10d2e3233 100644 --- a/WordPress/Classes/ViewRelated/Jetpack/Jetpack Settings/JetpackSpeedUpSiteSettingsViewController.swift +++ b/WordPress/Classes/ViewRelated/Jetpack/Jetpack Settings/JetpackSpeedUpSiteSettingsViewController.swift @@ -32,6 +32,7 @@ open class JetpackSpeedUpSiteSettingsViewController: UITableViewController { open override func viewDidLoad() { super.viewDidLoad() + title = NSLocalizedString("Speed up your site", comment: "Title for the Speed up your site Settings Screen") ImmuTable.registerRows([SwitchRow.self], tableView: tableView) WPStyleGuide.configureColors(view: view, tableView: tableView) @@ -51,34 +52,18 @@ open class JetpackSpeedUpSiteSettingsViewController: UITableViewController { } func tableViewModel() -> ImmuTable { - - let serveImagesFromOurServers = SwitchRow(title: NSLocalizedString("Serve images from our servers", - comment: "Title for the Serve images from our servers setting"), - value: self.settings.jetpackServeImagesFromOurServers, - onChange: self.serveImagesFromOurServersValueChanged()) - - let lazyLoadImages = SwitchRow(title: NSLocalizedString("\"Lazy-load\" images", - comment: "Title for the lazy load images setting"), - value: self.settings.jetpackLazyLoadImages, - onChange: self.lazyLoadImagesValueChanged()) + let serveImagesFromOurServers = SwitchRow( + title: NSLocalizedString("Serve images from our servers", + comment: "Title for the Serve images from our servers setting"), + value: self.settings.jetpackServeImagesFromOurServers, + onChange: self.serveImagesFromOurServersValueChanged()) return ImmuTable(sections: [ ImmuTableSection( headerText: "", rows: [serveImagesFromOurServers], - footerText: NSLocalizedString("Jetpack will optimize your images and serve them from the server " + - "location nearest to your visitors. Using our global content delivery " + - "network will boost the loading speed of your site.", - comment: "Footer for the Serve images from our servers setting")), - - ImmuTableSection( - headerText: "", - rows: [lazyLoadImages], - footerText: NSLocalizedString("Improve your site's speed by only loading images visible on the screen. " + - "New images will load just before they scroll into view. This prevents " + - "viewers from having to download all the images on a page all at once, " + - "even ones they can't see.", - comment: "Footer for the Serve images from our servers setting")), + footerText: NSLocalizedString("Jetpack will optimize your images and serve them from the server location nearest to your visitors. Using our global content delivery network will boost the loading speed of your site.", comment: "Footer for the Serve images from our servers setting") + ) ]) } @@ -98,19 +83,6 @@ open class JetpackSpeedUpSiteSettingsViewController: UITableViewController { } } - fileprivate func lazyLoadImagesValueChanged() -> (_ newValue: Bool) -> Void { - return { [unowned self] newValue in - self.settings.jetpackLazyLoadImages = newValue - self.reloadViewModel() - WPAnalytics.trackSettingsChange("jetpack_speed_up_site", fieldName: "lazy_load_images", value: newValue as Any) - self.service.updateJetpackLazyImagesModuleSettingForBlog(self.blog, - success: {}, - failure: { [weak self] (_) in - self?.refreshSettingsAfterSavingError() - }) - } - } - // MARK: - Persistance fileprivate func refreshSettings() {