mirror of
https://github.com/zhigang1992/GitHawk.git
synced 2026-01-13 09:10:06 +08:00
* change repo branch additions: - A change-repository-branch workflow thats very similar to the workflow in Milestones - GraphQL query to fetch a repo's branches modifications: - a mutable "branch" string in RepositoryOverviewController and RepositoryCodeDirectoryViewController - updated the V3RepositoryReadME fetch to include a branch parameter - a protocol RepositoryBranchUpdatable to flag and update the appropriate ViewControllers when a user switches branches - ContextMenu and UIAlertAction setup - Removed some outdated code to get a repo's branch name from fetch(page:) in RepositoryOverviewViewController - Added a line feed.adapter.reloadData() in fetch(page:) because app was crashing intermittently after a user switched branches without that line - was always an IGListKit duplicate identifier error on StyledTextRenderers - to reproduce, remove the feed.adapter.reloadData(), go to https://github.com/TheAlgorithms/Python, try to switch branches and the app will crash. I'm working raising an issue for it. * requested changes - changed public var to private(set) for var branch: String - removed wasteful feed.adapter.reloadData() call - re-formated params in switchBranchAction() * style nit
26 lines
562 B
Swift
26 lines
562 B
Swift
//
|
|
// RepoBranchesViewModel.swift
|
|
// Freetime
|
|
//
|
|
// Created by B_Litwin on 9/25/18.
|
|
// Copyright © 2018 Ryan Nystrom. All rights reserved.
|
|
//
|
|
|
|
import IGListKit
|
|
|
|
struct RepositoryBranchViewModel: ListSwiftDiffable {
|
|
let branch: String
|
|
let selected: Bool
|
|
|
|
var identifier: String {
|
|
return branch
|
|
}
|
|
|
|
func isEqual(to value: ListSwiftDiffable) -> Bool {
|
|
guard let value = value as? RepositoryBranchViewModel else { return false }
|
|
return value.branch == branch
|
|
&& value.selected == selected
|
|
}
|
|
}
|
|
|