Skip to content

Commit f1bfc61

Browse files
committed
Theme: removed direct access to theme from Utils singleton
1 parent c66a944 commit f1bfc61

File tree

82 files changed

+227
-195
lines changed

Some content is hidden

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

82 files changed

+227
-195
lines changed

storybook/pages/AccountViewPage.qml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ SplitView {
2929
property var dummyOverview: updateDummyView(StatusColors.colors['black'])
3030

3131
function updateDummyView(color) {
32-
const clr = Utils.getIdForColor(color)
32+
const clr = Utils.getIdForColor(root.Theme.palette, color)
3333
dummyOverview = ({
3434
name: "helloworld",
3535
address: "0xcdc2ea3b6ba8fed3a3402f8db8b2fab53e7b7421",

storybook/pages/SavedAddressActivityPopupPage.qml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ SplitView {
3333
name: "Noelia Santos",
3434
address: "0xe5bd6c877cd566af2a58990ad0ed4b73fb0c6752",
3535
ens: "",
36-
colorId: Utils.getIdForColor(Theme.palette.customisationColors.blue),
36+
colorId: Utils.getIdForColor(Theme.palette, Theme.palette.customisationColors.blue),
3737
mixedcaseAddress: "0xe5bD6C877cd566Af2a58990Ad0eD4B73fb0c6752",
3838
})
3939
}

storybook/pages/SendSignModalPage.qml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,13 +137,13 @@ SplitView {
137137
accountName: priv.selectedAccount.name
138138
accountAddress: priv.selectedAccount.address
139139
accountEmoji: priv.selectedAccount.emoji
140-
accountColor: Utils.getColorForId(priv.selectedAccount.colorId)
140+
accountColor: Utils.getColorForId(Theme.palette, priv.selectedAccount.colorId)
141141

142142
recipientAddress: priv.selectedRecipient.address
143143
recipientName: priv.selectedRecipient.name
144144
recipientEns: priv.selectedRecipient.ens
145145
recipientEmoji: priv.selectedRecipient.emoji
146-
recipientWalletColor: Utils.getColorForId(priv.selectedRecipient.colorId)
146+
recipientWalletColor: Utils.getColorForId(Theme.palette, priv.selectedRecipient.colorId)
147147

148148
networkShortName: priv.selectedNetwork.shortName
149149
networkName: priv.selectedNetwork.chainName

storybook/pages/StatusMessagePage.qml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,8 @@ SplitView {
265265
sender.isEnsVerified: isEnsVerified
266266
sender.profileImage {
267267
name: model.profileImage || ""
268-
colorId: index % Theme.palette.userCustomizationColors.length
268+
color: Theme.palette.userCustomizationColors[
269+
index % Theme.palette.userCustomizationColors.length]
269270
}
270271
album: model.contentType === StatusMessage.ContentType.Image ? d.exampleAlbum : []
271272
albumCount: model.contentType === StatusMessage.ContentType.Image ? d.exampleAlbum.length : 0

storybook/pages/SwapApproveCapModalPage.qml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ SplitView {
8787
accountName: priv.selectedAccount.name
8888
accountAddress: priv.selectedAccount.address
8989
accountEmoji: priv.selectedAccount.emoji
90-
accountColor: Utils.getColorForId(priv.selectedAccount.colorId)
90+
accountColor: Utils.getColorForId(Theme.palette, priv.selectedAccount.colorId)
9191
accountBalanceFormatted: formatBigNumber(120.55489)
9292

9393
networkShortName: priv.selectedNetwork.shortName

storybook/pages/SwapSignModalPage.qml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ SplitView {
9191
accountName: priv.selectedAccount.name
9292
accountAddress: priv.selectedAccount.address
9393
accountEmoji: priv.selectedAccount.emoji
94-
accountColor: Utils.getColorForId(priv.selectedAccount.colorId)
94+
accountColor: Utils.getColorForId(Theme.palette, priv.selectedAccount.colorId)
9595

9696
networkShortName: priv.selectedNetwork.shortName
9797
networkName: priv.selectedNetwork.chainName

storybook/qmlTests/tests/tst_SendSignModal.qml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@ Item {
3333
accountName: "Hot wallet (generated)"
3434
accountAddress: "0x7F47C2e98a4BBf5487E6fb082eC2D9Ab0E6d8881"
3535
accountEmoji: "🚗"
36-
accountColor: Utils.getColorForId(Constants.walletAccountColors.primary)
36+
accountColor: Utils.getColorForId(Theme.palette, Constants.walletAccountColors.primary)
3737

3838
recipientAddress: "0xA858DDc0445d8131daC4d1DE01f834ffcbA52Ef1"
3939
recipientName: "0x7F47C2e98a4BBf5487E6fb082eC2D9Ab0E6d8882"
4040
recipientEmoji: "😋"
4141
recipientEns: ""
42-
recipientWalletColor: Utils.getColorForId(Constants.walletAccountColors.secondary)
42+
recipientWalletColor: Utils.getColorForId(Theme.palette, Constants.walletAccountColors.secondary)
4343

4444
networkShortName: Constants.networkShortChainNames.mainnet
4545
networkName: "Mainnet"

storybook/qmlTests/tests/tst_SimpleSendModal.qml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -496,9 +496,10 @@ Item {
496496
const accountSelectorTextContent = findChild(accountSelector, "textContent")
497497
verify(!!accountSelectorTextContent)
498498

499-
compare(accountSelectorHeaderBackground.color, Utils.getColorForId(defaultAccountItem.colorId))
499+
const palette = controlUnderTest.Theme.palette
500+
compare(accountSelectorHeaderBackground.color, Utils.getColorForId(palette, defaultAccountItem.colorId))
500501
compare(accountSelectorAssetContent.asset.emoji, defaultAccountItem.emoji)
501-
compare(accountSelectorAssetContent.asset.color, Utils.getColorForId(defaultAccountItem.colorId))
502+
compare(accountSelectorAssetContent.asset.color, Utils.getColorForId(palette, defaultAccountItem.colorId))
502503
compare(accountSelectorTextContent.text, defaultAccountItem.name)
503504

504505
// Sticky Header should not be visible when not scrolling
@@ -587,9 +588,10 @@ Item {
587588
const accountSelectorTextContent = findChild(accountSelector, "textContent")
588589
verify(!!accountSelectorTextContent)
589590

590-
compare(accountSelectorHeaderBackground.color, Utils.getColorForId(selectedAccount.colorId))
591+
const palette = controlUnderTest.Theme.palette
592+
compare(accountSelectorHeaderBackground.color, Utils.getColorForId(palette, selectedAccount.colorId))
591593
compare(accountSelectorAssetContent.asset.emoji, selectedAccount.emoji)
592-
compare(accountSelectorAssetContent.asset.color, Utils.getColorForId(selectedAccount.colorId))
594+
compare(accountSelectorAssetContent.asset.color, Utils.getColorForId(palette, selectedAccount.colorId))
593595
compare(accountSelectorTextContent.text, selectedAccount.name)
594596

595597
// Sticky Header should not be visible when not scrolling

storybook/qmlTests/tests/tst_StatusMessage.qml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Item {
2323
sender.isEnsVerified: false
2424
sender.profileImage {
2525
name: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAiElEQVR4nOzXUQpAQBRGYWQvLNAyLJDV8C5qpiGnv/M9al5Ot27X0IUwhMYQGkNoDKGJCRlLH67bftx9X+ap/+P9VcxEDKExhKZ4a9Uq3TZviZmIITSG0DRvlqcbqVbrlouZiCE0htD4h0hjCI0hNN5aNIbQGKKPxEzEEBpDaAyhMYTmDAAA//+gYCErzmCpCQAAAABJRU5ErkJggg="
26-
colorId: 1
26+
color: "red"
2727
}
2828
}
2929
linkAddressAndEnsName: true

storybook/qmlTests/tests/tst_SwapApproveCapModal.qml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Item {
3131
accountName: "Hot wallet (generated)"
3232
accountAddress: "0x7F47C2e98a4BBf5487E6fb082eC2D9Ab0E6d8881"
3333
accountEmoji: "🚗"
34-
accountColor: Utils.getColorForId(Constants.walletAccountColors.primary)
34+
accountColor: Utils.getColorForId(Theme.palette, Constants.walletAccountColors.primary)
3535
accountBalanceFormatted: "120.55489 DAI"
3636

3737
networkShortName: Constants.networkShortChainNames.mainnet

0 commit comments

Comments
 (0)