diff --git a/.github/workflows/analyzer.yml b/.github/workflows/analyzer.yml deleted file mode 100644 index 15df267..0000000 --- a/.github/workflows/analyzer.yml +++ /dev/null @@ -1,19 +0,0 @@ -name: Analyzer - -on: - push: - branches: [ "main" ] - pull_request: - branches: [ "main" ] - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: subosito/flutter-action@v2.8.0 - with: - channel: 'stable' - - run: flutter packages get - - run: flutter analyze - diff --git a/.github/workflows/create_tag.yaml b/.github/workflows/create_tag.yaml new file mode 100644 index 0000000..08dfa37 --- /dev/null +++ b/.github/workflows/create_tag.yaml @@ -0,0 +1,26 @@ +name: Automated version bump + +on: + push: + branches: + - main + +jobs: + bump_version: + name: Version bump on main + runs-on: ubuntu-latest + steps: + - name: Checkout source code + uses: actions/checkout@v2 + with: + token: ${{ secrets.IMPAKTFULL_GITHUB_PAT }} + ref: ${{ github.ref }} + - name: Setup Node.js + uses: actions/setup-node@v2 + with: + node-version: 18 + - name: Automated version bump + uses: impaktfull/gh_action_dart_conventional_release@main + with: + script-pre-run: tool/dart/pre_run.dart + tag-prefix: 'v' \ No newline at end of file diff --git a/.github/workflows/formatting.yml b/.github/workflows/formatting.yml deleted file mode 100644 index b50defe..0000000 --- a/.github/workflows/formatting.yml +++ /dev/null @@ -1,19 +0,0 @@ -name: Code Formatting - -on: - push: - branches: [ "main" ] - pull_request: - branches: [ "main" ] - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: subosito/flutter-action@v2.8.0 - with: - channel: 'stable' - - run: flutter packages get - - run: dart format --set-exit-if-changed . - diff --git a/.github/workflows/publish_to_pubdev.yaml b/.github/workflows/publish_to_pubdev.yaml new file mode 100644 index 0000000..94bdee4 --- /dev/null +++ b/.github/workflows/publish_to_pubdev.yaml @@ -0,0 +1,14 @@ +name: Publish to pub.dev + +on: + push: + tags: + - 'v[0-9]+.[0-9]+.[0-9]+*' + +jobs: + publish: + permissions: + id-token: write # Required for authentication using OIDC + uses: Impaktfull/gh_action_dart_conventional_release/.github/workflows/flutter_release.yml@main + with: + environment: 'pub.dev' \ No newline at end of file diff --git a/.github/workflows/sanity.yml b/.github/workflows/sanity.yml deleted file mode 100644 index 188e655..0000000 --- a/.github/workflows/sanity.yml +++ /dev/null @@ -1,19 +0,0 @@ -name: Sanity - -on: - push: - branches: [ "main" ] - pull_request: - branches: [ "main" ] - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: subosito/flutter-action@v2.8.0 - with: - channel: 'stable' - - run: flutter packages get - - run: dart run ./tool/check_for_credentials.dart - diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml deleted file mode 100644 index 12a2e8a..0000000 --- a/.github/workflows/tests.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: Flutter Test - -on: - push: - branches: [ "main" ] - pull_request: - branches: [ "main" ] - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: subosito/flutter-action@v2.8.0 - with: - channel: 'stable' - - run: flutter packages get - - run: dart run ./tool/test_coverage_create_helper.dart - - run: flutter test --coverage - - run: dart run ./tool/test_coverage_filter.dart - - run: dart run ./tool/test_coverage_validate_percentage.dart - - name: Coveralls - uses: coverallsapp/github-action@master - with: - github-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitignore b/.gitignore index 71bb7cc..9aab7a7 100644 --- a/.gitignore +++ b/.gitignore @@ -88,4 +88,7 @@ **_testImage.png # Fvm -.fvm/flutter_sdk \ No newline at end of file +.fvm/flutter_sdk + +# config.dart +example/lib/config.dart \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..10ccdff --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,14 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "Example Flutter App", + "request": "launch", + "type": "dart", + "program": "example/lib/main.dart", + }, + ] +} \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index e3e29b3..0f64bac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,23 +1,33 @@ -## 3.0.1 +# 4.0.0 + +## Breaking: + +- Refactor to impaktfull +- Updated dependencies +- Updated min versions +- Updated kotlin version +- License + +# 3.0.1 Don't fail if release notes are `null` (we fall back to an empty string) -## 3.0.0 +# 3.0.0 Min flutter version 3.3.0 Updated: - Dependencies - Kotlin version to 1.6.0 -## 2.2.0 +# 2.2.0 Added: - (Android) Support for aab files -## 2.1.1 +# 2.1.1 Fixed: - (Android) Memory leak when using `openAndroidInstallScreen: false, keepAndroidNotification: true` -## 2.1.0 +# 2.1.0 Added: - (Android) Support to decide if the download should open the install screen automatically or the user should click on the download notification. By default the install screen will open. - (Android) Support to keep the notification after the download was completed. By default the notification will be dismissed after downloading. @@ -26,7 +36,7 @@ Updated: - Github Actions - Analyzer -## 2.0.1 +# 2.0.1 Updated: - Dependencies - Fixed analyzer warnings @@ -36,7 +46,7 @@ Removed: Added: - Github Actions -## 2.0.0 +# 2.0.0 Breaking: - #18 @@ -49,33 +59,33 @@ Breaking: Added: - Support for testers. Collaborators, members & testers can now use the app with an api token. -## 1.0.1 +# 1.0.1 Fixed: - crash when fetching user details with null avatarurl -## 1.0.0 +# 1.0.0 Added: - Nullsafety - Nullsafety example -## 0.0.5 +# 0.0.5 Added: - No access error so we can check if the api token is valid Fixed: - Non exposed exceptions -## 0.0.4 +# 0.0.4 Fixed: - json.encode would fail if DateTime was used in a toJson -## 0.0.3 +# 0.0.3 Added: - User Details - Extra documentation: `Api Token should have read access only` -## 0.0.2 +# 0.0.2 Added: - pub.dev version label -## 0.0.1 +# 0.0.1 Initial Release diff --git a/LICENSE b/LICENSE index ee9d98b..b49ba2b 100644 --- a/LICENSE +++ b/LICENSE @@ -1,21 +1,31 @@ -MIT License +BSD 3-Clause License -Copyright (c) 2020 Koen Van Looveren +Copyright (c) 2024, Impaktfull -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: +Authors: +- Koen Van Looveren -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: -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. \ No newline at end of file +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/README.md b/README.md index 6df76f7..46a8979 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,10 @@ # AppCenter Release Manager - [![pub package](https://img.shields.io/pub/v/appcenter_release_manager.svg)](https://pub.dartlang.org/packages/appcenter_release_manager) -[![Build Status Analyzer](https://github.com/vanlooverenkoen/flutter_appcenter_release_manager/actions/workflows/analyzer.yml/badge.svg)](https://github.com/vanlooverenkoen/flutter_appcenter_release_manager/actions/workflows/analyzer.yml) -[![Build Status Formatting](https://github.com/vanlooverenkoen/flutter_appcenter_release_manager/actions/workflows/formatting.yml/badge.svg)](https://github.com/vanlooverenkoen/flutter_appcenter_release_manager/actions/workflows/formatting.yml) -[![Build Status Test](https://github.com/vanlooverenkoen/flutter_appcenter_release_manager/actions/workflows/tests.yml/badge.svg)](https://github.com/vanlooverenkoen/flutter_appcenter_release_manager/actions/workflows/tests.yml) -[![Coverage Status](https://coveralls.io/repos/github/vanlooverenkoen/flutter_appcenter_release_manager/badge.svg)](https://coveralls.io/github/vanlooverenkoen/flutter_appcenter_release_manager) -[![MIT license](https://img.shields.io/badge/License-MIT-blue.svg)](https://lbesson.mit-license.org/) +[![License](https://img.shields.io/badge/License-BSD_3--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause) Download appcenter updates straight from your iOS or Android app. - ### Use the predefined UI with the AppcenterReleaseManagerLatestReleases widget Api Token should have read access only ```dart diff --git a/analysis_options.yaml b/analysis_options.yaml index acc5d0a..4c6c535 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -2,22 +2,11 @@ include: package:flutter_lints/flutter.yaml analyzer: errors: - missing_required_param: error - missing_return: error todo: ignore - exclude: - - '**.g.dart' - - '**.mocks.dart' language: strict-casts: true strict-raw-types: true linter: rules: - - unawaited_futures - - always_declare_return_types - - unsafe_html - - use_full_hex_values_for_flutter_colors - - prefer_final_in_for_each - - prefer_final_fields - - prefer_final_locals \ No newline at end of file + - unawaited_futures \ No newline at end of file diff --git a/android/build.gradle b/android/build.gradle index 887da34..4c0766e 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -1,15 +1,15 @@ -group 'be.vanlooverenkoen.appcenter_release_manager' +group 'com.impaktfull.appcenter_release_manager' version '1.0-SNAPSHOT' buildscript { - ext.kotlin_version = '1.6.0' + ext.kotlin_version = '1.7.10' repositories { google() - jcenter() + mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:4.2.2' + classpath 'com.android.tools.build:gradle:7.0.4' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } @@ -17,7 +17,7 @@ buildscript { rootProject.allprojects { repositories { google() - jcenter() + mavenCentral() } } diff --git a/android/src/main/AndroidManifest.xml b/android/src/main/AndroidManifest.xml index eb95a8f..3ebdffd 100644 --- a/android/src/main/AndroidManifest.xml +++ b/android/src/main/AndroidManifest.xml @@ -1,11 +1,11 @@ + package="com.impaktfull.appcenter_release_manager"> diff --git a/android/src/main/kotlin/be/vanlooverenkoen/appcenter_release_manager/AppcenterReleaseManagerPlugin.kt b/android/src/main/kotlin/com/impaktfull/appcenter_release_manager/AppcenterReleaseManagerPlugin.kt similarity index 98% rename from android/src/main/kotlin/be/vanlooverenkoen/appcenter_release_manager/AppcenterReleaseManagerPlugin.kt rename to android/src/main/kotlin/com/impaktfull/appcenter_release_manager/AppcenterReleaseManagerPlugin.kt index 11810b5..d3b53e3 100644 --- a/android/src/main/kotlin/be/vanlooverenkoen/appcenter_release_manager/AppcenterReleaseManagerPlugin.kt +++ b/android/src/main/kotlin/com/impaktfull/appcenter_release_manager/AppcenterReleaseManagerPlugin.kt @@ -1,4 +1,4 @@ -package be.vanlooverenkoen.appcenter_release_manager +package com.impaktfull.appcenter_release_manager import android.app.DownloadManager import android.content.BroadcastReceiver diff --git a/android/src/main/kotlin/be/vanlooverenkoen/appcenter_release_manager/FileProvider.kt b/android/src/main/kotlin/com/impaktfull/appcenter_release_manager/FileProvider.kt similarity index 59% rename from android/src/main/kotlin/be/vanlooverenkoen/appcenter_release_manager/FileProvider.kt rename to android/src/main/kotlin/com/impaktfull/appcenter_release_manager/FileProvider.kt index 60ab9c2..badd2ee 100644 --- a/android/src/main/kotlin/be/vanlooverenkoen/appcenter_release_manager/FileProvider.kt +++ b/android/src/main/kotlin/com/impaktfull/appcenter_release_manager/FileProvider.kt @@ -1,4 +1,4 @@ -package be.vanlooverenkoen.appcenter_release_manager +package com.impaktfull.appcenter_release_manager import androidx.core.content.FileProvider diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle index b86e9fc..6b4249c 100644 --- a/example/android/app/build.gradle +++ b/example/android/app/build.gradle @@ -37,8 +37,8 @@ android { } defaultConfig { - applicationId "be.vanlooverenkoen.appcenter_release_manager_example" - minSdkVersion 16 + applicationId "com.impaktfull.appcenter_release_manager_example" + minSdkVersion flutter.minSdkVersion targetSdkVersion 33 versionCode flutterVersionCode.toInteger() versionName flutterVersionName diff --git a/example/android/app/src/main/AndroidManifest.xml b/example/android/app/src/main/AndroidManifest.xml index 90f9373..3e3cd15 100644 --- a/example/android/app/src/main/AndroidManifest.xml +++ b/example/android/app/src/main/AndroidManifest.xml @@ -1,5 +1,5 @@ + package="com.impaktfull.appcenter_release_manager_example"> diff --git a/example/android/app/src/main/kotlin/be/vanlooverenkoen/appcenter_release_manager_example/MainActivity.kt b/example/android/app/src/main/kotlin/be/vanlooverenkoen/appcenter_release_manager_example/MainActivity.kt index c9576e6..4013292 100644 --- a/example/android/app/src/main/kotlin/be/vanlooverenkoen/appcenter_release_manager_example/MainActivity.kt +++ b/example/android/app/src/main/kotlin/be/vanlooverenkoen/appcenter_release_manager_example/MainActivity.kt @@ -1,4 +1,4 @@ -package be.vanlooverenkoen.appcenter_release_manager_example +package com.impaktfull.appcenter_release_manager_example import io.flutter.embedding.android.FlutterActivity diff --git a/example/android/app/src/release/AndroidManifest.xml b/example/android/app/src/release/AndroidManifest.xml index 07f44c9..4092ced 100644 --- a/example/android/app/src/release/AndroidManifest.xml +++ b/example/android/app/src/release/AndroidManifest.xml @@ -1,6 +1,6 @@ + package="com.impaktfull.appcenter_release_manager_example"> CADisableMinimumFrameDurationOnPhone + UIApplicationSupportsIndirectInputEvents + diff --git a/example/lib/config.txt b/example/lib/config.txt new file mode 100644 index 0000000..4ac2bb7 --- /dev/null +++ b/example/lib/config.txt @@ -0,0 +1,5 @@ +class Config { + static const apiToken = ''; + static const preDefinedOwnerName = ''; + static const preDefinedAppName = ''; +} diff --git a/example/lib/main.dart b/example/lib/main.dart index 4d4a81a..18f3517 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -1,17 +1,16 @@ import 'package:appcenter_release_manager/appcenter_release_manager.dart'; +import 'package:appcenter_release_manager_example/config.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -const apiToken = ''; -const preDefinedOwnerName = ''; -const preDefinedAppName = ''; - void main() { runApp(const MyApp()); } class MyApp extends StatefulWidget { - const MyApp({Key? key}) : super(key: key); + const MyApp({ + super.key, + }); @override State createState() => _MyAppState(); @@ -25,7 +24,8 @@ class _MyAppState extends State { @override void initState() { super.initState(); - _appCenterReleaseManager = AppCenterReleaseManager(apiToken: apiToken); + _appCenterReleaseManager = + AppCenterReleaseManager(apiToken: Config.apiToken); } @override @@ -34,7 +34,7 @@ class _MyAppState extends State { home: Scaffold( appBar: AppBar( systemOverlayStyle: SystemUiOverlayStyle.light, - title: const Text('Plugin example app'), + title: const Text('AppCenter App'), ), body: IndexedStack( index: _index, @@ -43,8 +43,8 @@ class _MyAppState extends State { AppList(appCenterReleaseManager: _appCenterReleaseManager), AppCenterReleaseManagerLatestReleases( apiToken: _appCenterReleaseManager.apiToken, - ownerName: preDefinedOwnerName, - appName: preDefinedAppName, + ownerName: Config.preDefinedOwnerName, + appName: Config.preDefinedAppName, ), UserDetails(appCenterReleaseManager: _appCenterReleaseManager), ], @@ -67,7 +67,7 @@ class _MyAppState extends State { ), BottomNavigationBarItem( icon: Icon(Icons.description), - label: preDefinedAppName, + label: Config.preDefinedAppName, ), BottomNavigationBarItem( icon: Icon(Icons.person), diff --git a/example/pubspec.lock b/example/pubspec.lock index b5e3aa0..440a379 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -7,7 +7,7 @@ packages: path: ".." relative: true source: path - version: "3.0.1" + version: "4.0.0" async: dependency: transitive description: @@ -73,10 +73,10 @@ packages: dependency: "direct dev" description: name: flutter_lints - sha256: "2118df84ef0c3ca93f96123a616ae8540879991b8b57af2f81b76a7ada49b2a4" + sha256: e2a421b7e59244faef694ba7b30562e489c2b489866e505074eb005cd7060db7 url: "https://pub.dev" source: hosted - version: "2.0.2" + version: "3.0.1" flutter_test: dependency: "direct dev" description: flutter @@ -91,10 +91,10 @@ packages: dependency: transitive description: name: http - sha256: "759d1a329847dd0f39226c688d3e06a6b8679668e350e2891a6474f8b4bb8525" + sha256: a2bbf9d017fcced29139daa8ed2bba4ece450ab222871df93ca9eec6f80c34ba url: "https://pub.dev" source: hosted - version: "1.1.0" + version: "1.2.0" http_parser: dependency: transitive description: @@ -107,10 +107,10 @@ packages: dependency: transitive description: name: lints - sha256: "5e4a9cd06d447758280a8ac2405101e0e2094d2a1dbdd3756aec3fe7775ba593" + sha256: cbf8d4b858bb0134ef3ef87841abdf8d63bfc255c266b7bf6b39daa1085c4290 url: "https://pub.dev" source: hosted - version: "2.0.1" + version: "3.0.0" matcher: dependency: transitive description: @@ -147,10 +147,10 @@ packages: dependency: transitive description: name: plugin_platform_interface - sha256: dbf0f707c78beedc9200146ad3cb0ab4d5da13c246336987be6940f026500d3a + sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" url: "https://pub.dev" source: hosted - version: "2.1.3" + version: "2.1.8" sky_engine: dependency: transitive description: flutter @@ -224,66 +224,66 @@ packages: dependency: transitive description: name: url_launcher - sha256: "781bd58a1eb16069412365c98597726cd8810ae27435f04b3b4d3a470bacd61e" + sha256: c512655380d241a337521703af62d2c122bf7b77a46ff7dd750092aa9433499c url: "https://pub.dev" source: hosted - version: "6.1.12" + version: "6.2.4" url_launcher_android: dependency: transitive description: name: url_launcher_android - sha256: "6f91d30ce9060c204b2dbe728adb300750fa4b228e8f7ed1b961aa1ceb728799" + sha256: "507dc655b1d9cb5ebc756032eb785f114e415f91557b73bf60b7e201dfedeb2f" url: "https://pub.dev" source: hosted - version: "6.0.22" + version: "6.2.2" url_launcher_ios: dependency: transitive description: name: url_launcher_ios - sha256: "6ba7dddee26c9fae27c9203c424631109d73c8fa26cfa7bc3e35e751cb87f62e" + sha256: "75bb6fe3f60070407704282a2d295630cab232991eb52542b18347a8a941df03" url: "https://pub.dev" source: hosted - version: "6.0.17" + version: "6.2.4" url_launcher_linux: dependency: transitive description: name: url_launcher_linux - sha256: "86f3f393cde6bed2a05bfc7f05e52aeaf4f9911a3ad9ff78a42e89e57e5a264a" + sha256: ab360eb661f8879369acac07b6bb3ff09d9471155357da8443fd5d3cf7363811 url: "https://pub.dev" source: hosted - version: "2.0.0" + version: "3.1.1" url_launcher_macos: dependency: transitive description: name: url_launcher_macos - sha256: f72b523da791d519aed53c12fd99c7dc50fdd1e4913da904081f3666d06334b5 + sha256: b7244901ea3cf489c5335bdacda07264a6e960b1c1b1a9f91e4bc371d9e68234 url: "https://pub.dev" source: hosted - version: "2.0.0" + version: "3.1.0" url_launcher_platform_interface: dependency: transitive description: name: url_launcher_platform_interface - sha256: "4eae912628763eb48fc214522e58e942fd16ce195407dbf45638239523c759a6" + sha256: a932c3a8082e118f80a475ce692fde89dc20fddb24c57360b96bc56f7035de1f url: "https://pub.dev" source: hosted - version: "2.1.1" + version: "2.3.1" url_launcher_web: dependency: transitive description: name: url_launcher_web - sha256: "057e3458dfcc4276d171ae70cd98efc6d2485bf39b93a015349754e5dec0f657" + sha256: fff0932192afeedf63cdd50ecbb1bc825d31aed259f02bb8dba0f3b729a5e88b url: "https://pub.dev" source: hosted - version: "2.0.0" + version: "2.2.3" url_launcher_windows: dependency: transitive description: name: url_launcher_windows - sha256: f98b970a12236957881fa28df0c6700f03d9dc5f471cf5ca6d205b77e7ad92d2 + sha256: ecf9725510600aa2bb6d7ddabe16357691b6d2805f66216a97d1b881e21beff7 url: "https://pub.dev" source: hosted - version: "2.0.0" + version: "3.1.1" vector_math: dependency: transitive description: @@ -301,5 +301,5 @@ packages: source: hosted version: "0.3.0" sdks: - dart: ">=3.2.0-194.0.dev <4.0.0" - flutter: ">=3.10.0" + dart: ">=3.2.0 <4.0.0" + flutter: ">=3.16.0" diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 17d7ffb..b9f45d0 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -3,7 +3,8 @@ description: Demonstrates how to use the appcenter_release_manager plugin. publish_to: 'none' environment: - sdk: ">=2.18.0 <3.0.0" + sdk: ">=2.18.0 <4.0.0" + flutter: ">=3.3.0" dependencies: appcenter_release_manager: @@ -12,7 +13,7 @@ dependencies: sdk: flutter dev_dependencies: - flutter_lints: ^2.0.2 + flutter_lints: ^3.0.1 flutter_test: sdk: flutter diff --git a/lib/src/appcenter_release_manager.dart b/lib/src/appcenter_release_manager.dart index 100b40f..2868ab1 100644 --- a/lib/src/appcenter_release_manager.dart +++ b/lib/src/appcenter_release_manager.dart @@ -23,7 +23,7 @@ class AppCenterReleaseManager { required this.apiToken, }) { if (apiToken.isEmpty) { - throw AppCenterReleaseManagerError(message: 'apiToken is empty'); + throw AppCenterReleaseManagerError('apiToken is empty'); } _releaseRepo = AppCenterRepository(webservice: Webservice(apiToken: apiToken)); diff --git a/lib/src/data/exception/appcenter_api_error.dart b/lib/src/data/exception/appcenter_api_error.dart index c354771..3ac7c9f 100644 --- a/lib/src/data/exception/appcenter_api_error.dart +++ b/lib/src/data/exception/appcenter_api_error.dart @@ -1,5 +1,5 @@ import 'package:appcenter_release_manager/src/data/exception/appcenter_release_manager_error.dart'; class AppCenterApiError extends AppCenterReleaseManagerError { - AppCenterApiError(String message) : super(message: message); + AppCenterApiError(super.message); } diff --git a/lib/src/data/exception/appcenter_no_access_api_error.dart b/lib/src/data/exception/appcenter_no_access_api_error.dart index 63b2b67..744ec6e 100644 --- a/lib/src/data/exception/appcenter_no_access_api_error.dart +++ b/lib/src/data/exception/appcenter_no_access_api_error.dart @@ -1,5 +1,5 @@ import 'package:appcenter_release_manager/appcenter_release_manager.dart'; class AppCenterNoAccessApiError extends AppCenterApiError { - AppCenterNoAccessApiError(String message) : super(message); + AppCenterNoAccessApiError(super.message); } diff --git a/lib/src/data/exception/appcenter_release_manager_error.dart b/lib/src/data/exception/appcenter_release_manager_error.dart index 6f4bb10..9a3c273 100644 --- a/lib/src/data/exception/appcenter_release_manager_error.dart +++ b/lib/src/data/exception/appcenter_release_manager_error.dart @@ -1,7 +1,7 @@ class AppCenterReleaseManagerError extends Error { final String? message; - AppCenterReleaseManagerError({this.message}); + AppCenterReleaseManagerError(this.message); @override String toString() { diff --git a/pubspec.lock b/pubspec.lock index b812fd1..386f577 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -66,10 +66,10 @@ packages: dependency: "direct dev" description: name: flutter_lints - sha256: "2118df84ef0c3ca93f96123a616ae8540879991b8b57af2f81b76a7ada49b2a4" + sha256: e2a421b7e59244faef694ba7b30562e489c2b489866e505074eb005cd7060db7 url: "https://pub.dev" source: hosted - version: "2.0.2" + version: "3.0.1" flutter_test: dependency: "direct dev" description: flutter @@ -84,10 +84,10 @@ packages: dependency: "direct main" description: name: http - sha256: "759d1a329847dd0f39226c688d3e06a6b8679668e350e2891a6474f8b4bb8525" + sha256: a2bbf9d017fcced29139daa8ed2bba4ece450ab222871df93ca9eec6f80c34ba url: "https://pub.dev" source: hosted - version: "1.1.0" + version: "1.2.0" http_parser: dependency: transitive description: @@ -100,10 +100,10 @@ packages: dependency: transitive description: name: lints - sha256: "5e4a9cd06d447758280a8ac2405101e0e2094d2a1dbdd3756aec3fe7775ba593" + sha256: cbf8d4b858bb0134ef3ef87841abdf8d63bfc255c266b7bf6b39daa1085c4290 url: "https://pub.dev" source: hosted - version: "2.0.1" + version: "3.0.0" matcher: dependency: transitive description: @@ -140,10 +140,10 @@ packages: dependency: transitive description: name: plugin_platform_interface - sha256: dbf0f707c78beedc9200146ad3cb0ab4d5da13c246336987be6940f026500d3a + sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" url: "https://pub.dev" source: hosted - version: "2.1.3" + version: "2.1.8" sky_engine: dependency: transitive description: flutter @@ -217,66 +217,66 @@ packages: dependency: "direct main" description: name: url_launcher - sha256: "781bd58a1eb16069412365c98597726cd8810ae27435f04b3b4d3a470bacd61e" + sha256: c512655380d241a337521703af62d2c122bf7b77a46ff7dd750092aa9433499c url: "https://pub.dev" source: hosted - version: "6.1.12" + version: "6.2.4" url_launcher_android: dependency: transitive description: name: url_launcher_android - sha256: "6f91d30ce9060c204b2dbe728adb300750fa4b228e8f7ed1b961aa1ceb728799" + sha256: "507dc655b1d9cb5ebc756032eb785f114e415f91557b73bf60b7e201dfedeb2f" url: "https://pub.dev" source: hosted - version: "6.0.22" + version: "6.2.2" url_launcher_ios: dependency: transitive description: name: url_launcher_ios - sha256: "6ba7dddee26c9fae27c9203c424631109d73c8fa26cfa7bc3e35e751cb87f62e" + sha256: "75bb6fe3f60070407704282a2d295630cab232991eb52542b18347a8a941df03" url: "https://pub.dev" source: hosted - version: "6.0.17" + version: "6.2.4" url_launcher_linux: dependency: transitive description: name: url_launcher_linux - sha256: "86f3f393cde6bed2a05bfc7f05e52aeaf4f9911a3ad9ff78a42e89e57e5a264a" + sha256: ab360eb661f8879369acac07b6bb3ff09d9471155357da8443fd5d3cf7363811 url: "https://pub.dev" source: hosted - version: "2.0.0" + version: "3.1.1" url_launcher_macos: dependency: transitive description: name: url_launcher_macos - sha256: f72b523da791d519aed53c12fd99c7dc50fdd1e4913da904081f3666d06334b5 + sha256: b7244901ea3cf489c5335bdacda07264a6e960b1c1b1a9f91e4bc371d9e68234 url: "https://pub.dev" source: hosted - version: "2.0.0" + version: "3.1.0" url_launcher_platform_interface: dependency: transitive description: name: url_launcher_platform_interface - sha256: "4eae912628763eb48fc214522e58e942fd16ce195407dbf45638239523c759a6" + sha256: a932c3a8082e118f80a475ce692fde89dc20fddb24c57360b96bc56f7035de1f url: "https://pub.dev" source: hosted - version: "2.1.1" + version: "2.3.1" url_launcher_web: dependency: transitive description: name: url_launcher_web - sha256: "057e3458dfcc4276d171ae70cd98efc6d2485bf39b93a015349754e5dec0f657" + sha256: fff0932192afeedf63cdd50ecbb1bc825d31aed259f02bb8dba0f3b729a5e88b url: "https://pub.dev" source: hosted - version: "2.0.0" + version: "2.2.3" url_launcher_windows: dependency: transitive description: name: url_launcher_windows - sha256: f98b970a12236957881fa28df0c6700f03d9dc5f471cf5ca6d205b77e7ad92d2 + sha256: ecf9725510600aa2bb6d7ddabe16357691b6d2805f66216a97d1b881e21beff7 url: "https://pub.dev" source: hosted - version: "2.0.0" + version: "3.1.1" vector_math: dependency: transitive description: @@ -294,5 +294,5 @@ packages: source: hosted version: "0.3.0" sdks: - dart: ">=3.2.0-194.0.dev <4.0.0" - flutter: ">=3.10.0" + dart: ">=3.2.0 <4.0.0" + flutter: ">=3.16.0" diff --git a/pubspec.yaml b/pubspec.yaml index ec45e60..d7c2af7 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: appcenter_release_manager description: Download appcenter updates straight from your iOS or Android app. -homepage: https://github.com/vanlooverenkoen/flutter_appcenter_release_manager -version: 3.0.1 +homepage: https://github.com/impaktfull/flutter_appcenter_release_manager +version: 4.0.0 environment: sdk: ">=2.18.0 <4.0.0" @@ -10,12 +10,12 @@ environment: dependencies: flutter: sdk: flutter - http: ^1.1.0 - url_launcher: ^6.1.12 + http: ^1.2.0 + url_launcher: ^6.2.4 universal_io: ^2.2.2 dev_dependencies: - flutter_lints: ^2.0.2 + flutter_lints: ^3.0.1 flutter_test: sdk: flutter @@ -23,7 +23,7 @@ flutter: plugin: platforms: android: - package: be.vanlooverenkoen.appcenter_release_manager + package: com.impaktfull.appcenter_release_manager pluginClass: AppcenterReleaseManagerPlugin ios: pluginClass: AppcenterReleaseManagerPlugin diff --git a/tool/analyze.sh b/tool/analyze.sh deleted file mode 100755 index d0bc68f..0000000 --- a/tool/analyze.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -flutter analyze || exit -1; \ No newline at end of file diff --git a/tool/check_for_credentials.dart b/tool/check_for_credentials.dart deleted file mode 100644 index e065b84..0000000 --- a/tool/check_for_credentials.dart +++ /dev/null @@ -1,24 +0,0 @@ -import 'dart:io'; - -void main() { - final file = File('example/lib/main.dart'); - if (!file.existsSync()) { - Logger.debug('${file.path} does not exist'); - exit(-1); - } - final content = file.readAsStringSync(); - const emptyCredentials = '''const apiToken = ''; -const preDefinedOwnerName = ''; -const preDefinedAppName = '';'''; - if (!content.contains(emptyCredentials)) { - Logger.debug('${file.path} still contains credentials'); - exit(-1); - } - Logger.debug('${file.path} does not contain credentials'); -} - -class Logger { - Logger._(); - - static void debug(Object value) => print(value); // ignore: avoid_print -} diff --git a/tool/dart/pre_run.dart b/tool/dart/pre_run.dart new file mode 100644 index 0000000..47aeb46 --- /dev/null +++ b/tool/dart/pre_run.dart @@ -0,0 +1,16 @@ +import 'dart:io'; + +/// This script is used to copy the content of the config.txt file to the config.dart file +/// We do this because the config.txt file is used to store the configuration of the app and +/// we don't want to expose the credentials to the outside world. +/// But we do want to publish a working example to pub.dev +void main() { + final configDartFile = File('example/lib/config.dart'); + final configFile = File('example/lib/config.txt'); + final content = configFile.readAsStringSync(); + if (configDartFile.existsSync()) { + configDartFile.deleteSync(); + } + configDartFile.createSync(recursive: true); + configDartFile.writeAsStringSync(content); +} diff --git a/tool/format.sh b/tool/format.sh new file mode 100755 index 0000000..647eb34 --- /dev/null +++ b/tool/format.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +dart format . \ No newline at end of file diff --git a/tool/test_coverage.sh b/tool/test_coverage.sh deleted file mode 100755 index 6bbf2bd..0000000 --- a/tool/test_coverage.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash - -CURRENT=`pwd` -DIR_NAME=`basename "$CURRENT"` -if [ $DIR_NAME == 'tool' ] -then - cd .. -fi - -dart run tool/test_coverage_validate_files.dart || exit -1 - -dart run tool/test_coverage_create_helper.dart - -fvm flutter test --coverage || exit -1 - -dart run tool/test_coverage_filter.dart - -if [ "$1" == "ci" ] -then - dart run tool/test_coverage_validate_percentage.dart -else - genhtml coverage/lcov.info -o coverage/html - open coverage/html/index.html -fi \ No newline at end of file diff --git a/tool/test_coverage_create_helper.dart b/tool/test_coverage_create_helper.dart deleted file mode 100644 index aedb84f..0000000 --- a/tool/test_coverage_create_helper.dart +++ /dev/null @@ -1,32 +0,0 @@ -import 'dart:io'; - -const packageName = 'appcenter_release_manager'; - -void main() { - Logger.debug( - 'First create a file with all other files imported so flutter test coverage uses all files'); - final imports = Directory('lib').listSync(recursive: true).where((element) { - if (Directory(element.path).existsSync()) return false; - if (!element.path.endsWith('.dart')) return false; - if (element.path.endsWith('.g.dart')) return false; - if (element.path.endsWith('_web.dart')) return false; - return true; - }).map((element) { - final importPath = element.path.replaceFirst('lib', packageName); - return "import 'package:$importPath';"; - }); - final testFile = File('test/coverage_helper_test.dart'); - if (!testFile.existsSync()) { - testFile.createSync(); - } - final sortedImports = imports.toList()..sort((e1, e2) => e1.compareTo(e2)); - final content = '${sortedImports.join('\n')}\nvoid main(){}'; - testFile.writeAsStringSync(content); - Logger.debug('Created the test/coverage_helper_test.dart'); -} - -class Logger { - Logger._(); - - static void debug(Object value) => print(value); // ignore: avoid_print -} diff --git a/tool/test_coverage_filter.dart b/tool/test_coverage_filter.dart deleted file mode 100644 index a3ff86a..0000000 --- a/tool/test_coverage_filter.dart +++ /dev/null @@ -1,123 +0,0 @@ -import 'dart:io'; - -void main(List args) { - printMessage('Start filtering the lcov.info file'); - final file = File('coverage/lcov.info'); - if (!file.existsSync()) { - printMessage('${file.path}" does not exist'); - return; - } - const endOfRecord = 'end_of_record'; - final sections = []; - final lines = file.readAsLinesSync(); - LcovSection? currentSection; - for (final line in lines) { - if (line.endsWith('.dart')) { - final filePath = line.replaceAll('SF:', ''); - currentSection = LcovSection() - ..header = line - ..filePath = filePath; - } else if (line == endOfRecord) { - final currentSectionTmp = currentSection; - if (currentSectionTmp != null) { - currentSectionTmp.footer = line; - sections.add(currentSectionTmp); - } - } else { - currentSection?.body.add(line); - } - } - final filteredSections = getFilteredSections(sections); - final sb = StringBuffer(); - for (final section in filteredSections) { - sb.write(section.toString()); - } - file.writeAsStringSync(sb.toString()); - printMessage('Filtered the lcov.info file'); -} - -class LcovSection { - String? filePath; - String? header; - final body = []; - String? footer; - - String? getBodyString() { - final filePathTmp = filePath; - if (filePathTmp == null) return null; - final file = File(filePathTmp); - final content = file.readAsLinesSync(); - final sb = StringBuffer(); - getFilteredBody(body, content).forEach((item) => sb - ..write(item) - ..write('\n')); - return sb.toString(); - } - - @override - String toString() { - return '$header\n${getBodyString()}$footer\n'; - } -} - -List getFilteredSections(List sections) { - return sections.where((section) { - final header = section.header; - if (header == null) return false; - if (!header.endsWith('.dart')) { - return false; - } else if (header.endsWith('.g.dart')) { - return false; - } else if (header.endsWith('.config.dart')) { - return false; - } else if (header.endsWith('injectable.dart')) { - return false; - } else if (header.startsWith('SF:lib/util/locale')) { - return false; - } else if (header.startsWith('SF:lib/widget')) { - return false; - } else if (header.startsWith('SF:lib/screen')) { - return false; - } else if (header.startsWith('SF:lib/navigator')) { - return false; - } - return true; - }).toList(); -} - -List getFilteredBody(List body, List lines) { - return body.where((line) { - if (line.startsWith('DA:')) { - final sections = line.split(','); - final lineNr = int.parse(sections[0].replaceAll('DA:', '')); - final callCount = int.parse(sections[1]); - if (callCount == 0) { - final fileLine = lines[lineNr - 1].trim(); - if (excludedLines.contains(fileLine)) { - return false; - } - for (final line in excludedStartsWithLines) { - if (fileLine.trim().startsWith(line)) { - return false; - } - } - } - } - return true; - }).toList(); -} - -const excludedLines = [ - 'const TranslationWriter._();', - 'const CaseUtil._();', - 'const LocaleGenParser._();', - 'const LocaleGenSbWriter._();', - 'const LocaleGenWriter._();', -]; - -const excludedStartsWithLines = []; - -void printMessage(String message) { - // ignore: avoid_print - print(message); -} diff --git a/tool/test_coverage_validate_files.dart b/tool/test_coverage_validate_files.dart deleted file mode 100644 index b1c45ec..0000000 --- a/tool/test_coverage_validate_files.dart +++ /dev/null @@ -1,103 +0,0 @@ -import 'dart:io'; - -void main() { - printMessage( - 'Start a check to make sure we have a test file for every sourcecode file'); - final sourceCodeFolder = Directory('lib'); - final testSourceCodeFolder = Directory('test'); - - if (!sourceCodeFolder.existsSync()) { - throw ArgumentError('lib dir not found'); - } else if (!testSourceCodeFolder.existsSync()) { - throw ArgumentError('test dir not found'); - } - final sourceCodeTodoFiles = []; - final sourceFiles = []; - sourceCodeFolder.listSync(recursive: true).forEach((element) { - if (element is File) { - if (element.path.endsWith('.dart')) { - sourceFiles.add(element); - } - } - }); - - printMessage(''); - printMessage( - 'Detected ${sourceFiles.length} source files (with excluded folders/files: .g.dart, lib/vendor/**, lib/util/locale**)'); - - final sourceCodeFiles = sourceFiles.where((file) { - final path = file.path; - if (path.endsWith('.g.dart')) { - return false; - } else if (path.startsWith('lib/vendor/')) { - return false; - } else if (path.startsWith('lib/util/locale')) { - return false; - } - for (final excludedFile in excludedEndsWithFiles) { - if (path.endsWith(excludedFile)) return false; - } - return true; - }); - printMessage(''); - printMessage('Detected ${sourceCodeFiles.length} source files'); - - for (final file in sourceCodeFiles) { - final cleanupFile = - file.path.replaceFirst('lib/', '').replaceFirst('.dart', ''); - final testFile = File('test/${cleanupFile}_test.dart'); - if (!testFile.existsSync()) { - sourceCodeTodoFiles.add(testFile); - } - } - printMessage(''); - printMessage('Detected ${sourceCodeTodoFiles.length} untested files'); - - printMessage(''); - printMessage( - 'Exclude ${excludedFiles.length} files (no tests needed for these)'); - sourceCodeTodoFiles.removeWhere((file) => excludedFiles.contains( - file.path.replaceFirst('test/', '').replaceFirst('_test.dart', '.dart'))); - - printMessage(''); - printMessage( - 'Detected ${sourceCodeTodoFiles.length} untested files after filter'); - - printMessage(''); - printMessage('There are no test yet created for:'); - printMessage(''); - for (final file in (sourceCodeTodoFiles - ..sort((file1, file2) => file1.path.compareTo(file2.path)))) { - printMessage(file.path); - } - printMessage(''); - if (sourceCodeTodoFiles.isNotEmpty) { - printMessage( - 'You need to create ${sourceCodeTodoFiles.length} extra test files'); - exit(-1); - } -} - -List getFiles(Directory directory) { - final files = []; - final data = directory.listSync(); - for (final info in data) { - final file = File(info.path); - final dir = Directory(info.path); - if (dir.existsSync()) { - files.addAll(getFiles(dir)); - } else { - files.add(file); - } - } - return files; -} - -const excludedFiles = []; - -const excludedEndsWithFiles = []; - -void printMessage(String message) { - // ignore: avoid_print - print(message); -} diff --git a/tool/test_coverage_validate_percentage.dart b/tool/test_coverage_validate_percentage.dart deleted file mode 100644 index f22d605..0000000 --- a/tool/test_coverage_validate_percentage.dart +++ /dev/null @@ -1,41 +0,0 @@ -import 'dart:io'; - -const minRequiredCoverage = 0; - -void main(List args) { - printMessage('Start checking the lcov.info file'); - final file = File('coverage/lcov.info'); - if (!file.existsSync()) { - printMessage('${file.path}" does not exist'); - return; - } - var totalLines = 0; - var totalLinesCovered = 0; - final lines = file.readAsLinesSync(); - for (final line in lines) { - if (line.startsWith('DA')) { - totalLines++; - } else if (line.startsWith('LH')) { - totalLinesCovered += int.parse(line.replaceAll('LH:', '')); - } - } - final codeCoveragePercentage = (totalLinesCovered / totalLines) * 100; - if (codeCoveragePercentage == 100) { - printMessage('\n100% CODE COVERAGE!!!!\n'); - } else if (codeCoveragePercentage >= minRequiredCoverage) { - printMessage('COVERAGE IS ${codeCoveragePercentage.toStringAsFixed(2)}%\n'); - printMessage( - 'TIS IS ABOVE THE MIN REQUIRED TARGET of $minRequiredCoverage%\n'); - } else { - printMessage('\nCODE COVERAGE IS TO LOW!!\n'); - printMessage('COVERAGE IS ${codeCoveragePercentage.toStringAsFixed(2)}%\n'); - printMessage('AMOUNT OF LINES:$totalLines'); - printMessage('AMOUNT OF COVERED:$totalLinesCovered\n'); - exit(-1); - } -} - -void printMessage(String message) { - // ignore: avoid_print - print(message); -}