-
-
Notifications
You must be signed in to change notification settings - Fork 382
Resolve: Logged Out Between Sessions [tvOS] #1657
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
Conversation
.cachesDirectory
to .applicationSupportDirectory
@LePips I think this is good to go! I've successfully migrated 10 different simulators and confirmed they are working as expected. I adding a lot of logging for this but please let me know if it's done incorrectly or needs to be scaled up/down. Most of the logging I use in my day-to-day are for logs only I see so please let me know if there is a more standard way I should be approaching this. I've been testing this by loading everything onto a physical AppleTV. I will have the AppStore 1.0.1 version logged in and this branch logged in. I will then let both of these go into the background / close Swiftfin. I use VLC's tvOS to upload videos into the AppleTV's storage until it is full. Once it's full, I check both Swiftfins and find that 1.0.1 have been 'logged out' where the data has been cleared with the cache and this branch is still active and logged in. Please let me know if there is a more scientific method for testing this. I know this route is kind of a pain but I've been testing this one for the day and this appears to have fixed the "log out" issue. Either that, or it's just more resilient? Regardless, I think you were right that this is the correct move for resolving this! Finally, In my testing, the logic I have for the the tvOS New SQLiteStore private static let storage: SQLiteStore = {
let logger = Logging.Logger.swiftfin()
let applicationSupportDirectory = FileManager.default.urls(
for: .applicationSupportDirectory,
in: .userDomainMask
).first!
let databaseURL = applicationSupportDirectory.appendingPathComponent(bundleIdentifier, isDirectory: true)
.appendingPathComponent("Swiftfin.sqlite")
logger.info("Using the SQLite Database at: \(databaseURL.absoluteString)")
#if os(tvOS)
return SQLiteStore(
fileURL: databaseURL,
migrationMappingProviders: [Mappings.userV1_V2]
)
#else
return SQLiteStore(
fileName: "Swiftfin.sqlite",
migrationMappingProviders: [Mappings.userV1_V2]
)
#endif
}() |
Please test after my changes to see if it still works. |
I'll start testing now but I will likely need a couple hours get to run through it all. I'll reach out when I am done! |
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.
Thanks for testing!
Building current main for tvOS seems to result in a broken Swiftfin atm, it just hangs at a spinner. I think it's due to this PR. The dev console logs: When running on hardware (it previously had another Swiftfin tvOS installed build from main a week or so ago. Running it in a simulator is fine though (but that one was empty) Edit: removing swiftfin and rebooting the tvOS box results in the same and installing again results in the same. |
@LePips I am so sorry, @sjorge is right... I swear I tested this in like 30 different ways but I must have missed something. Clean installs are screwing up on hardware. I think is best to rollback while this is fresh. I can keep digging on my end to find a better route. Sorry, I know that's a huge pain... |
Glad I at least caught pretty quickly :) I try to bump my copy to main once a week or so. |
This reverts commit 3c51138.
Summary
Resolves: #776
Discussed: #1654 (comment)
From some feedback, I believe this resolves our tvOS logout issue by moving our data from
.cachesDirectory
to.applicationSupportDirectory
. This should mirror where this is places for iOS now. I have some build flags but I believe this should also work by using the same code for both iOS and tvOS. I wanted to start at this point to keep it separate since iOS is more up-to-date and I wanted to limit changes to the polished side of Swiftfin.I have added a migration as well to move files from the
.cachesDirectory
to.applicationSupportDirectory
if available. I put this inMappings
but please let me know if this is the incorrect move.This is WIP for now. I am going to throw some more testing at this first. I've done some testing this morning but I want to test a bit more to be safe. Additionally, I want to test the migration as well. Specifically, file migration + upgrade from 1.0.1 to Main.
Progress
.applicationSupportDirectory