mirror of
https://github.com/Finb/Bark.git
synced 2025-12-08 21:36:01 +00:00
设置中添加构建信息
This commit is contained in:
parent
138701fcf6
commit
b4c7d58023
3
.github/workflows/testflight.yaml
vendored
3
.github/workflows/testflight.yaml
vendored
@ -42,11 +42,10 @@ jobs:
|
||||
run: |
|
||||
export LC_ALL=en_US.UTF-8
|
||||
export LANG=en_US.UTF-8
|
||||
bundle exec fastlane beta
|
||||
bundle exec fastlane beta build_number:${{ github.event.inputs.buildNumber }}
|
||||
env:
|
||||
APP_STORE_CONNECT_ISSUER_ID: ${{ secrets.APP_STORE_CONNECT_ISSUER_ID }}
|
||||
APP_STORE_CONNECT_KEY_CONTENT: ${{ secrets.APP_STORE_CONNECT_KEY_CONTENT }}
|
||||
BARK_KEY: ${{ secrets.BARK_KEY }}
|
||||
BUILD_NUMBER: ${{ github.event.inputs.buildNumber }}
|
||||
MATCH_GIT_BASIC_AUTHORIZATION: ${{ secrets.MATCH_GIT_BASIC_AUTHORIZATION }}
|
||||
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
|
||||
@ -97,6 +97,8 @@
|
||||
06BBB8C12567B3EF0076F63E /* BaseTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 06BBB8C02567B3EF0076F63E /* BaseTableViewCell.swift */; };
|
||||
06BBB8C92567B6730076F63E /* Operators.swift in Sources */ = {isa = PBXBuildFile; fileRef = 06BBB8C82567B6730076F63E /* Operators.swift */; };
|
||||
06BBB8CE2567B8E60076F63E /* silence.caf in Resources */ = {isa = PBXBuildFile; fileRef = 06BBB8CD2567B8E60076F63E /* silence.caf */; };
|
||||
06C2CF232685B88D0034B127 /* TextCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 06C2CF222685B88D0034B127 /* TextCell.swift */; };
|
||||
06C2CF252685BDB80034B127 /* SpacerCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 06C2CF242685BDB80034B127 /* SpacerCell.swift */; };
|
||||
06C5952D2480E3F8006B98F3 /* LabelCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 06C5952C2480E3F8006B98F3 /* LabelCell.swift */; };
|
||||
06C5952F248107F5006B98F3 /* iCloudStatusCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 06C5952E248107F5006B98F3 /* iCloudStatusCell.swift */; };
|
||||
06C5953124811392006B98F3 /* ArchiveSettingCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 06C5953024811392006B98F3 /* ArchiveSettingCell.swift */; };
|
||||
@ -239,6 +241,8 @@
|
||||
06BBB8C02567B3EF0076F63E /* BaseTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseTableViewCell.swift; sourceTree = "<group>"; };
|
||||
06BBB8C82567B6730076F63E /* Operators.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Operators.swift; sourceTree = "<group>"; };
|
||||
06BBB8CD2567B8E60076F63E /* silence.caf */ = {isa = PBXFileReference; lastKnownFileType = file; path = silence.caf; sourceTree = "<group>"; };
|
||||
06C2CF222685B88D0034B127 /* TextCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextCell.swift; sourceTree = "<group>"; };
|
||||
06C2CF242685BDB80034B127 /* SpacerCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SpacerCell.swift; sourceTree = "<group>"; };
|
||||
06C5952C2480E3F8006B98F3 /* LabelCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LabelCell.swift; sourceTree = "<group>"; };
|
||||
06C5952E248107F5006B98F3 /* iCloudStatusCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = iCloudStatusCell.swift; sourceTree = "<group>"; };
|
||||
06C5953024811392006B98F3 /* ArchiveSettingCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArchiveSettingCell.swift; sourceTree = "<group>"; };
|
||||
@ -337,6 +341,8 @@
|
||||
062B98C7251B27AE004562E7 /* UINavigationItem+Extension.swift */,
|
||||
06AE311B266F54A500B39FBB /* GroupTableViewCell.swift */,
|
||||
06AE311D266F54CC00B39FBB /* GroupCellViewModel.swift */,
|
||||
06C2CF222685B88D0034B127 /* TextCell.swift */,
|
||||
06C2CF242685BDB80034B127 /* SpacerCell.swift */,
|
||||
);
|
||||
path = View;
|
||||
sourceTree = "<group>";
|
||||
@ -797,6 +803,7 @@
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
06C2CF232685B88D0034B127 /* TextCell.swift in Sources */,
|
||||
06BBB896256518760076F63E /* NewServerViewModel.swift in Sources */,
|
||||
06BBB8C92567B6730076F63E /* Operators.swift in Sources */,
|
||||
0603706920E1F89500F4CA05 /* PreviewCardCell.swift in Sources */,
|
||||
@ -837,6 +844,7 @@
|
||||
06885EB6247FB9880004A303 /* MessageSettingsViewController.swift in Sources */,
|
||||
06C5952D2480E3F8006B98F3 /* LabelCell.swift in Sources */,
|
||||
0637FA7C20E0930E00E80174 /* BarkApi.swift in Sources */,
|
||||
06C2CF252685BDB80034B127 /* SpacerCell.swift in Sources */,
|
||||
06BBB8BC2567B3AD0076F63E /* ArchiveSettingCellViewModel.swift in Sources */,
|
||||
0637FA8020E0981E00E80174 /* BarkSettings.swift in Sources */,
|
||||
065BE4402563D649002A8CA4 /* SoundsViewModel.swift in Sources */,
|
||||
|
||||
@ -2,6 +2,8 @@
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>GitHub Run Id</key>
|
||||
<string>0</string>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
||||
<key>CFBundleDisplayName</key>
|
||||
|
||||
@ -86,3 +86,11 @@ hideAllGroups = "Unselect All Groups";
|
||||
showAllGroups = "Select All Groups";
|
||||
groupMessagesNotice = "Grouping of messages allows you to view messages by group.";
|
||||
messageGroup = "Message grouping";
|
||||
|
||||
buildInfo = "Build Info";
|
||||
buildDesc = "Bark was uploaded to the App Store by Github Actions.";
|
||||
|
||||
other = "Other";
|
||||
faq = "FAQ";
|
||||
appSC = "App Source Code";
|
||||
backendSC = "Backend Source Code";
|
||||
|
||||
@ -88,3 +88,11 @@ hideAllGroups = "取消所有选择";
|
||||
showAllGroups = "选择所有群组";
|
||||
groupMessagesNotice = "对消息进行分组,可以选择查看不同的群组。";
|
||||
messageGroup = "推送消息分组";
|
||||
|
||||
buildInfo = "构建信息";
|
||||
buildDesc = "Bark 由 GitHub Actions 构建后上传到 App Store,此信息可帮助你确认当前版本是由开源代码所构建,未经任何人修改。";
|
||||
|
||||
other = "其他";
|
||||
faq = "常见问题";
|
||||
appSC = "App源代码";
|
||||
backendSC = "后端源代码";
|
||||
|
||||
@ -17,6 +17,8 @@ class MessageSettingsViewController: BaseViewController {
|
||||
tableView.register(LabelCell.self, forCellReuseIdentifier: "\(LabelCell.self)")
|
||||
tableView.register(iCloudStatusCell.self, forCellReuseIdentifier: "\(iCloudStatusCell.self)")
|
||||
tableView.register(ArchiveSettingCell.self, forCellReuseIdentifier: "\(ArchiveSettingCell.self)")
|
||||
tableView.register(DetailTextCell.self, forCellReuseIdentifier: "\(DetailTextCell.self)")
|
||||
tableView.register(SpacerCell.self, forCellReuseIdentifier: "\(SpacerCell.self)")
|
||||
|
||||
return tableView
|
||||
}()
|
||||
@ -32,7 +34,11 @@ class MessageSettingsViewController: BaseViewController {
|
||||
guard let viewModel = self.viewModel as? MessageSettingsViewModel else {
|
||||
return
|
||||
}
|
||||
let output = viewModel.transform(input: MessageSettingsViewModel.Input())
|
||||
let output = viewModel.transform(
|
||||
input: MessageSettingsViewModel.Input(
|
||||
itemSelected: self.tableView.rx.modelSelected(MessageSettingItem.self).asDriver()
|
||||
)
|
||||
)
|
||||
|
||||
let dataSource = RxTableViewSectionedReloadDataSource<SectionModel<String, MessageSettingItem>> { (source, tableView, indexPath, item) -> UITableViewCell in
|
||||
switch item {
|
||||
@ -50,14 +56,32 @@ class MessageSettingsViewController: BaseViewController {
|
||||
cell.bindViewModel(model: viewModel)
|
||||
return cell
|
||||
}
|
||||
case let .detail(title,text,textColor,_):
|
||||
if let cell = tableView.dequeueReusableCell(withIdentifier: "\(DetailTextCell.self)") as? DetailTextCell {
|
||||
cell.textLabel?.text = title
|
||||
cell.detailTextLabel?.text = text
|
||||
cell.detailTextLabel?.textColor = textColor
|
||||
return cell
|
||||
}
|
||||
case let .spacer(height, color):
|
||||
if let cell = tableView.dequeueReusableCell(withIdentifier: "\(SpacerCell.self)") as? SpacerCell {
|
||||
cell.height = height
|
||||
cell.backgroundColor = color
|
||||
return cell
|
||||
}
|
||||
}
|
||||
|
||||
return UITableViewCell()
|
||||
}
|
||||
|
||||
output.settings
|
||||
.drive(tableView.rx.items(dataSource: dataSource))
|
||||
.disposed(by: rx.disposeBag)
|
||||
|
||||
|
||||
output.openUrl.drive {[weak self] url in
|
||||
self?.navigationController?.present(BarkSFSafariViewController(url: url), animated: true, completion: nil)
|
||||
}.disposed(by: rx.disposeBag)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -10,13 +10,15 @@ import Foundation
|
||||
import RxSwift
|
||||
import RxCocoa
|
||||
import RxDataSources
|
||||
import Material
|
||||
|
||||
class MessageSettingsViewModel: ViewModel, ViewModelType {
|
||||
struct Input {
|
||||
|
||||
var itemSelected: Driver<MessageSettingItem>
|
||||
}
|
||||
struct Output {
|
||||
var settings:Driver<[SectionModel<String, MessageSettingItem>]>
|
||||
var openUrl:Driver<URL>
|
||||
}
|
||||
func transform(input: Input) -> Output {
|
||||
|
||||
@ -28,6 +30,39 @@ class MessageSettingsViewModel: ViewModel, ViewModelType {
|
||||
settings.append(.label(text: NSLocalizedString("defaultArchiveSettings")))
|
||||
settings.append(.archiveSetting(viewModel: ArchiveSettingCellViewModel(on: ArchiveSettingManager.shared.isArchive)))
|
||||
settings.append(.label(text: NSLocalizedString("archiveNote")))
|
||||
|
||||
if let infoDict = Bundle.main.infoDictionary,
|
||||
let runId = infoDict["GitHub Run Id"] as? String{
|
||||
settings.append(.label(text: NSLocalizedString("buildInfo")))
|
||||
settings.append(.detail(
|
||||
title: "Github Run Id",
|
||||
text:"\(runId)",
|
||||
textColor: Color.grey.darken2,
|
||||
url: URL(string: "https://github.com/Finb/Bark/actions/runs/\(runId)")))
|
||||
settings.append(.label(text: NSLocalizedString("buildDesc")))
|
||||
}
|
||||
|
||||
|
||||
settings.append(.label(text: NSLocalizedString("other")))
|
||||
settings.append(.detail(
|
||||
title: NSLocalizedString("faq"),
|
||||
text: nil,
|
||||
textColor: nil,
|
||||
url: URL(string: "https://day.app/2021/06/barkfaq/")))
|
||||
|
||||
settings.append(.spacer(height: 0.5, color: Color.grey.lighten4))
|
||||
settings.append(.detail(
|
||||
title: NSLocalizedString("appSC"),
|
||||
text: nil,
|
||||
textColor: nil,
|
||||
url: URL(string: "https://github.com/Finb/Bark")))
|
||||
|
||||
settings.append(.spacer(height: 0.5, color: Color.grey.lighten4))
|
||||
settings.append(.detail(
|
||||
title: NSLocalizedString("backendSC"),
|
||||
text: nil,
|
||||
textColor: nil,
|
||||
url: URL(string: "https://github.com/Finb/bark-server")))
|
||||
return settings
|
||||
}()
|
||||
|
||||
@ -43,14 +78,32 @@ class MessageSettingsViewModel: ViewModel, ViewModelType {
|
||||
ArchiveSettingManager.shared.isArchive = on
|
||||
}).disposed(by: rx.disposeBag)
|
||||
|
||||
return Output(settings: Driver<[SectionModel<String, MessageSettingItem>]>
|
||||
.just([SectionModel(model: "model", items: settings)]))
|
||||
let openUrl = input.itemSelected.compactMap { item -> URL? in
|
||||
if case let MessageSettingItem.detail(_, _, _, url) = item {
|
||||
return url
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
return Output(
|
||||
settings: Driver<[SectionModel<String, MessageSettingItem>]>
|
||||
.just([SectionModel(model: "model", items: settings)]),
|
||||
openUrl: openUrl
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
enum MessageSettingItem {
|
||||
// 普通标题标签
|
||||
case label(text:String)
|
||||
// iCloud 状态
|
||||
case iCloudStatus
|
||||
// 默认保存
|
||||
case archiveSetting(viewModel:ArchiveSettingCellViewModel)
|
||||
// 带 详细按钮的 文本cell
|
||||
case detail(title:String?, text:String?, textColor:UIColor?, url:URL?)
|
||||
// 分隔线
|
||||
case spacer(height:CGFloat, color:UIColor?)
|
||||
}
|
||||
|
||||
27
View/SpacerCell.swift
Normal file
27
View/SpacerCell.swift
Normal file
@ -0,0 +1,27 @@
|
||||
//
|
||||
// SpacerCell.swift
|
||||
// Bark
|
||||
//
|
||||
// Created by huangfeng on 2021/6/25.
|
||||
// Copyright © 2021 Fin. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
class SpacerCell: UITableViewCell {
|
||||
var height:CGFloat = 0 {
|
||||
didSet{
|
||||
self.contentView.snp.remakeConstraints { make in
|
||||
make.height.equalTo(height)
|
||||
}
|
||||
}
|
||||
}
|
||||
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
|
||||
super.init(style: style, reuseIdentifier: reuseIdentifier)
|
||||
self.backgroundColor = UIColor.clear
|
||||
self.selectionStyle = .none
|
||||
}
|
||||
required init?(coder aDecoder: NSCoder) {
|
||||
fatalError("init(coder:) has not been implemented")
|
||||
}
|
||||
}
|
||||
22
View/TextCell.swift
Normal file
22
View/TextCell.swift
Normal file
@ -0,0 +1,22 @@
|
||||
//
|
||||
// TextCell.swift
|
||||
// Bark
|
||||
//
|
||||
// Created by huangfeng on 2021/6/25.
|
||||
// Copyright © 2021 Fin. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
class DetailTextCell: UITableViewCell {
|
||||
|
||||
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
|
||||
super.init(style: .value1, reuseIdentifier: reuseIdentifier)
|
||||
self.selectionStyle = .none
|
||||
self.accessoryType = .disclosureIndicator
|
||||
}
|
||||
required init?(coder aDecoder: NSCoder) {
|
||||
fatalError("init(coder:) has not been implemented")
|
||||
}
|
||||
|
||||
}
|
||||
@ -17,14 +17,19 @@ default_platform(:ios)
|
||||
|
||||
platform :ios do
|
||||
desc "Push a new beta build to TestFlight"
|
||||
lane :beta do
|
||||
lane :beta do | options |
|
||||
setup_ci
|
||||
|
||||
build = ENV["BUILD_NUMBER"]
|
||||
build = options[:build_number]
|
||||
if !build.nil? && !build.empty?
|
||||
increment_build_number(build_number: build.to_i)
|
||||
end
|
||||
|
||||
run_id = ENV["GITHUB_RUN_ID"]
|
||||
if !run_id.nil? && !run_id.empty?
|
||||
set_info_plist_value(path: "./Bark/Info.plist", key: "GitHub Run Id", value: run_id)
|
||||
end
|
||||
|
||||
match(type: "appstore", readonly: is_ci)
|
||||
|
||||
build_app(workspace: "Bark.xcworkspace", scheme: "Bark")
|
||||
@ -40,7 +45,6 @@ platform :ios do
|
||||
upload_to_testflight
|
||||
|
||||
bark_key = ENV["BARK_KEY"]
|
||||
run_id = ENV["GITHUB_RUN_ID"]
|
||||
%x( curl https://api.day.app/#{bark_key}/Bark%20has%20completed%20processing?isArchive=0&url=https%3A%2F%2Fgithub.com%2FFinb%2FBark%2Factions%2Fruns%2F#{run_id} )
|
||||
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user