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

Commit 93493e8d authored by Hasib Prince's avatar Hasib Prince
Browse files

refactor: removed some unnecessary codes

parent eb9c3cf9
Loading
Loading
Loading
Loading
Loading
+3 −6
Original line number Diff line number Diff line
@@ -84,14 +84,12 @@ class MainActivity : AppCompatActivity() {

        setupViewModels()

        // 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()
        }
@@ -104,7 +102,6 @@ class MainActivity : AppCompatActivity() {

        setupDestinationChangedListener(navController, hasInternet, bottomNavigationView)


        observePurchaseAppPage()

        observeErrorMessage()
@@ -211,15 +208,15 @@ class MainActivity : AppCompatActivity() {
    }

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

    private fun setupDestinationChangedListener(
+12 −102
Original line number Diff line number Diff line
@@ -1079,31 +1079,31 @@ class ApplicationApiImpl @Inject constructor(
        headings.forEach { (key, value) ->
            when (key) {
                "top_updated_apps" -> {
                    prepareTopUpdatedApps(home, list, value)
                    prepareApps(home.top_updated_apps, list, value)
                }

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

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

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

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

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

                "discover" -> {
                    prepareDiscoverApps(home, list, value)
                    prepareApps(home.discover, list, value)
                }
            }
        }
@@ -1114,108 +1114,18 @@ class ApplicationApiImpl @Inject constructor(
        }
    }

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

    private suspend fun prepareGamesInLast24Hours(
        home: foundation.e.apps.data.cleanapk.data.home.Home,
        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.updateType()
                it.updateFilterLevel(null)
            }
            list.add(Home(value, home.popular_games_in_last_24_hours))
        }
    }

    private suspend fun prepareAppsInLast24Hours(
        home: foundation.e.apps.data.cleanapk.data.home.Home,
        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.updateType()
                it.updateFilterLevel(null)
            }
            list.add(Home(value, home.popular_apps_in_last_24_hours))
        }
    }

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

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

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

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

+0 −12
Original line number Diff line number Diff line
@@ -43,16 +43,11 @@ object NativeDeviceInfoProviderModule {
        @ApplicationContext context: Context,
    ): Properties {
        val properties = Properties().apply {
            // Build Props
            setBuildProperties()
            setConfigProperties(context)
            // Display Metrics
            setDisplayMetrics(context)
            // GL Extensions
            setGLExtensions(context)
            // Google Related Props
            setGoogleProperties(context)
            // MISC
            setMiscProperties()
        }
        return properties
@@ -61,7 +56,6 @@ object NativeDeviceInfoProviderModule {
    private fun Properties.setMiscProperties() {
        setProperty("Roaming", "mobile-notroaming")
        setProperty("TimeZone", "UTC-10")
        // Telephony (USA 3650 AT&T)
        setProperty("CellOperator", "310")
        setProperty("SimOperator", "38")
    }
@@ -92,15 +86,9 @@ object NativeDeviceInfoProviderModule {
        setProperty("Screen.Density", "${metrics.densityDpi}")
        setProperty("Screen.Width", "${metrics.widthPixels}")
        setProperty("Screen.Height", "${metrics.heightPixels}")

        // Supported Platforms
        setProperty("Platforms", Build.SUPPORTED_ABIS.joinToString(separator = ","))

        // Supported Features
        setProperty("Features", getFeatures(context).joinToString(separator = ","))
        // Shared Locales
        setProperty("Locales", getLocales(context).joinToString(separator = ","))
        // Shared Libraries
        setProperty(
            "SharedLibraries",
            getSharedLibraries(context).joinToString(separator = ",")
+8 −4
Original line number Diff line number Diff line
@@ -19,6 +19,10 @@
package foundation.e.apps.install.download.data

import android.app.DownloadManager
import android.app.DownloadManager.COLUMN_BYTES_DOWNLOADED_SO_FAR
import android.app.DownloadManager.COLUMN_ID
import android.app.DownloadManager.COLUMN_STATUS
import android.app.DownloadManager.COLUMN_TOTAL_SIZE_BYTES
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleOwner
import androidx.lifecycle.LiveData
@@ -76,13 +80,13 @@ class DownloadProgressLD @Inject constructor(
                cursor.moveToFirst()
                while (!cursor.isAfterLast) {
                    val id =
                        cursor.getLong(cursor.getColumnIndexOrThrow(DownloadManager.COLUMN_ID))
                        cursor.getLong(cursor.getColumnIndexOrThrow(COLUMN_ID))
                    val status =
                        cursor.getInt(cursor.getColumnIndexOrThrow(DownloadManager.COLUMN_STATUS))
                        cursor.getInt(cursor.getColumnIndexOrThrow(COLUMN_STATUS))
                    val totalSizeBytes =
                        cursor.getLong(cursor.getColumnIndexOrThrow(DownloadManager.COLUMN_TOTAL_SIZE_BYTES))
                        cursor.getLong(cursor.getColumnIndexOrThrow(COLUMN_TOTAL_SIZE_BYTES))
                    val bytesDownloadedSoFar =
                        cursor.getLong(cursor.getColumnIndexOrThrow(DownloadManager.COLUMN_BYTES_DOWNLOADED_SO_FAR))
                        cursor.getLong(cursor.getColumnIndexOrThrow(COLUMN_BYTES_DOWNLOADED_SO_FAR))

                    downloadProgress.downloadId = id

+1 −0
Original line number Diff line number Diff line
@@ -90,6 +90,7 @@ class PWAManagerModule @Inject constructor(
        } catch (e: Exception) {
           Timber.w(e)
        }

        return false
    }

Loading