Skip to content

Commit

Permalink
feat: add source code viewing feature and update version to 1.2.7
Browse files Browse the repository at this point in the history
- Introduced a new button in ContentView to view the source code on GitHub.
- Added SafariWebView component to handle the display of the web content.
- Updated the app version from 1.2.6 to 1.2.7.
- Minor text correction in ProxyView for clarity.
  • Loading branch information
bin64 committed Dec 30, 2024
1 parent 6b9d01a commit a56c750
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 6 deletions.
8 changes: 4 additions & 4 deletions Clash Dash.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.2.6;
MARKETING_VERSION = 1.2.7;
PRODUCT_BUNDLE_IDENTIFIER = ym.si.clashdash;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down Expand Up @@ -574,7 +574,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.2.6;
MARKETING_VERSION = 1.2.7;
PRODUCT_BUNDLE_IDENTIFIER = ym.si.clashdash;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down Expand Up @@ -676,7 +676,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 1.2.6;
MARKETING_VERSION = 1.2.7;
PRODUCT_BUNDLE_IDENTIFIER = ym.si.clashdash.WidgetExtension;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
Expand Down Expand Up @@ -706,7 +706,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 1.2.6;
MARKETING_VERSION = 1.2.7;
PRODUCT_BUNDLE_IDENTIFIER = ym.si.clashdash.WidgetExtension;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
Expand Down
20 changes: 20 additions & 0 deletions Clash Dash/Views/Components/SafariWebView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import SwiftUI
import SafariServices

struct SafariWebView: UIViewControllerRepresentable {
let url: URL

func makeUIViewController(context: Context) -> SFSafariViewController {
let config = SFSafariViewController.Configuration()
config.entersReaderIfAvailable = false
config.barCollapsingEnabled = true

let safariViewController = SFSafariViewController(url: url, configuration: config)
safariViewController.preferredControlTintColor = .systemBlue
safariViewController.dismissButtonStyle = .close

return safariViewController
}

func updateUIViewController(_ uiViewController: SFSafariViewController, context: Context) {}
}
31 changes: 30 additions & 1 deletion Clash Dash/Views/ContentView.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import SwiftUI
import UIKit
import SafariServices

struct ContentView: View {
@StateObject private var viewModel = ServerViewModel()
Expand All @@ -11,6 +12,7 @@ struct ContentView: View {
@StateObject private var settingsViewModel = SettingsViewModel()
@State private var showingModeChangeSuccess = false
@State private var lastChangedMode = ""
@State private var showingSourceCode = false

// 添加触觉反馈生成器
private let impactFeedback = UIImpactFeedbackGenerator(style: .medium)
Expand Down Expand Up @@ -210,6 +212,27 @@ struct ContentView: View {
destination: HelpView()
)

Button {
impactFeedback.impactOccurred()
showingSourceCode = true
} label: {
HStack {
Image(systemName: "chevron.left.forwardslash.chevron.right")
.font(.body)
.foregroundColor(.purple)
.frame(width: 32)

Text("源码查看")
.font(.body)

Spacer()

Image(systemName: "chevron.right")
.font(.caption)
.foregroundColor(.secondary)
}
}

// SettingsLinkRow(
// title: "给APP评分",
// icon: "star.fill",
Expand All @@ -222,7 +245,7 @@ struct ContentView: View {
.cornerRadius(16)

// 版本信息
Text("Ver: 1.2.6")
Text("Ver: 1.2.7")
.foregroundColor(.secondary)
.font(.footnote)
.padding(.top, 8)
Expand Down Expand Up @@ -276,6 +299,12 @@ struct ContentView: View {
.sheet(isPresented: $showingAddOpenWRTSheet) {
OpenWRTServerView(viewModel: viewModel)
}
.sheet(isPresented: $showingSourceCode) {
if let url = URL(string: "https://github.com/bin64/Clash-Dash") {
SafariWebView(url: url)
.ignoresSafeArea()
}
}
.refreshable {
await viewModel.checkAllServersStatus()
}
Expand Down
2 changes: 1 addition & 1 deletion Clash Dash/Views/Proxies/ProxyView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ struct ProxyGroupsOverview: View {
}
}

// 单��代理组卡片
// 单个代理组卡片
struct GroupCard: View {
let group: ProxyGroup
@ObservedObject var viewModel: ProxyViewModel
Expand Down

0 comments on commit a56c750

Please sign in to comment.