Skip to content

Commit

Permalink
Issue #162: Make sure, proof is generated before upload.
Browse files Browse the repository at this point in the history
  • Loading branch information
tladesignz committed Mar 9, 2023
1 parent 3dca000 commit 9969b26
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 7 additions & 0 deletions Save/Preview/PreviewViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,13 @@ class PreviewViewController: UIViewController, UITableViewDelegate, UITableViewD
.iterateKeysAndObjects(inGroup: group) { collection, key, object, index, stop in

if let asset = object as? Asset {
// ProofMode might have been switched on in between import and now,
// or something inhibited proof generation, so make sure,
// proof is generated before upload.
// Proofing will set asset to un-ready, so upload will not start
// before proof is done as asset is set to ready again.
asset.generateProof()

let upload = Upload(order: order, asset: asset)
transaction.setObject(upload, forKey: upload.id, inCollection: Upload.collection)
order += 1
Expand Down
2 changes: 0 additions & 2 deletions Shared/Models/Asset.swift
Original file line number Diff line number Diff line change
Expand Up @@ -644,8 +644,6 @@ class Asset: NSObject, Item, YapDatabaseRelationshipNode, Encodable {
item.proofFolder = Files.base
item.proofFilesBaseName = id

print("Generating proof into: \(item.proofFolder?.path ?? "(nil)")")

Proof.shared.process(
mediaItem: item,
options: .init(showDeviceIds: true, showLocation: false, showMobileNetwork: false, notarizationProviders: []))
Expand Down

0 comments on commit 9969b26

Please sign in to comment.