()
| 1098 | } |
| 1099 | |
| 1100 | func (a *App) adBlockStatusDTO() AdBlockStatusDTO { |
| 1101 | enabled := false |
| 1102 | if a.config != nil { |
| 1103 | enabled = a.config.GetConfig().Settings.AdBlock |
| 1104 | } |
| 1105 | connected := false |
| 1106 | engineAdBlock := false |
| 1107 | if a.proxy != nil { |
| 1108 | st := a.proxy.GetStatus() |
| 1109 | connected = st.IsConnected |
| 1110 | engineAdBlock = a.proxy.IsAdBlockActive() |
| 1111 | } |
| 1112 | if a.filters == nil { |
| 1113 | return AdBlockStatusDTO{Enabled: enabled, CAInstalled: filter.CAInstalled()} |
| 1114 | } |
| 1115 | s := a.filters.Status(enabled, connected, engineAdBlock) |
| 1116 | return AdBlockStatusDTO{ |
| 1117 | Enabled: s.Enabled, |
| 1118 | FilterCount: s.FilterCount, |
| 1119 | RuleSetsReady: s.RuleSetsReady, |
| 1120 | RuleSetsTotal: s.RuleSetsTotal, |
| 1121 | LastUpdatedUnix: s.LastUpdatedUnix, |
| 1122 | LastError: s.LastError, |
| 1123 | CAInstalled: s.CAInstalled, |
| 1124 | NetworkBlocked: s.NetworkBlocked, |
| 1125 | CosmeticBlocked: s.CosmeticBlocked, |
| 1126 | UpdateInProgress: s.UpdateInProgress, |
| 1127 | UpdatePhase: s.UpdatePhase, |
| 1128 | UpdateCurrent: s.UpdateCurrent, |
| 1129 | UpdateTotal: s.UpdateTotal, |
| 1130 | UpdateItem: s.UpdateItem, |
| 1131 | NetworkBlockActive: s.NetworkBlockActive, |
| 1132 | NeedsReconnect: s.NeedsReconnect, |
| 1133 | } |
| 1134 | } |
| 1135 | |
| 1136 | func (a *App) GetAdBlockStatus() AdBlockStatusDTO { |
| 1137 | return a.adBlockStatusDTO() |
no test coverage detected