Skip to content

Downloading(cracked, not original) doesn't ask where to save file #116

Description

@Bryan0211

Describe the bug

In Download.x,it import:

#import "Headers.h"
#import <AVFoundation/AVFoundation.h>
#import <Photos/Photos.h>

But, it doesn't impl a document picker/export flow for downloaded files.
The final file is written to the app sandbox, via YouModDownloadsDirectoryURL() and YouModUniqueFileURL().

Thus,
when "downloaded things is not Photo-compatible" or "option DownloadSaveToPhotos is disable",
the file is saved only inside the app sandbox and no user-visible export/share flow is presented.

Note

Current behavior:

if (isVideo && IS_ENABLED(DownloadSaveToPhotos) && canSaveToPhotos) {
    // save to Photos
} else {
    // toast, *no export*
}
isVideo == NO
canSaveToPhotos == NO
DownloadSaveToPhotos == NO
→ only toast, no share sheet, no Files export picker
isVideo == YES
canSaveToPhotos == YES
DownloadSaveToPhotos == YES
→ present UIDocumentPickerViewController export flow

For fixing, the intended bahabior:

If DownloadSaveToPhotos == enabled:
    *keep the current behavior* and save Photos-compatible videos to Photos.

If DownloadSaveToPhotos == disabled:
    present a user-visible export flow, such as `UIDocumentPickerViewController`,
    so the user can choose where to save the downloaded file.

For impl, add an export helper in Download.x, similiar to the export logic already used in YouModPerferences.x:

UIDocumentPickerViewController *picker =
    [[UIDocumentPickerViewController alloc] initForExportingURLs:@[fileURL] asCopy:YES];

Then update completeWithFileURL:isVideo:presenter: so that Photos-compatible videos with DownloadSaveToPhotos disabled are exported through this picker instead of only showing a completion toast.

Steps to reproduce

  1. Enable "Download Manager" under setting "YouMod" item.
  2. Download sth(video, subtitle, ...) of video.
  3. After download process completing, there is nothing happen(file is saved to under app sandbox).

Crashlog or video error popup log

No response

Post requisites

  • I have CHECKED that a similar issue has not been reported before.
  • Verified the relevance of the project and the version you are using.
  • Provided a detailed description of the problem and have filled in all required fields.
  • By submitting this issue, I confirm that I have filled in all the necessary fields and complied with the guidelines. Failure to comply may result in the issue being closed without discussion, and repeated violations may lead to restrict account from further participation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions