fix(suite-native): use correct message config on mobile (#10184)

* fix(suite-native): use correct message config on mobile

* fix(suite-native): correct color for feature message dismiss button
This commit is contained in:
vytick
2023-12-08 09:54:21 +01:00
committed by GitHub
parent 5a99908716
commit 082592a2bb
14 changed files with 40 additions and 13 deletions

View File

@@ -58,6 +58,8 @@ const isAndroid = () => getPlatform() === 'android';
const isLinux = () => false;
const isCodesignBuild = () => Config.CODESIGN_BUILD === 'true';
const getPlatformLanguages = () => getLocales().map(language => language.languageTag);
const getOsName = () => {
@@ -98,6 +100,7 @@ export const envUtils: EnvUtils = {
isWindows,
isIOs,
isLinux,
isCodesignBuild,
getOsName,
getOsNameWeb,
getOsFamily,

View File

@@ -89,6 +89,8 @@ const isLinux = () => {
return getPlatform().startsWith('Linux');
};
const isCodesignBuild = () => !!process.env.CODESIGN_BUILD;
const getOsName = () => {
if (isWindows()) return 'windows';
if (isMacOs()) return 'macos';
@@ -143,6 +145,7 @@ export const envUtils: EnvUtils = {
isWindows,
isIOs,
isLinux,
isCodesignBuild,
getOsName,
getOsNameWeb,
getOsFamily,

View File

@@ -29,6 +29,7 @@ export const {
isWindows,
isIOs,
isLinux,
isCodesignBuild,
getOsName,
getOsNameWeb,
getOsFamily,

View File

@@ -27,6 +27,7 @@ export interface EnvUtils {
isWindows: () => boolean | undefined;
isIOs: () => boolean;
isLinux: () => boolean | undefined;
isCodesignBuild: () => boolean;
getOsName: () => '' | 'android' | 'linux' | 'windows' | 'macos' | 'chromeos' | 'ios';
getOsNameWeb: () => string | undefined;
getOsFamily: () => 'Windows' | 'MacOS' | 'Linux';

View File

@@ -16,6 +16,8 @@ export const FETCH_INTERVAL = 60_000; // 1 minute in milliseconds
export const FETCH_CHECK_INTERVAL = 30_000;
export const FETCH_TIMEOUT = 30_000;
export const CONFIG_URL_REMOTE = `https://data.trezor.io/config/${
process.env.CODESIGN_BUILD ? 'stable' : 'develop'
}/${JWS_CONFIG_FILENAME_REMOTE}`;
export const CONFIG_URL_REMOTE_BASE = 'https://data.trezor.io/config';
export const CONFIG_URL_REMOTE = {
stable: `${CONFIG_URL_REMOTE_BASE}/stable/${JWS_CONFIG_FILENAME_REMOTE}`,
develop: `${CONFIG_URL_REMOTE_BASE}/develop/${JWS_CONFIG_FILENAME_REMOTE}`,
};

View File

@@ -1,5 +1,6 @@
import { decode, verify } from 'jws';
import { isCodesignBuild } from '@trezor/env-utils';
import { scheduleAction } from '@trezor/utils';
import { createThunk } from '@suite-common/redux-utils';
import { MessageSystem } from '@suite-common/suite-types';
@@ -19,8 +20,12 @@ import {
} from './messageSystemSelectors';
const getConfigJws = async () => {
const remoteConfigUrl = isCodesignBuild()
? CONFIG_URL_REMOTE.stable
: CONFIG_URL_REMOTE.develop;
try {
const response = await scheduleAction(signal => fetch(CONFIG_URL_REMOTE, { signal }), {
const response = await scheduleAction(signal => fetch(remoteConfigUrl, { signal }), {
timeout: FETCH_TIMEOUT,
});

View File

@@ -3,4 +3,5 @@ COMMIT_HASH=
CHANGELOG=
VERSION=
BUILD_NUMBER=
CODESIGN_BUILD=false
JWS_PUBLIC_KEY='-----BEGIN PUBLIC KEY-----MFYwEAYHKoZIzj0CAQYFK4EEAAoDQgAEbSUHJlr17+NywPS/w+xMkp3dSD8eWXSuAfFKwonZPe5fL63kISipJC+eJP7Mad0WxgyJoiMsZCV6BZPK2jIFdg==-----END PUBLIC KEY-----'

View File

@@ -3,4 +3,5 @@ COMMIT_HASH=
CHANGELOG=
VERSION=
BUILD_NUMBER=
CODESIGN_BUILD=false
JWS_PUBLIC_KEY='-----BEGIN PUBLIC KEY-----MFYwEAYHKoZIzj0CAQYFK4EEAAoDQgAEbSUHJlr17+NywPS/w+xMkp3dSD8eWXSuAfFKwonZPe5fL63kISipJC+eJP7Mad0WxgyJoiMsZCV6BZPK2jIFdg==-----END PUBLIC KEY-----'

View File

@@ -4,4 +4,5 @@ COMMIT_HASH=
CHANGELOG=
VERSION=
BUILD_NUMBER=
CODESIGN_BUILD=true
JWS_PUBLIC_KEY='-----BEGIN PUBLIC KEY-----MFYwEAYHKoZIzj0CAQYFK4EEAAoDQgAES7MbBzU/v5BsljkTM8Mz0Jsk+Nn5n2wH\no2/+MUI3TgCVdTbEHhn3HXaY7GJ6TLyWqxn+pIDY9wUUAyUqOStTUQ==-----END PUBLIC KEY-----'

View File

@@ -3,4 +3,5 @@ COMMIT_HASH=
CHANGELOG=
VERSION=
BUILD_NUMBER=
JWS_PUBLIC_KEY='-----BEGIN PUBLIC KEY-----MFYwEAYHKoZIzj0CAQYFK4EEAAoDQgAES7MbBzU/v5BsljkTM8Mz0Jsk+Nn5n2wH\no2/+MUI3TgCVdTbEHhn3HXaY7GJ6TLyWqxn+pIDY9wUUAyUqOStTUQ==-----END PUBLIC KEY-----'
CODESIGN_BUILD=false
JWS_PUBLIC_KEY='-----BEGIN PUBLIC KEY-----MFYwEAYHKoZIzj0CAQYFK4EEAAoDQgAES7MbBzU/v5BsljkTM8Mz0Jsk+Nn5n2wH\no2/+MUI3TgCVdTbEHhn3HXaY7GJ6TLyWqxn+pIDY9wUUAyUqOStTUQ==-----END PUBLIC KEY-----'

View File

@@ -36,7 +36,6 @@ private_lane :replace_debug_info_environment_variables do |options|
changelog_substitute = "s/^(CHANGELOG)=(.*)$/\\1=#{ENV["CHANGELOG"]}/"
version_substitute = "s/^(VERSION)=(.*)$/\\1=#{ENV["VERSION"]}/"
build_number_substitute = "s/^(BUILD_NUMBER)=(.*)$/\\1=#{ENV["BUILD_NUMBER"]}/"
codesign_build_substitute = "s/^(CODESIGN_BUILD)=(.*)$/\\1=#{ENV["CODESIGN_BUILD"]}/"
if is_ci and platform == :ios
sh(
@@ -45,7 +44,6 @@ private_lane :replace_debug_info_environment_variables do |options|
sed -r -i '' '#{changelog_substitute}' '#{environment_file}'
sed -r -i '' '#{version_substitute}' '#{environment_file}'
sed -r -i '' '#{build_number_substitute}' '#{environment_file}'
sed -r -i '' '#{codesign_build_substitute}' '#{environment_file}'
SHELL
)
elsif is_ci and platform == :android
@@ -55,7 +53,6 @@ private_lane :replace_debug_info_environment_variables do |options|
sed -r -i '#{changelog_substitute}' '#{environment_file}'
sed -r -i '#{version_substitute}' '#{environment_file}'
sed -r -i '#{build_number_substitute}' '#{environment_file}'
sed -r -i '#{codesign_build_substitute}' '#{environment_file}'
SHELL
)
end

View File

@@ -853,4 +853,4 @@ SPEC CHECKSUMS:
PODFILE CHECKSUM: d37876aaf00e7f8309b694188119b139b8452ca1
COCOAPODS: 1.11.3
COCOAPODS: 1.14.3

View File

@@ -24,12 +24,23 @@
<string>1</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSApplicationCategoryType</key>
<string></string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<false/>
<key>NSExceptionDomains</key>
<dict>
<key>data.trezor.io/config</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
<key>NSIncludesSubdomains</key>
<true/>
</dict>
<key>localhost</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
@@ -40,9 +51,11 @@
<key>NSCameraUsageDescription</key>
<string>$(PRODUCT_NAME) needs access to your Camera to scan your XPUB.</string>
<key>NSFaceIDUsageDescription</key>
<string>$(PRODUCT_NAME) needs Face ID and Touch ID to keep sensitive data about your portfolio private.</string>
<string>$(PRODUCT_NAME) needs Face ID and Touch ID to keep sensitive data about your portfolio private.</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string></string>
<key>NSMicrophoneUsageDescription</key>
<string>This app does not require access to the microphone.</string>
<key>UIAppFonts</key>
<array>
<string>TTSatoshi-Bold.otf</string>
@@ -72,7 +85,5 @@
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>NSMicrophoneUsageDescription</key>
<string>This app does not require access to the microphone.</string>
</dict>
</plist>

View File

@@ -126,7 +126,7 @@ export const FeatureMessageScreen = () => {
</Button>
)}
{isDismissable && (
<Button size="large" onPress={handleDismiss}>
<Button size="large" colorScheme="tertiaryElevation0" onPress={handleDismiss}>
{translate('generic.buttons.dismiss')}
</Button>
)}