new: add review
This commit is contained in:
@@ -64,6 +64,11 @@ abstract class Preferences {
|
||||
"started_by_user",
|
||||
false,
|
||||
);
|
||||
|
||||
static final storeReviewedByUser = PreferencesNotifier.create<bool, bool>(
|
||||
"store_reviewed_by_user",
|
||||
false,
|
||||
);
|
||||
}
|
||||
|
||||
@Riverpod(keepAlive: true)
|
||||
|
||||
@@ -11,6 +11,7 @@ import 'package:hiddify/utils/utils.dart';
|
||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||
import 'package:rxdart/rxdart.dart';
|
||||
import 'package:sentry_flutter/sentry_flutter.dart';
|
||||
import 'package:in_app_review/in_app_review.dart';
|
||||
|
||||
part 'connection_notifier.g.dart';
|
||||
|
||||
@@ -30,6 +31,14 @@ class ConnectionNotifier extends _$ConnectionNotifier with AppLogger {
|
||||
if (previous case AsyncData(:final value) when !value.isConnected) {
|
||||
if (next case AsyncData(value: final Connected _)) {
|
||||
await ref.read(hapticServiceProvider.notifier).heavyImpact();
|
||||
|
||||
if (Platform.isAndroid &&
|
||||
!ref.read(Preferences.storeReviewedByUser)) {
|
||||
if (await InAppReview.instance.isAvailable()) {
|
||||
InAppReview.instance.requestReview();
|
||||
ref.read(Preferences.storeReviewedByUser.notifier).update(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -94,18 +94,19 @@ class ConnectionButton extends HookConsumerWidget {
|
||||
AsyncData(value: _) => buttonTheme.idleColor!,
|
||||
_ => Colors.red,
|
||||
},
|
||||
image:switch (connectionStatus) {
|
||||
image: switch (connectionStatus) {
|
||||
AsyncData(value: Connected()) when requiresReconnect == true =>
|
||||
Assets.images.disconnectNorouz,
|
||||
AsyncData(value: Connected()) => Assets.images.connectNorouz,
|
||||
AsyncData(value: _) => Assets.images.disconnectNorouz,
|
||||
_ => Assets.images.disconnectNorouz,
|
||||
AsyncData(value: Disconnected()) || AsyncError() => Assets.images.disconnectNorouz,
|
||||
AsyncData(value: Disconnected()) ||
|
||||
AsyncError() =>
|
||||
Assets.images.disconnectNorouz,
|
||||
AsyncData(value: Connected()) => Assets.images.connectNorouz,
|
||||
_ =>Assets.images.disconnectNorouz,
|
||||
_ => Assets.images.disconnectNorouz,
|
||||
},
|
||||
useImage:today.day>=19 && today.day<=23 && today.month==3 ,
|
||||
|
||||
useImage: today.day >= 19 && today.day <= 23 && today.month == 3,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -161,12 +162,9 @@ class _ConnectionButton extends StatelessWidget {
|
||||
tween: ColorTween(end: buttonColor),
|
||||
duration: const Duration(milliseconds: 250),
|
||||
builder: (context, value, child) {
|
||||
if(useImage) {
|
||||
return image.image(
|
||||
filterQuality: FilterQuality.medium
|
||||
);
|
||||
}
|
||||
else{
|
||||
if (useImage) {
|
||||
return image.image(filterQuality: FilterQuality.medium);
|
||||
} else {
|
||||
return Assets.images.logo.svg(
|
||||
colorFilter: ColorFilter.mode(
|
||||
value!,
|
||||
|
||||
@@ -7,6 +7,7 @@ import Foundation
|
||||
|
||||
import device_info_plus
|
||||
import flutter_timezone
|
||||
import in_app_review
|
||||
import mobile_scanner
|
||||
import package_info_plus
|
||||
import path_provider_foundation
|
||||
@@ -23,6 +24,7 @@ import window_manager
|
||||
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
||||
DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin"))
|
||||
FlutterTimezonePlugin.register(with: registry.registrar(forPlugin: "FlutterTimezonePlugin"))
|
||||
InAppReviewPlugin.register(with: registry.registrar(forPlugin: "InAppReviewPlugin"))
|
||||
MobileScannerPlugin.register(with: registry.registrar(forPlugin: "MobileScannerPlugin"))
|
||||
FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin"))
|
||||
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
|
||||
|
||||
16
pubspec.lock
16
pubspec.lock
@@ -830,6 +830,22 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "4.1.3"
|
||||
in_app_review:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: in_app_review
|
||||
sha256: "99869244d09adc76af16bf8fd731dd13cef58ecafd5917847589c49f378cbb30"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.0.9"
|
||||
in_app_review_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: in_app_review_platform_interface
|
||||
sha256: fed2c755f2125caa9ae10495a3c163aa7fab5af3585a9c62ef4a6920c5b45f10
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.0.5"
|
||||
injector:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
||||
@@ -78,6 +78,7 @@ dependencies:
|
||||
json_path: ^0.7.1
|
||||
# permission_handler: ^11.3.0 # is not compatible with windows
|
||||
flutter_easy_permission: ^1.1.2
|
||||
in_app_review: ^2.0.9
|
||||
# circle_flags: ^4.0.2
|
||||
circle_flags:
|
||||
git: https://github.com/hiddify-com/flutter_circle_flags.git
|
||||
|
||||
Reference in New Issue
Block a user