Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 0.4.0 - 5/12/22
* Add unnamed constructor to improve testing and mocking
* Fix lint warnings
* Bump packages to latest versions

## 0.3.0 - 1/13/21
* #75: Add `forceAppVersion` field to make testing easier.
* #77: Improve `canUpdate` logic so that greater local version won't prompt for an update.
Expand Down
4 changes: 2 additions & 2 deletions example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
compileSdkVersion 30
compileSdkVersion 31

sourceSets {
main.java.srcDirs += 'src/main/kotlin'
Expand All @@ -36,7 +36,7 @@ android {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.example"
minSdkVersion 16
targetSdkVersion 30
targetSdkVersion 31
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
Expand Down
2 changes: 1 addition & 1 deletion example/android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
buildscript {
ext.kotlin_version = '1.3.50'
ext.kotlin_version = '1.6.10'
repositories {
google()
jcenter()
Expand Down
13 changes: 7 additions & 6 deletions lib/new_version.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import 'package:flutter/material.dart';
import 'package:html/parser.dart' show parse;
import 'package:http/http.dart' as http;
import 'package:package_info_plus/package_info_plus.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:url_launcher/url_launcher_string.dart';

/// Information about the app's current version, and the most recent version
/// available in the Apple App Store or Google Play Store.
Expand Down Expand Up @@ -51,7 +51,7 @@ class VersionStatus {
return false;
}

VersionStatus._({
VersionStatus({
required this.localVersion,
required this.storeVersion,
required this.appStoreLink,
Expand Down Expand Up @@ -109,6 +109,7 @@ class NewVersion {
} else {
debugPrint(
'The target platform "${Platform.operatingSystem}" is not yet supported by this package.');
return null;
}
}

Expand Down Expand Up @@ -137,7 +138,7 @@ class NewVersion {
debugPrint('Can\'t find an app in the App Store with the id: $id');
return null;
}
return VersionStatus._(
return VersionStatus(
localVersion: _getCleanVersion(packageInfo.version),
storeVersion:
_getCleanVersion(forceAppVersion ?? jsonObj['results'][0]['version']),
Expand Down Expand Up @@ -174,7 +175,7 @@ class NewVersion {
?.querySelector('.DWPxHb')
?.text;

return VersionStatus._(
return VersionStatus(
localVersion: _getCleanVersion(packageInfo.version),
storeVersion: _getCleanVersion(forceAppVersion ?? storeVersion),
appStoreLink: uri.toString(),
Expand Down Expand Up @@ -265,8 +266,8 @@ class NewVersion {
/// Launches the Apple App Store or Google Play Store page for the app.
Future<void> launchAppStore(String appStoreLink) async {
debugPrint(appStoreLink);
if (await canLaunch(appStoreLink)) {
await launch(appStoreLink);
if (await canLaunchUrlString(appStoreLink)) {
await launchUrlString(appStoreLink);
} else {
throw 'Could not launch appStoreLink';
}
Expand Down
10 changes: 5 additions & 5 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: new_version
description: Check if your user has the most recent version of your Flutter app.
version: 0.3.0
version: 0.4.0
homepage: https://github.com/timtraversy/new_version

environment:
Expand All @@ -9,11 +9,11 @@ environment:
dependencies:
flutter:
sdk: flutter
package_info_plus: ^1.0.0
http: ^0.13.1
package_info_plus: ^1.4.2
http: ^0.13.4
html: ^0.15.0
url_launcher: ^6.0.2
collection: ^1.15.0
url_launcher: ^6.1.2
collection: ^1.16.0

dev_dependencies:
flutter_test:
Expand Down