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 deaecca
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 @@ -280,7 +278,9 @@ private func notificationHandler(contextObject: UnsafeMutableRawPointer?, sessio
let stateLabelShort = delegate.rimeAPI.get_state_label_abbreviated(sessionId, name, state, true)
let longLabel = stateLabelLong.str.map { String(cString: $0) }
let shortLabel = stateLabelShort.str.map { String(cString: $0) }
delegate.showStatusMessage(msgTextLong: longLabel, msgTextShort: shortLabel)
if longLabel != nil || shortLabel != nil {
delegate.showStatusMessage(msgTextLong: longLabel, msgTextShort: shortLabel)
}
}
}
}
Expand Down

0 comments on commit deaecca

Please sign in to comment.