This commit is contained in:
Chris Li 2016-08-30 10:40:06 -04:00
parent 9879fae22a
commit 6b98031f88
5 changed files with 37 additions and 33 deletions

View File

@ -30,6 +30,8 @@ class BookDetailController: UITableViewController, CenterButtonCellDelegate, DZN
tableView.emptyDataSetSource = self
tableView.emptyDataSetDelegate = self
tableView.tableFooterView = UIView()
tableView.estimatedRowHeight = 44.0
tableView.rowHeight = UITableViewAutomaticDimension
hasPicIndicator.layer.cornerRadius = 2.0
hasIndexIndicator.layer.cornerRadius = 2.0
@ -70,11 +72,14 @@ class BookDetailController: UITableViewController, CenterButtonCellDelegate, DZN
cellTitles.append([Strings.remove])
}
cellTitles.append([Strings.size, Strings.createDate, Strings.arcitleCount, Strings.language, Strings.creator, Strings.publisher])
if let _ = book.url { cellTitles.append([Strings.copyURL]) }
}
// MARK: - Delegates
func buttonTapped(cell: CenterButtonCell) {
guard let title = cell.button.titleLabel?.text,
let book = book else {return}
@ -96,6 +101,12 @@ class BookDetailController: UITableViewController, CenterButtonCellDelegate, DZN
} else {
startDownload()
}
case Strings.copyURL:
guard let url = book.url else {return}
UIPasteboard.generalPasteboard().string = url.absoluteString
let action = UIAlertAction(title: LocalizedStrings.Common.ok, style: .Cancel, handler: nil)
let alert = UIAlertController(title: Strings.CopyURLAlert.succeed, message: "", actions: [action])
presentViewController(alert, animated: true, completion: nil)
default:
return
}
@ -128,6 +139,11 @@ class BookDetailController: UITableViewController, CenterButtonCellDelegate, DZN
if book?.spaceState == .Caution { cell.button.tintColor = UIColor.orangeColor() }
}
return cell
case Strings.copyURL:
let cell = tableView.dequeueReusableCellWithIdentifier("CenterButtonCell", forIndexPath: indexPath) as! CenterButtonCell
cell.button.setTitle(title, forState: .Normal)
cell.delegate = self
return cell
default:
let cell = tableView.dequeueReusableCellWithIdentifier("RightDetailCell", forIndexPath: indexPath)
cell.textLabel?.text = title
@ -149,12 +165,6 @@ class BookDetailController: UITableViewController, CenterButtonCellDelegate, DZN
}
return cell
}
// case (0,2):
// let cell = tableView.dequeueReusableCellWithIdentifier("TextSwitchCell", forIndexPath: indexPath) as! TextSwitchCell
// cell.titleLabel.text = NSLocalizedString("Updates Automatically", comment: LocalizedStrings.BookDetail.comment)
// return cell
}
override func tableView(tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
@ -207,6 +217,13 @@ extension LocalizedStrings {
static let creator = NSLocalizedString("Creator", comment: comment)
static let publisher = NSLocalizedString("Publisher", comment: comment)
static let copyURL = NSLocalizedString("Copy URL", comment: comment)
class CopyURLAlert {
private static let comment = "Library, Book Detail, Copy URL Alert"
static let succeed = NSLocalizedString("URL Copied Successfully", comment: comment)
}
class SpaceAlert {
private static let comment = "Library, Book Detail, Space Alert"
static let downloadAnyway = NSLocalizedString("Download Anyway", comment: comment)

View File

@ -49,7 +49,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>1.7.1576</string>
<string>1.7.1591</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSRequiresIPhoneOS</key>

View File

@ -219,7 +219,7 @@
</view>
<prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" reuseIdentifier="RightDetailCell" textLabel="iyO-rf-lDN" detailTextLabel="iHv-oK-qrR" style="IBUITableViewCellStyleValue1" id="eB8-dt-BPR">
<rect key="frame" x="0.0" y="184.5" width="375" height="44"/>
<rect key="frame" x="0.0" y="185" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="eB8-dt-BPR" id="KR4-kV-SZd">
<frame key="frameInset" width="375" height="43.5"/>
@ -243,13 +243,16 @@
</tableViewCellContentView>
</tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" reuseIdentifier="CenterButtonCell" id="B0D-Hu-sVM" customClass="CenterButtonCell" customModule="Kiwix" customModuleProvider="target">
<rect key="frame" x="0.0" y="228.5" width="375" height="44"/>
<rect key="frame" x="0.0" y="229" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="B0D-Hu-sVM" id="Fhf-jb-Urf">
<frame key="frameInset" width="375" height="43.5"/>
<frame key="frameInset" width="375" height="43"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="TLs-eg-B0R">
<constraints>
<constraint firstAttribute="height" constant="44" id="K1j-tL-2bu"/>
</constraints>
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="15"/>
<state key="normal" title="Button"/>
<connections>
@ -268,7 +271,7 @@
</connections>
</tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" reuseIdentifier="TextSwitchCell" id="c4v-9p-eEF" customClass="TextSwitchCell" customModule="Kiwix" customModuleProvider="target">
<rect key="frame" x="0.0" y="272.5" width="375" height="44"/>
<rect key="frame" x="0.0" y="273" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="c4v-9p-eEF" id="Lt6-0C-r4i">
<frame key="frameInset" width="375" height="43.5"/>
@ -294,23 +297,6 @@
<outlet property="titleLabel" destination="Ksx-E1-lZ2" id="2c2-zU-Ekv"/>
</connections>
</tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" reuseIdentifier="DescCell" textLabel="noJ-ab-bVV" style="IBUITableViewCellStyleDefault" id="J0v-iU-gZ5">
<rect key="frame" x="0.0" y="316.5" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="J0v-iU-gZ5" id="bXv-ic-E7x">
<frame key="frameInset" width="375" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Title" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="noJ-ab-bVV">
<frame key="frameInset" minX="15" width="345" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<fontDescription key="fontDescription" style="UICTFontTextStyleSubhead"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
</tableViewCellContentView>
</tableViewCell>
</prototypes>
<connections>
<outlet property="dataSource" destination="baD-NX-PQT" id="euZ-wN-6yy"/>
@ -699,6 +685,6 @@
</scene>
</scenes>
<inferredMetricsTieBreakers>
<segue reference="eUy-Zq-fkw"/>
<segue reference="G7C-gQ-hOd"/>
</inferredMetricsTieBreakers>
</document>

View File

@ -21,7 +21,7 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.7.1983</string>
<string>1.7.2010</string>
<key>NSExtension</key>
<dict>
<key>NSExtensionMainStoryboard</key>

View File

@ -72,7 +72,8 @@ class LocalizedStrings {
class Common {
private static let comment = "Common"
static let cancel = "Cancel"
static let cancel = NSLocalizedString("Cancel", comment: "Basic")
static let ok = NSLocalizedString("OK", comment: "Basic")
}
class LibraryTabTitle {