From c9a700c777238b16d1db6731efcdad8b47955120 Mon Sep 17 00:00:00 2001 From: Dwayne Harris Date: Mon, 26 Nov 2018 00:18:03 -0800 Subject: [PATCH] Misc changes --- elpha-ios.xcodeproj/project.pbxproj | 10 ++- .../AbstractStatusTableViewController.swift | 2 +- elpha-ios/AccountTableViewController.swift | 84 +++++++++++-------- elpha-ios/Base.lproj/Main.storyboard | 39 +++++---- elpha-ios/SettingsTableViewController.swift | 20 +++-- elpha-ios/StatusTableViewController.swift | 39 +++++---- elpha-ios/StatusView.swift | 25 +++--- elpha-ios/StatusView.xib | 48 +++++------ 8 files changed, 155 insertions(+), 112 deletions(-) diff --git a/elpha-ios.xcodeproj/project.pbxproj b/elpha-ios.xcodeproj/project.pbxproj index 9a721f2..3277f0e 100644 --- a/elpha-ios.xcodeproj/project.pbxproj +++ b/elpha-ios.xcodeproj/project.pbxproj @@ -351,6 +351,14 @@ name = "Abstract View Controllers"; sourceTree = ""; }; + 1562EEB121AB46DF003A2DCD /* Views */ = { + isa = PBXGroup; + children = ( + 15CF7243219282AF00E6BF19 /* UITextViewFixed.swift */, + ); + name = Views; + sourceTree = ""; + }; 15637095219FE22E00D51D42 /* Products */ = { isa = PBXGroup; children = ( @@ -423,7 +431,6 @@ 15960E6E21321FA500C38CE9 /* Elpha.xcdatamodeld */, 15960E5A213145E100C38CE9 /* AppDelegate.swift */, 15960E7621322C6F00C38CE9 /* Configuration.swift */, - 15CF7243219282AF00E6BF19 /* UITextViewFixed.swift */, 156FF05621779C140074D9CA /* API */, 151AD4AF2166DDA000F07403 /* Extensions */, 15960E7121322B9F00C38CE9 /* Keychain Helper */, @@ -433,6 +440,7 @@ 152FBCE4219789450079B3E8 /* Abstract View Controllers */, 15960E782132383600C38CE9 /* View Controllers */, 151AD4AE2166DD3500F07403 /* Table View Cells */, + 1562EEB121AB46DF003A2DCD /* Views */, ); path = "elpha-ios"; sourceTree = ""; diff --git a/elpha-ios/AbstractStatusTableViewController.swift b/elpha-ios/AbstractStatusTableViewController.swift index 37e68a7..2f00ca7 100644 --- a/elpha-ios/AbstractStatusTableViewController.swift +++ b/elpha-ios/AbstractStatusTableViewController.swift @@ -94,7 +94,7 @@ class AbstractStatusTableViewController: UITableViewController, StatusViewDelega } cell.statusView.update(withStatus: status) - cell.statusView.topDividerView.isHidden = indexPath.row == 0 + cell.statusView.topDividerView.isHidden = false cell.statusView.topLoadMoreView.isHidden = true cell.statusView.bottomLoadMoreView.isHidden = true diff --git a/elpha-ios/AccountTableViewController.swift b/elpha-ios/AccountTableViewController.swift index 56dd52d..7ef5871 100644 --- a/elpha-ios/AccountTableViewController.swift +++ b/elpha-ios/AccountTableViewController.swift @@ -110,6 +110,8 @@ class AccountTableViewController: AbstractStatusTableViewController { if let account = account { updateHeader(withAccount: account) + sizeHeaderToFit() + initializeFetchedResultsController() } } @@ -135,6 +137,20 @@ class AccountTableViewController: AbstractStatusTableViewController { } } + override func viewDidLayoutSubviews() { + super.viewDidLayoutSubviews() + sizeHeaderToFit() + } + + private func sizeHeaderToFit() { + headerView.setNeedsLayout() + headerView.layoutIfNeeded() + +// var frame = headerView.frame +// frame.size.height = headerView.systemLayoutSizeFitting(UIView.layoutFittingCompressedSize).height +// headerView.frame = frame + } + private func updateHeader(withAccount account: AccountMO) { navigationItem.title = account.displayName @@ -158,7 +174,7 @@ class AccountTableViewController: AbstractStatusTableViewController { followingLabel.text = NumberFormatter.localizedString(from: NSNumber(value: account.followingCount), number: .decimal) followersLabel.text = NumberFormatter.localizedString(from: NSNumber(value: account.followersCount), number: .decimal) - if let fields = account.fields { + if let fields = account.fields, fields.count > 0 { fieldTableViewController!.fields = fields fieldTableView.dataSource = fieldTableViewController @@ -255,33 +271,33 @@ class AccountTableViewController: AbstractStatusTableViewController { } switch statusTypeSegmentedControl.selectedSegmentIndex { - case 1: - MastodonAPI.statuses( - accountID: account.id!, - onlyMedia: false, - excludeReplies: false, - limit: fetchLimit, - pagination: pagination, - completion: requestCompletion - ) - case 2: - MastodonAPI.statuses( - accountID: account.id!, - onlyMedia: true, - excludeReplies: true, - limit: fetchLimit, - pagination: pagination, - completion: requestCompletion - ) - default: - MastodonAPI.statuses( - accountID: account.id!, - onlyMedia: false, - excludeReplies: true, - limit: fetchLimit, - pagination: pagination, - completion: requestCompletion - ) + case 1: + MastodonAPI.statuses( + accountID: account.id!, + onlyMedia: false, + excludeReplies: false, + limit: fetchLimit, + pagination: pagination, + completion: requestCompletion + ) + case 2: + MastodonAPI.statuses( + accountID: account.id!, + onlyMedia: true, + excludeReplies: true, + limit: fetchLimit, + pagination: pagination, + completion: requestCompletion + ) + default: + MastodonAPI.statuses( + accountID: account.id!, + onlyMedia: false, + excludeReplies: true, + limit: fetchLimit, + pagination: pagination, + completion: requestCompletion + ) } } } @@ -297,12 +313,12 @@ extension AccountTableViewController: NSFetchedResultsControllerDelegate { ] switch statusTypeSegmentedControl.selectedSegmentIndex { - case 1: - request.predicate = NSPredicate(format: "account == %@", account) - case 2: - request.predicate = NSPredicate(format: "account == %@ AND attachments.@count > 0", account) - default: - request.predicate = NSPredicate(format: "account == %@ AND inReplyToID == nil", account) + case 1: + request.predicate = NSPredicate(format: "account == %@", account) + case 2: + request.predicate = NSPredicate(format: "account == %@ AND attachments.@count > 0", account) + default: + request.predicate = NSPredicate(format: "account == %@ AND inReplyToID == nil", account) } fetchedResultsController = NSFetchedResultsController( diff --git a/elpha-ios/Base.lproj/Main.storyboard b/elpha-ios/Base.lproj/Main.storyboard index b742625..54bd984 100644 --- a/elpha-ios/Base.lproj/Main.storyboard +++ b/elpha-ios/Base.lproj/Main.storyboard @@ -484,10 +484,10 @@ - - + + - + @@ -513,7 +513,7 @@ - + - + - + - + + + + @@ -603,10 +606,10 @@ - + - + @@ -615,7 +618,7 @@ - + @@ -696,7 +699,7 @@ - + @@ -900,7 +903,7 @@ - + @@ -930,7 +933,7 @@ - + @@ -951,7 +954,7 @@ - + @@ -1425,10 +1428,10 @@ - + - + @@ -1445,8 +1448,8 @@ - - + - - + - - +