Skip to content

Commit

Permalink
Update restricted profile except expiration (#481)
Browse files Browse the repository at this point in the history
TV profiles were not updated until expiration.
  • Loading branch information
keeshux committed Jan 19, 2024
1 parent e3f4443 commit 24b08c4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Unreleased

### Fixed

- Restricted profile not updated. [#481](https://github.com/passepartoutvpn/passepartout-apple/pull/481)

## 2.3.5 (2024-01-19)

### Fixed
Expand Down
5 changes: 2 additions & 3 deletions Passepartout/App/Context/AppContext.swift
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ private extension AppContext {
}

guard productManager.isEligible(forFeature: .appleTV) else {
var restricted: Profile
var restricted = newProfile
let remainingMinutes: Int
let expirationDate: Date

Expand All @@ -158,15 +158,14 @@ private extension AppContext {
remainingMinutes = Int(currentExpirationDate.timeIntervalSinceNow / 60.0)
expirationDate = currentExpirationDate

restricted = existingProfile
restricted.connectionExpirationDate = currentExpirationDate
}
// otherwise, expire in N minutes from now
else {
remainingMinutes = Constants.InApp.tvLimitedMinutes
expirationDate = Date()
.addingTimeInterval(TimeInterval(remainingMinutes) * 60.0)

restricted = newProfile
restricted.connectionExpirationDate = expirationDate
}

Expand Down

0 comments on commit 24b08c4

Please sign in to comment.