feat: add illustration for home timeline empty state
This commit is contained in:
parent
0e7fcfcc7d
commit
d350213f6c
@ -12,7 +12,7 @@
|
|||||||
<key>CoreDataStack.xcscheme_^#shared#^_</key>
|
<key>CoreDataStack.xcscheme_^#shared#^_</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>orderHint</key>
|
<key>orderHint</key>
|
||||||
<integer>21</integer>
|
<integer>20</integer>
|
||||||
</dict>
|
</dict>
|
||||||
<key>Mastodon - ASDK.xcscheme_^#shared#^_</key>
|
<key>Mastodon - ASDK.xcscheme_^#shared#^_</key>
|
||||||
<dict>
|
<dict>
|
||||||
@ -37,7 +37,7 @@
|
|||||||
<key>NotificationService.xcscheme_^#shared#^_</key>
|
<key>NotificationService.xcscheme_^#shared#^_</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>orderHint</key>
|
<key>orderHint</key>
|
||||||
<integer>20</integer>
|
<integer>21</integer>
|
||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
<key>SuppressBuildableAutocreation</key>
|
<key>SuppressBuildableAutocreation</key>
|
||||||
|
@ -24,6 +24,7 @@ internal enum Asset {
|
|||||||
internal static let accentColor = ColorAsset(name: "AccentColor")
|
internal static let accentColor = ColorAsset(name: "AccentColor")
|
||||||
internal enum Asset {
|
internal enum Asset {
|
||||||
internal static let email = ImageAsset(name: "Asset/email")
|
internal static let email = ImageAsset(name: "Asset/email")
|
||||||
|
internal static let friends = ImageAsset(name: "Asset/friends")
|
||||||
internal static let mastodonTextLogo = ImageAsset(name: "Asset/mastodon.text.logo")
|
internal static let mastodonTextLogo = ImageAsset(name: "Asset/mastodon.text.logo")
|
||||||
}
|
}
|
||||||
internal enum Circles {
|
internal enum Circles {
|
||||||
|
23
Mastodon/Resources/Assets.xcassets/Asset/friends.imageset/Contents.json
vendored
Normal file
23
Mastodon/Resources/Assets.xcassets/Asset/friends.imageset/Contents.json
vendored
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
{
|
||||||
|
"images" : [
|
||||||
|
{
|
||||||
|
"filename" : "friends 3.png",
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "1x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename" : "friends 2.png",
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "2x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename" : "friends 1.png",
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "3x"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info" : {
|
||||||
|
"author" : "xcode",
|
||||||
|
"version" : 1
|
||||||
|
}
|
||||||
|
}
|
BIN
Mastodon/Resources/Assets.xcassets/Asset/friends.imageset/friends 1.png
vendored
Normal file
BIN
Mastodon/Resources/Assets.xcassets/Asset/friends.imageset/friends 1.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 585 KiB |
BIN
Mastodon/Resources/Assets.xcassets/Asset/friends.imageset/friends 2.png
vendored
Normal file
BIN
Mastodon/Resources/Assets.xcassets/Asset/friends.imageset/friends 2.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 221 KiB |
BIN
Mastodon/Resources/Assets.xcassets/Asset/friends.imageset/friends 3.png
vendored
Normal file
BIN
Mastodon/Resources/Assets.xcassets/Asset/friends.imageset/friends 3.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 125 KiB |
@ -24,12 +24,18 @@ final class HomeTimelineViewController: UIViewController, NeedsDependency, Media
|
|||||||
private(set) lazy var viewModel = HomeTimelineViewModel(context: context)
|
private(set) lazy var viewModel = HomeTimelineViewModel(context: context)
|
||||||
|
|
||||||
let mediaPreviewTransitionController = MediaPreviewTransitionController()
|
let mediaPreviewTransitionController = MediaPreviewTransitionController()
|
||||||
|
|
||||||
|
let friendsAssetImageView: UIImageView = {
|
||||||
|
let imageView = UIImageView()
|
||||||
|
imageView.image = Asset.Asset.friends.image
|
||||||
|
imageView.contentMode = .scaleAspectFill
|
||||||
|
return imageView
|
||||||
|
}()
|
||||||
|
|
||||||
lazy var emptyView: UIStackView = {
|
lazy var emptyView: UIStackView = {
|
||||||
let emptyView = UIStackView()
|
let emptyView = UIStackView()
|
||||||
emptyView.axis = .vertical
|
emptyView.axis = .vertical
|
||||||
emptyView.distribution = .fill
|
emptyView.distribution = .fill
|
||||||
emptyView.layoutMargins = UIEdgeInsets(top: 0, left: 20, bottom: 54, right: 20)
|
|
||||||
emptyView.isLayoutMarginsRelativeArrangement = true
|
emptyView.isLayoutMarginsRelativeArrangement = true
|
||||||
return emptyView
|
return emptyView
|
||||||
}()
|
}()
|
||||||
@ -246,9 +252,10 @@ extension HomeTimelineViewController {
|
|||||||
view.addSubview(emptyView)
|
view.addSubview(emptyView)
|
||||||
emptyView.translatesAutoresizingMaskIntoConstraints = false
|
emptyView.translatesAutoresizingMaskIntoConstraints = false
|
||||||
NSLayoutConstraint.activate([
|
NSLayoutConstraint.activate([
|
||||||
emptyView.leadingAnchor.constraint(equalTo: view.readableContentGuide.leadingAnchor),
|
emptyView.topAnchor.constraint(equalTo: view.layoutMarginsGuide.topAnchor),
|
||||||
emptyView.trailingAnchor.constraint(equalTo: view.readableContentGuide.trailingAnchor),
|
emptyView.leadingAnchor.constraint(equalTo: view.leadingAnchor),
|
||||||
emptyView.bottomAnchor.constraint(equalTo: view.readableContentGuide.bottomAnchor)
|
emptyView.trailingAnchor.constraint(equalTo: view.trailingAnchor),
|
||||||
|
emptyView.bottomAnchor.constraint(equalTo: view.layoutMarginsGuide.bottomAnchor)
|
||||||
])
|
])
|
||||||
|
|
||||||
if emptyView.arrangedSubviews.count > 0 {
|
if emptyView.arrangedSubviews.count > 0 {
|
||||||
@ -272,11 +279,29 @@ extension HomeTimelineViewController {
|
|||||||
button.addTarget(self, action: #selector(HomeTimelineViewController.manuallySearchButtonPressed(_:)), for: .touchUpInside)
|
button.addTarget(self, action: #selector(HomeTimelineViewController.manuallySearchButtonPressed(_:)), for: .touchUpInside)
|
||||||
return button
|
return button
|
||||||
}()
|
}()
|
||||||
|
|
||||||
emptyView.addArrangedSubview(findPeopleButton)
|
let topPaddingView = UIView()
|
||||||
emptyView.setCustomSpacing(17, after: findPeopleButton)
|
let bottomPaddingView = UIView()
|
||||||
emptyView.addArrangedSubview(manuallySearchButton)
|
|
||||||
|
emptyView.addArrangedSubview(topPaddingView)
|
||||||
|
emptyView.addArrangedSubview(friendsAssetImageView)
|
||||||
|
emptyView.addArrangedSubview(bottomPaddingView)
|
||||||
|
|
||||||
|
topPaddingView.translatesAutoresizingMaskIntoConstraints = false
|
||||||
|
bottomPaddingView.translatesAutoresizingMaskIntoConstraints = false
|
||||||
|
NSLayoutConstraint.activate([
|
||||||
|
topPaddingView.heightAnchor.constraint(equalTo: bottomPaddingView.heightAnchor, multiplier: 0.8),
|
||||||
|
])
|
||||||
|
|
||||||
|
let buttonContainerStackView = UIStackView()
|
||||||
|
emptyView.addArrangedSubview(buttonContainerStackView)
|
||||||
|
buttonContainerStackView.isLayoutMarginsRelativeArrangement = true
|
||||||
|
buttonContainerStackView.layoutMargins = UIEdgeInsets(top: 0, left: 32, bottom: 22, right: 32)
|
||||||
|
buttonContainerStackView.axis = .vertical
|
||||||
|
buttonContainerStackView.spacing = 17
|
||||||
|
|
||||||
|
buttonContainerStackView.addArrangedSubview(findPeopleButton)
|
||||||
|
buttonContainerStackView.addArrangedSubview(manuallySearchButton)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user