Skip to content

Commit

Permalink
Small fixes to upload button at the end of a session
Browse files Browse the repository at this point in the history
  • Loading branch information
sunshinejr committed Jan 23, 2021
1 parent e63b9ba commit 6023306
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Tree Tracker/Screens/UploadList/UploadListViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ protocol UploadListNavigating: AnyObject {
final class UploadListViewModel {
@Published var title: String
@Published var data: [ListSection<TreesListItem>]
@Published var syncProgress: SyncProgress?
@Published var syncButton: ButtonModel?
@Published var navigationButtons: [NavigationBarButtonModel]

Expand Down Expand Up @@ -64,12 +63,17 @@ final class UploadListViewModel {
private func stopUploading() {
print("Uploading cancelled.")
currentUpload?.cancel()
presentTreesFromDatabase()
}

private func uploadLocalTreesRecursively() {
print("Uploading images...")
database.fetchLocalTrees { [weak self] trees in
guard let tree = trees.first else { return }
guard let tree = trees.first else {
print("No more items to upload - bailing.")
self?.presentUploadButton(isUploading: false)
return
}

print("Now uploading tree: \(tree)")
self?.currentUpload = self?.api.upload(
Expand Down

0 comments on commit 6023306

Please sign in to comment.