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

Uniffi React Native Integration #401

Merged
merged 45 commits into from
Jan 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
b08a438
Initial uniffi setup
bjtrounson Dec 19, 2024
b6f97a3
Initial FerrostarCore and Route Provider implementation
bjtrounson Dec 20, 2024
a9fa7d1
FerrostarCore mostly done but without the location provider and spoke…
bjtrounson Dec 21, 2024
ae1feff
Location Provider Implementation
bjtrounson Dec 21, 2024
44f8ad6
intergration of LocationProvider into FerrostarCore
bjtrounson Dec 21, 2024
6721cec
Event listener for navigation state so we can since the external Ferr…
bjtrounson Dec 21, 2024
621ce74
Early NavigationView
bjtrounson Dec 21, 2024
f419c1f
Working FerrostarCore
bjtrounson Dec 22, 2024
9e74c58
Initial views and UI
bjtrounson Dec 22, 2024
a551b25
Working puck and trip progress view with formatters
bjtrounson Dec 23, 2024
a3ec716
typo fixes
bjtrounson Dec 23, 2024
fa218d4
forgot one word in typo check
bjtrounson Dec 23, 2024
56ae448
added icons
bjtrounson Dec 25, 2024
4217567
changed TripProgressView styling
bjtrounson Dec 25, 2024
6d99b4c
Added InstructionView
bjtrounson Dec 25, 2024
1d1796a
fix navigation camera to have pitch and zoom
bjtrounson Dec 25, 2024
981c007
fix icons names
bjtrounson Dec 26, 2024
eb250ea
change some styling in the instruction view
bjtrounson Dec 26, 2024
b5ccf0b
fix the estimatedArrival time
bjtrounson Dec 26, 2024
db63261
Add initial map control till needs onPress handlers
bjtrounson Dec 26, 2024
8b67143
chore: update and install new deps
bjtrounson Jan 16, 2025
3417e4a
feat: add example app with dotenv
bjtrounson Jan 16, 2025
714eebb
chore: add location permissions to example app
bjtrounson Jan 16, 2025
94d354f
fix: handling location edge cases
bjtrounson Jan 16, 2025
cb19e4e
feat: add map control events and state
bjtrounson Jan 16, 2025
927b614
chore: remove deprecated setAccessToken from default export
bjtrounson Jan 16, 2025
d0112eb
feat: add more icons and improve icons on other elements
bjtrounson Jan 16, 2025
49120af
Trying to fix camera issues when route focus
bjtrounson Jan 16, 2025
eeabe48
Update react-native/android/build.gradle
bjtrounson Jan 21, 2025
fcd3a89
chore: delete auto-generated code
bjtrounson Jan 21, 2025
2478e2a
chore: add auto-generated code to .gitignore
bjtrounson Jan 21, 2025
442a4a9
chore: update package.json for new license and ts for new imports
bjtrounson Jan 21, 2025
008d247
Update react-native/src/core/FerrostarCore.ts
bjtrounson Jan 21, 2025
2eae9a0
changed fastestInterval to 1000 as suggested
bjtrounson Jan 21, 2025
227366a
Merge branch 'react-native' of https://github.com/bjtrounson/ferrosta…
bjtrounson Jan 21, 2025
a973eaa
Update react-native/example/ios/FerrostarExample/Info.plist
bjtrounson Jan 21, 2025
e195139
Add JSDoc link to comments since syntax is different to Android
bjtrounson Jan 21, 2025
1b2e953
Changed the AndroidManifest that build.gradle is pointing at
bjtrounson Jan 21, 2025
1846a91
Revert back the AndroidManifestNew.xml since it's used for better com…
bjtrounson Jan 21, 2025
d846537
Update the example README.md with some helpful information
bjtrounson Jan 27, 2025
8b004e6
Add to the .gitignore
bjtrounson Jan 27, 2025
4181e5d
added package name to auto-generation and build.gradle
bjtrounson Jan 28, 2025
69addcc
remove CMakeList.txt and AndroidManifest.xml since they are auto-gene…
bjtrounson Jan 28, 2025
f5f2ade
correct AndroidManifest.xml ignore
bjtrounson Jan 28, 2025
779e3b8
Add TripState extensions as utils functions and apply them to the Nav…
bjtrounson Jan 28, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions _typos.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
[default]
extend-ignore-re = [
"VALHALLA_EXTENDED_OSRM_RESPONSE.*",
]
extend-ignore-re = ["VALHALLA_EXTENDED_OSRM_RESPONSE.*"]

[default.extend-words]
rememberable = "rememberable"

[files]
extend-exclude = ["**/build/*", "*.pbxproj", "**/dist/*", "guide/**/*.js", "**/fixtures/*"]
extend-exclude = [
"**/build/*",
"*.pbxproj",
"**/dist/*",
"guide/**/*.js",
"**/fixtures/*",
"react-native/cpp/generated/*",
"react-native/src/generated/*",
]
15 changes: 15 additions & 0 deletions react-native/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# editorconfig.org

root = true

[*]

indent_style = space
indent_size = 2

end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
3 changes: 3 additions & 0 deletions react-native/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*.pbxproj -text
# specific for windows script files
*.bat text eol=crlf
27 changes: 27 additions & 0 deletions react-native/.github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Setup
description: Setup Node.js and install dependencies

runs:
using: composite
steps:
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version-file: .nvmrc

- name: Cache dependencies
id: yarn-cache
uses: actions/cache@v3
with:
path: |
**/node_modules
.yarn/install-state.gz
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}-${{ hashFiles('**/package.json', '!node_modules/**') }}
restore-keys: |
${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
${{ runner.os }}-yarn-

- name: Install dependencies
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn install --immutable
shell: bash
157 changes: 157 additions & 0 deletions react-native/.github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
merge_group:
types:
- checks_requested

jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup
uses: ./.github/actions/setup

- name: Lint files
run: yarn lint

- name: Typecheck files
run: yarn typecheck

test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup
uses: ./.github/actions/setup

- name: Run unit tests
run: yarn test --maxWorkers=2 --coverage

build-library:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup
uses: ./.github/actions/setup

- name: Build package
run: yarn prepare

build-android:
runs-on: ubuntu-latest
env:
TURBO_CACHE_DIR: .turbo/android
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup
uses: ./.github/actions/setup

- name: Cache turborepo for Android
uses: actions/cache@v3
with:
path: ${{ env.TURBO_CACHE_DIR }}
key: ${{ runner.os }}-turborepo-android-${{ hashFiles('yarn.lock') }}
restore-keys: |
${{ runner.os }}-turborepo-android-

- name: Check turborepo cache for Android
run: |
TURBO_CACHE_STATUS=$(node -p "($(yarn turbo run build:android --cache-dir="${{ env.TURBO_CACHE_DIR }}" --dry=json)).tasks.find(t => t.task === 'build:android').cache.status")

if [[ $TURBO_CACHE_STATUS == "HIT" ]]; then
echo "turbo_cache_hit=1" >> $GITHUB_ENV
fi

- name: Install JDK
if: env.turbo_cache_hit != 1
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '17'

- name: Finalize Android SDK
if: env.turbo_cache_hit != 1
run: |
/bin/bash -c "yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --licenses > /dev/null"

- name: Cache Gradle
if: env.turbo_cache_hit != 1
uses: actions/cache@v3
with:
path: |
~/.gradle/wrapper
~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('example/android/gradle/wrapper/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-

- name: Build example for Android
env:
JAVA_OPTS: "-XX:MaxHeapSize=6g"
run: |
yarn turbo run build:android --cache-dir="${{ env.TURBO_CACHE_DIR }}"

build-ios:
runs-on: macos-14
env:
TURBO_CACHE_DIR: .turbo/ios
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup
uses: ./.github/actions/setup

- name: Cache turborepo for iOS
uses: actions/cache@v3
with:
path: ${{ env.TURBO_CACHE_DIR }}
key: ${{ runner.os }}-turborepo-ios-${{ hashFiles('yarn.lock') }}
restore-keys: |
${{ runner.os }}-turborepo-ios-

- name: Check turborepo cache for iOS
run: |
TURBO_CACHE_STATUS=$(node -p "($(yarn turbo run build:ios --cache-dir="${{ env.TURBO_CACHE_DIR }}" --dry=json)).tasks.find(t => t.task === 'build:ios').cache.status")

if [[ $TURBO_CACHE_STATUS == "HIT" ]]; then
echo "turbo_cache_hit=1" >> $GITHUB_ENV
fi

- name: Cache cocoapods
if: env.turbo_cache_hit != 1
id: cocoapods-cache
uses: actions/cache@v3
with:
path: |
**/ios/Pods
key: ${{ runner.os }}-cocoapods-${{ hashFiles('example/ios/Podfile.lock') }}
restore-keys: |
${{ runner.os }}-cocoapods-

- name: Install cocoapods
if: env.turbo_cache_hit != 1 && steps.cocoapods-cache.outputs.cache-hit != 'true'
run: |
cd example/ios
pod install
env:
NO_FLIPPER: 1

- name: Build example for iOS
run: |
yarn turbo run build:ios --cache-dir="${{ env.TURBO_CACHE_DIR }}"
96 changes: 96 additions & 0 deletions react-native/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
# OSX
#
.DS_Store

# XDE
.expo/

# VSCode
.vscode/
jsconfig.json

# Xcode
#
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
*.xccheckout
*.moved-aside
DerivedData
*.hmap
*.ipa
*.xcuserstate
project.xcworkspace

# Android/IJ
#
.classpath
.cxx
.gradle
.idea
.project
.settings
local.properties
android.iml

# Cocoapods
#
example/ios/Pods

# Ruby
example/vendor/

# node.js
#
node_modules/
npm-debug.log
yarn-debug.log
yarn-error.log

# BUCK
buck-out/
\.buckd/
android/app/libs
android/keystores/debug.keystore

# Yarn
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions

# Expo
.expo/

# Turborepo
.turbo/

# generated by bob
lib/

# React Native Codegen
ios/generated
android/generated

# Uniffi bindings
rust_modules/
*.a
cpp/
android/src/main/java/
android/cpp-adapter.cpp
android/CMakeLists.txt
android/src/main/AndroidManifest.xml
ios/
src/Native*
src/generated/
src/index.ts*

1 change: 1 addition & 0 deletions react-native/.nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v18
1 change: 1 addition & 0 deletions react-native/.watchmanconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
541 changes: 541 additions & 0 deletions react-native/.yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs

Large diffs are not rendered by default.

28 changes: 28 additions & 0 deletions react-native/.yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs

Large diffs are not rendered by default.

874 changes: 874 additions & 0 deletions react-native/.yarn/releases/yarn-3.6.1.cjs

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions react-native/.yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
nodeLinker: node-modules
nmHoistingLimits: workspaces

plugins:
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
spec: "@yarnpkg/plugin-interactive-tools"
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
spec: "@yarnpkg/plugin-workspace-tools"

yarnPath: .yarn/releases/yarn-3.6.1.cjs
Loading
Loading