mirror of
https://github.com/kiwix/kiwix-apple.git
synced 2025-09-26 21:39:37 -04:00
update book detail controller
This commit is contained in:
parent
380f740bfc
commit
f49ffb5259
@ -17,8 +17,6 @@ class BookDetailController: UITableViewController, DZNEmptyDataSetSource, DZNEmp
|
||||
|
||||
@IBOutlet weak var hasPicIndicator: UILabel!
|
||||
@IBOutlet weak var hasPicLabel: UILabel!
|
||||
@IBOutlet weak var hasIndexIndicator: UILabel!
|
||||
@IBOutlet weak var hasIndexLabel: UILabel!
|
||||
|
||||
private(set) var context: UnsafeMutablePointer<Void> = nil
|
||||
|
||||
@ -38,9 +36,7 @@ class BookDetailController: UITableViewController, DZNEmptyDataSetSource, DZNEmp
|
||||
tableView.rowHeight = UITableViewAutomaticDimension
|
||||
|
||||
hasPicIndicator.layer.cornerRadius = 2.0
|
||||
hasIndexIndicator.layer.cornerRadius = 2.0
|
||||
hasPicIndicator.layer.masksToBounds = true
|
||||
hasIndexIndicator.layer.masksToBounds = true
|
||||
}
|
||||
|
||||
override func viewWillAppear(animated: Bool) {
|
||||
@ -74,13 +70,8 @@ class BookDetailController: UITableViewController, DZNEmptyDataSetSource, DZNEmp
|
||||
func configureIndicators(with book: Book) {
|
||||
hasPicIndicator.backgroundColor = book.hasPic ? AppColors.hasPicTintColor : UIColor.lightGrayColor()
|
||||
hasPicLabel.text = book.hasPic ? LocalizedStrings.hasPic : LocalizedStrings.noPic
|
||||
hasIndexIndicator.backgroundColor = book.hasIndex ? AppColors.hasIndexTintColor : UIColor.lightGrayColor()
|
||||
hasIndexLabel.text = book.hasIndex ? LocalizedStrings.hasIndex : LocalizedStrings.noIndex
|
||||
|
||||
hasPicIndicator.hidden = false
|
||||
hasPicLabel.hidden = false
|
||||
hasIndexIndicator.hidden = false
|
||||
hasIndexLabel.hidden = false
|
||||
}
|
||||
|
||||
func configureDescriptionSection(with book: Book) {
|
||||
@ -123,14 +114,18 @@ class BookDetailController: UITableViewController, DZNEmptyDataSetSource, DZNEmp
|
||||
func configureBookInfoSection(with book: Book) {
|
||||
sectionHeaders.append(LocalizedStrings.bookInfo)
|
||||
sectionFooters.append(nil)
|
||||
cellTitles.append([
|
||||
var titles = [
|
||||
LocalizedStrings.size,
|
||||
LocalizedStrings.createDate,
|
||||
LocalizedStrings.arcitleCount,
|
||||
LocalizedStrings.language,
|
||||
LocalizedStrings.creator,
|
||||
LocalizedStrings.publisher
|
||||
])
|
||||
LocalizedStrings.publisher,
|
||||
]
|
||||
if let _ = ZimMultiReader.shared.readers[book.id] {
|
||||
titles.append(LocalizedStrings.index)
|
||||
}
|
||||
cellTitles.append(titles)
|
||||
}
|
||||
|
||||
func configurePIDSection(with book: Book) {
|
||||
@ -217,6 +212,19 @@ class BookDetailController: UITableViewController, DZNEmptyDataSetSource, DZNEmp
|
||||
cell.detailTextLabel?.text = book?.creator
|
||||
case LocalizedStrings.publisher:
|
||||
cell.detailTextLabel?.text = book?.publisher
|
||||
case LocalizedStrings.index:
|
||||
guard let book = book, let reader = ZimMultiReader.shared.readers[book.id] else {break}
|
||||
cell.detailTextLabel?.text = {
|
||||
if reader.hasIndex() {
|
||||
if reader.idxFolderURL != nil {
|
||||
return LocalizedStrings.external
|
||||
} else {
|
||||
return LocalizedStrings.embedded
|
||||
}
|
||||
} else {
|
||||
return LocalizedStrings.none
|
||||
}
|
||||
}()
|
||||
default:
|
||||
break
|
||||
}
|
||||
@ -273,9 +281,7 @@ class BookDetailController: UITableViewController, DZNEmptyDataSetSource, DZNEmp
|
||||
|
||||
class LocalizedStrings {
|
||||
private static let comment = "Library, Book Detail"
|
||||
static let hasIndex = NSLocalizedString("Index", comment: comment)
|
||||
static let hasPic = NSLocalizedString("Pictures", comment: comment)
|
||||
static let noIndex = NSLocalizedString("No Index", comment: comment)
|
||||
static let noPic = NSLocalizedString("No Picture", comment: comment)
|
||||
|
||||
static let download = NSLocalizedString("Download", comment: comment)
|
||||
@ -295,6 +301,11 @@ class BookDetailController: UITableViewController, DZNEmptyDataSetSource, DZNEmp
|
||||
static let language = NSLocalizedString("Language", comment: comment)
|
||||
static let creator = NSLocalizedString("Creator", comment: comment)
|
||||
static let publisher = NSLocalizedString("Publisher", comment: comment)
|
||||
static let index = NSLocalizedString("Index", comment: comment)
|
||||
|
||||
static let none = NSLocalizedString("None", comment: comment)
|
||||
static let embedded = NSLocalizedString("Embedded", comment: comment)
|
||||
static let external = NSLocalizedString("External", comment: comment)
|
||||
|
||||
static let pid = NSLocalizedString("Persistent ID", comment: comment)
|
||||
static let pidNote = NSLocalizedString("This ID does not change in different versions of the same book.", comment: comment)
|
||||
|
@ -49,7 +49,7 @@
|
||||
</dict>
|
||||
</array>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.8.1211</string>
|
||||
<string>1.8.1249</string>
|
||||
<key>ITSAppUsesNonExemptEncryption</key>
|
||||
<false/>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
|
@ -155,13 +155,6 @@
|
||||
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="FxJ-Aa-5Pk">
|
||||
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="13" id="JEt-Ru-hK6"/>
|
||||
<constraint firstAttribute="width" constant="10" id="gY9-B0-Fnc"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<label hidden="YES" opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="P" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="HJc-XE-GVe">
|
||||
<color key="backgroundColor" red="0.66666666666666663" green="0.66666666666666663" blue="0.66666666666666663" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<constraints>
|
||||
@ -177,21 +170,6 @@
|
||||
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label hidden="YES" opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="I" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="JQU-Gb-xqS">
|
||||
<color key="backgroundColor" red="0.66666666666666663" green="0.66666666666666663" blue="0.66666666666666663" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="13" id="Vas-0R-Wil"/>
|
||||
<constraint firstAttribute="width" constant="13" id="rIh-7j-6mY"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="11"/>
|
||||
<color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label hidden="YES" opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="yJh-4P-l8s">
|
||||
<fontDescription key="fontDescription" type="system" pointSize="14"/>
|
||||
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="vSn-bw-OUc">
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="44" id="9k1-yP-9Cx"/>
|
||||
@ -201,21 +179,15 @@
|
||||
</subviews>
|
||||
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<constraints>
|
||||
<constraint firstItem="FxJ-Aa-5Pk" firstAttribute="leading" secondItem="fEt-eR-ago" secondAttribute="trailing" constant="2" id="2yd-GZ-OCp"/>
|
||||
<constraint firstAttribute="trailing" secondItem="4e2-XW-fS5" secondAttribute="trailing" constant="60" id="5RV-Re-G6u"/>
|
||||
<constraint firstItem="FxJ-Aa-5Pk" firstAttribute="top" secondItem="4e2-XW-fS5" secondAttribute="bottom" constant="4" id="71o-Ca-P9X"/>
|
||||
<constraint firstItem="JQU-Gb-xqS" firstAttribute="centerY" secondItem="FxJ-Aa-5Pk" secondAttribute="centerY" id="7Ll-MR-EtC"/>
|
||||
<constraint firstItem="4e2-XW-fS5" firstAttribute="leading" secondItem="vSn-bw-OUc" secondAttribute="trailing" constant="8" id="C3D-hA-EFf"/>
|
||||
<constraint firstItem="fEt-eR-ago" firstAttribute="leading" secondItem="HJc-XE-GVe" secondAttribute="trailing" constant="2.5" id="Sp7-bB-IwY"/>
|
||||
<constraint firstItem="fEt-eR-ago" firstAttribute="centerY" secondItem="FxJ-Aa-5Pk" secondAttribute="centerY" id="edK-jm-Q1f"/>
|
||||
<constraint firstItem="yJh-4P-l8s" firstAttribute="centerY" secondItem="JQU-Gb-xqS" secondAttribute="centerY" id="fnQ-CU-vOb"/>
|
||||
<constraint firstItem="HJc-XE-GVe" firstAttribute="centerY" secondItem="fEt-eR-ago" secondAttribute="centerY" id="lm2-XF-U29"/>
|
||||
<constraint firstItem="JQU-Gb-xqS" firstAttribute="leading" secondItem="FxJ-Aa-5Pk" secondAttribute="trailing" constant="2" id="naO-NP-qyM"/>
|
||||
<constraint firstItem="fEt-eR-ago" firstAttribute="top" secondItem="4e2-XW-fS5" secondAttribute="bottom" constant="2" id="mty-r0-zh5"/>
|
||||
<constraint firstItem="4e2-XW-fS5" firstAttribute="top" secondItem="xW2-eb-wOa" secondAttribute="top" constant="16" id="qmA-Nb-RFY"/>
|
||||
<constraint firstItem="vSn-bw-OUc" firstAttribute="leading" secondItem="xW2-eb-wOa" secondAttribute="leading" constant="8" id="rOL-t3-qNG"/>
|
||||
<constraint firstItem="yJh-4P-l8s" firstAttribute="leading" secondItem="JQU-Gb-xqS" secondAttribute="trailing" constant="2" id="s0x-bK-qks"/>
|
||||
<constraint firstItem="vSn-bw-OUc" firstAttribute="top" secondItem="xW2-eb-wOa" secondAttribute="top" constant="20" id="ubP-iG-piZ"/>
|
||||
<constraint firstItem="FxJ-Aa-5Pk" firstAttribute="centerX" secondItem="xW2-eb-wOa" secondAttribute="centerX" constant="10" id="wDl-Hb-oK4"/>
|
||||
<constraint firstItem="fEt-eR-ago" firstAttribute="centerX" secondItem="xW2-eb-wOa" secondAttribute="centerX" constant="6" id="z11-dR-UXi"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<prototypes>
|
||||
@ -337,8 +309,6 @@
|
||||
<navigationItem key="navigationItem" id="BcQ-LZ-SEM"/>
|
||||
<connections>
|
||||
<outlet property="favIconImageView" destination="vSn-bw-OUc" id="Bp4-vZ-ArU"/>
|
||||
<outlet property="hasIndexIndicator" destination="JQU-Gb-xqS" id="XqK-s5-UXe"/>
|
||||
<outlet property="hasIndexLabel" destination="yJh-4P-l8s" id="u74-JG-tnh"/>
|
||||
<outlet property="hasPicIndicator" destination="HJc-XE-GVe" id="nXH-vm-kZ2"/>
|
||||
<outlet property="hasPicLabel" destination="fEt-eR-ago" id="QVd-5h-ouQ"/>
|
||||
<outlet property="titleLabel" destination="4e2-XW-fS5" id="fQS-5f-4VT"/>
|
||||
|
@ -21,7 +21,7 @@
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.8.1215</string>
|
||||
<string>1.8.1253</string>
|
||||
<key>NSExtension</key>
|
||||
<dict>
|
||||
<key>NSExtensionMainStoryboard</key>
|
||||
|
@ -56,7 +56,7 @@
|
||||
moduleName = "Kiwix"
|
||||
usesParentBreakpointCondition = "Yes"
|
||||
urlString = "file:///Volumes/Data/Developer/Kiwix/Kiwix/Operations/BookmarkMigrationOperation.swift"
|
||||
timestampString = "496693865.757662"
|
||||
timestampString = "496704126.923131"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "27"
|
||||
@ -71,7 +71,7 @@
|
||||
moduleName = "Kiwix"
|
||||
usesParentBreakpointCondition = "Yes"
|
||||
urlString = "file:///Volumes/Data/Developer/Kiwix/Kiwix/Operations/BookmarkMigrationOperation.swift"
|
||||
timestampString = "496693865.758711"
|
||||
timestampString = "496704126.924306"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "27"
|
||||
|
Loading…
x
Reference in New Issue
Block a user