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 0000000..2b06674 Binary files /dev/null and b/elpha-ios/Assets.xcassets/Icons/Search.imageset/search.pdf differ 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 @@ - +