Skip to content

Commit c1207b5

Browse files
authored
Merge pull request #1133 from cph-cachet/733-project-app_usage---orgjetbrainskotlinkotlin-gradle-plugin1350
app_usage 4.0.0 published
2 parents 1fc3e96 + 9ddf45d commit c1207b5

18 files changed

Lines changed: 168 additions & 188 deletions

File tree

packages/app_usage/CHANGELOG.md

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,63 @@
1+
## 4.0.0
2+
3+
* upgrade of Android APK
4+
* removing `AppUsageException` - instead and empty list is returned on iOS
5+
16
## 3.0.1
27

3-
- Updated pubsec.yaml description
4-
- Fixed license file
8+
* Updated `pubsec.yaml` description
9+
* Fixed license file
510

611
## 3.0.0
712

8-
- Updates Kotlin plugin and AGP
9-
- Upgrade of compileSdkVersion
10-
- Upgrade to Dart 3
13+
* Updates Kotlin plugin and AGP
14+
* Upgrade of compileSdkVersion
15+
* Upgrade to Dart 3
1116

1217
## 2.1.1
1318

14-
- check of Android OS version added when getting `lastForeground`.
19+
* check of Android OS version added when getting `lastForeground`.
1520

1621
## 2.1.0
1722

18-
- Addition of `lastForeground` information - when was the app last time in the foreground.
19-
- update of example app to AndroidX and new gradle build version.
20-
- update of documentation.
23+
* Addition of `lastForeground` information - when was the app last time in the foreground.
24+
* update of example app to AndroidX and new gradle build version.
25+
* update of documentation.
2126

2227
## 2.0.0
2328

24-
- Migration to null safety
29+
* Migration to null safety
2530

2631
## 1.2.0
2732

28-
- Fixed the parsing of package names and app names.
33+
* Fixed the parsing of package names and app names.
2934

3035
## 1.1.1
3136

32-
- Updated example and README slightly to reflect the precision of the plugin.
37+
* Updated example and README slightly to reflect the precision of the plugin.
3338

3439
## 1.1.0
3540

36-
- Changed the behaviour of the plugin to delay asking for permission when app usage is requested, rather than when the app is started.
41+
* Changed the behavior of the plugin to delay asking for permission when app usage is requested, rather than when the app is started.
3742

3843
## 1.0.2
3944

40-
- Fixed an Android issue where the permission activity could not be spawned.
45+
* Fixed an Android issue where the permission activity could not be spawned.
4146

4247
## 1.0.1
4348

44-
- Made the project anew since the old project had an error somewhere.
49+
* Made the project anew since the old project had an error somewhere.
4550

4651
## 1.0.0
4752

48-
- Updated to the new Android API
49-
- Changed Android source code to Kotlin rather than Java
53+
* Updated to the new Android API
54+
* Changed Android source code to Kotlin rather than Java
5055

5156
## 0.9.0
5257

53-
- Update example app to support Android X
54-
- Updated the README file to emphasize the need to use min SDK version 21 for Android
58+
* Update example app to support Android X
59+
* Updated the README file to emphasize the need to use min SDK version 21 for Android
5560

5661
## 0.0.1
5762

58-
- Initial release
63+
* Initial release

packages/app_usage/LICENSE

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,9 @@
11
MIT License.
22

3-
Copyright 2019 Copenhagen Center for Health Technology (CACHET) at the Technical University of Denmark (DTU).
3+
Copyright 2018-2024 the Technical University of Denmark (DTU).
44

5-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
6-
documentation files (the ”Software”), to deal in the Software without restriction, including without limitation
7-
the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
8-
and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
5+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ”Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
96

10-
The above copyright notice and this permission notice shall be included in all copies or substantial
11-
portions of the Software.
7+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
128

13-
THE SOFTWARE IS PROVIDED ”AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
14-
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
15-
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
16-
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
17-
IN THE SOFTWARE.
9+
THE SOFTWARE IS PROVIDED ”AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Lines changed: 43 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,68 @@
1-
group 'dk.cachet.app_usage'
2-
version '1.0-SNAPSHOT'
1+
group = "dk.cachet.app_usage"
2+
version = "1.0-SNAPSHOT"
33

44
buildscript {
5-
ext.kotlin_version = '1.7.10'
5+
ext.kotlin_version = "1.8.22"
66
repositories {
77
google()
8-
mavenCentral()
8+
mavenCentral()
99
}
1010

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

17-
rootProject.allprojects {
17+
allprojects {
1818
repositories {
1919
google()
20-
jcenter()
20+
mavenCentral()
2121
}
2222
}
2323

24-
apply plugin: 'com.android.library'
25-
apply plugin: 'kotlin-android'
24+
apply plugin: "com.android.library"
25+
apply plugin: "kotlin-android"
2626

2727
android {
28-
compileSdkVersion 33
28+
namespace "dk.cachet.app_usage"
29+
30+
compileSdk = 35
31+
32+
compileOptions {
33+
sourceCompatibility = JavaVersion.VERSION_11
34+
targetCompatibility = JavaVersion.VERSION_11
35+
}
36+
37+
kotlinOptions {
38+
jvmTarget = JavaVersion.VERSION_11
39+
}
2940

3041
sourceSets {
31-
main.java.srcDirs += 'src/main/kotlin'
42+
main.java.srcDirs += "src/main/kotlin"
43+
test.java.srcDirs += "src/test/kotlin"
3244
}
45+
3346
defaultConfig {
34-
minSdkVersion 16
47+
minSdk = 21
3548
}
36-
lintOptions {
37-
disable 'InvalidPackage'
49+
50+
dependencies {
51+
testImplementation("org.jetbrains.kotlin:kotlin-test")
52+
testImplementation("org.mockito:mockito-core:5.0.0")
3853
}
39-
namespace "dk.cachet.app_usage"
40-
}
4154

42-
dependencies {
43-
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
55+
testOptions {
56+
unitTests.all {
57+
useJUnitPlatform()
58+
59+
testLogging {
60+
events "passed", "skipped", "failed", "standardOut", "standardError"
61+
outputs.upToDateWhen {false}
62+
showStandardStreams = true
63+
}
64+
}
65+
}
4466
}
67+
68+

packages/app_usage/android/gradle.properties

Lines changed: 0 additions & 4 deletions
This file was deleted.

packages/app_usage/android/gradle/wrapper/gradle-wrapper.properties

Lines changed: 0 additions & 5 deletions
This file was deleted.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[],"android":[{"name":"app_usage","path":"/Users/arata/Developer/carp/flutter-plugins/packages/app_usage/","native_build":true,"dependencies":[]}],"macos":[],"linux":[],"windows":[],"web":[]},"dependencyGraph":[{"name":"app_usage","dependencies":[]}],"date_created":"2024-10-30 13:38:21.146381","version":"3.24.3","swift_package_manager_enabled":false}
1+
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[],"android":[{"name":"app_usage","path":"/Users/bardram/dev/flutter-plugins/packages/app_usage/","native_build":true,"dependencies":[]}],"macos":[],"linux":[],"windows":[],"web":[]},"dependencyGraph":[{"name":"app_usage","dependencies":[]}],"date_created":"2025-02-11 15:03:37.052336","version":"3.27.1","swift_package_manager_enabled":false}
Lines changed: 21 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,44 @@
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.")
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"
126
}
137

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'
22-
}
23-
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 flutter.compileSdkVersion
30-
9+
namespace = "dk.cachet.app_usage_example"
10+
compileSdk = flutter.compileSdkVersion
11+
ndkVersion = flutter.ndkVersion
3112

32-
sourceSets {
33-
main.java.srcDirs += 'src/main/kotlin'
13+
compileOptions {
14+
sourceCompatibility = JavaVersion.VERSION_1_8
15+
targetCompatibility = JavaVersion.VERSION_1_8
3416
}
3517

36-
lintOptions {
37-
disable 'InvalidPackage'
18+
kotlinOptions {
19+
jvmTarget = JavaVersion.VERSION_1_8
3820
}
3921

4022
defaultConfig {
4123
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
4224
applicationId "dk.cachet.app_usage_example"
43-
minSdkVersion flutter.minSdkVersion
44-
targetSdkVersion flutter.targetSdkVersion
45-
versionCode flutterVersionCode.toInteger()
46-
versionName flutterVersionName
25+
// You can update the following values to match your application needs.
26+
// For more information, see: https://flutter.dev/to/review-gradle-config.
27+
minSdk = flutter.minSdkVersion
28+
targetSdk = flutter.targetSdkVersion
29+
versionCode = flutter.versionCode
30+
versionName = flutter.versionName
4731
}
4832

4933
buildTypes {
5034
release {
5135
// TODO: Add your own signing config for the release build.
5236
// Signing with the debug keys for now, so `flutter run --release` works.
53-
signingConfig signingConfigs.debug
37+
signingConfig = signingConfigs.debug
5438
}
5539
}
5640
}
5741

5842
flutter {
59-
source '../..'
60-
}
61-
62-
dependencies {
63-
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
43+
source = "../.."
6444
}

packages/app_usage/example/android/app/src/debug/AndroidManifest.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
package="dk.cachet.app_usage_example">
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
32
<!-- Flutter needs it to communicate with the running application
43
to allow setting breakpoints, to provide hot reload, etc.
54
-->

packages/app_usage/example/android/app/src/main/AndroidManifest.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
package="dk.cachet.app_usage_example"
32
xmlns:tools="http://schemas.android.com/tools">
43

54
<uses-permission

packages/app_usage/example/android/app/src/profile/AndroidManifest.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
package="dk.cachet.app_usage_example">
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
32
<!-- Flutter needs it to communicate with the running application
43
to allow setting breakpoints, to provide hot reload, etc.
54
-->

0 commit comments

Comments
 (0)