Skip to content

Commit

Permalink
#1899 (dashboard)
Browse files Browse the repository at this point in the history
- Improved laoding dashboard.
- Fixed story layout.
  • Loading branch information
Dejal committed Dec 31, 2024
1 parent 0933da3 commit 7686e1a
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 deletions.
25 changes: 24 additions & 1 deletion clients/ios/Classes/FeedsViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,32 @@ class FeedsViewController: FeedsObjCViewController {

@objc func loadDashboard() {
if appDelegate.feedDetailViewController.dashboardIndex >= 0 {
appDelegate.feedDetailViewController.storyCache.reloadDashboard(for: appDelegate.feedDetailViewController.dashboardIndex)
deferredLoadNextDash()
} else {
immediatelyLoadNextDash()
}
}

var dashWorkItem: DispatchWorkItem?

private func deferredLoadNextDash() {
dashWorkItem?.cancel()

let workItem = DispatchWorkItem { [weak self] in
guard let self else {
return
}

immediatelyLoadNextDash()
}

dashWorkItem = workItem
DispatchQueue.main.asyncAfter(deadline: .now() + .seconds(5), execute: workItem)
}

private func immediatelyLoadNextDash() {
appDelegate.feedDetailViewController.storyCache.reloadDashboard(for: appDelegate.feedDetailViewController.dashboardIndex)

appDelegate.feedDetailViewController.dashboardIndex += 1
appDelegate.detailViewController.storyTitlesInDashboard = true

Expand Down
4 changes: 2 additions & 2 deletions clients/ios/Classes/StoryCache.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ import Foundation

/// Using a magazine-style grid view layout for the story titles and story pages.
var isMagazine: Bool {
return appDelegate.detailViewController.layout == .magazine
return appDelegate.detailViewController.layout == .magazine && !isDashboard
}

/// Using a grid-style grid view layout for the story titles and story pages.
var isGrid: Bool {
return appDelegate.detailViewController.layout == .grid
return appDelegate.detailViewController.layout == .grid && !isDashboard
}

/// Using the list, magazine, or grid layout based on the grid view.
Expand Down

0 comments on commit 7686e1a

Please sign in to comment.