Merge pull request #38 from tootsuite/feature/highlighted
chore: set the photoButton highlight with some value alpha
This commit is contained in:
commit
d093d27127
|
@ -28,6 +28,9 @@ internal enum Asset {
|
|||
internal enum Asset {
|
||||
internal static let mastodonTextLogo = ImageAsset(name: "Asset/mastodon.text.logo")
|
||||
}
|
||||
internal enum Circles {
|
||||
internal static let plusCircleFill = ImageAsset(name: "Circles/plus.circle.fill")
|
||||
}
|
||||
internal enum Colors {
|
||||
internal enum Background {
|
||||
internal static let onboardingBackground = ColorAsset(name: "Colors/Background/onboarding.background")
|
||||
|
@ -66,6 +69,7 @@ internal enum Asset {
|
|||
internal static let lightSecondaryText = ColorAsset(name: "Colors/lightSecondaryText")
|
||||
internal static let lightSuccessGreen = ColorAsset(name: "Colors/lightSuccessGreen")
|
||||
internal static let lightWhite = ColorAsset(name: "Colors/lightWhite")
|
||||
internal static let plusCircleFill = ImageAsset(name: "Colors/plus.circle.fill")
|
||||
internal static let systemOrange = ColorAsset(name: "Colors/system.orange")
|
||||
}
|
||||
internal enum Welcome {
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
},
|
||||
"properties" : {
|
||||
"provides-namespace" : true
|
||||
}
|
||||
}
|
21
Mastodon/Resources/Assets.xcassets/Circles/plus.circle.fill.imageset/Contents.json
vendored
Normal file
21
Mastodon/Resources/Assets.xcassets/Circles/plus.circle.fill.imageset/Contents.json
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "plus.circle.fill.pdf",
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
89
Mastodon/Resources/Assets.xcassets/Circles/plus.circle.fill.imageset/plus.circle.fill.pdf
vendored
Normal file
89
Mastodon/Resources/Assets.xcassets/Circles/plus.circle.fill.imageset/plus.circle.fill.pdf
vendored
Normal file
|
@ -0,0 +1,89 @@
|
|||
%PDF-1.7
|
||||
|
||||
1 0 obj
|
||||
<< >>
|
||||
endobj
|
||||
|
||||
2 0 obj
|
||||
<< /Length 3 0 R >>
|
||||
stream
|
||||
/DeviceRGB CS
|
||||
/DeviceRGB cs
|
||||
q
|
||||
1.000000 0.000000 -0.000000 1.000000 0.000000 0.000000 cm
|
||||
0.000000 0.000000 0.000000 scn
|
||||
12.007203 -0.000002 m
|
||||
18.586674 -0.000002 24.000000 5.413311 24.000000 12.007201 c
|
||||
24.000000 18.586702 18.586674 24.000000 11.992814 24.000000 c
|
||||
5.413314 24.000000 0.000000 18.586702 0.000000 12.007201 c
|
||||
0.000000 5.413311 5.413314 -0.000002 12.007203 -0.000002 c
|
||||
h
|
||||
6.478707 12.007201 m
|
||||
6.478707 12.827837 7.068974 13.432522 7.875220 13.432522 c
|
||||
10.567494 13.432522 l
|
||||
10.567494 16.124798 l
|
||||
10.567494 16.931015 11.172179 17.535698 11.992814 17.535698 c
|
||||
12.813449 17.535698 13.418134 16.931015 13.418134 16.124798 c
|
||||
13.418134 13.432522 l
|
||||
16.110380 13.432522 l
|
||||
16.931015 13.432522 17.521311 12.827837 17.521311 12.007201 c
|
||||
17.521311 11.186566 16.931015 10.581882 16.110380 10.581882 c
|
||||
13.418134 10.581882 l
|
||||
13.418134 7.889637 l
|
||||
13.418134 7.083389 12.813449 6.478704 11.992814 6.478704 c
|
||||
11.172179 6.478704 10.567494 7.083389 10.567494 7.889637 c
|
||||
10.567494 10.581882 l
|
||||
7.875220 10.581882 l
|
||||
7.068974 10.581882 6.478707 11.186566 6.478707 12.007201 c
|
||||
h
|
||||
f
|
||||
n
|
||||
Q
|
||||
|
||||
endstream
|
||||
endobj
|
||||
|
||||
3 0 obj
|
||||
1071
|
||||
endobj
|
||||
|
||||
4 0 obj
|
||||
<< /Annots []
|
||||
/Type /Page
|
||||
/MediaBox [ 0.000000 0.000000 24.000000 24.000000 ]
|
||||
/Resources 1 0 R
|
||||
/Contents 2 0 R
|
||||
/Parent 5 0 R
|
||||
>>
|
||||
endobj
|
||||
|
||||
5 0 obj
|
||||
<< /Kids [ 4 0 R ]
|
||||
/Count 1
|
||||
/Type /Pages
|
||||
>>
|
||||
endobj
|
||||
|
||||
6 0 obj
|
||||
<< /Type /Catalog
|
||||
/Pages 5 0 R
|
||||
>>
|
||||
endobj
|
||||
|
||||
xref
|
||||
0 7
|
||||
0000000000 65535 f
|
||||
0000000010 00000 n
|
||||
0000000034 00000 n
|
||||
0000001161 00000 n
|
||||
0000001184 00000 n
|
||||
0000001357 00000 n
|
||||
0000001431 00000 n
|
||||
trailer
|
||||
<< /ID [ (some) (id) ]
|
||||
/Root 6 0 R
|
||||
/Size 7
|
||||
>>
|
||||
startxref
|
||||
1490
|
||||
%%EOF
|
21
Mastodon/Resources/Assets.xcassets/Colors/plus.circle.fill.imageset/Contents.json
vendored
Normal file
21
Mastodon/Resources/Assets.xcassets/Colors/plus.circle.fill.imageset/Contents.json
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "plus.circle.fill.pdf",
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
101
Mastodon/Resources/Assets.xcassets/Colors/plus.circle.fill.imageset/plus.circle.fill.pdf
vendored
Normal file
101
Mastodon/Resources/Assets.xcassets/Colors/plus.circle.fill.imageset/plus.circle.fill.pdf
vendored
Normal file
|
@ -0,0 +1,101 @@
|
|||
%PDF-1.7
|
||||
|
||||
1 0 obj
|
||||
<< >>
|
||||
endobj
|
||||
|
||||
2 0 obj
|
||||
<< /Length 3 0 R >>
|
||||
stream
|
||||
/DeviceRGB CS
|
||||
/DeviceRGB cs
|
||||
q
|
||||
1.000000 0.000000 -0.000000 1.000000 0.000000 0.000000 cm
|
||||
1.000000 1.000000 1.000000 scn
|
||||
30.000000 15.000000 m
|
||||
30.000000 6.715729 23.284271 0.000000 15.000000 0.000000 c
|
||||
6.715729 0.000000 0.000000 6.715729 0.000000 15.000000 c
|
||||
0.000000 23.284271 6.715729 30.000000 15.000000 30.000000 c
|
||||
23.284271 30.000000 30.000000 23.284271 30.000000 15.000000 c
|
||||
h
|
||||
f
|
||||
n
|
||||
Q
|
||||
q
|
||||
1.000000 0.000000 -0.000000 1.000000 0.000000 0.000000 cm
|
||||
0.000000 0.000000 0.000000 scn
|
||||
15.009004 0.000000 m
|
||||
23.233341 0.000000 30.000000 6.766640 30.000000 15.009003 c
|
||||
30.000000 23.233379 23.233341 30.000000 14.991017 30.000000 c
|
||||
6.766642 30.000000 0.000000 23.233379 0.000000 15.009003 c
|
||||
0.000000 6.766640 6.766643 0.000000 15.009004 0.000000 c
|
||||
h
|
||||
8.098384 15.009003 m
|
||||
8.098384 16.034798 8.836217 16.790653 9.844025 16.790653 c
|
||||
13.209368 16.790653 l
|
||||
13.209368 20.155996 l
|
||||
13.209368 21.163769 13.965223 21.919624 14.991017 21.919624 c
|
||||
16.016811 21.919624 16.772667 21.163769 16.772667 20.155996 c
|
||||
16.772667 16.790653 l
|
||||
20.137974 16.790653 l
|
||||
21.163769 16.790653 21.901638 16.034798 21.901638 15.009003 c
|
||||
21.901638 13.983208 21.163769 13.227352 20.137974 13.227352 c
|
||||
16.772667 13.227352 l
|
||||
16.772667 9.862047 l
|
||||
16.772667 8.854239 16.016811 8.098381 14.991017 8.098381 c
|
||||
13.965223 8.098381 13.209368 8.854239 13.209368 9.862047 c
|
||||
13.209368 13.227352 l
|
||||
9.844025 13.227352 l
|
||||
8.836217 13.227352 8.098384 13.983208 8.098384 15.009003 c
|
||||
h
|
||||
f
|
||||
n
|
||||
Q
|
||||
|
||||
endstream
|
||||
endobj
|
||||
|
||||
3 0 obj
|
||||
1426
|
||||
endobj
|
||||
|
||||
4 0 obj
|
||||
<< /Annots []
|
||||
/Type /Page
|
||||
/MediaBox [ 0.000000 0.000000 30.000000 30.000000 ]
|
||||
/Resources 1 0 R
|
||||
/Contents 2 0 R
|
||||
/Parent 5 0 R
|
||||
>>
|
||||
endobj
|
||||
|
||||
5 0 obj
|
||||
<< /Kids [ 4 0 R ]
|
||||
/Count 1
|
||||
/Type /Pages
|
||||
>>
|
||||
endobj
|
||||
|
||||
6 0 obj
|
||||
<< /Type /Catalog
|
||||
/Pages 5 0 R
|
||||
>>
|
||||
endobj
|
||||
|
||||
xref
|
||||
0 7
|
||||
0000000000 65535 f
|
||||
0000000010 00000 n
|
||||
0000000034 00000 n
|
||||
0000001516 00000 n
|
||||
0000001539 00000 n
|
||||
0000001712 00000 n
|
||||
0000001786 00000 n
|
||||
trailer
|
||||
<< /ID [ (some) (id) ]
|
||||
/Root 6 0 R
|
||||
/Size 7
|
||||
>>
|
||||
startxref
|
||||
1845
|
||||
%%EOF
|
|
@ -8,9 +8,9 @@
|
|||
import Combine
|
||||
import MastodonSDK
|
||||
import os.log
|
||||
import PhotosUI
|
||||
import UIKit
|
||||
import UITextField_Shake
|
||||
import PhotosUI
|
||||
|
||||
final class MastodonRegisterViewController: UIViewController, NeedsDependency, OnboardingViewControllerAppearance {
|
||||
var disposeBag = Set<AnyCancellable>()
|
||||
|
@ -36,7 +36,7 @@ final class MastodonRegisterViewController: UIViewController, NeedsDependency, O
|
|||
scrollview.showsVerticalScrollIndicator = false
|
||||
scrollview.keyboardDismissMode = .interactive
|
||||
scrollview.alwaysBounceVertical = true
|
||||
scrollview.clipsToBounds = false // make content could display over bleeding
|
||||
scrollview.clipsToBounds = false // make content could display over bleeding
|
||||
scrollview.translatesAutoresizingMaskIntoConstraints = false
|
||||
return scrollview
|
||||
}()
|
||||
|
@ -71,23 +71,13 @@ final class MastodonRegisterViewController: UIViewController, NeedsDependency, O
|
|||
return button
|
||||
}()
|
||||
|
||||
let plusIconBackground: UIImageView = {
|
||||
let icon = UIImageView()
|
||||
let boldFont = UIFont.systemFont(ofSize: 24)
|
||||
let configuration = UIImage.SymbolConfiguration(font: boldFont)
|
||||
let image = UIImage(systemName: "plus.circle", withConfiguration: configuration)
|
||||
icon.image = image
|
||||
icon.tintColor = .white
|
||||
return icon
|
||||
}()
|
||||
|
||||
let plusIcon: UIImageView = {
|
||||
let icon = UIImageView()
|
||||
let boldFont = UIFont.systemFont(ofSize: 24)
|
||||
let configuration = UIImage.SymbolConfiguration(font: boldFont)
|
||||
let image = UIImage(systemName: "plus.circle.fill", withConfiguration: configuration)
|
||||
|
||||
let image = Asset.Circles.plusCircleFill.image.withRenderingMode(.alwaysTemplate)
|
||||
icon.image = image
|
||||
icon.tintColor = Asset.Colors.Icon.plus.color
|
||||
icon.backgroundColor = .white
|
||||
return icon
|
||||
}()
|
||||
|
||||
|
@ -216,19 +206,28 @@ final class MastodonRegisterViewController: UIViewController, NeedsDependency, O
|
|||
}()
|
||||
|
||||
deinit {
|
||||
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function)
|
||||
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", (#file as NSString).lastPathComponent, #line, #function)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
extension MastodonRegisterViewController {
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
setupOnboardingAppearance()
|
||||
defer { setupNavigationBarBackgroundView() }
|
||||
|
||||
|
||||
photoButton.publisher(for: \.isHighlighted, options: .new)
|
||||
.receive(on: DispatchQueue.main)
|
||||
.sink { [weak self] isHighlighted in
|
||||
guard let self = self else { return }
|
||||
let alpha: CGFloat = isHighlighted ? 0.8 : 1
|
||||
self.plusIcon.alpha = alpha
|
||||
self.photoButton.alpha = alpha
|
||||
}
|
||||
.store(in: &disposeBag)
|
||||
|
||||
domainLabel.text = "@" + viewModel.domain + " "
|
||||
domainLabel.sizeToFit()
|
||||
passwordCheckLabel.attributedText = viewModel.attributeStringForPassword()
|
||||
|
@ -295,12 +294,7 @@ extension MastodonRegisterViewController {
|
|||
photoButton.centerXAnchor.constraint(equalTo: photoView.centerXAnchor),
|
||||
photoButton.centerYAnchor.constraint(equalTo: photoView.centerYAnchor),
|
||||
])
|
||||
plusIconBackground.translatesAutoresizingMaskIntoConstraints = false
|
||||
photoView.addSubview(plusIconBackground)
|
||||
NSLayoutConstraint.activate([
|
||||
plusIconBackground.trailingAnchor.constraint(equalTo: photoButton.trailingAnchor),
|
||||
plusIconBackground.bottomAnchor.constraint(equalTo: photoButton.bottomAnchor),
|
||||
])
|
||||
|
||||
plusIcon.translatesAutoresizingMaskIntoConstraints = false
|
||||
photoView.addSubview(plusIcon)
|
||||
NSLayoutConstraint.activate([
|
||||
|
@ -415,7 +409,7 @@ extension MastodonRegisterViewController {
|
|||
|
||||
viewModel.isUsernameTaken
|
||||
.receive(on: DispatchQueue.main)
|
||||
.sink {[weak self] isUsernameTaken in
|
||||
.sink { [weak self] isUsernameTaken in
|
||||
guard let self = self else { return }
|
||||
if isUsernameTaken {
|
||||
self.usernameIsTakenLabel.isHidden = false
|
||||
|
@ -492,10 +486,9 @@ extension MastodonRegisterViewController {
|
|||
.store(in: &disposeBag)
|
||||
|
||||
if viewModel.approvalRequired {
|
||||
|
||||
inviteTextField.delegate = self
|
||||
NSLayoutConstraint.activate([
|
||||
inviteTextField.heightAnchor.constraint(equalToConstant: 50).priority(.defaultHigh)
|
||||
inviteTextField.heightAnchor.constraint(equalToConstant: 50).priority(.defaultHigh),
|
||||
])
|
||||
|
||||
viewModel.inviteValidateState
|
||||
|
@ -503,7 +496,6 @@ extension MastodonRegisterViewController {
|
|||
.sink { [weak self] validateState in
|
||||
guard let self = self else { return }
|
||||
self.setTextFieldValidAppearance(self.inviteTextField, validateState: validateState)
|
||||
|
||||
}
|
||||
.store(in: &disposeBag)
|
||||
NotificationCenter.default
|
||||
|
@ -518,11 +510,14 @@ extension MastodonRegisterViewController {
|
|||
|
||||
signUpButton.addTarget(self, action: #selector(MastodonRegisterViewController.signUpButtonPressed(_:)), for: .touchUpInside)
|
||||
}
|
||||
|
||||
override func viewDidLayoutSubviews() {
|
||||
super.viewDidLayoutSubviews()
|
||||
plusIcon.layer.cornerRadius = plusIcon.frame.width/2
|
||||
plusIcon.clipsToBounds = true
|
||||
}
|
||||
}
|
||||
|
||||
extension MastodonRegisterViewController: UITextFieldDelegate {
|
||||
|
||||
func textFieldDidBeginEditing(_ textField: UITextField) {
|
||||
let text = textField.text?.trimmingCharacters(in: .whitespacesAndNewlines) ?? ""
|
||||
|
||||
|
@ -564,7 +559,6 @@ extension MastodonRegisterViewController: UITextFieldDelegate {
|
|||
}
|
||||
|
||||
extension MastodonRegisterViewController {
|
||||
|
||||
@objc private func tapGestureRecognizerHandler(_ sender: UITapGestureRecognizer) {
|
||||
view.endEditing(true)
|
||||
}
|
||||
|
@ -611,6 +605,5 @@ extension MastodonRegisterViewController {
|
|||
self.coordinator.present(scene: .mastodonConfirmEmail(viewModel: viewModel), from: self, transition: .show)
|
||||
}
|
||||
.store(in: &disposeBag)
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue