Skip to content

Commit

Permalink
do not showStatusMessage if no label has valid String
Browse files Browse the repository at this point in the history
  • Loading branch information
LEOYoon-Tsaw committed May 23, 2024
1 parent 4b6874d commit bafeed5
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions sources/SquirrelApplicationDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -261,13 +261,11 @@ private func notificationHandler(contextObject: UnsafeMutableRawPointer?, sessio
if !delegate.enableNotifications {
return
}
// schema change

if messageType == "schema", let messageValue = messageValue, let schemaName = try? /^[^\/]*\/(.*)$/.firstMatch(in: messageValue)?.output.1 {
delegate.showStatusMessage(msgTextLong: String(schemaName), msgTextShort: String(schemaName))
return
}
// option change
if messageType == "option" {
} else if messageType == "option" {
let state = messageValue?.first != "!"
let optionName = if state {
messageValue
Expand All @@ -288,7 +286,9 @@ private func notificationHandler(contextObject: UnsafeMutableRawPointer?, sessio

private extension SquirrelApplicationDelegate {
func showStatusMessage(msgTextLong: String?, msgTextShort: String?) {
panel?.updateStatus(long: msgTextLong ?? "", short: msgTextShort ?? "")
if !(msgTextLong ?? "").isEmpty || !(msgTextShort ?? "").isEmpty {
panel?.updateStatus(long: msgTextLong ?? "", short: msgTextShort ?? "")
}
}

func shutdownRime() {
Expand Down

0 comments on commit bafeed5

Please sign in to comment.