From a4ffb1f94b70a6c084a1b06a927f68130740a87a Mon Sep 17 00:00:00 2001 From: Dwayne Harris Date: Wed, 19 Aug 2020 15:51:30 -0400 Subject: [PATCH] WIP --- Frameworks/Alamofire | 2 +- elpha-ios.xcodeproj/project.pbxproj | 16 ++ .../AbstractStatusTableViewController.swift | 2 +- elpha-ios/AccountSearchTableViewCell.swift | 15 + elpha-ios/AccountTableViewController.swift | 16 +- elpha-ios/AlertManager.swift | 2 +- elpha-ios/AppDelegate.swift | 5 + .../Icons/Search.imageset/Contents.json | 12 + .../Icons/Search.imageset/search.pdf | Bin 0 -> 3906 bytes elpha-ios/AttachmentsView.swift | 29 +- elpha-ios/AttachmentsView.xib | 2 +- elpha-ios/Base.lproj/Main.storyboard | 264 +++++++++++++++--- elpha-ios/ComposeViewController.swift | 6 +- .../Elpha.xcdatamodel/contents | 3 +- elpha-ios/HashtagSearchTableViewCell.swift | 13 + elpha-ios/InstancesDataManager.swift | 3 - elpha-ios/MastodonDataManager.swift | 1 + elpha-ios/SearchTableViewController.swift | 147 ++++++++++ elpha-ios/StatusSearchTableViewCell.swift | 13 + elpha-ios/StatusTableViewController.swift | 24 +- elpha-ios/StatusView.swift | 10 +- elpha-ios/StatusView.xib | 6 +- elpha-ios/TimelineTableViewController.swift | 45 +-- elpha-ios/TimelinesViewController.swift | 4 +- 24 files changed, 537 insertions(+), 103 deletions(-) create mode 100644 elpha-ios/AccountSearchTableViewCell.swift create mode 100644 elpha-ios/Assets.xcassets/Icons/Search.imageset/Contents.json create mode 100644 elpha-ios/Assets.xcassets/Icons/Search.imageset/search.pdf create mode 100644 elpha-ios/HashtagSearchTableViewCell.swift create mode 100644 elpha-ios/SearchTableViewController.swift create mode 100644 elpha-ios/StatusSearchTableViewCell.swift diff --git a/Frameworks/Alamofire b/Frameworks/Alamofire index 61a780f..32573d0 160000 --- a/Frameworks/Alamofire +++ b/Frameworks/Alamofire @@ -1 +1 @@ -Subproject commit 61a780f3b58ee0d2bb76fdb7b89dbc9751d521d7 +Subproject commit 32573d05b91d8b7349ca31b4726e80212483f02a diff --git a/elpha-ios.xcodeproj/project.pbxproj b/elpha-ios.xcodeproj/project.pbxproj index acc9ab2..2708f85 100644 --- a/elpha-ios.xcodeproj/project.pbxproj +++ b/elpha-ios.xcodeproj/project.pbxproj @@ -27,6 +27,10 @@ 153418A221A0EEAC002F5F8A /* AttachmentInputView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 153418A121A0EEAC002F5F8A /* AttachmentInputView.swift */; }; 153418A421A0EEED002F5F8A /* AttachmentInputView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 153418A321A0EEED002F5F8A /* AttachmentInputView.xib */; }; 1539509121894A38009BA6E7 /* AlertManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1539509021894A38009BA6E7 /* AlertManager.swift */; }; + 153C2BAA21B1DAA1009414C2 /* SearchTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 153C2BA921B1DAA1009414C2 /* SearchTableViewController.swift */; }; + 153C2BB921B1ED09009414C2 /* AccountSearchTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 153C2BB821B1ED09009414C2 /* AccountSearchTableViewCell.swift */; }; + 153C2BBB21B1EEC9009414C2 /* StatusSearchTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 153C2BBA21B1EEC9009414C2 /* StatusSearchTableViewCell.swift */; }; + 153C2BBD21B1EEE3009414C2 /* HashtagSearchTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 153C2BBC21B1EEE3009414C2 /* HashtagSearchTableViewCell.swift */; }; 1564316521A15B2E00816382 /* Alamofire.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 157405C3215890BC00EEAAEB /* Alamofire.framework */; }; 1564316621A15B2E00816382 /* Alamofire.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 157405C3215890BC00EEAAEB /* Alamofire.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 1564316E21A15B5400816382 /* Kingfisher.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 156370B0219FE22E00D51D42 /* Kingfisher.framework */; }; @@ -226,6 +230,10 @@ 153418A121A0EEAC002F5F8A /* AttachmentInputView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AttachmentInputView.swift; sourceTree = ""; }; 153418A321A0EEED002F5F8A /* AttachmentInputView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = AttachmentInputView.xib; sourceTree = ""; }; 1539509021894A38009BA6E7 /* AlertManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AlertManager.swift; sourceTree = ""; }; + 153C2BA921B1DAA1009414C2 /* SearchTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchTableViewController.swift; sourceTree = ""; }; + 153C2BB821B1ED09009414C2 /* AccountSearchTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountSearchTableViewCell.swift; sourceTree = ""; }; + 153C2BBA21B1EEC9009414C2 /* StatusSearchTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StatusSearchTableViewCell.swift; sourceTree = ""; }; + 153C2BBC21B1EEE3009414C2 /* HashtagSearchTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HashtagSearchTableViewCell.swift; sourceTree = ""; }; 15637094219FE22E00D51D42 /* Kingfisher.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = Kingfisher.xcodeproj; path = Frameworks/Kingfisher/Kingfisher.xcodeproj; sourceTree = ""; }; 1569029F219A7D75002BF61F /* ComposeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ComposeViewController.swift; sourceTree = ""; }; 156FF014217289380074D9CA /* AccountTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountTableViewCell.swift; sourceTree = ""; }; @@ -332,10 +340,13 @@ 151AD4AE2166DD3500F07403 /* Table View Cells */ = { isa = PBXGroup; children = ( + 153C2BB821B1ED09009414C2 /* AccountSearchTableViewCell.swift */, 156FF014217289380074D9CA /* AccountTableViewCell.swift */, 152FBCF1219818AD0079B3E8 /* FieldTableViewCell.swift */, + 153C2BBC21B1EEE3009414C2 /* HashtagSearchTableViewCell.swift */, 159048AE214F5015004F4014 /* InstancesTableViewCell.swift */, 156FF04E2175CDBC0074D9CA /* MainStatusTableViewCell.swift */, + 153C2BBA21B1EEC9009414C2 /* StatusSearchTableViewCell.swift */, 156FF050217683270074D9CA /* StatusTableViewCell.swift */, 15BB72AA2171A8D4002F1FA4 /* TimelinesTableViewCell.swift */, 159026AD2162CF5600D362DD /* TimelineTableViewCell.swift */, @@ -479,6 +490,7 @@ 15960E83213774FC00C38CE9 /* InstancesTableViewController.swift */, 157405A72150588A00EEAAEB /* InstanceViewController.swift */, 15960E792132387A00C38CE9 /* MainTabBarController.swift */, + 153C2BA921B1DAA1009414C2 /* SearchTableViewController.swift */, 1506C57F2199709200EFB483 /* SettingsTableViewController.swift */, 156FF0302174797E0074D9CA /* StatusTableViewController.swift */, 15960E812136668500C38CE9 /* TimelinesNavigationController.swift */, @@ -706,6 +718,7 @@ 156FF0312174797E0074D9CA /* StatusTableViewController.swift in Sources */, 152FB0F8218ADC1A001D6574 /* AttachmentPageViewController.swift in Sources */, 15131EF4216DB8B90092B252 /* AccountTableViewController.swift in Sources */, + 153C2BBD21B1EEE3009414C2 /* HashtagSearchTableViewCell.swift in Sources */, 1534189E21A0E19F002F5F8A /* VisibilityInputView.swift in Sources */, 156902A0219A7D75002BF61F /* ComposeViewController.swift in Sources */, 15F998352162C0E8009E58DA /* MastodonDataManager.swift in Sources */, @@ -725,6 +738,7 @@ 15960E7721322C6F00C38CE9 /* Configuration.swift in Sources */, 156FF07021779C570074D9CA /* MastodonAPI.swift in Sources */, 15341866219FF29D002F5F8A /* SettingsManager.swift in Sources */, + 153C2BAA21B1DAA1009414C2 /* SearchTableViewController.swift in Sources */, 15A9AFE721AFA243008789E8 /* AttachmentsView.swift in Sources */, 15C91A04216AB32500D97DC3 /* AlertView.swift in Sources */, 15131EF6216DBA820092B252 /* AccountNavigationController.swift in Sources */, @@ -735,6 +749,8 @@ 156FF051217683270074D9CA /* StatusTableViewCell.swift in Sources */, 159026D02163069600D362DD /* Date+TimeAgo.swift in Sources */, 152FBCD2219682E80079B3E8 /* AbstractStatusTableViewController.swift in Sources */, + 153C2BB921B1ED09009414C2 /* AccountSearchTableViewCell.swift in Sources */, + 153C2BBB21B1EEC9009414C2 /* StatusSearchTableViewCell.swift in Sources */, 15A79B43215EB959007A326E /* CoreDataManager.swift in Sources */, 15BB72AB2171A8D4002F1FA4 /* TimelinesTableViewCell.swift in Sources */, 156FF015217289380074D9CA /* AccountTableViewCell.swift in Sources */, diff --git a/elpha-ios/AbstractStatusTableViewController.swift b/elpha-ios/AbstractStatusTableViewController.swift index 0732c8e..6672117 100644 --- a/elpha-ios/AbstractStatusTableViewController.swift +++ b/elpha-ios/AbstractStatusTableViewController.swift @@ -105,7 +105,7 @@ class AbstractStatusTableViewController: UITableViewController, StatusViewDelega } cell.statusView.update(withStatus: status) - cell.statusView.topDividerView.isHidden = false + cell.statusView.topDividerView.isHidden = indexPath.row == 0 cell.statusView.topLoadMoreView.isHidden = true cell.statusView.bottomLoadMoreView.isHidden = true diff --git a/elpha-ios/AccountSearchTableViewCell.swift b/elpha-ios/AccountSearchTableViewCell.swift new file mode 100644 index 0000000..5eb8e0f --- /dev/null +++ b/elpha-ios/AccountSearchTableViewCell.swift @@ -0,0 +1,15 @@ +// +// AccountSearchTableViewCell.swift +// elpha-ios +// +// Created by Dwayne Harris on 11/30/18. +// Copyright © 2018 Elpha. All rights reserved. +// + +import UIKit + +class AccountSearchTableViewCell: UITableViewCell { + @IBOutlet var avatarImageView: UIImageView! + @IBOutlet var displayNameLabel: UILabel! + @IBOutlet var usernameLabel: UILabel! +} diff --git a/elpha-ios/AccountTableViewController.swift b/elpha-ios/AccountTableViewController.swift index 04663ab..7402bc4 100644 --- a/elpha-ios/AccountTableViewController.swift +++ b/elpha-ios/AccountTableViewController.swift @@ -375,15 +375,15 @@ extension AccountTableViewController: NSFetchedResultsControllerDelegate { return 1 } - override func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) { - if let cell = cell as? AccountTableViewCell { - CellHeightManager.set(status: cell.statusView.status, height: cell.frame.size.height) - } - } +// override func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) { +// if let cell = cell as? AccountTableViewCell { +// CellHeightManager.set(status: cell.statusView.status, height: cell.frame.size.height) +// } +// } - override func tableView(_ tableView: UITableView, estimatedHeightForRowAt indexPath: IndexPath) -> CGFloat { - return CellHeightManager.get(status: fetchedResultsController?.object(at: indexPath)) - } +// override func tableView(_ tableView: UITableView, estimatedHeightForRowAt indexPath: IndexPath) -> CGFloat { +// return CellHeightManager.get(status: fetchedResultsController?.object(at: indexPath)) +// } override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return fetchedResultsController?.fetchedObjects?.count ?? 0 diff --git a/elpha-ios/AlertManager.swift b/elpha-ios/AlertManager.swift index b7ec937..8c608f6 100644 --- a/elpha-ios/AlertManager.swift +++ b/elpha-ios/AlertManager.swift @@ -112,7 +112,7 @@ class AlertManager { } } - print("ALERT: \(message)") + print("Alert: \(message)") alerts.append(Alert(category: category, message: message)) start() diff --git a/elpha-ios/AppDelegate.swift b/elpha-ios/AppDelegate.swift index 416129b..eb2b7bf 100644 --- a/elpha-ios/AppDelegate.swift +++ b/elpha-ios/AppDelegate.swift @@ -11,6 +11,7 @@ import UIKit extension Notification.Name { static let didAuthenticate = Notification.Name("didAuthenticate") static let didUnauthenticate = Notification.Name("didUnauthenticate") + static let didBecomeActive = Notification.Name("didBecomeActive") } @UIApplicationMain @@ -28,5 +29,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate { return true } + + func applicationDidBecomeActive(_ application: UIApplication) { +// NotificationCenter.default.post(name: .didBecomeActive, object: nil) + } } diff --git a/elpha-ios/Assets.xcassets/Icons/Search.imageset/Contents.json b/elpha-ios/Assets.xcassets/Icons/Search.imageset/Contents.json new file mode 100644 index 0000000..c90c854 --- /dev/null +++ b/elpha-ios/Assets.xcassets/Icons/Search.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "search.pdf" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/elpha-ios/Assets.xcassets/Icons/Search.imageset/search.pdf b/elpha-ios/Assets.xcassets/Icons/Search.imageset/search.pdf new file mode 100644 index 0000000000000000000000000000000000000000..2b066740d210d1a28961917c89f46a3e2e183e04 GIT binary patch literal 3906 zcmai%c|27A_s1<$7?Mgvs+$iZg_$v9nX(TiC1WWW`wWAzO^vZ<&GNBjPn0BO%~DjN zAv^Ik$(9O_w#z@g875PCX;IU=twl*1sj_Rv$!bx@$oGJ)hi}vr&cUdb>BV;T%jOUu9qWmax!6 z`=I_O+MV622cdb&N!jKt&D+Uxp*bJ8x7~n0YrrVvs^SB%#nrdmtS%kh;KjR2?T+!2 zU8hSK@sM6aTYOGU`{m)5GLNp`NZLq2TJ@E+?1C`h zo%~OK?EPOwGp3Lo%!pLLise*SAFu(SXtFz*Vs-)VKm^!TMSH;km7flN^P&2ikDrA{ zeYb)du>yi>vy1P^syqPICHjyYh^82w|9vLeSAEZ#4T(h4X)3fAyCnhXCGh}0;N^*v zdqE~K2BF4WQ4tUy-EI29yJXEB&pzYCL`yp83G-hLCk*m^5i)LVFwxax49C0i&6g@I zj%01N;YNq19uE#V&j$_Ga2RidgBqz8oT12E3*k>Q4c5E&bT+SW?Gxe@wBUR;=Hvvz ztm<<0ZP3&+GYe0)RxW>12z9J|BUf(>@fz3)NtRSWOKs->>-8(E1w%v`Txn*NEn;{yyBBAUo5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fT7?{ zDkv2=9*-m_!U=ddf~Z13IjK0R!j&BG8sPtJ@}md6sI1obejo^>Dhezut%ubI{~s;| Bm<9j< literal 0 HcmV?d00001 diff --git a/elpha-ios/AttachmentsView.swift b/elpha-ios/AttachmentsView.swift index 77fe964..da23747 100644 --- a/elpha-ios/AttachmentsView.swift +++ b/elpha-ios/AttachmentsView.swift @@ -33,7 +33,7 @@ class AttachmentsView: UIView { Bundle.main.loadNibNamed("AttachmentsView", owner: self, options: nil) addSubview(contentView) contentView.frame = self.bounds - contentView.autoresizingMask = [.flexibleWidth, .flexibleHeight] + contentView.autoresizingMask = [.flexibleWidth] attachmentsCollectionView.dataSource = self attachmentsCollectionView.delegate = self @@ -43,15 +43,18 @@ class AttachmentsView: UIView { } func update(withAttachments attachments: [AttachmentMO]) { - self.attachments = attachments - - attachmentsCollectionView.collectionViewLayout.invalidateLayout() + self.attachments = Array(attachments.prefix(4)) + attachmentsCollectionView.reloadData() - attachmentsCollectionView.setNeedsLayout() + attachmentsCollectionView.collectionViewLayout.invalidateLayout() } } extension AttachmentsView: UICollectionViewDelegate, UICollectionViewDataSource { + func numberOfSections(in collectionView: UICollectionView) -> Int { + return 1 + } + func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { return attachments?.count ?? 0 } @@ -67,12 +70,10 @@ extension AttachmentsView: UICollectionViewDelegate, UICollectionViewDataSource case .gifv, .video: let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "VideoAttachmentCollectionViewCell", for: indexPath) as! VideoAttachmentCollectionViewCell cell.update(withAttachment: attachment) - return cell default: let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "ImageAttachmentCollectionViewCell", for: indexPath) as! ImageAttachmentCollectionViewCell cell.update(withAttachment: attachment) - return cell } } @@ -84,12 +85,16 @@ extension AttachmentsView: UICollectionViewDelegate, UICollectionViewDataSource extension AttachmentsView: UICollectionViewDelegateFlowLayout { func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { - let halfWidth = (frame.size.width / 2) - 1 - let tallSize = CGSize(width: halfWidth, height: frame.size.width) - let smallSize = CGSize(width: halfWidth, height: halfWidth) + print("collectionView sizeForItemAt indexPath: \(indexPath)") + + let halfWidth = (frame.size.width / 2) - 2 + let halfHeight = (frame.size.height / 2) - 2 + + let tallSize = CGSize(width: halfWidth, height: frame.size.height) + let smallSize = CGSize(width: halfWidth, height: halfHeight) switch attachments?.count ?? 0 { - case 1: return CGSize(width: frame.size.width, height: frame.size.width) + case 1: return CGSize(width: frame.size.width, height: frame.size.height) case 2: return tallSize case 3: return indexPath.row == 0 ? tallSize : smallSize case 4: return smallSize @@ -102,7 +107,7 @@ extension AttachmentsView: UICollectionViewDelegateFlowLayout { } func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumInteritemSpacingForSectionAt section: Int) -> CGFloat { - return 2 + return 4 } func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAt section: Int) -> UIEdgeInsets { diff --git a/elpha-ios/AttachmentsView.xib b/elpha-ios/AttachmentsView.xib index 0bca149..98c0e80 100644 --- a/elpha-ios/AttachmentsView.xib +++ b/elpha-ios/AttachmentsView.xib @@ -24,7 +24,7 @@ - + diff --git a/elpha-ios/Base.lproj/Main.storyboard b/elpha-ios/Base.lproj/Main.storyboard index dd0dbe1..22840b6 100644 --- a/elpha-ios/Base.lproj/Main.storyboard +++ b/elpha-ios/Base.lproj/Main.storyboard @@ -1,11 +1,11 @@ - + - + @@ -158,7 +158,7 @@ - +