style: rename `Id` to `ID`
This commit is contained in:
parent
cbc828eec2
commit
85014802c4
|
@ -88,7 +88,7 @@ extension ReportViewModel {
|
|||
}
|
||||
if status.id == self.statusId {
|
||||
attribute.isSelected = true
|
||||
self.reportQuery.append(statusId: status.id)
|
||||
self.reportQuery.append(statusID: status.id)
|
||||
self.continueEnableSubject.send(true)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -66,8 +66,8 @@ class ReportViewModel: NSObject {
|
|||
)
|
||||
|
||||
self.reportQuery = FileReportQuery(
|
||||
accountId: userId,
|
||||
statusIds: [],
|
||||
accountID: userId,
|
||||
statusIDs: [],
|
||||
comment: nil,
|
||||
forward: nil
|
||||
)
|
||||
|
@ -121,15 +121,15 @@ class ReportViewModel: NSObject {
|
|||
|
||||
attribute.isSelected = !attribute.isSelected
|
||||
if attribute.isSelected {
|
||||
self.reportQuery.append(statusId: status.id)
|
||||
self.reportQuery.append(statusID: status.id)
|
||||
} else {
|
||||
self.reportQuery.remove(statusId: status.id)
|
||||
self.reportQuery.remove(statusID: status.id)
|
||||
}
|
||||
|
||||
snapshot.reloadItems([item])
|
||||
self.diffableDataSource?.apply(snapshot, animatingDifferences: false)
|
||||
|
||||
let continueEnable = (self.reportQuery.statusIds?.count ?? 0) > 0
|
||||
let continueEnable = (self.reportQuery.statusIDs?.count ?? 0) > 0
|
||||
self.continueEnableSubject.send(continueEnable)
|
||||
}
|
||||
.store(in: &disposeBag)
|
||||
|
@ -150,7 +150,7 @@ class ReportViewModel: NSObject {
|
|||
func bindForStep1(input: Input) {
|
||||
let skip = input.step1Skip.map { [weak self] value -> Void in
|
||||
guard let self = self else { return value }
|
||||
self.reportQuery.statusIds?.removeAll()
|
||||
self.reportQuery.statusIDs?.removeAll()
|
||||
return value
|
||||
}
|
||||
|
||||
|
|
|
@ -65,40 +65,41 @@ extension Mastodon.API.Reports {
|
|||
|
||||
public extension Mastodon.API.Reports {
|
||||
class FileReportQuery: Codable, PostQuery {
|
||||
public let accountId: String
|
||||
public var statusIds: [String]?
|
||||
public let accountID: Mastodon.Entity.Account.ID
|
||||
public var statusIDs: [Mastodon.Entity.Status.ID]?
|
||||
public var comment: String?
|
||||
public let forward: Bool?
|
||||
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case accountId = "account_id"
|
||||
case statusIds = "status_ids"
|
||||
case accountID = "account_id"
|
||||
case statusIDs = "status_ids"
|
||||
case comment
|
||||
case forward
|
||||
}
|
||||
|
||||
public init(accountId: String,
|
||||
statusIds: [String]?,
|
||||
public init(
|
||||
accountID: Mastodon.Entity.Account.ID,
|
||||
statusIDs: [Mastodon.Entity.Status.ID]?,
|
||||
comment: String?,
|
||||
forward: Bool?) {
|
||||
self.accountId = accountId
|
||||
self.statusIds = statusIds
|
||||
self.accountID = accountID
|
||||
self.statusIDs = statusIDs
|
||||
self.comment = comment
|
||||
self.forward = forward
|
||||
}
|
||||
|
||||
public func append(statusId: String) {
|
||||
guard self.statusIds?.contains(statusId) != true else { return }
|
||||
if self.statusIds == nil {
|
||||
self.statusIds = []
|
||||
public func append(statusID: Mastodon.Entity.Status.ID) {
|
||||
guard self.statusIDs?.contains(statusID) != true else { return }
|
||||
if self.statusIDs == nil {
|
||||
self.statusIDs = []
|
||||
}
|
||||
|
||||
self.statusIds?.append(statusId)
|
||||
self.statusIDs?.append(statusID)
|
||||
}
|
||||
|
||||
public func remove(statusId: String) {
|
||||
guard let index = self.statusIds?.firstIndex(of: statusId) else { return }
|
||||
self.statusIds?.remove(at: index)
|
||||
public func remove(statusID: String) {
|
||||
guard let index = self.statusIDs?.firstIndex(of: statusID) else { return }
|
||||
self.statusIDs?.remove(at: index)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue