mirror of
https://github.com/metabolist/metatext.git
synced 2024-06-02 13:40:13 +00:00
37 lines
1.1 KiB
Swift
37 lines
1.1 KiB
Swift
// Copyright © 2020 Metabolist. All rights reserved.
|
|
|
|
import Foundation
|
|
|
|
public enum NavigationEvent {
|
|
case collectionNavigation(CollectionViewModel)
|
|
case profileNavigation(ProfileViewModel)
|
|
case urlNavigation(URL)
|
|
case share(URL)
|
|
case webfingerStart
|
|
case webfingerEnd
|
|
}
|
|
|
|
extension NavigationEvent {
|
|
public init?(_ event: CollectionItemEvent) {
|
|
switch event {
|
|
case .ignorableOutput:
|
|
return nil
|
|
case let .navigation(item):
|
|
switch item {
|
|
case let .url(url):
|
|
self = .urlNavigation(url)
|
|
case let .collection(statusListService):
|
|
self = .collectionNavigation(CollectionItemsViewModel(collectionService: statusListService))
|
|
case let .profile(profileService):
|
|
self = .profileNavigation(ProfileViewModel(profileService: profileService))
|
|
case .webfingerStart:
|
|
self = .webfingerStart
|
|
case .webfingerEnd:
|
|
self = .webfingerEnd
|
|
}
|
|
case let .share(url):
|
|
self = .share(url)
|
|
}
|
|
}
|
|
}
|