ReconnectCwtchForeground should reload Profiles
This commit is contained in:
parent
afed5c3703
commit
f485e372a7
|
@ -232,7 +232,16 @@ func ReconnectCwtchForeground() {
|
|||
return
|
||||
}
|
||||
|
||||
// TODO: Need To Repopulate UI
|
||||
// Repopulate the UI on Android by iterating through all loaded profiles and treating them as New Peer loads. The ReloadEvent field
|
||||
// suppresses any listen/connection actions and simply sends updated attributes to the UI.
|
||||
// The UI is designed in such a way that "NewPeer" events are treated as updates.
|
||||
// TODO: if/when we break apart NewPeer into smaller chunks for the UI to fetch, the need to do this here will go away.
|
||||
peerList := application.ListProfiles()
|
||||
for _, onion := range peerList {
|
||||
eventHandler.Push(event.NewEvent(event.NewPeer, map[event.Field]string{event.Identity: onion, utils.ReloadEvent: event.True}))
|
||||
}
|
||||
|
||||
|
||||
|
||||
settingsJson, _ := json.Marshal(application.ReadSettings())
|
||||
application.GetPrimaryBus().Publish(event.NewEvent(settings.UpdateGlobalSettings, map[event.Field]string{event.Data: string(settingsJson)}))
|
||||
|
|
|
@ -30,11 +30,6 @@ type EventProfileEnvelope struct {
|
|||
Profile string
|
||||
}
|
||||
|
||||
type LCG_API_Handler struct {
|
||||
LaunchServers func()
|
||||
StopServers func()
|
||||
}
|
||||
|
||||
type EventHandler struct {
|
||||
app app.Application
|
||||
appBusQueue event.Queue
|
||||
|
@ -46,6 +41,8 @@ type EventHandlerInterface interface {
|
|||
OnACNStatusEvent(appl app.Application, e *event.Event)
|
||||
}
|
||||
|
||||
const ReloadEvent = event.Field("Reload")
|
||||
|
||||
// We should be reading from profile events pretty quickly, but we make this buffer fairly large...
|
||||
const profileEventsBufferSize = 512
|
||||
|
||||
|
@ -143,7 +140,7 @@ func (eh *EventHandler) handleAppBusEvent(e *event.Event) string {
|
|||
}
|
||||
log.Debug("New Peer Event: %v", e)
|
||||
|
||||
if e.Data["Reload"] != event.True {
|
||||
if e.Data[ReloadEvent] != event.True {
|
||||
eh.startHandlingPeer(onion)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue