From be3a4d4253f311c84be2c2700c2fe4d37e75528f Mon Sep 17 00:00:00 2001 From: Sergio Villar Senin Date: Wed, 27 Sep 2023 17:21:23 +0200 Subject: [PATCH] Move homepage URL to a resValue in build config We're removing it from the list of non translatable strings. Having it in the build config allows us to specify different start pages per flavour. In this case we're interested in providing a different one for the Chinese market as some of the experiences in the start page cannot be either viewed from mainland China or simply take a lot to load. So far we're using about:blank but we can change that in the future. --- app/build.gradle | 2 ++ .../common/shared/com/igalia/wolvic/browser/SettingsStore.java | 2 +- .../common/shared/com/igalia/wolvic/browser/engine/Session.java | 2 +- .../igalia/wolvic/ui/widgets/settings/DisplayOptionsView.java | 2 +- app/src/common/shared/com/igalia/wolvic/utils/UrlUtils.java | 2 +- app/src/main/res/values/non_L10n.xml | 1 - 6 files changed, 6 insertions(+), 5 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index db30beadc7..fd338cb24e 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -123,6 +123,7 @@ android { buildConfigField "String[]", "SPEECH_SERVICES", "{ com.igalia.wolvic.speech.SpeechServices.MEETKAI }" buildConfigField "Boolean", "SUPPORTS_SYSTEM_NOTIFICATIONS", "false" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + resValue 'string', 'HOMEPAGE_URL', "https://wolvic.com/start" externalNativeBuild { cmake { cppFlags "-std=c++14 -fexceptions -frtti -Werror" + @@ -369,6 +370,7 @@ android { buildConfigField "Boolean", "FXA_USE_CHINA_SERVER", "true" buildConfigField "Boolean", "WEBVIEW_IN_PHONE_UI", "true" buildConfigField "Boolean", "CN_FIRST_RUN_IN_PHONE_UI", "true" + resValue 'string', 'HOMEPAGE_URL', 'about:blank' } } diff --git a/app/src/common/shared/com/igalia/wolvic/browser/SettingsStore.java b/app/src/common/shared/com/igalia/wolvic/browser/SettingsStore.java index aeadcf7673..b0be2885cc 100644 --- a/app/src/common/shared/com/igalia/wolvic/browser/SettingsStore.java +++ b/app/src/common/shared/com/igalia/wolvic/browser/SettingsStore.java @@ -383,7 +383,7 @@ public void setInputMode(int aTouchMode) { public String getHomepage() { return mPrefs.getString( mContext.getString(R.string.settings_key_homepage), - mContext.getString(R.string.homepage_url)); + mContext.getString(R.string.HOMEPAGE_URL)); } public void setHomepage(String aHomepage) { diff --git a/app/src/common/shared/com/igalia/wolvic/browser/engine/Session.java b/app/src/common/shared/com/igalia/wolvic/browser/engine/Session.java index 63751b0235..f0ed2e729f 100644 --- a/app/src/common/shared/com/igalia/wolvic/browser/engine/Session.java +++ b/app/src/common/shared/com/igalia/wolvic/browser/engine/Session.java @@ -726,7 +726,7 @@ public void setRegion(String aRegion) { public String getHomeUri() { String homepage = SettingsStore.getInstance(mContext).getHomepage(); - if (homepage.equals(mContext.getString(R.string.homepage_url)) && mState.mRegion != null) { + if (homepage.equals(mContext.getString(R.string.HOMEPAGE_URL)) && mState.mRegion != null) { homepage = homepage + "?region=" + mState.mRegion; } return homepage; diff --git a/app/src/common/shared/com/igalia/wolvic/ui/widgets/settings/DisplayOptionsView.java b/app/src/common/shared/com/igalia/wolvic/ui/widgets/settings/DisplayOptionsView.java index 8115b22f08..cebca32d63 100644 --- a/app/src/common/shared/com/igalia/wolvic/ui/widgets/settings/DisplayOptionsView.java +++ b/app/src/common/shared/com/igalia/wolvic/ui/widgets/settings/DisplayOptionsView.java @@ -75,7 +75,7 @@ protected void updateUI() { mBinding.startWithPassthroughSwitch.setVisibility(View.GONE); } - mDefaultHomepageUrl = getContext().getString(R.string.homepage_url); + mDefaultHomepageUrl = getContext().getString(R.string.HOMEPAGE_URL); mBinding.homepageEdit.setHint1(getContext().getString(R.string.homepage_hint, getContext().getString(R.string.app_name))); mBinding.homepageEdit.setDefaultFirstValue(mDefaultHomepageUrl); diff --git a/app/src/common/shared/com/igalia/wolvic/utils/UrlUtils.java b/app/src/common/shared/com/igalia/wolvic/utils/UrlUtils.java index 21001aa6f3..edffa7e8cf 100644 --- a/app/src/common/shared/com/igalia/wolvic/utils/UrlUtils.java +++ b/app/src/common/shared/com/igalia/wolvic/utils/UrlUtils.java @@ -224,7 +224,7 @@ public static boolean isAboutPage(@Nullable String url) { } public static boolean isContentFeed(Context aContext, @Nullable String url) { - String feed = aContext.getString(R.string.homepage_url); + String feed = aContext.getString(R.string.HOMEPAGE_URL); return UrlUtils.getHost(feed).equalsIgnoreCase(UrlUtils.getHost(url)); } diff --git a/app/src/main/res/values/non_L10n.xml b/app/src/main/res/values/non_L10n.xml index b103075060..f1f6c62af2 100644 --- a/app/src/main/res/values/non_L10n.xml +++ b/app/src/main/res/values/non_L10n.xml @@ -2,7 +2,6 @@ Wolvic github.com/Igalia/wolvic/issues - https://wolvic.com/start settings_homepage settings_crash settings_locale