Skip to content

Commit

Permalink
mentions fully working
Browse files Browse the repository at this point in the history
  • Loading branch information
EricBAndrews committed Oct 27, 2023
1 parent 71cb4bb commit b70496a
Show file tree
Hide file tree
Showing 26 changed files with 630 additions and 271 deletions.
15 changes: 15 additions & 0 deletions Mlem/API/Models/Person/APIPersonMention.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,21 @@ struct APIPersonMention: Decodable {
let commentId: Int
let read: Bool
let published: Date

init(
from personMention: APIPersonMention,
id: Int? = nil,
recipientId: Int? = nil,
commentId: Int? = nil,
read: Bool? = nil,
published: Date? = nil
) {
self.id = id ?? personMention.id
self.recipientId = recipientId ?? personMention.recipientId
self.commentId = commentId ?? personMention.commentId
self.read = read ?? personMention.read
self.published = published ?? personMention.published
}
}

extension APIPersonMention: Equatable {
Expand Down
9 changes: 9 additions & 0 deletions Mlem/API/Models/ScoringOperation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,20 @@
//

import Foundation
import SwiftUI

enum ScoringOperation: Int, Decodable {
case upvote = 1
case downvote = -1
case resetVote = 0

var color: Color? {
switch self {
case .upvote: return .blue
case .downvote: return .red
case .resetVote: return nil
}
}
}

extension ScoringOperation: AssociatedIcon {
Expand Down
2 changes: 2 additions & 0 deletions Mlem/App Constants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,6 @@ struct AppConstants {

static let blockUserPrompt: String = "Really block this user?"
static let reportPostPrompt: String = "Really report this post?"
static let reportMentionPrompt: String = "Really report this mention?"
static let reportMessagePrompt: String = "Really report this message?"
}
4 changes: 2 additions & 2 deletions Mlem/Icons.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ struct Icons {
static let unsaveFill: String = "bookmark.slash.fill"

// mark read
static let markRead: String = "envelope"
static let markRead: String = "envelope.open"
static let markReadFill: String = "envelope.open.fill"
static let markUnread: String = "envelope.open"
static let markUnread: String = "envelope"
static let markUnreadFill: String = "envelope.fill"

// moderation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,10 @@ struct ReplyToMention: ResponseEditorModel {
var id: Int { mention.id }

func embeddedView() -> AnyView {
AnyView(InboxMentionView(
mention: mention,
menuFunctions: []
AnyView(
InboxMentionView(mention: mention)
.padding(.horizontal)
)
.padding(.horizontal))
}

func sendResponse(responseContents: String) async throws {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ struct ReportMention: ResponseEditorModel {
let mention: MentionModel

func embeddedView() -> AnyView {
AnyView(InboxMentionView(mention: mention, menuFunctions: [])
.padding(.horizontal))
AnyView(
InboxMentionView(mention: mention)
.padding(.horizontal)
)
}

func sendResponse(responseContents: String) async throws {
Expand Down
Loading

0 comments on commit b70496a

Please sign in to comment.