Skip to content

Commit

Permalink
Merge pull request #70 from altotunchitoo/master
Browse files Browse the repository at this point in the history
Updated pubs and sdk
  • Loading branch information
rodydavis authored Oct 24, 2022
2 parents 1dfd6c6 + c1cd0ba commit 39d24ab
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 17 deletions.
28 changes: 15 additions & 13 deletions lib/app_review.dart
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,14 @@ class AppReview {
if (compose) {
final id = appId ?? (await getIosAppId()) ?? '';
final reviewUrl = 'itunes.apple.com/app/id$id?mt=8&action=write-review';

if (await canLaunch('itms-apps://$reviewUrl')) {
final uri = Uri.parse('itms-apps://$reviewUrl');
if (await canLaunchUrl(uri)) {
debugPrint('launching store page');
await launch('itms-apps://$reviewUrl');
await launchUrl(uri);
return 'Launched App Store Directly: $reviewUrl';
}

await launch('https://$reviewUrl');
await launchUrl(Uri.parse('https://$reviewUrl'));
return 'Launched App Store: $reviewUrl';
}

Expand All @@ -136,7 +136,7 @@ class AppReview {
static Future<String?> openAndroidReview() {
try {
return _channel.invokeMethod<String>('requestReview');
} on dynamic {
} on Error {
return openGooglePlay();
}
}
Expand All @@ -146,12 +146,13 @@ class AppReview {
final appId = await getIosAppId() ?? '';

if (appId.isNotEmpty) {
launch('https://itunes.apple.com/app/id$appId');
launchUrl(Uri.parse('https://itunes.apple.com/app/id$appId'),
mode: LaunchMode.externalApplication);
return 'Launched App Store';
}

if (fallbackUrl != null) {
launch(fallbackUrl);
launchUrl(Uri.parse(fallbackUrl), mode: LaunchMode.externalApplication);
return 'Launched App Store via $fallbackUrl';
}

Expand All @@ -162,23 +163,24 @@ class AppReview {
static Future<String> openGooglePlay({String? fallbackUrl}) async {
final bundle = await getBundleName() ?? '';
final markerUrl = 'market://details?id=$bundle';

if (await canLaunch(markerUrl)) {
final uri = Uri.parse(markerUrl);
if (await canLaunchUrl(uri)) {
debugPrint('launching store page');
launch(markerUrl);
launchUrl(uri, mode: LaunchMode.externalApplication);
return 'Launched Google Play Directly: $bundle';
}

if (fallbackUrl != null) {
launch(fallbackUrl);
launchUrl(Uri.parse(fallbackUrl), mode: LaunchMode.externalApplication);
return 'Launched Google Play via $fallbackUrl';
}

launch('https://play.google.com/store/apps/details?id=$bundle');
launchUrl(
Uri.parse('https://play.google.com/store/apps/details?id=$bundle'));
return 'Launched Google Play: $bundle';
}

/// Lazyload package info instance
/// Lazy load package info instance
static Future<PackageInfo?> getPackageInfo() async {
_packageInfo ??= await PackageInfo.fromPlatform();

Expand Down
8 changes: 4 additions & 4 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ homepage: https://github.com/rodydavis/plugins
repository: https://github.com/fluttercommunity/app_review

environment:
sdk: '>=2.12.0-259.8.beta <3.0.0'
sdk: ">=2.16.0 <3.0.0"
flutter: ^1.10.0

dependencies:
http: ^0.13.0-nullsafety.0
package_info_plus: ^1.0.0
url_launcher: ^6.0.0-nullsafety.6
http: ^0.13.5
package_info_plus: ^3.0.1
url_launcher: ^6.1.6
flutter:
sdk: flutter

Expand Down

0 comments on commit 39d24ab

Please sign in to comment.