few nips and tucks

Signed-off-by: androidacy-user <opensource@androidacy.com>
pull/89/head
androidacy-user 2 years ago
parent f2f7589c68
commit 191bccec1b

@ -28,6 +28,7 @@ import androidx.appcompat.widget.SearchView
import androidx.cardview.widget.CardView
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import androidx.room.Room
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout.OnRefreshListener
import com.fox2code.foxcompat.app.FoxActivity
@ -54,6 +55,7 @@ import com.fox2code.mmm.utils.RuntimeUtils
import com.fox2code.mmm.utils.SyncManager
import com.fox2code.mmm.utils.io.net.Http.Companion.cleanDnsCache
import com.fox2code.mmm.utils.io.net.Http.Companion.hasWebView
import com.fox2code.mmm.utils.room.ReposListDatabase
import com.google.android.material.bottomnavigation.BottomNavigationView
import com.google.android.material.progressindicator.LinearProgressIndicator
import org.matomo.sdk.extra.TrackHelper
@ -108,6 +110,28 @@ class MainActivity : FoxActivity(), OnRefreshListener, SearchView.OnQueryTextLis
// Show a toast to warn the user
Toast.makeText(this, R.string.not_official_build, Toast.LENGTH_LONG).show()
}
// track enabled repos
Thread {
val db = Room.databaseBuilder(
applicationContext,
ReposListDatabase::class.java,
"ReposList.db"
).build()
val repoDao = db.reposListDao()
val repos = repoDao.getAll()
val enabledRepos = StringBuilder()
for (repo in repos) {
if (repo.enabled) {
enabledRepos.append(repo.url).append(", ")
}
}
db.close()
if (enabledRepos.isNotEmpty()) {
enabledRepos.delete(enabledRepos.length - 2, enabledRepos.length)
TrackHelper.track().event("Enabled Repos", enabledRepos.toString())
.with(MainApplication.INSTANCE!!.tracker)
}
}.start()
val ts = Timestamp(System.currentTimeMillis() - 30L * 24 * 60 * 60 * 1000)
// check if this build has expired
val buildTime = Timestamp(BuildConfig.BUILD_TIME)

@ -112,7 +112,7 @@ class CustomRepoManager internal constructor(
// now the same as above but for room database
val applicationContext = INSTANCE!!.applicationContext
val db = Room.databaseBuilder(
applicationContext, ReposListDatabase::class.java, "reposlist.db"
applicationContext, ReposListDatabase::class.java, "ReposList.db"
).build()
val reposListDao = db.reposListDao()
val reposList = ReposList(id, repo, true, donate, support, submitModule, 0, name, website)

@ -297,6 +297,7 @@ open class RepoData(url: String, cacheRoot: File) : XRepo() {
"ReposList.db",
).allowMainThreadQueries().build()
val reposList = db.reposListDao().getById(preferenceId!!)
db.close()
// should never happen but for safety
if (reposList.enabled) {
!isForceHide

@ -441,4 +441,5 @@
<string name="eula_agree_v2_headline">EULA and Terms</string>
<string name="error_creating_repos_database">Could not create repos db</string>
<string name="error_creating_modulelistcache_database">Failed to create module cache db</string>
<string name="blur_performance_warning_summary">Device is not compatible with blur</string>
</resources>

@ -1,7 +1,3 @@
#
# Copyright (c) 2023 to present Androidacy and contributors. Names, logos, icons, and the Androidacy name are all trademarks of Androidacy and may not be used without license. See LICENSE for more information.
#
## For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
#
@ -14,7 +10,7 @@
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
#Mon May 29 11:36:28 EDT 2023
#Mon Jun 19 16:29:35 EDT 2023
android.defaults.buildfeatures.buildconfig=true
android.enableJetifier=false
android.enableR8.fullMode=true
@ -22,5 +18,5 @@ android.useAndroidX=true
org.gradle.caching=true
org.gradle.configuration-cache=true
org.gradle.configuration-cache.problems=warn
org.gradle.jvmargs=-Xmx1536M -Dkotlin.daemon.jvm.options\="-Xmx1536M" -Dfile.encoding\=UTF-8 -XX\:+UseParallelGC -XX\:ReservedCodeCacheSize\=768m
org.gradle.jvmargs=-Xmx2048M -Dkotlin.daemon.jvm.options\="-Xmx2048M" -Dfile.encoding\=UTF-8 -XX\:+UseParallelGC -XX\:ReservedCodeCacheSize\=768m
org.gradle.parallel=true

Loading…
Cancel
Save