From 8f6b2f8d993b2ced4fb314d15144fe716e393a17 Mon Sep 17 00:00:00 2001 From: Ivan Magda Date: Fri, 16 Nov 2018 14:29:43 +0300 Subject: [PATCH] Fix offline --- Stepic/SectionsViewController.swift | 6 +++++- Stepic/UnitsViewController.swift | 8 +++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Stepic/SectionsViewController.swift b/Stepic/SectionsViewController.swift index 63adff18ca..fbddb85d60 100644 --- a/Stepic/SectionsViewController.swift +++ b/Stepic/SectionsViewController.swift @@ -302,7 +302,11 @@ class SectionsViewController: UIViewController, ShareableController, UIViewContr //TODO: Handle error type in section downloading UIThread.performUI({ self.refreshControl.endRefreshing() - self.emptyDatasetState = EmptyDatasetState.connectionError + + if self.course.sections.isEmpty { + self.emptyDatasetState = .connectionError + } + self.tableView.reloadData() if let m = self.moduleId { if (1...self.course.sectionsArray.count ~= m) && self.isReachable(section: m - 1) { diff --git a/Stepic/UnitsViewController.swift b/Stepic/UnitsViewController.swift index 77a7a7ae9f..2ab6915df7 100644 --- a/Stepic/UnitsViewController.swift +++ b/Stepic/UnitsViewController.swift @@ -217,10 +217,6 @@ class UnitsViewController: UIViewController, ShareableController, UIViewControll } if let section = section { - if section.units.count > 0 { - self.isPlaceholderShown = false - } - section.loadProgressesForUnits(units: section.units, completion: { UIThread.performUI({ self.tableView.reloadData() @@ -268,7 +264,9 @@ class UnitsViewController: UIViewController, ShareableController, UIViewControll }, error: { UIThread.performUI({ self.refreshControl.endRefreshing() - self.emptyDatasetState = EmptyDatasetState.connectionError + if self.section?.units.isEmpty ?? true { + self.emptyDatasetState = .connectionError + } }) self.didRefresh = true })