Files
SideStore/AltStore/Settings/RefreshAttemptsViewController.swift
Joshua Laymon 403a369df9 Match branding some more (#72)
* change app name to SideStore
* Make it P U R P L E
* Fix actions for branding
* Change patreon description in settings
* Update RefreshAttemptsViewController.swift
* Update LaunchViewController.swift
* Update some of Credits
* Fix space
* More Branding fixes
* Change How it Works to have better wording.
* Change Branding for source and bundle
* Get the Rest of the Branding and popup naming fixes
* Welcome to SiteStore
* Update instructions to not include sideserver 

This removes sideserver fro the instructions on how it works as sideServer in background of a computer so far isn’t needed.
* Remove mention of sideserver in the app
* SideStore error Message instead of AltServer
* some adjustments
* forgot to add this in the last commit
* Try fixing compile error
* Spell correct of last commit
* Fix Requested changes 11/5/2022

Signed-off-by: bogotesr <71040782+bogotesr@users.noreply.github.com>
Co-authored-by: Spidy123222 <64176728+Spidy123222@users.noreply.github.com>
2022-11-05 23:50:07 -07:00

75 lines
2.5 KiB
Swift

//
// RefreshAttemptsViewController.swift
// AltStore
//
// Created by Riley Testut on 7/31/19.
// Copyright © 2019 Riley Testut. All rights reserved.
//
import UIKit
import AltStoreCore
import Roxas
@objc(RefreshAttemptTableViewCell)
private class RefreshAttemptTableViewCell: UITableViewCell
{
@IBOutlet var successLabel: UILabel!
@IBOutlet var dateLabel: UILabel!
@IBOutlet var errorDescriptionLabel: UILabel!
}
class RefreshAttemptsViewController: UITableViewController
{
private lazy var dataSource = self.makeDataSource()
private lazy var dateFormatter: DateFormatter = {
let dateFormatter = DateFormatter()
dateFormatter.dateStyle = .short
dateFormatter.timeStyle = .short
return dateFormatter
}()
override func viewDidLoad()
{
super.viewDidLoad()
self.tableView.dataSource = self.dataSource
}
}
private extension RefreshAttemptsViewController
{
func makeDataSource() -> RSTFetchedResultsTableViewDataSource<RefreshAttempt>
{
let fetchRequest = RefreshAttempt.fetchRequest() as NSFetchRequest<RefreshAttempt>
fetchRequest.sortDescriptors = [NSSortDescriptor(keyPath: \RefreshAttempt.date, ascending: false)]
fetchRequest.returnsObjectsAsFaults = false
let dataSource = RSTFetchedResultsTableViewDataSource(fetchRequest: fetchRequest, managedObjectContext: DatabaseManager.shared.viewContext)
dataSource.cellConfigurationHandler = { [weak self] (cell, attempt, indexPath) in
let cell = cell as! RefreshAttemptTableViewCell
cell.dateLabel.text = self?.dateFormatter.string(from: attempt.date)
cell.errorDescriptionLabel.text = attempt.errorDescription
if attempt.isSuccess
{
cell.successLabel.text = NSLocalizedString("Success", comment: "")
cell.successLabel.textColor = .refreshGreen
}
else
{
cell.successLabel.text = NSLocalizedString("Failure", comment: "")
cell.successLabel.textColor = .refreshRed
}
}
let placeholderView = RSTPlaceholderView()
placeholderView.textLabel.text = NSLocalizedString("No Refresh Attempts", comment: "")
placeholderView.detailTextLabel.text = NSLocalizedString("The more you use SideStore, the more often iOS will allow it to refresh apps in the background.", comment: "")
dataSource.placeholderView = placeholderView
return dataSource
}
}