mirror of
https://github.com/kiwix/kiwix-apple.git
synced 2025-09-28 06:25:04 -04:00
Fixes for library space detection
This commit is contained in:
parent
d841c3b982
commit
f4bd73e477
@ -192,7 +192,7 @@ class LibraryBooksController: CoreDataCollectionBaseController, UICollectionView
|
||||
].flatMap({$0}).joined(separator: " ")
|
||||
cell.descriptionLabel.text = book.desc
|
||||
cell.hasPicLabel.isHidden = !book.hasPic
|
||||
cell.spaceStatus = getBookSpaceStatus(fileSize: book.fileSize)
|
||||
if isCloudTab {cell.spaceStatus = getBookSpaceStatus(fileSize: book.fileSize)}
|
||||
|
||||
return cell
|
||||
}
|
||||
|
@ -154,8 +154,9 @@ class LibraryCollectionCell: UICollectionViewCell {
|
||||
delegate?.didTapMoreButton(cell: self)
|
||||
}
|
||||
|
||||
var spaceStatus: SpaceStatus = .enough {
|
||||
var spaceStatus: SpaceStatus? {
|
||||
didSet {
|
||||
guard let spaceStatus = spaceStatus else {return}
|
||||
switch spaceStatus {
|
||||
case .enough:
|
||||
titleLabel.textColor = UIColor.black
|
||||
|
@ -2,4 +2,22 @@
|
||||
<Bucket
|
||||
type = "0"
|
||||
version = "2.0">
|
||||
<Breakpoints>
|
||||
<BreakpointProxy
|
||||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||
<BreakpointContent
|
||||
shouldBeEnabled = "Yes"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
filePath = "Kiwix/libkiwix/ZimReader.mm"
|
||||
timestampString = "508185579.868817"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "43"
|
||||
endingLineNumber = "43"
|
||||
landmarkName = "-initWithZIMFileURL:"
|
||||
landmarkType = "7">
|
||||
</BreakpointContent>
|
||||
</BreakpointProxy>
|
||||
</Breakpoints>
|
||||
</Bucket>
|
||||
|
@ -114,11 +114,12 @@ extension AlertProcedure {
|
||||
return alert
|
||||
}
|
||||
|
||||
static func more(context: UIViewController, book: Book, spaceStatus: SpaceStatus) -> AlertProcedure {
|
||||
static func more(context: UIViewController, book: Book, spaceStatus: SpaceStatus?) -> AlertProcedure {
|
||||
assert(Thread.isMainThread)
|
||||
let alert = AlertProcedure(presentAlertFrom: context, withPreferredStyle: .actionSheet, waitForDismissal: true)
|
||||
alert.title = book.title
|
||||
alert.message = {
|
||||
guard let spaceStatus = spaceStatus else {return book.desc}
|
||||
switch spaceStatus {
|
||||
case .enough:
|
||||
return book.desc
|
||||
@ -146,7 +147,7 @@ extension AlertProcedure {
|
||||
}
|
||||
|
||||
alert.add(actionWithTitle: Localized.Common.cancel, style: .cancel) { _ in alert.finish() }
|
||||
alert.actions.first?.isEnabled = spaceStatus != .notEnough
|
||||
if let _ = spaceStatus {alert.actions.first?.isEnabled = spaceStatus != .notEnough}
|
||||
return alert
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user