Skip to content

Commit

Permalink
[trello.com/c/sI4VXuJa] Restyle notification view: update text colors
Browse files Browse the repository at this point in the history
  • Loading branch information
IanaaDvlp committed Nov 5, 2024
1 parent 83805d1 commit 391cfea
Showing 1 changed file with 24 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ class NotificationViewController: UIViewController, UNNotificationContentExtensi
senderAddressLabel.text = ""
messageLabel.text = ""
dateLabel.text = ""

updateTextColors()
}

func didReceive(_ notification: UNNotification) {
Expand Down Expand Up @@ -81,12 +83,14 @@ class NotificationViewController: UIViewController, UNNotificationContentExtensi
message = raw
} else {
guard let passphrase: String = keychainStore.get(passphraseStoreKey),
let keys = nativeCore.createKeypairFor(passphrase: passphrase),
let chat = transaction.asset.chat,
let raw = nativeCore.decodeMessage(rawMessage: chat.message,
rawNonce: chat.ownMessage,
senderPublicKey: transaction.senderPublicKey,
privateKey: keys.privateKey) else {
let keys = nativeCore.createKeypairFor(passphrase: passphrase),
let chat = transaction.asset.chat,
let raw = nativeCore.decodeMessage(
rawMessage: chat.message,
rawNonce: chat.ownMessage,
senderPublicKey: transaction.senderPublicKey,
privateKey: keys.privateKey
) else {
showError()
return
}
Expand Down Expand Up @@ -158,6 +162,20 @@ class NotificationViewController: UIViewController, UNNotificationContentExtensi
}

// MARK: - UI
private func updateTextColors() {
if self.traitCollection.userInterfaceStyle == .dark {
senderNameLabel.textColor = .white
senderAddressLabel.textColor = .white
messageLabel.textColor = .white
dateLabel.textColor = .white
} else {
senderNameLabel.textColor = .black
senderAddressLabel.textColor = .black
messageLabel.textColor = .black
dateLabel.textColor = .black
}
}

private func showError(with message: String? = nil) {
let warningView = NotificationWarningView()

Expand Down

0 comments on commit 391cfea

Please sign in to comment.