From 8061336bcb1ad7a7b5a628ce344f10831e8c91c0 Mon Sep 17 00:00:00 2001 From: amougel Date: Mon, 23 Jul 2018 17:13:56 +0200 Subject: [PATCH] add FORCE_PROVIDER constant for testing --- src/config/constants.js | 3 +++ src/helpers/devices/getDeviceInfo.js | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/config/constants.js b/src/config/constants.js index 1fd94965..032f98d9 100644 --- a/src/config/constants.js +++ b/src/config/constants.js @@ -56,6 +56,9 @@ export const MANAGER_API_BASE = stringFromEnv( export const BASE_SOCKET_URL = stringFromEnv('BASE_SOCKET_URL', 'wss://api.ledgerwallet.com/update') +// Provider +export const FORCE_PROVIDER = intFromEnv('FORCE_PROVIDER', 0) + // Flags export const DEBUG_ANALYTICS = boolFromEnv('DEBUG_ANALYTICS') diff --git a/src/helpers/devices/getDeviceInfo.js b/src/helpers/devices/getDeviceInfo.js index f133b43e..5ea943e3 100644 --- a/src/helpers/devices/getDeviceInfo.js +++ b/src/helpers/devices/getDeviceInfo.js @@ -3,6 +3,7 @@ import type Transport from '@ledgerhq/hw-transport' import { getFirmwareInfo } from 'helpers/common' +import { FORCE_PROVIDER } from 'config/constants' export type DeviceInfo = { targetId: string | number, @@ -31,7 +32,7 @@ export default async (transport: Transport<*>): Promise => { seVersion.match(/([0-9]+.[0-9])+(.[0-9]+)?((?!-osu)-([a-z]+))?(-osu)?/) || [] const isOSU = typeof parsedVersion[5] !== 'undefined' const providerName = parsedVersion[4] || '' - const providerId = PROVIDERS[providerName] + const providerId = FORCE_PROVIDER || PROVIDERS[providerName] const isBootloader = targetId === 0x01000001 const majMin = parsedVersion[1] const patch = parsedVersion[2] || '.0'