Skip to content

Latest commit

 

History

History
 
 

js

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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
berty-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
web-dev-app/ A minimal React web app that allows us to easily test our store functionality (currently not supported)

🔨 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 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`

Running the web dev app

🚧 This debugging tool is primarily used internally and not actively maintained except by developers for their own usage.

TODO: This is currently not working, we need to port the transpiler config and catch up

1. Requirements

  • yarn
  • npx

2. Run required services

  • cd packages/web-dev-app && yarn && yarn start
  • BERTY_DAEMON_PORT=1337 make daemon.start
  • BERTY_DAEMON_PORT=1338 make daemon.start

3. Navigate to the app

yarn start should have opened a browser tab already but if that's not the case, navigate to localhost:3000

4. Create an account and choose a daemon

In the app's ui, you have to choose a daemon port when you create your account, if you started the services using the commands above, you will have a service on port 1337 and one on port 1338

You can use one normal tab and one private tab to have two accounts at the same time

🧳 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):
    • Android SDK Build-Tools
    • LLDB
    • NDK
    • 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)

web-dev-app requirements

🚧 Known issues and troubleshooting