Skip to content

Commit cf4373b

Browse files
Merge remote-tracking branch 'origin/release/desktop-shimmer-2.1.14' into release/desktop-iota-2.0.9
2 parents 0cb9628 + 61c732a commit cf4373b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+692
-132
lines changed

packages/desktop/components/panes/ProposalInformationPane.svelte

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
</script>
6363

6464
<Pane height={Height.Fit}>
65-
<Text smaller classes="mb-5">
65+
<Text smaller classes="mb-4">
6666
{localize('views.governance.details.proposalInformation.title')}
6767
</Text>
6868
<ul class="space-y-2">

packages/desktop/electron/electronApi.js

-46
Original file line numberDiff line numberDiff line change
@@ -7,30 +7,12 @@ const NotificationManager = require('./lib/notificationManager')
77
const { menuState } = require('./lib/menuState')
88
const features = require('../features/features').default
99

10-
let activeProfileId = null
1110
const eventListeners = {}
1211

1312
const ElectronApi = {
1413
updateAppSettings(settings) {
1514
return ipcRenderer.invoke('update-app-settings', settings)
1615
},
17-
getActiveProfile() {
18-
return activeProfileId
19-
},
20-
updateActiveProfile(id) {
21-
activeProfileId = id
22-
},
23-
async renameProfileFolder(oldPath, newPath) {
24-
return ipcRenderer.invoke('get-path', 'userData').then((userDataPath) => {
25-
if (oldPath.startsWith(userDataPath)) {
26-
try {
27-
fs.renameSync(oldPath, newPath)
28-
} catch (err) {
29-
console.error(err)
30-
}
31-
}
32-
})
33-
},
3416
async removeProfileFolder(profilePath) {
3517
return ipcRenderer.invoke('get-path', 'userData').then((userDataPath) => {
3618
// Check that the removing profile path matches the user data path
@@ -82,28 +64,6 @@ const ElectronApi = {
8264
return result.filePath
8365
})
8466
},
85-
saveStrongholdBackup: ({ allowAccess }) => null,
86-
async exportTransactionHistory(defaultPath, contents) {
87-
return ipcRenderer
88-
.invoke('show-save-dialog', {
89-
properties: ['createDirectory', 'showOverwriteConfirmation'],
90-
defaultPath,
91-
filters: [{ name: 'CSV Files', extensions: ['csv'] }],
92-
})
93-
.then((result) => {
94-
if (result.canceled) {
95-
return null
96-
}
97-
return new Promise((resolve, reject) => {
98-
try {
99-
fs.writeFileSync(result.filePath, contents)
100-
resolve(result.filePath)
101-
} catch (err) {
102-
reject(err)
103-
}
104-
})
105-
})
106-
},
10767
/**
10868
* Gets directory for app's configuration files
10969
*
@@ -337,12 +297,6 @@ const ElectronApi = {
337297
updateTheme(theme) {
338298
return ipcRenderer.invoke('update-theme', theme)
339299
},
340-
startLedgerProcess() {
341-
return ipcRenderer.send('start-ledger-process')
342-
},
343-
killLedgerProcess() {
344-
return ipcRenderer.send('kill-ledger-process')
345-
},
346300
}
347301

348302
module.exports = ElectronApi

packages/desktop/views/dashboard/governance/views/ProposalDetailsView.svelte

+4-4
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
} from '@contexts/governance/utils'
3737
import { openPopup, PopupId } from '@auxiliary/popup'
3838
import { activeProfile } from '@core/profile'
39-
import { TextHintVariant } from 'shared/components/enums'
39+
import { FontWeight, TextHintVariant } from '@ui'
4040
4141
const { metadata } = $visibleSelectedAccountAssets?.[$activeProfile?.network?.id]?.baseCoin ?? {}
4242
@@ -219,7 +219,7 @@
219219
<ProposalDetailsButton proposal={$selectedProposal} />
220220
</header-container>
221221
<div class="flex flex-1 flex-col space-y-4 justify-between scrollable-y">
222-
<Text type={TextType.h2}>{$selectedProposal?.title}</Text>
222+
<Text type={TextType.h4}>{$selectedProposal?.title}</Text>
223223
{#if $selectedProposal?.additionalInfo}
224224
<MarkdownBlock text={$selectedProposal?.additionalInfo} />
225225
{/if}
@@ -228,7 +228,7 @@
228228
</Pane>
229229
<Pane height={Height.Fit}>
230230
<div class="shrink-0">
231-
<Text smaller classes="mb-5">
231+
<Text fontWeight={FontWeight.medium} fontSize="12" classes="mb-4">
232232
{localize('views.governance.details.yourVote.title')}
233233
</Text>
234234
<ul class="space-y-2">
@@ -254,7 +254,7 @@
254254
</div>
255255
<div class="w-3/5">
256256
<Pane height={Height.Full}>
257-
<div class="flex flex-col justify-between flex-1 space-y-4 scrollable-y max-h-full">
257+
<div class="flex flex-col justify-between flex-1 space-y-4 scrollable-y h-full max-h-full">
258258
<proposal-questions
259259
class="relative flex flex-1 flex-col space-y-5 overflow-y-scroll"
260260
bind:this={proposalQuestions}

packages/desktop/views/login/views/EnterPinView.svelte

+8-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import { loginRouter } from '@core/router'
1616
import { isValidPin } from '@core/utils'
1717
import features from '@features/features'
18-
import { Icon, PinInput, Profile, Text, TextHint } from '@ui'
18+
import { Icon, InitProfileActionsModal, MeatballMenuButton, Modal, PinInput, Profile, Text, TextHint } from '@ui'
1919
import { TextHintVariant } from 'shared/components/enums'
2020
import { onDestroy } from 'svelte'
2121
@@ -35,6 +35,7 @@
3535
let buttonText: string = getButtonText(timeRemainingBeforeNextAttempt)
3636
let maxAttemptsTimer: ReturnType<typeof setTimeout> = null
3737
let shakeTimeout: ReturnType<typeof setTimeout> = null
38+
let modal: Modal
3839
3940
$: if (needsToAcceptLatestPrivacyPolicy() || needsToAcceptLatestTermsOfService()) {
4041
openPopup({
@@ -150,6 +151,12 @@
150151
<enter-pin-view class="block w-full h-full bg-white dark:bg-gray-900">
151152
<div class="flex w-full h-full justify-center items-center">
152153
<div class="w-96 flex flex-col flex-wrap items-center mb-20">
154+
<div class="flex justify-end w-full">
155+
<div class="max-h-7 max-w-9 overflow-visible relative">
156+
<MeatballMenuButton onClick={modal?.toggle} />
157+
<InitProfileActionsModal bind:modal />
158+
</div>
159+
</div>
153160
<div class="flex flex-col gap-8 w-full items-center">
154161
<Profile profile={$activeProfile} {updateRequired} />
155162
{#if updateRequired}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<script lang="ts">
2+
import { localize } from '@core/i18n'
3+
import { Icon } from '@lib/auxiliary/icon'
4+
import { MenuItem, Modal } from 'shared/components'
5+
import { showAppNotification } from '@lib/auxiliary/notification'
6+
import { setClipboard } from '@lib/core/utils'
7+
import { activeProfile, getStorageDirectoryOfProfile } from '@lib/core/profile'
8+
9+
export let modal: Modal | undefined
10+
11+
async function handleCopyProfileSystemLocation(): Promise<void> {
12+
const profileDirectory = await getStorageDirectoryOfProfile($activeProfile?.id)
13+
setClipboard(profileDirectory, false)
14+
showAppNotification({
15+
type: 'info',
16+
message: localize('general.copiedToClipboard'),
17+
})
18+
modal?.close()
19+
}
20+
</script>
21+
22+
<Modal bind:this={modal} {...$$restProps}>
23+
<div class="flex flex-col">
24+
<MenuItem
25+
icon={Icon.Copy}
26+
title={localize('actions.copyProfileSystemLocation')}
27+
onClick={handleCopyProfileSystemLocation}
28+
/>
29+
</div>
30+
</Modal>

packages/shared/components/modals/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ export { default as AssetActionsModal } from './AssetActionsModal.svelte'
22
export { default as CollectibleActionsModal } from './CollectibleActionsModal.svelte'
33
export { default as Modal } from './Modal.svelte'
44
export { default as ProfileActionsModal } from './ProfileActionsModal.svelte'
5+
export { default as InitProfileActionsModal } from './InitProfileActionsModal.svelte'

packages/shared/lib/core/app/interfaces/platform.interface.ts

-7
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,13 @@ import { AppTheme } from '../enums'
88

99
export interface IPlatform {
1010
getStrongholdBackupDestination(defaultPath: string): Promise<string | null>
11-
saveStrongholdBackup({ allowAccess }: { allowAccess: boolean }): Promise<void>
12-
exportTransactionHistory(defaultPath: string, contents: string): Promise<string | null>
1311
getUserDataPath(): Promise<string>
1412
getDiagnostics(): Promise<{ label: string; value: string }[]>
1513
getOS(): Promise<string>
1614
getMachineId(): Promise<string>
1715
updateAppSettings(settings: Partial<IAppSettings>): Promise<void>
18-
getActiveProfile(): string
1916
updateActiveProfile(id: string): void
2017
removeProfileFolder(profilePath: string): Promise<void>
21-
renameProfileFolder(oldPath: string, newPath: string): Promise<void>
2218
listProfileFolders(profileStoragePath: string): Promise<string[]>
2319
updateMenu(attribute: string, value: unknown): void
2420
popupMenu(): void
@@ -55,7 +51,4 @@ export interface IPlatform {
5551

5652
getLanguageCode(): Promise<string>
5753
updateTheme(theme: AppTheme): void
58-
59-
startLedgerProcess(): Promise<void>
60-
killLedgerProcess(): Promise<void>
6154
}
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { localize } from '../../i18n'
12
import { INft } from '../interfaces'
23

34
/**
@@ -10,10 +11,13 @@ export function isFlaggedNft(nft: INft): string | undefined {
1011
const parsedMetadata = nft.parsedMetadata
1112
const parsedName = parsedMetadata?.name ?? ''
1213
const parsedDescription = parsedMetadata?.description ?? ''
13-
const urlRegex = /((https?|ftp|file):\/\/)?([\da-z-]+\.)+([a-z]{2,6})([/\w .-]*)*\/?$/gi
14+
const urlRegex = new RegExp(
15+
'\\b(?:https?:\\/\\/)?[a-zA-Z0-9-]+(?:[\\.\\u2024\\uFE52\\uFF0E\\uFF61][a-zA-Z0-9-]+)+\\b(?:[\\/\\?#][^\\s()<>]*)?',
16+
'i'
17+
)
1418
const containsUrl = urlRegex.test(name) || urlRegex.test(parsedName) || urlRegex.test(parsedDescription)
15-
// Note: in order to avoid issues with the translations, we are using a hardcoded string here
16-
const WARNING_MESSAGE =
17-
'Be careful when following unknown links. Never share your private keys, nor enter them into any websites or services. '
18-
return containsUrl ? WARNING_MESSAGE : undefined
19+
20+
if (containsUrl) {
21+
return localize('warning.nft.flagged')
22+
}
1923
}

packages/shared/lib/core/profile/actions/active-profile/login.ts

-1
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,6 @@ export async function login(loginOptions?: ILoginOptions): Promise<void> {
141141
setTimeStrongholdLastUnlocked()
142142
}
143143
} else {
144-
Platform.startLedgerProcess()
145144
incrementLoginProgress(2)
146145
}
147146

packages/shared/lib/core/profile/actions/active-profile/logout.ts

-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import { IProfileManager } from '@core/profile-manager/interfaces'
1919
import { profileManager } from '@core/profile-manager/stores'
2020
import { routerManager } from '@core/router/stores'
2121
import { clearFilters } from '@core/utils/clearFilters'
22-
import { Platform } from '@core/app'
2322

2423
/**
2524
* Logout from active profile
@@ -28,7 +27,6 @@ export async function logout(clearActiveProfile = true, _lockStronghold = true):
2827
if (get(isSoftwareProfile)) {
2928
_lockStronghold && lockStronghold()
3029
} else if (isLedgerProfile(get(activeProfile).type)) {
31-
Platform.killLedgerProcess()
3230
get(isPollingLedgerDeviceStatus) && stopPollingLedgerNanoStatus()
3331
}
3432

Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
import { activeProfile, activeProfileId, INITIAL_ACTIVE_PROFILE, IProfile } from '@core/profile'
2-
import { Platform } from '@core/app'
32
import { get } from 'svelte/store'
43

54
export function resetActiveProfile(): void {
65
const { lastUsedAccountIndex } = get(activeProfile)
76
activeProfile.set(<IProfile>{ ...INITIAL_ACTIVE_PROFILE, lastUsedAccountIndex })
87
activeProfileId.set(null)
9-
Platform.updateActiveProfile(null)
108
}
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
import { activeProfile, INITIAL_ACTIVE_PROFILE, IPersistedProfile, IProfile } from '@core/profile'
22
import { activeProfileId } from '@core/profile/stores'
3-
import { Platform } from '@core/app'
43

54
export function setActiveProfile(persistedProfile: IPersistedProfile): void {
65
activeProfile?.set(<IProfile>{ ...INITIAL_ACTIVE_PROFILE, ...persistedProfile })
76
activeProfileId?.set(persistedProfile.id)
8-
Platform.updateActiveProfile(persistedProfile.id)
97
}

packages/shared/lib/tests/__mocks__/platform.mock.ts

-11
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,6 @@ const Platform: IPlatform = {
66
NotificationManager: undefined,
77
PincodeManager: undefined,
88
close(): void {},
9-
exportTransactionHistory(defaultPath: string, contents: string): Promise<string | null> {
10-
return Promise.resolve(null)
11-
},
12-
getActiveProfile(): string {
13-
return ''
14-
},
159
getDiagnostics(): Promise<{ label: string; value: string }[]> {
1610
return Promise.resolve([])
1711
},
@@ -47,16 +41,12 @@ const Platform: IPlatform = {
4741
removeProfileFolder(profilePath: string): Promise<void> {
4842
return Promise.resolve(undefined)
4943
},
50-
renameProfileFolder(oldPath: string, newPath: string): Promise<void> {
51-
return Promise.resolve(undefined)
52-
},
5344
saveRecoveryKit(kitData: ArrayBuffer): Promise<void> {
5445
return Promise.resolve(undefined)
5546
},
5647
unhandledException(title: string, err: IError | unknown): Promise<void> {
5748
return Promise.resolve(undefined)
5849
},
59-
updateActiveProfile(id: string): void {},
6050
updateAppSettings(settings: Partial<IAppSettings>): Promise<void> {
6151
return Promise.resolve(undefined)
6252
},
@@ -97,5 +87,4 @@ const Platform: IPlatform = {
9787
updateTheme(): void {},
9888
}
9989

100-
window['__CAPACITOR__'] = Platform
10190
window['__ELECTRON__'] = Platform

packages/shared/locales/af.json

+14-1
Original file line numberDiff line numberDiff line change
@@ -1190,6 +1190,12 @@
11901190
"errorNoChronicle": "Chronicle not configured",
11911191
"errorFailedFetch": "Couldn't fetch address history",
11921192
"errorFailedGenerate": "Couldn't generate a new address"
1193+
},
1194+
"withdrawFromL2": {
1195+
"title": "Withdraw from L2",
1196+
"body": "List of addresses with withdrawable funds",
1197+
"withdraw": "Withdraw",
1198+
"withdrawing": "Withdrawing..."
11931199
}
11941200
},
11951201
"charts": {
@@ -1257,6 +1263,8 @@
12571263
"createWalletDescription": "Create a fresh profile running on {network, select, iota {Chrysalis} shimmer {Shimmer} testnet {Testnet} custom {Custom Network} other {Unknown}}",
12581264
"claimShimmer": "Claim Shimmer staking rewards",
12591265
"claimShimmerDescription": "Import IOTA profile and claim staking rewards",
1266+
"migrateFromLegacy": "Migrate from Legacy",
1267+
"migrateFromLegacyDescription": "Migrate to Stardust",
12601268
"createAlias": "Create alias",
12611269
"createAliasDescription": "Create alias output",
12621270
"savePassword": "Stoor wagwoord",
@@ -1342,6 +1350,7 @@
13421350
"viewStatus": "Sien status",
13431351
"viewAddressHistory": "Bekyk adresgeskiedenis",
13441352
"viewBalanceBreakdown": "View balance breakdown",
1353+
"withdrawFromL2": "Withdraw from L2",
13451354
"verifyDepositAddress": "Verify deposit address",
13461355
"showHiddenAccounts": "Wys versteekte beursie",
13471356
"confirm": "Bevestig",
@@ -1399,7 +1408,8 @@
13991408
"revote": "Revote",
14001409
"skipAndKeep": "Skip and keep old password",
14011410
"addChain": "Add chain",
1402-
"viewVestingRewardsFinder": "Find vesting rewards"
1411+
"viewVestingRewardsFinder": "Find vesting rewards",
1412+
"copyProfileSystemLocation": "Copy profile system location"
14031413
},
14041414
"general": {
14051415
"recipient": "Recipient",
@@ -2117,6 +2127,9 @@
21172127
},
21182128
"participation": {
21192129
"noFunds": "You do not have any IOTA."
2130+
},
2131+
"nft": {
2132+
"flagged": "Be careful when following unknown links. Never share your private keys, nor enter them into any websites or services."
21202133
}
21212134
},
21222135
"tooltips": {

0 commit comments

Comments
 (0)