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

Fix VPN uninstall not working for App Store users. #2951

Merged
merged 1 commit into from
Jul 9, 2024

Conversation

diegoreymendez
Copy link
Contributor

@diegoreymendez diegoreymendez commented Jul 8, 2024

Task/Issue URL: https://app.asana.com/0/1203108348835387/1207749767717701/f

Description

App Store users can't uninstall the VPN due to an issue with the VPN menu app target name.

Testing

Since making a test App Store release build isn't trivial, this can be checked by looking at some files instead. That said once this is merged we should quickly make a new internal build and check that the VPN works correctly.

Test 1: Verify the product name is right

  1. Check out the comments in ManualAppStoreRelease.xcconfig... you need to uncomment a line in that file to make a manual build
  2. Archive an App Store release build (won't need to run it, so just archiving is enough)
  3. Once the archive is created, right click on it (from the Organizer in Xcode) and select "Show in Finder"
  4. Right click on the archive and "Show package Contents"
  5. Go into Products > Applications > DuckDuckGo.app > Contents and open Info.plist
  6. Check that AGENT_PRODUCT_NAME is DuckDuckGo VPN
  7. Go into Library > LoginItems and check that the VPN menu app is named DuckDuckGo VPN.app

Test 2: Test the VPN in debug

Reset all changes and ensure the VPN works fine in debug builds.

Definition of Done:


Internal references:

Pull Request Review Checklist
Software Engineering Expectations
Technical Design Template
Pull Request Documentation

@diegoreymendez diegoreymendez self-assigned this Jul 8, 2024
@github-actions github-actions bot added the bot: not in app board Added by automation for pull requests with tasks not added to macOS App Board Asana project label Jul 8, 2024
@diegoreymendez diegoreymendez marked this pull request as ready for review July 8, 2024 16:34
@diegoreymendez diegoreymendez removed the bot: not in app board Added by automation for pull requests with tasks not added to macOS App Board Asana project label Jul 8, 2024
@@ -9531,7 +9531,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "# Embeds login items for the App Store build.\n\n# Skip login item embedding for release builds until they're ready to go live.\nif [ \"${CONFIGURATION}\" = \"Release\" ]; then\n VPN_AGENT_NAME=\"${AGENT_RELEASE_PRODUCT_NAME}\"\n PIR_AGENT_NAME=\"${DBP_BACKGROUND_AGENT_RELEASE_PRODUCT_NAME}\"\nelse\n VPN_AGENT_NAME=\"${AGENT_PRODUCT_NAME}\"\n PIR_AGENT_NAME=\"${DBP_BACKGROUND_AGENT_PRODUCT_NAME}\"\nfi\n\nVPN_AGENT_ORIGIN=$(readlink -f \"${CONFIGURATION_BUILD_DIR}/${VPN_AGENT_NAME}.app\")\nPIR_AGENT_ORIGIN=$(readlink -f \"${CONFIGURATION_BUILD_DIR}/${PIR_AGENT_NAME}.app\")\nAGENT_DESTINATION=\"${CONFIGURATION_BUILD_DIR}/${CONTENTS_FOLDER_PATH}/Library/LoginItems\"\n \n# Make sure that Library/LoginItems exists before copying\nmkdir -p \"$AGENT_DESTINATION\"\n \necho \"Copying VPN agent from $VPN_AGENT_ORIGIN to $AGENT_DESTINATION\"\nrsync -r --links \"$VPN_AGENT_ORIGIN\" \"$AGENT_DESTINATION\"\n \necho \"Copying Personal Information Removal agent from $PIR_AGENT_ORIGIN to $AGENT_DESTINATION\"\nrsync -r --links \"$PIR_AGENT_ORIGIN\" \"$AGENT_DESTINATION\"\n";
shellScript = "# Embeds login items for the App Store build.\n\n# Skip login item embedding for release builds until they're ready to go live.\nif [ \"${CONFIGURATION}\" = \"Release\" ]; then\n PIR_AGENT_NAME=\"${DBP_BACKGROUND_AGENT_RELEASE_PRODUCT_NAME}\"\nelse\n PIR_AGENT_NAME=\"${DBP_BACKGROUND_AGENT_PRODUCT_NAME}\"\nfi\n\nVPN_AGENT_NAME=\"${AGENT_PRODUCT_NAME}\"\n\nif [ -z \"$VPN_AGENT_NAME\" ]; then\n echo \"VPN_AGENT_NAME is empty.\"\n exit 1\nelif [ -z \"$PIR_AGENT_NAME\" ]; then\n echo \"PIR_AGENT_NAME is empty.\"\n exit 1\nelse\n echo \"Both VPN_AGENT_NAME and PIR_AGENT_NAME are set.\"\n echo \"VPN_AGENT_NAME is set to '$VPN_AGENT_NAME'.\"\n echo \"PIR_AGENT_NAME is set to '$PIR_AGENT_NAME'.\"\nfi\n\nVPN_AGENT_ORIGIN=$(readlink -f \"${CONFIGURATION_BUILD_DIR}/${VPN_AGENT_NAME}.app\")\nPIR_AGENT_ORIGIN=$(readlink -f \"${CONFIGURATION_BUILD_DIR}/${PIR_AGENT_NAME}.app\")\nAGENT_DESTINATION=\"${CONFIGURATION_BUILD_DIR}/${CONTENTS_FOLDER_PATH}/Library/LoginItems\"\n \n# Make sure that Library/LoginItems exists before copying\nmkdir -p \"$AGENT_DESTINATION\"\n \necho \"Copying VPN agent from $VPN_AGENT_ORIGIN to $AGENT_DESTINATION\"\nrsync -r --links \"$VPN_AGENT_ORIGIN\" \"$AGENT_DESTINATION\"\n \necho \"Copying Personal Information Removal agent from $PIR_AGENT_ORIGIN to $AGENT_DESTINATION\"\nrsync -r --links \"$PIR_AGENT_ORIGIN\" \"$AGENT_DESTINATION\"\n";
Copy link
Contributor Author

Choose a reason for hiding this comment

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

You might want to look at this in Xcode. Basically removed the override and just use AGENT_PRODUCT_NAME.

I've also added a check to ensure that VPN_AGENT_NAME and PIR_AGENT_NAME are not empty, since if they're empty some really odd stuff happens later in the build.

@@ -54,7 +54,7 @@ AGENT_BUNDLE_ID[config=CI][sdk=*] = $(AGENT_BUNDLE_ID_BASE).debug
AGENT_BUNDLE_ID[config=Review][sdk=*] = $(AGENT_BUNDLE_ID_BASE).review

AGENT_PRODUCT_NAME = DuckDuckGo VPN App Store
AGENT_RELEASE_PRODUCT_NAME = DuckDuckGo VPN
AGENT_PRODUCT_NAME[config=Release][sdk=*] = DuckDuckGo VPN
Copy link
Contributor Author

@diegoreymendez diegoreymendez Jul 8, 2024

Choose a reason for hiding this comment

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

Quite honestly there should be no difference in just setting this directly, because in the end we were loading this value directly into the product name.

Additionally AGENT_PRODUCT_NAME is saved in Info.plist so that the code knows what the agent product name is - this is what was causing the issue since the app was trying to launch the VPN menu app with the wrong product name (loaded from info.plist).

@@ -44,7 +44,7 @@ CODE_SIGN_IDENTITY[config=CI][sdk=macosx*] =
PRODUCT_NAME_PREFIX = $(AGENT_PRODUCT_NAME)
PRODUCT_NAME = $(AGENT_PRODUCT_NAME)
PRODUCT_NAME[config=Review][arch=*][sdk=*] = $(AGENT_PRODUCT_NAME)
PRODUCT_NAME[config=Release][arch=*][sdk=*] = $(AGENT_RELEASE_PRODUCT_NAME)
PRODUCT_NAME[config=Release][arch=*][sdk=*] = $(AGENT_PRODUCT_NAME)
Copy link
Contributor Author

@diegoreymendez diegoreymendez Jul 8, 2024

Choose a reason for hiding this comment

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

Read my comment below. Even though we always use AGENT_PRODUCT_NAME this is specifically expanded because the value of AGENT_PRODUCT_NAME is different for release builds, and Xcode otherwise seems to miss it.

@github-actions github-actions bot added the bot: not in app board Added by automation for pull requests with tasks not added to macOS App Board Asana project label Jul 8, 2024
@diegoreymendez diegoreymendez requested review from samsymons and ayoy and removed request for ayoy and samsymons July 8, 2024 16:45
@diegoreymendez diegoreymendez removed the bot: not in app board Added by automation for pull requests with tasks not added to macOS App Board Asana project label Jul 8, 2024
Copy link
Collaborator

@samsymons samsymons left a comment

Choose a reason for hiding this comment

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

From what I can see, this works well. The archived App Store build includes the VPN agent with the correct product name, and other build types were unaffected when testing, even when making multiple builds of various types.

@diegoreymendez diegoreymendez changed the base branch from main to release/1.96.0 July 9, 2024 07:20
@diegoreymendez diegoreymendez merged commit 5c5b256 into release/1.96.0 Jul 9, 2024
52 of 56 checks passed
@diegoreymendez diegoreymendez deleted the diego/try-fix-appstore-uninstall-2 branch July 9, 2024 07:22
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