An advanced Ethereum/EVM mobile wallet
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
alpha-wallet-ios/docs/INTRODUCTION-CODE.md

2.8 KiB

Refer to High Level Blocks

Flow coordinators

The app uses Flow coordinators to avoid coupling between view controllers.

One unfortunate thing with the codebase is that a lot of the logic ends up being in the coordinators. Those should and can be moved into separate logic types.

Almost every view controller has an auxiliary protocol defined in the same file, at the top of the file. Never open another view controller from each view controller. Go through the protocol which will be implemented by a coordinator.

User interface & Storyboard

The app UI is built entirely in code. No storyboard/nib/xib is used.

Notable Types

  • AppDelegate and AppCoordinator is where the app starts
  • InCoordinator is where the bulk of the app branches from
  • MigrationInitializer stores Realm migration code
  • MigrationInitializerForOneChainPerDatabase should never be modified
  • Constants
  • Config
  • Features holds flags to toggle features. This is usually meant to be for WIP features that would be good to merge (big changes, or we want to test them) yet not ready yet
  • Always use R to access strings, image files, colors and other files bundled with the app. eg. R.string.localizable.addrpcServerNavigationTitle(). This avoids runtime errors and crashes
  • Constants.Credentials is where API keys are stored. Replace them when making production builds
  • Use the logging functions to generate logs to help development. Beware of performance and too much noise
    • debugLog()
    • infoLog()
    • warnLog()
    • verboseLog()
    • errorLog()

TestFlight

  1. Update the build number and if necessary the version number. Commit this
  2. Make sure Constants.Credentials is updated. Do not commit these changes unless you are sure your repo is private
  3. Archive the AlphaWallet target for Any iOS Device (arm64)
  4. Submit

Submission to the app store

Submit the appropriate TestFlight build or repeat the process and submit the new build

Tips

Some specific tasks:

Tip: Figure out where to change

An easy way to figure out which part of the code makes a change is to look for text in the UI like the title of the current screen or a button. Look for it in R.generated.swift (this file is automatically generated and updated based on the localization strings files while building the project). Look for the function returning the string you want and then find callers for that function.

Tip: Navigating the code base

Look for implementors and callers of protocols is a very important part of working with the code base. As of writing, AppCode provides better code navigation functionality than Xcode.

Tip: Add support for a new chain

  1. Open RPCServer
  2. Add a new case to the enum
  3. Build and fix the errors. Do not use switch-default: