Git Product home page Git Product logo

ledger-live-mobile's Introduction

⛔️ DEPRECATED

This repository is now deprecated. We moved to a new mono repository architecture containing all of Ledger Live JavaScript Ecosystem that you can find here. You can follow the migration guide to help you make the transition.

We are hiring, join us! 👨‍💻👩‍💻

ledger-live-mobile

Ledger Live is a mobile companion app for Ledger hardware wallets. It allows users to manage their crypto assets securely, such as Bitcoin, Ethereum, XRP and many others. Ledger Live mobile is available for iOS and Android.

Architecture

Ledger Live is a native mobile application built with React Native, React, Redux, RxJS, etc. and some native libraries. The architecture is analog to the desktop application and also uses our C++ library, lib-ledger-core, to deal with blockchains (sync, broadcast...) via ledger-core-react-native-bindings. It communicates with the Ledger Nano X via Bluetooth (or USB for using the Ledger Nano S on Android) to manage installed applications, update the device firmware, verify public addresses and sign transactions with ledgerjs. We also share some logic in live-common.

Developing on ledger-live-mobile

Pre-requisites

iOS

Android

  • Android Studio
  • JDK 11
  • Required SDK tools: (go to Android Studio > Tools > SDK Manager > SDK Tools > check "Show Package Details" at the bottom right)
    • Android NDK 21.4.7075529 (in case this doc is outdated, check the version specified as ndkVersion in android/build.gradle)
    • CMake 3.10.2

Scripts

yarn install

install dependencies.

yarn start

Runs your app in development mode.

Sometimes you may need to reset or clear the React Native packager's cache. To do so, you can pass the --reset-cache flag to the start script:

yarn start -- --reset-cache

yarn test

yarn run ios

or open ios/ledgerlivemobile.xcworkspace

yarn run android

or open android/ in Android Studio.

yarn android:clean

Delete the application data for Ledger Live Mobile, equivalent to doing it manually through settings

yarn android:import importDataString

Passing a base64 encoded export string (the export from desktop) will trigger an import activity and allow easy data setting for development.

Environment variables

Optional environment variables you can put in .env, .env.production or .env.staging for debug, release, or staging release builds respectively.

A more exhaustive list of documented environment variables can be found here.

  • DEVICE_PROXY_URL=http://localhost:8435 Use the ledger device over HTTP. Useful for debugging on an emulator. More info about this in the section Connection via HTTP bridge.
  • BRIDGESTREAM_DATA=... Come from console.log of the desktop app during the qrcode export. allow to bypass the bridgestream scanning.
  • DEBUG_RNDEBUGGER=1 Enable react native debugger.
  • DISABLE_READ_ONLY=1 Disable readonly mode by default.
  • SKIP_ONBOARDING=1 Skips the onboarding flow.

Maintenance

Refresh the flow-typed from flow-typed Github

yarn sync-flowtyped

Refresh the languages (when we add new languages)

yarn sync-locales

Debugging

Javascript / React

It's recommended to use react-native-debugger instead of Chrome dev tools as it features some additional React and Redux panels.

  • Get the react-native-debugger app from the official repo
  • Run it
  • Run Ledger Live Mobile in debug mode (yarn ios or yarn android)
  • Open React Native Development menu (shake gesture)
  • Chose Enable Remote JS Debugging

Keep in mind that doing so will run your Javascript code on a Chromium JS engine (V8) on your computer, instead of iOS' system JS engine (JavaScript Core), or our bundled JS engine (JSC for now, soon to be replaced with Hermes) on Android.

End to end testing

Refer to the e2e specific README.md

Native code

XCode / Android studio

Run the app from the Apple or Google own IDE to get some native debugging features like breakpoints etc.

And more

Flipper 🐬

Flipper has been integrated in the project, so you can use it to get additional debugging information (like network monitoring) and find other useful data you could previously get from scattered places, here neatly presented in a single interface (like logs and crash reports for both platforms).

React Native integration seems pretty bleeding edge right now, so don't expect everything to work just yet.

  • Install Flipper on your computer
  • Launch it 🚀
  • Run Ledger Live Mobile in debug as usual
  • No need to enable remote debug!

Working on iOS or Android emulators

Connection via HTTP bridge

It is possible to run Ledger Live Mobile on an emulator and connect to a Nano that is plugged in via USB.

  • Install the ledger-live cli.
  • Plug in your Nano to your computer.
  • Run ledger-live proxy. A server starts and displays variable environments that can be used to build Ledger-Live Mobile. For example:
    DEVICE_PROXY_URL=ws://localhost:8435
    DEVICE_PROXY_URL=ws://192.168.1.14:8435
    Nano S proxy started on 192.168.1.14
    
  • Either do export DEVICE_PROXY_URL=the_adress_given_by_the_server or paste this variable environment in the .env file at the root of the project (create it if it doesn't exist)
  • Build & run Ledger Live Mobile yarn ios or yarn android
  • When prompted to choose a Nano device in Ledger Live Mobile, you will see your Nano available with the adress from above, just select it and it should work normally.

Extra Docs 📄

ledger-live-mobile's People

Contributors

arnaud97234 avatar cgrellard-ledger avatar dasilvarosa avatar dependabot[bot] avatar elbywan avatar ggilchrist-ledger avatar gre avatar grsoares21 avatar henri-ly avatar hzheng-ledger avatar iammorrow avatar jelbaz-ledger avatar juan-cortes avatar junichisugiura avatar khalilbellakrid avatar lambertkevin avatar ledger-bot avatar ledgerlive avatar lfbarreto avatar machard avatar meriadec avatar mortalkastor avatar nastias avatar nparigi-ledger avatar ofreyssinet-ledger avatar pbondoer avatar qd-qd avatar thomasrogerlux avatar tlaforge-ledger avatar valpinkman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ledger-live-mobile's Issues

Make the package name / bundle identifier consistent

Right now we have com.ledger.live for iOS, com.ledgerlivemobile for Android, and some com.ledgerwallet leftovers.

$ for SUFFIX in .live livemobile wallet; do PATTERN="com.ledger$SUFFIX"; echo "--- $PATTERN ---"; rg -c $PATTERN | tee; done
--- com.ledger.live ---
ios/ledgerlivemobile.xcodeproj/project.pbxproj:2
--- com.ledgerlivemobile ---
package.json:1
android/app/BUCK:2
android/app/build.gradle:2
android/app/src/main/AndroidManifest.xml:1
android/app/src/main/java/com/ledgerlivemobile/MainApplication.java:1
android/app/src/main/java/com/ledgerlivemobile/MainActivity.java:1
--- com.ledgerwallet ---
ios/ledgerlivemobile/Info.plist:1
android/app/src/main/java/com/ledgerlivemobile/MainApplication.java:1

We should settle on one I guess, com.ledger.live seems the best, as we now own ledger.com, and it follows Android's (actually, Java's) naming convention.

Unless it's bad practice to use the same string for iOS bundle id and Android package name?

bugs with the new Account header

There are many bugs with current implementation and I suggest we revert it and rework it later.

we really should stick to react-navigation here because it solves a lot of the bug i'm going to list (non exhaustive)

  • it does not properly support the "SafeAreaView". on iOS the account name goes into the navbar
  • you no longer see the SectionList header like we used to
  • when you pull down the ScrollView you even move the header itself
  • it does not support having the title longer than available space

The code is also a bit complex component compared to the previous version that was delegating more to react-navigation and there is a cost to maintain & fix it all, so I would suggest we rollback to the simpler version for now, and in future, we need to figure out how we can pass in the animated value directly the the "headerTitle" component.

Handle android config deprecation

Let's figure out if it's fixable:

$ yarn staging-android                                                                                                               develop-libcore
yarn run v1.9.4
$ ADB=$ANDROID_HOME/platform-tools/adb && cd android && ./gradlew assembleStagingRelease && $ADB install -r app/build/outputs/apk/stagingRelease/app-stagingRelease.apk && $ADB shell monkey -p com.ledgerlivemobile.staging 1
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
Reading env from: .env
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
WARNING: Configuration 'testCompile' is obsolete and has been replaced with 'testImplementation' and 'testApi'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
WARNING: Configuration 'testApi' is obsolete and has been replaced with 'testImplementation'.
...

better pull to refresh

pull to refresh need to wait the actual end of everything it was pulling of.. i'll work a bit on that. (wip branch)

also need to do a Promise.all([ delay(300), ..] just for ui to not go too crazy in case everything load fast

Test RN's WebSocket

we will need websocket in the future, make sure it correctly works. test things a bit.

hidden feature to trigger an error

we need a hidden feature that trigger a crash, we need both JS and a native crash. this would allow us to test at any time if Sentry works and especially if sourcemaps works. IMO it's quite vital it's shipped on all modes (release too), we just need it to be hidden

templatize the appname from the .env file

"Ledger Live" shouldn't be hardcoded both in strings.xml (android) and in Info.plist,

with the use of react-native-config we can inject it from the .env file.

Two usecases:

  • share this literally between 2 platforms
  • customize it so when we make Staging / Dev version we can easily differenciate on the phone

Performance: provideSummary

more perf to look in this.
need to introduce more caches.

that would be overkill for now, but i was thinking the last solution could be to use some sort of webworker & we send the whole redux store and it gets us back all the calculations.

Rebootstrap the project

we keep the same repo, but the project code will be fully rebootstrap:

  • we'll have a old 'poc' branch to keep track of old code
  • we'll make sure to backport all things we've set up on desktop proj ( .github/ , etc.. same management of master/develop branch, ..)
  • we'll make sure to backport all necessary things and good practice that was in mobile project too. (fonts, etc..)
  • bootstrap with latest React Native, re-create the basic screens architecture (in sync with latest design choices),
  • prepare the libs we're sure that will be in and integrate a basic version of all features (very very light, just poc) just to make sure all is correctly plugged in architecture (redux, countervalue, etc..)
  • make clear decision on sourcecode tree and list out the parts that will need to work on. try to establish a rough roadmap.

Do the tab bar need a tiny more padding or maybe no text?

i feel the bar is not enough big. text is too close to edge. also kinda hard to touch on Android & is close to the bottom bar with the back button/home/ ..

I actually wonder if the text is necessary , it feels a bit ugly on Android with the actual bar on the bottom. if study a bit some apps on Android, tab bars that have text are usually on top. on bottom it's usually just icons.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.