Skip to content

Commit 561efd3

Browse files
authored
Merge pull request #1152 from DimensionDev/ios/20250807
Ios/20250807
2 parents 92e31d5 + e19c121 commit 561efd3

File tree

79 files changed

+384
-3173
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+384
-3173
lines changed

iosApp/iosApp/UI/Navigation/FlareDestinationView.swift

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ struct FlareDestinationView: View {
88
let destination: FlareDestination
99
let router: FlareRouter
1010

11-
@Environment(FlareAppState.self) private var appState
11+
@Environment(FlareMenuState.self) private var menuState
1212
@Environment(\.appSettings) private var appSettings
1313
@Environment(FlareTheme.self) private var theme
1414

@@ -24,17 +24,15 @@ struct FlareDestinationView: View {
2424
case let .profile(accountType, userKey):
2525
ProfileTabScreenUikit(
2626
accountType: accountType,
27-
userKey: userKey,
28-
toProfileMedia: { _ in }
27+
userKey: userKey
2928
)
3029
.environment(router)
3130

3231
case let .profileWithNameAndHost(accountType, userName, host):
3332
ProfileWithUserNameScreen(
3433
accountType: accountType,
3534
userName: userName,
36-
host: host,
37-
toProfileMedia: { _ in }
35+
host: host
3836
)
3937
.environment(router)
4038

@@ -125,31 +123,31 @@ struct FlareDestinationView: View {
125123
case let .download(accountType):
126124
DownloadManagerScreen(accountType: accountType)
127125
.environment(router)
128-
.environment(appState)
126+
.environment(menuState)
129127

130128
case let .instanceScreen(host, _):
131129
InstanceScreen(host: host)
132130
.environment(router)
133-
.environment(appState)
131+
.environment(menuState)
134132

135133
case let .podcastSheet(accountType, podcastId):
136134
PodcastSheetView(accountType: accountType, podcastId: podcastId)
137135
.environment(router)
138-
.environment(appState)
136+
.environment(menuState)
139137
.environment(\.appSettings, appSettings)
140138

141139
case let .spaces(accountType):
142140
SpaceScreen(accountType: accountType)
143141
.environment(router)
144-
.environment(appState)
142+
.environment(menuState)
145143

146144
default:
147145
Text("page not found for destination: \(String(describing: destination))")
148146
.frame(maxWidth: .infinity, maxHeight: .infinity)
149147
}
150148
}
151149
.environment(router)
152-
.environment(appState)
150+
.environment(menuState)
153151
.background(theme.primaryBackgroundColor)
154152
.foregroundColor(theme.labelColor)
155153
}

iosApp/iosApp/UI/Navigation/FlareRootView.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import shared
33
import SwiftUI
44

55
struct FlareRootView: View {
6-
@State var appState = FlareAppState()
6+
@State var menuState = FlareMenuState()
77
@StateObject private var router = FlareRouter.shared
88
@StateObject private var composeManager = ComposeManager.shared
99
@StateObject private var timelineState = TimelineExtState()
@@ -34,7 +34,7 @@ struct FlareRootView: View {
3434
HomeTabViewContentV2(accountType: accountType)
3535
.environment(theme)
3636
.applyTheme(theme)
37-
.environment(appState)
37+
.environment(menuState)
3838
.environment(router)
3939
.environmentObject(timelineState)
4040
.sheet(isPresented: $router.isSheetPresented) {
@@ -44,7 +44,7 @@ struct FlareRootView: View {
4444
router: router
4545
).environment(theme)
4646
.applyTheme(theme)
47-
.environment(appState)
47+
.environment(menuState)
4848
}
4949
}
5050
.fullScreenCover(isPresented: $router.isFullScreenPresented) {
@@ -56,7 +56,7 @@ struct FlareRootView: View {
5656
.environment(theme)
5757
.applyTheme(theme)
5858
.environment(\.appSettings, appSettings)
59-
.environment(appState)
59+
.environment(menuState)
6060
}
6161
}
6262
.alert(isPresented: $router.isDialogPresented) {
@@ -78,7 +78,7 @@ struct FlareRootView: View {
7878
.environment(theme)
7979
.applyTheme(theme)
8080
.environment(router)
81-
.environment(appState)
81+
.environment(menuState)
8282
.environment(\.appSettings, appSettings)
8383
}
8484
}
@@ -92,7 +92,7 @@ struct FlareRootView: View {
9292
.navigationViewStyle(StackNavigationViewStyle())
9393
.onAppear {
9494
setupInitialState()
95-
router.appState = appState
95+
router.menuState = menuState
9696
}
9797
.frame(maxWidth: .infinity, maxHeight: .infinity)
9898
)

iosApp/iosApp/UI/Navigation/FlareRouter.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import UIKit
99
class FlareRouter: ObservableObject {
1010
public static let shared = FlareRouter()
1111

12-
public var appState: FlareAppState
12+
public var menuState: FlareMenuState
1313

1414
private var cancellables = Set<AnyCancellable>()
1515

@@ -110,8 +110,8 @@ class FlareRouter: ObservableObject {
110110
log: .default, type: .debug, String(describing: tab))
111111
}
112112

113-
init(appState: FlareAppState = FlareAppState()) {
114-
self.appState = appState
113+
init(menuState: FlareMenuState = FlareMenuState()) {
114+
self.menuState = menuState
115115
os_log("[FlareRouter] Initialized router: %{public}@", log: .default, type: .debug, String(describing: ObjectIdentifier(self)))
116116
}
117117

iosApp/iosApp/UI/Page/Compose/Text/FlareMarkdownStyle.swift

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
import MarkdownUI
22
import SwiftUI
33

4-
// 扩展的是 MarkdownUI.Theme
54
extension MarkdownUI.Theme {
65
static func flareMarkdownStyle(using style: FlareTextStyle.Style, fontScale: Double) -> MarkdownUI.Theme {
7-
// 获取基础字体大小
86
let baseFontSize = style.font.pointSize
9-
// 应用用户的字体缩放设置
7+
108
let scaledFontSize = baseFontSize * fontScale
119

1210
return MarkdownUI.Theme()
@@ -23,21 +21,17 @@ extension MarkdownUI.Theme {
2321
// UnderlineStyle(.single)
2422
}
2523
.strong {
26-
// 粗体文本
2724
FontWeight(.semibold)
2825
ForegroundColor(Color(style.textColor))
2926
}
3027
.emphasis {
31-
// 斜体文本
3228
FontStyle(.italic)
3329
ForegroundColor(Color(style.textColor))
3430
}
3531
.code {
36-
// 行内代码
3732
FontFamilyVariant(.monospaced)
3833
FontSize(scaledFontSize * 0.9)
3934
ForegroundColor(Color(style.textColor))
40-
// BackgroundColor(Color.gray.opacity(0.1))
4135
}
4236
}
4337
}

iosApp/iosApp/UI/Page/Compose/Text/FlareText.swift

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import SwiftUI
44
import TwitterText
55

66
public enum FlareTextType {
7-
case body
8-
case caption
7+
case flareTextTypeBody
8+
case flareTextTypeCaption
99
}
1010

1111
public struct FlareText: View, Equatable {
@@ -20,10 +20,7 @@ public struct FlareText: View, Equatable {
2020
public static func == (lhs: FlareText, rhs: FlareText) -> Bool {
2121
lhs.text == rhs.text &&
2222
lhs.markdownText == rhs.markdownText &&
23-
lhs.textType == rhs.textType &&
24-
lhs.isRTL == rhs.isRTL
25-
// 注意:linkHandler是函数类型,无法比较,但通常不影响渲染
26-
// Environment变量由SwiftUI自动处理
23+
lhs.textType == rhs.textType
2724
}
2825

2926
public init(
@@ -46,10 +43,10 @@ public struct FlareText: View, Equatable {
4643

4744
public var body: some View {
4845
let currentStyle: FlareTextStyle.Style = switch textType {
49-
case .body:
50-
theme.bodyTextStyle
51-
case .caption:
52-
theme.captionTextStyle
46+
case .flareTextTypeBody:
47+
theme.flareTextBodyTextStyle
48+
case .flareTextTypeCaption:
49+
theme.flareTextCaptionTextStyle
5350
}
5451

5552
switch appSettings.appearanceSettings.renderEngine {

iosApp/iosApp/UI/Page/Compose/Text/FlareTextStyle.swift

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -37,33 +37,6 @@ public enum FlareTextStyle {
3737
lhs.cashtagColor == rhs.cashtagColor
3838
}
3939

40-
// public static let `default` = Style(
41-
// font: .systemFont(ofSize: 16),
42-
// textColor: UIColor.black, // .Text.primary,
43-
// linkColor: UIColor.black,
44-
// mentionColor: UIColor.black,
45-
// hashtagColor: UIColor.black,
46-
// cashtagColor: UIColor.black
47-
// )
48-
49-
// public static let timeline = Style(
50-
// font: .systemFont(ofSize: 16),
51-
// textColor: UIColor.black,
52-
// linkColor: UIColor.black,
53-
// mentionColor: UIColor.black,
54-
// hashtagColor: UIColor.black,
55-
// cashtagColor: UIColor.black
56-
// )
57-
58-
// public static let quote = Style(
59-
// font: .systemFont(ofSize: 15),
60-
// textColor: UIColor.black,
61-
// linkColor: UIColor.black.withAlphaComponent(0.8),
62-
// mentionColor: UIColor.black.withAlphaComponent(0.8),
63-
// hashtagColor: UIColor.black.withAlphaComponent(0.8),
64-
// cashtagColor: UIColor.black.withAlphaComponent(0.8)
65-
// )
66-
6740
public init(
6841
font: UIFont = .systemFont(ofSize: 16),
6942
textColor: UIColor = UIColor.black,

iosApp/iosApp/UI/Page/Compose/Timeline/CardPreview/LinkPreview.swift

Lines changed: 0 additions & 39 deletions
This file was deleted.

iosApp/iosApp/UI/Page/Compose/TimelineV2/LinkPreviewV2.swift renamed to iosApp/iosApp/UI/Page/Compose/Timeline/CardPreview/LinkPreviewV2.swift

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
import SwiftUI
22

33
struct LinkPreviewV2: View {
4-
let card: Card // 使用Swift Card类型
4+
let card: Card
55
var body: some View {
66
Link(destination: URL(string: card.url)!) {
77
HStack {
88
if let media = card.media {
9-
// 使用V2版本的MediaItemComponent
109
MediaItemComponentV2(media: media)
1110
.frame(width: 64, height: 64)
1211
}
1312
VStack(alignment: .leading) {
14-
Text(card.title ?? "") // 处理可选值
13+
Text(card.title ?? "")
1514
.lineLimit(1)
16-
if let desc = card.description, !desc.isEmpty { // 确保description不为空
15+
if let desc = card.description, !desc.isEmpty {
1716
Text(desc)
1817
.font(.caption)
1918
.foregroundStyle(.gray)

iosApp/iosApp/UI/Page/Compose/Timeline/CardPreview/PodcastPreview.swift

Lines changed: 0 additions & 37 deletions
This file was deleted.

iosApp/iosApp/UI/Page/Compose/TimelineV2/PodcastPreviewV2.swift renamed to iosApp/iosApp/UI/Page/Compose/Timeline/CardPreview/PodcastPreviewV2.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
// import Foundation
21
import SwiftUI
32

43
struct PodcastPreviewV2: View {
5-
let card: Card // 使用Swift Card类型
4+
let card: Card
65

76
private var podcastId: String {
87
URL(string: card.url)?.lastPathComponent ?? ""

0 commit comments

Comments
 (0)