diff --git a/geth/api/api.go b/geth/api/api.go index 2ee223901..6c06ce592 100644 --- a/geth/api/api.go +++ b/geth/api/api.go @@ -240,7 +240,7 @@ func (api *StatusAPI) ConnectionChange(typ string, expensive bool) { func (api *StatusAPI) AppStateChange(state string) { appState, err := ParseAppState(state) if err != nil { - log.Error("AppStateChange failed, ignoring it:", err) + log.Error("AppStateChange failed, ignoring it.", "err", err) return // and do nothing } api.b.AppStateChange(appState) diff --git a/geth/api/app_state.go b/geth/api/app_state.go index 3ae1f4da4..ac69afc30 100644 --- a/geth/api/app_state.go +++ b/geth/api/app_state.go @@ -15,7 +15,7 @@ func (a AppState) String() string { // Specific app states // see https://facebook.github.io/react-native/docs/appstate.html const ( - AppStateForeground = AppState("foreground") + AppStateForeground = AppState("active") // these constant values are kept in sync with React Native AppStateBackground = AppState("background") AppStateInactive = AppState("inactive") diff --git a/geth/api/app_state_test.go b/geth/api/app_state_test.go index b13e5af79..9e27cb790 100644 --- a/geth/api/app_state_test.go +++ b/geth/api/app_state_test.go @@ -15,10 +15,10 @@ func TestParseAppType(t *testing.T) { } } - check("foreground", AppStateForeground, false) + check("active", AppStateForeground, false) check("background", AppStateBackground, false) check("inactive", AppStateInactive, false) - check(" forEGROUnd ", AppStateForeground, false) + check(" acTIVE ", AppStateForeground, false) check(" backGROUND ", AppStateBackground, false) check(" INACTIVE ", AppStateInactive, false) check("", AppStateInvalid, true) diff --git a/geth/api/backend.go b/geth/api/backend.go index 3a3ad9ad0..8a8c05391 100644 --- a/geth/api/backend.go +++ b/geth/api/backend.go @@ -239,7 +239,7 @@ func (b *StatusBackend) ConnectionChange(state ConnectionState) { // AppStateChange handles app state changes (background/foreground). func (b *StatusBackend) AppStateChange(state AppState) { - log.Info("App State changed: %s", state) + log.Info("App State changed.", "new-state", state) // TODO: put node in low-power mode if the app is in background (or inactive) // and normal mode if the app is in foreground.