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

dcr: Reimplemint privacy screens. #248

Merged
merged 2 commits into from
Dec 12, 2023

Conversation

JoeGruffins
Copy link
Collaborator

dcr: Reimplemint privacy screens.

dcr: Use default account on creation.

In order to make mixing opt in, start with it off and do not create the
accounts. Allow sending from the default account on creation.

closes #171

ui/page/privacy/manual_mixer_setup_page.go Outdated Show resolved Hide resolved
ui/page/privacy/manual_mixer_setup_page.go Outdated Show resolved Hide resolved
ui/page/privacy/manual_mixer_setup_page.go Outdated Show resolved Hide resolved
}),
layout.Rigid(func(gtx C) D {
txt := `<span style="text-color: grayText2">
<b>Make sure to select the same accounts from the previous privacy setup. </b><br>Failing to do so could compromise wallet privacy.<br> You may not select the same account for mixed and unmixed.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While this would allow to bold text in the middle of a sentence, the font ends up being different from the rest of the page so not using. Could also make everything html...

ui/page/privacy/setup_mixer_accounts_page.go Show resolved Hide resolved
ui/values/localizable/en.go Show resolved Hide resolved
Comment on lines -470 to -478
dcrUniqueImpl := wal.(*dcr.Asset)
err = dcrUniqueImpl.CreateMixerAccounts(values.String(values.StrMixed), values.String(values.StrUnmixed), pg.passwordEditor.Editor.Text())
if err != nil {
errModal := modal.NewErrorModal(pg.Load, err.Error(), modal.DefaultClickFunc())
pg.ParentWindow().ShowModal(errModal)
return
}
wal.SetBoolConfigValueForKey(sharedW.AccountMixerConfigSet, true)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So not creating the accounts until the user turns mixing on.

ui/page/privacy/manual_mixer_setup_page.go Outdated Show resolved Hide resolved
@JoeGruffins
Copy link
Collaborator Author

Current screenshots on desktop, yet to try mobile:
image
image
image

Copy link
Collaborator Author

@JoeGruffins JoeGruffins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh its broken on mobile, should this pr worry with that?
image

@JoeGruffins
Copy link
Collaborator Author

@JoeGruffins JoeGruffins marked this pull request as ready for review November 14, 2023 07:12
@JoeGruffins
Copy link
Collaborator Author

@dreacot
Copy link
Member

dreacot commented Nov 14, 2023

Oh its broken on mobile, should this pr worry with that? image

usually mobile work should be focused for a different PR

but feel free to include it here if you want, i see the figma screens are ready

@JoeGruffins
Copy link
Collaborator Author

JoeGruffins commented Nov 15, 2023

but feel free to include it here if you want, i see the figma screens are ready

Another pr would be good if that's alright, this one focuses on desktop. This solves the main intent of the issue I was trying to make, that privacy should be opt in.

Actually I forgot about the default receive account after you turn on can't send from default. Let me check that out will probably add more to this pr.

@JoeGruffins
Copy link
Collaborator Author

The default sending account is already ok. Made it impossible to toggle off the spend unmixed funds if mixing is not set up. https://github.com/crypto-power/cryptopower/compare/befab2bf2ef08de596310212857243a6b593b33c..28be9d560bcf5ab875620b4aa37524419980e297

Copy link
Collaborator

@Sirmorrison Sirmorrison left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First pass. Please add screenshots of the UI developed to the PR desc.

Comment on lines +125 to +119
return layout.Flex{Axis: layout.Vertical, Alignment: layout.Start}.Layout(gtx,
layout.Rigid(func(gtx C) D {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This lines are not needed and seem repeated. I would recommend using the linear Layout widget for this though.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yeah, was able to remove the Flex layout here and it looks the same.

Linear in place of the Center below or the Card above?

ui/page/privacy/manual_mixer_setup_page.go Outdated Show resolved Hide resolved
ui/page/privacy/manual_mixer_setup_page.go Outdated Show resolved Hide resolved
ui/page/privacy/manual_mixer_setup_page.go Outdated Show resolved Hide resolved
Comment on lines 183 to 175
layout.Flexed(1, func(gtx C) D {
return layout.Flex{Axis: layout.Vertical, Alignment: layout.Middle, Spacing: layout.SpaceAround}.Layout(gtx,
layout.Rigid(func(gtx C) D {
gtx.Constraints.Max.X = int(values.MarginPadding40)
return pg.Theme.Icons.ActionInfo.Layout(gtx, pg.Theme.Color.Gray1)
}),
)
}),
layout.Flexed(7, func(gtx C) D {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flexed(1) and Flexed(7) seems off.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What would be good values here.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JoeGruffins I think it just:

return layout.Flex{Alignment: layout.Start}.Layout(gtx,
					layout.Rigid(func(gtx C) D {
						gtx.Constraints.Max.X = int(values.MarginPadding40)
						return layout.Center.Layout(gtx, func(gtx layout.Context) layout.Dimensions {
							return pg.Theme.Icons.ActionInfo.Layout(gtx, pg.Theme.Color.Gray1)
						})
					}),
					layout.Rigid(func(gtx C) D {
						return layout.Inset{
							Left: values.MarginPadding10,
						}.Layout(gtx, func(gtx C) D {
							return layout.Flex{Axis: layout.Vertical}.Layout(gtx,
								layout.Rigid(func(gtx C) D {
									label := pg.Theme.H6(values.String(values.StrSetUpStakeShuffleWarningTitle))
									return label.Layout(gtx)
								}),
								layout.Rigid(func(gtx C) D {
									label := pg.Theme.Body1(values.String(values.StrSetUpStakeShuffleWarningDesc))
									return label.Layout(gtx)
								}),
							)
						})
					}),
				)

this is my suggestion code.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok.

Comment on lines 68 to 72
return layout.Flex{Axis: layout.Vertical, Alignment: layout.Middle}.Layout(gtx,
layout.Rigid(func(gtx C) D {
return layout.Center.Layout(gtx, func(gtx C) D {
return layout.Inset{Top: values.MarginPadding25}.Layout(gtx, func(gtx C) D {
return layout.Flex{Axis: layout.Vertical, Alignment: layout.Start}.Layout(gtx,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using the linear layout widget will technically remove these lines of code as you can align the layout by passing the necessary params.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was able to remove the Flex further above like you suggested in another place.

Linear in place of Center?

ui/values/localizable/en.go Outdated Show resolved Hide resolved
ui/values/localizable/en.go Outdated Show resolved Hide resolved
ui/values/strings.go Outdated Show resolved Hide resolved
ui/page/privacy/manual_mixer_setup_page.go Outdated Show resolved Hide resolved
ui/page/privacy/manual_mixer_setup_page.go Outdated Show resolved Hide resolved
ui/page/privacy/manual_mixer_setup_page.go Outdated Show resolved Hide resolved
ui/page/privacy/manual_mixer_setup_page.go Outdated Show resolved Hide resolved
ui/page/privacy/manual_mixer_setup_page.go Outdated Show resolved Hide resolved
ui/page/privacy/manual_mixer_setup_page.go Outdated Show resolved Hide resolved
ui/page/privacy/manual_mixer_setup_page.go Outdated Show resolved Hide resolved
ui/page/privacy/manual_mixer_setup_page.go Outdated Show resolved Hide resolved
@dreacot
Copy link
Member

dreacot commented Nov 22, 2023

the top margin is too much, i can't also see the button

Screenshot from 2023-11-22 15-51-14

Uploading Screenshot from 2023-11-22 15-53-21.png…

@dreacot
Copy link
Member

dreacot commented Nov 22, 2023

i get this while trying to setup manual mixer, i don't think the user should have funds in order to create a mixer

Screenshot from 2023-11-22 15-53-34

@dreacot
Copy link
Member

dreacot commented Nov 22, 2023

trying auto setup, i selected auto move funds (i don't have any funds to move, so i assume that should be skipped)

Screenshot from 2023-11-22 15-54-37

clicking ok, i get stuck on this screen
Screenshot from 2023-11-22 15-56-43

@JoeGruffins JoeGruffins force-pushed the addmixerscreens branch 2 times, most recently from b2dd44e to 4b6cb72 Compare November 24, 2023 07:31
@JoeGruffins
Copy link
Collaborator Author

@JoeGruffins
Copy link
Collaborator Author

JoeGruffins commented Nov 24, 2023

i get this while trying to setup manual mixer, i don't think the user should have funds in order to create a mixer

@dreacot Not funds, accounts. You need three accounts to set up mixing. Automatic will create them but if manual you already need them. I will look into the other error now.

@JoeGruffins
Copy link
Collaborator Author

@dreacot
Copy link
Member

dreacot commented Nov 29, 2023

i'm still having the issue where i can't see the button

@dreacot
Copy link
Member

dreacot commented Nov 29, 2023

@JoeGruffins
Copy link
Collaborator Author

i'm still having the issue where i can't see the button

What button.

@dreacot
Copy link
Member

dreacot commented Nov 30, 2023

the top margin is too much, i can't also see the button

Screenshot from 2023-11-22 15-51-14

Uploading Screenshot from 2023-11-22 15-53-21.png…

This the button to start mixer setup

@JoeGruffins
Copy link
Collaborator Author

This the button to start mixer setup

Ohh. On desktop? I guess the card needs a set minimum thats higher than it is currently

@dreacot
Copy link
Member

dreacot commented Nov 30, 2023

This the button to start mixer setup

Ohh. On desktop? I guess the card needs a set minimum thats higher than it is currently

I think the top padding is too much as well

@JoeGruffins JoeGruffins force-pushed the addmixerscreens branch 2 times, most recently from 379d9f3 to c63e287 Compare November 30, 2023 06:05
@JoeGruffins
Copy link
Collaborator Author

@dreacot reduced a lot of the space https://github.com/crypto-power/cryptopower/compare/379d9f3c1fcfbe9ea63e7f49ebd9160689332b31..c63e28790fbd65d581fd10524348bc1fd62c80a5

Setting a max Y in the layout doesn't seem to be respected. These changes make the buttons viewable with as small a screen as I can make. I guess there is a minimum size I cannot makes the window smaller than?

@dreacot
Copy link
Member

dreacot commented Dec 5, 2023

@dreacot reduced a lot of the space https://github.com/crypto-power/cryptopower/compare/379d9f3c1fcfbe9ea63e7f49ebd9160689332b31..c63e28790fbd65d581fd10524348bc1fd62c80a5

Setting a max Y in the layout doesn't seem to be respected. These changes make the buttons viewable with as small a screen as I can make. I guess there is a minimum size I cannot makes the window smaller than?

the app window? yeah its 650px minimum

@JoeGruffins
Copy link
Collaborator Author

I just rebased and there's still conflicts lol

Copy link
Collaborator

@JustinBeBoy JustinBeBoy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think click title row is back button is good idea

m1

@@ -77,6 +77,7 @@ func (asset *Asset) CreateMixerAccounts(mixedAccount, unmixedAccount, privPass s
asset.SetInt32ConfigValueForKey(sharedW.AccountMixerMixedAccount, mixedAccountNumber)
asset.SetInt32ConfigValueForKey(sharedW.AccountMixerUnmixedAccount, unmixedAccountNumber)
asset.SetBoolConfigValueForKey(sharedW.AccountMixerConfigSet, true)
asset.SetBoolConfigValueForKey(sharedW.SpendUnmixedFundsKey, false)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

set false for sharedW.SpendUnmixedFundsKey not need because when read it, default value return is false

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I set the default to true in this commit I believe. Please see the CreateNewDCRWallet variants in libwallet/dcr.go.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it fine

@@ -108,6 +109,7 @@ func (asset *Asset) SetAccountMixerConfig(mixedAccount, unmixedAccount int32, pr
asset.SetInt32ConfigValueForKey(sharedW.AccountMixerMixedAccount, mixedAccount)
asset.SetInt32ConfigValueForKey(sharedW.AccountMixerUnmixedAccount, unmixedAccount)
asset.SetBoolConfigValueForKey(sharedW.AccountMixerConfigSet, true)
asset.SetBoolConfigValueForKey(sharedW.SpendUnmixedFundsKey, false)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same above

@JoeGruffins
Copy link
Collaborator Author

I don't think click title row is back button is good idea

Do you suggest just the arrow or arrow and "Manual Setup" label

I did the entire row because it's easier to click on mobile, if these screens can be reused.

@dreacot
Copy link
Member

dreacot commented Dec 7, 2023

I don't think click title row is back button is good idea

Do you suggest just the arrow or arrow and "Manual Setup" label

I did the entire row because it's easier to click on mobile, if these screens can be reused.

i think the arrow and manual setup label should be fine

@JoeGruffins JoeGruffins force-pushed the addmixerscreens branch 2 times, most recently from 5aa3fff to c8d5703 Compare December 8, 2023 04:16
@JoeGruffins
Copy link
Collaborator Author

Copy link
Collaborator

@JustinBeBoy JustinBeBoy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 arrow seem like distorted and blurred

b1

ui/page/privacy/manual_mixer_setup_page.go Outdated Show resolved Hide resolved
ui/page/privacy/manual_mixer_setup_page.go Outdated Show resolved Hide resolved
Comment on lines 69 to 113
return layout.Inset{Top: values.MarginPadding25}.Layout(gtx, func(gtx C) D {
return layout.Flex{Axis: layout.Vertical, Alignment: layout.Start}.Layout(gtx,
layout.Rigid(func(gtx C) D {
label := pg.Theme.H6(values.String(values.StrSetUpStakeShuffleAutoOrManualA))
return layout.Inset{
Left: values.MarginPadding24,
}.Layout(gtx, label.Layout)
}),
layout.Rigid(func(gtx C) D {
label := pg.Theme.Body1(values.String(values.StrSetUpStakeShuffleAutoOrManualB))
return layout.Inset{
Left: values.MarginPadding24,
}.Layout(gtx, label.Layout)
}),
layout.Rigid(func(gtx C) D {
// TODO: Find a way to make Mixed and Unmixed bold while keeping to the theme.
label := pg.Theme.Body1(values.String(values.StrSetUpStakeShuffleAutoOrManualC))
return layout.Inset{
Top: values.MarginPadding10,
Left: values.MarginPadding24,
}.Layout(gtx, label.Layout)
}),
layout.Rigid(func(gtx C) D {
label := pg.Theme.Body1(values.String(values.StrSetUpStakeShuffleAutoOrManualD))
return layout.Inset{
Top: values.MarginPadding10,
Left: values.MarginPadding24,
}.Layout(gtx, label.Layout)
}),
layout.Rigid(func(gtx C) D {
return layout.Spacer{Height: values.MarginPadding80}.Layout(gtx)
}),
layout.Rigid(func(gtx C) D {
line := pg.Theme.Separator()
return layout.Inset{
Top: values.MarginPadding10,
Left: values.MarginPadding24,
Right: values.MarginPadding24,
}.Layout(gtx, line.Layout)
}),
layout.Rigid(func(gtx C) D {
return pg.autoSetupClickable.Layout(gtx, pg.autoSetupLayout)
}),
layout.Rigid(func(gtx C) D {
return pg.manualSetupClickable.Layout(gtx, pg.manualSetupLayout)
}),
layout.Rigid(func(gtx C) D {
return layout.Spacer{Height: values.MarginPadding10}.Layout(gtx)
}),
)
})
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

too many repeated Insets

you can try:

return layout.Inset{
			Top: values.MarginPadding25,
			Left: values.MarginPadding24,
			Right: values.MarginPadding24,
			}.Layout(gtx, func(gtx C) D {...

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. Prevents the buttons from covering the whole width of the screen but I guess thats fine.

ui/page/privacy/setup_mixer_accounts_page.go Outdated Show resolved Hide resolved
ui/page/privacy/setup_mixer_accounts_page.go Outdated Show resolved Hide resolved
ui/page/privacy/setup_privacy_page.go Outdated Show resolved Hide resolved
ui/page/privacy/setup_privacy_page.go Outdated Show resolved Hide resolved
In order to make mixing opt in, start with it off and do not create the
accounts. Allow sending from the default account on creation.
@JoeGruffins JoeGruffins force-pushed the addmixerscreens branch 2 times, most recently from 3822f66 to da8ba79 Compare December 11, 2023 08:38
@JoeGruffins
Copy link
Collaborator Author

using a lot of code from @JustinBeBoy https://github.com/crypto-power/cryptopower/compare/3822f667033d78e0b477b5197bfd898f0a687fc7..da8ba79152ffc3cb7759f6cfa576401fd5a5404f

Do these arrows look ok?
image

ui/page/privacy/manual_mixer_setup_page.go Outdated Show resolved Hide resolved
@JoeGruffins
Copy link
Collaborator Author

@dreacot dreacot merged commit 6c0785e into crypto-power:master Dec 12, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

update stakeshuffle layout and logic
5 participants