Skip to content

Commit

Permalink
Fix status indicators
Browse files Browse the repository at this point in the history
  • Loading branch information
Tha14 authored and zoff99 committed Nov 26, 2022
1 parent 8b742e1 commit 15bcc8f
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 27 deletions.
56 changes: 30 additions & 26 deletions Antidote/UserStatusView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import SnapKit

class UserStatusView: StaticBackgroundView {
struct Constants {
static let DefaultSize = 12.0
static let DefaultSize = 14.0
}

fileprivate var roundView: StaticBackgroundView?
Expand Down Expand Up @@ -67,38 +67,42 @@ private extension UserStatusView {

roundView!.snp.makeConstraints {
$0.center.equalTo(self)
$0.size.equalTo(self).offset(-2.0)
$0.size.equalTo(self).offset(-4.0)
}
}

func userStatusWasUpdated() {
if let theme = theme {

// TODO: show userstatus aswell as connectionstatus
// for now rather show connectionstatus
/*
switch userStatus {
case .offline:
roundView?.setStaticBackgroundColor(theme.colorForType(.OfflineStatus))
case .online:
roundView?.setStaticBackgroundColor(theme.colorForType(.OnlineStatus))
case .away:
roundView?.setStaticBackgroundColor(theme.colorForType(.AwayStatus))
case .busy:
roundView?.setStaticBackgroundColor(theme.colorForType(.BusyStatus))
// TODO: show userstatus as well as connectionstatus
// Currently showing the userstatus when debug mode is off, otherwise the connection status

if (UserDefaultsManager().DebugMode == false) {
//Default user status indicator
switch userStatus {
case .offline:
roundView?.setStaticBackgroundColor(theme.colorForType(.OfflineStatus))
case .online:
roundView?.setStaticBackgroundColor(theme.colorForType(.OnlineStatus))
case .away:
roundView?.setStaticBackgroundColor(theme.colorForType(.AwayStatus))
case .busy:
roundView?.setStaticBackgroundColor(theme.colorForType(.BusyStatus))
}
} else {
//Debug connection status indicator
switch connectionStatus {
case .tcp:
roundView?.setStaticBackgroundColor(theme.colorForType(.AwayStatus))
case .udp:
roundView?.setStaticBackgroundColor(theme.colorForType(.OnlineStatus))
case .none:
fallthrough
default:
roundView?.setStaticBackgroundColor(theme.colorForType(.OfflineStatus))
}
}
*/
switch connectionStatus {
case .tcp:
roundView?.setStaticBackgroundColor(theme.colorForType(.AwayStatus))
case .udp:
roundView?.setStaticBackgroundColor(theme.colorForType(.OnlineStatus))
case .none:
roundView?.setStaticBackgroundColor(theme.colorForType(.OfflineStatus))
default:
roundView?.setStaticBackgroundColor(theme.colorForType(.OfflineStatus))
}


let background = showExternalCircle ? theme.colorForType(.StatusBackground) : .clear
setStaticBackgroundColor(background)
}
Expand Down
2 changes: 1 addition & 1 deletion Antidote/default-theme.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ colors:
gray: CCCCCC
lightgraypink: EFEFF4
darkgray: AAAAAA
color_offline_status: D43F3F
color_offline_status: "A3A3A3"
darkgray2: 8C8C8C
lightgrayblue: EDF3F5
simpleblue: 2E76D3
Expand Down

0 comments on commit 15bcc8f

Please sign in to comment.