Skip to content

Commit 743cd3f

Browse files
finish room and kotlin migration
SettingsActivity.java cannot be converted right now because AS crashes silently Signed-off-by: androidacy-user <opensource@androidacy.com>
1 parent 0b05dfe commit 743cd3f

24 files changed

Lines changed: 1345 additions & 1161 deletions

File tree

app/build.gradle.kts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ android {
7272
"en"
7373
)
7474
)
75+
// ksp room processor
76+
room {
77+
schemaLocationDir.set(file("roomSchemas"))
78+
}
7579
}
7680

7781
splits {
@@ -525,9 +529,6 @@ dependencies {
525529
// yes
526530
implementation("com.github.fingerprintjs:fingerprint-android:2.0.0")
527531

528-
// encryption for room
529-
implementation("net.zetetic:android-database-sqlcipher:4.5.4")
530-
531532
// room
532533
implementation("androidx.room:room-runtime:2.5.1")
533534

Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
{
2+
"formatVersion": 1,
3+
"database": {
4+
"version": 1,
5+
"identityHash": "2abfd2dad332c887d96cdda63d92a639",
6+
"entities": [
7+
{
8+
"tableName": "modulelistcache",
9+
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`codename` TEXT NOT NULL, `version` TEXT NOT NULL, `versionCode` INTEGER NOT NULL, `author` TEXT NOT NULL, `description` TEXT NOT NULL, `minApi` INTEGER NOT NULL, `maxApi` INTEGER NOT NULL, `minMagisk` INTEGER NOT NULL, `needRamdisk` INTEGER NOT NULL, `support` TEXT NOT NULL, `donate` TEXT NOT NULL, `config` TEXT NOT NULL, `changeBoot` INTEGER NOT NULL, `mmtReborn` INTEGER NOT NULL, `repoId` TEXT NOT NULL, `lastUpdate` INTEGER NOT NULL, `name` TEXT NOT NULL, `safe` INTEGER NOT NULL, `stats` INTEGER NOT NULL, PRIMARY KEY(`codename`))",
10+
"fields": [
11+
{
12+
"fieldPath": "codename",
13+
"columnName": "codename",
14+
"affinity": "TEXT",
15+
"notNull": true
16+
},
17+
{
18+
"fieldPath": "version",
19+
"columnName": "version",
20+
"affinity": "TEXT",
21+
"notNull": true
22+
},
23+
{
24+
"fieldPath": "versionCode",
25+
"columnName": "versionCode",
26+
"affinity": "INTEGER",
27+
"notNull": true
28+
},
29+
{
30+
"fieldPath": "author",
31+
"columnName": "author",
32+
"affinity": "TEXT",
33+
"notNull": true
34+
},
35+
{
36+
"fieldPath": "description",
37+
"columnName": "description",
38+
"affinity": "TEXT",
39+
"notNull": true
40+
},
41+
{
42+
"fieldPath": "minApi",
43+
"columnName": "minApi",
44+
"affinity": "INTEGER",
45+
"notNull": true
46+
},
47+
{
48+
"fieldPath": "maxApi",
49+
"columnName": "maxApi",
50+
"affinity": "INTEGER",
51+
"notNull": true
52+
},
53+
{
54+
"fieldPath": "minMagisk",
55+
"columnName": "minMagisk",
56+
"affinity": "INTEGER",
57+
"notNull": true
58+
},
59+
{
60+
"fieldPath": "needRamdisk",
61+
"columnName": "needRamdisk",
62+
"affinity": "INTEGER",
63+
"notNull": true
64+
},
65+
{
66+
"fieldPath": "support",
67+
"columnName": "support",
68+
"affinity": "TEXT",
69+
"notNull": true
70+
},
71+
{
72+
"fieldPath": "donate",
73+
"columnName": "donate",
74+
"affinity": "TEXT",
75+
"notNull": true
76+
},
77+
{
78+
"fieldPath": "config",
79+
"columnName": "config",
80+
"affinity": "TEXT",
81+
"notNull": true
82+
},
83+
{
84+
"fieldPath": "changeBoot",
85+
"columnName": "changeBoot",
86+
"affinity": "INTEGER",
87+
"notNull": true
88+
},
89+
{
90+
"fieldPath": "mmtReborn",
91+
"columnName": "mmtReborn",
92+
"affinity": "INTEGER",
93+
"notNull": true
94+
},
95+
{
96+
"fieldPath": "repoId",
97+
"columnName": "repoId",
98+
"affinity": "TEXT",
99+
"notNull": true
100+
},
101+
{
102+
"fieldPath": "lastUpdate",
103+
"columnName": "lastUpdate",
104+
"affinity": "INTEGER",
105+
"notNull": true
106+
},
107+
{
108+
"fieldPath": "name",
109+
"columnName": "name",
110+
"affinity": "TEXT",
111+
"notNull": true
112+
},
113+
{
114+
"fieldPath": "safe",
115+
"columnName": "safe",
116+
"affinity": "INTEGER",
117+
"notNull": true
118+
},
119+
{
120+
"fieldPath": "stats",
121+
"columnName": "stats",
122+
"affinity": "INTEGER",
123+
"notNull": true
124+
}
125+
],
126+
"primaryKey": {
127+
"autoGenerate": false,
128+
"columnNames": [
129+
"codename"
130+
]
131+
},
132+
"indices": [],
133+
"foreignKeys": []
134+
}
135+
],
136+
"views": [],
137+
"setupQueries": [
138+
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
139+
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '2abfd2dad332c887d96cdda63d92a639')"
140+
]
141+
}
142+
}
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
{
2+
"formatVersion": 1,
3+
"database": {
4+
"version": 1,
5+
"identityHash": "5a217dbf3caa5a6b70e7eee98636866c",
6+
"entities": [
7+
{
8+
"tableName": "ReposList",
9+
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `url` TEXT NOT NULL, `enabled` INTEGER NOT NULL, `donate` TEXT, `support` TEXT, `submitModule` TEXT, `lastUpdate` INTEGER NOT NULL, `name` TEXT NOT NULL, `website` TEXT, PRIMARY KEY(`id`))",
10+
"fields": [
11+
{
12+
"fieldPath": "id",
13+
"columnName": "id",
14+
"affinity": "TEXT",
15+
"notNull": true
16+
},
17+
{
18+
"fieldPath": "url",
19+
"columnName": "url",
20+
"affinity": "TEXT",
21+
"notNull": true
22+
},
23+
{
24+
"fieldPath": "enabled",
25+
"columnName": "enabled",
26+
"affinity": "INTEGER",
27+
"notNull": true
28+
},
29+
{
30+
"fieldPath": "donate",
31+
"columnName": "donate",
32+
"affinity": "TEXT",
33+
"notNull": false
34+
},
35+
{
36+
"fieldPath": "support",
37+
"columnName": "support",
38+
"affinity": "TEXT",
39+
"notNull": false
40+
},
41+
{
42+
"fieldPath": "submitModule",
43+
"columnName": "submitModule",
44+
"affinity": "TEXT",
45+
"notNull": false
46+
},
47+
{
48+
"fieldPath": "lastUpdate",
49+
"columnName": "lastUpdate",
50+
"affinity": "INTEGER",
51+
"notNull": true
52+
},
53+
{
54+
"fieldPath": "name",
55+
"columnName": "name",
56+
"affinity": "TEXT",
57+
"notNull": true
58+
},
59+
{
60+
"fieldPath": "website",
61+
"columnName": "website",
62+
"affinity": "TEXT",
63+
"notNull": false
64+
}
65+
],
66+
"primaryKey": {
67+
"autoGenerate": false,
68+
"columnNames": [
69+
"id"
70+
]
71+
},
72+
"indices": [],
73+
"foreignKeys": []
74+
}
75+
],
76+
"views": [],
77+
"setupQueries": [
78+
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
79+
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '5a217dbf3caa5a6b70e7eee98636866c')"
80+
]
81+
}
82+
}
-20 KB
Binary file not shown.

app/src/main/assets/repos.db

-28 KB
Binary file not shown.

app/src/main/kotlin/com/fox2code/mmm/MainActivity.kt

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ import androidx.appcompat.widget.SearchView
2828
import androidx.cardview.widget.CardView
2929
import androidx.recyclerview.widget.LinearLayoutManager
3030
import androidx.recyclerview.widget.RecyclerView
31-
import androidx.room.Room
3231
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
3332
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout.OnRefreshListener
3433
import com.fox2code.foxcompat.app.FoxActivity
@@ -55,7 +54,6 @@ import com.fox2code.mmm.utils.RuntimeUtils
5554
import com.fox2code.mmm.utils.SyncManager
5655
import com.fox2code.mmm.utils.io.net.Http.Companion.cleanDnsCache
5756
import com.fox2code.mmm.utils.io.net.Http.Companion.hasWebView
58-
import com.fox2code.mmm.utils.room.ReposListDatabase
5957
import com.google.android.material.bottomnavigation.BottomNavigationView
6058
import com.google.android.material.progressindicator.LinearProgressIndicator
6159
import org.matomo.sdk.extra.TrackHelper
@@ -102,25 +100,6 @@ class MainActivity : FoxActivity(), OnRefreshListener, SearchView.OnQueryTextLis
102100
onMainActivityCreate(this)
103101
super.onCreate(savedInstanceState)
104102
TrackHelper.track().screen(this).with(MainApplication.INSTANCE!!.tracker)
105-
// track enabled repos
106-
val db = Room.databaseBuilder(
107-
applicationContext,
108-
ReposListDatabase::class.java,
109-
"reposlist.db"
110-
).build()
111-
val repoDao = db.reposListDao()
112-
val repos = repoDao.getAll()
113-
val enabledRepos = StringBuilder()
114-
for (repo in repos) {
115-
if (repo.enabled) {
116-
enabledRepos.append(repo.url).append(", ")
117-
}
118-
}
119-
if (enabledRepos.isNotEmpty()) {
120-
enabledRepos.delete(enabledRepos.length - 2, enabledRepos.length)
121-
TrackHelper.track().event("Enabled Repos", enabledRepos.toString())
122-
.with(MainApplication.INSTANCE!!.tracker)
123-
}
124103
// hide this behind a buildconfig flag for now, but crash the app if it's not an official build and not debug
125104
if (BuildConfig.ENABLE_PROTECTION && !MainApplication.o && !BuildConfig.DEBUG) {
126105
throw RuntimeException("This is not an official build of AMM")

0 commit comments

Comments
 (0)