Something went wrong. Try again.
A slopfork of Sam Henri Gold's Twitter client, reskinned like Tweetie 2 / Twitter for iPhone circa 2012. Personal use.
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869import ComposableArchitectureimport FeedFeatureimport Foundationimport ListsFeatureimport Modelsimport ProfileFeatureimport Routingimport SearchFeatureimport UserListFeatureimport WebFeature
@Reducerpackage enum TabStackPath { /// A List's timeline. case list(FeedFeature) case lists(ListsFeature) case profile(ProfileFeature) /// A post's quotes: a timeline of the posts quoting it. case quotes(FeedFeature) case search(SearchFeature) case thread(FeedFeature) case userList(UserListFeature) case web(WebFeature)}
extension TabStackPath.State: Equatable { /// Twitter for iPad's web panels are wide: a page needs more room than a timeline. var isWide: Bool { if case .web = self { true } else { false } }}
extension TabStackPath.State { /// Whether this column already shows what the route would open. func shows(_ route: Route) -> Bool { switch (self, route) { case (.thread(let feed), .thread(let tweet)): feed.source == .thread(tweetID: tweet.id) case (.thread(let feed), .threadID(let id)): feed.source == .thread(tweetID: id) case (.profile(let profile), .profile(let user)): profile.shows(screenName: user.screenName) case (.profile(let profile), .profileHandle(let screenName)): profile.shows(screenName: screenName) case (.quotes(let feed), .quotes(let tweetID)): feed.source == .quotes(of: tweetID) case (.userList(let list), .userList(let source)): list.source == source case (.list(let feed), .list(let list)): feed.source == .list(id: list.id, name: list.name) case (.lists(let lists), .lists(let userID)): lists.userID == userID case (.web(let web), .web(let url)): web.shows(url) default: false } }}
extension ProfileFeature.State { fileprivate func shows(screenName other: String) -> Bool { screenName.caseInsensitiveCompare(other) == .orderedSame }}
extension TabStackPath.Action { package var contentDelegate: ContentDelegate? { switch self { case .list(.delegate(let delegate)), .lists(.delegate(let delegate)), .profile(.delegate(let delegate)), .quotes(.delegate(let delegate)), .search(.delegate(let delegate)), .thread(.delegate(let delegate)), .userList(.delegate(let delegate)), .web(.delegate(let delegate)): delegate default: nil } }}