Skip to content

Commit 8978232

Browse files
gdlboaliveoutsidefimkovSecondThundeRandr0d1v
authored
Version 0.0.7 (#226)
Co-authored-by: Artemiy <53598473+aliveoutside@users.noreply.github.com> Co-authored-by: Fimkov <123477029+fimkov@users.noreply.github.com> Co-authored-by: Uladzislau Hramyka <awayfromgalaxy@gmail.com> Co-authored-by: Andro_Dev <87223939+andr0d1v@users.noreply.github.com> Co-authored-by: keimoger <keimoger@gmail.com> Co-authored-by: iWisp360 <114373500+iWisp360@users.noreply.github.com>
1 parent fa87b10 commit 8978232

288 files changed

Lines changed: 19736 additions & 7195 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/android.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Android CI
2+
3+
on:
4+
pull_request:
5+
branches: ["master", "develop"]
6+
workflow_dispatch:
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout repository
14+
uses: actions/checkout@v5
15+
with:
16+
submodules: recursive
17+
fetch-depth: 0
18+
token: ${{ secrets.GITHUB_TOKEN }}
19+
20+
- name: Set up JDK 21
21+
uses: actions/setup-java@v5
22+
with:
23+
java-version: '21'
24+
distribution: 'temurin'
25+
cache: gradle
26+
27+
- name: Make all scripts executable
28+
run: |
29+
chmod +x gradlew
30+
chmod +x presentation/src/main/cpp/build.sh
31+
32+
- name: Build libvpx
33+
run: cd presentation/src/main/cpp && ./build.sh
34+
35+
- name: Build Debug APK (without GMS)
36+
run: ./gradlew assembleDebug
37+
38+
- name: Run Unit Tests
39+
run: ./gradlew testDebugUnitTest
40+
41+
- name: Upload universal APK
42+
uses: actions/upload-artifact@v7
43+
with:
44+
name: app-universal-no-appid
45+
path: app/build/outputs/apk/debug/app-universal-debug.apk
46+
47+
- name: Upload arm64-v8a APK
48+
uses: actions/upload-artifact@v7
49+
with:
50+
name: app-arm64-v8a-no-appid
51+
path: app/build/outputs/apk/debug/app-arm64-v8a-debug.apk
52+
53+
- name: Upload armeabi-v7a APK
54+
uses: actions/upload-artifact@v7
55+
with:
56+
name: app-armeabi-v7a-no-appid
57+
path: app/build/outputs/apk/debug/app-armeabi-v7a-debug.apk
58+
59+
- name: Upload x86_64 APK
60+
uses: actions/upload-artifact@v7
61+
with:
62+
name: app-x86_64-no-appid
63+
path: app/build/outputs/apk/debug/app-x86_64-debug.apk

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<img src="https://img.shields.io/github/stars/monogram-android/monogram" width="120">
1616
</a>
1717
<img src="https://img.shields.io/badge/Kotlin-2.0+-blue.svg?logo=kotlin" width="130">
18-
<img src="https://img.shields.io/badge/TDLib-1.8.62-blue" width="120">
18+
<img src="https://img.shields.io/badge/TDLib-1.8.63-blue" width="120">
1919
<img src="https://img.shields.io/badge/Status-Active_Development-orange" width="170">
2020
<a href="https://boosty.to/monogram">
2121
<img src="https://img.shields.io/badge/Boosty-Support_the_project-ff6f61?logo=boosty&logoColor=white" width="200">

README_ES.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<img src="https://img.shields.io/github/stars/monogram-android/monogram" width="120">
1616
</a>
1717
<img src="https://img.shields.io/badge/Kotlin-2.0+-blue.svg?logo=kotlin" width="130">
18-
<img src="https://img.shields.io/badge/TDLib-1.8.62-blue" width="120">
18+
<img src="https://img.shields.io/badge/TDLib-1.8.63-blue" width="120">
1919
<img src="https://img.shields.io/badge/Status-Active_Development-orange" width="170">
2020
<a href="https://boosty.to/monogram">
2121
<img src="https://img.shields.io/badge/Boosty-Support_the_project-ff6f61?logo=boosty&logoColor=white" width="200">

README_KOR.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<img src="https://img.shields.io/github/stars/monogram-android/monogram" width="120">
1616
</a>
1717
<img src="https://img.shields.io/badge/Kotlin-2.0+-blue.svg?logo=kotlin" width="130">
18-
<img src="https://img.shields.io/badge/TDLib-1.8.62-blue" width="120">
18+
<img src="https://img.shields.io/badge/TDLib-1.8.63-blue" width="120">
1919
<img src="https://img.shields.io/badge/Status-Active_Development-orange" width="170">
2020
<a href="https://boosty.to/monogram">
2121
<img src="https://img.shields.io/badge/Boosty-Support_the_project-ff6f61?logo=boosty&logoColor=white" width="200">

README_RU.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<img src="https://img.shields.io/github/stars/monogram-android/monogram" width="120">
1616
</a>
1717
<img src="https://img.shields.io/badge/Kotlin-2.0+-blue.svg?logo=kotlin" width="130">
18-
<img src="https://img.shields.io/badge/TDLib-1.8.62-blue" width="120">
18+
<img src="https://img.shields.io/badge/TDLib-1.8.63-blue" width="120">
1919
<img src="https://img.shields.io/badge/Status-Active_Development-orange" width="170">
2020
<a href="https://boosty.to/monogram">
2121
<img src="https://img.shields.io/badge/Boosty-Support_the_project-ff6f61?logo=boosty&logoColor=white" width="200">

README_UR.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<img src="https://img.shields.io/github/stars/monogram-android/monogram" width="120">
1616
</a>
1717
<img src="https://img.shields.io/badge/Kotlin-2.0+-blue.svg?logo=kotlin" width="130">
18-
<img src="https://img.shields.io/badge/TDLib-1.8.62-blue" width="120">
18+
<img src="https://img.shields.io/badge/TDLib-1.8.63-blue" width="120">
1919
<img src="https://img.shields.io/badge/Status-Active_Development-orange" width="170">
2020
<a href="https://boosty.to/monogram">
2121
<img src="https://img.shields.io/badge/Boosty-Support_the_project-ff6f61?logo=boosty&logoColor=white" width="200">

app/build.gradle.kts

Lines changed: 52 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import com.android.build.api.artifact.SingleArtifact
22
import com.android.build.api.variant.FilterConfiguration
3+
import com.android.build.api.variant.impl.VariantOutputImpl
34
import com.google.android.gms.oss.licenses.plugin.DependencyTask
45
import com.google.gms.googleservices.GoogleServicesPlugin
56

67
plugins {
78
alias(libs.plugins.android.application)
8-
alias(libs.plugins.kotlin.android)
99
alias(libs.plugins.kotlin.compose)
1010
alias(libs.plugins.google.oss.licenses)
1111
alias(libs.plugins.google.services)
@@ -20,8 +20,8 @@ android {
2020
applicationId = "org.monogram"
2121
minSdk = 25
2222
targetSdk = 36
23-
versionCode = 6
24-
versionName = "0.0.6"
23+
versionCode = 7
24+
versionName = "0.0.7"
2525
}
2626

2727
splits {
@@ -45,10 +45,16 @@ android {
4545
getDefaultProguardFile("proguard-android-optimize.txt"),
4646
"proguard-rules.pro"
4747
)
48+
buildFeatures {
49+
resValues = true
50+
}
4851
signingConfig = signingConfigs.getByName("debug")
4952
resValue("string", "app_name", "MonoGram")
5053
}
5154
debug {
55+
buildFeatures {
56+
resValues = true
57+
}
5258
applicationIdSuffix = ".debug"
5359
isMinifyEnabled = false
5460
resValue("string", "app_name", "MonoGram Debug")
@@ -58,54 +64,56 @@ android {
5864
sourceCompatibility = JavaVersion.VERSION_21
5965
targetCompatibility = JavaVersion.VERSION_21
6066
}
61-
kotlin {
62-
jvmToolchain(21)
63-
}
6467
buildFeatures {
6568
compose = true
6669
}
6770
}
6871

6972
androidComponents {
7073
onVariants { variant ->
74+
if (variant.buildType != "release") return@onVariants
75+
76+
variant.outputs.forEach { output ->
77+
val variantOutput = output as? VariantOutputImpl ?: return@forEach
78+
val abi = variantOutput.filters.find {
79+
it.filterType == FilterConfiguration.FilterType.ABI
80+
}?.identifier ?: "universal"
81+
val versionName = variantOutput.versionName.orNull ?: "unknown"
82+
83+
variantOutput.outputFileName.set(
84+
"monogram-$abi-$versionName-${variant.buildType}.apk"
85+
)
86+
}
87+
7188
val apkDirProvider = variant.artifacts.get(SingleArtifact.APK)
72-
val artifactsLoader = variant.artifacts.getBuiltArtifactsLoader()
73-
74-
val renameTask = tasks.register("rename${variant.name.capitalize()}Apk") {
75-
inputs.dir(apkDirProvider)
76-
77-
doLast {
78-
val builtArtifacts = artifactsLoader.load(apkDirProvider.get())!!
79-
val targetDir = apkDirProvider.get().asFile
80-
81-
builtArtifacts.elements.forEach { artifact ->
82-
val abi = artifact.filters.find {
83-
it.filterType == FilterConfiguration.FilterType.ABI
84-
}?.identifier ?: "universal"
85-
val versionName = artifact.versionName
86-
val versionCode = artifact.versionCode
87-
val buildType = variant.buildType
88-
89-
val originalApk = File(artifact.outputFile)
90-
val targetFile = File(
91-
targetDir,
92-
"monogram-$abi-${versionName}(${versionCode})-${buildType}.apk"
93-
)
94-
95-
originalApk.copyTo(targetFile, overwrite = true)
96-
}
89+
90+
val capitalizedVariantName = variant.name.replaceFirstChar {
91+
if (it.isLowerCase()) it.titlecase() else it.toString()
92+
}
93+
94+
val copyTask = tasks.register<Sync>("copy${capitalizedVariantName}Apk") {
95+
from(apkDirProvider)
96+
include("*.apk")
97+
into(layout.projectDirectory.dir("releases"))
98+
99+
doFirst {
100+
destinationDir.mkdirs()
101+
destinationDir.listFiles()
102+
?.filter { it.isFile && it.extension == "apk" && it.name.startsWith("monogram-") }
103+
?.forEach { it.delete() }
97104
}
98105
}
99106

100-
project.tasks.matching { it.name == "assemble${variant.name.capitalize()}" }.configureEach {
101-
finalizedBy(renameTask)
107+
project.tasks.matching { it.name == "assemble${capitalizedVariantName}" }.configureEach {
108+
finalizedBy(copyTask)
102109
}
103110
}
104111
}
105112

106113
dependencies {
107114
implementation(platform(libs.androidx.compose.bom))
108115
implementation(libs.bundles.androidx.compose)
116+
implementation(libs.androidx.core.splashscreen)
109117

110118
implementation(libs.bundles.decompose)
111119
implementation(libs.bundles.koin)
@@ -131,14 +139,20 @@ dependencies {
131139

132140
tasks.withType(DependencyTask::class.java).configureEach {
133141
if (name == "debugOssDependencyTask") {
134-
val releaseTaskProvider = project.tasks.named<DependencyTask>("releaseOssDependencyTask")
142+
val releaseJsonProvider =
143+
layout.buildDirectory.file("generated/third_party_licenses/release/dependencies.json")
144+
val debugJsonProvider =
145+
layout.buildDirectory.file("generated/third_party_licenses/debug/dependencies.json")
135146

136-
dependsOn(releaseTaskProvider)
147+
dependsOn("releaseOssDependencyTask")
137148

138149
doLast {
139-
val releaseJson = releaseTaskProvider.get().dependenciesJson.get().asFile
140-
val debugJson = dependenciesJson.get().asFile
141-
if (releaseJson.exists()) releaseJson.copyTo(debugJson, overwrite = true)
150+
val releaseJson = releaseJsonProvider.get().asFile
151+
val debugJson = debugJsonProvider.get().asFile
152+
if (releaseJson.exists()) {
153+
debugJson.parentFile?.mkdirs()
154+
releaseJson.copyTo(debugJson, overwrite = true)
155+
}
142156
}
143157
}
144158
}

app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
android:label="@string/app_name"
4343
android:launchMode="singleTask"
4444
android:supportsPictureInPicture="true"
45-
android:theme="@style/Theme.MonoGram"
45+
android:theme="@style/Theme.MonoGram.Startup"
4646
android:windowSoftInputMode="adjustResize"
4747
tools:targetApi="33">
4848
<intent-filter>

app/src/main/java/org/monogram/app/App.kt

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import org.koin.core.context.startKoin
1212
import org.maplibre.android.MapLibre
1313
import org.maplibre.android.WellKnownTileServer
1414
import org.monogram.app.di.appModule
15+
import org.monogram.data.infra.DataMemoryPressureHandler
1516
import org.monogram.domain.managers.DistrManager
1617
import org.monogram.domain.repository.AppPreferencesProvider
1718
import org.monogram.domain.repository.PushProvider
@@ -33,6 +34,19 @@ class App : Application(), SingletonImageLoader.Factory {
3334
checkPushAvailability()
3435
}
3536

37+
@Suppress("DEPRECATION")
38+
override fun onTrimMemory(level: Int) {
39+
super.onTrimMemory(level)
40+
if (level >= TRIM_MEMORY_RUNNING_LOW) {
41+
trimInMemoryCaches("onTrimMemory:$level")
42+
}
43+
}
44+
45+
override fun onLowMemory() {
46+
super.onLowMemory()
47+
trimInMemoryCaches("onLowMemory")
48+
}
49+
3650
private fun initCrashHandler() {
3751
val defaultHandler = Thread.getDefaultUncaughtExceptionHandler()
3852
Thread.setDefaultUncaughtExceptionHandler { thread, throwable ->
@@ -79,7 +93,26 @@ class App : Application(), SingletonImageLoader.Factory {
7993
}
8094
}
8195

96+
private fun trimInMemoryCaches(reason: String) {
97+
if (!::container.isInitialized) return
98+
runCatching {
99+
get<DataMemoryPressureHandler>().clearDataCaches(reason)
100+
}.onFailure { error ->
101+
Log.w(TAG, "Failed to clear data caches for $reason", error)
102+
}
103+
104+
runCatching {
105+
get<ImageLoader>().memoryCache?.clear()
106+
}.onFailure { error ->
107+
Log.w(TAG, "Failed to clear Coil memory cache for $reason", error)
108+
}
109+
}
110+
82111
override fun newImageLoader(context: PlatformContext): ImageLoader {
83112
return get<ImageLoader>()
84113
}
114+
115+
companion object {
116+
private const val TAG = "App"
117+
}
85118
}

0 commit comments

Comments
 (0)