Skip to content

MetaMask/metamask-mobile

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1,720 Commits
 
 
 
 

Repository files navigation

metamask-mobile App Config

A hosted JSON object that can be fetched to get information that needs to come from a remote source.

Version Status Link
1 stable https://metamask.github.io/metamask-mobile/AppConfig/v1/AppConfig.json
test test https://metamask.github.io/metamask-mobile/AppConfig/test/MockAppConfig.json

Getting Started

$ curl https://metamask.github.io/metamask-mobile/AppConfig/v1/AppConfig.json

{
  "security":{
    "minimumVersions": {
      "appMinimumBuild": 700,
      "appleMinimumOS": 6,
      "androidMinimumAPIVersion": 21
    }
  }
}

Contributing

Opening an issue/pull request

  • Always add the label minimum-versions when modifying the minimum secure versions.

Changing the minimum version

  • All severity 0 bugs should result in a minimum version bump. The value should reflect the version of the app that resolved said issue.
  • Changing the minimum version should only happen after the bug fix has been released to 100% + 24 hours to be safe.
  • All version changes should be documented in notion here.
  • Once the above steps have been completed, this becomes a relatively simple change. All that is needed is to change the values in the AppConfig.json file to your desired values. There is no need for a new version of the API or any code changes in the mobile repo.

Changing the schema

If you want to add/modify fields to the API then you must create a new version of the API by creating a subdirectory in the AppConfig folder with your desired version number. You must also modify the test endpoint located at AppConfig/test/MockAppConfig.json to match the new schema.

NOTE If you are modifying the schema AND changing existing values you must also modify the existing values in the older versions of the API.

Change the README to document the new API and mark the latest version as stable.

Changes required in the mobile codebase

  1. Since the useAppConfig hook will no longer work you must modify the AppConfig.ts interface to exactly your new JSON object.
  2. Then you will need to modify this logic within the fetch to correctly parse the response to match the new schema.
  3. Change the MM_APP_CONFIG_URL to the newest endpoint.

Using In The Mobile App

There is a handy useAppConfig hook in the mobile repo that will fetch and parse the AppConfig into a useable typescript object. This hook will return an object with the state of Loading or Error or Success and the values inside the data property. You must then check to see if data exists in the state before you can interact with the AppConfig.

const appConfig = useAppConfig();

if (appConfig.data) {
	console.log(appConfig.data.security.minimumVersions.appMinimumBuild);
}

App Config API

security.minimumVersions

  • The current minimum supported app and operating system versions.
{
  "security":{
    "minimumVersions": {
      "appMinimumBuild": 700,
      "appleMinimumOS": 6,
      "androidMinimumAPIVersion": 21
    }
  }
}

Testing

A mock endpoint can be found at AppConfig/test/MockAppConfig.json. This endpoint can be used to populate test values for QA without changing the stable values. To test minimum values logic, open a PR with values higher than the current stable release values. Once merged, you can query the test endpoint at https://metamask.github.io/metamask-mobile/AppConfig/test/MockAppConfig.json and verify that the mobile app performs accordingly.

{
  "security":{
    "minimumVersions": {
      "appMinimumBuild": 972,
      "appleMinimumOS": 6,
      "androidMinimumAPIVersion": 21
    }
  }
}

About

Mobile web browser providing access to websites that use the Ethereum blockchain

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Sponsor this project

Packages

 
 
 

Contributors