From 5e9b339cf491405e559682fc70a902e790747726 Mon Sep 17 00:00:00 2001 From: deep Date: Fri, 17 Jun 2022 14:31:26 -0400 Subject: [PATCH 1/2] Resolve vpn support --- .../chrome/browser/settings/BraveVpnPreferences.java | 5 ++--- .../browser/vpn/activities/BraveVpnSupportActivity.java | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/android/java/org/chromium/chrome/browser/settings/BraveVpnPreferences.java b/android/java/org/chromium/chrome/browser/settings/BraveVpnPreferences.java index aa5742d988cf..9843d498fbd4 100644 --- a/android/java/org/chromium/chrome/browser/settings/BraveVpnPreferences.java +++ b/android/java/org/chromium/chrome/browser/settings/BraveVpnPreferences.java @@ -27,6 +27,7 @@ import org.chromium.base.Log; import org.chromium.chrome.R; import org.chromium.chrome.browser.InternetConnection; +import org.chromium.chrome.browser.customtabs.CustomTabActivity; import org.chromium.chrome.browser.settings.BravePreferenceFragment; import org.chromium.chrome.browser.vpn.BraveVpnNativeWorker; import org.chromium.chrome.browser.vpn.BraveVpnObserver; @@ -133,9 +134,7 @@ public boolean onPreferenceClick(Preference preference) { .setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference preference) { - Intent browserIntent = - new Intent(Intent.ACTION_VIEW, Uri.parse(VPN_SUPPORT_PAGE)); - getActivity().startActivity(browserIntent); + CustomTabActivity.showInfoPage(getActivity(), VPN_SUPPORT_PAGE); return true; } }); diff --git a/android/java/org/chromium/chrome/browser/vpn/activities/BraveVpnSupportActivity.java b/android/java/org/chromium/chrome/browser/vpn/activities/BraveVpnSupportActivity.java index 349aa73bcdd0..f2ff04c23c70 100644 --- a/android/java/org/chromium/chrome/browser/vpn/activities/BraveVpnSupportActivity.java +++ b/android/java/org/chromium/chrome/browser/vpn/activities/BraveVpnSupportActivity.java @@ -90,7 +90,7 @@ public void onCheckedChanged(RadioGroup group, int checkedId) { @Override public void onClick(View v) { StringBuilder bodyText = new StringBuilder( - "\n\n\n\n\n#### Please do not edit any information below ####\n"); + "\n\n\n\n\n#### Brave doesn’t track you or know how you use our app, so we don’t know how you’ve set up VPN. Please share info about the issue you’re experiencing and we’ll do our best to resolve it as soon as we can. ####\n"); if (vpnHostnameSwitch.isChecked()) { bodyText.append("\n\nVPN Hostname\n" + BraveVpnPrefUtils.getHostname()); } From 691ecadd849e843b41f72e1f20d368ebcc5136e5 Mon Sep 17 00:00:00 2001 From: deep Date: Fri, 17 Jun 2022 16:13:01 -0400 Subject: [PATCH 2/2] Add string resources --- .../activities/BraveVpnSupportActivity.java | 41 +++++++++++-------- .../vpn/utils/BraveVpnApiResponseUtils.java | 1 - .../android/strings/android_brave_strings.grd | 30 ++++++++++++++ 3 files changed, 54 insertions(+), 18 deletions(-) diff --git a/android/java/org/chromium/chrome/browser/vpn/activities/BraveVpnSupportActivity.java b/android/java/org/chromium/chrome/browser/vpn/activities/BraveVpnSupportActivity.java index f2ff04c23c70..f7cd125cf5ae 100644 --- a/android/java/org/chromium/chrome/browser/vpn/activities/BraveVpnSupportActivity.java +++ b/android/java/org/chromium/chrome/browser/vpn/activities/BraveVpnSupportActivity.java @@ -89,41 +89,48 @@ public void onCheckedChanged(RadioGroup group, int checkedId) { btnContinueToEmail.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - StringBuilder bodyText = new StringBuilder( - "\n\n\n\n\n#### Brave doesn’t track you or know how you use our app, so we don’t know how you’ve set up VPN. Please share info about the issue you’re experiencing and we’ll do our best to resolve it as soon as we can. ####\n"); + StringBuilder bodyText = + new StringBuilder(getResources().getString(R.string.support_email_text)); if (vpnHostnameSwitch.isChecked()) { - bodyText.append("\n\nVPN Hostname\n" + BraveVpnPrefUtils.getHostname()); + bodyText.append(String.format(getResources().getString(R.string.vpn_host_text), + BraveVpnPrefUtils.getHostname())); } if (subscriptionTypeSwitch.isChecked()) { - bodyText.append("\n\nSubscription Type\n" + BraveVpnPrefUtils.getProductId()); + bodyText.append( + String.format(getResources().getString(R.string.subscription_type_text), + BraveVpnPrefUtils.getProductId())); } if (appReceiptSwitch.isChecked()) { bodyText.append( - "\n\nPlay store token\n" + BraveVpnPrefUtils.getPurchaseToken()); + String.format(getResources().getString(R.string.playstore_token_text), + BraveVpnPrefUtils.getPurchaseToken())); } if (appVersionSwitch.isChecked()) { - bodyText.append("\n\nApp Version\n" - + AboutChromeSettings.getApplicationVersion( - BraveVpnSupportActivity.this, - AboutSettingsBridge.getApplicationVersion())); + bodyText.append(String.format( + getResources().getString(R.string.app_version_text), + AboutChromeSettings.getApplicationVersion(BraveVpnSupportActivity.this, + AboutSettingsBridge.getApplicationVersion()))); } if (timezoneSwitch.isChecked()) { - bodyText.append("\n\nTimezone\n").append(TimeZone.getDefault().getID()); + bodyText.append(getResources().getString(R.string.timezone_text)) + .append(TimeZone.getDefault().getID()); } if (networkTypeSwitch.isChecked()) { - bodyText.append("\n\nNetwork Type\n").append(getNetworkType()); + bodyText.append(getResources().getString(R.string.network_type_text)) + .append(getNetworkType()); } if (cellularCarrierSwitch.isChecked()) { - bodyText.append("\n\nCellular Carrier\n").append(getCellularCarrier()); + bodyText.append(getResources().getString(R.string.cellular_carrier_text)) + .append(getCellularCarrier()); } - bodyText.append("\n\nOther Issue\n"); + bodyText.append(getResources().getString(R.string.other_issue_text)); AppCompatRadioButton checkedRadioButton = findViewById(otherIssuesRadioGroup.getCheckedRadioButtonId()); - bodyText.append(checkedRadioButton.getText() + "\n"); - bodyText.append("\n\nPlatform\n") - .append("Android" - + "\n"); + bodyText.append(checkedRadioButton.getText()).append("\n"); + bodyText.append(getResources().getString(R.string.platform_text)) + .append("Android") + .append("\n"); composeEmail(bodyText.toString()); } diff --git a/android/java/org/chromium/chrome/browser/vpn/utils/BraveVpnApiResponseUtils.java b/android/java/org/chromium/chrome/browser/vpn/utils/BraveVpnApiResponseUtils.java index 5c0db17583fe..6ad6dfcbd57c 100644 --- a/android/java/org/chromium/chrome/browser/vpn/utils/BraveVpnApiResponseUtils.java +++ b/android/java/org/chromium/chrome/browser/vpn/utils/BraveVpnApiResponseUtils.java @@ -24,7 +24,6 @@ public class BraveVpnApiResponseUtils { public static void queryPurchaseFailed(Activity activity) { - BraveVpnPrefUtils.setPurchaseToken(""); BraveVpnPrefUtils.setProductId(""); BraveVpnPrefUtils.setPurchaseExpiry(0L); BraveVpnPrefUtils.setSubscriptionPurchase(false); diff --git a/browser/ui/android/strings/android_brave_strings.grd b/browser/ui/android/strings/android_brave_strings.grd index d38c2886e62b..35034958bdd4 100644 --- a/browser/ui/android/strings/android_brave_strings.grd +++ b/browser/ui/android/strings/android_brave_strings.grd @@ -3052,6 +3052,36 @@ If you don't accept this request, VPN will not reconnect and your internet conne Display Web3 notifications + + \n\n\n\n#### Brave doesn’t track you or know how you use our app, so we don’t know how you’ve set up VPN. Please share info about the issue you’re experiencing and we’ll do our best to resolve it as soon as we can. ####\n\n + + + \n\nVPN Hostname\n %1$s + + + \n\nSubscription Type\n %1$s + + + \n\nPlaystore Token\n %1$s + + + \n\nApp Version\n %1$s + + + \n\nTimezone\n + + + \n\nNetwork Type\n + + + \n\nCellular Carrier\n + + + \n\nOther Issue\n + + + \n\nPlatform\n +