Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat(polls): Use PlaceholderView as background in PollDraftsViewContr…
…oller

Signed-off-by: Ivan Sein <[email protected]>
  • Loading branch information
Ivansss committed Jan 15, 2025
commit 59013ee35d5af07ceff54057cad206d6b6a833c2
19 changes: 12 additions & 7 deletions NextcloudTalk/PollDraftsViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class PollDraftsViewController: UITableViewController {

var room: NCRoom
var drafts: [NCPoll] = []
let activityIndicator = UIActivityIndicatorView(style: .medium)
var pollDraftsBackgroundView: PlaceholderView = PlaceholderView(for: .grouped)

init(room: NCRoom) {
self.room = room
Expand Down Expand Up @@ -43,14 +43,18 @@ class PollDraftsViewController: UITableViewController {
self.navigationItem.compactAppearance = appearance
self.navigationItem.scrollEdgeAppearance = appearance

setupActivityIndicator()
setupBackgroundView()
getPollDrafts()
}

// MARK: - Activity Indicator
private func setupActivityIndicator() {
tableView.backgroundView = activityIndicator
activityIndicator.startAnimating()
// MARK: - Backgroud view
private func setupBackgroundView() {
pollDraftsBackgroundView.placeholderView.isHidden = true
pollDraftsBackgroundView.loadingView.startAnimating()
pollDraftsBackgroundView.placeholderTextView.text = NSLocalizedString("No poll drafts saved yet", comment: "")
pollDraftsBackgroundView.setImage(UIImage(systemName: "chart.bar"))

tableView.backgroundView = pollDraftsBackgroundView
}

// MARK: - Poll drafts
Expand All @@ -68,7 +72,8 @@ class PollDraftsViewController: UITableViewController {
self.tableView.reloadData()
}

self.activityIndicator.stopAnimating()
self.pollDraftsBackgroundView.placeholderView.isHidden = drafts?.count ?? 0 > 0
self.pollDraftsBackgroundView.loadingView.stopAnimating()
}
}

Expand Down