Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add NetP widget #2142

Merged
merged 31 commits into from
Nov 13, 2023
Merged

Add NetP widget #2142

merged 31 commits into from
Nov 13, 2023

Conversation

samsymons
Copy link
Contributor

@samsymons samsymons commented Nov 9, 2023

Task/Issue URL: https://app.asana.com/0/414235014887631/1205921206830836/f
Tech Design URL:
CC: @graeme

Description:

This PR adds a NetP widget. It's only available in the debug and alpha builds, and only available on iOS 17.

Steps to test this PR:

  1. First, update the #if ALPHA checks in this PR to include DEBUG - the alpha checks are because we would like to get the widget into the alpha builds, but we need CI to support Xcode 15, which we can't do for any workflows that run tests unfortunately
  2. Run the app on your device
  3. Add the widget from the widget UI
  4. Toggle NetP within the app, check that the widget state updates accordingly
  5. Try the "Connect" and "Disconnect" buttons inside the widget - note that the widget does not show connecting/disconnecting states, this functionality is pretty hacky at the moment

Device Testing:

  • iPhone SE (1st Gen)
  • iPhone 8
  • iPhone X
  • iPhone 14 Pro
  • iPad

OS Testing:

  • iOS 14
  • iOS 15
  • iOS 16

Theme Testing:

  • Light theme
  • Dark theme

Internal references:

Software Engineering Expectations
Technical Design Template

* develop:
  Release 7.95.0 (#2122)
  Add toggling of NetP Notifications to iOS (#2112)
  Fix for deeplink crash when preparing webview preview (#2116)
  Integrates the latest DBP changes in BSK (#2108)
  Switch to next phase of new experiment for UA (#2118)
  Update BSK with autofill 9.0.0 (#2103)
  Add an “Open VPN Settings” quick action (#2089)
* develop:
  Add e2e test for email protection deep-links (#2123)
  Update to config v4 (#2114)
# By Christopher Brind (3) and others
# Via GitHub (1) and Michal Smaga (1)
* develop:
  Support environment setting (#2140)
  Update BSK (#2136)
  Update BSK for NetP change (#2134)
  Update test to match exact tracker (#2133)
  Avoid AppTP DB initialization when disabled (#2090)
  re-enable keyboard shortcuts (#2132)
  fix favorite launch with keyboard bug (#2131)
  Fix syncing empty favorites folders (#2121)
  kill variant when receiving atb update (#2130)
  Adding 'protectionsState' to breakage form submission (#2120)
  Release 7.96.0 (#2128)
  Update remote messaging production url (#2124)
  Alert user about abnormal app conditions (#2110)

# Conflicts:
#	DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
@samsymons samsymons requested a review from graeme November 9, 2023 22:30
mainViewController?.clearNavigationStack()
// mainViewController?.clearNavigationStack()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to fix this, it was getting in the way of the open URL functionality. I'll update it to avoid this check depending on the URL.

Copy link

github-actions bot commented Nov 9, 2023

Warnings
⚠️ PR has more than 500 lines of code changing. Consider splitting into smaller PRs if possible.

Generated by 🚫 dangerJS against 8163d28

@samsymons
Copy link
Contributor Author

⚠️ I just remembered that we don't yet support Xcode 15. I'll try and find a workaround for this - perhaps it can be used for the alpha build only.

@@ -209,6 +213,14 @@ final class NetworkProtectionPacketTunnelProvider: PacketTunnelProvider {
source.resume()
}
}

private func observeServerChanges() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should also utilise the observable UserDefaults pattern with this.

@available(iOSApplicationExtension 17.0, *)
struct VPNStatusView: View {
@Environment(\.widgetFamily) var family: WidgetFamily
var entry: VPNStatusTimelineProvider.Entry
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see that a lot of this has a very synchronous data flow. I’m not sure where the limitations lie with that but let’s have a quick chat about it now I’ve seen the PR.

Copy link
Contributor

@graeme graeme left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this looks generally good, but I’d like to try and understand a bit more about what the limitations are for us being able to observe changes from the extension. It might be that there’s still something we can do that hasn’t been tried to make it a bit more reactive.

Copy link
Contributor

@graeme graeme left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Look good! Just need to figure out what to do with the commented out code + also will need to come back to do Localization before shipping to external users. But that can be done in a later task.

* develop:
  Normalize ampUrl in breakage pixel (#2154)
  Bump submodules/privacy-reference-tests from `0d23f76` to `7519c3d` (#2135)
  Properly refresh home page favorites view when updating favorites display mode (#2148)
  Add DesignResourcesKit to SyncUI (#2147)
@samsymons samsymons merged commit 7243cb6 into develop Nov 13, 2023
9 checks passed
@samsymons samsymons deleted the sam/hack-days-netp-widget branch November 13, 2023 23:40
samsymons added a commit that referenced this pull request Nov 14, 2023
# By Brad Slayter (1) and others
# Via Graeme Arthur (2) and others
* develop:
  Add NetP widget (#2142)
  Normalize ampUrl in breakage pixel (#2154)
  Bump submodules/privacy-reference-tests from `0d23f76` to `7519c3d` (#2135)
  Properly refresh home page favorites view when updating favorites display mode (#2148)

# Conflicts:
#	DuckDuckGo/AppDelegate.swift
samsymons added a commit that referenced this pull request Nov 16, 2023
* develop: (36 commits)
  Rolls back a BSK change by mistake
  Updates BSK
  Updates BSK
  Document LinkPresentation usage (#2172)
  Autofill "Never Save for this Site" feature (#2104)
  Use upstream fastlane 2.217.0 (#2161)
  Update about screen (#2152)
  Fixes a crasher due to a test line merged by mistake. (#2162)
  remove return user pixel (#2146)
  Revert to auto signing (#2158)
  BSK changes for NetP iOS Geoswitching (#2141)
  Update sync e2e tests to new setup flow (#2151)
  Fix for duplicated "atb" in Pixel request (#2139)
  Updating tests to support latest reference tests (#2145)
  Add NetP widget (#2142)
  Normalize ampUrl in breakage pixel (#2154)
  Update embedded files
  Update version number
  Bump submodules/privacy-reference-tests from `0d23f76` to `7519c3d` (#2135)
  Properly refresh home page favorites view when updating favorites display mode (#2148)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants