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

Notifications Refresh (Phase 2) #23051

Closed
wants to merge 143 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
143 commits
Select commit Hold shift + click to select a range
3bed34c
Create base branch for the notifications phase 2 project
salimbraksa Apr 22, 2024
714734f
Empty commit to create a draft PR
salimbraksa Apr 22, 2024
f9ce7de
Add dropdown in the navigation title to filter notifications
salimbraksa Apr 22, 2024
52f8afa
Update notifications title when the filter changes
salimbraksa Apr 23, 2024
f830990
Hide filters menu if the user doesn't have notifications
salimbraksa Apr 23, 2024
2b7006a
Remove the old filters tab bar
salimbraksa Apr 23, 2024
114ca83
Add documentation
salimbraksa Apr 23, 2024
c65658c
Split filters menu into 2 sections
salimbraksa Apr 23, 2024
bb6bdbc
Add icons for each menu item
salimbraksa Apr 24, 2024
a46872c
Localize All Notifications string
salimbraksa Apr 24, 2024
69c98b3
Remove icons from notifications filters menu
salimbraksa Apr 24, 2024
c0a4a5d
Add reusable component for Comment Details and Likes header
salimbraksa Apr 24, 2024
1e328c2
Uncomment DynamicDashboardCard_Previews
salimbraksa Apr 24, 2024
efee7cd
Expose ContentPreview inits
salimbraksa Apr 24, 2024
3a5728d
[Notifications Refresh] Implement component for Comment Moderation an…
salimbraksa Apr 24, 2024
96ddcb7
Update localized string key
salimbraksa Apr 25, 2024
7b25e64
[Notifications Refresh] Replace tabs with dropdown in notifications s…
salimbraksa Apr 25, 2024
5562048
Add `CommentModerationOptionsView`
alpavanoglu Apr 25, 2024
82e81bb
Add background color to body
alpavanoglu Apr 25, 2024
257a0c7
Replace the old comment detail header with the new one
salimbraksa Apr 25, 2024
cafdac8
Handle navigation when the Content Preview is tapped
salimbraksa Apr 25, 2024
f15f3b2
Update avatar logic to handle Gravatars and missing avatars
salimbraksa Apr 25, 2024
cba89b4
Remove unused import
salimbraksa Apr 25, 2024
972336f
Redesign likes and follows notifications details headers
justtwago Apr 26, 2024
fe94674
Replace navigation buttons for notification details
justtwago Apr 26, 2024
e8a5b25
Fix failing UI Test
salimbraksa Apr 29, 2024
2d235b3
[Notification Refresh] Replace the old Comment Detail header with the…
salimbraksa Apr 29, 2024
dc020ae
Update design to match new icons
alpavanoglu Apr 29, 2024
f0cac5d
Merge branch 'feature/notifications_refresh_p2' into task/redesign-li…
justtwago Apr 29, 2024
9ccbdce
Wrap HStack with Button
alpavanoglu Apr 29, 2024
8cf6f21
Update the likes header view
justtwago Apr 29, 2024
e09f77c
Add edit and avatar icon
salimbraksa Apr 29, 2024
7bedf88
Add comment content header view
salimbraksa Apr 29, 2024
05b72fd
Add comment content view but it's still wip
salimbraksa Apr 29, 2024
f0406af
Wrap SwiftUI preview logic in DEBUG macro
salimbraksa Apr 29, 2024
6aba19f
[Notifications P2] Comment Moderation View (#23090)
alpavanoglu Apr 30, 2024
8d8762a
Add `CommentModerationView`
alpavanoglu Apr 30, 2024
a764f9e
Add actions to `CommentModerationViewModel`
alpavanoglu Apr 30, 2024
1bf164c
Sync with base branch and fix conflicts
salimbraksa Apr 30, 2024
fc52884
Move notifications nav buttons to the design system
justtwago Apr 30, 2024
f0d29ad
Improve lifecycle of NoteBlockHeaderTableViewCell
justtwago Apr 30, 2024
1e5b46d
Configure likes notifications avatar using Avatar entity
justtwago Apr 30, 2024
4fe893b
Merge branch 'feature/notifications_refresh_p2' into task/redesign-li…
justtwago Apr 30, 2024
17738c5
Remove DEBUG macros from Previews
salimbraksa May 1, 2024
bd170ef
Update code formatting
salimbraksa May 1, 2024
c5ba22d
Improve menu data structure
salimbraksa May 1, 2024
dd9db3f
Extract menu button logic into a separate function
salimbraksa May 1, 2024
57e22b4
Improve menu filtering logic
salimbraksa May 1, 2024
ba3e4f5
Update icon spacings
alpavanoglu May 1, 2024
266e0c4
Add new comment moderation view to `CommentDetailViewController`
alpavanoglu May 1, 2024
9e3e4cc
Make LikesListController parent fieled unowned to avoid keeping stron…
justtwago May 1, 2024
b3d1c8c
Replace unowned modifier with weak for LikesListController parent pro…
justtwago May 2, 2024
2851056
Merge branch 'trunk' into feature/notifications_refresh_p2
justtwago May 3, 2024
eab1dc4
Merge branch 'feature/notifications_refresh_p2' into task/redesign-li…
justtwago May 3, 2024
0cc6471
[Notification Refresh] Likes and follows notifications header redesig…
justtwago May 3, 2024
81dd999
Refactor Menu Configuration API
salimbraksa May 3, 2024
7154ae5
Improve shouldShowMenu readability
salimbraksa May 4, 2024
7924ea1
[Notifications Refresh] Comment Moderation Content Header (#23117)
salimbraksa May 4, 2024
269ef54
Integrate the new header in Comment Detail screen
salimbraksa May 1, 2024
1dd0800
Extra comment content view component into its own class
salimbraksa May 2, 2024
6beb84c
Integrate the new comment view component
salimbraksa May 2, 2024
02727e7
Handle user info, share and edit comment actions
salimbraksa May 3, 2024
95870d0
Fix app crashing when sharing comment URL using an iPad
salimbraksa May 4, 2024
ff8802c
Improve comment moderation sheet transition smoothness
salimbraksa May 5, 2024
d1ed21d
Decrease insertion animation delay
salimbraksa May 5, 2024
eccb016
Fix a minor typo
salimbraksa May 5, 2024
8213bfd
Fix lint issue
salimbraksa May 5, 2024
7715cc2
Reset Swift Packages cache
salimbraksa May 7, 2024
f623b9f
Comment out notification UI tests until the redesign is complete
salimbraksa May 7, 2024
3d77d0a
Minor code refactoring
salimbraksa May 7, 2024
cac14dc
[Notifications Refresh] Comment Content Redesign (#23147)
salimbraksa May 8, 2024
6bc1dfd
Add a reusable component for the Bottom Sheet content view controller
salimbraksa May 8, 2024
47229b4
Tweak Comment Moderation Options view spacing
salimbraksa May 8, 2024
cf4b51c
Remove status options from the Comment Content Header menu
salimbraksa May 8, 2024
540aa49
Present Comment Moderation Options view
salimbraksa May 8, 2024
fef822d
Add `CommentModerationCoordinator`
alpavanoglu May 8, 2024
0a77dbc
Add optional init to `CommentModerationState`
alpavanoglu May 8, 2024
56463ee
Redesign like notification details content
justtwago May 8, 2024
fc2c176
Define transition and animation delay as constants
salimbraksa May 9, 2024
346b52c
Change changeStatusViewController type
salimbraksa May 9, 2024
4a4fc79
[Notifications Refresh] Present Comment Moderations Options View (#23…
salimbraksa May 9, 2024
fc37fe1
[Notifications Refresh] Improve comment moderation views transition s…
salimbraksa May 9, 2024
96eb615
Merge branch 'feature/notifications_refresh_p2' of github.com:wordpre…
alpavanoglu May 9, 2024
61d71e2
Merge branch 'feature/notifications_refresh_p2' of github.com:wordpre…
alpavanoglu May 9, 2024
ea7a5ae
Remove redundant size calculation
alpavanoglu May 9, 2024
e1b1031
Fix regression on animation duration
alpavanoglu May 9, 2024
dca0bf6
Merge branch 'feature/notifications_refresh_p2' into feature/notifica…
alpavanoglu May 9, 2024
301b746
Redesign followers notification details content
justtwago May 9, 2024
b552e09
[Notifications P1] Comment Moderation View (#23127)
alpavanoglu May 9, 2024
ce1ffe8
Remove useless separators for header and user notification detail cells
justtwago May 9, 2024
06893e5
Make presenting bottom sheet logic public
alpavanoglu May 9, 2024
3326b2c
Merge branch 'feature/notifications_refresh_p2' of github.com:wordpre…
alpavanoglu May 9, 2024
1cfaed4
Add TODO comment
alpavanoglu May 9, 2024
15410a5
Fix white spacing in enum
alpavanoglu May 10, 2024
d4c4612
Merge branch 'trunk' of github.com:wordpress-mobile/WordPress-iOS int…
salimbraksa May 10, 2024
09bd4df
Merge branch 'trunk' into feature/notifications_refresh_p2
salimbraksa May 10, 2024
53f358f
Revert Packages.resolved changes
salimbraksa May 10, 2024
e0cec11
Update `pending` underlying value as `hold`
alpavanoglu May 10, 2024
fc41a45
DSButton is used for Follow/Unfollow button on Followers details screen
justtwago May 10, 2024
1d7ed27
Reduce a redundant init function for NotificationDetailUserView
justtwago May 10, 2024
d9779f6
Refactor NotificationDetailUserView body to extract nested views
justtwago May 10, 2024
5d93234
Create specific configure functions for NoteBlockUserTableViewCell an…
justtwago May 10, 2024
ee2d565
Merge branch 'feature/notifications_refresh_p2' into task/likes-detai…
justtwago May 10, 2024
9a98fa3
[Notifications P2] Commen Moderation: Pending (#23134)
alpavanoglu May 13, 2024
c60d69e
Remove redundant ImageConfiguration from NotificationDetailUserView
justtwago May 13, 2024
a42a63e
Remove redundant LikeUserTableViewCell.xib file
justtwago May 16, 2024
af5ba03
Remove redundant NoteBlockUserTableViewCell.xib file
justtwago May 16, 2024
1d6b5eb
Remove redundant NoteBlockHeaderTableViewCell.xib file
justtwago May 16, 2024
54ff478
[Notifications Refresh] Redesign Likes and Follows details content (#…
justtwago May 16, 2024
63fcfc8
Add callback from the view model
alpavanoglu May 15, 2024
b56c770
Move `viewModel` instance to `CommenDetailViewController`
alpavanoglu May 17, 2024
3e4ec3f
Add like logic
alpavanoglu May 17, 2024
013c64c
Add delete logic
alpavanoglu May 17, 2024
c782632
Remove obsolete button cells & moderation logic
alpavanoglu May 17, 2024
d897c96
Add pop logic to dismiss after deletion
alpavanoglu May 17, 2024
b898d25
Add loading state to buttons
alpavanoglu May 17, 2024
eba626b
[Notifications Refresh] Revert Packages.resolved changes (#23188)
salimbraksa May 21, 2024
e1a9a45
Revert unnecessary `@StateObject` change on ViewModel
alpavanoglu May 22, 2024
758bd35
Pass in `isLiked` to approved state
alpavanoglu May 22, 2024
396c2bc
Rename `didChangeState` function as `didSelectState`
alpavanoglu May 22, 2024
ebfed09
Update `commentModerationViewModel` as lazy var
alpavanoglu May 23, 2024
85386dd
Fix wrong unLike track event
alpavanoglu May 23, 2024
8704144
[Notifications P2] Commen Moderation (#23225)
alpavanoglu May 24, 2024
3b25e66
Remove obsolete comment moderation code
alpavanoglu May 28, 2024
7a88eaa
Tweak Moderation Sheet UI
salimbraksa May 29, 2024
5fc2145
Add a utility to read the size of a SwiftUI view
salimbraksa May 29, 2024
89afc01
Resolve an issue in the comment content cell where the header wasn't …
salimbraksa May 29, 2024
91d9a2b
Add a view hosting the comment moderation sheet
salimbraksa May 29, 2024
62f7923
Minor code tweaks
salimbraksa May 29, 2024
ed10122
[Notifications P2] Remove obsolete code (#23268)
alpavanoglu May 29, 2024
069f9f7
Introduce Share button to likes and follow notification details
justtwago May 29, 2024
7832ce2
Add unit tests for CommentModerationSheetHostingView
salimbraksa May 31, 2024
e1e6826
Remove commented method calls
salimbraksa May 31, 2024
304dfc9
Add documentation clarifying the need for overriding hitTest method
salimbraksa May 31, 2024
01b5a20
Resolve share footer resizing issue
justtwago May 31, 2024
5fea833
Update share footer view when notification details are refreshed
justtwago May 31, 2024
02d452c
[Notifications Refresh] Resolve an issue where the comment moderation…
salimbraksa May 31, 2024
eb4fa83
Make shareFooterView nullable
justtwago May 31, 2024
c4add82
Set only primary color for the share footer background
justtwago May 31, 2024
7ae29ce
Remove redundant frame height from the share footer divider
justtwago May 31, 2024
5a55631
Make shareFooterView a source view for a share screen
justtwago May 31, 2024
ffe4c9b
Add weak self to the ShareFooterView action function
justtwago May 31, 2024
ce0c6b7
[Notifications Refresh] Introduce likes and subscribers details share…
justtwago Jun 3, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
import SwiftUI

public struct ContentPreview: View {

// MARK: - Constants

public enum Constants {
public static let imageSize: CGFloat = 32
}

// MARK: - Metrics

@ScaledMetric private var imageSize: CGFloat = Constants.imageSize
@ScaledMetric private var height: CGFloat = 40

private var leadingPadding: CGFloat {
return image == nil ? CGFloat.DS.Padding.double : CGFloat.DS.Padding.single
}

// MARK: - Properties

private let image: ImageConfiguration?
private let text: String
private let action: () -> Void

// MARK: - Init

public init(image: ImageConfiguration? = nil, text: String, action: @escaping () -> Void) {
self.image = image
self.text = text
self.action = action
}

// MARK: - Body

public var body: some View {
Button(action: action) {
HStack(spacing: CGFloat.DS.Padding.half) {
if let configuration = image {
image(configuration: configuration)
}
Text(text)
.style(.bodyLarge(.regular))
.lineLimit(1)
.foregroundStyle(Color.DS.Foreground.primary)
Spacer()
Image.DS.icon(named: .chevronRight)
.foregroundStyle(Color.DS.Foreground.tertiary)
}
.padding(.trailing, CGFloat.DS.Padding.single)
.padding(.leading, leadingPadding)
.frame(height: height)
.background(Color.DS.Background.secondary)
.clipShape(Capsule())
}
}

private func image(configuration: ImageConfiguration) -> some View {
AsyncImage(url: configuration.url) { phase in
Group {
switch phase {
case .success(let image):
image.resizable()
default:
if let placeholder = configuration.placeholder {
placeholder
.resizable()
} else {
Color.DS.Background.tertiary
}
}
}
.frame(width: imageSize, height: imageSize)
.clipShape(Circle())
}
}

// MARK: - Types

public struct ImageConfiguration {
let url: URL?
let placeholder: Image?

public init(url: URL?, placeholder: Image? = nil) {
self.url = url
self.placeholder = placeholder
}

public init(url: String?, placeholder: Image? = nil) {
self.init(url: URL(string: url ?? ""), placeholder: placeholder)
}
}
}

#Preview {
VStack {
ContentPreview(image: .init(url: "https://i.pravatar.cc/300"),
text: "Great post! ❤️",
action: {})
ContentPreview(text: "The Beauty of Off-the-Beaten-Path Adventures",
action: {})
ContentPreview(image: .init(url: "https://i.pravatar.cc/300"),
text: "Absolutely loved the tips in your latest post! 😊",
action: {})
ContentPreview(image: .init(url: URL(string: "invalid-url")),
text: "Just stumbled upon your latest art piece and wow, I'm blown away!",
action: {})
}
.padding(.horizontal, CGFloat.DS.Padding.double)
}
2 changes: 1 addition & 1 deletion Modules/Sources/DesignSystem/Components/DSButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public struct DSButton: View {
buttonBackground
if isLoading {
ProgressView()
.tint(Color.white)
.tint(Color.DS.Background.primary)
} else {
if style.emphasis != .tertiary {
buttonLabel
Expand Down
10 changes: 10 additions & 0 deletions Modules/Sources/DesignSystem/Foundation/IconName.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,20 @@ import SwiftUI
public enum IconName: String, CaseIterable {
case ellipsisHorizontal = "ellipsis.horizontal"
case checkmark
case checkmarkCircle = "checkmark.circle"
case clock
case trash
case gearshapeFill = "gearshape.fill"
case blockShare = "block.share"
case starFill = "star.fill"
case starOutline = "star.outline"
case chevronRight = "chevron.right"
case edit
case avatar
case exclamationCircle = "exclamation.circle"
case person
case arrowUp = "arrow.up"
case arrowDown = "arrow.down"
case vector = "vector"
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"images" : [
{
"filename" : "chevron-right.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"preserves-vector-representation" : true,
"template-rendering-intent" : "template"
}
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "arrow-down.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "arrow-up.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"images" : [
{
"filename" : "comment-author-avatar.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"preserves-vector-representation" : true,
"template-rendering-intent" : "template"
}
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "check-circle.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "clock.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"images" : [
{
"filename" : "edit.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"preserves-vector-representation" : true,
"template-rendering-intent" : "template"
}
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "exclamation.circle.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "gravatar.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "trash.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import UIKit
import SwiftUI
import DesignSystem
import Gravatar

public extension ContentPreview.ImageConfiguration {

init(avatar: Avatar) {
self.init(url: Self.avatarURL(from: avatar), placeholder: Image("gravatar"))
}

private static func avatarURL(from avatar: Avatar) -> URL? {
if let url = avatar.url {
return url
} else if let email = avatar.email {
let pixels = Int(ceil(avatar.size * UIScreen.main.scale))
return AvatarURL.url(for: email, preferredSize: .pixels(pixels), gravatarRating: .general)
}
return nil
}

struct Avatar {
let url: URL?
let email: String?
let size: CGFloat

init(url: URL?, email: String?, size: CGFloat = 80) {
self.url = url
self.email = email
self.size = size
}
}
}
34 changes: 34 additions & 0 deletions WordPress/Classes/Extensions/SwiftUI/View+ReadSize.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import SwiftUI

private struct SizePreferenceKey: PreferenceKey {
static var defaultValue: CGSize = .zero

static func reduce(value: inout CGSize, nextValue: () -> CGSize) {
value = nextValue()
}
}

private struct SizeModifier: ViewModifier {
let size: (CGSize) -> Void

private var sizeView: some View {
GeometryReader { geometry in
Color.clear.preference(key: SizePreferenceKey.self, value: geometry.size)
}
}

func body(content: Content) -> some View {
content.background(
sizeView
.onPreferenceChange(SizePreferenceKey.self, perform: { value in
size(value)
})
)
}
}

extension View {
func readSize(_ size: @escaping (CGSize) -> Void) -> some View {
modifier(SizeModifier(size: size))
}
}
Loading