mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-17 23:18:27 +02:00
Added BWIThemeService helper class
This commit is contained in:
@@ -23,7 +23,7 @@ import SwiftUI
|
||||
|
||||
@available(iOS 14.0, *)
|
||||
class func makeViewController(session: MXSession) -> UIViewController {
|
||||
return UIHostingController(rootView: DeveloperSettingsView(session: session))
|
||||
return UIHostingController(rootView: DeveloperSettingsView(session: session).environmentObject(BWIThemeService.shared))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ import SwiftUI
|
||||
struct DeveloperSettingsView: View {
|
||||
let session: MXSession?
|
||||
|
||||
@EnvironmentObject var themeService: BWIThemeService
|
||||
@State private var showAlert = false
|
||||
@State private var showAlertBirthdayCampaign = false
|
||||
@State private var permalinkPrefix: String? = UserDefaults.standard.string(forKey: "bwi_permalink_prefix")
|
||||
@@ -42,7 +43,7 @@ struct DeveloperSettingsView: View {
|
||||
SwiftUI.Section {
|
||||
Button(action: { showAlert = createNewPersonalNotesRoom(mxSession: session) }) {
|
||||
Text(BWIL10n.bwiSettingsDeveloperCreateNewPersonalNotesRoom)
|
||||
.foregroundColor(Color(ThemeService.shared().theme.tintColor))
|
||||
.foregroundColor(Color(themeService.theme.tintColor))
|
||||
.font(.system(size: 17))
|
||||
}
|
||||
.alert(isPresented: $showAlert) {
|
||||
@@ -51,7 +52,7 @@ struct DeveloperSettingsView: View {
|
||||
|
||||
Button(action: { showAlert = resetMatomoInfoScreen(mxSession: session) }) {
|
||||
Text(BWIL10n.bwiSettingsDeveloperResetMatomoInfo)
|
||||
.foregroundColor(Color(ThemeService.shared().theme.tintColor))
|
||||
.foregroundColor(Color(themeService.theme.tintColor))
|
||||
.font(.system(size: 17))
|
||||
}
|
||||
.alert(isPresented: $showAlert) {
|
||||
@@ -59,7 +60,7 @@ struct DeveloperSettingsView: View {
|
||||
}
|
||||
Button(action: { showAlertBirthdayCampaign = resetBirthdayCampaignScreen(mxSession: session) }) {
|
||||
Text(BWIL10n.bwiSettingsDeveloperSettingsResetBirthdayBanner)
|
||||
.foregroundColor(Color(ThemeService.shared().theme.tintColor))
|
||||
.foregroundColor(Color(themeService.theme.tintColor))
|
||||
.font(.system(size: 17))
|
||||
}
|
||||
.alert(isPresented: $showAlertBirthdayCampaign) {
|
||||
@@ -67,34 +68,35 @@ struct DeveloperSettingsView: View {
|
||||
}
|
||||
Button(action: { _ = restrictUser(mxSession: session) }) {
|
||||
Text(BWIL10n.bwiSettingsDeveloperRestrictUser)
|
||||
.foregroundColor(Color(ThemeService.shared().theme.tintColor))
|
||||
.foregroundColor(Color(themeService.theme.tintColor))
|
||||
.font(.system(size: 17))
|
||||
}
|
||||
Button(action: { _ = unrestrictUser(mxSession: session) }) {
|
||||
Text(BWIL10n.bwiSettingsDeveloperUnrestrictUser)
|
||||
.foregroundColor(Color(ThemeService.shared().theme.tintColor))
|
||||
.foregroundColor(Color(themeService.theme.tintColor))
|
||||
.font(.system(size: 17))
|
||||
}
|
||||
Button(action: { _ = unmarkBannerVersion(mxSession: session) }) {
|
||||
Text(BWIL10n.bwiSettingsDeveloperUnmarkBanner)
|
||||
.foregroundColor(Color(ThemeService.shared().theme.tintColor))
|
||||
.foregroundColor(Color(themeService.theme.tintColor))
|
||||
.font(.system(size: 17))
|
||||
}
|
||||
}
|
||||
SwiftUI.Section(header: Text(BWIL10n.bwiSettingsDeveloperIntroduceFederation)) {
|
||||
Button(action: { showIntroduceFederation = true }) {
|
||||
Text(BWIL10n.bwiSettingsDeveloperIntroduceFederationPreview)
|
||||
.foregroundColor(Color(ThemeService.shared().theme.tintColor))
|
||||
.foregroundColor(Color(themeService.theme.tintColor))
|
||||
.font(.system(size: 17))
|
||||
}
|
||||
.sheet(isPresented: $showIntroduceFederation) {
|
||||
IntroduceFederationView()
|
||||
.interactiveDismissDisabled()
|
||||
.environmentObject(BWIThemeService.shared)
|
||||
}
|
||||
if let session = session {
|
||||
Button(action: { BWIAccountNotificationService(mxSession: session).setShowFederationIntroductionFlag(true) }) {
|
||||
Text(BWIL10n.bwiSettingsDeveloperIntroduceFederationReset)
|
||||
.foregroundColor(Color(ThemeService.shared().theme.tintColor))
|
||||
.foregroundColor(Color(themeService.theme.tintColor))
|
||||
.font(.system(size: 17))
|
||||
}
|
||||
}
|
||||
@@ -172,7 +174,7 @@ fileprivate func resetMatomoInfoScreen(mxSession: MXSession?) -> Bool {
|
||||
guard let mxSession = mxSession else {
|
||||
return false
|
||||
}
|
||||
BWIAnalyticsAccountDataService(mxSession: mxSession)
|
||||
_ = BWIAnalyticsAccountDataService(mxSession: mxSession)
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user