Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OK-28046 OK-28150 feat: remove hardware sdk url setting #4686

Merged
merged 2 commits into from
Jun 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions packages/kit-bg/src/services/ServiceSetting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import { getDefaultLocale } from '@onekeyhq/shared/src/locale/getDefaultLocale';
import platformEnv from '@onekeyhq/shared/src/platformEnv';
import { memoizee } from '@onekeyhq/shared/src/utils/cacheUtils';
import timerUtils from '@onekeyhq/shared/src/utils/timerUtils';
import type { EOnekeyDomain } from '@onekeyhq/shared/types';
import { EServiceEndpointEnum } from '@onekeyhq/shared/types/endpoint';
import type { IClearCacheOnAppState } from '@onekeyhq/shared/types/setting';

Expand Down Expand Up @@ -92,14 +91,6 @@ class ServiceSetting extends ServiceBase {
}));
}

@backgroundMethod()
public async setHardwareConnectSrc(value: EOnekeyDomain) {
await settingsPersistAtom.set((prev) => ({
...prev,
hardwareConnectSrc: value,
}));
}

@backgroundMethod()
public async refreshLastActivity() {
await settingsLastActivityAtom.set((prev) => ({
Expand Down
8 changes: 8 additions & 0 deletions packages/kit/src/views/Setting/pages/Currency/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { type FC, useCallback, useMemo, useState } from 'react';
import { useIntl } from 'react-intl';

import {
Empty,
Page,
SearchBar,
SectionList,
Expand Down Expand Up @@ -145,6 +146,13 @@ export default function SettingCurrencyModal() {
ListHeaderComponent={
<ListHeaderComponent text={text} onChangeText={onChangeText} />
}
ListEmptyComponent={
<Empty
icon="SearchOutline"
title="No results"
description="Try to change the search keyword"
/>
}
sections={sections ?? emptySections}
renderItem={renderItem}
renderSectionHeader={renderSectionHeader}
Expand Down
50 changes: 0 additions & 50 deletions packages/kit/src/views/Setting/pages/HardwareSdkUrl/index.tsx

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,29 +15,13 @@ import { openUrlExternal } from '@onekeyhq/shared/src/utils/openUrlUtils';
import { Section } from '../Section';

const HardwareBridgeListItems = () => {
const navigation =
useAppNavigation<IPageNavigationProp<IModalSettingParamList>>();
const onPressBridgeSdkUrl = useCallback(() => {
navigation.push(EModalSettingRoutes.SettingHardwareSdkUrlModal);
}, [navigation]);

const onPressBridgeStatus = useCallback(() => {
openUrlExternal(BRIDGE_STATUS_URL);
}, []);
const intl = useIntl();

const [settings] = useSettingsPersistAtom();

return (
<>
<ListItem
onPress={onPressBridgeSdkUrl}
icon="CodeOutline"
title={intl.formatMessage({ id: 'form__hardware_bridge_sdk_url' })}
drillIn
>
<ListItem.Text primary={settings.hardwareConnectSrc} align="right" />
</ListItem>
<ListItem
onPress={onPressBridgeStatus}
icon="ApiConnectionOutline"
Expand Down
8 changes: 0 additions & 8 deletions packages/kit/src/views/Setting/router/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ const SettingAppAutoLockModal = LazyLoadPage(
const SettingCurrencyModal = LazyLoadPage(
() => import('@onekeyhq/kit/src/views/Setting/pages/Currency'),
);
const SettingHardwareSdkUrlModal = LazyLoadPage(
() => import('@onekeyhq/kit/src/views/Setting/pages/HardwareSdkUrl'),
);
const SettingListModal = LazyLoadPage(
() => import('@onekeyhq/kit/src/views/Setting/pages/List'),
);
Expand Down Expand Up @@ -66,11 +63,6 @@ export const ModalSettingStack: IModalFlowNavigatorConfig<
component: SettingAccountDerivationModal,
translationId: 'form__theme',
},
{
name: EModalSettingRoutes.SettingHardwareSdkUrlModal,
component: SettingHardwareSdkUrlModal,
translationId: 'form__hardware_bridge_sdk_url',
},
{
name: EModalSettingRoutes.SettingAppAutoLockModal,
component: SettingAppAutoLockModal,
Expand Down
8 changes: 2 additions & 6 deletions packages/shared/src/hardware/instance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@ import {
import platformEnv from '@onekeyhq/shared/src/platformEnv';
import { memoizee } from '@onekeyhq/shared/src/utils/cacheUtils';

import { EOnekeyDomain } from '../../types';

import { importHardwareSDK, importHardwareSDKLowLevel } from './sdk-loader';

import type { EOnekeyDomain } from '../../types';
import type {
ConnectSettings,
CoreApi,
Expand All @@ -21,10 +20,7 @@ let HardwareSDK: CoreApi;
let HardwareLowLevelSDK: LowLevelCoreApi;

export const generateConnectSrc = (hardwareConnectSrc?: EOnekeyDomain) => {
let connectSrc = `${HARDWARE_SDK_IFRAME_SRC_ONEKEYSO}/${HARDWARE_SDK_VERSION}/`;
if (hardwareConnectSrc === EOnekeyDomain.ONEKEY_CN) {
connectSrc = `${HARDWARE_SDK_IFRAME_SRC_ONEKEYCN}/${HARDWARE_SDK_VERSION}/`;
}
const connectSrc = `${HARDWARE_SDK_IFRAME_SRC_ONEKEYSO}/${HARDWARE_SDK_VERSION}/`;
return connectSrc;
};

Expand Down
2 changes: 0 additions & 2 deletions packages/shared/src/routes/setting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ export enum EModalSettingRoutes {
SettingListModal = 'SettingListModal',
SettingCurrencyModal = 'SettingCurrencyModal',
SettingAccountDerivationModal = 'SettingAccountDerivationModal',
SettingHardwareSdkUrlModal = 'SettingHardwareSdkUrlModal',
SettingSpendUTXOModal = 'SettingSpendUTXOModal',
SettingAppAutoLockModal = 'SettingAppAutoLockModal',
SettingProtectModal = 'SettingProtectModal',
Expand All @@ -14,7 +13,6 @@ export type IModalSettingParamList = {
[EModalSettingRoutes.SettingListModal]: undefined;
[EModalSettingRoutes.SettingCurrencyModal]: undefined;
[EModalSettingRoutes.SettingAccountDerivationModal]: undefined;
[EModalSettingRoutes.SettingHardwareSdkUrlModal]: undefined;
[EModalSettingRoutes.SettingSpendUTXOModal]: undefined;
[EModalSettingRoutes.SettingAppAutoLockModal]: undefined;
[EModalSettingRoutes.SettingProtectModal]: undefined;
Expand Down
1 change: 0 additions & 1 deletion packages/shared/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ export type IServerNetwork = {

export enum EOnekeyDomain {
ONEKEY_SO = 'onekey.so',
ONEKEY_CN = 'onekeycn.com',
}

export enum EAccountSelectorSceneName {
Expand Down
Loading