Skip to content

Commit

Permalink
refactor: a lot of changes
Browse files Browse the repository at this point in the history
optimize database
optimize student card rotation
add firebase analyitcs, crashlytics and performance metrics
a bit of changes in the launcher icons
an about screen with a few thanks
aboutlibraries
privacy policy update
  • Loading branch information
abdallahmehiz committed Oct 12, 2024
1 parent 414c288 commit cee9854
Show file tree
Hide file tree
Showing 66 changed files with 939 additions and 479 deletions.
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Progres

A remake of the DRDN's Progres WebEtu app, by students for students.

## Some Screenshots

![App Screenshot](https://via.placeholder.com/468x300?text=App+Screenshot+Here)

## Additional Features

- Access your previous years' data
- Material you with dark and light themes
- A more stable experience
- And more coming soon...

## Installation

The app is available on the platforms listed below:

## License

[MIT](https://choosealicense.com/licenses/mit/)
4 changes: 4 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
plugins {
alias(libs.plugins.firebase.crashlytics) apply false
alias(libs.plugins.firebase.performance) apply false
alias(libs.plugins.kotlin.multiplatform) apply false
alias(libs.plugins.android.application) apply false
alias(libs.plugins.jetbrains.compose) apply false
alias(libs.plugins.compose.compiler) apply false
alias(libs.plugins.android.library) apply false
alias(libs.plugins.moko.resources) apply false
alias(libs.plugins.aboutlibraries) apply false
alias(libs.plugins.buildkonfig) apply false
alias(libs.plugins.sqldelight) apply false
alias(libs.plugins.detekt) apply false
alias(libs.plugins.gms) apply false
}

buildscript {
Expand Down
11 changes: 11 additions & 0 deletions composeApp/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@ import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
import org.jetbrains.kotlin.gradle.dsl.JvmTarget

plugins {
alias(libs.plugins.firebase.performance)
alias(libs.plugins.firebase.crashlytics)
alias(libs.plugins.kotlin.multiplatform)
alias(libs.plugins.android.application)
alias(libs.plugins.jetbrains.compose)
alias(libs.plugins.compose.compiler)
alias(libs.plugins.aboutlibraries)
alias(libs.plugins.buildkonfig)
alias(libs.plugins.detekt)
alias(libs.plugins.gms)
}

kotlin {
Expand Down Expand Up @@ -43,6 +47,8 @@ kotlin {

implementation(libs.koin.androidx.startup)
implementation(libs.koin.androidx.workmanager)

implementation(libs.bundles.firebase)
}
commonMain.dependencies {
implementation(project(":i18n"))
Expand Down Expand Up @@ -73,6 +79,7 @@ kotlin {
implementation(libs.placeholder)
implementation(libs.qrscan)
implementation(libs.compottie)
implementation(libs.bundles.aboutlibraries)

implementation(libs.kotlinx.datetime)

Expand Down Expand Up @@ -138,6 +145,7 @@ android {
}

dependencies {
implementation(platform(libs.firebase.bom))
coreLibraryDesugaring(libs.desugar.jdk.libs)
implementation(libs.detekt.gradle.plugin)
detektPlugins(libs.detekt.formatter)
Expand Down Expand Up @@ -171,3 +179,6 @@ buildkonfig {
compose.resources {
generateResClass = always
}

tasks["generateComposeResClass"].dependsOn("exportLibraryDefinitions")
tasks["copyNonXmlValueResourcesForCommonMain"].dependsOn("exportLibraryDefinitions")
29 changes: 29 additions & 0 deletions composeApp/google-services.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"project_info": {
"project_number": "850037090509",
"project_id": "progres-webetu",
"storage_bucket": "progres-webetu.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:850037090509:android:7b74b6a05207dd11b6e184",
"android_client_info": {
"package_name": "mehiz.abdallah.progres"
}
},
"oauth_client": [],
"api_key": [
{
"current_key": "AIzaSyAiMqUaf__Rqy-IXVjUZM-1r5-BIUcZxyU"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": []
}
}
}
],
"configuration_version": "1"
}
121 changes: 67 additions & 54 deletions composeApp/src/androidMain/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,56 +1,69 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.INTERNET" />

<uses-feature android:name="android.hardware.camera"/>
<uses-feature android:name="android.hardware.camera.autofocus"/>
<uses-permission android:name="android.permission.CAMERA"/>

<application
android:name=".App"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:localeConfig="@xml/locales_config"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@android:style/Theme.Material.Light.NoActionBar">
<activity
android:name=".MainActivity"
android:configChanges="orientation|screenSize|screenLayout|keyboardHidden|mnc|colorMode|density|fontScale|fontWeightAdjustment|keyboard|layoutDirection|locale|mcc|navigation|smallestScreenSize|touchscreen|uiMode"
android:exported="true"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".CrashActivity"
android:exported="false"
android:configChanges="orientation|screenSize|screenLayout|keyboardHidden|mnc|colorMode|density|fontScale|fontWeightAdjustment|keyboard|layoutDirection|locale|mcc|navigation|smallestScreenSize|touchscreen|uiMode" />
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.provider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths" />
</provider>
<provider
android:name="androidx.startup.InitializationProvider"
android:authorities="${applicationId}.androidx-startup"
android:exported="false"
tools:node="merge">
<meta-data
android:name="androidx.work.WorkManagerInitializer"
android:value="androidx.startup"
tools:node="remove" />
</provider>
</application>

</manifest>
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.INTERNET" />

<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" android:required="true" />
<uses-permission android:name="android.permission.CAMERA" />

<!-- Remove unnecessary permissions from Firebase dependency -->
<uses-permission android:name="android.permission.ACCESS_ADSERVICES_AD_ID" tools:node="remove" />
<uses-permission android:name="android.permission.ACCESS_ADSERVICES_ATTRIBUTION" tools:node="remove" />
<uses-permission android:name="com.google.android.finsky.permission.BIND_GET_INSTALL_REFERRER_SERVICE" tools:node="remove" />
<uses-permission android:name="com.google.android.gms.permission.AD_ID" tools:node="remove" />

<application
android:name=".App"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:localeConfig="@xml/locales_config"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@android:style/Theme.Material.Light.NoActionBar">
<activity
android:name=".MainActivity"
android:configChanges="orientation|screenSize|screenLayout|keyboardHidden|mnc|colorMode|density|fontScale|fontWeightAdjustment|keyboard|layoutDirection|locale|mcc|navigation|smallestScreenSize|touchscreen|uiMode"
android:exported="true"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".CrashActivity"
android:configChanges="orientation|screenSize|screenLayout|keyboardHidden|mnc|colorMode|density|fontScale|fontWeightAdjustment|keyboard|layoutDirection|locale|mcc|navigation|smallestScreenSize|touchscreen|uiMode"
android:exported="false" />

<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.provider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths" />
</provider>
<provider
android:name="androidx.startup.InitializationProvider"
android:authorities="${applicationId}.androidx-startup"
android:exported="false"
tools:node="merge">
<meta-data
android:name="androidx.work.WorkManagerInitializer"
android:value="androidx.startup"
tools:node="remove" />
</provider>

<!-- Disable unnecessary stuff from Firebase -->
<meta-data android:name="google_analytics_adid_collection_enabled" android:value="false" />
<meta-data android:name="google_analytics_automatic_screen_reporting_enabled" android:value="false" />
<meta-data android:name="google_analytics_default_allow_ad_personalization_signals" android:value="false" />

</application>

</manifest>
Binary file modified composeApp/src/androidMain/ic_launcher-playstore.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 6 additions & 8 deletions composeApp/src/androidMain/kotlin/mehiz/abdallah/progres/App.kt
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
package mehiz.abdallah.progres

import android.app.Application
import com.google.firebase.FirebaseApp
import com.liftric.kvault.KVault
import de.halfbit.logger.initializeLogger
import de.halfbit.logger.sink.android.registerAndroidLogSink
import de.halfbit.logger.sink.println.registerPrintlnSink
import di.initKoin
import mehiz.abdallah.progres.di.WorkersModule
import mehiz.abdallah.progres.i18n.Localize
import org.koin.android.ext.koin.androidContext
import org.koin.androidx.workmanager.koin.workManagerFactory
import org.koin.androix.startup.KoinStartup.onKoinStartup
import org.koin.core.component.KoinComponent
import utils.CredentialManager
import utils.PlatformUtils

class App : Application(), KoinComponent {

Expand All @@ -23,9 +23,9 @@ class App : Application(), KoinComponent {
modules(
initKoin(
datastorePath = filesDir.path,
localize = Localize(applicationContext),
credentialManager = CredentialManager(applicationContext),
kVault = KVault(applicationContext)
kVault = KVault(applicationContext),
platformUtils = PlatformUtils(applicationContext)
),
WorkersModule,
)
Expand All @@ -34,10 +34,8 @@ class App : Application(), KoinComponent {

override fun onCreate() {
super.onCreate()
FirebaseApp.initializeApp(applicationContext)
Thread.setDefaultUncaughtExceptionHandler(GlobalExceptionHandler(applicationContext, CrashActivity::class.java))
initializeLogger {
registerPrintlnSink()
registerAndroidLogSink()
}
initializeLogger { registerAndroidLogSink() }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package mehiz.abdallah.progres

import android.content.Context
import android.content.Intent
import utils.FirebaseUtils
import kotlin.system.exitProcess

class GlobalExceptionHandler(
Expand All @@ -10,6 +11,7 @@ class GlobalExceptionHandler(
) : Thread.UncaughtExceptionHandler {

override fun uncaughtException(t: Thread, e: Throwable) {
FirebaseUtils.reportException(e)
val intent = Intent(context, activity)
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK)
Expand Down

This file was deleted.

11 changes: 11 additions & 0 deletions composeApp/src/androidMain/kotlin/utils/FirebaseUtils.android.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package utils

import com.google.firebase.crashlytics.ktx.crashlytics
import com.google.firebase.ktx.Firebase

actual object FirebaseUtils {
actual fun reportException(throwable: Throwable) {
Firebase.crashlytics.recordException(throwable)
Firebase.crashlytics.sendUnsentReports()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package utils

import io.ktor.client.network.sockets.SocketTimeoutException
import java.net.SocketException
import java.net.UnknownHostException

// timeouts, can't reach and connection resets
actual val Throwable.isNetworkError: Boolean
get() = this is UnknownHostException || this is SocketTimeoutException || this is SocketException
3 changes: 0 additions & 3 deletions composeApp/src/androidMain/kotlin/utils/Platform.android.kt

This file was deleted.

38 changes: 38 additions & 0 deletions composeApp/src/androidMain/kotlin/utils/PlatformUtils.android.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package utils

import android.content.ClipData
import android.content.ClipboardManager
import android.content.Context
import android.content.Intent
import android.net.Uri
import dev.icerock.moko.resources.PluralsResource
import dev.icerock.moko.resources.StringResource

actual class PlatformUtils(context: Context) {

private val context = context
actual val platform: Platform = Platform.Android

actual fun openURI(uri: String) {
val intent = Intent(Intent.ACTION_VIEW, Uri.parse(uri))
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
context.startActivity(intent)
}

actual fun getString(res: StringResource, vararg args: Any): String {
return context.getString(res.resourceId, *args)
}

actual fun getPlural(
res: PluralsResource,
amount: Int,
vararg args: Any,
): String {
return context.resources.getQuantityString(res.resourceId, amount, args)
}

actual fun copyTextToClipboard(text: String) {
val clipboardManager = context.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
clipboardManager.setPrimaryClip(ClipData.newPlainText(null, text))
}
}
Loading

0 comments on commit cee9854

Please sign in to comment.