2023-01-23 18:01:27 +01:00
|
|
|
//
|
|
|
|
// https://mczachurski.dev
|
|
|
|
// Copyright © 2023 Marcin Czachurski and the repository contributors.
|
|
|
|
// Licensed under the MIT License.
|
|
|
|
//
|
|
|
|
|
|
|
|
import Foundation
|
|
|
|
import SwiftUI
|
|
|
|
|
|
|
|
extension View {
|
|
|
|
func withAppRouteur() -> some View {
|
|
|
|
self.navigationDestination(for: RouteurDestinations.self) { destination in
|
|
|
|
switch destination {
|
|
|
|
case .tag(let hashTag):
|
|
|
|
StatusesView(listType: .hashtag(tag: hashTag))
|
2023-01-27 15:46:09 +01:00
|
|
|
case .status(let id, let blurhash, let highestImageUrl, let metaImageWidth, let metaImageHeight):
|
2023-01-23 18:01:27 +01:00
|
|
|
StatusView(statusId: id,
|
|
|
|
imageBlurhash: blurhash,
|
2023-01-27 15:46:09 +01:00
|
|
|
highestImageUrl: highestImageUrl,
|
2023-01-23 18:01:27 +01:00
|
|
|
imageWidth: metaImageWidth,
|
|
|
|
imageHeight: metaImageHeight)
|
|
|
|
case .statuses(let listType):
|
|
|
|
StatusesView(listType: listType)
|
2023-02-01 20:01:18 +01:00
|
|
|
case .bookmarks:
|
|
|
|
PaginableStatusesView(listType: .bookmarks)
|
|
|
|
case .favourites:
|
|
|
|
PaginableStatusesView(listType: .favourites)
|
2023-01-23 18:01:27 +01:00
|
|
|
case .userProfile(let accountId, let accountDisplayName, let accountUserName):
|
|
|
|
UserProfileView(
|
|
|
|
accountId: accountId,
|
|
|
|
accountDisplayName: accountDisplayName,
|
|
|
|
accountUserName: accountUserName)
|
2023-03-07 16:45:44 +01:00
|
|
|
case .accounts(let listType):
|
|
|
|
AccountsView(listType: listType)
|
2023-01-23 18:01:27 +01:00
|
|
|
case .signIn:
|
|
|
|
SignInView()
|
2023-02-08 21:09:51 +01:00
|
|
|
case .thirdParty:
|
|
|
|
ThirdPartyView()
|
2023-02-17 14:47:59 +01:00
|
|
|
case .photoEditor(let photoAttachment):
|
|
|
|
PhotoEditorView(photoAttachment: photoAttachment)
|
2023-03-07 16:45:44 +01:00
|
|
|
case .hashtags(let listType):
|
|
|
|
HashtagsView(listType: listType)
|
2023-03-08 12:07:43 +01:00
|
|
|
case .accountsPhoto(let listType):
|
|
|
|
AccountsPhotoView(listType: listType)
|
2023-03-06 16:00:53 +01:00
|
|
|
case .search:
|
|
|
|
SearchView()
|
2023-03-26 08:21:22 +02:00
|
|
|
case .editProfile:
|
|
|
|
EditProfileView()
|
2023-01-23 18:01:27 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func withSheetDestinations(sheetDestinations: Binding<SheetDestinations?>) -> some View {
|
|
|
|
self.sheet(item: sheetDestinations) { destination in
|
|
|
|
switch destination {
|
|
|
|
case .replyToStatusEditor(let status):
|
|
|
|
ComposeView(statusViewModel: status)
|
|
|
|
case .newStatusEditor:
|
|
|
|
ComposeView()
|
|
|
|
case .settings:
|
|
|
|
SettingsView()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-02-13 21:10:07 +01:00
|
|
|
|
|
|
|
func withOverlayDestinations(overlayDestinations: Binding<OverlayDestinations?>) -> some View {
|
|
|
|
self.overlay {
|
|
|
|
switch overlayDestinations.wrappedValue {
|
|
|
|
case .successPayment:
|
|
|
|
ThanksView()
|
|
|
|
.transition(.move(edge: .bottom).combined(with: .opacity))
|
|
|
|
default:
|
|
|
|
EmptyView()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-01-23 18:01:27 +01:00
|
|
|
}
|