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) .background(theme.secondaryBackgroundColor)
.scrollDismissesKeyboard(.immediately) .scrollDismissesKeyboard(.immediately)
.toolbar { .toolbar {
ToolbarItem(placement: .navigationBarLeading) { if !appAccountsManager.availableAccounts.isEmpty {
Button("Cancel", action: { dismiss() }) ToolbarItem(placement: .navigationBarLeading) {
Button("Cancel", action: { dismiss() })
}
} }
} }
.onAppear { .onAppear {

View File

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

View File

@ -26,11 +26,27 @@ public struct ExploreView: View {
} }
} else if !viewModel.isLoaded { } else if !viewModel.isLoaded {
loadingView 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 { } else {
trendingTagsSection if !viewModel.trendingTags.isEmpty {
suggestedAccountsSection trendingTagsSection
trendingPostsSection }
trendingLinksSection if !viewModel.suggestedAccounts.isEmpty {
suggestedAccountsSection
}
if !viewModel.trendingStatuses.isEmpty {
trendingPostsSection
}
if !viewModel.trendingLinks.isEmpty {
trendingLinksSection
}
} }
} }
.task { .task {