Skip to content

Commit

Permalink
feat: stable release
Browse files Browse the repository at this point in the history
  • Loading branch information
kauemurakami committed Sep 19, 2022
1 parent 7a1391c commit 6997600
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .flutter-plugins-dependencies
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"package_info_plus","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\package_info_plus-1.4.3+1\\\\","native_build":true,"dependencies":[]},{"name":"url_launcher_ios","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\url_launcher_ios-6.0.17\\\\","native_build":true,"dependencies":[]}],"android":[{"name":"package_info_plus","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\package_info_plus-1.4.3+1\\\\","native_build":true,"dependencies":[]},{"name":"url_launcher_android","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\url_launcher_android-6.0.19\\\\","native_build":true,"dependencies":[]}],"macos":[{"name":"package_info_plus_macos","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\package_info_plus_macos-1.3.0\\\\","native_build":true,"dependencies":[]},{"name":"url_launcher_macos","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\url_launcher_macos-3.0.1\\\\","native_build":true,"dependencies":[]}],"linux":[{"name":"package_info_plus_linux","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\package_info_plus_linux-1.0.5\\\\","native_build":false,"dependencies":[]},{"name":"url_launcher_linux","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\url_launcher_linux-3.0.1\\\\","native_build":true,"dependencies":[]}],"windows":[{"name":"package_info_plus_windows","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\package_info_plus_windows-2.1.0\\\\","native_build":false,"dependencies":[]},{"name":"url_launcher_windows","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\url_launcher_windows-3.0.1\\\\","native_build":true,"dependencies":[]}],"web":[{"name":"package_info_plus_web","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\package_info_plus_web-1.0.5\\\\","dependencies":[]},{"name":"url_launcher_web","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\url_launcher_web-2.0.13\\\\","dependencies":[]}]},"dependencyGraph":[{"name":"package_info_plus","dependencies":["package_info_plus_linux","package_info_plus_macos","package_info_plus_windows","package_info_plus_web"]},{"name":"package_info_plus_linux","dependencies":[]},{"name":"package_info_plus_macos","dependencies":[]},{"name":"package_info_plus_web","dependencies":[]},{"name":"package_info_plus_windows","dependencies":[]},{"name":"url_launcher","dependencies":["url_launcher_android","url_launcher_ios","url_launcher_linux","url_launcher_macos","url_launcher_web","url_launcher_windows"]},{"name":"url_launcher_android","dependencies":[]},{"name":"url_launcher_ios","dependencies":[]},{"name":"url_launcher_linux","dependencies":[]},{"name":"url_launcher_macos","dependencies":[]},{"name":"url_launcher_web","dependencies":[]},{"name":"url_launcher_windows","dependencies":[]}],"date_created":"2022-09-19 09:10:56.287038","version":"3.3.2"}
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"package_info_plus","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\package_info_plus-1.4.3+1\\\\","native_build":true,"dependencies":[]},{"name":"url_launcher_ios","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\url_launcher_ios-6.0.17\\\\","native_build":true,"dependencies":[]}],"android":[{"name":"package_info_plus","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\package_info_plus-1.4.3+1\\\\","native_build":true,"dependencies":[]},{"name":"url_launcher_android","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\url_launcher_android-6.0.19\\\\","native_build":true,"dependencies":[]}],"macos":[{"name":"package_info_plus_macos","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\package_info_plus_macos-1.3.0\\\\","native_build":true,"dependencies":[]},{"name":"url_launcher_macos","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\url_launcher_macos-3.0.1\\\\","native_build":true,"dependencies":[]}],"linux":[{"name":"package_info_plus_linux","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\package_info_plus_linux-1.0.5\\\\","native_build":false,"dependencies":[]},{"name":"url_launcher_linux","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\url_launcher_linux-3.0.1\\\\","native_build":true,"dependencies":[]}],"windows":[{"name":"package_info_plus_windows","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\package_info_plus_windows-2.1.0\\\\","native_build":false,"dependencies":[]},{"name":"url_launcher_windows","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\url_launcher_windows-3.0.1\\\\","native_build":true,"dependencies":[]}],"web":[{"name":"package_info_plus_web","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\package_info_plus_web-1.0.5\\\\","dependencies":[]},{"name":"url_launcher_web","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\url_launcher_web-2.0.13\\\\","dependencies":[]}]},"dependencyGraph":[{"name":"package_info_plus","dependencies":["package_info_plus_linux","package_info_plus_macos","package_info_plus_windows","package_info_plus_web"]},{"name":"package_info_plus_linux","dependencies":[]},{"name":"package_info_plus_macos","dependencies":[]},{"name":"package_info_plus_web","dependencies":[]},{"name":"package_info_plus_windows","dependencies":[]},{"name":"url_launcher","dependencies":["url_launcher_android","url_launcher_ios","url_launcher_linux","url_launcher_macos","url_launcher_web","url_launcher_windows"]},{"name":"url_launcher_android","dependencies":[]},{"name":"url_launcher_ios","dependencies":[]},{"name":"url_launcher_linux","dependencies":[]},{"name":"url_launcher_macos","dependencies":[]},{"name":"url_launcher_web","dependencies":[]},{"name":"url_launcher_windows","dependencies":[]}],"date_created":"2022-09-19 11:37:04.522002","version":"3.3.2"}
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,11 @@
## 0.4.5

* Fix Change log

## 1.0.0
* Stable version !!!
* Fixing bug that detected an update when the version is the same.
* Converting string comparison values ​​to num.
* Added support for versions that have the + character.
* Componentizing functions.
* Fixing bug during development with version higher than store version in local app.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ AppUpdateVersion.showAlertUpdate({
| Next Updates | status |
|------------------------------|-------------|
| Mandatory or optional update | development |
| Create TestMode | development |
| Bottom sheet widget | development |
| Page widget | development |
| Handle Exceptions | development |
Expand Down
16 changes: 7 additions & 9 deletions lib/app_version_update.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ library app_version_update;

import 'dart:convert';
import 'dart:io';
import 'package:app_version_update/core/functions/convert_version.dart';
import 'package:app_version_update/data/enums/app_version_widgets.dart';
import 'package:app_version_update/data/models/app_version_result.dart';
import 'package:app_version_update/widgets/alert_dialog_update.dart';
Expand Down Expand Up @@ -41,12 +42,11 @@ class AppVersionUpdate {
final response =
await http.get(uri, headers: headers).catchError((e) => throw e);
AppVersionResult appVersionResult = AppVersionResult(
canUpdate: RegExp(r',\[\[\["([0-9,\.]*)"]],')
.firstMatch(response.body)!
.group(1) ==
packageInfo.version
? false
: true,
canUpdate: convertVersion(
version: packageInfo.version,
versionStore: RegExp(r',\[\[\["([0-9,\.]*)"]],')
.firstMatch(response.body)!
.group(1)!),
storeUrl: uri.toString(),
storeVersion: RegExp(r',\[\[\["([0-9,\.]*)"]],')
.firstMatch(response.body)!
Expand All @@ -67,9 +67,7 @@ class AppVersionUpdate {
final _json = json.decode(response.body);
final List results = _json['results'];
final appVersionResult = AppVersionResult(
canUpdate: _json['results'].first['version'] == packageInfo.version
? false
: true,
canUpdate: convertVersion(version: packageInfo.version, versionStore: _json['results'].first['version']),
storeUrl: _json['results'].first['trackViewUrl'],
storeVersion: _json['results'].first['version'],
platform: TargetPlatform.iOS);
Expand Down
32 changes: 32 additions & 0 deletions lib/core/functions/convert_version.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/// Convert string of the stores for list number and compare.
/// * ```version``` local version app.
/// * ```versionStore``` store version app.
convertVersion({String? version, String? versionStore}) {
List<String>? localVersion = [];
List<String>? storeVersion = [];
version!.contains('+') ? localVersion = [version.split('+').last] : null;

localVersion.addAll(
[version.split('.')[0], version.split('.')[1], version.split('.')[2][0]]);

versionStore!.contains('+')
? storeVersion = [versionStore.split('+').last]
: null;

storeVersion.addAll([
versionStore.split('.')[0],
versionStore.split('.')[1],
versionStore.split('.')[2][0]
]);

/// Loop for verify values.
for (int i = 0; i <= localVersion.length; i++) {
if (int.parse(storeVersion[i]) < int.parse(localVersion[i])) {
return false;
}
if (int.parse(storeVersion[i]) > int.parse(localVersion[i])) {
return true;
}
}
return false;
}
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: app_version_update
description: An easy and quick way to check if the local app is updated with the same version in their respective stores (Play Store / Apple Store ).
# author: Kauê Tomaz Murakami<[email protected]>
version: 0.4.5
version: 1.0.0
homepage: https://github.com/kauemurakami/app_version_update

environment:
Expand Down

0 comments on commit 6997600

Please sign in to comment.