mirror of
https://github.com/zhigang1992/GitHawk.git
synced 2026-04-23 19:50:19 +08:00
Open accounts in detail on iPad (#648)
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12121" systemVersion="16G29" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="d42-bu-Upj">
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13196" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="d42-bu-Upj">
|
||||
<device id="retina4_7" orientation="portrait">
|
||||
<adaptation id="fullscreen"/>
|
||||
</device>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12089"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13174"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
@@ -81,9 +81,6 @@
|
||||
</subviews>
|
||||
</tableViewCellContentView>
|
||||
<inset key="separatorInset" minX="16" minY="0.0" maxX="0.0" maxY="0.0"/>
|
||||
<connections>
|
||||
<segue destination="Pin-sZ-TSO" kind="show" id="v7n-Wc-t3h"/>
|
||||
</connections>
|
||||
</tableViewCell>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" id="x9n-2O-buf">
|
||||
<rect key="frame" x="0.0" y="143.5" width="375" height="44"/>
|
||||
@@ -295,7 +292,7 @@
|
||||
</tableView>
|
||||
<navigationItem key="navigationItem" title="Settings" id="fVs-Zg-aE3"/>
|
||||
<connections>
|
||||
<outlet property="accountsCell" destination="64O-sw-wTx" id="Erb-Qs-t0m"/>
|
||||
<outlet property="accountsCell" destination="64O-sw-wTx" id="UPX-Wa-mYM"/>
|
||||
<outlet property="apiStatusLabel" destination="rIC-a2-0GF" id="ceC-Ij-CrY"/>
|
||||
<outlet property="apiStatusView" destination="1mP-Dr-7rt" id="f66-HG-AkG"/>
|
||||
<outlet property="backgroundFetchSwitch" destination="FvK-93-raA" id="Huy-vc-MoM"/>
|
||||
@@ -332,7 +329,7 @@
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="username" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="ASM-DA-gBk">
|
||||
<rect key="frame" x="15" y="0.0" width="345" height="43.5"/>
|
||||
<rect key="frame" x="16" y="0.0" width="344" height="43.5"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="16"/>
|
||||
<nil key="textColor"/>
|
||||
@@ -358,7 +355,7 @@
|
||||
</tableViewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="YHM-PS-ThT" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="-90" y="-131"/>
|
||||
<point key="canvasLocation" x="862" y="-132"/>
|
||||
</scene>
|
||||
<!--Navigation Controller-->
|
||||
<scene sceneID="D9x-gg-9aE">
|
||||
@@ -376,5 +373,23 @@
|
||||
</objects>
|
||||
<point key="canvasLocation" x="-1721" y="-130"/>
|
||||
</scene>
|
||||
<!--Navigation Controller-->
|
||||
<scene sceneID="Ad5-42-Gd9">
|
||||
<objects>
|
||||
<navigationController storyboardIdentifier="accountsNavigationController" automaticallyAdjustsScrollViewInsets="NO" id="ws0-Mr-B4Z" sceneMemberID="viewController">
|
||||
<toolbarItems/>
|
||||
<navigationBar key="navigationBar" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" id="igk-Sw-tO3">
|
||||
<rect key="frame" x="0.0" y="20" width="375" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
</navigationBar>
|
||||
<nil name="viewControllers"/>
|
||||
<connections>
|
||||
<segue destination="Pin-sZ-TSO" kind="relationship" relationship="rootViewController" id="Q8A-y1-sOr"/>
|
||||
</connections>
|
||||
</navigationController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="OVs-04-lfm" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="57" y="-131"/>
|
||||
</scene>
|
||||
</scenes>
|
||||
</document>
|
||||
|
||||
@@ -18,6 +18,11 @@ final class SettingsAccountsViewController: UITableViewController, GithubSession
|
||||
}
|
||||
}
|
||||
private var userSessions = [GithubUserSession]()
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
title = NSLocalizedString("Accounts", comment: "")
|
||||
}
|
||||
|
||||
// MARK: Private API
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ NewIssueTableViewControllerDelegate {
|
||||
NotificationCenter.default.addObserver(
|
||||
self,
|
||||
selector: #selector(SettingsViewController.updateBadge),
|
||||
name: NSNotification.Name.UIApplicationDidBecomeActive,
|
||||
name: .UIApplicationDidBecomeActive,
|
||||
object: nil
|
||||
)
|
||||
}
|
||||
@@ -60,28 +60,24 @@ NewIssueTableViewControllerDelegate {
|
||||
}
|
||||
}
|
||||
|
||||
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
|
||||
if let controller = segue.destination as? SettingsAccountsViewController,
|
||||
let client = self.client {
|
||||
controller.client = client
|
||||
controller.sessionManager = sessionManager
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: UITableViewDelegate
|
||||
|
||||
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
|
||||
func deselectRow() { tableView.deselectRow(at: indexPath, animated: true) }
|
||||
let cell = tableView.cellForRow(at: indexPath)
|
||||
|
||||
if cell === reviewAccessCell {
|
||||
onReviewAccess()
|
||||
} else if cell === accountsCell {
|
||||
deselectRow()
|
||||
onAccounts()
|
||||
} else if cell === reportBugCell {
|
||||
tableView.deselectRow(at: indexPath, animated: true)
|
||||
deselectRow()
|
||||
onReportBug()
|
||||
} else if cell === viewSourceCell {
|
||||
onViewSource()
|
||||
} else if cell === signOutCell {
|
||||
tableView.deselectRow(at: indexPath, animated: true)
|
||||
deselectRow()
|
||||
onSignOut()
|
||||
}
|
||||
}
|
||||
@@ -93,6 +89,16 @@ NewIssueTableViewControllerDelegate {
|
||||
else { fatalError("Should always create GitHub issue URL") }
|
||||
presentSafari(url: url)
|
||||
}
|
||||
|
||||
func onAccounts() {
|
||||
if let navigationController = UIStoryboard(name: "Settings", bundle: nil).instantiateViewController(withIdentifier: "accountsNavigationController") as? UINavigationController,
|
||||
let accountsController = navigationController.topViewController as? SettingsAccountsViewController,
|
||||
let client = self.client {
|
||||
accountsController.client = client
|
||||
accountsController.sessionManager = sessionManager
|
||||
self.navigationController?.showDetailViewController(navigationController, sender: self)
|
||||
}
|
||||
}
|
||||
|
||||
func onReportBug() {
|
||||
guard let client = client,
|
||||
@@ -172,7 +178,7 @@ NewIssueTableViewControllerDelegate {
|
||||
|
||||
@IBAction func onSettings(_ sender: Any) {
|
||||
guard let url = URL(string: UIApplicationOpenSettingsURLString) else { return }
|
||||
UIApplication.shared.open(url, options: [:], completionHandler: nil)
|
||||
UIApplication.shared.open(url)
|
||||
}
|
||||
|
||||
@IBAction func onMarkRead(_ sender: Any) {
|
||||
|
||||
Reference in New Issue
Block a user