Skip to content

Commit

Permalink
PIA-809: Update iOS application (#31)
Browse files Browse the repository at this point in the history
* Adds the functionality of in-app message for user survey and point to new commit sha on PIALibary module

* Corrects a module rename and points to new commit

* Code cleanup on weak self.

* Refactors the survey control logic into a UserSurveyManager.

This also changes responsibility of incrementing successConnections and moves it to AppPreferences. Small refactoring of RatingManager.

* Update for KPI module and new commit sha for client-library-apple.

* Refactors showRating method

* Fixes the > issue with take a survey CTA text

* Code refactor for handling connection success on rating and survey managers

* Revert to accidentally committing swiftgen file

* Removes more unwanted swiftgen changes

* Moves the string extension to private scope and applies a code refactor

* Update for an edge case where user has to interact with the survey message

* Points to correct commit sha for PIAKPI and PIALibrary modules

* Updates PIALibrary commit sha

* Updates commit sha

* Adds functionality to have a separate connections-counter for UserSurvey message banner logic

* Code refactor for User survey's separate counter

* Refactor on successConnectionUntilSurvey

* Updates commit sha and time_to_connect collection logic

* Code refactor and updates commit sha

* Code refactor

* Updates commit sha

* Updates to correct commit sha for KPI library

* Updates KPI commit sha

* Updates the commit for wrong ip fix

* Adds UI Test target

* Updates commit sha after merging client-library-apple for timeToConnect MR

* Adds a UI test for invalid user

* Updates commit sha

* Code refactor and adds PIALibrary to UITests target for accessibility identifiers

* Fixes a keyboard typing issue

* Adds a user credentials json file for testing different users

* Point to PIALibrary release/2.15.0

* Bump version to 3.15.0

* Use credentials from plist

* Refactor invalid user test to reuse it other tests

* Update PIALibrary commit, refactor and add valid user UI Test with updated accessibility identifiers

* Fix the environment and UI test target selection issues

* Remove XCTAssert as a function

* Remove unnecessary sleeps

* Update commit sha PIALibrary

* Update PIA Library commit & accessibility strings and code improvements

* Rename conversion bool

* Download translations and new en placeholders

* Update commit sha for PIALibrary

* Add deviceType and DNS info in user setting for CSI (wip)

* Update PIALibrary commit sha to avoid conflicts on closing release

* Update checksum

* Update integration with CSI V1.0.2

* Fix setting's delegate reference for updating DNS info in app preferences

* Update pod file commit sha

* Refactor code for device type

* Bump PIALibrary to 2.16.0 commit sha

* Bump version to 3.16.0

* Convert rating alert UI to use default iOS UX widgets

* Bump commit sha for feature flag

* Add control logic for showing default UX of rating alert

* Code cleaning

* Bump the version to 3.16.1

* Bump commit sha for token migration hotfix

* Flag rename and bump PIALibrary commit sha

* Code refactor

* Add translations for rating alert and DIP retry message

* Bump commit sha

* Update PIALibrary commit sha

* Bump commit sha for based PIALibrary

* Code clean

* Bump PIALibrary to v2.17.0

* Bump version to 3.17.0

* Bump PIARegions to v1.3.2

* Bump CSI to v1.1.1 and update support for Last Know Exception category on PIALibrary

* Bump PIALibrary to latest commit

* Refactor dip header view cell to move the network request code out of it

* Fix a bug where rating alert was re-presented when app was updated

* Refactor if into a guard statement

* Remove redundant deviceInfo key and bump PIALibrary to whitelist user_setting commit

* Bump to the fixed commit sha of file references fixes in PIALibrary

* Bump commit for PIALibrary

* Refactor fatalError to NSException for better CSI reports

* Rename user preference flag stopInAppMessages to showServiceMessages and bump the commit sha of PIALibrary

This is to make UI menu name consistent with flag name

* Fix the logic when API call should be made based on flag

* Bump PIALibrary to 2.18.0 commit sha

* Bump version 3.18.0

* Merge `release/3.19.0` into `master` (#1131)

* Fix develop branch for an issue where commit sha does not exist on client-library-apple

* Fix CSI and KPI dependencies

* Migrate to SPM

* Widget Cleanup

* Update to wireguard-apple `1.0.15-26`

* Add workflow pia-mobile/ios/vpn-ios

* Sync OpenVPN TunnelKit to version 4.0.3 (#1128)

* wip

* wip

* update dep

* bump version

* bump build number

* Fix signup storyboard crash (#1129)

* fix signup storyboard crash

* update to client-library-apple merged revision

* bump build version number to 20030 (#1130)

---------

Co-authored-by: Waleed Mahmood <[email protected]>
Co-authored-by: Juan Docal <[email protected]>
Co-authored-by: Bogdan Danila <[email protected]>

* remove messages logic (#1133)

* bump version to 3.20.0 (#1134)

* bump version to 3.21.0 (#1135)

* update openssl to version 3.0.2 (#1136)

* bump version to 3.22.0 (#1137)

* bump version to 3.23.0 (#1138)

* CXAPP-3161: Show leak protection toggles on privacy settings

* CXAPP-3160: Add feature flag feetching for leak protection

* CXAPP-3231: Add leak protections UI behind feature flag

* CXAPP-3162: Add logic to show and hide leak protection toggles

* CXAPP-3162: Add logic to show and hide leak protection toggles

* CXAPP-3165: Add alert for leak protection changes when VPN is connected

* CXAPP-3165: Update PIA iOS Library to the latest version

* PIA-68: Add Network monitor to identify non-compliant Wifi

* PIA-68: Integrate network monitor on HospotHelper

* PIA-54: Migrate currentRFC1918VulnerableWifi to Client preferences

* PIA-54: Add english localization for non compliant alert

* PIA-54: Add logic to show the non compliant WIFI alert

* PIA-54: Add logic to disable and reconnect CTA

* PIA-57: Update feature flags on dev builds from debug menu

* PIA-57: Skip updating feature flag values when pulling from CSI server on dev builds

* PIA-57: Show leak protection local notification
when connected to a non-compliant Wi-Fi network

* PIA-61: Remove leak protection notification when the device connects to a compliant wifi

* PIA-62: Remove leak protection local notification when VPN is disconnected

* PIA-325: Add logic to make sure we reconnect after disconnection was completed

* PIA-326: Show alert whencurrent vpn status is not connected

* PIA-56: Handle learn more action on leak protection alert

* PIA-63: Handle 'More info' action from the Leak Protection settings description

* PIA-337: Show leak protection content in English if no translations are available in other languages

* PIA-314: Add non-compliant check for current WIFI

* PIA-62: Remove leak proteciton notification when vpn is disconnected and app in the foreground

* PIA-335: Dismiss leak protection alert when disconnecting from quick action

* PIA-350: Show leak protection local notification in English when untranslated

* PIA-362: Remove leak protection alert when user connects to a compliant Wi-Fi

* Bump version to 3.23.1

* PIA-454: Disable UI tests and failing tests from target

* PIA-65: Hide leak protection settings when Wireguard is selected

* PIA-454: Add Fastlane setup

* PIA-454: Add CI congifuration

* PIA-415: Connection Live Activity and Dynamic Island POC

* PIA-490: Set feature flag for Dynamic Island Live Activity

* PIA-66: Add strings for non IKEV2 protocol alert

* PIA-66: Show non compliant alert for non IKEV2 protocol

* PIA-66: Enable leak protection and disable allow local devices

* Bump version to 3.23.2

* PIA-509: Execute pending actions when switching to IKEV2

* PIA-504: Update connection live activity and dynamic islanc UI

* PIA-417: Hook Connection state to Live Activity and Dynamic Island

* PIA-438: Bump version

* PIA-438: Add uploading to Testflight action

* PIA-438: Update CI to sign and upload builds

* PIA-438: Automate build number increase

* PIA-620: Update PIAAccount framework

* PIA-504: Update disconnected button and icon on Live Activity widget and Dynamic Island

* PIA-504: Localize text displayed on Live Activity and Dynamic Island

* PIA-540: PIA e2e testing setup
Login screen e2e tests

* PIA-540: Remove legacy ui testing target

* PIA-540: Set user credentials from ENV variables

* PIA-556: Update translations

* PIA-541: Allow VPN Profile installation e2e test
And add e2e example test on how to launch the app on authenticated state
and with the VPN Profile installation complete

* PIA-680: Add e2e workflow on CI

* - Integrated framework with Quick and Nimble
- Added Tests using Quick and Nimble
- Started the restructuring of directories

* - Integrated framework with Quick and Nimble
- Added Tests using Quick and Nimble
- Started the restructuring of directories
- Added Tests

* -  Enhanced based on PR Comments

* PIA-566: Update UI on regions cell to accomodate full text on smaller devices and different languages

* Enhanced FW by adding screens, helpers and rearranged structure

* PIA-560: Handle first region button from Quick Connect section

* PIA-832: Update app version to 3.23.4

* PIA-809: Update XCode on CI pipeline

---------

Co-authored-by: Waleed Mahmood <[email protected]>
Co-authored-by: Miguel Berrocal <[email protected]>
Co-authored-by: Helge Becker <[email protected]>
Co-authored-by: kp-juan-docal <[email protected]>
Co-authored-by: Juan Docal <[email protected]>
Co-authored-by: Bogdan Danila <[email protected]>
Co-authored-by: Said Rehouni <[email protected]>
Co-authored-by: kp-said-rehouni <[email protected]>
Co-authored-by: xv-laura-sempere <[email protected]>
Co-authored-by: Geneva Parayno <[email protected]>
Co-authored-by: xv-geneva-parayno <[email protected]>
  • Loading branch information
12 people authored Nov 7, 2023
1 parent 99e87c7 commit 374153f
Show file tree
Hide file tree
Showing 83 changed files with 2,839 additions and 950 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: pia_vpn_ios
on:
pull_request:
workflow_dispatch:
concurrency:
group: "${{ github.ref }}"
cancel-in-progress: true
jobs:
build:
runs-on: macos-13
env:
TEST_RUNNER_PIA_TEST_USER: ${{ secrets.PIA_ACCOUNT_USERNAME}}
TEST_RUNNER_PIA_TEST_PASSWORD: ${{ secrets.PIA_ACCOUNT_PASSWORD }}

steps:
- name: Setup Git credentials
run: |
git config --global url."https://${{ secrets.ORG_GITHUB_USERNAME }}:${{ secrets.ORG_GITHUB_TOKEN }}@github.com/".insteadOf "[email protected]:"
- uses: actions/checkout@v3

- name: Select XCode version
run: sudo xcode-select -s /Applications/Xcode_15.0.app

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7

- name: Install Fastlane
run: gem install fastlane

- name: Set credentials in fastlane env
run: echo "TEST_RUNNER_PIA_TEST_USER=${{ secrets.PIA_ACCOUNT_USERNAME}}"\n"TEST_RUNNER_PIA_TEST_PASSWORD=${{ secrets.PIA_ACCOUNT_PASSWORD }}" > fastlane/.env

- name: Check fastlane env
run: cat fastlane/.env

- name: Run e2e tests with fastlane
run: bundle exec fastlane e2e_tests
continue-on-error: true

- name: Run tests
run: bundle exec fastlane tests


51 changes: 51 additions & 0 deletions .github/workflows/testflight_deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: testflight_deploy
on:
push:
branches:
- master

workflow_dispatch:
concurrency:
group: "${{ github.ref }}"
cancel-in-progress: true
jobs:
build:
runs-on: macos-13
env:
CERTIFICATE_PASSWORD: ${{ secrets.CERTIFICATE_PASSWORD }}
KEYCHAIN_NAME: ${{ secrets.KEYCHAIN_NAME }}
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
APP_STORE_CONNECT_KEY_ID: ${{ secrets.APP_STORE_CONNECT_KEY_ID }}
APP_STORE_CONNECT_ISSUER_ID: ${{ secrets.APP_STORE_CONNECT_ISSUER_ID }}
APP_STORE_CONNECT_KEY: ${{ secrets.APP_STORE_CONNECT_KEY }}

steps:
- name: Setup Git credentials
run: |
git config --global url."https://${{ secrets.ORG_GITHUB_USERNAME }}:${{ secrets.ORG_GITHUB_TOKEN }}@github.com/".insteadOf "[email protected]:"
- uses: actions/checkout@v3

- name: Select XCode version
run: sudo xcode-select -s /Applications/Xcode_15.0.app

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7

- name: Install Fastlane
run: gem install fastlane

- name: Decode Certificates
run: echo "${{ secrets.IOS_CERTIFICATE }}" | base64 --decode > ./fastlane/Certificate.p12

- name: Run tests
run: bundle exec fastlane tests

- name: Set up certificates and profiles
run: bundle exec fastlane get_profiles > /dev/null 2>&1

- name: Upload version to TestFlight
run: bundle exec fastlane testflight_build

3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source "https://rubygems.org"

gem "fastlane"
407 changes: 279 additions & 128 deletions PIA VPN.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

31 changes: 25 additions & 6 deletions PIA VPN.xcodeproj/xcshareddata/xcschemes/PIA VPN dev.xcscheme
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0930"
version = "1.3">
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
Expand Down Expand Up @@ -54,7 +54,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
shouldUseLaunchSchemeArgsEnv = "NO">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
Expand All @@ -64,6 +64,24 @@
ReferencedContainer = "container:PIA VPN.xcodeproj">
</BuildableReference>
</MacroExpansion>
<EnvironmentVariables>
<EnvironmentVariable
key = "PIA_TEST_USER"
value = "xxx"
isEnabled = "YES">
</EnvironmentVariable>
<EnvironmentVariable
key = "PIA_TEST_PASSWORD"
value = "xxx"
isEnabled = "YES">
</EnvironmentVariable>
</EnvironmentVariables>
<TestPlans>
<TestPlanReference
reference = "container:PIA-VPN_E2E_Tests/PIA-VPN-e2e-simulator.xctestplan"
default = "YES">
</TestPlanReference>
</TestPlans>
<Testables>
<TestableReference
skipped = "NO">
Expand All @@ -76,12 +94,13 @@
</BuildableReference>
</TestableReference>
<TestableReference
skipped = "NO">
skipped = "NO"
parallelizable = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "7EB8D11227CCF4C20030B060"
BuildableName = "PIA VPN UITests.xctest"
BlueprintName = "PIA VPN UITests"
BlueprintIdentifier = "69B70AAF2ACBF51C0072A09D"
BuildableName = "PIA-VPN_E2E_Tests.xctest"
BlueprintName = "PIA-VPN_E2E_Tests"
ReferencedContainer = "container:PIA VPN.xcodeproj">
</BuildableReference>
</TestableReference>
Expand Down
14 changes: 14 additions & 0 deletions PIA VPN.xcodeproj/xcshareddata/xcschemes/PIA VPN.xcscheme
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,20 @@
ReferencedContainer = "container:PIA VPN.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "NO"
buildForRunning = "NO"
buildForProfiling = "NO"
buildForArchiving = "NO"
buildForAnalyzing = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "7EB8D11227CCF4C20030B060"
BuildableName = "PIA VPN UITests.xctest"
BlueprintName = "PIA VPN UITests"
ReferencedContainer = "container:PIA VPN.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1430"
version = "2.2">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "NO"
buildForProfiling = "NO"
buildForArchiving = "NO"
buildForAnalyzing = "NO">
<AutocreatedTestPlanReference>
</AutocreatedTestPlanReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
shouldAutocreateTestPlan = "YES">
<Testables>
<TestableReference
skipped = "NO"
parallelizable = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "69B70AAF2ACBF51C0072A09D"
BuildableName = "PIA-VPN_E2E_Tests.xctest"
BlueprintName = "PIA-VPN_E2E_Tests"
ReferencedContainer = "container:PIA VPN.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<EnvironmentVariables>
<EnvironmentVariable
key = "PIA_TEST_USER"
value = "xxx"
isEnabled = "YES">
</EnvironmentVariable>
<EnvironmentVariable
key = "PIA_TEST_PASSWORD"
value = "xxx"
isEnabled = "YES">
</EnvironmentVariable>
</EnvironmentVariables>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
48 changes: 48 additions & 0 deletions PIA VPN/AccessibilityId.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@

import Foundation

public struct AccessibilityId {
public struct VPNPermission {
public static let screen = "id.vpnPermission.screen"
public static let submit = "id.vpnPermission.ok.button"
}

public struct Dashboard {
public static let connectionButton = "id.dashboard.connection.button"
}

}


/// This is the same struct `Accessibility` from `PIALibrary`
/// It has been copied over to the VPN ios client app to
/// facilitate e2e testing.
/// In the future, we will move the Welcome and Login ViewControllers and storyboards from `PIALibrary` into vpn ios
/// And this duplication will not be necessary
public struct PIALibraryAccessibility {
public struct Id {
public struct Welcome {
public static let environment = "id.welcome.environment"
}
public struct Login {
public static let submit = "id.login.submit"
public static let submitNew = "id.login.submit.new"
public static let username = "id.login.username"
public static let password = "id.login.submit"
public struct Error {
public static let banner = "id.login.error.banner"
}
}

public struct Dashboard {
public static let menu = "id.dashboard.menu"
}
public struct Menu {
public static let logout = "id.menu.logout"
}
public struct Dialog {
public static let destructive = "id.dialog.destructive.button"
}
}
}

21 changes: 20 additions & 1 deletion PIA VPN/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class AppDelegate: NSObject, UIApplicationDelegate {

var window: UIWindow?
private var hotspotHelper: PIAHotspotHelper!
private (set) var liveActivityManager: PIAConnectionLiveActivityManagerType?

deinit {
NotificationCenter.default.removeObserver(self)
Expand All @@ -55,12 +56,27 @@ class AppDelegate: NSObject, UIApplicationDelegate {
application.shortcutItems = []
hotspotHelper = PIAHotspotHelper()
_ = hotspotHelper.configureHotspotHelper()


instantiateLiveActivityManagerIfNeeded()
return true
}

private func instantiateLiveActivityManagerIfNeeded() {
if #available(iOS 16.2, *) {
// Only instantiates the LiveActivities if the Feature Flag for it is enabled
guard AppPreferences.shared.showDynamicIslandLiveActivity else {
liveActivityManager = nil
return
}

liveActivityManager = PIAConnectionLiveActivityManager.shared
}
}

func applicationWillTerminate(_ application: UIApplication) {
Bootstrapper.shared.dispose()

liveActivityManager?.endLiveActivities()
}

// MARK: Orientations
Expand Down Expand Up @@ -200,6 +216,9 @@ class AppDelegate: NSObject, UIApplicationDelegate {
application.applicationIconBadgeNumber = 0
// Remove the Non compliant Wifi local notification as the app is in foreground now
Macros.removeLocalNotification(NotificationCategory.nonCompliantWifi)

instantiateLiveActivityManagerIfNeeded()

}

private func refreshShortcutItems(in application: UIApplication) {
Expand Down
10 changes: 10 additions & 0 deletions PIA VPN/AppPreferences.swift
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ class AppPreferences {
static let showNewInitialScreen = "showNewInitialScreen"
static let showLeakProtection = "showLeakProtection"
static let showLeakProtectionNotifications = "showLeakProtectionNotifications"
static let showDynamicIslandLiveActivity = "showDynamicIslandLiveActivity"

// Survey
static let userInteractedWithSurvey = "userInteractedWithSurvey"
Expand Down Expand Up @@ -537,6 +538,15 @@ class AppPreferences {
defaults.set(newValue, forKey: Entries.showLeakProtectionNotifications)
}
}

var showDynamicIslandLiveActivity: Bool {
get {
return defaults.bool(forKey: Entries.showDynamicIslandLiveActivity)
}
set {
defaults.set(newValue, forKey: Entries.showDynamicIslandLiveActivity)
}
}

var checksDipExpirationRequest: Bool {
get {
Expand Down
Loading

0 comments on commit 374153f

Please sign in to comment.