[android]: Fix a crash on the start

Follow up 70a0ffa "Removed metrics and local notifications"

Signed-off-by: Roman Tsisyk <roman@tsisyk.com>
This commit is contained in:
Roman Tsisyk 2021-03-27 21:03:59 +03:00
parent ab4662bf19
commit a68e23e0f7
2 changed files with 4 additions and 6 deletions

View file

@ -495,8 +495,6 @@ public class Framework
public static native void nativeSetActiveSubscription(@SubscriptionType int type,
boolean isActive, boolean isTrial);
public static native int nativeGetCurrentTipIndex();
@Nullable
public static native String nativeGetAccessToken();

View file

@ -22,6 +22,7 @@ import uk.co.samuelwall.materialtaptargetprompt.MaterialTapTargetPrompt;
import java.util.Arrays;
import java.util.List;
import java.util.Random;
public enum Tutorial
{
@ -102,6 +103,7 @@ public enum Tutorial
private static final Logger LOGGER = LoggerFactory.INSTANCE.getLogger(LoggerFactory.Type.MISC);
private static final String TAG = Tutorial.class.getSimpleName();
private static final Random RANDOM = new Random();
@StringRes
private final int mPrimaryText;
@ -174,10 +176,8 @@ public enum Tutorial
if (MwmApplication.from(context).isFirstLaunch())
return STUB;
int index = Framework.nativeGetCurrentTipIndex();
Tutorial value = index >= 0 ? values()[index] : STUB;
Tutorial tipsApi = value != STUB && value.isScreenAllowed(requiredScreenClass) ? value
: STUB;
Tutorial value = values()[RANDOM.nextInt(values().length)];
Tutorial tipsApi = value.isScreenAllowed(requiredScreenClass) ? value : STUB;
LOGGER.d(TAG, "tipsApi = " + tipsApi);
return tipsApi;
}