Skip to content

Commit

Permalink
feat: request in-app review
Browse files Browse the repository at this point in the history
closes #127
  • Loading branch information
pd4d10 committed Dec 12, 2020
1 parent fae1c7f commit 08511fb
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 44 deletions.
18 changes: 0 additions & 18 deletions ios/Flutter/Flutter.podspec

This file was deleted.

8 changes: 7 additions & 1 deletion ios/Podfile.lock
@@ -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):
Expand All @@ -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`)
Expand All @@ -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:
Expand All @@ -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
Expand Down
14 changes: 14 additions & 0 deletions lib/models/auth.dart
@@ -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';
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions macos/Flutter/GeneratedPluginRegistrant.swift
Expand Up @@ -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"))
Expand Down
46 changes: 21 additions & 25 deletions pubspec.yaml
Expand Up @@ -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
artemis: ^3.2.1
cupertino_icons: ^1.0.0
file_icon: ^0.3.0
http: ^0.12.0
intl: ^0.16.0
url_launcher: ^5.4.1
uni_links: ^0.4.0
filesize: ^1.0.4
fimber: ^0.4.4
fluro: ^1.7.8
flutter_highlight: ^0.6.0
flutter_markdown: ^0.4.4
shared_preferences: ^0.5.6
share: ^0.6.0
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
timeago: ^2.0.18
nanoid: ^0.1.0
package_info: ^0.4.0
primer: ^0.0.2
provider: ^4.3.2
filesize: ^1.0.4
share: ^0.6.0
shared_preferences: ^0.5.6
timeago: ^2.0.18
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
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:
Expand All @@ -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
Expand Down

0 comments on commit 08511fb

Please sign in to comment.