Skip to content

Commit

Permalink
Merge pull request #1114 from digidem/release/v5.6.4
Browse files Browse the repository at this point in the history
Release/v5.6.4
  • Loading branch information
ErikSin committed Aug 29, 2023
2 parents 034f7a8 + fcdadb4 commit 225bd02
Show file tree
Hide file tree
Showing 8 changed files with 1,511 additions and 79 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Expand Up @@ -2,6 +2,8 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

### [5.6.4](https://github.com/digidem/mapeo-mobile/compare/v5.6.3...v5.6.4) (2023-08-29)

### [5.6.3](https://github.com/digidem/mapeo-mobile/compare/v5.6.2...v5.6.3) (2023-06-29)

### [5.6.2](https://github.com/digidem/mapeo-mobile/compare/v5.6.1...v5.6.2) (2023-05-25)
Expand Down
141 changes: 72 additions & 69 deletions CONTRIBUTING.md
@@ -1,87 +1,32 @@
# Contributing

Thank you so much for taking the time to contribute to Mapeo development!
mapeo-mobile is a mobile app written in react-native that currently runs on
Android. For most development you will need the Android SDK installed on your
computer, but it is possible to contribute to UI Component development using the
storybook server.
Thank you so much for taking the time to contribute to Mapeo development! Mapeo Mobile is a mobile app written in react-native that currently runs on Android.

After doing the [Initial Install](#initial-install), for most development you will need Android Studio and the Android SDK installed on your computer as outlined in the [Full App Development](#full-app-development) section.

It is also possible to contribute to UI Component development using the
storybook server. See the below [Storybook](#storybook) section for more information on that.

## Initial Install

In order to start developing you will need git and node >=v10 installed on your
computer (node v14 does not seem to be working at this time, you can use [nvm](https://github.com/nvm-sh/nvm) to rollback
your node version). For many development tasks you will also need the Android SDK installed.
your node version).

```sh
git clone https://github.com/digidem/mapeo-mobile.git
cd mapeo-mobile
npm install
```

## Storybook

[Storybook](https://storybook.js.org) is a tool for developing React UI
components in isolation. You can see how a component renders with different
props as inputs, and changes you make to the code will update in realtime
through the storybook UI. What you see in the Storybook UI is defined by
"stories" which are in the [`src/stories`](src/stories) folder.

### Storybook Web

**_Storybook web is fragile, it currently requires some code modifications for
everything to work correctly on web_**

The easiest way to get started without setting up your machine for mobile
development is to use Storybook web. It uses
[`react-native-web`](https://github.com/necolas/react-native-web) internally in
order to render react-native components in a browser. Note that layout and
colors do not appear exactly the same in the browser, and you may need to add
some additional styles to get things looking right. To start the storybook web
server:

```sh
npm run storybook-web
```

Your default browser should open with the Storybook interface. You can browse
different stories, and as you edit a component you will see your changes update
in real-time.

### Storybook Native

For a development environment that is closer to the actual app end-users will
see you can run storybook on a device or in the Android emulator. To install and
run the app in storybook mode on a device:

```sh
npm run android-storybook
```

You can edit components and write new stories and see how components on-screen
render in isolation.

Optionally you can also start a server that will give you a web interface to
control what you see on the mobile device:

```sh
adb reverse tcp:7007 tcp:7007
npm run storybook-native
```

You will probably need to reload the storybook mobile app for the web app to be
able to control the mobile app.

## Full App Development

### Pre-requisites

Follow the [official React Native instructions](https://reactnative.dev/docs/0.67/environment-setup) for setting up the majority of what's needed for your development environment (ignore the "Creating a new application" section and anything that comes after it).
In order to develop the full app you will need the Android Studio, Android SDK, React Native CLI, and other dependencies installed, as per [this guide](https://reactnative.dev/docs/0.66/environment-setup) following the instructions up to *Creating a new application*.

In order to develop the full app you will need the Android SDK installed and
specifically [21.4.7075529 of the NDK](https://developer.android.com/ndk/guides/) in order to build
nodejs-mobile for Android.
Once you have done so and have Android Studio open, you may need to open your app's `/android` folder in Android Studio, so that it detects, downloads and configures requirements that might be missing, such as the NDK and CMake to build the native code part of the project. However, the version of NDK to use with Mapeo Mobile needs to be specifically [21.4.7075529](https://developer.android.com/ndk/guides/). You can download this version (as well as CMake if necessary) in Android Studio by navigating to Tools -> SDK Manager -> SDK Tools.

You may need to open your app's `/android` folder in Android Studio, so that it detects, downloads and configures requirements that might be missing, like the NDK and CMake to build the native code part of the project.

Due to an [issue](https://github.com/rnmapbox/maps/issues/1572) with installing some Mapbox SDK Android deps, you will also have to complete additional steps before getting the app to build:

Expand All @@ -95,17 +40,17 @@ Due to an [issue](https://github.com/rnmapbox/maps/issues/1572) with installing
MAPBOX_DOWNLOAD_TOKEN=your_token_here npm run android
```

- Export the environment variable in your shell environment. Usually this will be in a file like `$HOME/.bashrc` (or `$HOME/.bash_profile`), `$HOME/.zshrc`, etc (depending on which shell you use). For example, add a line like this in the file and then restart your shell session:
- Create a `.env` file in your Mapeo Mobile directory and paste the following in there with your Mapbox access token. This will be utilized when building Mapeo Mobile.

```sh
export MAPBOX_DOWNLOAD_TOKEN=your_token_here
MAPBOX_DOWNLOAD_TOKEN=your_token_here
```

We recognize that this extra configuration is not ideal and we intend for this to be temporary.

### Testing Device

To use a real device, you will need to [enable USB
Testing Mapeo Mobile builds locally is much faster and more efficient with a real device. To use a real device, you will need to [enable USB
debugging](https://developer.android.com/studio/debug/dev-options) and connect
the phone to your computer with a USB cable. Enter `adb devices` in the terminal
to check that you can see the phone. You may need to unlock the phone screen and
Expand Down Expand Up @@ -136,7 +81,13 @@ dev version of the app on your device:
npm run android
```

You can configure the app to reload whenever you make a change: shake the device
This process may take a while when you are first building the app. Additionally, to bypass unneeded latency when installing certain dependencies like TypeScript, you can add the following to your `.gitconfig` file in your home directory (`~`):
```sh
[url "https://"]
insteadOf = git://
```

Once started, you can configure the app to reload whenever you make a change: shake the device
to bring up the developer menu, and select "Enable Live Reload". Whenever you
change the code the app should reload. Changes to any code in the `src/frontend`
folder will appear immediately after a reload. If you change anything in
Expand All @@ -147,7 +98,7 @@ computer.
`npm run android` does two things: starts "Metro bundler" in one window, and
then builds and installs the dev version of Mapeo on the connected device.
That might not work on all machines, so in order to start the Metro bundler on
its own (e.g. if you already have the app installed), use `npm start`.
its own (e.g. if you already have the app installed), use `npm start` first.

### Running end-to-end tests

Expand All @@ -169,6 +120,58 @@ Now, to run the tests on a device or a running emulator, replace `DEVICE_ID` in
RN_SRC_EXT=e2e detox test -c android.device.debug -n DEVICE_ID -r
```

## Storybook

[Storybook](https://storybook.js.org) is a tool for developing React UI
components in isolation. You can see how a component renders with different
props as inputs, and changes you make to the code will update in realtime
through the storybook UI. What you see in the Storybook UI is defined by
"stories" which are in the [`src/stories`](src/stories) folder.

### Storybook Web

**_Storybook web is fragile, it currently requires some code modifications for
everything to work correctly on web_**

The easiest way to get started without setting up your machine for mobile
development is to use Storybook web. It uses
[`react-native-web`](https://github.com/necolas/react-native-web) internally in
order to render react-native components in a browser. Note that layout and
colors do not appear exactly the same in the browser, and you may need to add
some additional styles to get things looking right. To start the storybook web
server:

```sh
npm run storybook-web
```

Your default browser should open with the Storybook interface. You can browse
different stories, and as you edit a component you will see your changes update
in real-time.

### Storybook Native

For a development environment that is closer to the actual app end-users will
see you can run storybook on a device or in the Android emulator. To install and
run the app in storybook mode on a device:

```sh
npm run android-storybook
```

You can edit components and write new stories and see how components on-screen
render in isolation.

Optionally you can also start a server that will give you a web interface to
control what you see on the mobile device:

```sh
adb reverse tcp:7007 tcp:7007
npm run storybook-native
```

You will probably need to reload the storybook mobile app for the web app to be
able to control the mobile app.
## Release Variants

We generate different variants of the app, each with a different Application ID,
Expand Down
17 changes: 9 additions & 8 deletions bitrise.yml
Expand Up @@ -29,7 +29,7 @@ workflows:
opts:
is_expand: false
steps:
- script@1.1.6:
- script@1.2.0:
title: Rename APKs
inputs:
- content: |
Expand Down Expand Up @@ -71,7 +71,7 @@ workflows:
# Save the variable to the env so it is accessible in other build steps
envman add --key BITRISE_APK_PATH_LIST --value "$NEW_APK_PATH_LIST"
- deploy-to-bitrise-io@2.0: {}
- script@1.1.6:
- script@1.2.0:
title: Set APK path variables
inputs:
- content: |
Expand Down Expand Up @@ -102,7 +102,7 @@ workflows:
- bucket_name: $AWS_S3_BUCKET_NAME
- path_in_bucket: release/v${VERSION_NAME}
- file_path: $RELEASE_APK_PATH
- script@1.1.6:
- script@1.2.0:
title: Update download URL for release
inputs:
- content: |-
Expand Down Expand Up @@ -131,7 +131,7 @@ workflows:
- bucket_name: $AWS_S3_BUCKET_NAME
- path_in_bucket: release-ICCA
- file_path: $ICCA_RELEASE_APK_PATH
- script@1.1.6:
- script@1.2.0:
title: Update download URL for ICCA
is_skippable: true
inputs:
Expand Down Expand Up @@ -169,7 +169,7 @@ workflows:
opts:
is_expand: false
steps:
- script@1.1.6:
- script@1.2.0:
title: Rename APKs
inputs:
- content: |
Expand Down Expand Up @@ -210,7 +210,7 @@ workflows:
# Save the variable to the env so it is accessible in other build steps
envman add --key BITRISE_APK_PATH_LIST --value "$NEW_APK_PATH_LIST"
- script@1.1.6:
- script@1.2.0:
title: Set APK path variables
inputs:
- content: |
Expand Down Expand Up @@ -281,7 +281,7 @@ workflows:
inputs:
- destination: $PROJECT_LOCATION/app/mapeo-release-key.keystore
- source: $BITRISEIO_ANDROID_KEYSTORE_URL
- script@1.1.6:
- script@1.2.0:
title: Update SDK components
inputs:
- content: |
Expand All @@ -306,6 +306,7 @@ workflows:
echo "Downloading correct cmake version"
rm -rf /usr/local/share/android-sdk/cmdline-tools/latest/
mkdir /usr/local/share/android-sdk/cmdline-tools/latest/
mkdir /usr/local/share/android-sdk/cmdline-tools/latest/bin/
ln -s /usr/local/share/android-sdk/cmdline-tools/cmdline-tools/bin/sdkmanager /usr/local/share/android-sdk/cmdline-tools/latest/bin/sdkmanager
Expand All @@ -322,7 +323,7 @@ workflows:
inputs:
- npm_version: ""
- command: run build:translations
- script@1.1.6:
- script@1.2.0:
title: Set version name & code
inputs:
- content: |
Expand Down

0 comments on commit 225bd02

Please sign in to comment.