mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-29 12:46:58 +02:00
Revert "Replace DesignKit with package from ElementX."
This reverts the following commits:4858d72afb6827d2a85492c58743590a9bd1fbe6
This commit is contained in:
@@ -14,33 +14,10 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
import Foundation
|
||||
import DesignKit
|
||||
import DesignTokens
|
||||
|
||||
protocol ThemeSwiftUI: ThemeSwiftUIType {
|
||||
var identifier: ThemeIdentifier { get }
|
||||
var isDark: Bool { get }
|
||||
}
|
||||
|
||||
/// Theme v2 for SwiftUI.
|
||||
@available(iOS 14.0, *)
|
||||
public protocol ThemeSwiftUIType {
|
||||
|
||||
/// Colors object
|
||||
var colors: ElementColors { get }
|
||||
|
||||
/// Fonts object
|
||||
var fonts: ElementFonts { get }
|
||||
|
||||
/// may contain more design components in future, like icons, audio files etc.
|
||||
}
|
||||
|
||||
// MARK: - Legacy Colors
|
||||
|
||||
public extension ElementColors {
|
||||
var legacyTile: Color {
|
||||
let dynamicColor = UIColor { $0.userInterfaceStyle == .light ? .elementLight.tile : .elementDark.tile }
|
||||
return Color(dynamicColor)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ extension ThemeSwiftUI {
|
||||
/// - Parameter userId: The user id used to hash.
|
||||
/// - Returns: The SwiftUI color for the associated userId.
|
||||
func userColor(for userId: String) -> Color {
|
||||
let senderNameColorIndex = Int(userId.vc_hashCode % Int32(colors.contentAndAvatars.count))
|
||||
return colors.contentAndAvatars[senderNameColorIndex]
|
||||
let senderNameColorIndex = Int(userId.vc_hashCode % Int32(colors.namesAndAvatars.count))
|
||||
return colors.namesAndAvatars[senderNameColorIndex]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,12 +14,12 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
import Foundation
|
||||
import DesignKit
|
||||
|
||||
struct DarkThemeSwiftUI: ThemeSwiftUI {
|
||||
var identifier: ThemeIdentifier = .dark
|
||||
let isDark: Bool = true
|
||||
var colors = Color.element
|
||||
var fonts = Font.element
|
||||
var colors: ColorSwiftUI = DarkColors.swiftUI
|
||||
var fonts: FontSwiftUI = FontSwiftUI(values: ElementFonts())
|
||||
}
|
||||
|
||||
@@ -14,12 +14,12 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
import Foundation
|
||||
import DesignKit
|
||||
|
||||
struct DefaultThemeSwiftUI: ThemeSwiftUI {
|
||||
var identifier: ThemeIdentifier = .light
|
||||
let isDark: Bool = false
|
||||
var colors = Color.element
|
||||
var fonts = Font.element
|
||||
var colors: ColorSwiftUI = LightColors.swiftUI
|
||||
var fonts: FontSwiftUI = FontSwiftUI(values: ElementFonts())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user