-
Notifications
You must be signed in to change notification settings - Fork 399
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
90 changed files
with
3,368 additions
and
208 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
packages/components/src/primitives/Icon/react/outline/Translate.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import Svg, { SvgProps, Path } from 'react-native-svg'; | ||
const SvgTranslate = (props: SvgProps) => ( | ||
<Svg viewBox="0 0 24 24" fill="none" accessibilityRole="image" {...props}> | ||
<Path | ||
fillRule="evenodd" | ||
clipRule="evenodd" | ||
d="M8 3a1 1 0 0 1 1 1v1h3a1 1 0 0 1 0 2h-.627c-.313 1.912-.929 3.524-1.936 4.819.751.525 1.674.928 2.806 1.21a1 1 0 0 1-.485 1.941c-1.461-.365-2.717-.928-3.758-1.725-1.04.797-2.296 1.36-3.757 1.725a1 1 0 1 1-.485-1.94c1.131-.283 2.054-.686 2.805-1.211C5.556 10.524 4.94 8.912 4.628 7H4a1 1 0 0 1 0-2h3V4a1 1 0 0 1 1-1ZM6.658 7c.266 1.414.716 2.527 1.342 3.401C8.627 9.527 9.076 8.414 9.342 7H6.658Zm8.499 4.3c.687-1.631 3-1.631 3.686 0l3.079 7.312a1 1 0 0 1-1.843.776L19.494 18h-4.988l-.584 1.388a1 1 0 0 1-1.843-.776l3.078-7.311Zm.191 4.7h3.304L17 12.077 15.348 16Z" | ||
fill="currentColor" | ||
/> | ||
</Svg> | ||
); | ||
export default SvgTranslate; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
packages/components/src/primitives/Icon/react/solid/Translate.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import Svg, { SvgProps, Path } from 'react-native-svg'; | ||
const SvgTranslate = (props: SvgProps) => ( | ||
<Svg viewBox="0 0 24 24" fill="none" accessibilityRole="image" {...props}> | ||
<Path | ||
fillRule="evenodd" | ||
clipRule="evenodd" | ||
d="M8 3a1 1 0 0 1 1 1v1h3a1 1 0 0 1 0 2h-.627c-.313 1.912-.929 3.524-1.936 4.819.751.525 1.674.928 2.806 1.21a1 1 0 0 1-.485 1.941c-1.461-.365-2.717-.928-3.758-1.725-1.04.797-2.296 1.36-3.757 1.725a1 1 0 1 1-.485-1.94c1.131-.283 2.054-.686 2.805-1.211C5.556 10.524 4.94 8.912 4.628 7H4a1 1 0 0 1 0-2h3V4a1 1 0 0 1 1-1ZM6.658 7c.266 1.414.716 2.527 1.342 3.401C8.627 9.527 9.076 8.414 9.342 7H6.658Zm8.499 4.3c.687-1.631 3-1.631 3.686 0l3.079 7.312a1 1 0 0 1-1.843.776L19.494 18h-4.988l-.584 1.388a1 1 0 0 1-1.843-.776l3.078-7.311Zm.191 4.7h3.304L17 12.077 15.348 16Z" | ||
fill="currentColor" | ||
/> | ||
</Svg> | ||
); | ||
export default SvgTranslate; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
84 changes: 84 additions & 0 deletions
84
packages/kit-bg/src/dbs/simple/entity/SimpleDbEntityCustomNetwork.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
import { backgroundMethod } from '@onekeyhq/shared/src/background/backgroundDecorators'; | ||
import type { ENetworkStatus, IServerNetwork } from '@onekeyhq/shared/types'; | ||
|
||
import { SimpleDbEntityBase } from '../base/SimpleDbEntityBase'; | ||
|
||
export interface ICustomNetworkDBStruct { | ||
data: Record< | ||
string, | ||
IServerNetwork & { createdAt: number; updatedAt: number } | ||
>; | ||
} | ||
|
||
export class SimpleDbEntityCustomNetwork extends SimpleDbEntityBase<ICustomNetworkDBStruct> { | ||
entityName = 'customNetwork'; | ||
|
||
override enableCache = false; | ||
|
||
@backgroundMethod() | ||
async upsertCustomNetwork(params: { networkInfo: IServerNetwork }) { | ||
const { networkInfo } = params; | ||
await this.setRawData(({ rawData }) => { | ||
const data: ICustomNetworkDBStruct = { | ||
data: { ...(rawData?.data || {}) }, | ||
}; | ||
const now = Date.now(); | ||
const existingNetwork = data.data[networkInfo.id]; | ||
|
||
data.data[networkInfo.id] = { | ||
...networkInfo, | ||
createdAt: existingNetwork?.createdAt || now, | ||
updatedAt: now, | ||
}; | ||
return data; | ||
}); | ||
} | ||
|
||
@backgroundMethod() | ||
async deleteCustomNetwork(params: { networkId: string }) { | ||
const { networkId } = params; | ||
await this.setRawData(({ rawData }) => { | ||
const data: ICustomNetworkDBStruct = { | ||
data: { ...(rawData?.data || {}) }, | ||
}; | ||
delete data.data[networkId]; | ||
return data; | ||
}); | ||
} | ||
|
||
@backgroundMethod() | ||
async getAllCustomNetworks(): Promise<IServerNetwork[]> { | ||
const rawData = await this.getRawData(); | ||
return Object.values(rawData?.data || {}).sort( | ||
(a, b) => (b?.createdAt ?? 0) - (a?.createdAt ?? 0), | ||
); | ||
} | ||
|
||
@backgroundMethod() | ||
async getCustomNetwork(params: { networkId: string }) { | ||
const { networkId } = params; | ||
const rawData = await this.getRawData(); | ||
return rawData?.data?.[networkId]; | ||
} | ||
|
||
@backgroundMethod() | ||
async updateNetworkStatus(params: { | ||
networkId: string; | ||
status: ENetworkStatus; | ||
}) { | ||
const { networkId, status } = params; | ||
await this.setRawData(({ rawData }) => { | ||
const data: ICustomNetworkDBStruct = { | ||
data: { ...(rawData?.data || {}) }, | ||
}; | ||
if (data.data[networkId]) { | ||
data.data[networkId] = { | ||
...data.data[networkId], | ||
status, | ||
updatedAt: Date.now(), | ||
}; | ||
} | ||
return data; | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.