Skip to content

Commit

Permalink
Merge pull request #337 from AgoraIO/light-dark-mode
Browse files Browse the repository at this point in the history
Dark Mode Fix
  • Loading branch information
plutoless authored Mar 7, 2023
2 parents 95fca06 + eeec895 commit 6fee157
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 8 deletions.
36 changes: 30 additions & 6 deletions iOS/APIExample/APIExample/Common/NetworkManager/ToastView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ class ToastView: UIView {
private lazy var label: UILabel = {
let label = UILabel()
label.text = ""
label.textColor = .white
if #available(iOS 13.0, *) {
label.textColor = .label
} else {
label.textColor = .white
}
label.font = .systemFont(ofSize: 14)
label.numberOfLines = 0
label.preferredMaxLayoutWidth = UIScreen.main.bounds.width - 60
Expand Down Expand Up @@ -66,9 +70,13 @@ class ToastView: UIView {
static func showWait(text: String, view: UIView? = nil) {
DispatchQueue.main.async {
self.currentToastView?.removeFromSuperview()
var textColor: UIColor = .white
if #available(iOS 13.0, *) {
textColor = .label
}
let toastView = show(text: text,
tagImage: nil,
textColor: .white,
textColor: textColor,
font: nil,
postion: .center,
view: view)
Expand All @@ -92,8 +100,12 @@ class ToastView: UIView {

static func show(text: String, duration: CGFloat = 2.5, view: UIView? = nil) {
DispatchQueue.main.async {
var textColor: UIColor = .white
if #available(iOS 13.0, *) {
textColor = .label
}
let toastView = show(text: text, tagImage: nil,
textColor: .white, font: nil,
textColor: textColor, font: nil,
postion: .center,
view: view)
showAnimation(toastView: toastView, duration: duration)
Expand All @@ -102,8 +114,12 @@ class ToastView: UIView {

static func show(text: String, postion: ToastViewPostion = .center) {
DispatchQueue.main.async {
var textColor: UIColor = .white
if #available(iOS 13.0, *) {
textColor = .label
}
let toastView = show(text: text, tagImage: nil,
textColor: .white, font: nil,
textColor: textColor, font: nil,
postion: postion,
view: nil)
showAnimation(toastView: toastView)
Expand All @@ -115,8 +131,12 @@ class ToastView: UIView {
duration: CGFloat = 2.5,
view: UIView? = nil) {
DispatchQueue.main.async {
var textColor: UIColor = .white
if #available(iOS 13.0, *) {
textColor = .label
}
let toastView = show(text: text, tagImage: nil,
textColor: .white, font: nil,
textColor: textColor, font: nil,
postion: postion,
view: view)
showAnimation(toastView: toastView, duration: duration)
Expand All @@ -125,8 +145,12 @@ class ToastView: UIView {

static func show(text: String, tagImage: UIImage? = nil, postion: ToastViewPostion = .center, view: UIView? = nil) {
DispatchQueue.main.async {
var textColor: UIColor = .white
if #available(iOS 13.0, *) {
textColor = .label
}
let toastView = show(text: text, tagImage: tagImage,
textColor: .white, font: nil,
textColor: textColor, font: nil,
postion: postion,
view: view)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ class SpatialAudioActionSheet: UIView {
}()
private lazy var attenuationLabel: UILabel = {
let label = UILabel()
label.text = "Attenuatuin".localized
label.text = "Attenuation".localized
return label
}()
private lazy var muteSwitch: UISwitch = {
Expand Down Expand Up @@ -356,7 +356,11 @@ class SpatialAudioActionSheet: UIView {
}

private func setupUI() {
backgroundColor = .white
if #available(iOS 13.0, *) {
backgroundColor = .tertiarySystemBackground
} else {
backgroundColor = .white
}
addSubview(muteLabel)
addSubview(voiceBlurLabel)
addSubview(airborneLabel)
Expand Down

0 comments on commit 6fee157

Please sign in to comment.