Skip to content

Commit 4f80456

Browse files
authored
feat: Upgrade kiosk_mode (MewsSystems#695)
1 parent cbf5fa3 commit 4f80456

File tree

8 files changed

+72
-75
lines changed

8 files changed

+72
-75
lines changed

kiosk_mode/android/build.gradle

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ group 'com.mews.kiosk_mode'
22
version '1.0-SNAPSHOT'
33

44
buildscript {
5-
ext.kotlin_version = '1.5.20'
5+
ext.kotlin_version = "1.9.24"
66
repositories {
77
google()
88
mavenCentral()
99
}
1010

1111
dependencies {
12-
classpath 'com.android.tools.build:gradle:4.1.3'
13-
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
12+
classpath("com.android.tools.build:gradle:8.1.4")
13+
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version")
1414
}
1515
}
1616

@@ -25,14 +25,27 @@ apply plugin: 'com.android.library'
2525
apply plugin: 'kotlin-android'
2626

2727
android {
28-
compileSdkVersion 30
29-
namespace 'com.mews.kiosk_mode'
28+
if (project.android.hasProperty("namespace")) {
29+
namespace 'com.mews.kiosk_mode'
30+
}
31+
32+
compileSdk = 34
33+
34+
compileOptions {
35+
sourceCompatibility = JavaVersion.VERSION_21
36+
targetCompatibility = JavaVersion.VERSION_21
37+
}
38+
39+
kotlinOptions {
40+
jvmTarget = JavaVersion.VERSION_21
41+
}
3042

3143
sourceSets {
3244
main.java.srcDirs += 'src/main/kotlin'
3345
}
46+
3447
defaultConfig {
35-
minSdkVersion 23
48+
minSdk = 23
3649
}
3750
}
3851

kiosk_mode/android/gradle/wrapper/gradle-wrapper.properties

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
4+
networkTimeout=10000
5+
validateDistributionUrl=true
36
zipStoreBase=GRADLE_USER_HOME
47
zipStorePath=wrapper/dists
5-
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip
Lines changed: 18 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,34 @@
1-
def localProperties = new Properties()
2-
def localPropertiesFile = rootProject.file('local.properties')
3-
if (localPropertiesFile.exists()) {
4-
localPropertiesFile.withReader('UTF-8') { reader ->
5-
localProperties.load(reader)
6-
}
7-
}
8-
9-
def flutterRoot = localProperties.getProperty('flutter.sdk')
10-
if (flutterRoot == null) {
11-
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
12-
}
13-
14-
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
15-
if (flutterVersionCode == null) {
16-
flutterVersionCode = '1'
17-
}
18-
19-
def flutterVersionName = localProperties.getProperty('flutter.versionName')
20-
if (flutterVersionName == null) {
21-
flutterVersionName = '1.0'
1+
plugins {
2+
id "com.android.application"
3+
id "kotlin-android"
4+
// The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
5+
id "dev.flutter.flutter-gradle-plugin"
226
}
237

24-
apply plugin: 'com.android.application'
25-
apply plugin: 'kotlin-android'
26-
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
27-
288
android {
29-
compileSdkVersion 31
9+
namespace 'com.mews.kiosk_mode_example'
10+
compileSdk = flutter.compileSdkVersion
11+
ndkVersion = '27.0.12077973'
12+
13+
compileOptions {
14+
sourceCompatibility = JavaVersion.VERSION_21
15+
targetCompatibility = JavaVersion.VERSION_21
16+
}
3017

31-
sourceSets {
32-
main.java.srcDirs += 'src/main/kotlin'
18+
kotlinOptions {
19+
jvmTarget = JavaVersion.VERSION_21
3320
}
3421

3522
defaultConfig {
36-
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
3723
applicationId "com.mews.kiosk_mode_example"
3824
minSdkVersion 23
39-
targetSdkVersion 30
40-
versionCode flutterVersionCode.toInteger()
41-
versionName flutterVersionName
25+
targetSdk = flutter.targetSdkVersion
26+
versionCode = flutter.versionCode
27+
versionName = flutter.versionName
4228
}
4329

4430
buildTypes {
4531
release {
46-
// TODO: Add your own signing config for the release build.
47-
// Signing with the debug keys for now, so `flutter run --release` works.
4832
signingConfig signingConfigs.debug
4933
}
5034
}
@@ -53,7 +37,3 @@ android {
5337
flutter {
5438
source '../..'
5539
}
56-
57-
dependencies {
58-
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
59-
}

kiosk_mode/example/android/app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
android:icon="@mipmap/ic_launcher">
66
<activity
77
android:name=".MainActivity"
8+
android:exported="true"
89
android:launchMode="singleTop"
910
android:theme="@style/LaunchTheme"
1011
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,18 @@
1-
buildscript {
2-
ext.kotlin_version = '1.4.32'
3-
repositories {
4-
google()
5-
jcenter()
6-
}
7-
8-
dependencies {
9-
classpath 'com.android.tools.build:gradle:4.1.0'
10-
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
11-
}
12-
}
13-
141
allprojects {
152
repositories {
163
google()
17-
jcenter()
4+
mavenCentral()
185
}
196
}
207

21-
rootProject.buildDir = '../build'
8+
rootProject.layout.buildDirectory = "../build"
229
subprojects {
23-
project.buildDir = "${rootProject.buildDir}/${project.name}"
10+
project.layout.buildDirectory = "${rootProject.layout.buildDirectory}/${project.name}"
2411
}
2512
subprojects {
26-
project.evaluationDependsOn(':app')
13+
project.evaluationDependsOn(":app")
2714
}
2815

29-
task clean(type: Delete) {
30-
delete rootProject.buildDir
16+
tasks.register("clean", Delete) {
17+
delete rootProject.layout.buildDirectory
3118
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
org.gradle.jvmargs=-Xmx1536M
1+
org.gradle.jvmargs=-Xmx4G -XX:MaxMetaspaceSize=2G -XX:+HeapDumpOnOutOfMemoryError
22
android.useAndroidX=true
33
android.enableJetifier=true
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Fri Jun 23 08:50:38 CEST 2017
1+
#Mon Oct 07 15:51:35 BST 2024
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
4+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
45
zipStoreBase=GRADLE_USER_HOME
56
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip
Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,25 @@
1-
include ':app'
1+
pluginManagement {
2+
def flutterSdkPath = {
3+
def properties = new Properties()
4+
file("local.properties").withInputStream { properties.load(it) }
5+
def flutterSdkPath = properties.getProperty("flutter.sdk")
6+
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
7+
return flutterSdkPath
8+
}()
29

3-
def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
4-
def properties = new Properties()
10+
includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")
511

6-
assert localPropertiesFile.exists()
7-
localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
12+
repositories {
13+
google()
14+
mavenCentral()
15+
gradlePluginPortal()
16+
}
17+
}
818

9-
def flutterSdkPath = properties.getProperty("flutter.sdk")
10-
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
11-
apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
19+
plugins {
20+
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
21+
id "com.android.application" version '8.7.0' apply false
22+
id "org.jetbrains.kotlin.android" version "1.9.24" apply false
23+
}
24+
25+
include ":app"

0 commit comments

Comments
 (0)