[PR #2925] feat(ios): add interactive VPN control widget #3016

Open
opened 2026-10-14 21:06:54 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/amnezia-vpn/amnezia-client/pull/2925
Author: @mikop63
Created: 8/2/2026
Status: 🔄 Open

Base: dev ← Head: feat/ios-vpn-control-widget


📝 Commits (2)

  • e163ea0 feat(ios): add VPN control widget
  • 3eda4ae docs(ios): document widget setup and testing

📊 Changes

21 files changed (+937 additions, -5 deletions)

View changed files

📝 client/cmake/ios.cmake (+7 -2)
📝 client/core/controllers/coreSignalHandlers.cpp (+98 -1)
📝 client/core/controllers/coreSignalHandlers.h (+1 -1)
📝 client/ios/app/Info.plist.in (+11 -0)
➕ client/ios/widget/AmneziaVPNWidget.entitlements (+10 -0)
➕ client/ios/widget/CMakeLists.txt (+75 -0)
➕ client/ios/widget/Info.plist.in (+31 -0)
➕ client/ios/widget/PrivacyInfo.xcprivacy (+10 -0)
➕ client/ios/widget/VPNControlWidget.swift (+210 -0)
➕ client/ios/widget/VPNControlWidgetPreviews.swift (+43 -0)
➕ client/ios/widget/VPNWidgetIntent.swift (+24 -0)
➕ client/ios/widget/en.lproj/Localizable.strings (+21 -0)
📝 client/platforms/ios/AmneziaSceneDelegateHooks.mm (+12 -1)
📝 client/platforms/ios/QtAppDelegate.mm (+7 -0)
➕ client/platforms/ios/VPNWidgetBridge.swift (+25 -0)
➕ client/platforms/ios/VPNWidgetState.swift (+142 -0)
📝 client/platforms/ios/ios_controller.h (+1 -0)
📝 client/platforms/ios/ios_controller.mm (+2 -0)
📝 client/vpnConnection.cpp (+1 -0)
➕ docs/ios-vpn-control-widget.md (+85 -0)

...and 1 more files

📄 Description

Adds an iOS Home Screen systemSmall WidgetKit widget for Amnezia VPN. The widget displays the latest known VPN state, selected protocol, and selected server/configuration name, and lets users request connect/disconnect from the Home Screen.

Motivation

Users can start or stop the selected VPN configuration from the Home Screen without manually navigating to the in-app power button.

Implementation Details

  • Adds a vpncontrolwidget WidgetKit extension target to the CMake-generated Xcode project.
  • Adds shared App Group state for widget display and short-lived action requests.
  • Adds a small WidgetKit UI with a prominent power control, state text, protocol label, and server label.
  • Adds iOS 17+ Button(intent:) support through ToggleVPNWidgetIntent.
  • Adds iOS 14-16 fallback through amneziavpn://widget/toggle.
  • Routes all actual VPN toggling through the existing ConnectionUiController and validation flow.
  • Reloads WidgetKit timelines when connection state or selected configuration changes.

Supported iOS Versions

  • Minimum supported iOS version remains 14.0.
  • Widget display is available on iOS 14+.
  • WidgetKit Button with AppIntent is used on iOS 17+.
  • iOS 14-16 uses the WidgetKit URL fallback.

Behavior Differences Between iOS Versions

  • iOS 14-16: tapping the widget opens the app with amneziavpn://widget/toggle.
  • iOS 17+: tapping the power button runs an AppIntent, stores a short-lived pending toggle request in the App Group, opens the app, and the app consumes the request.

Architecture And Shared State

The widget reads minimal state from group.org.amnezia.AmneziaVPN:

  • connection state;
  • selected protocol display name;
  • selected server display name;
  • saved tunnel display name;
  • configuration availability;
  • update and action timestamps.

The widget does not build VPN configurations and does not own connection-management logic. The main app remains the source of truth and uses the existing controllers to validate and connect/disconnect.

Entitlements And App Group Changes

  • Adds client/ios/widget/AmneziaVPNWidget.entitlements.
  • Requires the widget App ID and provisioning profile to include group.org.amnezia.AmneziaVPN.
  • Existing app and packet tunnel App Group usage is preserved.

Screenshots Or Previews

Widget previews are included for connected, disconnected, connecting, disconnecting, unavailable, and long-server-name states in client/ios/widget/VPNControlWidgetPreviews.swift.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/amnezia-vpn/amnezia-client/pull/2925 **Author:** [@mikop63](https://github.com/mikop63) **Created:** 8/2/2026 **Status:** 🔄 Open **Base:** `dev` ← **Head:** `feat/ios-vpn-control-widget` --- ### 📝 Commits (2) - [`e163ea0`](https://github.com/amnezia-vpn/amnezia-client/commit/e163ea03176bdd80a534f3c90a1cfcc5337f0e3c) feat(ios): add VPN control widget - [`3eda4ae`](https://github.com/amnezia-vpn/amnezia-client/commit/3eda4ae5de3c17e30180d40cb3d8580eaa652fd2) docs(ios): document widget setup and testing ### 📊 Changes **21 files changed** (+937 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `client/cmake/ios.cmake` (+7 -2) 📝 `client/core/controllers/coreSignalHandlers.cpp` (+98 -1) 📝 `client/core/controllers/coreSignalHandlers.h` (+1 -1) 📝 `client/ios/app/Info.plist.in` (+11 -0) ➕ `client/ios/widget/AmneziaVPNWidget.entitlements` (+10 -0) ➕ `client/ios/widget/CMakeLists.txt` (+75 -0) ➕ `client/ios/widget/Info.plist.in` (+31 -0) ➕ `client/ios/widget/PrivacyInfo.xcprivacy` (+10 -0) ➕ `client/ios/widget/VPNControlWidget.swift` (+210 -0) ➕ `client/ios/widget/VPNControlWidgetPreviews.swift` (+43 -0) ➕ `client/ios/widget/VPNWidgetIntent.swift` (+24 -0) ➕ `client/ios/widget/en.lproj/Localizable.strings` (+21 -0) 📝 `client/platforms/ios/AmneziaSceneDelegateHooks.mm` (+12 -1) 📝 `client/platforms/ios/QtAppDelegate.mm` (+7 -0) ➕ `client/platforms/ios/VPNWidgetBridge.swift` (+25 -0) ➕ `client/platforms/ios/VPNWidgetState.swift` (+142 -0) 📝 `client/platforms/ios/ios_controller.h` (+1 -0) 📝 `client/platforms/ios/ios_controller.mm` (+2 -0) 📝 `client/vpnConnection.cpp` (+1 -0) ➕ `docs/ios-vpn-control-widget.md` (+85 -0) _...and 1 more files_ </details> ### 📄 Description Adds an iOS Home Screen `systemSmall` WidgetKit widget for Amnezia VPN. The widget displays the latest known VPN state, selected protocol, and selected server/configuration name, and lets users request connect/disconnect from the Home Screen. # Motivation Users can start or stop the selected VPN configuration from the Home Screen without manually navigating to the in-app power button. # Implementation Details - Adds a `vpncontrolwidget` WidgetKit extension target to the CMake-generated Xcode project. - Adds shared App Group state for widget display and short-lived action requests. - Adds a small WidgetKit UI with a prominent power control, state text, protocol label, and server label. - Adds iOS 17+ `Button(intent:)` support through `ToggleVPNWidgetIntent`. - Adds iOS 14-16 fallback through `amneziavpn://widget/toggle`. - Routes all actual VPN toggling through the existing `ConnectionUiController` and validation flow. - Reloads WidgetKit timelines when connection state or selected configuration changes. # Supported iOS Versions - Minimum supported iOS version remains 14.0. - Widget display is available on iOS 14+. - WidgetKit `Button` with `AppIntent` is used on iOS 17+. - iOS 14-16 uses the WidgetKit URL fallback. # Behavior Differences Between iOS Versions - iOS 14-16: tapping the widget opens the app with `amneziavpn://widget/toggle`. - iOS 17+: tapping the power button runs an AppIntent, stores a short-lived pending toggle request in the App Group, opens the app, and the app consumes the request. # Architecture And Shared State The widget reads minimal state from `group.org.amnezia.AmneziaVPN`: - connection state; - selected protocol display name; - selected server display name; - saved tunnel display name; - configuration availability; - update and action timestamps. The widget does not build VPN configurations and does not own connection-management logic. The main app remains the source of truth and uses the existing controllers to validate and connect/disconnect. # Entitlements And App Group Changes - Adds `client/ios/widget/AmneziaVPNWidget.entitlements`. - Requires the widget App ID and provisioning profile to include `group.org.amnezia.AmneziaVPN`. - Existing app and packet tunnel App Group usage is preserved. # Screenshots Or Previews Widget previews are included for connected, disconnected, connecting, disconnecting, unavailable, and long-server-name states in `client/ios/widget/VPNControlWidgetPreviews.swift`. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
amnezia-vpn/amnezia-client#3016
No description provided.