Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b6579f81 authored by Hasib Prince's avatar Hasib Prince
Browse files

refactor: agelimitrestrictionevent

parent 75ef0b98
Loading
Loading
Loading
Loading
Loading
+13 −10
Original line number Diff line number Diff line
@@ -207,18 +207,21 @@ class MainActivity : AppCompatActivity() {
                }

                launch {
                    observeAgeLimitRestrictionEvent()
                }
            }
        }
    }

    private suspend fun observeAgeLimitRestrictionEvent() {
        EventBus.events.filter {
                        it is AppEvent.AgeRateLimit
            it is AppEvent.AgeLimitRestrictionEvent
        }.collectLatest {
            ApplicationDialogFragment(
                getString(R.string.unknown_error),
                getString(R.string.age_rate_limit_message),
                positiveButtonText = getString(R.string.ok),
            ).show(supportFragmentManager, TAG)

                    }
                }
            }
        }
    }

+1 −1
Original line number Diff line number Diff line
@@ -135,7 +135,7 @@ class AppInstallProcessor @Inject constructor(

            if (checkAppAgeLimitUseCase.invoke(appInstall)) {
                Timber.i("Content rating is not allowed for: ${appInstall.name}")
                EventBus.invokeEvent(AppEvent.AgeRateLimit(appInstall.name))
                EventBus.invokeEvent(AppEvent.AgeLimitRestrictionEvent(appInstall.name))
                appManagerWrapper.cancelDownload(appInstall)
                return
            }
+1 −2
Original line number Diff line number Diff line
@@ -33,6 +33,5 @@ sealed class AppEvent(val data: Any) {
    class AppPurchaseEvent(appInstall: AppInstall) : AppEvent(appInstall)
    class NoInternetEvent(isInternetAvailable: Boolean) : AppEvent(isInternetAvailable)
    class TooManyRequests : AppEvent(Unit)

    class AgeRateLimit(title: String) : AppEvent(String)
    class AgeLimitRestrictionEvent(title: String) : AppEvent(String)
}