Skip to content

Commit

Permalink
Updated app version to v1.0.6
Browse files Browse the repository at this point in the history
  • Loading branch information
polodarb authored Oct 16, 2023
2 parents 104f7e7 + 9a40e2d commit 1978338
Show file tree
Hide file tree
Showing 70 changed files with 2,365 additions and 1,101 deletions.
14 changes: 8 additions & 6 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ plugins {
id("org.jetbrains.kotlin.plugin.serialization")
id("com.google.gms.google-services")
id("com.google.firebase.crashlytics")
// id("kotlin-kapt")
id("com.google.firebase.firebase-perf")
}

val keystorePropertiesFile = rootProject.file("keystore.properties")
Expand All @@ -32,8 +32,8 @@ android {
applicationId = "ua.polodarb.gmsflags"
minSdk = 29
targetSdk = 33
versionCode = 6
versionName = "1.0.5"
versionCode = 7
versionName = "1.0.6"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
Expand Down Expand Up @@ -108,7 +108,7 @@ dependencies {
implementation("androidx.core:core-splashscreen:1.0.1")

// Navigation
implementation("androidx.navigation:navigation-compose:2.7.2")
implementation("androidx.navigation:navigation-compose:2.7.4")

// DataStore
implementation("androidx.datastore:datastore-preferences:1.0.0")
Expand All @@ -118,14 +118,16 @@ dependencies {
implementation("com.google.firebase:firebase-analytics-ktx")
implementation("com.google.firebase:firebase-crashlytics-ktx")
implementation("com.google.firebase:firebase-analytics-ktx")
implementation("com.google.firebase:firebase-perf-ktx")
implementation("com.google.firebase:firebase-messaging-ktx")

implementation("com.github.requery:sqlite-android:3.42.0")

implementation("com.google.android.material:material:1.9.0")
implementation("androidx.core:core-ktx:1.12.0")
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.6.2")
implementation("androidx.activity:activity-compose:1.7.2")
implementation("androidx.compose.ui:ui:1.5.1")
implementation("androidx.activity:activity-compose:1.8.0")
implementation("androidx.compose.ui:ui:1.5.3")
implementation("androidx.compose.ui:ui-tooling-preview:1.5.1")
implementation("androidx.compose.material3:material3:1.2.0-alpha04")
implementation("androidx.leanback:leanback:1.0.0")
Expand Down
11 changes: 9 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,30 +10,37 @@
<application
android:name=".GMSApplication"
android:allowBackup="false"
android:enableOnBackInvokedCallback="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.App.Starting"
tools:targetApi="31">
tools:targetApi="tiramisu">
<activity
android:name=".ui.CrashActivity"
android:enableOnBackInvokedCallback="false"
android:exported="false"
android:theme="@style/AppTheme"/>
<activity
android:name=".ui.MainActivity"
android:enableOnBackInvokedCallback="true"
android:windowSoftInputMode="adjustResize"
android:exported="true"
android:label="@string/app_name"
android:theme="@style/Theme.App.Starting">
android:theme="@style/Theme.App.Starting"
tools:targetApi="tiramisu">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data
android:name="com.google.firebase.messaging.default_notification_icon"
android:resource="@drawable/ic_notify_logo" />
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}"
Expand Down
90 changes: 90 additions & 0 deletions app/src/main/assets/suggestedFlags.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
[
{
"name": "Google Search Suggestions new design",
"author": "Nail Sadykov",
"flags": [
{
"tag": "45369077",
"type": "bool",
"value": "1"
}
],
"package": "com.google.android.libraries.search.googleapp.device#com.google.android.googlequicksearchbox",
"isArchive": false
},
{
"name": "Proofreading mode in GBoard",
"author": "GApps Flags & Leaks",
"flags": [
{
"tag": "writing_helper",
"type": "bool",
"value": "1"
},
{
"tag": "writing_helper_enable_free_chat",
"type": "bool",
"value": "1"
},
{
"tag": "writing_helper_chip_shown_as_candidate",
"type": "bool",
"value": "1"
}
],
"package": "com.google.android.inputmethod.latin#com.google.android.inputmethod.latin",
"isArchive": false
},
{
"name": "\"Undo\" button in GBoard",
"author": "GApps Flags & Leaks",
"flags": [
{
"tag": "undo_access_point",
"type": "bool",
"value": "1"
}
],
"package": "com.google.android.inputmethod.latin#com.google.android.inputmethod.latin",
"isArchive": false
},
{
"name": "Enable transparent statusBar in dialer",
"author": "Nail Sadykov",
"flags": [
{
"tag": "45372787",
"type": "bool",
"value": "1"
}
],
"package": "com.google.android.dialer.directboot",
"isArchive": false
},
{
"name": "Enable docs scanner in Drive",
"author": "Nail Sadykov",
"flags": [
{
"tag": "MlkitScanningUiFeature__enable_mlkit_scanning_ui",
"type": "bool",
"value": "1"
}
],
"package": "com.google.apps.drive.android#com.google.android.apps.docs",
"isArchive": false
},
{
"name": "Enable MD3 style in Android Auto",
"author": "Nail Sadykov",
"flags": [
{
"tag": "SystemUi__material_you_settings_enabled",
"type": "bool",
"value": "1"
}
],
"package": "com.google.android.projection.gearhead",
"isArchive": false
}
]
7 changes: 4 additions & 3 deletions app/src/main/java/ua/polodarb/gmsflags/GMSApplication.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@ import com.topjohnwu.superuser.Shell
import com.topjohnwu.superuser.ipc.RootService
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.MutableStateFlow
import org.koin.android.BuildConfig
import org.koin.android.ext.koin.androidContext
import org.koin.android.ext.koin.androidLogger
import org.koin.core.context.startKoin
import org.koin.core.logger.Level
import ua.polodarb.gmsflags.core.Constants
import ua.polodarb.gmsflags.data.databases.gms.RootDatabase
import ua.polodarb.gmsflags.di.appModule
import ua.polodarb.gmsflags.di.databaseModule
import ua.polodarb.gmsflags.di.remoteModule
import ua.polodarb.gmsflags.di.repositoryModule
import ua.polodarb.gmsflags.di.viewModelsModule
import ua.polodarb.gmsflags.ui.CrashActivity
Expand Down Expand Up @@ -54,7 +55,7 @@ class GMSApplication : Application() {
startKoin {
androidLogger(if (BuildConfig.DEBUG) Level.DEBUG else Level.NONE)
androidContext(this@GMSApplication)
modules(listOf(appModule, viewModelsModule, databaseModule, repositoryModule))
modules(listOf(appModule, viewModelsModule, databaseModule, repositoryModule, remoteModule))
}
}

Expand Down Expand Up @@ -88,7 +89,7 @@ class GMSApplication : Application() {
}

fun getRootDatabase(): IRootDatabase {
check (isRootDatabaseInitialized) { "RootDatabase is not initialized yet." }
check (isRootDatabaseInitialized) { Constants.GMS_DATABASE_CRASH_MSG }
return rootDatabase
}
}
1 change: 1 addition & 0 deletions app/src/main/java/ua/polodarb/gmsflags/core/Constants.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ object Constants {
const val TAG = "RootDatabase"
const val DB_PATH_GMS = "/data/data/com.google.android.gms/databases/phenotype.db"
const val DB_PATH_VENDING = "/data/data/com.android.vending/databases/phenotype.db"
const val GMS_DATABASE_CRASH_MSG = "RootDatabase is not initialized yet."
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@ class RootDatabase : RootService() {
override fun getOverriddenBoolFlagsByPackage(pkgName: String?): Map<String?, String?> =
this@RootDatabase.getOverriddenBoolFlagsByPackage(pkgName)

override fun getOverriddenIntFlagsByPackage(pkgName: String): Map<String, String> =
override fun getOverriddenIntFlagsByPackage(pkgName: String): Map<String?, String?> =
this@RootDatabase.getOverriddenIntFlagsByPackage(pkgName)

override fun getOverriddenFloatFlagsByPackage(pkgName: String): Map<String, String> =
override fun getOverriddenFloatFlagsByPackage(pkgName: String): Map<String?, String?> =
this@RootDatabase.getOverriddenFloatFlagsByPackage(pkgName)

override fun getOverriddenStringFlagsByPackage(pkgName: String): Map<String, String> =
override fun getOverriddenStringFlagsByPackage(pkgName: String): Map<String?, String?> =
this@RootDatabase.getOverriddenStringFlagsByPackage(pkgName)

override fun getAllOverriddenBoolFlags(): Map<String?, String?> =
Expand Down Expand Up @@ -408,38 +408,38 @@ class RootDatabase : RootService() {
}


private fun getOverriddenIntFlagsByPackage(pkgName: String): Map<String, String> { // todo: not used
private fun getOverriddenIntFlagsByPackage(pkgName: String): Map<String?, String?> { // todo: not used
val cursor = gmsDB.rawQuery(
"SELECT DISTINCT name, intVal FROM FlagOverrides WHERE packageName = \"$pkgName\";",
null
)
val list = mutableMapOf<String, String>()
val list = mutableMapOf<String?, String?>()
while (cursor.moveToNext()) {
list[cursor.getString(0)] = cursor.getString(1)
}
cursor.close()
return list.toMap()
}

private fun getOverriddenFloatFlagsByPackage(pkgName: String): Map<String, String> { // todo: not used
private fun getOverriddenFloatFlagsByPackage(pkgName: String): Map<String?, String?> { // todo: not used
val cursor = gmsDB.rawQuery(
"SELECT DISTINCT name, floatVal FROM FlagOverrides WHERE packageName = \"$pkgName\";",
null
)
val list = mutableMapOf<String, String>()
val list = mutableMapOf<String?, String?>()
while (cursor.moveToNext()) {
list[cursor.getString(0)] = cursor.getString(1)
}
cursor.close()
return list.toMap()
}

private fun getOverriddenStringFlagsByPackage(pkgName: String): Map<String, String> { // todo: not used
private fun getOverriddenStringFlagsByPackage(pkgName: String): Map<String?, String?> { // todo: not used
val cursor = gmsDB.rawQuery(
"SELECT DISTINCT name, stringVal FROM FlagOverrides WHERE packageName = \"$pkgName\";",
null
)
val list = mutableMapOf<String, String>()
val list = mutableMapOf<String?, String?>()
while (cursor.moveToNext()) {
list[cursor.getString(0)] = cursor.getString(1)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package ua.polodarb.gmsflags.data.remote

import android.util.Log
import io.ktor.client.HttpClientConfig
import io.ktor.client.plugins.HttpTimeout
import io.ktor.client.plugins.contentnegotiation.ContentNegotiation
import io.ktor.client.plugins.logging.LogLevel
import io.ktor.client.plugins.logging.Logger
import io.ktor.client.plugins.logging.Logging
import io.ktor.serialization.kotlinx.json.json
import kotlinx.serialization.json.Json
import ua.polodarb.gmsflags.BuildConfig

fun HttpClientConfig<*>.setConfig(tag: String) {
install(Logging) { this.setConfig(tag = tag) }
install(ContentNegotiation) { this.setConfig() }
install(HttpTimeout) { this.setConfig() }
}

private fun Logging.Config.setConfig(tag: String) {
this.level = if (BuildConfig.DEBUG) LogLevel.ALL else LogLevel.NONE
this.logger = object: Logger {
override fun log(message: String) {
Log.e(tag, message)
}
}
}

private fun ContentNegotiation.Config.setConfig() {
this.json(json = Json {
ignoreUnknownKeys = true
isLenient = true
})
}

private const val TIMEOUT = 5000L

private fun HttpTimeout.HttpTimeoutCapabilityConfiguration.setConfig() {
requestTimeoutMillis = TIMEOUT
connectTimeoutMillis = TIMEOUT
socketTimeoutMillis = TIMEOUT
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package ua.polodarb.gmsflags.data.remote

sealed class Resource<T>(val data: T? = null, val message: String? = null) {
class Success<T>(data: T) : Resource<T>(data)
class Error<T>(exception: Exception? = null, data: T? = null) :
Resource<T>(data, exception?.message)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package ua.polodarb.gmsflags.data.remote.flags

import ua.polodarb.gmsflags.data.remote.Resource
import ua.polodarb.gmsflags.data.remote.flags.dto.SuggestedFlagInfo

interface FlagsApiService {
suspend fun getSuggestedFlags(): Resource<List<SuggestedFlagInfo>>
}


Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package ua.polodarb.gmsflags.data.remote.flags

import io.ktor.client.HttpClient
import io.ktor.client.call.body
import io.ktor.client.engine.HttpClientEngine
import io.ktor.client.plugins.defaultRequest
import io.ktor.client.request.get
import io.ktor.client.request.url
import kotlinx.serialization.json.Json
import ua.polodarb.gmsflags.BuildConfig
import ua.polodarb.gmsflags.data.remote.Resource
import ua.polodarb.gmsflags.data.remote.flags.dto.SuggestedFlagInfo
import ua.polodarb.gmsflags.data.remote.setConfig

private const val BASE_URL = "https://raw.githubusercontent.com/polodarb/GMS-Flags/"
private const val ASSETS_PATH = "/app/src/main/assets/"
private const val LOG_TAG = "FlagsApiService"

class FlagsApiServiceImpl(
engine: HttpClientEngine
): FlagsApiService {
private val client = HttpClient(engine) {
this.setConfig(LOG_TAG)
defaultRequest {
url(BASE_URL + (if (BuildConfig.DEBUG) "develop" else "master") + ASSETS_PATH)
}
}

override suspend fun getSuggestedFlags(): Resource<List<SuggestedFlagInfo>> {
return try {
val response: String = client.get { url("suggestedFlags.json") }.body()
Resource.Success(Json.decodeFromString(response))
} catch (e: Exception) {
Resource.Error(e)
}
}
}
Loading

0 comments on commit 1978338

Please sign in to comment.