Files
GitHawk/Classes/Issues/Comments/IssueCommentModel.swift
Ryan Nystrom 4733859946 Open PR comments in another VC (#828)
* WIP PR comments

* thread comment count to PR review model

* PR review comments in another VC
2017-11-04 21:46:21 -04:00

72 lines
1.8 KiB
Swift

//
// IssueCommentModel.swift
// Freetime
//
// Created by Ryan Nystrom on 5/19/17.
// Copyright © 2017 Ryan Nystrom. All rights reserved.
//
import Foundation
import IGListKit
final class IssueCommentModel: ListDiffable {
let id: String
let details: IssueCommentDetailsViewModel
let bodyModels: [ListDiffable]
let reactions: IssueCommentReactionViewModel
let collapse: (model: AnyObject, height: CGFloat)?
let number: Int?
let rawMarkdown: String
let viewerCanUpdate: Bool
let viewerCanDelete: Bool
let isRoot: Bool
let asReviewComment: Bool
enum ThreadState {
case single
case neck
case tail
}
let threadState: ThreadState
init(
id: String,
details: IssueCommentDetailsViewModel,
bodyModels: [ListDiffable],
reactions: IssueCommentReactionViewModel,
collapse: (AnyObject, CGFloat)?,
threadState: ThreadState,
rawMarkdown: String,
viewerCanUpdate: Bool,
viewerCanDelete: Bool,
isRoot: Bool,
number: Int?,
asReviewComment: Bool = false
) {
self.id = id
self.details = details
self.bodyModels = bodyModels
self.reactions = reactions
self.collapse = collapse
self.threadState = threadState
self.number = number
self.rawMarkdown = rawMarkdown
self.viewerCanUpdate = viewerCanUpdate
self.viewerCanDelete = viewerCanDelete
self.isRoot = isRoot
self.asReviewComment = asReviewComment
}
// MARK: ListDiffable
func diffIdentifier() -> NSObjectProtocol {
return id as NSObjectProtocol
}
func isEqual(toDiffableObject object: ListDiffable?) -> Bool {
return true
}
}