Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 17 additions & 4 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,37 @@
"version": "0.2.0",
"configurations": [
{
"name": "Obtainium",
"name": "Obtainium (debug mode)",
"request": "launch",
"type": "dart",
"args":[ "--flavor", "normal" ]
"flutterMode": "debug",
"program": "lib/main.dart",
"args": [
"--flavor",
"normal"
]
},
{
"name": "Obtainium (profile mode)",
"request": "launch",
"type": "dart",
"flutterMode": "profile",
"args":[ "--flavor", "normal" ]
"program": "lib/main.dart",
"args": [
"--flavor",
"normal"
]
},
{
"name": "Obtainium (release mode)",
"request": "launch",
"type": "dart",
"flutterMode": "release",
"args":[ "--flavor", "normal" ]
"program": "lib/main.dart",
"args": [
"--flavor",
"normal"
]
}
]
}
51 changes: 39 additions & 12 deletions android/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,24 @@ var flutterVersionName = localProperties.getProperty("flutter.versionName") ?: "

val keystoreProperties = Properties()
val keystorePropertiesFile = rootProject.file("key.properties")
if (keystorePropertiesFile.exists()) {
val keystorePropertiesExists = keystorePropertiesFile.exists()
if (keystorePropertiesExists) {
keystoreProperties.load(FileInputStream(keystorePropertiesFile))
}

android {
namespace = "dev.imranr.obtainium"
compileSdk = flutter.compileSdkVersion
ndkVersion = "27.0.12077973" // 'flutter.ndkVersion' produces warnings (TODO can/should we switch back?)
ndkVersion = "28.2.13676358"

compileOptions {
isCoreLibraryDesugaringEnabled = true
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

kotlinOptions {
jvmTarget = JavaVersion.VERSION_11.toString()
jvmTarget = JavaVersion.VERSION_17.toString()
}

defaultConfig {
Expand All @@ -52,31 +53,57 @@ android {
versionName = flutterVersionName
}

flavorDimensions("flavor")
flavorDimensions += "default"

productFlavors {
create("normal") {
dimension = "flavor"
dimension = "default"
applicationIdSuffix = ""
}
create("fdroid") {
dimension = "flavor"
dimension = "default"
applicationIdSuffix = ".fdroid"
}
}

signingConfigs {
create("release") {
keyAlias = keystoreProperties["keyAlias"].toString()
keyPassword = keystoreProperties["keyPassword"].toString()
keyAlias = keystoreProperties["keyAlias"] as String?
keyPassword = keystoreProperties["keyPassword"] as String?
storeFile = keystoreProperties["storeFile"]?.let { file(it) }
storePassword = keystoreProperties["storePassword"].toString()
storePassword = keystoreProperties["storePassword"] as String?
}
}

buildTypes {
getByName("release") {
signingConfig = signingConfigs.getByName("release")
val releaseSigningConfig = signingConfigs.getByName("release")
signingConfig = if (keystorePropertiesExists && releaseSigningConfig.storeFile != null) {
releaseSigningConfig
} else {
if (gradle.startParameter.taskNames.any { it.contains("release", ignoreCase = true) }) {
logger.error(
"""
You are trying to create a release build, but a key.properties file was not found.
Falling back to the "debug" signing config.
To sign a release build, a keystore properties file is required.

The following is an example configuration.
Create a file named [project]/android/key.properties that contains a reference to your keystore.
Don't include the angle brackets (< >). They indicate that the text serves as a placeholder for your values.

storePassword=<keystore password>
keyPassword=<key password>
keyAlias=<key alias>
storeFile=<keystore file location>

For more info, see:
* https://docs.flutter.dev/deployment/android#sign-the-app
""".trimIndent()
)
}
signingConfigs.getByName("debug")
}
}
getByName("debug") {
applicationIdSuffix = ".debug"
Expand Down
9 changes: 4 additions & 5 deletions android/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@ allprojects {
repositories {
google()
mavenCentral()
maven {
// [required] background_fetch
url = uri("${project(":background_fetch").projectDir}/libs")
}
}
}

val newBuildDir: Directory = rootProject.layout.buildDirectory.dir("../../build").get()
val newBuildDir: Directory =
rootProject.layout.buildDirectory
.dir("../../build")
.get()
rootProject.layout.buildDirectory.value(newBuildDir)

subprojects {
Expand Down
2 changes: 1 addition & 1 deletion android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-all.zip
21 changes: 11 additions & 10 deletions android/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
pluginManagement {
val flutterSdkPath = run {
val properties = java.util.Properties()
file("local.properties").inputStream().use { properties.load(it) }
val flutterSdkPath = properties.getProperty("flutter.sdk")
require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" }
flutterSdkPath
}
val flutterSdkPath =
run {
val properties = java.util.Properties()
file("local.properties").inputStream().use { properties.load(it) }
val flutterSdkPath = properties.getProperty("flutter.sdk")
require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" }
flutterSdkPath
}

includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")

Expand All @@ -18,8 +19,8 @@ pluginManagement {

plugins {
id("dev.flutter.flutter-plugin-loader") version "1.0.0"
id("com.android.application") version "8.7.3" apply false
id("org.jetbrains.kotlin.android") version "2.1.0" apply false
id("com.android.application") version "8.11.1" apply false
id("org.jetbrains.kotlin.android") version "2.2.20" apply false
}

include(":app")
include(":app")
2 changes: 1 addition & 1 deletion lib/pages/app.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_markdown/flutter_markdown.dart';
import 'package:flutter_markdown_plus/flutter_markdown_plus.dart';
import 'package:obtainium/components/generated_form_modal.dart';
import 'package:obtainium/custom_errors.dart';
import 'package:obtainium/main.dart';
Expand Down
2 changes: 1 addition & 1 deletion lib/pages/apps.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import 'dart:convert';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_markdown/flutter_markdown.dart';
import 'package:flutter_markdown_plus/flutter_markdown_plus.dart';
import 'package:obtainium/components/custom_app_bar.dart';
import 'package:obtainium/components/generated_form.dart';
import 'package:obtainium/components/generated_form_modal.dart';
Expand Down
Loading