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

CATROID-1199 Link to flavors from settings #4431

Merged
merged 1 commit into from
Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,10 @@ public void setUp() throws Exception {
.getDefaultSharedPreferences(ApplicationProvider.getApplicationContext());

nxtSettingBuffer = sharedPreferences
.getBoolean(SettingsFragment.SETTINGS_MINDSTORMS_NXT_BRICKS_ENABLED, false);
.getBoolean(SettingsFragment.SETTINGS_MINDSTORMS_NXT_BRICKS_CHECKBOX_PREFERENCE, false);

sharedPreferences.edit()
.putBoolean(SettingsFragment.SETTINGS_MINDSTORMS_NXT_BRICKS_ENABLED, true)
.putBoolean(SettingsFragment.SETTINGS_MINDSTORMS_NXT_BRICKS_CHECKBOX_PREFERENCE, true)
.commit();

sensorMappingBuffer = SettingsFragment.getLegoNXTSensorMapping(ApplicationProvider.getApplicationContext());
Expand All @@ -105,7 +105,7 @@ public void tearDown() throws Exception {
logger.disconnectAndDestroy();

PreferenceManager.getDefaultSharedPreferences(ApplicationProvider.getApplicationContext()).edit()
.putBoolean(SettingsFragment.SETTINGS_MINDSTORMS_NXT_BRICKS_ENABLED, nxtSettingBuffer)
.putBoolean(SettingsFragment.SETTINGS_MINDSTORMS_NXT_BRICKS_CHECKBOX_PREFERENCE, nxtSettingBuffer)
.commit();
setSensorMapping(sensorMappingBuffer);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,8 @@
import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertTrue;

import static org.catrobat.catroid.ui.settingsfragments.SettingsFragment.SETTINGS_MINDSTORMS_EV3_BRICKS_ENABLED;
import static org.catrobat.catroid.ui.settingsfragments.SettingsFragment.SETTINGS_MINDSTORMS_NXT_BRICKS_ENABLED;
import static org.catrobat.catroid.ui.settingsfragments.SettingsFragment.SETTINGS_MINDSTORMS_EV3_BRICKS_CHECKBOX_PREFERENCE;
import static org.catrobat.catroid.ui.settingsfragments.SettingsFragment.SETTINGS_MINDSTORMS_NXT_BRICKS_CHECKBOX_PREFERENCE;
import static org.catrobat.catroid.ui.settingsfragments.SettingsFragment.SETTINGS_SHOW_AI_FACE_DETECTION_SENSORS;
import static org.catrobat.catroid.ui.settingsfragments.SettingsFragment.SETTINGS_SHOW_AI_POSE_DETECTION_SENSORS;
import static org.catrobat.catroid.ui.settingsfragments.SettingsFragment.SETTINGS_SHOW_AI_SPEECH_RECOGNITION_SENSORS;
Expand All @@ -224,7 +224,7 @@
import static org.catrobat.catroid.ui.settingsfragments.SettingsFragment.SETTINGS_SHOW_JUMPING_SUMO_BRICKS;
import static org.catrobat.catroid.ui.settingsfragments.SettingsFragment.SETTINGS_SHOW_NFC_BRICKS;
import static org.catrobat.catroid.ui.settingsfragments.SettingsFragment.SETTINGS_SHOW_PARROT_AR_DRONE_BRICKS;
import static org.catrobat.catroid.ui.settingsfragments.SettingsFragment.SETTINGS_SHOW_PHIRO_BRICKS;
import static org.catrobat.catroid.ui.settingsfragments.SettingsFragment.SETTINGS_SHOW_PHIRO_BRICKS_CHECKBOX_PREFERENCE;
import static org.catrobat.catroid.ui.settingsfragments.SettingsFragment.SETTINGS_SHOW_RASPI_BRICKS;
import static org.catrobat.catroid.uiespresso.util.matchers.rtl.RtlViewDirection.isViewRtl;
import static org.hamcrest.Matchers.allOf;
Expand All @@ -247,8 +247,8 @@ public class RtlBrickTest {
SpriteActivity.FRAGMENT_SCRIPTS);

private Locale arLocale = new Locale("ar");
private List<String> allPeripheralCategories = new ArrayList<>(Arrays.asList(SETTINGS_MINDSTORMS_NXT_BRICKS_ENABLED,
SETTINGS_MINDSTORMS_EV3_BRICKS_ENABLED, SETTINGS_SHOW_PARROT_AR_DRONE_BRICKS, SETTINGS_SHOW_PHIRO_BRICKS,
private List<String> allPeripheralCategories = new ArrayList<>(Arrays.asList(SETTINGS_MINDSTORMS_NXT_BRICKS_CHECKBOX_PREFERENCE,
SETTINGS_MINDSTORMS_EV3_BRICKS_CHECKBOX_PREFERENCE, SETTINGS_SHOW_PARROT_AR_DRONE_BRICKS, SETTINGS_SHOW_PHIRO_BRICKS_CHECKBOX_PREFERENCE,
SETTINGS_SHOW_ARDUINO_BRICKS, SETTINGS_SHOW_RASPI_BRICKS, SETTINGS_SHOW_NFC_BRICKS,
SETTINGS_SHOW_JUMPING_SUMO_BRICKS, SETTINGS_SHOW_AI_SPEECH_RECOGNITION_SENSORS,
SETTINGS_SHOW_AI_SPEECH_SYNTHETIZATION_SENSORS,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -792,10 +792,10 @@ class FormulaEditorSensorListTest(

private val allShowBrickSettings: List<String> = listOf(
SettingsFragment.SETTINGS_SHOW_ARDUINO_BRICKS,
SettingsFragment.SETTINGS_SHOW_PHIRO_BRICKS,
SettingsFragment.SETTINGS_SHOW_PHIRO_BRICKS_CHECKBOX_PREFERENCE,
SettingsFragment.SETTINGS_SHOW_NFC_BRICKS,
SettingsFragment.SETTINGS_MINDSTORMS_NXT_BRICKS_ENABLED,
SettingsFragment.SETTINGS_MINDSTORMS_EV3_BRICKS_ENABLED,
SettingsFragment.SETTINGS_MINDSTORMS_NXT_BRICKS_CHECKBOX_PREFERENCE,
SettingsFragment.SETTINGS_MINDSTORMS_EV3_BRICKS_CHECKBOX_PREFERENCE,
SettingsFragment.SETTINGS_SHOW_PARROT_AR_DRONE_BRICKS,
SettingsFragment.SETTINGS_SHOW_RASPI_BRICKS,
SettingsFragment.SETTINGS_CAST_GLOBALLY_ENABLED,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@
import android.content.Intent;
import android.content.SharedPreferences;
import android.net.Uri;
import android.os.Build;
import android.preference.PreferenceManager;

import org.catrobat.catroid.BuildConfig;
import org.catrobat.catroid.R;
import org.catrobat.catroid.common.Constants;
import org.catrobat.catroid.testsuites.annotations.Cat;
Expand Down Expand Up @@ -64,9 +66,9 @@
import static org.catrobat.catroid.common.SharedPreferenceKeys.LANGUAGE_TAGS;
import static org.catrobat.catroid.ui.settingsfragments.SettingsFragment.SETTINGS_CAST_GLOBALLY_ENABLED;
import static org.catrobat.catroid.ui.settingsfragments.SettingsFragment.SETTINGS_CRASH_REPORTS;
import static org.catrobat.catroid.ui.settingsfragments.SettingsFragment.SETTINGS_MINDSTORMS_EV3_BRICKS_ENABLED;
import static org.catrobat.catroid.ui.settingsfragments.SettingsFragment.SETTINGS_MINDSTORMS_EV3_BRICKS_CHECKBOX_PREFERENCE;
import static org.catrobat.catroid.ui.settingsfragments.SettingsFragment.SETTINGS_MINDSTORMS_EV3_SHOW_SENSOR_INFO_BOX_DISABLED;
import static org.catrobat.catroid.ui.settingsfragments.SettingsFragment.SETTINGS_MINDSTORMS_NXT_BRICKS_ENABLED;
import static org.catrobat.catroid.ui.settingsfragments.SettingsFragment.SETTINGS_MINDSTORMS_NXT_BRICKS_CHECKBOX_PREFERENCE;
import static org.catrobat.catroid.ui.settingsfragments.SettingsFragment.SETTINGS_MINDSTORMS_NXT_SHOW_SENSOR_INFO_BOX_DISABLED;
import static org.catrobat.catroid.ui.settingsfragments.SettingsFragment.SETTINGS_MULTIPLAYER_VARIABLES_ENABLED;
import static org.catrobat.catroid.ui.settingsfragments.SettingsFragment.SETTINGS_SHOW_AI_FACE_DETECTION_SENSORS;
Expand All @@ -75,11 +77,12 @@
import static org.catrobat.catroid.ui.settingsfragments.SettingsFragment.SETTINGS_SHOW_AI_SPEECH_SYNTHETIZATION_SENSORS;
import static org.catrobat.catroid.ui.settingsfragments.SettingsFragment.SETTINGS_SHOW_AI_TEXT_RECOGNITION_SENSORS;
import static org.catrobat.catroid.ui.settingsfragments.SettingsFragment.SETTINGS_SHOW_ARDUINO_BRICKS;
import static org.catrobat.catroid.ui.settingsfragments.SettingsFragment.SETTINGS_SHOW_EMBROIDERY_BRICKS_CHECKBOX_PREFERENCE;
import static org.catrobat.catroid.ui.settingsfragments.SettingsFragment.SETTINGS_SHOW_HINTS;
import static org.catrobat.catroid.ui.settingsfragments.SettingsFragment.SETTINGS_SHOW_JUMPING_SUMO_BRICKS;
import static org.catrobat.catroid.ui.settingsfragments.SettingsFragment.SETTINGS_SHOW_NFC_BRICKS;
import static org.catrobat.catroid.ui.settingsfragments.SettingsFragment.SETTINGS_SHOW_PARROT_AR_DRONE_BRICKS;
import static org.catrobat.catroid.ui.settingsfragments.SettingsFragment.SETTINGS_SHOW_PHIRO_BRICKS;
import static org.catrobat.catroid.ui.settingsfragments.SettingsFragment.SETTINGS_SHOW_PHIRO_BRICKS_CHECKBOX_PREFERENCE;
import static org.catrobat.catroid.ui.settingsfragments.SettingsFragment.SETTINGS_SHOW_RASPI_BRICKS;
import static org.hamcrest.Matchers.hasToString;
import static org.hamcrest.Matchers.instanceOf;
Expand Down Expand Up @@ -108,9 +111,12 @@ public class SettingsFragmentTest {
BaseActivityTestRule<>(SettingsActivity.class, true, false);

private List<String> allSettings = new ArrayList<>(Arrays.asList(SETTINGS_SHOW_ARDUINO_BRICKS,
SETTINGS_SHOW_PHIRO_BRICKS, SETTINGS_SHOW_NFC_BRICKS, SETTINGS_SHOW_HINTS, SETTINGS_CRASH_REPORTS,
SETTINGS_MINDSTORMS_NXT_BRICKS_ENABLED, SETTINGS_MINDSTORMS_NXT_SHOW_SENSOR_INFO_BOX_DISABLED,
SETTINGS_MINDSTORMS_EV3_BRICKS_ENABLED, SETTINGS_MINDSTORMS_EV3_SHOW_SENSOR_INFO_BOX_DISABLED,
SETTINGS_SHOW_PHIRO_BRICKS_CHECKBOX_PREFERENCE, SETTINGS_SHOW_NFC_BRICKS, SETTINGS_SHOW_HINTS,
SETTINGS_CRASH_REPORTS, SETTINGS_MINDSTORMS_NXT_BRICKS_CHECKBOX_PREFERENCE,
SETTINGS_MINDSTORMS_NXT_SHOW_SENSOR_INFO_BOX_DISABLED,
SETTINGS_MINDSTORMS_EV3_BRICKS_CHECKBOX_PREFERENCE,
SETTINGS_MINDSTORMS_EV3_SHOW_SENSOR_INFO_BOX_DISABLED,
SETTINGS_SHOW_EMBROIDERY_BRICKS_CHECKBOX_PREFERENCE,
SETTINGS_SHOW_PARROT_AR_DRONE_BRICKS, SETTINGS_SHOW_JUMPING_SUMO_BRICKS,
SETTINGS_SHOW_RASPI_BRICKS, SETTINGS_MULTIPLAYER_VARIABLES_ENABLED,
SETTINGS_CAST_GLOBALLY_ENABLED, SETTINGS_SHOW_AI_SPEECH_RECOGNITION_SENSORS,
Expand Down Expand Up @@ -168,7 +174,19 @@ public void tearDown() {
@Test
public void basicSettingsTest() {
checkPreference(R.string.preference_title_enable_arduino_bricks, SETTINGS_SHOW_ARDUINO_BRICKS);
checkPreference(R.string.preference_title_enable_phiro_bricks, SETTINGS_SHOW_PHIRO_BRICKS);

if (BuildConfig.FLAVOR.equals(Constants.FLAVOR_PHIRO)) {
checkPreference(R.string.preference_title_enable_phiro_bricks, SETTINGS_SHOW_PHIRO_BRICKS_CHECKBOX_PREFERENCE);
} else {
openAppstoreDialog(R.string.preference_title_enable_phiro_bricks);
}

if (BuildConfig.FLAVOR.equals(Constants.FLAVOR_EMBROIDERY_DESIGNER)) {
checkPreference(R.string.preference_title_enable_embroidery_bricks, SETTINGS_SHOW_EMBROIDERY_BRICKS_CHECKBOX_PREFERENCE);
} else {
openAppstoreDialog(R.string.preference_title_enable_embroidery_bricks);
}

checkPreference(R.string.preference_title_enable_jumpingsumo_bricks, SETTINGS_SHOW_JUMPING_SUMO_BRICKS);
checkPreference(R.string.preference_title_enable_nfc_bricks, SETTINGS_SHOW_NFC_BRICKS);
checkPreference(R.string.preference_title_enable_hints, SETTINGS_SHOW_HINTS);
Expand Down Expand Up @@ -196,7 +214,12 @@ public void legoNxtSettingsTest() {
onData(PreferenceMatchers.withTitle(R.string.preference_title_enable_mindstorms_nxt_bricks))
.perform(click());

checkPreference(R.string.preference_title_enable_mindstorms_nxt_bricks, SETTINGS_MINDSTORMS_NXT_BRICKS_ENABLED);
if (BuildConfig.FLAVOR.equals(Constants.FLAVOR_LEGO_NXT_EV3)) {
checkPreference(R.string.preference_title_enable_mindstorms_nxt_bricks, SETTINGS_MINDSTORMS_NXT_BRICKS_CHECKBOX_PREFERENCE);
} else {
openAppstoreDialog(R.string.preference_title_enable_mindstorms_nxt_bricks);
}

checkPreference(R.string.preference_disable_nxt_info_dialog, SETTINGS_MINDSTORMS_NXT_SHOW_SENSOR_INFO_BOX_DISABLED);
}

Expand All @@ -206,7 +229,12 @@ public void legoEv3SettingsTest() {
onData(PreferenceMatchers.withTitle(R.string.preference_title_enable_mindstorms_ev3_bricks))
.perform(click());

checkPreference(R.string.preference_title_enable_mindstorms_ev3_bricks, SETTINGS_MINDSTORMS_EV3_BRICKS_ENABLED);
if (BuildConfig.FLAVOR.equals(Constants.FLAVOR_LEGO_NXT_EV3)) {
checkPreference(R.string.preference_title_enable_mindstorms_ev3_bricks, SETTINGS_MINDSTORMS_EV3_BRICKS_CHECKBOX_PREFERENCE);
} else {
openAppstoreDialog(R.string.preference_title_enable_mindstorms_ev3_bricks);
}

checkPreference(R.string.preference_disable_nxt_info_dialog,
SETTINGS_MINDSTORMS_EV3_SHOW_SENSOR_INFO_BOX_DISABLED);
}
Expand Down Expand Up @@ -296,4 +324,20 @@ private void checkPreference(int displayedTitleResourceString, String sharedPref

assertTrue(sharedPreferences.getBoolean(sharedPreferenceTag, false));
}

private void openAppstoreDialog(int displayedTitleResourceString) {
onData(PreferenceMatchers.withTitle(displayedTitleResourceString))
.perform(click());

if (!Build.BRAND.equals(Constants.DEVICE_BRAND_HUAWEI)) {
onView(withText(R.string.preference_dialog_google_play))
.check(matches(isDisplayed()));
} else {
onView(withText(R.string.preference_dialog_appgallery))
.check(matches(isDisplayed()));
}

onView(withText(R.string.cancel_button_text))
.perform(click());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ public void setUp() throws Exception {
.getDefaultSharedPreferences(ApplicationProvider.getApplicationContext());

nxtSettingBuffer = sharedPreferences
.getBoolean(SettingsFragment.SETTINGS_MINDSTORMS_NXT_BRICKS_ENABLED, false);
.getBoolean(SettingsFragment.SETTINGS_MINDSTORMS_NXT_BRICKS_CHECKBOX_PREFERENCE, false);

sharedPreferences.edit()
.putBoolean(SettingsFragment.SETTINGS_MINDSTORMS_NXT_BRICKS_ENABLED, true)
.putBoolean(SettingsFragment.SETTINGS_MINDSTORMS_NXT_BRICKS_CHECKBOX_PREFERENCE, true)
.commit();

sensorMappingBuffer = SettingsFragment.getLegoNXTSensorMapping(ApplicationProvider.getApplicationContext());
Expand Down Expand Up @@ -130,7 +130,7 @@ public void checkDialogTest() {
@After
public void tearDown() throws IOException {
PreferenceManager.getDefaultSharedPreferences(ApplicationProvider.getApplicationContext()).edit()
.putBoolean(SettingsFragment.SETTINGS_MINDSTORMS_NXT_BRICKS_ENABLED, nxtSettingBuffer)
.putBoolean(SettingsFragment.SETTINGS_MINDSTORMS_NXT_BRICKS_CHECKBOX_PREFERENCE, nxtSettingBuffer)
.commit();

SettingsFragment
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public void setUp() throws Exception {
script.addBrick(new ChangeSizeByNBrick(0));

nxtSettingBuffer = PreferenceManager.getDefaultSharedPreferences(ApplicationProvider.getApplicationContext())
.getBoolean(SettingsFragment.SETTINGS_MINDSTORMS_NXT_BRICKS_ENABLED, false);
.getBoolean(SettingsFragment.SETTINGS_MINDSTORMS_NXT_BRICKS_CHECKBOX_PREFERENCE, false);

setNXTBrickSetting(true);

Expand Down Expand Up @@ -118,7 +118,7 @@ public void tearDown() throws IOException {

private void setNXTBrickSetting(boolean bricksEnabled) {
PreferenceManager.getDefaultSharedPreferences(ApplicationProvider.getApplicationContext()).edit()
.putBoolean(SettingsFragment.SETTINGS_MINDSTORMS_NXT_BRICKS_ENABLED, bricksEnabled)
.putBoolean(SettingsFragment.SETTINGS_MINDSTORMS_NXT_BRICKS_CHECKBOX_PREFERENCE, bricksEnabled)
.commit();
}
}
16 changes: 16 additions & 0 deletions catroid/src/main/java/org/catrobat/catroid/common/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,22 @@ public final class Constants {
ExifInterface.TAG_CAMARA_OWNER_NAME
));

public static final String FLAVOR_POCKET_CODE = "catroid";
public static final String FLAVOR_EMBROIDERY_DESIGNER = "embroideryDesigner";
public static final String FLAVOR_LEGO_NXT_EV3 = "mindstorms";
public static final String FLAVOR_PHIRO = "phiro";
public static final String FLAVOR_LUNA_AND_CAT = "lunaAndCat";
public static final String FLAVOR_CREATE_AT_SCHOOL = "createAtSchool";

public static final String PREFRENCE_PLAYSTORE_EMBROIDERY_URL = "https://play.google.com/store/apps/details?id=org.catrobat.catroid.embroiderydesigner";
public static final String PREFRENCE_APPGALLERY_EMBROIDERY_URL = "https://appgallery.huawei.com/app/C100085769";
public static final String PREFRENCE_PLAYSTORE_MINDSTORMS_URL = "https://play.google.com/store/apps/details?id=org.catrobat.catroid";
public static final String PREFRENCE_APPGALLERY_MINDSTORMS_URL = "https://appgallery.huawei.com/app/C100085769";
public static final String PREFRENCE_PLAYSTORE_PHIRO_URL = "https://play.google.com/store/apps/details?id=org.catrobat.catroid.phiro";
public static final String PREFRENCE_APPGALLERY_PHIRO_URL = "https://appgallery.huawei.com/app/C100085769";

public static final String DEVICE_BRAND_HUAWEI = "huawei";

private Constants() {
throw new AssertionError("No.");
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
/*
* Catroid: An on-device visual programming system for Android devices
* Copyright (C) 2010-2022 The Catrobat Team
* (<http://developer.catrobat.org/credits>)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* An additional term exception under section 7 of the GNU Affero
* General Public License, version 3, is available at
* http://developer.catrobat.org/license_additional_term
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.catrobat.catroid.ui.recyclerview.dialog

import android.app.Dialog
import android.content.Intent
import android.net.Uri
import android.os.Bundle
import android.view.View
import android.widget.TextView
import androidx.appcompat.app.AlertDialog
import androidx.fragment.app.DialogFragment
import org.catrobat.catroid.R
import org.catrobat.catroid.common.Constants

class AppStoreDialogFragment : DialogFragment() {

companion object {
val TAG: String = AppStoreDialogFragment::class.java.simpleName

enum class Extension {
LEGO_NXT_EV3,
PHIRO,
EMBROIDERY
}

@JvmStatic
fun newInstance(extension: Extension): AppStoreDialogFragment {
val dialog = AppStoreDialogFragment()
dialog.extension = extension
return dialog
}
}

private lateinit var extension: Extension

override fun onCreateDialog(bundle: Bundle?): Dialog {
val view = View.inflate(activity, R.layout.dialog_google_play, null)

val text = view.findViewById<TextView>(R.id.dialog_google_play_text)
text.text = when (extension) {
Extension.LEGO_NXT_EV3 -> getString(R.string.preference_lego_dialog_text)
Extension.EMBROIDERY -> getString(R.string.preference_embroidery_dialog_text)
Extension.PHIRO -> getString(R.string.preference_phiro_dialog_text)
}

val builder: AlertDialog.Builder = AlertDialog.Builder(requireActivity())
.setTitle(getString(R.string.preference_dialog_use_full_features))
.setView(view)
.setNegativeButton(R.string.cancel_button_text, null)

val buttonText = if (android.os.Build.BRAND != Constants.DEVICE_BRAND_HUAWEI) {
getString(R.string.preference_dialog_google_play)
} else {
getString(R.string.preference_dialog_appgallery)
}

builder.setPositiveButton(buttonText) { _, _ ->
val intent = Intent(Intent.ACTION_VIEW)
intent.data = Uri.parse(getCorrectUrl())
startActivity(intent)
}

return builder.create()
}

private fun getCorrectUrl(): String {
return if (android.os.Build.BRAND != Constants.DEVICE_BRAND_HUAWEI) {
when (extension) {
Extension.LEGO_NXT_EV3 -> Constants.PREFRENCE_PLAYSTORE_MINDSTORMS_URL
Extension.EMBROIDERY -> Constants.PREFRENCE_PLAYSTORE_EMBROIDERY_URL
Extension.PHIRO -> Constants.PREFRENCE_PLAYSTORE_PHIRO_URL
}
} else {
when (extension) {
Extension.LEGO_NXT_EV3 -> Constants.PREFRENCE_APPGALLERY_MINDSTORMS_URL
Extension.EMBROIDERY -> Constants.PREFRENCE_APPGALLERY_EMBROIDERY_URL
Extension.PHIRO -> Constants.PREFRENCE_APPGALLERY_PHIRO_URL
}
}
}
}
Loading