Skip to content

Commit

Permalink
Display China license number in the Settings
Browse files Browse the repository at this point in the history
  • Loading branch information
felipeerias authored and svillar committed Feb 20, 2024
1 parent d5cf3b2 commit 81463c4
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
import com.igalia.wolvic.ui.widgets.dialogs.ClearUserDataDialogWidget;
import com.igalia.wolvic.ui.widgets.dialogs.RestartDialogWidget;
import com.igalia.wolvic.ui.widgets.dialogs.UIDialog;
import com.igalia.wolvic.utils.DeviceType;
import com.igalia.wolvic.utils.RemoteProperties;
import com.igalia.wolvic.utils.StringUtils;

Expand Down Expand Up @@ -202,14 +203,23 @@ public void updateUI() {
return view.performClick();
});

mBinding.surveyLink.setOnClickListener(v -> {
if (mAudio != null) {
mAudio.playSound(AudioEngine.Sound.CLICK);
}

mWidgetManager.openNewTabForeground(getResources().getString(R.string.survey_link));
exitWholeSettings();
});
if (DeviceType.getStoreType() == DeviceType.StoreType.MAINLAND_CHINA) {
mBinding.chinaLicenseNumber.setOnClickListener(v -> {
if (mAudio != null) {
mAudio.playSound(AudioEngine.Sound.CLICK);
}
mWidgetManager.openNewTabForeground(getResources().getString(R.string.rCN_license_link));
exitWholeSettings();
});
} else {
mBinding.surveyLink.setOnClickListener(v -> {
if (mAudio != null) {
mAudio.playSound(AudioEngine.Sound.CLICK);
}
mWidgetManager.openNewTabForeground(getResources().getString(R.string.survey_link));
exitWholeSettings();
});
}

mBinding.helpButton.setOnClickListener(view -> {
if (mAudio != null) {
Expand Down
19 changes: 18 additions & 1 deletion app/src/main/res/layout/settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
name="settingsmodel"
type="com.igalia.wolvic.ui.viewmodel.SettingsViewModel" />
<import type="com.igalia.wolvic.BuildConfig"/>
<import type="com.igalia.wolvic.utils.DeviceType" />
</data>

<androidx.constraintlayout.widget.ConstraintLayout
Expand Down Expand Up @@ -82,7 +83,23 @@
android:textColor="@color/azure"
android:autoLink="all"
android:textStyle="bold"
android:textSize="@dimen/text_smaller_size" />
android:textSize="@dimen/text_smaller_size"
app:visibleGone="@{DeviceType.getStoreType() != DeviceType.StoreType.MAINLAND_CHINA}" />

<TextView
android:id="@+id/chinaLicenseNumber"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="false"
android:fontFamily="sans-serif"
android:gravity="center"
android:text="@string/rCN_license_number"
android:textColor="@color/azure"
android:textColorHighlight="@android:color/transparent"
android:textColorLink="@color/azure"
android:textSize="@dimen/text_medium_size"
android:textStyle="bold"
app:visibleGone="@{DeviceType.getStoreType() == DeviceType.StoreType.MAINLAND_CHINA}" />

<TextView
android:id="@+id/buildText"
Expand Down
4 changes: 4 additions & 0 deletions app/src/main/res/values/non_L10n.xml
Original file line number Diff line number Diff line change
Expand Up @@ -231,4 +231,8 @@
<!-- Shared preferences key to store the list of installed Web apps (JSON string) -->
<string name="settings_key_web_apps_data" translatable="false">settings_key_web_apps_data</string>

<!-- China license number -->
<string name="rCN_license_number" translatable="false">ICP备案号:京ICP备2022006476号-10A</string>
<string name="rCN_license_link" translatable="false">https://beian.miit.gov.cn/</string>

</resources>

0 comments on commit 81463c4

Please sign in to comment.