Skip to content

Latest commit

 

History

History

js

Berty js/

Introduction

This folder contains most of the Typescript and Javascript code needed for the Berty Messenger mobile apps. The code is organized into packages in ./js/packages. Only some of them are freestanding.

Please, read the main README.md file first.

📦 Packages

directory description
api/ Interfaces with the Berty golang services
messenger-app/ Berty Messenger react root
i18n/ Locale support files
components React Native components
go-bridge/ Berty daemon native module
grpc-bridge/ Collection of grpc utilities used to interface with the daemon
navigation/ Berty Messenger + react-native-navigation
store/ App state control using React hooks and Context
styles/ Generates StyleSheet utilities and styles that conform to our design specs

🔨 Usage

$ cd ./js
$ make help

Running the mobile apps for development

💡 First, verify you have the relevant Requirements 😉

## Optional if not modifying any .proto file
## Generate files using protobuf
$ make generate

## Build and serve mobile UI
$ make metro.start

## Optional if using only one device
## Run this with different ports to test with multiple devices
$ BERTY_DAEMON_PORT=1337 make daemon.start
$ BERTY_DAEMON_PORT=1338 make daemon.start

## iOS
## Run iOS app in debug mode
$ make ios.debug
## Optional if using only one device
## Run this with different iOS device names
$ IOS_DEVICE=__IOS_DEVICE_NAME_1__ make ios.debug
$ IOS_DEVICE=__IOS_DEVICE_NAME_2__ make ios.debug

💡 You can check available virtual iOS devices with `xcrun simctl list`

## Android
## Run Android app in debug mode
$ make android.debug
## Optional if using only one device
## Run this with different Android device IDs
$ ANDROID_DEVICE=__ANDROID_DEVICE_ID_1__ make android.debug
$ ANDROID_DEVICE=__ANDROID_DEVICE_ID_2__ make android.debug

💡 You can check available Android Virtual Devices with `adb devices`

## Web
## Run Berty daemon for the web app
make web.daemon.start
## Run web app in debug mode
$ make web.debug
## Open http://localhost:3002/#/ip4/127.0.0.1/tcp/9092/grpcws in your browser

🧳 Requirements

Requirements for working on iOS and Android apps

💡 $GOPATH may need to be set explicitly (usually $HOME/go)

General React Native requirements

iOS dev requirements

  • Mac OS X
  • XCode (latest stable)

Android dev requirements

  • An Android app development environment, e.g. Android Studio
  • Android SDK, with the following enabled (in Android Studio Code in Tools --> SDK Manager):
    • SDK Platform "Android 11.0 (R)"
    • Android SDK Build-Tools
    • LLDB
    • NDK version 23.1.7779620 (export ANDROID_NDK_HOME="$ANDROID_HOME/ndk/23.1.7779620")
    • Cmake
    • Android SDK Command-line Tools
  • A physical or virtual Android device (in Android Studio, Tools --> AVD Manager)
  • Java 8. If you already have another version of Java, you can use a version manager and Homebrew to add another installation. Some nice instructions are given here.

💡 Check you can run all the commands sdkmanager, emulator, ndk-bundle, and adb (these are binaries in $ANDROID_HOME subfolders)