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:
@@ -15,9 +15,6 @@ struct PostingTimelineSwitcherView: View {
|
|||||||
init(damusState: DamusState, timelineSource: Binding<TimelineSource>) {
|
init(damusState: DamusState, timelineSource: Binding<TimelineSource>) {
|
||||||
self.damusState = damusState
|
self.damusState = damusState
|
||||||
self._timelineSource = timelineSource
|
self._timelineSource = timelineSource
|
||||||
if #available(iOS 17.0, *) {
|
|
||||||
try? Tips.configure([.displayFrequency(.daily)])
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
@@ -47,10 +44,6 @@ struct PostingTimelineSwitcherView: View {
|
|||||||
struct TimelineSwitcherTip: Tip {
|
struct TimelineSwitcherTip: Tip {
|
||||||
static let shared = TimelineSwitcherTip()
|
static let shared = TimelineSwitcherTip()
|
||||||
|
|
||||||
var options: [Option] {
|
|
||||||
[MaxDisplayCount(1)]
|
|
||||||
}
|
|
||||||
|
|
||||||
var title: Text {
|
var title: Text {
|
||||||
Text("Timeline switcher", comment: "Title of tip that informs users that they can switch timelines.")
|
Text("Timeline switcher", comment: "Title of tip that informs users that they can switch timelines.")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
import TipKit
|
||||||
|
|
||||||
struct PostingTimelineView: View {
|
struct PostingTimelineView: View {
|
||||||
|
|
||||||
@@ -29,6 +30,17 @@ struct PostingTimelineView: View {
|
|||||||
@SceneStorage("PostingTimelineView.filter_state") var filter_state : FilterState = .posts_and_replies
|
@SceneStorage("PostingTimelineView.filter_state") var filter_state : FilterState = .posts_and_replies
|
||||||
@State var timeline_source: TimelineSource = .follows
|
@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> {
|
var loading: Binding<Bool> {
|
||||||
Binding(get: {
|
Binding(get: {
|
||||||
return home.loading
|
return home.loading
|
||||||
@@ -72,20 +84,12 @@ struct PostingTimelineView: View {
|
|||||||
HStack(alignment: .center) {
|
HStack(alignment: .center) {
|
||||||
SignalView(state: damus_state, signal: home.signal)
|
SignalView(state: damus_state, signal: home.signal)
|
||||||
if damus_state.settings.enable_favourites_feature {
|
if damus_state.settings.enable_favourites_feature {
|
||||||
let switchView = PostingTimelineSwitcherView(
|
Image(systemName: "square.stack")
|
||||||
damusState: damus_state,
|
.foregroundColor(DamusColors.purple)
|
||||||
timelineSource: $timeline_source
|
.overlay(PostingTimelineSwitcherView(
|
||||||
)
|
damusState: damus_state,
|
||||||
if #available(iOS 17.0, *) {
|
timelineSource: $timeline_source
|
||||||
Image(systemName: "square.stack")
|
))
|
||||||
.foregroundColor(DamusColors.purple)
|
|
||||||
.overlay(
|
|
||||||
switchView
|
|
||||||
.popoverTip(PostingTimelineSwitcherView.TimelineSwitcherTip.shared)
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
switchView
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -103,7 +107,12 @@ struct PostingTimelineView: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
.padding(.horizontal, 20)
|
.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) {
|
VStack(spacing: 0) {
|
||||||
CustomPicker(tabs: [
|
CustomPicker(tabs: [
|
||||||
(NSLocalizedString("Notes", comment: "Label for filter for seeing only notes (instead of notes and replies)."), FilterState.posts),
|
(NSLocalizedString("Notes", comment: "Label for filter for seeing only notes (instead of notes and replies)."), FilterState.posts),
|
||||||
|
|||||||
Reference in New Issue
Block a user