diff --git a/Mastodon.xcodeproj/xcuserdata/mainasuk.xcuserdatad/xcschemes/xcschememanagement.plist b/Mastodon.xcodeproj/xcuserdata/mainasuk.xcuserdatad/xcschemes/xcschememanagement.plist
index 0dd2f7853..b0069747c 100644
--- a/Mastodon.xcodeproj/xcuserdata/mainasuk.xcuserdatad/xcschemes/xcschememanagement.plist
+++ b/Mastodon.xcodeproj/xcuserdata/mainasuk.xcuserdatad/xcschemes/xcschememanagement.plist
@@ -7,12 +7,12 @@
AppShared.xcscheme_^#shared#^_
orderHint
- 24
+ 25
CoreDataStack.xcscheme_^#shared#^_
orderHint
- 23
+ 24
Mastodon - ASDK.xcscheme_^#shared#^_
@@ -37,7 +37,7 @@
MastodonIntent.xcscheme_^#shared#^_
orderHint
- 26
+ 27
MastodonIntents.xcscheme_^#shared#^_
@@ -57,7 +57,7 @@
ShareActionExtension.xcscheme_^#shared#^_
orderHint
- 25
+ 23
SuppressBuildableAutocreation
diff --git a/Mastodon/Diffiable/Item/SettingsItem.swift b/Mastodon/Diffiable/Item/SettingsItem.swift
index e82d0e1f9..ed472808a 100644
--- a/Mastodon/Diffiable/Item/SettingsItem.swift
+++ b/Mastodon/Diffiable/Item/SettingsItem.swift
@@ -58,6 +58,7 @@ extension SettingsItem {
enum Link: CaseIterable, Hashable {
case accountSettings
+ case github
case termsOfService
case privacyPolicy
case clearMediaCache
@@ -66,6 +67,7 @@ extension SettingsItem {
var title: String {
switch self {
case .accountSettings: return L10n.Scene.Settings.Section.BoringZone.accountSettings
+ case .github: return "GitHub"
case .termsOfService: return L10n.Scene.Settings.Section.BoringZone.terms
case .privacyPolicy: return L10n.Scene.Settings.Section.BoringZone.privacy
case .clearMediaCache: return L10n.Scene.Settings.Section.SpicyZone.clear
@@ -76,6 +78,7 @@ extension SettingsItem {
var textColor: UIColor {
switch self {
case .accountSettings: return Asset.Colors.brandBlue.color
+ case .github: return Asset.Colors.brandBlue.color
case .termsOfService: return Asset.Colors.brandBlue.color
case .privacyPolicy: return Asset.Colors.brandBlue.color
case .clearMediaCache: return .systemRed
diff --git a/Mastodon/Extension/MetaLabel.swift b/Mastodon/Extension/MetaLabel.swift
index e5a588e15..e1ea32731 100644
--- a/Mastodon/Extension/MetaLabel.swift
+++ b/Mastodon/Extension/MetaLabel.swift
@@ -66,7 +66,7 @@ extension MetaLabel {
case .settingTableFooter:
font = .preferredFont(forTextStyle: .body)
- textColor = Asset.Colors.Label.primary.color
+ textColor = Asset.Colors.Label.secondary.color
numberOfLines = 0
textContainer.maximumNumberOfLines = 0
paragraphStyle.alignment = .center
diff --git a/Mastodon/Scene/Compose/ComposeViewModel.swift b/Mastodon/Scene/Compose/ComposeViewModel.swift
index 9964dd2ba..601aeae04 100644
--- a/Mastodon/Scene/Compose/ComposeViewModel.swift
+++ b/Mastodon/Scene/Compose/ComposeViewModel.swift
@@ -95,7 +95,36 @@ final class ComposeViewModel: NSObject {
case .post, .hashtag, .mention: self.title = CurrentValueSubject(L10n.Scene.Compose.Title.newPost)
case .reply: self.title = CurrentValueSubject(L10n.Scene.Compose.Title.newReply)
}
- self.selectedStatusVisibility = CurrentValueSubject(context.authenticationService.activeMastodonAuthentication.value?.user.locked == true ? .private : .public)
+ self.selectedStatusVisibility = {
+ // default private when user locked
+ var visibility: ComposeToolbarView.VisibilitySelectionType = context.authenticationService.activeMastodonAuthentication.value?.user.locked == true ? .private : .public
+ // set visibility for reply post
+ switch composeKind {
+ case .reply(let repliedToStatusObjectID):
+ context.managedObjectContext.performAndWait {
+ guard let status = try? context.managedObjectContext.existingObject(with: repliedToStatusObjectID) as? Status else {
+ assertionFailure()
+ return
+ }
+ guard let repliedStatusVisibility = status.visibilityEnum else { return }
+ switch repliedStatusVisibility {
+ case .public, .unlisted:
+ // keep default
+ break
+ case .private:
+ visibility = .private
+ case .direct:
+ visibility = .direct
+ case ._other:
+ assertionFailure()
+ break
+ }
+ }
+ default:
+ break
+ }
+ return CurrentValueSubject(visibility)
+ }()
self.activeAuthentication = CurrentValueSubject(context.authenticationService.activeMastodonAuthentication.value)
self.activeAuthenticationBox = CurrentValueSubject(context.authenticationService.activeMastodonAuthenticationBox.value)
super.init()
diff --git a/Mastodon/Scene/Onboarding/Register/MastodonRegisterViewController.swift b/Mastodon/Scene/Onboarding/Register/MastodonRegisterViewController.swift
index 5ea418e45..ffef3d872 100644
--- a/Mastodon/Scene/Onboarding/Register/MastodonRegisterViewController.swift
+++ b/Mastodon/Scene/Onboarding/Register/MastodonRegisterViewController.swift
@@ -744,13 +744,33 @@ extension MastodonRegisterViewController {
let username = viewModel.username.value
let email = viewModel.email.value
let password = viewModel.password.value
+
+ let locale: String = {
+ let fallbackLanguageCode = Locale.current.languageCode ?? "en"
+ guard let identifier = Locale.preferredLanguages.first else {
+ return fallbackLanguageCode
+ }
+ let local = Locale(identifier: identifier)
+ guard let languageCode = local.languageCode else {
+ return fallbackLanguageCode
+ }
+ switch languageCode {
+ case "zh":
+ // Check Simplified Chinese / Traditional Chinese
+ // https://github.com/gunchleoc/mastodon/blob/ed6153b8f24d3a8f5a124cc95683bd1f20aec882/app/helpers/settings_helper.rb
+ guard let regionCode = local.regionCode else { return languageCode }
+ return "zh" + "-" + regionCode
+ default:
+ return languageCode
+ }
+ }()
let query = Mastodon.API.Account.RegisterQuery(
reason: viewModel.reason.value,
username: username,
email: email,
password: password,
agreement: true, // user confirmed in the server rules scene
- locale: Locale.current.languageCode ?? "en"
+ locale: locale
)
// register without show server rules
diff --git a/Mastodon/Scene/Settings/SettingsViewController.swift b/Mastodon/Scene/Settings/SettingsViewController.swift
index 9a240daaf..c6e41e624 100644
--- a/Mastodon/Scene/Settings/SettingsViewController.swift
+++ b/Mastodon/Scene/Settings/SettingsViewController.swift
@@ -105,18 +105,18 @@ class SettingsViewController: UIViewController, NeedsDependency {
}()
let tableFooterLabel = MetaLabel(style: .settingTableFooter)
-// lazy var tableFooterView: UIView = {
-// // init with a frame to fix a conflict ('UIView-Encapsulated-Layout-Height' UIStackView:0x7ffe41e47da0.height == 0)
-// let view = UIStackView(frame: CGRect(x: 0, y: 0, width: 320, height: 320))
-// view.isLayoutMarginsRelativeArrangement = true
-// view.layoutMargins = UIEdgeInsets(top: 20, left: 20, bottom: 20, right: 20)
-// view.axis = .vertical
-// view.alignment = .center
-//
-// tableFooterLabel.linkDelegate = self
-// view.addArrangedSubview(tableFooterLabel)
-// return view
-// }()
+ lazy var tableFooterView: UIView = {
+ // init with a frame to fix a conflict ('UIView-Encapsulated-Layout-Height' UIStackView:0x7ffe41e47da0.height == 0)
+ let view = UIStackView(frame: CGRect(x: 0, y: 0, width: 320, height: 320))
+ view.isLayoutMarginsRelativeArrangement = true
+ view.layoutMargins = UIEdgeInsets(top: 20, left: 20, bottom: 20, right: 20)
+ view.axis = .vertical
+ view.alignment = .center
+
+ // tableFooterLabel.linkDelegate = self
+ view.addArrangedSubview(tableFooterLabel)
+ return view
+ }()
override func viewDidLoad() {
super.viewDidLoad()
@@ -188,24 +188,31 @@ class SettingsViewController: UIViewController, NeedsDependency {
}
.store(in: &disposeBag)
- viewModel.currentInstance
- .receive(on: RunLoop.main)
- .sink { [weak self] instance in
- guard let self = self else { return }
- let version = instance?.version ?? "-"
- let link = #"mastodon/mastodon"#
- let content = L10n.Scene.Settings.Footer.mastodonDescription(link, version)
- let mastodonContent = MastodonContent(content: content, emojis: [:])
- do {
- let metaContent = try MastodonMetaContent.convert(document: mastodonContent)
- self.tableFooterLabel.configure(content: metaContent)
- } catch {
- let metaContent = PlaintextMetaContent(string: "")
- self.tableFooterLabel.configure(content: metaContent)
- assertionFailure()
- }
- }
- .store(in: &disposeBag)
+
+ let footer = "Mastodon v\(UIApplication.appVersion()) (\(UIApplication.appBuild()))"
+ let metaContent = PlaintextMetaContent(string: footer)
+ tableFooterLabel.configure(content: metaContent)
+
+ // FIXME:
+ // needs a workaround for GitHub link
+// viewModel.currentInstance
+// .receive(on: RunLoop.main)
+// .sink { [weak self] instance in
+// guard let self = self else { return }
+// let version = instance?.version ?? "-"
+// let link = #"mastodon/mastodon"#
+// let content = L10n.Scene.Settings.Footer.mastodonDescription(link, version)
+// let mastodonContent = MastodonContent(content: content, emojis: [:])
+// do {
+// let metaContent = try MastodonMetaContent.convert(document: mastodonContent)
+// self.tableFooterLabel.configure(content: metaContent)
+// } catch {
+// let metaContent = PlaintextMetaContent(string: "")
+// self.tableFooterLabel.configure(content: metaContent)
+// assertionFailure()
+// }
+// }
+// .store(in: &disposeBag)
}
private func setupView() {
@@ -259,7 +266,7 @@ class SettingsViewController: UIViewController, NeedsDependency {
settingsAppearanceTableViewCellDelegate: self,
settingsToggleCellDelegate: self
)
- // tableView.tableFooterView = tableFooterView
+ tableView.tableFooterView = tableFooterView
}
func alertToSignout() {
@@ -376,6 +383,13 @@ extension SettingsViewController: UITableViewDelegate {
guard let box = context.authenticationService.activeMastodonAuthenticationBox.value,
let url = URL(string: "https://\(box.domain)/auth/edit") else { return }
viewModel.openAuthenticationPage(authenticateURL: url, presentationContextProvider: self)
+ case .github:
+ guard let url = URL(string: "https://github.com/mastodon/mastodon-ios") else { break }
+ coordinator.present(
+ scene: .safari(url: url),
+ from: self,
+ transition: .safariPresent(animated: true, completion: nil)
+ )
case .termsOfService, .privacyPolicy:
// same URL
guard let url = viewModel.privacyURL else { break }
diff --git a/Mastodon/Scene/Settings/SettingsViewModel.swift b/Mastodon/Scene/Settings/SettingsViewModel.swift
index 9bc0adce2..9158e8169 100644
--- a/Mastodon/Scene/Settings/SettingsViewModel.swift
+++ b/Mastodon/Scene/Settings/SettingsViewModel.swift
@@ -130,6 +130,7 @@ extension SettingsViewModel {
let boringZoneSettingsItems: [SettingsItem] = {
let links: [SettingsItem.Link] = [
.accountSettings,
+ .github,
.termsOfService,
.privacyPolicy
]
diff --git a/Podfile.lock b/Podfile.lock
index c59f13a9b..b2c540abf 100644
--- a/Podfile.lock
+++ b/Podfile.lock
@@ -78,6 +78,6 @@ SPEC CHECKSUMS:
Texture: 2f109e937850d94d1d07232041c9c7313ccddb81
"UITextField+Shake": 298ac5a0f239d731bdab999b19b628c956ca0ac3
-PODFILE CHECKSUM: 1ea006302c191ee52b6206e4957aa78fb66fe690
+PODFILE CHECKSUM: 4db0bdf969729c5758bd923e33d9e097cb892086
-COCOAPODS: 1.10.1
+COCOAPODS: 1.10.2