Rather than redoing ProfileManager.observeLocal() altogether:
- Keep the existing profiles subscription (localSubscription)
- Reload ALL local profiles on NE notifications
The reload is "heavy" because each profile save causes a reload of ALL
profiles, but it's the most reliable approach and in the end, it only
takes 1-2msec. It can be improved later.
Partially reverts #1049, because the app did not sync when a VPN
configuration was deleted from the OS settings.
A tolerant way to cope with scattered approvals. That is, if a
platform build fails to upload, it will not prevent other
platforms from being sent to public_beta/app_review.
The app_store environment is also allowed despite errors, as the
platform builds may have been approved at different times.
This somehow deals with the lottery of getting an approval for
multiple platforms at the same time.
Fixes#1043
Especially useful on macOS and tvOS where Network Extension does not
retain this information when the profile is disabled. On these
platforms, there's no native way to tell the last used profile, so save
it to UserDefaults and fall back to it when tunnel.currentProfile is
nil.
This was not apparent on TestFlight, but features from single iOS and
macOS "Full version" purchases were not being credited on the Apple TV
because of the incomplete `#if` conditionals.
When level is .beta, it was relying on beta receipt exclusively without
falling back to production receipt.
This was preventing the sandbox receipt ("production" in TestFlight)
from being read unless the AppUserLevel was explicitly set to .freemium
(0).
The remote container is shared by ProfileManager and
PreferencesManager, but it must be the same for CloudKit sync
to work properly.
Externalize the logic of onEligibleFeatures() so that the
AppContext singleton can update the managers (and their
repositories) with the new remote store.
Now that the remote profile repository is reloaded every time that
eligible features change, the .removeDuplicates() may also be
restored. Just add a .dropFirst() to skip the initially empty
value of eligible features. Even when features are eventually empty,
a value is always emitted after IAPManager.reloadReceipt()
Lastly, enable Core Data lightweight migration.
Regressions from #1017
Only offer compensations to former purchasers:
- .appleTV to .full purchasers
- .full to .appleTV purchasers
Always suggest .fullTV to new purchasers.
Finally rename:
- .full to .iOS_macOS
- .fullTV to .allFeatures (lifetime)
Even if they haven't changed since the app was last sent to the
background.
Regression from #1019 where the initial .reloadReceipt() call was
wrapped in a Task to make it asynchronous.
Suggest whenever .fullTV is suggested. For this reason, subscriptions
are not suggested to existing full version purchasers, because they only
miss the one-time .appleTV purchase. Group purchases by feature products
and full version products, e.g.:
- Features
- Apple TV
- Full version
- Yearly
- Monthly
- Full
- Full + TV
Additionally, fix reloadReceipt() slowing down onLaunch() sometimes. The
warning sign would appear on restricted profiles until the receipt is
loaded.