-
Notifications
You must be signed in to change notification settings - Fork 349
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
Refactor buttons to use UIButton.Configuration #6928
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 8 of 8 files at r1, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @mojganii)
ios/MullvadVPN/View controllers/Login/AccountInputGroupView.swift
line 111 at r1 (raw file):
config.contentInsets = UIMetrics.textFieldMargins.toDirectionalInsets config.baseForegroundColor = .AccountTextField.NormalState.textColor button.configuration = config
Nit: I think we should either add all available configurations (including eg.title
) or just the one that is deprecated. Title color isn't deprecated and can be left out if we want to.
ios/MullvadVPN/Views/CustomButton.swift
line 43 at r1 (raw file):
return UIColor.AppButton.normalTitleColor case .disabled: return UIColor.AppButton.disabledTitleColor.withAlphaComponent(0.5)
Is this ok to remove? This color has a value of 1.0 alpha and without the 0.5 it is the same color as .highlightedTitleColor
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @rablador)
ios/MullvadVPN/View controllers/Login/AccountInputGroupView.swift
line 111 at r1 (raw file):
Previously, rablador (Jon Petersson) wrote…
Nit: I think we should either add all available configurations (including eg.
title
) or just the one that is deprecated. Title color isn't deprecated and can be left out if we want to.
Good catch!
we have to put all together in configuration.
ios/MullvadVPN/Views/CustomButton.swift
line 43 at r1 (raw file):
Previously, rablador (Jon Petersson) wrote…
Is this ok to remove? This color has a value of 1.0 alpha and without the 0.5 it is the same color as
.highlightedTitleColor
.
it's correct both have the same value but we are using them separately in the code. so I suggest to not let them mix up when it's supposed to have different style for different states.
973ed38
to
06d2f5b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 1 files at r2, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like the reconnect button is gone
Reviewed 6 of 8 files at r1, 1 of 1 files at r2, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @mojganii)
ios/MullvadVPN/Views/InAppPurchaseButton.swift
line 78 at r2 (raw file):
} private func getActivityIndicatorRect(forContentRect contentRect: CGRect) -> CGRect {
nit
There's no need to add a get
prefix here, the name of the function follows convention and Apple's guidelines
06d2f5b
to
47c0fcf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed all commit messages.
Reviewable status: 5 of 8 files reviewed, 1 unresolved discussion (waiting on @buggmagnet and @mojganii)
47c0fcf
to
9fa4ad7
Compare
9fa4ad7
to
3674be3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 8 of 8 files at r4, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @mojganii)
ios/MullvadVPN/Views/AppButton.swift
line 109 at r4 (raw file):
imageAlignment = .trailing titleAlignment = .leading isHighlighted = false
This attribute is false
by default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 6 of 8 files at r4.
Reviewable status: all files reviewed, 5 unresolved discussions (waiting on @mojganii)
ios/MullvadVPN/Extensions/CGSize+Helpers.swift
line 13 at r4 (raw file):
extension CGSize { // Function to deduct insets from CGSize func deducting(insets: NSDirectionalEdgeInsets) -> CGSize {
nit
It's deducting offsets from a NSDirectionalEdgeInsets
ios/MullvadVPN/Extensions/CGSize+Helpers.swift
line 14 at r4 (raw file):
// Function to deduct insets from CGSize func deducting(insets: NSDirectionalEdgeInsets) -> CGSize { let newWidth = self.width - (insets.leading + insets.trailing)
not need for self here and below
ios/MullvadVPN/Extensions/UIImage+Helpers.swift
line 14 at r4 (raw file):
// Function to resize image while keeping aspect ratio func resizeImage(targetSize: CGSize) -> UIImage { let widthRatio = targetSize.width / self.size.width
no need for self here and below
3674be3
to
0fbaa5a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 5 of 10 files reviewed, 5 unresolved discussions (waiting on @buggmagnet and @rablador)
ios/MullvadVPN/Extensions/CGSize+Helpers.swift
line 14 at r4 (raw file):
Previously, buggmagnet wrote…
not need for self here and below
Done.
ios/MullvadVPN/Extensions/UIImage+Helpers.swift
line 14 at r4 (raw file):
Previously, buggmagnet wrote…
no need for self here and below
Done.
ios/MullvadVPN/Views/AppButton.swift
line 109 at r4 (raw file):
Previously, rablador (Jon Petersson) wrote…
This attribute is
false
by default.
true. I've forgotten to remove that.
ios/MullvadVPN/Views/InAppPurchaseButton.swift
line 78 at r2 (raw file):
Previously, buggmagnet wrote…
nit
There's no need to add aget
prefix here, the name of the function follows convention and Apple's guidelines
Fair enough!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 5 of 5 files at r5, all commit messages.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @buggmagnet and @mojganii)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 8 files at r4, 5 of 5 files at r5, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @mojganii)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @mojganii)
0fbaa5a
to
0339b0b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 1 files at r6, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @mojganii)
🚨 End to end tests failed. Please check the failed workflow run. |
This PR refactors the buttons to use UIButton.Configuration for their configuration.
This change is