Show Timeline Tip in same way and after other Damus Tips.

Changelog-None:
Signed-off-by: Askeew <askeew@hotmail.com>
This commit is contained in:
Askeew
2025-12-19 20:30:18 +01:00
committed by Daniel D’Aquino
parent 650d4af504
commit ed9971f84f
2 changed files with 24 additions and 22 deletions

View File

@@ -15,9 +15,6 @@ struct PostingTimelineSwitcherView: View {
init(damusState: DamusState, timelineSource: Binding<TimelineSource>) {
self.damusState = damusState
self._timelineSource = timelineSource
if #available(iOS 17.0, *) {
try? Tips.configure([.displayFrequency(.daily)])
}
}
var body: some View {
@@ -47,10 +44,6 @@ struct PostingTimelineSwitcherView: View {
struct TimelineSwitcherTip: Tip {
static let shared = TimelineSwitcherTip()
var options: [Option] {
[MaxDisplayCount(1)]
}
var title: Text {
Text("Timeline switcher", comment: "Title of tip that informs users that they can switch timelines.")
}

View File

@@ -6,6 +6,7 @@
//
import SwiftUI
import TipKit
struct PostingTimelineView: View {
@@ -29,6 +30,17 @@ struct PostingTimelineView: View {
@SceneStorage("PostingTimelineView.filter_state") var filter_state : FilterState = .posts_and_replies
@State var timeline_source: TimelineSource = .follows
@State private var damusTips: Any? = {
if #available(iOS 18.0, *) {
return TipGroup(.ordered) {
TrustedNetworkButtonTip.shared
TrustedNetworkRepliesTip.shared
PostingTimelineSwitcherView.TimelineSwitcherTip.shared
}
}
return nil
}()
var loading: Binding<Bool> {
Binding(get: {
return home.loading
@@ -72,20 +84,12 @@ struct PostingTimelineView: View {
HStack(alignment: .center) {
SignalView(state: damus_state, signal: home.signal)
if damus_state.settings.enable_favourites_feature {
let switchView = PostingTimelineSwitcherView(
damusState: damus_state,
timelineSource: $timeline_source
)
if #available(iOS 17.0, *) {
Image(systemName: "square.stack")
.foregroundColor(DamusColors.purple)
.overlay(
switchView
.popoverTip(PostingTimelineSwitcherView.TimelineSwitcherTip.shared)
)
} else {
switchView
}
Image(systemName: "square.stack")
.foregroundColor(DamusColors.purple)
.overlay(PostingTimelineSwitcherView(
damusState: damus_state,
timelineSource: $timeline_source
))
}
}
}
@@ -103,7 +107,12 @@ struct PostingTimelineView: View {
}
}
.padding(.horizontal, 20)
if #available(iOS 18.0, *), let tipGroup = damusTips as? TipGroup {
TipView(tipGroup.currentTip as? PostingTimelineSwitcherView.TimelineSwitcherTip)
.tipBackground(.clear)
.tipViewStyle(TrustedNetworkButtonTipViewStyle())
.padding(.horizontal)
}
VStack(spacing: 0) {
CustomPicker(tabs: [
(NSLocalizedString("Notes", comment: "Label for filter for seeing only notes (instead of notes and replies)."), FilterState.posts),