-
Notifications
You must be signed in to change notification settings - Fork 392
HOTFIX Media not loading #5678
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
HOTFIX Media not loading #5678
Conversation
📸 Snapshot Test11 modified, 864 unchanged
🛸 Powered by Emerge Tools |
} | ||
|
||
func generateLocalFilesystemURL(forRemoteURL url: URL, withChecksum checksum: Checksum?) -> URL? { | ||
let path = checksum?.value ?? url.absoluteString.asData.md5String |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the checksum should be unique, we don't need the md5 string of the url, correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is if we have a checksum. Images don't have one. So I'm falling back to the md5
// Set up file handling | ||
|
||
let tempFileURL = temporaryDirectory.appendingPathExtension(checksum?.value ?? url.pathExtension) | ||
let tempFileURL = temporaryDirectory.appendingPathComponent((checksum?.value ?? "") + url.lastPathComponent) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of empty string, should this be an md5 of the url? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file is deleted after we confirm that the download is valid and we move the contents to the permanent file location. So the md5 here matters little to me. I could even get rid of the checksum here I think. I really just need some text + the file extension. So the url.lastPathComponent
would really be all I need.
I specifically need to include the .mp4 or whatever it is there because the newer build tools (pretty sure it's due to Xcode build tools now, not iOS 26) for one reason or another do not consistently render the video without the file extension.
let path = checksum?.value ?? url.absoluteString.asData.md5String | ||
return cacheURL? | ||
.appendingPathComponent(url.absoluteString.asData.md5String) | ||
.appendingPathExtension(checksum?.value ?? url.pathExtension) | ||
.appendingPathComponent(path + url.lastPathComponent) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the fix. 2 things are different
- PathExtension -- putting the checksum in there was a mistake. It should have been a path component that ended with the path extension.
- I'm no longer chaining the calls. This seems to be a breaking change with iOS 26 (or perhaps the xcode26 build tools), the second call is ignored. Or something is severely wrong with my machine.
This results in the correct output in both Xcode 16.4 and Xcode 26
// Set up file handling | ||
|
||
let tempFileURL = temporaryDirectory.appendingPathExtension(checksum?.value ?? url.pathExtension) | ||
let tempFileURL = temporaryDirectory.appendingPathComponent((checksum?.value ?? "") + url.lastPathComponent) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This ended up being an issue too after changing the other file, moving didn't work. So I had to update this too.
.onReceive( | ||
stagedURL.publisher | ||
.eraseToAnyPublisher() | ||
.removeDuplicates() | ||
.debounce(for: 0.300, scheduler: RunLoop.main) | ||
) { output in | ||
// in the event that the download of the high res video is so fast that it tries to set the | ||
// url moments after the low_res was set, we need to delay a tiny bit to ensure the rerender | ||
// actually occurs. This happens consistently with small file sizes and great connection | ||
cachedURL = output | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was also not noticed until the editor changes merged because the high res and low res were the same file and therefore we just ignored the second one.
Checklist
purchases-android
and hybridsMotivation
Description