diff --git a/modules/react-native-status/android/build.gradle b/modules/react-native-status/android/build.gradle index 7c38e27ab5..b93ab4a445 100644 --- a/modules/react-native-status/android/build.gradle +++ b/modules/react-native-status/android/build.gradle @@ -17,7 +17,7 @@ dependencies { implementation 'com.github.ericwlange:AndroidJSCore:3.0.1' implementation 'status-im:function:0.0.1' - String statusGoVersion = 'develop-gaabbcbe5' + String statusGoVersion = 'develop-g3b92b61e' final String statusGoGroup = 'status-im', statusGoName = 'status-go' // Check if the local status-go jar exists, and compile against that if it does diff --git a/modules/react-native-status/android/src/main/java/im/status/ethereum/module/StatusModule.java b/modules/react-native-status/android/src/main/java/im/status/ethereum/module/StatusModule.java index f504d2900a..2fd4a0ddcb 100644 --- a/modules/react-native-status/android/src/main/java/im/status/ethereum/module/StatusModule.java +++ b/modules/react-native-status/android/src/main/java/im/status/ethereum/module/StatusModule.java @@ -705,4 +705,10 @@ class StatusModule extends ReactContextBaseJavaModule implements LifecycleEventL Log.d(TAG, "ConnectionChange: " + type + ", is expensive " + isExpensive); Statusgo.ConnectionChange(type, isExpensive ? 1 : 0); } + + @ReactMethod + public void appStateChange(final String type) { + Log.d(TAG, "AppStateChange: " + type); + Statusgo.AppStateChange(type); + } } diff --git a/modules/react-native-status/ios/RCTStatus/RCTStatus.m b/modules/react-native-status/ios/RCTStatus/RCTStatus.m index 1c3e1752ff..386a0e5528 100644 --- a/modules/react-native-status/ios/RCTStatus/RCTStatus.m +++ b/modules/react-native-status/ios/RCTStatus/RCTStatus.m @@ -412,6 +412,13 @@ RCT_EXPORT_METHOD(connectionChange:(NSString *)type ConnectionChange((char *) [type UTF8String], isExpensive? 1 : 0); } +RCT_EXPORT_METHOD(appStateChange:(NSString *)type) { +#if DEBUG + NSLog(@"AppStateChange() method called"); +#endif + AppStateChange((char *) [type UTF8String]); +} + + (void)signalEvent:(const char *) signal { if(!signal){ diff --git a/modules/react-native-status/ios/RCTStatus/pom.xml b/modules/react-native-status/ios/RCTStatus/pom.xml index c0941be8f7..076c07e60e 100644 --- a/modules/react-native-status/ios/RCTStatus/pom.xml +++ b/modules/react-native-status/ios/RCTStatus/pom.xml @@ -25,7 +25,7 @@ status-im status-go-ios-simulator - develop-gaabbcbe5 + develop-g3b92b61e zip true ./ diff --git a/src/status_im/native_module/core.cljs b/src/status_im/native_module/core.cljs index 5a094df216..6a3650f999 100644 --- a/src/status_im/native_module/core.cljs +++ b/src/status_im/native_module/core.cljs @@ -95,3 +95,6 @@ (defn connection-change [data] (module-interface/-connection-change rns-module data)) + +(defn app-state-change [state] + (module-interface/-app-state-change rns-module state)) diff --git a/src/status_im/native_module/impl/module.cljs b/src/status_im/native_module/impl/module.cljs index aa36b70ccd..f4bb53f56f 100644 --- a/src/status_im/native_module/impl/module.cljs +++ b/src/status_im/native_module/impl/module.cljs @@ -236,6 +236,9 @@ (defn connection-change [{:keys [type expensive?]}] (.connectionChange status type expensive?)) +(defn app-state-change [state] + (.appStateChange status state)) + (defrecord ReactNativeStatus [] module/IReactNativeStatus ;; status-go calls @@ -282,4 +285,6 @@ (-close-application [this] (close-application)) (-connection-change [this data] - (connection-change data))) + (connection-change data)) + (-app-state-change [this state] + (app-state-change state))) diff --git a/src/status_im/native_module/impl/non_status_go_module.cljs b/src/status_im/native_module/impl/non_status_go_module.cljs index 8e2ae378ed..e15565565f 100644 --- a/src/status_im/native_module/impl/non_status_go_module.cljs +++ b/src/status_im/native_module/impl/non_status_go_module.cljs @@ -61,4 +61,5 @@ (-notify-users [this {:keys [message payload tokens] :as m} callback]) (-add-peer [this enode callback]) (-close-application [this]) - (-connection-change [this data])) + (-connection-change [this data]) + (-app-state-change [this state])) diff --git a/src/status_im/native_module/module.cljs b/src/status_im/native_module/module.cljs index a8bd8197c1..15350f92af 100644 --- a/src/status_im/native_module/module.cljs +++ b/src/status_im/native_module/module.cljs @@ -21,5 +21,6 @@ (-notify-users [this {:keys [message payload tokens] :as m} callback]) (-add-peer [this enode callback]) (-close-application [this]) - (-connection-change [this data])) + (-connection-change [this data]) + (-app-state-change [this state])) diff --git a/src/status_im/ui/screens/events.cljs b/src/status_im/ui/screens/events.cljs index 059da1be53..4d29fd7fe7 100644 --- a/src/status_im/ui/screens/events.cljs +++ b/src/status_im/ui/screens/events.cljs @@ -393,9 +393,8 @@ (handlers/register-handler-fx :app-state-change - (fn [_ [_ state]])) -;; TODO(rasom): let's not remove this handler, it will be used for -;; pausing node on entering background on android + (fn [_ [_ state]] + (status/app-state-change state))) (handlers/register-handler-fx :request-permissions