Suggest login on launch

This commit is contained in:
Thomas Ricouard 2023-01-12 06:30:43 +01:00
parent a5308730f8
commit 150cb5a8c5
3 changed files with 27 additions and 6 deletions

View File

@ -52,8 +52,10 @@ struct AddAccountView: View {
.background(theme.secondaryBackgroundColor)
.scrollDismissesKeyboard(.immediately)
.toolbar {
ToolbarItem(placement: .navigationBarLeading) {
Button("Cancel", action: { dismiss() })
if !appAccountsManager.availableAccounts.isEmpty {
ToolbarItem(placement: .navigationBarLeading) {
Button("Cancel", action: { dismiss() })
}
}
}
.onAppear {

View File

@ -37,6 +37,9 @@ struct TimelineTab: View {
Task {
await currentAccount.fetchLists()
}
if !client.isAuth {
routeurPath.presentedSheet = .addAccount
}
}
.onChange(of: client.isAuth, perform: { isAuth in
timeline = isAuth ? .home : .federated

View File

@ -26,11 +26,27 @@ public struct ExploreView: View {
}
} else if !viewModel.isLoaded {
loadingView
} else if viewModel.trendingLinks.isEmpty &&
viewModel.trendingTags.isEmpty &&
viewModel.trendingStatuses.isEmpty &&
viewModel.suggestedAccounts.isEmpty {
EmptyView(iconName: "magnifyingglass",
title: "Search your instance",
message: "From this screen you can search anything on \(client.server)")
.listRowBackground(theme.secondaryBackgroundColor)
} else {
trendingTagsSection
suggestedAccountsSection
trendingPostsSection
trendingLinksSection
if !viewModel.trendingTags.isEmpty {
trendingTagsSection
}
if !viewModel.suggestedAccounts.isEmpty {
suggestedAccountsSection
}
if !viewModel.trendingStatuses.isEmpty {
trendingPostsSection
}
if !viewModel.trendingLinks.isEmpty {
trendingLinksSection
}
}
}
.task {