Updated on 2026-08-14
This commit is contained in:
parent
b6335203e0
commit
6bb82257c2
1 changed files with 16 additions and 6 deletions
|
|
@ -72,14 +72,17 @@ class Learn2earnViewModel @Inject constructor(
|
|||
}
|
||||
|
||||
private fun onButtonMainClick() {
|
||||
if (!interactor.isUserHadPromoCode() && !interactor.isUserRegisteredInPromotion()) {
|
||||
if (interactor.isUserHadPromoCode() || interactor.isUserRegisteredInPromotion()) {
|
||||
analytics.send(Learn2earnEvents.MainScreen.NoticeLear2earn(AnalyticsParam.ClientType.Old()))
|
||||
requestAward()
|
||||
} else {
|
||||
analytics.send(Learn2earnEvents.MainScreen.NoticeLear2earn(AnalyticsParam.ClientType.New()))
|
||||
subscribeToWebViewResultEvents()
|
||||
router.openWebView(interactor.buildUriForOldUser(), interactor.getBasicAuthHeaders())
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
analytics.send(Learn2earnEvents.MainScreen.NoticeLear2earn(AnalyticsParam.ClientType.Old()))
|
||||
private fun requestAward() {
|
||||
viewModelScope.launch(dispatchers.io) {
|
||||
updateUi { uiState.updateProgress(showProgress = true) }
|
||||
|
||||
|
|
@ -171,9 +174,16 @@ class Learn2earnViewModel @Inject constructor(
|
|||
private fun subscribeToWebViewResultEvents() {
|
||||
interactor.webViewResultHandler = object : WebViewResultHandler {
|
||||
override fun handleResult(result: WebViewResult) {
|
||||
interactor.webViewResultHandler = null
|
||||
if (result is WebViewResult.ReadyForAward) {
|
||||
updateMainScreenViews()
|
||||
when (result) {
|
||||
is WebViewResult.PromoCode -> {
|
||||
interactor.webViewResultHandler = null
|
||||
}
|
||||
WebViewResult.ReadyForAward -> {
|
||||
interactor.webViewResultHandler = null
|
||||
updateMainScreenViews()
|
||||
requestAward()
|
||||
}
|
||||
WebViewResult.Empty, is WebViewResult.Learn2earnAnalyticsEvent -> Unit
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue