Send app state changes to status-go.

Signed-off-by: Julien Eluard <julien.eluard@gmail.com>
This commit is contained in:
Igor Mandrigin 2018-03-16 13:01:10 +01:00 committed by Julien Eluard
parent 48dd386051
commit 3008e38624
No known key found for this signature in database
GPG Key ID: 6FD7DB5437FCBEF6
9 changed files with 30 additions and 8 deletions

View File

@ -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

View File

@ -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);
}
}

View File

@ -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){

View File

@ -25,7 +25,7 @@
<artifactItem>
<groupId>status-im</groupId>
<artifactId>status-go-ios-simulator</artifactId>
<version>develop-gaabbcbe5</version>
<version>develop-g3b92b61e</version>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>./</outputDirectory>

View File

@ -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))

View File

@ -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)))

View File

@ -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]))

View File

@ -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]))

View File

@ -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