Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add scale bar to map #356

Merged
merged 1 commit into from
Mar 26, 2020
Merged

feat: Add scale bar to map #356

merged 1 commit into from
Mar 26, 2020

Conversation

gmaclennan
Copy link
Member

Fixes: #243

Thanks to https://github.com/react-native-mapbox-gl/maps/issues/482#issuecomment-557966301 for pointing out react-native-scale-bar which solves this problem. Not quite as slick as the native SDK scale bar, but it is enough info.

When I initially added this, CPU usage while the map is in "follow user location" mode went up from 200% to 250% (on a Moto X4). This obviously has a high impact on battery life.

I changed the way the map follow mode works, and now the map position will only update once the user has moved by >15 meters. @aliya-ryan @jencastrodoesstuff let me know if this should be less (this does not affect the location of any points, it only affects the view of the map)

Note that currently both the map centering (in follow mode) and the position of the blue dot (user location) are only updating every 15m of displacement, but they are not always in sync (i.e. if you walk with the map open, you will see the map move at one moment, then a little later the blue dot will catch up). This will be fixed in a later release.

@gmaclennan gmaclennan merged commit 841c031 into master Mar 26, 2020
@gmaclennan gmaclennan deleted the scale-bar branch March 26, 2020 19:24
gmaclennan added a commit that referenced this pull request Jul 22, 2020
* fix: Adjust projectKey styling and text

* fix(Sync): Touch up styles of no wifi sync screen

* chore(docs): Add README note about breaking changes and stability

* chore(docs): Add README note about translations

* feat: Update to latest React Native & Unimodules (better performance and bug fixes)

Squashed commits:
[2cdd3e6] chore: Cleanup unused vars (+7 squashed commits)
[2599762] chore: Fix gradlew script (was throwing warning)
[dd60087] chore: Update deps
[c41f02d] fix: Update react-native-v8 for RN 0.61
[556422c] Update to latest unimodules
[737c490] remove redundant patch (issue was fixed in RN61)
[8cf62f0] Bump react-native-fs to latest
[37a7e1e] Update to RN 0.61.5

* fix: Don't render app until saved draft is loaded from storage

* fix: Fix crash after deleting an observation's description

* feat: Use Android default animation for navigation (changes close icon on GPS and Sync screens)

Simplify the navigation structure to remove nested stacks and use the built-in react-navigation headers.
Change the way navigation is blocked for user confirmation after creating or editing an observation.
Uses back arrow (not X close icon) on GPS and Sync modals, since this is the Android default.

* feat: Ask for confirmation when the user presses the back button when editing/creating an observation

* fix: Fix bug when a user edits an existing observation and is returned to the home screen (map)

* chore(release): 2.0.0-alpha.0

* feat: 🎉 Import configuration files (.mapeosettings) from a new settings screen

* chore(release): 2.1.0-alpha.1

* fix: Remove unused picker component (pending coordinate format setting)

* chore(release): 2.1.0-alpha.2

* fix: Fix config import failing when there is an existing config

* chore(release): 2.1.0-alpha.3

* New Crowdin translations (#272)

* New translations en.json (Burmese)

* New translations en.json (Khmer)

* New translations en.json (Lao)

* New translations en.json (Thai)

* New translations en.json (Vietnamese)

* New translations en.json (Hindi)

* New translations en.json (Indonesian)

* New translations en.json (Malay)

* New translations en.json (Nepali)

* New translations en.json (Nepali)

* New translations en.json (Nepali)

* New translations en.json (Nepali)

* New translations en.json (Nepali)

* New translations en.json (Nepali)

* New translations en.json (Indonesian)

* New translations en.json (Nepali)

* New translations en.json (Nepali)

* New translations en.json (Nepali)

* New translations en.json (Nepali)

* New translations en.json (Spanish)

* New translations en.json (French)

* New translations en.json (Spanish)

* New translations en.json (Portuguese, Brazilian)

* New translations en.json (Burmese)

* New translations en.json (Khmer)

* New translations en.json (Lao)

* New translations en.json (Thai)

* New translations en.json (Vietnamese)

* New translations en.json (Hindi)

* New translations en.json (Indonesian)

* New translations en.json (Malay)

* New translations en.json (Nepali)

* New translations en.json (Thai)

* New translations en.json (Thai)

* New translations en.json (Thai)

* New translations en.json (Thai)

* New translations en.json (Thai)

* New translations en.json (Thai)

* New translations en.json (Thai)

* New translations en.json (Thai)

* New translations en.json (Thai)

* New translations en.json (Thai)

* New translations en.json (Thai)

* New translations en.json (Burmese)

* New translations en.json (French)

* New translations en.json (Hindi)

* New translations en.json (Indonesian)

* New translations en.json (Khmer)

* New translations en.json (Lao)

* New translations en.json (Malay)

* New translations en.json (Nepali)

* New translations en.json (Portuguese, Brazilian)

* New translations en.json (Spanish)

* New translations en.json (Thai)

* New translations en.json (Vietnamese)

* fix: Fix crash when presets have empty placeholder field

* feat: Add settings screen to change language (independent of device language) (#302)

* Abstract persisted state to a custom hook

* Add context for user-selected locale

* Change to list-based settings screen

* Add language settings screen

* move settings icon onto observationList screen

* Extract translatable strings

* Only extract `en` messages - crowdin will deal with the rest

* Make language screen scrollable

* Sort languages by english name

* Include English name in language list

* add dense list settings for formatting settings selectone field

* fix: add react-native-screens

* chore(release): 2.1.0-alpha.4

* karissa->okdistribute

* fix: add package-lock.json files for front and backend

* chore: Enable package-lock in .npmrc

* fix: Fix crash caused by react-native-v8 patch release fixes #311

* chore: Report "Application Not Responding" errors to Bugsnag

* chore: Add bugsnag gradle / Android integration

* feat: Release smaller APK for Arm devices only (#322)

Almost all phones use Arm chips, so this reduces the size by about 50% with little impact. Users of Intel devices (some rare phones from about 2015 and some Chromebooks that run Android apps) will need to use the Intel or Universal APKs.

* Do not include support x86 in the main release APK

* Add intel-only build for x86 phones

Very few Android devices, apart from Chromebooks, are x86.
This would mainly be for the 2015 ASUS Zenphone in case users want to use it.
The PlayStore release will continue to be cross-platform, but splitting the APK into two releases reduces the APK size by about 40%.

* Add universal build

* More sensible naming of output apks

* Only create universal and debug build for QA

* remove unused dep

This was only used for yarn with patch-package, and we don't use yarn.

* Fix for running `npm ci` on CI

* Add bitrise.yml to repo

* Remove exposed AWS key (exposed key de-activated)

* Change keystore passwords and move to env variables

* Setup bitrise.yml to run from repo

* Sign QA builds with a separate key

* Adjust apk naming

* Setup beta and release workflows

* rename workflows

* chore(deps): bump acorn from 7.1.0 to 7.1.1 in /src/backend

Bumps [acorn](https://github.com/acornjs/acorn) from 7.1.0 to 7.1.1.
- [Release notes](https://github.com/acornjs/acorn/releases)
- [Commits](acornjs/acorn@7.1.0...7.1.1)

Signed-off-by: dependabot[bot] <[email protected]>

* feat: New translations including Vietnamese (#303)

Squashed commits:
[d950853] New translations en.json (Vietnamese)
[9496dac] New translations en.json (Vietnamese)
[f1ce80e] New translations en.json (Vietnamese)
[aa182a3] New translations en.json (Vietnamese)
[415ed78] New translations en.json (Vietnamese)
[6b2261a] New translations en.json (Vietnamese)
[7743cae] New translations en.json (Thai)
[07db0e2] New translations en.json (Spanish)
[c7dee5c] New translations en.json (Portuguese, Brazilian)
[0adf598] New translations en.json (Nepali)
[d3d753c] New translations en.json (Malay)
[ab64667] New translations en.json (Lao)
[05abda9] New translations en.json (Khmer)
[35bf81b] New translations en.json (Indonesian)
[35998db] New translations en.json (Hindi)
[4095b4f] New translations en.json (French)
[4faf387] New translations en.json (Burmese)

* feat: New "Mapeo for ICCAs" variant for UNEP WCMC (#346)

* feat: Add intro screens for ICCA / WCMC

* feat: Add icca presets for icca app flavor

* feat: Only show icca intro screens for icca build flavor

* feat: Add ICCA splash screen and logo

* chore: package-lock updates

* Build ICCA for beta

* fix package-lock

* remove unused dep

* add signing config for mapeo for iccas

* fix S3 upload and ignore failed S3 uploads in the future

* Include ICCA variant in S3 release & beta uploads

* Update download URLs to point to latest release

* Fix syntax error in APK path names

* [skip ci] fix script location

* Fix path for google play upload

* debug source_dir

* Fix - change working dir after gradle build

* Another fix for scripts :/

* chore: small improvements to logging for nodejs-mobile

* fix: Bundle React-Native code in Universal & Intel build types

* chore: Improve deploy process (#349)

* Update download URLs when releasing

https://apk.mapeo.world/latest
https://apk.mapeo.world/icca/latest

* Remove Intel-only builds (Universal build works for this)

* Update apk naming

The makes the names easier to parse when in a long list

* chore: Update deps (including flow)

* chore: remove unused yarn artifacts

* chore: Switch out deprecated react-native-hooks package

* Fix: Fix crash from switching away from app during camera view

We've seen several errors in bugsnag caused by subscriptions and the expo-sensors module.
Turns out we were doing too much, trying to unsubscribe from the accelerometer when the app was going into the background. Expo was already doing that, so we were throwing an error by doing it twice. Re-writing this as a function component helped clear up the logic and identify the bugs.
fixes #330 #187 #138

* fix: Don't [silently] throw error if a user cancels a share action

fixes #344

* Fix: Fix double header on photo modal (from alphas)

* FIx: Fix race conditions with server start-stop (switching away from app and back)

Fixes #210 (hopefully!)

* chore: Improve debug messages and error reporting

* fix: Fix online mapstyle not loading when offline style is removed

* fix: Do not update user location (blue dot) on map until user moves more than 15 meters (saves battery life)

This reduces CPU use on a Moto 4 from 150% to 20% when the map is not following the user
TODO: Reduce updates to map when in follow mode to reduce CPU usage further

* feat: Show "empty state" when user has not yet recorded any observations

* chore: Fix gradle build errors trying to strip mips code

* fix: Attempt to fix builds for OPPO phones (fixes #301)

* fix: Fix translations build script

* chore: Update translations for new features (#350)

* New translations en.json (Spanish)

* New translations en.json (Spanish)

* New translations en.json (Spanish)

* New translations en.json (Spanish)

* New translations en.json (Spanish)

* New translations en.json (Spanish)

* New translations en.json (Vietnamese)

* New translations en.json (Burmese)

* New translations en.json (French)

* New translations en.json (Hindi)

* New translations en.json (Indonesian)

* New translations en.json (Khmer)

* New translations en.json (Lao)

* New translations en.json (Malay)

* New translations en.json (Nepali)

* New translations en.json (Portuguese, Brazilian)

* New translations en.json (Thai)

* New translations en.json (Spanish)

* feat: Add end-to-end tests with Detox (#355)

Fixes #310

* chore: Move home screen header and add button into parent components

* feat: Add detox and initial test

* feat: Add github action for detox tests

* Add cache

* Switch to custom emulator setup

* checkout first

* Use npm ci instead of npm install

* Fix curl script

* move patch-package to non-dev dep

* add debug info for emulator

* remove sdk list to check perf

* Use host GPU accel

* Revert "remove sdk list to check perf"

This reverts commit ad49591.

* Install correct NDK version

* fix ndk install

* record videos and logs

* Fix ndk unzip

* fix script

* fix npm install

* update ndk version

* Try getting NDK from sdkmanager update

* change gpu

* always run artifact (video) upload

* save emulator logs

* create artifacts folder

* Run tests without google apis

* Re-work apk naming and signing to work with detox

* Skip caching - it did not save time overall

* Run CI tests on release build

* fallback to debug signingconfig if release keystore is not availabel

* fix Bitrise builds

* Fix beta-release workflow

* Fix deploy-release workflow

* Ensure npm version name is set

* feat: 📏 Add scale bar to map & improve battery usage (#356)

* chore: Fix s3 upload naming

* chore: Fix debug applicationId

* chore(release): 2.1.0-beta.0

* fix: Fix sync errors by locking discovery swarm to v6.0.0

* chore: Also run Github CI on pull requests

* chore: Version naming for new release process

* chore(release): prepare for 2.1.0

* chore: typo in docs

* chore: Adjust when CI runs

PRs on Bitrise do not have access to secret variables, so we do not run the release candidate workflow based on PR, instead on the branch push.

* chore: Fix e2e tests

* fix: Move attribution (i) to bottom-right (avoid overlap with scale bar)

* fix: Fix crash during sync progress (updates progress circle library)

* fix: Fix photos rotated incorrectly when the phone is rotated soon after photo capture

Use the phone accelerometer data at the moment the photo is taken rather
than after capture

* fix: Update to latest Mapbox. Potentially fixes missing map icon.

* chore: Better reporting of error message after config update

* fix: Support presets version 3 (only breaks compat with iD, not MM)

* fix(update-config): Don't import presets if version check fails

* fix: Fix changing config with new project key (fix sync not working after change)

Prior to this fix, changing the project key did not change the encryption
key that is used by multifeed, or the discovery key

* fix: Ensure that presets are not cached after config is changed

* chore: Report config import errors to bugsnag

* fix: Show error to user if there is an error importing config

* chore: use mapeoCore.close() and patch in cleanup of hypercores and idx

@mapeo/core v8 does not close the hypercores in the close() method.

* chore: Update KNOWN_ISSUES with bugs that will not be fixed in v2.1

* chore: Fix bugsnag error reporting

* fix(ObservationView): Fix display of observation icon on inset map

Switch to render a react native Image as the icon instead of rendering
a symbol layer in the map, which was causing some rendering issues on
certain devices. Since the map is static (cannot be panned or zoomed) we
can just render the image in the center of the map and it will be in the
correct location.

* fix(MapView): Improve map performance and device compatibility

Render main map onto a GLSurfaceView, which should improve performance.
See #387

* fix(ObservationView): Speed up initial load of inset map

* chore: Don't re-fetch deviceId (is cached and does not change)

* feat: Device name remains the same across app restarts (#369)

* fix(SyncPeer): Make sync button respond immediately to press

Pressing the button did not immediately do anything - it waited on a peer
update from mapeo core. In some circumstances this does not arrive for
some time (because the sync starts sending first before receiving, so
no peer updates come through). This caused users to press the button
multiple times.

* fix: Fix config loading on Samsung devices

Samsung throws an EPERM error if tar-fs tries to set utime on extracted
files

* Fix close function to wait for everything to close

* Remove unnecessary close of hypercore storage

Multifeed.close closes hypercore, which closes all the storage

* chore: Rename pending release to v5 and update changelog

* feat: Add Brazilian Portuguese translations (#412)

* chore(deps): update to latest mapeo core

* abstract usePeers from desktop

* fix: pull in code from desktop for usePeers state manager

* chore: Add missing intl messages

* fix: get sync to render properly with new mapeo core

* chore(deps): update to latest mapeo core

* fix: sync on peer device should show progress events on local device

* fix: pass through 'connected' state to peer list

* fix: show indeterminate state when progress is 1

* fix: Fix Portuguese (Brazilian) translations

* fix: show a yellow icon when disconnected

* fix: When WiFi connection state changes, refresh peer list

* fix: Ignore errors (e.g., ECONNABORTED) that are now caught by the
'connected' property

* fix: 'missing data' error will not cancel large syncs too early

* fix: Improve the formatting of Mapeo Alerts fixes #401

* chore: for flow, ensure fields and preset are always present

* fix: some last fixes for mapeo alerts

* chore: ensure flow understands we use select_multiple now too

* fix: ignore missing data errors and errors that are stale

* chore(deps): bump to @mapeo/core v8.3.2 for missing data fixes

* chore: Update package-lock to v5.0.0

* chore: Update to [email protected]

* fix: Ensure sync errors are always propagated to frontend.

* fix: Fix observations not rendering when GPS is off (#431)

Previously, <MapboxGL.Camera> was not rendered when location services
were off. This caused the <MapboxGL.ShapeSource> to not render (for
unknown reasons). This fix always renders MapboxGL.Camera and ignores
location updates if the map is not in follow mode.

* fix: Update Portuguese translations

* New translations en.json (French)

* New translations en.json (Spanish)

* New translations en.json (Vietnamese)

* New translations en.json (Portuguese, Brazilian)

* New translations en.json (Indonesian)

* New translations en.json (Khmer)

* New translations en.json (Thai)

* New translations en.json (Hindi)

* New translations en.json (Malay)

* New translations en.json (Burmese)

* New translations en.json (Nepali)

* New translations en.json (Lao)

* fix: Update Thai and Nepali translations

* New translations en.json (Thai)

* New translations en.json (Thai)

* New translations en.json (Thai)

* New translations en.json (Thai)

* New translations en.json (Nepali)

* New translations en.json (Nepali)

* chore: Update changelog (prepare for release)

* chore: Update KNOWN_ISSUES for v5.0.0 release

* chore: Roll back to react-native-mapbox-gl/[email protected]

The 8.1.0-rc.2 seemed to be the cause of errors fetching tiles when the
device is offline

* fix: Turn off dev mode (yellow warning boxes) in universal build

Co-authored-by: Karissa McKelvey <[email protected]>
Co-authored-by: Karissa McKelvey <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Scale view on map
1 participant