From 59fd7f38f2b5f5bb196d45a790ea4f04f7dbfaa7 Mon Sep 17 00:00:00 2001 From: Huiqi ZHENG <huiqi.zheng@ledger.fr> Date: Thu, 31 Mar 2022 15:51:59 +0200 Subject: [PATCH 1/2] add User-agent as http header --- src/components/TabIcon.js | 2 +- src/families/index.js | 1 - src/live-common-setup.js | 10 ++++++++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/components/TabIcon.js b/src/components/TabIcon.js index 5d159b7625..390ae76038 100644 --- a/src/components/TabIcon.js +++ b/src/components/TabIcon.js @@ -2,8 +2,8 @@ import React from "react"; import { View, StyleSheet } from "react-native"; import { useTranslation } from "react-i18next"; -import LText from "./LText"; import styled from "styled-components/native"; +import LText from "./LText"; const ICON_SIZE = 24; diff --git a/src/families/index.js b/src/families/index.js index 36a628392a..b1f2d141e9 100644 --- a/src/families/index.js +++ b/src/families/index.js @@ -9,4 +9,3 @@ export * from "./algorand"; export * from "./polkadot"; export * from "./solana"; export * from "./crypto_org"; - diff --git a/src/live-common-setup.js b/src/live-common-setup.js index 315a687f43..86d058e083 100644 --- a/src/live-common-setup.js +++ b/src/live-common-setup.js @@ -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"; @@ -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}`; +} From 0df7ab033920ceb2fe5a8c11251d472c11074466 Mon Sep 17 00:00:00 2001 From: Huiqi ZHENG <huiqi.zheng@ledger.fr> Date: Thu, 31 Mar 2022 15:59:15 +0200 Subject: [PATCH 2/2] small refactoring --- src/components/TabIcon.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/TabIcon.js b/src/components/TabIcon.js index 390ae76038..5d159b7625 100644 --- a/src/components/TabIcon.js +++ b/src/components/TabIcon.js @@ -2,8 +2,8 @@ import React from "react"; import { View, StyleSheet } from "react-native"; import { useTranslation } from "react-i18next"; -import styled from "styled-components/native"; import LText from "./LText"; +import styled from "styled-components/native"; const ICON_SIZE = 24;