Skip to content

Implemented attachment downloading, previews, download progress and caching #21

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 10, 2022

Conversation

antingle
Copy link
Contributor

Created a CircularProgressView that sits in a Stack under the download button

  • Appears on download click and shows progress, goes away on completion or error

Created functions to handle creating files in cache and in the downloads folder

  • Quick look functionality downloads a file to cache and opens it in the cache
  • Quick look will always grab from a file from the cache first, if not there, it will download
  • The download button will always download a file from its external url and replace the cached version if it exists

Created a FileManager.swift file that currently holds the function to delete cache folders older than 24 hours

  • This could be expanded to hold the functions inside of AttachmentView currently handling downloading and loading

Adjusted buttons on the AttachmentView

  • Added a new preview button for quick look on non-image and non-video file types
  • Added an error state and completed state to the download button, it will take the form of an exclamation mark or check mark respectively

Bugs

  • Quick look does not show a rich preview on the first click, only exiting and re-selecting it will show the rich preview
    • It appears that quick look has its own cache system that allows it to load previews faster the second time. Maybe this has something to do with it? The file is downloaded by the time it is sent to quick look, so it is not because the file is being downloaded
  • There appears to be an error coming through the debug log related to quick look as well:
[General] -[QLPreviewPanel reloadData] called while the panel has no controller - Fix this or this will raise soon.
	See comments in QLPreviewPanel.h for -acceptsPreviewPanelControl:/-beginPreviewPanelControl:/-endPreviewPanelControl:.
2022-05-10 03:40:51.054025-0400 Swiftcord[30639:1187155] [default] [self.extensionContext conformsToProtocol:auxHostProtocol.protocol] - /AppleInternal/Library/BuildRoots/66382bca-8bca-11ec-aade-6613bcf0e2ee/Library/Caches/com.apple.xbs/Sources/ExtensionFoundation/ExtensionFoundation/Source/NSExtension/NSExtensionSupport/EXExtensionContext.m:332: Class QLPreviewExtensionHostContext does not conform to aux host protocol: QLPreviewExtensionHostContextProtocol

Looks

downloadButton.mov

quickLook

@cryptoAlgorithm
Copy link
Member

Great! Did you resolve the issue that caused the quick look not to show a proper preview the first time?

@antingle
Copy link
Contributor Author

No, that is unfortunately still occurring. It could possibly be related to the error coming through the log right now

@cryptoAlgorithm
Copy link
Member

Ok, thanks. Since that looks like a bug out of our control, I'll merge this :D

@cryptoAlgorithm cryptoAlgorithm merged commit 9e35fcf into SwiftcordApp:main May 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants