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

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

fixed: CyclomaticComplexMethod

parent 0d8a9fca
Loading
Loading
Loading
Loading
+1 −5
Original line number Original line Diff line number Diff line
@@ -2,12 +2,9 @@
<SmellBaseline>
<SmellBaseline>
  <ManuallySuppressedIssues></ManuallySuppressedIssues>
  <ManuallySuppressedIssues></ManuallySuppressedIssues>
  <CurrentIssues>
  <CurrentIssues>
    <ID>CyclomaticComplexMethod:ApplicationApiImpl.kt$ApplicationApiImpl$private suspend fun generateCleanAPKHome(home: CleanApkHome, appType: String): List&lt;Home&gt;</ID>
    <ID>CyclomaticComplexMethod:ApplicationDiffUtil.kt$ApplicationDiffUtil$override fun areContentsTheSame(oldItem: Application, newItem: Application): Boolean</ID>
    <ID>CyclomaticComplexMethod:ApplicationDiffUtil.kt$ApplicationDiffUtil$override fun areContentsTheSame(oldItem: Application, newItem: Application): Boolean</ID>
    <ID>CyclomaticComplexMethod:CategoryUtils.kt$CategoryUtils$fun provideAppsCategoryIconResource(categoryId: String): Int</ID>
<!--    <ID>CyclomaticComplexMethod:DownloadProgressLD.kt$DownloadProgressLD$override fun observe(owner: LifecycleOwner, observer: Observer&lt;in DownloadProgress&gt;)</ID>-->
    <ID>CyclomaticComplexMethod:DownloadProgressLD.kt$DownloadProgressLD$override fun observe(owner: LifecycleOwner, observer: Observer&lt;in DownloadProgress&gt;)</ID>
    <ID>CyclomaticComplexMethod:HomeChildFusedAppDiffUtil.kt$HomeChildFusedAppDiffUtil$override fun areContentsTheSame(oldItem: Application, newItem: Application): Boolean</ID>
    <ID>CyclomaticComplexMethod:HomeChildFusedAppDiffUtil.kt$HomeChildFusedAppDiffUtil$override fun areContentsTheSame(oldItem: Application, newItem: Application): Boolean</ID>
    <ID>CyclomaticComplexMethod:MainActivity.kt$MainActivity$override fun onCreate(savedInstanceState: Bundle?)</ID>
    <ID>EmptyCatchBlock:NativeDeviceInfoProviderModule.kt$NativeDeviceInfoProviderModule${ }</ID>
    <ID>EmptyCatchBlock:NativeDeviceInfoProviderModule.kt$NativeDeviceInfoProviderModule${ }</ID>
    <ID>EmptyFunctionBlock:CleanApkAuthenticator.kt$CleanApkAuthenticator${}</ID>
    <ID>EmptyFunctionBlock:CleanApkAuthenticator.kt$CleanApkAuthenticator${}</ID>
    <ID>ImplicitDefaultLocale:ApplicationFragment.kt$ApplicationFragment$String.format("%d%%", progressPercentage)</ID>
    <ID>ImplicitDefaultLocale:ApplicationFragment.kt$ApplicationFragment$String.format("%d%%", progressPercentage)</ID>
@@ -23,7 +20,6 @@
    <ID>LongMethod:ApplicationApiImpl.kt$ApplicationApiImpl$private suspend fun generateCleanAPKHome(home: CleanApkHome, appType: String): List&lt;Home&gt;</ID>
    <ID>LongMethod:ApplicationApiImpl.kt$ApplicationApiImpl$private suspend fun generateCleanAPKHome(home: CleanApkHome, appType: String): List&lt;Home&gt;</ID>
    <ID>LongMethod:ApplicationFragment.kt$ApplicationFragment$private fun observeDownloadStatus(view: View)</ID>
    <ID>LongMethod:ApplicationFragment.kt$ApplicationFragment$private fun observeDownloadStatus(view: View)</ID>
    <ID>LongMethod:CategoryUtils.kt$CategoryUtils$fun provideAppsCategoryIconResource(categoryId: String): Int</ID>
    <ID>LongMethod:CategoryUtils.kt$CategoryUtils$fun provideAppsCategoryIconResource(categoryId: String): Int</ID>
    <ID>LongMethod:MainActivity.kt$MainActivity$override fun onCreate(savedInstanceState: Bundle?)</ID>
    <ID>LongMethod:NativeDeviceInfoProviderModule.kt$NativeDeviceInfoProviderModule$@Singleton @Provides fun provideNativeDeviceProperties( @ApplicationContext context: Context, ): Properties</ID>
    <ID>LongMethod:NativeDeviceInfoProviderModule.kt$NativeDeviceInfoProviderModule$@Singleton @Provides fun provideNativeDeviceProperties( @ApplicationContext context: Context, ): Properties</ID>
    <ID>LongParameterList:ApplicationApiImpl.kt$ApplicationApiImpl$( private val pkgManagerModule: PkgManagerModule, private val pwaManagerModule: PWAManagerModule, private val preferenceManagerModule: PreferenceManagerModule, @Named("gplayRepository") private val gplayRepository: PlayStoreRepository, @Named("cleanApkAppsRepository") private val cleanApkAppsRepository: CleanApkRepository, @Named("cleanApkPWARepository") private val cleanApkPWARepository: CleanApkRepository, @ApplicationContext private val context: Context )</ID>
    <ID>LongParameterList:ApplicationApiImpl.kt$ApplicationApiImpl$( private val pkgManagerModule: PkgManagerModule, private val pwaManagerModule: PWAManagerModule, private val preferenceManagerModule: PreferenceManagerModule, @Named("gplayRepository") private val gplayRepository: PlayStoreRepository, @Named("cleanApkAppsRepository") private val cleanApkAppsRepository: CleanApkRepository, @Named("cleanApkPWARepository") private val cleanApkPWARepository: CleanApkRepository, @ApplicationContext private val context: Context )</ID>
    <ID>LongParameterList:ApplicationDialogFragment.kt$ApplicationDialogFragment$( drawable: Int = -1, title: String, message: String, positiveButtonText: String = "", positiveButtonAction: (() -&gt; Unit)? = null, cancelButtonText: String = "", cancelButtonAction: (() -&gt; Unit)? = null, cancellable: Boolean = true, onDismissListener: (() -&gt; Unit)? = null, )</ID>
    <ID>LongParameterList:ApplicationDialogFragment.kt$ApplicationDialogFragment$( drawable: Int = -1, title: String, message: String, positiveButtonText: String = "", positiveButtonAction: (() -&gt; Unit)? = null, cancelButtonText: String = "", cancelButtonAction: (() -&gt; Unit)? = null, cancellable: Boolean = true, onDismissListener: (() -&gt; Unit)? = null, )</ID>
+154 −98
Original line number Original line Diff line number Diff line
@@ -78,20 +78,53 @@ class MainActivity : AppCompatActivity() {
        binding = ActivityMainBinding.inflate(layoutInflater)
        binding = ActivityMainBinding.inflate(layoutInflater)
        setContentView(binding.root)
        setContentView(binding.root)


        val bottomNavigationView = binding.bottomNavigationView
        val (bottomNavigationView, navController) = setupBootomNav()
        val navHostFragment =
            supportFragmentManager.findFragmentById(R.id.fragment) as NavHostFragment
        val navController = navHostFragment.navController
        bottomNavigationView.setupWithNavController(navController)
        setupBottomNavItemSelectedListener(bottomNavigationView, navHostFragment, navController)


        var hasInternet = true
        var hasInternet = true


        viewModel = ViewModelProvider(this)[MainActivityViewModel::class.java]
        setupViewModels()
        signInViewModel = ViewModelProvider(this)[SignInViewModel::class.java]
        loginViewModel = ViewModelProvider(this)[LoginViewModel::class.java]


        // navOptions and activityNavController for TOS and SignIn Fragments
        // navOptions and activityNavController for TOS and SignIn Fragments
        setupNavigations(navController)

        if (intent.hasExtra(UpdatesNotifier.UPDATES_NOTIFICATION_CLICK_EXTRA)) {
            bottomNavigationView.selectedItemId = R.id.updatesFragment
        }

        // Create notification channel on post-nougat devices
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
            viewModel.createNotificationChannels()
        }

        viewModel.setupConnectivityManager(this.applicationContext)

        hasInternet = observeInternetConnections(hasInternet)

        observeAuthObjects(navController)

        setupDestinationChangedListener(navController, hasInternet, bottomNavigationView)


        observePurchaseAppPage()

        observeErrorMessage()

        observeErrorMessageString()

        observeIsAppPurchased()

        observePurchaseDeclined()

        if (viewModel.internetConnection.value != true) {
            showNoInternet()
        }

        viewModel.updateAppWarningList()

        observeEvents()
    }

    private fun setupNavigations(navController: NavController) {
        val navOptions = NavOptions.Builder()
        val navOptions = NavOptions.Builder()
            .setPopUpTo(R.id.navigation_resource, true)
            .setPopUpTo(R.id.navigation_resource, true)
            .build()
            .build()
@@ -104,79 +137,63 @@ class MainActivity : AppCompatActivity() {
                loginViewModel.startLoginFlow()
                loginViewModel.startLoginFlow()
            }
            }
        }
        }
    }


        viewModel.setupConnectivityManager(this.applicationContext)
    private fun observeEvents() {

        lifecycleScope.launch {
        viewModel.internetConnection.observe(this) { isInternetAvailable ->
            repeatOnLifecycle(Lifecycle.State.STARTED) {
            hasInternet = isInternetAvailable
                launch {
            if (isInternetAvailable) {
                    observeInvalidAuth()
                binding.noInternet.visibility = View.GONE
                binding.fragment.visibility = View.VISIBLE
                }
                }

                launch {
                    observeTooManyRequests()
                }
                }


        loginViewModel.authObjects.distinctUntilChanged().observe(this) {
                launch {
            when {
                    observeSignatureMissMatchError()
                it == null -> return@observe
                it.isEmpty() -> {
                    // No auth type defined means user has not logged in yet
                    // Pop back stack to prevent showing TOSFragment on pressing back button.
                    navController.popBackStack()
                    navController.navigate(R.id.signInFragment)
                }
                }


                else -> {}
                launch {
                    observerErrorEvent()
                }
                }


            it.find { it is AuthObject.GPlayAuth }?.result?.run {
                launch {
                if (isSuccess()) {
                    observeAppPurchaseFragment()
                    viewModel.gPlayAuthData = data as AuthData
                } else if (exception is GPlayValidationException) {
                    val email = otherPayload.toString()
                    viewModel.uploadFaultyTokenToEcloud(
                        email,
                        SystemInfoProvider.getAppBuildInfo()
                    )
                } else if (exception != null) {
                    Timber.e(exception, "Login failed! message: ${exception?.localizedMessage}")
                }
                }

                launch {
                    observeNoInternetEvent()
                }
                }
            }
            }

        navController.addOnDestinationChangedListener { _, destination, _ ->
            if (!hasInternet) {
                showNoInternet()
        }
        }
            when (destination.id) {
                R.id.applicationFragment,
                R.id.applicationListFragment,
                R.id.screenshotFragment,
                R.id.descriptionFragment,
                R.id.TOSFragment,
                R.id.googleSignInFragment,
                R.id.signInFragment -> {
                    bottomNavigationView.visibility = View.GONE
    }
    }


                else -> {
    private fun observePurchaseDeclined() {
                    bottomNavigationView.visibility = View.VISIBLE
        viewModel.purchaseDeclined.observe(this) {
            if (it.isNotEmpty()) {
                lifecycleScope.launch {
                    viewModel.updateUnavailableForPurchaseDeclined(it)
                }
                }
            }
            }
        }
        }

        if (intent.hasExtra(UpdatesNotifier.UPDATES_NOTIFICATION_CLICK_EXTRA)) {
            bottomNavigationView.selectedItemId = R.id.updatesFragment
    }
    }


        // Create notification channel on post-nougat devices
    private fun observeIsAppPurchased() {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
        viewModel.isAppPurchased.observe(this) {
            viewModel.createNotificationChannels()
            if (it.isNotEmpty()) {
                startInstallationOfPurchasedApp(viewModel, it)
            }
        }
    }
    }


        viewModel.purchaseAppLiveData.observe(this) {
    private fun observeErrorMessageString() {
            goToAppPurchaseFragment(it)
        viewModel.errorMessageStringResource.observe(this) {
            showSnackbarMessage(getString(it))
        }
    }
    }


    private fun observeErrorMessage() {
        viewModel.errorMessage.observe(this) {
        viewModel.errorMessage.observe(this) {
            when (it) {
            when (it) {
                is ApiException.AppNotPurchased -> showSnackbarMessage(getString(R.string.message_app_available_later))
                is ApiException.AppNotPurchased -> showSnackbarMessage(getString(R.string.message_app_available_later))
@@ -185,58 +202,97 @@ class MainActivity : AppCompatActivity() {
                )
                )
            }
            }
        }
        }

        viewModel.errorMessageStringResource.observe(this) {
            showSnackbarMessage(getString(it))
    }
    }


        viewModel.isAppPurchased.observe(this) {
    private fun observePurchaseAppPage() {
            if (it.isNotEmpty()) {
        viewModel.purchaseAppLiveData.observe(this) {
                startInstallationOfPurchasedApp(viewModel, it)
            goToAppPurchaseFragment(it)
        }
        }
    }
    }


        viewModel.purchaseDeclined.observe(this) {
    private fun observeInternetConnections(hasInternet: Boolean): Boolean {
            if (it.isNotEmpty()) {
        var hasInternet1 = hasInternet
                lifecycleScope.launch {
        viewModel.internetConnection.observe(this) { isInternetAvailable ->
                    viewModel.updateUnavailableForPurchaseDeclined(it)
            hasInternet1 = isInternetAvailable
            if (isInternetAvailable) {
                binding.noInternet.visibility = View.GONE
                binding.fragment.visibility = View.VISIBLE
            }
            }
        }
        }
        return hasInternet1
    }
    }


        if (viewModel.internetConnection.value != true) {
    private fun setupDestinationChangedListener(
        navController: NavController,
        hasInternet: Boolean,
        bottomNavigationView: BottomNavigationView
    ) {
        navController.addOnDestinationChangedListener { _, destination, _ ->
            if (!hasInternet) {
                showNoInternet()
                showNoInternet()
            }
            }

            when (destination.id) {
        viewModel.updateAppWarningList()
                R.id.applicationFragment,

                R.id.applicationListFragment,
        lifecycleScope.launch {
                R.id.screenshotFragment,
            repeatOnLifecycle(Lifecycle.State.STARTED) {
                R.id.descriptionFragment,
                launch {
                R.id.TOSFragment,
                    observeInvalidAuth()
                R.id.googleSignInFragment,
                R.id.signInFragment -> {
                    bottomNavigationView.visibility = View.GONE
                }
                }


                launch {
                else -> {
                    observeTooManyRequests()
                    bottomNavigationView.visibility = View.VISIBLE
                }
            }
        }
        }

                launch {
                    observeSignatureMissMatchError()
    }
    }


                launch {
    private fun observeAuthObjects(navController: NavController) {
                    observerErrorEvent()
        loginViewModel.authObjects.distinctUntilChanged().observe(this) {
            when {
                it == null -> return@observe
                it.isEmpty() -> {
                    // No auth type defined means user has not logged in yet
                    // Pop back stack to prevent showing TOSFragment on pressing back button.
                    navController.popBackStack()
                    navController.navigate(R.id.signInFragment)
                }
                }


                launch {
                else -> {}
                    observeAppPurchaseFragment()
            }
            }


                launch {
            it.find { it is AuthObject.GPlayAuth }?.result?.run {
                    observeNoInternetEvent()
                if (isSuccess()) {
                    viewModel.gPlayAuthData = data as AuthData
                } else if (exception is GPlayValidationException) {
                    val email = otherPayload.toString()
                    viewModel.uploadFaultyTokenToEcloud(
                        email,
                        SystemInfoProvider.getAppBuildInfo()
                    )
                } else if (exception != null) {
                    Timber.e(exception, "Login failed! message: ${exception?.localizedMessage}")
                }
            }
            }
        }
        }
    }
    }

    private fun setupViewModels() {
        viewModel = ViewModelProvider(this)[MainActivityViewModel::class.java]
        signInViewModel = ViewModelProvider(this)[SignInViewModel::class.java]
        loginViewModel = ViewModelProvider(this)[LoginViewModel::class.java]
    }

    private fun setupBootomNav(): Pair<BottomNavigationView, NavController> {
        val bottomNavigationView = binding.bottomNavigationView
        val navHostFragment =
            supportFragmentManager.findFragmentById(R.id.fragment) as NavHostFragment
        val navController = navHostFragment.navController
        bottomNavigationView.setupWithNavController(navController)
        setupBottomNavItemSelectedListener(bottomNavigationView, navHostFragment, navController)
        return Pair(bottomNavigationView, navController)
    }
    }


    private suspend fun observeNoInternetEvent() {
    private suspend fun observeNoInternetEvent() {
+129 −68
Original line number Original line Diff line number Diff line
@@ -1072,56 +1072,98 @@ class ApplicationApiImpl @Inject constructor(
    private suspend fun generateCleanAPKHome(home: CleanApkHome, appType: String): List<Home> {
    private suspend fun generateCleanAPKHome(home: CleanApkHome, appType: String): List<Home> {
        val list = mutableListOf<Home>()
        val list = mutableListOf<Home>()
        val headings = if (appType == APP_TYPE_OPEN) {
        val headings = if (appType == APP_TYPE_OPEN) {
            mapOf(
            getOpenSourceHomeCategories()
                "top_updated_apps" to context.getString(R.string.top_updated_apps),
                "top_updated_games" to context.getString(R.string.top_updated_games),
                "popular_apps_in_last_24_hours" to context.getString(R.string.popular_apps_in_last_24_hours),
                "popular_games_in_last_24_hours" to context.getString(R.string.popular_games_in_last_24_hours),
                "discover" to context.getString(R.string.discover)
            )
        } else {
        } else {
            mapOf(
            getPWAHomeCategories()
                "popular_apps" to context.getString(R.string.popular_apps),
                "popular_games" to context.getString(R.string.popular_games),
                "discover" to context.getString(R.string.discover_pwa)
            )
        }
        }
        headings.forEach { (key, value) ->
        headings.forEach { (key, value) ->
            when (key) {
            when (key) {
                "top_updated_apps" -> {
                "top_updated_apps" -> {
                    if (home.top_updated_apps.isNotEmpty()) {
                    prepareTopUpdatedApps(home, list, value)
                        home.top_updated_apps.forEach {
                }

                "top_updated_games" -> {
                    prepareTopUpdatedGames(home, list, value)
                }

                "popular_apps" -> {
                    preparePopularApps(home, list, value)
                }

                "popular_games" -> {
                    preparePopularGames(home, list, value)
                }

                "popular_apps_in_last_24_hours" -> {
                    prepareAppsInLast24Hours(home, list, value)
                }

                "popular_games_in_last_24_hours" -> {
                    prepareGamesInLast24Hours(home, list, value)
                }

                "discover" -> {
                    prepareDiscoverApps(home, list, value)
                }
            }
        }

        return list.map {
            it.source = appType
            it
        }
    }

    private suspend fun prepareDiscoverApps(
        home: foundation.e.apps.data.cleanapk.data.home.Home,
        list: MutableList<Home>,
        value: String
    ) {
        if (home.discover.isNotEmpty()) {
            home.discover.forEach {
                it.updateStatus()
                it.updateStatus()
                it.updateType()
                it.updateType()
                it.updateFilterLevel(null)
                it.updateFilterLevel(null)
            }
            }
                        list.add(Home(value, home.top_updated_apps))
            list.add(Home(value, home.discover))
        }
        }
    }
    }


                "top_updated_games" -> {
    private suspend fun prepareGamesInLast24Hours(
                    if (home.top_updated_games.isNotEmpty()) {
        home: foundation.e.apps.data.cleanapk.data.home.Home,
                        home.top_updated_games.forEach {
        list: MutableList<Home>,
        value: String
    ) {
        if (home.popular_games_in_last_24_hours.isNotEmpty()) {
            home.popular_games_in_last_24_hours.forEach {
                it.updateStatus()
                it.updateStatus()
                it.updateType()
                it.updateType()
                it.updateFilterLevel(null)
                it.updateFilterLevel(null)
            }
            }
                        list.add(Home(value, home.top_updated_games))
            list.add(Home(value, home.popular_games_in_last_24_hours))
        }
        }
    }
    }


                "popular_apps" -> {
    private suspend fun prepareAppsInLast24Hours(
                    if (home.popular_apps.isNotEmpty()) {
        home: foundation.e.apps.data.cleanapk.data.home.Home,
                        home.popular_apps.forEach {
        list: MutableList<Home>,
        value: String
    ) {
        if (home.popular_apps_in_last_24_hours.isNotEmpty()) {
            home.popular_apps_in_last_24_hours.forEach {
                it.updateStatus()
                it.updateStatus()
                it.updateType()
                it.updateType()
                it.updateFilterLevel(null)
                it.updateFilterLevel(null)
            }
            }
                        list.add(Home(value, home.popular_apps))
            list.add(Home(value, home.popular_apps_in_last_24_hours))
        }
        }
    }
    }


                "popular_games" -> {
    private suspend fun preparePopularGames(
        home: foundation.e.apps.data.cleanapk.data.home.Home,
        list: MutableList<Home>,
        value: String
    ) {
        if (home.popular_games.isNotEmpty()) {
        if (home.popular_games.isNotEmpty()) {
            home.popular_games.forEach {
            home.popular_games.forEach {
                it.updateStatus()
                it.updateStatus()
@@ -1132,46 +1174,65 @@ class ApplicationApiImpl @Inject constructor(
        }
        }
    }
    }


                "popular_apps_in_last_24_hours" -> {
    private suspend fun preparePopularApps(
                    if (home.popular_apps_in_last_24_hours.isNotEmpty()) {
        home: foundation.e.apps.data.cleanapk.data.home.Home,
                        home.popular_apps_in_last_24_hours.forEach {
        list: MutableList<Home>,
        value: String
    ) {
        if (home.popular_apps.isNotEmpty()) {
            home.popular_apps.forEach {
                it.updateStatus()
                it.updateStatus()
                it.updateType()
                it.updateType()
                it.updateFilterLevel(null)
                it.updateFilterLevel(null)
            }
            }
                        list.add(Home(value, home.popular_apps_in_last_24_hours))
            list.add(Home(value, home.popular_apps))
        }
        }
    }
    }


                "popular_games_in_last_24_hours" -> {
    private suspend fun prepareTopUpdatedGames(
                    if (home.popular_games_in_last_24_hours.isNotEmpty()) {
        home: foundation.e.apps.data.cleanapk.data.home.Home,
                        home.popular_games_in_last_24_hours.forEach {
        list: MutableList<Home>,
        value: String
    ) {
        if (home.top_updated_games.isNotEmpty()) {
            home.top_updated_games.forEach {
                it.updateStatus()
                it.updateStatus()
                it.updateType()
                it.updateType()
                it.updateFilterLevel(null)
                it.updateFilterLevel(null)
            }
            }
                        list.add(Home(value, home.popular_games_in_last_24_hours))
            list.add(Home(value, home.top_updated_games))
        }
        }
    }
    }


                "discover" -> {
    private suspend fun prepareTopUpdatedApps(
                    if (home.discover.isNotEmpty()) {
        home: foundation.e.apps.data.cleanapk.data.home.Home,
                        home.discover.forEach {
        list: MutableList<Home>,
        value: String
    ) {
        if (home.top_updated_apps.isNotEmpty()) {
            home.top_updated_apps.forEach {
                it.updateStatus()
                it.updateStatus()
                it.updateType()
                it.updateType()
                it.updateFilterLevel(null)
                it.updateFilterLevel(null)
            }
            }
                        list.add(Home(value, home.discover))
            list.add(Home(value, home.top_updated_apps))
                    }
                }
            }
        }
        return list.map {
            it.source = appType
            it
        }
        }
    }
    }


    private fun getPWAHomeCategories() = mapOf(
        "popular_apps" to context.getString(R.string.popular_apps),
        "popular_games" to context.getString(R.string.popular_games),
        "discover" to context.getString(R.string.discover_pwa)
    )

    private fun getOpenSourceHomeCategories() = mapOf(
        "top_updated_apps" to context.getString(R.string.top_updated_apps),
        "top_updated_games" to context.getString(R.string.top_updated_games),
        "popular_apps_in_last_24_hours" to context.getString(R.string.popular_apps_in_last_24_hours),
        "popular_games_in_last_24_hours" to context.getString(R.string.popular_games_in_last_24_hours),
        "discover" to context.getString(R.string.discover)
    )

    private suspend fun fetchGPlayHome(authData: AuthData): List<Home> {
    private suspend fun fetchGPlayHome(authData: AuthData): List<Home> {
        val list = mutableListOf<Home>()
        val list = mutableListOf<Home>()
        val gplayHomeData = gplayRepository.getHomeScreenData() as Map<String, List<App>>
        val gplayHomeData = gplayRepository.getHomeScreenData() as Map<String, List<App>>
+81 −154

File changed.

Preview size limit exceeded, changes collapsed.

+44 −40
Original line number Original line Diff line number Diff line
@@ -61,6 +61,16 @@ class DownloadProgressLD @Inject constructor(
                    continue
                    continue
                }
                }
                try {
                try {
                    findDownloadProgress(downloadingIds)
                } catch (e: Exception) {
                    Timber.e("downloading Ids: $downloadingIds ${e.localizedMessage}")
                }
                delay(20)
            }
        }
    }

    private fun findDownloadProgress(downloadingIds: MutableList<Long>) {
        downloadManager.query(downloadManagerQuery.setFilterById(*downloadingIds.toLongArray()))
        downloadManager.query(downloadManagerQuery.setFilterById(*downloadingIds.toLongArray()))
            .use { cursor ->
            .use { cursor ->
                cursor.moveToFirst()
                cursor.moveToFirst()
@@ -101,12 +111,6 @@ class DownloadProgressLD @Inject constructor(
                    cursor.moveToNext()
                    cursor.moveToNext()
                }
                }
            }
            }
                } catch (e: Exception) {
                    Timber.e("downloading Ids: $downloadingIds ${e.localizedMessage}")
                }
                delay(20)
            }
        }
    }
    }


    override fun onInactive() {
    override fun onInactive() {