From 5852f81957bafedd5c10f3571ed570c08b5ebb91 Mon Sep 17 00:00:00 2001 From: Daniele Bogo Date: Wed, 8 May 2019 16:30:55 +0100 Subject: [PATCH 1/5] =?UTF-8?q?Don=E2=80=99t=20display=20the=20offline=20i?= =?UTF-8?q?f=20the=20feature=20flag=20is=20on?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WordPress/Classes/ViewRelated/Stats/StatsViewController.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WordPress/Classes/ViewRelated/Stats/StatsViewController.m b/WordPress/Classes/ViewRelated/Stats/StatsViewController.m index 93919001869d..8cdd207c1b67 100644 --- a/WordPress/Classes/ViewRelated/Stats/StatsViewController.m +++ b/WordPress/Classes/ViewRelated/Stats/StatsViewController.m @@ -112,7 +112,7 @@ - (void)addStatsViewControllerToView - (void)initStats { WordPressAppDelegate *appDelegate = [WordPressAppDelegate sharedInstance]; - if (!appDelegate.connectionAvailable) { + if (!appDelegate.connectionAvailable && ![Feature enabled:FeatureFlagStatsRefresh]) { [self showNoResults]; self.offline = YES; return; From 57768808434416fd5fecf04b619eac472fba21a7 Mon Sep 17 00:00:00 2001 From: Daniele Bogo Date: Thu, 9 May 2019 10:43:04 +0100 Subject: [PATCH 2/5] Fix add subview --- WordPress/Classes/Extensions/UIViewController+NoResults.swift | 2 ++ 1 file changed, 2 insertions(+) diff --git a/WordPress/Classes/Extensions/UIViewController+NoResults.swift b/WordPress/Classes/Extensions/UIViewController+NoResults.swift index fd8461be5a88..7744a8e49150 100644 --- a/WordPress/Classes/Extensions/UIViewController+NoResults.swift +++ b/WordPress/Classes/Extensions/UIViewController+NoResults.swift @@ -116,6 +116,8 @@ extension NoResultsViewHost where Self: UIViewController { if animated { view.addSubview(withFadeAnimation: noResultsViewController.view) + } else { + view.addSubview(noResultsViewController.view) } noResultsViewController.didMove(toParent: self) } From 2c9f970217a406ba4dbe1768be97c32c13c8f554 Mon Sep 17 00:00:00 2001 From: Daniele Bogo Date: Thu, 9 May 2019 10:43:27 +0100 Subject: [PATCH 3/5] =?UTF-8?q?If=20there=E2=80=99s=20no=20connection=20fo?= =?UTF-8?q?rce=20to=20display=20the=20image?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Classes/ViewRelated/Blog/NoResultsViewController.swift | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/WordPress/Classes/ViewRelated/Blog/NoResultsViewController.swift b/WordPress/Classes/ViewRelated/Blog/NoResultsViewController.swift index 9587b387d562..e90966aa2b5e 100644 --- a/WordPress/Classes/ViewRelated/Blog/NoResultsViewController.swift +++ b/WordPress/Classes/ViewRelated/Blog/NoResultsViewController.swift @@ -236,6 +236,11 @@ import Reachability /// Public method to hide/show the image view. /// @objc func hideImageView(_ hide: Bool = true) { + if let isReachable = reachability?.isReachable(), + !isReachable { + hideImage = false + return + } hideImage = hide } From 2df6995680a46ec2ab37d43bf1e61ee6c5029aaf Mon Sep 17 00:00:00 2001 From: Daniele Bogo Date: Thu, 9 May 2019 19:45:26 +0100 Subject: [PATCH 4/5] Remove out of scope code --- .../Classes/ViewRelated/Blog/NoResultsViewController.swift | 5 ----- 1 file changed, 5 deletions(-) diff --git a/WordPress/Classes/ViewRelated/Blog/NoResultsViewController.swift b/WordPress/Classes/ViewRelated/Blog/NoResultsViewController.swift index e90966aa2b5e..9587b387d562 100644 --- a/WordPress/Classes/ViewRelated/Blog/NoResultsViewController.swift +++ b/WordPress/Classes/ViewRelated/Blog/NoResultsViewController.swift @@ -236,11 +236,6 @@ import Reachability /// Public method to hide/show the image view. /// @objc func hideImageView(_ hide: Bool = true) { - if let isReachable = reachability?.isReachable(), - !isReachable { - hideImage = false - return - } hideImage = hide } From 7ae9a3f1fc893fe1a2c021b97b9f110722387b3d Mon Sep 17 00:00:00 2001 From: Daniele Bogo Date: Thu, 9 May 2019 19:46:08 +0100 Subject: [PATCH 5/5] Check the reachability to hide / display the image --- .../Stats/Insights/SiteStatsInsightsTableViewController.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/WordPress/Classes/ViewRelated/Stats/Insights/SiteStatsInsightsTableViewController.swift b/WordPress/Classes/ViewRelated/Stats/Insights/SiteStatsInsightsTableViewController.swift index f65efbc434b9..da180e40997f 100644 --- a/WordPress/Classes/ViewRelated/Stats/Insights/SiteStatsInsightsTableViewController.swift +++ b/WordPress/Classes/ViewRelated/Stats/Insights/SiteStatsInsightsTableViewController.swift @@ -142,8 +142,10 @@ private extension SiteStatsInsightsTableViewController { updateNoResults(title: NoResultConstants.errorTitle, subtitle: NoResultConstants.errorSubtitle, buttonTitle: NoResultConstants.refreshButtonTitle) { [weak self] noResults in + let appDelegate = WordPressAppDelegate.sharedInstance() + noResults.delegate = self - noResults.hideImageView() + noResults.hideImageView(appDelegate?.connectionAvailable ?? true) } }