Skip to content

Commit

Permalink
chore(1.7.1): removed pubspec_generator and added package_info_plus
Browse files Browse the repository at this point in the history
  • Loading branch information
ziqq committed Jul 25, 2024
1 parent a9a8ffb commit 9b2aa15
Show file tree
Hide file tree
Showing 9 changed files with 117 additions and 543 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## 1.7.1
- **REMOVED**: `pubspec_generator`
- **ADDED**: `package_info_plus`


## 1.7.0
- **ADDED**: `pubspec_generator`
- **REMOVED**: `package_info_plus`
Expand Down
51 changes: 48 additions & 3 deletions example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.3.1"
ffi:
dependency: transitive
description:
name: ffi
sha256: "493f37e7df1804778ff3a53bd691d8692ddf69702cf4c1c1096a2e41b4779e21"
url: "https://pub.dev"
source: hosted
version: "2.1.2"
flutter:
dependency: "direct main"
description: flutter
Expand All @@ -68,7 +76,7 @@ packages:
path: ".."
relative: true
source: path
version: "1.7.0"
version: "1.7.1"
flutter_lints:
dependency: "direct dev"
description:
Expand All @@ -82,6 +90,11 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
flutter_web_plugins:
dependency: transitive
description: flutter
source: sdk
version: "0.0.0"
http:
dependency: transitive
description:
Expand Down Expand Up @@ -154,6 +167,22 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.12.0"
package_info_plus:
dependency: transitive
description:
name: package_info_plus
sha256: b93d8b4d624b4ea19b0a5a208b2d6eff06004bc3ce74c06040b120eeadd00ce0
url: "https://pub.dev"
source: hosted
version: "8.0.0"
package_info_plus_platform_interface:
dependency: transitive
description:
name: package_info_plus_platform_interface
sha256: f49918f3433a3146047372f9d4f1f847511f2acd5cd030e1f44fe5a50036b70e
url: "https://pub.dev"
source: hosted
version: "3.0.0"
path:
dependency: transitive
description:
Expand All @@ -162,6 +191,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.9.0"
plugin_platform_interface:
dependency: transitive
description:
name: plugin_platform_interface
sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02"
url: "https://pub.dev"
source: hosted
version: "2.1.8"
sky_engine:
dependency: transitive
description: flutter
Expand Down Expand Up @@ -247,6 +284,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "0.5.1"
win32:
dependency: transitive
description:
name: win32
sha256: a79dbe579cb51ecd6d30b17e0cae4e0ea15e2c0e66f69ad4198f22a6789e94f4
url: "https://pub.dev"
source: hosted
version: "5.5.1"
sdks:
dart: ">=3.3.0 <4.0.0"
flutter: ">=3.18.0-18.0.pre.54"
dart: ">=3.4.0 <4.0.0"
flutter: ">=3.19.0"
18 changes: 8 additions & 10 deletions lib/src/in_store_app_version_checker.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import 'dart:convert';

import 'package:flutter/foundation.dart';
import 'package:flutter_in_store_app_version_checker/src/model/in_store_app_version_checker_result.dart';
import 'package:flutter_in_store_app_version_checker/src/model/pubspec.yaml.g.dart';
import 'package:http/http.dart' as http;
import 'package:package_info_plus/package_info_plus.dart';

/// Possible types of android store
enum AndroidStore {
Expand Down Expand Up @@ -101,21 +101,19 @@ final class _InStoreAppVersionCheckerImpl implements InStoreAppVersionChecker {
_kIsWeb = true;
}

final packageName = appId ?? Pubspec.name;
final currentVersion = this.currentVersion ?? Pubspec.version.canonical;
final packageInfo = await PackageInfo.fromPlatform();
final packageName = appId ?? packageInfo.packageName;
final currentVersion = this.currentVersion ?? packageInfo.version;

if (_isAndroid) {
return await switch (androidStore) {
AndroidStore.apkPure =>
_checkPlayStore$ApkPure(currentVersion, packageName),
_checkPlayStoreApkPure(currentVersion, packageName),
_ => _checkPlayStore(currentVersion, packageName),
};
} else if (_isIOS) {
return await _checkAppleStore(
currentVersion,
packageName,
locale: locale,
);
return await _checkAppleStore(currentVersion, packageName,
locale: locale);
} else {
return InStoreAppVersionCheckerResult(
currentVersion,
Expand Down Expand Up @@ -207,7 +205,7 @@ final class _InStoreAppVersionCheckerImpl implements InStoreAppVersionChecker {
}

/// {@macro in_store_app_version_checker}
Future<InStoreAppVersionCheckerResult> _checkPlayStore$ApkPure(
Future<InStoreAppVersionCheckerResult> _checkPlayStoreApkPure(
String currentVersion,
String packageName,
) async {
Expand Down
Loading

0 comments on commit 9b2aa15

Please sign in to comment.