Skip to content

Commit

Permalink
PIA-1108: Hide dynamic island on logout (#68)
Browse files Browse the repository at this point in the history
  • Loading branch information
kp-juan-docal authored Jan 29, 2024
1 parent a46bb33 commit b0b0689
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions PIA VPN/DashboardViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,9 @@ class DashboardViewController: AutolayoutViewController {
@objc private func accountDidLogout(notification: Notification) {
AppPreferences.shared.todayWidgetVpnStatus = nil
AppPreferences.shared.todayWidgetButtonTitle = L10n.Localizable.Today.Widget.login
if #available(iOS 16.2, *) {
stopConnectionLiveActivity()
}
presentLogin()
}

Expand Down Expand Up @@ -1252,4 +1255,11 @@ extension DashboardViewController {
let connState = makeLiveActivityStateForCurrentConnection()
liveActivityManager.startLiveActivity(with: connState)
}

@available(iOS 16.2, *)
private func stopConnectionLiveActivity() {
guard let appDelegate = UIApplication.shared.delegate as? AppDelegate,
let liveActivityManager = appDelegate.liveActivityManager else { return }
liveActivityManager.endLiveActivities()
}
}

0 comments on commit b0b0689

Please sign in to comment.