Updated broken links
parent
027020c82b
commit
5283af397e
22
RN---GO.md
22
RN---GO.md
|
@ -1,27 +1,27 @@
|
||||||
# Function calls
|
# Function calls
|
||||||
|
|
||||||
All `status-react` to `status-go` calls are centralized in [StatusModule](https://github.com/status-im/status-react/blob/develop/modules/react-native-status/android/src/main/java/im/status/ethereum/module/StatusModule.java) (android) or [RCTStatus](https://github.com/status-im/status-react/blob/develop/modules/react-native-status/ios/RCTStatus/RCTStatus.m#L97) (ios).
|
All `status-react` to `status-go` calls are centralized in [StatusModule](https://github.com/status-im/status-react/blob/develop/modules/react-native-status/android/src/main/java/im/status/ethereum/module/StatusModule.java) (Android) or [RCTStatus](https://github.com/status-im/status-react/blob/develop/modules/react-native-status/ios/RCTStatus/RCTStatus.m#L97) (iOS).
|
||||||
General structure of methods is:
|
General structure of methods is:
|
||||||
|
|
||||||
* caller provides a callback
|
* caller provides a callback
|
||||||
* check for availability of current Activity
|
* check for availability of current Activity
|
||||||
* if available: call a static method on `StatusGo` via an ExecutorService (or sometimes a Thread) and use its result as callback payload
|
* if available: call a static method on `StatusGo` via an `ExecutorService` (or sometimes a `Thread`) and use its result as callback payload
|
||||||
* else: ivoke callback with false as payload
|
* else: invoke callback with `false` as payload
|
||||||
|
|
||||||
From RN perspective calls do not block, result is provided through callback execution.
|
From RN perspective calls do not block, result is provided through callback execution.
|
||||||
|
|
||||||
StatusGo is a C library generated from go cade embeded in Status apps. On android it is packaged as a JNI `aar` (generated using [xgo](https://github.com/karalabe/xgo)).
|
StatusGo is a C library generated from Go side embedded in Status apps. On Android it is packaged as a JNI `aar` (generated using [xgo](https://github.com/karalabe/xgo)).
|
||||||
|
|
||||||
StatusGo directly expose `status-go` methods marked for exportation.
|
StatusGo directly exposes `status-go` methods marked for exportation.
|
||||||
Those methods are defined in [cmd/statusd/library.go](https://github.com/status-im/status-go/blob/develop/cmd/statusd/library.go) and marked as `export`.
|
Those methods are defined in [lib/library.go](https://github.com/status-im/status-go/blob/develop/lib/library.go) and marked as `export`.
|
||||||
`go` side calls are then dispatched to [geth/api](https://github.com/status-im/status-go/blob/develop/geth/api/api.go#L172) then [geth/jail](https://github.com/status-im/status-go/blob/develop/geth/jail/jail.go#L213)
|
`go` side calls are then dispatched to [api/backend.go](https://github.com/status-im/status-go/blob/develop/api/backend.go).
|
||||||
|
|
||||||
Data is provided to the go layer as primitive types and retieved RN side as JSON.
|
Data is provided to the Go layer as primitive types and retrieved RN side as JSON.
|
||||||
|
|
||||||
# Events
|
# Events
|
||||||
|
|
||||||
`status-go` can directly [send events](https://github.com/status-im/status-go/blob/develop/geth/node/signals.go#L65) that will be received RN side. It achieves that by directly calling [signal-event](https://github.com/status-im/status-react/blob/develop/modules/react-native-status/android/src/main/java/im/status/ethereum/module/StatusService.java#L51) using some [JNI glue](https://github.com/status-im/status-go/blob/develop/geth/node/signals.c#L173).
|
`status-go` can directly [send events](https://github.com/status-im/status-go/blob/develop/geth/node/signals.go#L65) that will be received RN side. It achieves that by directly calling [signal-event](https://github.com/status-im/status-react/blob/develop/modules/react-native-status/android/src/main/java/im/status/ethereum/module/StatusService.java#L55) using some [JNI glue](https://github.com/status-im/status-go/blob/develop/signal/signals.c#L176).
|
||||||
|
|
||||||
StatusModule is also used as a react context [listener](https://github.com/status-im/status-react/blob/develop/modules/react-native-status/android/src/main/java/im/status/ethereum/module/StatusModule.java#L68) that [emits](https://github.com/status-im/status-react/blob/develop/modules/react-native-status/android/src/main/java/im/status/ethereum/module/StatusModule.java#L105) event to the RN layer.
|
`StatusModule` is also used as a react context [listener](https://github.com/status-im/status-react/blob/develop/modules/react-native-status/android/src/main/java/im/status/ethereum/module/StatusModule.java#L60) that [emits](https://github.com/status-im/status-react/blob/develop/modules/react-native-status/android/src/main/java/im/status/ethereum/module/StatusModule.java#L111) events to the RN layer.
|
||||||
|
|
||||||
`status-react` listens to those events via [gethEvent](https://github.com/status-im/status-react/blob/develop/src/status_im/components/status.cljs#L60) then dispatched by a [re-frame handler](https://github.com/status-im/status-react/blob/develop/src/status_im/handlers.cljs#L155).
|
`status-react` listens to those events via [gethEvent](https://github.com/status-im/status-react/blob/develop/src/status_im/native_module/impl/module.cljs#L54) then dispatched by a [re-frame handler](https://github.com/status-im/status-react/blob/develop/src/status_im/handlers.cljs#L155).
|
Loading…
Reference in New Issue