diff --git a/elpha-ios/AccountTableViewController.swift b/elpha-ios/AccountTableViewController.swift index a5ec613..add8465 100644 --- a/elpha-ios/AccountTableViewController.swift +++ b/elpha-ios/AccountTableViewController.swift @@ -175,25 +175,23 @@ class AccountTableViewController: AbstractStatusTableViewController { } override func loadMoreTapped(status: StatusMO, direction: PaginationDirection) { + func removeMarker(at: Int) { + status.markers?.remove(at: at) + CoreDataManager.shared.saveContext() + } + if let markers = status.markers { - var removeAt = -1 - for (index, marker) in markers.enumerated() { if marker.context == self.currentPaginationContext && marker.item.direction == direction { fetchStatuses(withPagination: marker.item) { error in if error == nil { - removeAt = index + removeMarker(at: index) } else { AlertManager.shared.show(message: error!.localizedDescription, category: .error) } } } } - - if removeAt > -1 { - status.markers?.remove(at: removeAt) - CoreDataManager.shared.saveContext() - } } } diff --git a/elpha-ios/Assets.xcassets/Icons/Share White.imageset/Contents.json b/elpha-ios/Assets.xcassets/Icons/Share White.imageset/Contents.json new file mode 100644 index 0000000..9e6f6d9 --- /dev/null +++ b/elpha-ios/Assets.xcassets/Icons/Share White.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "share-white.pdf" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/elpha-ios/Assets.xcassets/Icons/Share White.imageset/share-white.pdf b/elpha-ios/Assets.xcassets/Icons/Share White.imageset/share-white.pdf new file mode 100644 index 0000000..d9a5758 Binary files /dev/null and b/elpha-ios/Assets.xcassets/Icons/Share White.imageset/share-white.pdf differ diff --git a/elpha-ios/Assets.xcassets/Icons/Share.imageset/share.pdf b/elpha-ios/Assets.xcassets/Icons/Share.imageset/share.pdf index d9a5758..035fdd5 100644 Binary files a/elpha-ios/Assets.xcassets/Icons/Share.imageset/share.pdf and b/elpha-ios/Assets.xcassets/Icons/Share.imageset/share.pdf differ diff --git a/elpha-ios/Base.lproj/Main.storyboard b/elpha-ios/Base.lproj/Main.storyboard index 8bae72d..98b3305 100644 --- a/elpha-ios/Base.lproj/Main.storyboard +++ b/elpha-ios/Base.lproj/Main.storyboard @@ -1348,19 +1348,19 @@ - + - - + + - + - + @@ -1422,10 +1422,10 @@ - + - + @@ -1444,14 +1444,14 @@ - + - + @@ -1508,6 +1508,7 @@ + @@ -1516,6 +1517,9 @@ + + + @@ -1577,7 +1581,6 @@ - @@ -1595,8 +1598,28 @@ + + + + + + + + + + + + - + - + @@ -1672,6 +1695,7 @@ + @@ -1691,11 +1715,6 @@ - - - - - @@ -1706,6 +1725,11 @@ + + + + + @@ -1773,7 +1797,7 @@ - + @@ -1895,6 +1919,7 @@ + diff --git a/elpha-ios/StatusTableViewController.swift b/elpha-ios/StatusTableViewController.swift index 7ab6497..4f4da92 100644 --- a/elpha-ios/StatusTableViewController.swift +++ b/elpha-ios/StatusTableViewController.swift @@ -27,9 +27,11 @@ class StatusTableViewController: AbstractStatusTableViewController, UIGestureRec override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) - fetchStatuses { error in - if error != nil { - AlertManager.shared.show(message: error!.localizedDescription, category: .error) + if SettingsManager.automaticallyRefreshTimelines { + fetchStatuses { error in + if error != nil { + AlertManager.shared.show(message: error!.localizedDescription, category: .error) + } } } } @@ -118,6 +120,13 @@ class StatusTableViewController: AbstractStatusTableViewController, UIGestureRec self.replyTapped(status: status!) } + @IBAction func shareTapped(_ sender: Any) { + if let status = status { + let controller = UIActivityViewController(activityItems: [status.uri!], applicationActivities: nil) + present(controller, animated: true) + } + } + func fetchStatuses(completion: @escaping (Error?) -> Void) { if let status = status { loading = true @@ -296,12 +305,13 @@ extension StatusTableViewController: NSFetchedResultsControllerDelegate { case NSFetchedResultsChangeType.delete: tableView.deleteRows(at: [indexPath!], with: UITableView.RowAnimation.none) case NSFetchedResultsChangeType.update: - if let cell = tableView.cellForRow(at: indexPath!) as? StatusTableViewCell { - updateCell(cell, withStatusAt: indexPath!) - } - - if let cell = tableView.cellForRow(at: indexPath!) as? MainStatusTableViewCell { - updateMainCell(cell, withStatus: anObject as! StatusMO) + switch tableView.cellForRow(at: indexPath!) { + case let cell as StatusTableViewCell: + updateCell(cell, withStatusAt: indexPath!) + case let cell as MainStatusTableViewCell: + updateMainCell(cell, withStatus: anObject as! StatusMO) + default: + return } case NSFetchedResultsChangeType.move: tableView.deleteRows(at: [indexPath!], with: UITableView.RowAnimation.fade) diff --git a/elpha-ios/TimelineTableViewController.swift b/elpha-ios/TimelineTableViewController.swift index f043a87..30bd2d7 100644 --- a/elpha-ios/TimelineTableViewController.swift +++ b/elpha-ios/TimelineTableViewController.swift @@ -83,25 +83,23 @@ class TimelineTableViewController: AbstractStatusTableViewController { } override func loadMoreTapped(status: StatusMO, direction: PaginationDirection) { + func removeMarker(at: Int) { + status.markers?.remove(at: at) + CoreDataManager.shared.saveContext() + } + if let markers = status.markers { - var removeAt = -1 - for (index, marker) in markers.enumerated() { if marker.context == self.currentPaginationContext && marker.item.direction == direction { fetchTimeline(withPagination: marker.item) { error in if error == nil { - removeAt = index + removeMarker(at: index) } else { AlertManager.shared.show(message: error!.localizedDescription, category: .error) } } } } - - if removeAt > -1 { - status.markers?.remove(at: removeAt) - CoreDataManager.shared.saveContext() - } } }