feat: request in-app review

closes #127
This commit is contained in:
Rongjian Zhang 2020-12-12 23:38:10 +08:00
parent fae1c7f620
commit 08511fb8fb
5 changed files with 48 additions and 48 deletions

View File

@ -1,18 +0,0 @@
#
# NOTE: This podspec is NOT to be published. It is only used as a local source!
#
Pod::Spec.new do |s|
s.name = 'Flutter'
s.version = '1.0.0'
s.summary = 'High-performance, high-fidelity mobile apps.'
s.description = <<-DESC
Flutter provides an easy and productive way to build and deploy high-performance mobile apps for Android and iOS.
DESC
s.homepage = 'https://flutter.io'
s.license = { :type => 'MIT' }
s.author = { 'Flutter Dev Team' => 'flutter-dev@googlegroups.com' }
s.source = { :git => 'https://github.com/flutter/engine', :tag => s.version.to_s }
s.ios.deployment_target = '8.0'
s.vendored_frameworks = 'Flutter.framework'
end

View File

@ -1,5 +1,7 @@
PODS:
- Flutter (1.0.0)
- in_app_review (0.2.0):
- Flutter
- launch_review (0.0.1):
- Flutter
- package_info (0.0.1):
@ -17,6 +19,7 @@ PODS:
DEPENDENCIES:
- Flutter (from `Flutter`)
- in_app_review (from `.symlinks/plugins/in_app_review/ios`)
- launch_review (from `.symlinks/plugins/launch_review/ios`)
- package_info (from `.symlinks/plugins/package_info/ios`)
- share (from `.symlinks/plugins/share/ios`)
@ -28,6 +31,8 @@ DEPENDENCIES:
EXTERNAL SOURCES:
Flutter:
:path: Flutter
in_app_review:
:path: ".symlinks/plugins/in_app_review/ios"
launch_review:
:path: ".symlinks/plugins/launch_review/ios"
package_info:
@ -44,7 +49,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/webview_flutter/ios"
SPEC CHECKSUMS:
Flutter: 0e3d915762c693b495b44d77113d4970485de6ec
Flutter: 434fef37c0980e73bb6479ef766c45957d4b510c
in_app_review: 4a97249f7a2f539a0f294c2d9196b7fe35e49541
launch_review: 75d5a956ba8eaa493e9c9d4bf4c05e505e8d5ed0
package_info: 873975fc26034f0b863a300ad47e7f1ac6c7ec62
share: 0b2c3e82132f5888bccca3351c504d0003b3b410

View File

@ -1,5 +1,6 @@
import 'dart:convert';
import 'dart:async';
import 'package:in_app_review/in_app_review.dart';
import 'package:universal_io/io.dart';
import 'package:git_touch/models/bitbucket.dart';
import 'package:git_touch/models/gitea.dart';
@ -59,6 +60,9 @@ class BbPagePayload<T> {
class AuthModel with ChangeNotifier {
static const _apiPrefix = 'https://api.github.com';
static final inAppReview = InAppReview.instance;
var hasRequestedReview = false;
List<Account> _accounts;
int activeAccountIndex;
StreamSubscription<Uri> _sub;
@ -430,6 +434,16 @@ class AuthModel with ChangeNotifier {
_ghClient = null;
_gqlClient = null;
notifyListeners();
// waiting for 1min to request review
if (!hasRequestedReview) {
hasRequestedReview = true;
Timer(Duration(minutes: 1), () async {
if (await inAppReview.isAvailable()) {
inAppReview.requestReview();
}
});
}
}
// http timeout

View File

@ -5,11 +5,13 @@
import FlutterMacOS
import Foundation
import in_app_review
import package_info
import shared_preferences_macos
import url_launcher_macos
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
InAppReviewPlugin.register(with: registry.registrar(forPlugin: "InAppReviewPlugin"))
FLTPackageInfoPlugin.register(with: registry.registrar(forPlugin: "FLTPackageInfoPlugin"))
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))

View File

@ -16,36 +16,34 @@ environment:
dependencies:
flutter:
sdk: flutter
flutter_vector_icons: ^0.2.1
flutter_highlight: ^0.6.0
primer: ^0.0.2
nanoid: ^0.1.0
file_icon: ^0.3.0
http: ^0.12.0
intl: ^0.16.0
url_launcher: ^5.4.1
uni_links: ^0.4.0
flutter_markdown: ^0.4.4
shared_preferences: ^0.5.6
share: ^0.6.0
flutter_svg: ^0.19.0
launch_review: ^2.0.0
timeago: ^2.0.18
provider: ^4.3.2
filesize: ^1.0.4
tuple: ^1.0.2
uri: ^0.11.3
fimber: ^0.4.4
artemis: ^3.2.1
fluro: ^1.7.7
package_info: ^0.4.0
github: ^7.0.3
# path: ../../github/github.dart
github_trending: ^1.0.0
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.0
file_icon: ^0.3.0
filesize: ^1.0.4
fimber: ^0.4.4
fluro: ^1.7.8
flutter_highlight: ^0.6.0
flutter_markdown: ^0.4.4
flutter_svg: ^0.19.0
flutter_vector_icons: ^0.2.1
github: ^7.0.3
github_trending: ^1.0.0
http: ^0.12.0
in_app_review: ^1.0.4
intl: ^0.16.0
launch_review: ^2.0.0
nanoid: ^0.1.0
package_info: ^0.4.0
primer: ^0.0.2
provider: ^4.3.2
share: ^0.6.0
shared_preferences: ^0.5.6
timeago: ^2.0.18
tuple: ^1.0.2
uni_links: ^0.4.0
universal_io: ^1.0.1
uri: ^0.11.3
url_launcher: ^5.4.1
webview_flutter: ^1.0.5
dev_dependencies:
@ -57,10 +55,8 @@ dev_dependencies:
# dependencies_overrides:
# flutter_highlight:
# path: ../highlight/flutter_highlight
# For information on the generic Dart part of this file, see the
# following page: https://www.dartlang.org/tools/pub/pubspec
# The following section is specific to Flutter.
flutter:
uses-material-design: true