Skip to content
This repository has been archived by the owner on Jun 16, 2022. It is now read-only.

Commit

Permalink
Merge pull request #2371 from LedgerHQ/feat/LL-1804
Browse files Browse the repository at this point in the history
[LIVE-1804] Add user-agent in http headers
  • Loading branch information
hzheng-ledger authored Apr 22, 2022
2 parents a54d051 + 0df7ab0 commit a7abbe1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
1 change: 0 additions & 1 deletion src/families/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,3 @@ export * from "./algorand";
export * from "./polkadot";
export * from "./solana";
export * from "./crypto_org";

10 changes: 10 additions & 0 deletions src/live-common-setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ import { setPlatformVersion } from "@ledgerhq/live-common/lib/platform/version";
import { registerTransportModule } from "@ledgerhq/live-common/lib/hw";
import type { TransportModule } from "@ledgerhq/live-common/lib/hw";
import { setDeviceMode } from "@ledgerhq/live-common/lib/hw/actions/app";
import VersionNumber from "react-native-version-number";
import { Platform } from "react-native";
import axios from "axios";
import BluetoothTransport from "./react-native-hw-transport-ble";
import "./experimental";

Expand Down Expand Up @@ -133,3 +136,10 @@ registerTransportModule({
open: id => BluetoothTransport.open(id),
disconnect: id => BluetoothTransport.disconnect(id),
});

if (process.env.NODE_ENV === "production") {
axios.defaults.headers.common["User-Agent"] =
Platform.OS === "ios"
? `Live-IOS/${VersionNumber.appVersion}`
: `Live-Android/${VersionNumber.appVersion}`;
}

0 comments on commit a7abbe1

Please sign in to comment.