LeoKlaus / plappa

An Audiobook client for Jellyfin and AudioBookShelf, written in Swift/SwiftUI.
https://plappa.me
233 stars 1 forks source link

[BUG] Premium Features not retained after App restart #219

Open 20CCAA07 opened 2 days ago

20CCAA07 commented 2 days ago

Describe the bug I am experiencing an issue with the app repeatedly forgetting that I have already purchased the premium version (One-Time Purchase). Each time the app gets restarted, all premium features are deactivated and I need to use the "Restore Purchases" option to re-enable them.

To Reproduce Steps to reproduce the behavior:

  1. Go to settings
  2. Click on "$ Support Development"
  3. Click on "Restore Purchases"
  4. Verify that premium functionality (for instance playing downloaded audio books while being offline) is working
  5. Close App (either force close or restart phone)
  6. Reopen App

Expected behavior After restarting the phone or reopening the app, all premium functions should still be unlocked.

Environment(please complete the following information):

Additional context Please note: I noticed this behavior only on an iPhone X (in app purchase via family sharing). On the iPhone 15 Pro with iOS 18.1 and Plappa 2.16.2, the described issue does not happen. So maybe this is somehow related to iOS 16?

LeoKlaus commented 1 day ago

Hi Pascal, thank you for reporting this!

It's interesting that this happens only on one of your devices. Are both of them using the same Apple ID? If not, is one of the devices sharing the purchase through family sharing?

Can you send me the debug logs from plappa after this happens? You can find them at the bottom of the settings tab (make sure to censor private information, if applicable).

20CCAA07 commented 1 day ago

Hi Leo,

Thanks for your reply.

Both phones use a different Apple ID. I bought the app through my Apple ID (iPhone 15 Pro) and shared it with my son's Apple ID (iPhone X) through family sharing.

Here is the debug log:

[13.11.2024, 12:50] [CoreDataHandler] Initializing core data store... [13.11.2024, 12:50] [CoreDataHandler] CoreData store initialized [13.11.2024, 12:50] [PlaybackStateHandler] Syncing playback states through server [13.11.2024, 12:50] [PlaybackSessionHandler] Syncing playback sessions through server [13.11.2024, 12:50] [plappa] Encountered an error while loading audio files: Es besteht anscheinend keine Verbindung zum Internet. Error Domain=NSURLErrorDomain Code=-1009 "Es besteht anscheinend keine Verbindung zum Internet." UserInfo={_kCFStreamErrorCodeKey=50, NSUnderlyingError=0x282161860 {Error Domain=kCFErrorDomainCFNetwork Code=-1009 "(null)" UserInfo={_NSURLErrorNWPathKey=unsatisfied (No network route), _kCFStreamErrorCodeKey=50, _kCFStreamErrorDomainKey=1}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <4896C122-34D1-4430-BA02-19A003B10441>.<2>, _NSURLErrorRelatedURLSessionTaskErrorKey=(     "LocalDataTask <4896C122-34D1-4430-BA02-19A003B10441>.<2>" ), NSLocalizedDescription=Es besteht anscheinend keine Verbindung zum Internet., NSErrorFailingURLStringKey=http://, NSErrorFailingURLKey=http://, _kCFStreamErrorDomainKey=1} [13.11.2024, 12:50] [StoreKitHandler] Failed - error retrieving products StoreKit.StoreKitError.networkError(Foundation.URLError(_nsError: Error Domain=NSURLErrorDomain Code=-1008 "(null)")) [13.11.2024, 12:50] [AudioBookShelfAPIHandler] Couldn't connect to server: Es besteht anscheinend keine Verbindung zum Internet. [13.11.2024, 12:50] [PlaybackSessionHandler] Couldn't sync session: Error Domain=NSURLErrorDomain Code=-1009 UserInfo={_kCFStreamErrorCodeKey=50, NSUnderlyingError=0x2821dedf0 {Error Domain=kCFErrorDomainCFNetwork Code=-1009 UserInfo={_NSURLErrorNWPathKey=unsatisfied (No network route), _kCFStreamErrorCodeKey=50, _kCFStreamErrorDomainKey=1}}, _NSURLErrorFailingURLSessionTaskErrorKey=, _NSURLErrorRelatedURLSessionTaskErrorKey=, NSLocalizedDescription=, NSErrorFailingURLStringKey=, NSErrorFailingURLKey=, _kCFStreamErrorDomainKey=1} [13.11.2024, 12:50] [AudioBookShelfAPIHandler] No changes in session, not pushing... [13.11.2024, 12:50] [AudioBookShelfAPIHandler] No changes in session, not pushing... [13.11.2024, 12:50] [AudioBookShelfAPIHandler] No changes in session, not pushing... [13.11.2024, 12:50] [SoundHandler] Tried to save playback state with invalid audiobook. [13.11.2024, 12:50] [PlaybackSessionHandler] Couldn't sync session: Error Domain=NSURLErrorDomain Code=-1009 UserInfo={_kCFStreamErrorCodeKey=50, NSUnderlyingError=0x28213ff60 {Error Domain=kCFErrorDomainCFNetwork Code=-1009 UserInfo={_NSURLErrorNWPathKey=unsatisfied (No network route), _kCFStreamErrorCodeKey=50, _kCFStreamErrorDomainKey=1}}, _NSURLErrorFailingURLSessionTaskErrorKey=, _NSURLErrorRelatedURLSessionTaskErrorKey=, NSLocalizedDescription=, NSErrorFailingURLStringKey=, NSErrorFailingURLKey=, _kCFStreamErrorDomainKey=1}

While checking, I noticed that this problem only occurs when the phone is offline. The above log file has been taken while the device was not connected to the internet (plane mode on, wifi off). Once I turned on wifi and restarted the app, the in app purchase was registered. Here is the log, when being online:

[13.11.2024, 13:00] [CoreDataHandler] Initializing core data store... [13.11.2024, 13:00] [CoreDataHandler] CoreData store initialized [13.11.2024, 13:00] [PlaybackStateHandler] Syncing playback states through server [13.11.2024, 13:00] [PlaybackSessionHandler] Syncing playback sessions through server [13.11.2024, 13:00] [StoreKitHandler] unlocked!