Skip to content

Commit

Permalink
enabled app review + refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
GibreelAbdullah committed Oct 29, 2024
1 parent 5dd448b commit 3104078
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 22 deletions.
2 changes: 1 addition & 1 deletion android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application
android:label="hanswehr"
android:label="Hans Wehr"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher">
<activity
Expand Down
2 changes: 1 addition & 1 deletion lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class _MyAppState extends State<MyApp> {
@override
void initState() {
super.initState();
// appReview();
appReview();
// checkDatabaseUpdates();
}

Expand Down
12 changes: 7 additions & 5 deletions lib/screens/search.dart
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ class _SearchState extends State<Search> {

void buildDefinitionOnSubmission(BuildContext context, String searchWord,
DefinitionProvider definitionListConsumer) async {
definitionListConsumer.searchWord = searchWord;
definitionListConsumer.searchType = 'FullTextSearch';
DefinitionProvider value =
await databaseObject.definition(searchWord, 'FullTextSearch');
definitionListConsumer.updateDefinition(
Expand Down Expand Up @@ -141,28 +143,28 @@ class _SearchState extends State<Search> {
}

Widget buildItem(BuildContext context, String searchWord,
DefinitionProvider definitionList) {
DefinitionProvider definitionListConsumer) {
final model =
Provider.of<SearchSuggestionsProvider>(context, listen: false);
return Column(
mainAxisSize: MainAxisSize.min,
children: [
InkWell(
onTap: () async {
definitionList.searchType =
definitionListConsumer.searchType =
allAlphabets.contains(searchWord.substring(0, 1))
? 'RootSearch'
: 'FullTextSearch';
definitionList.searchWord = searchWord;
definitionListConsumer.searchWord = searchWord;
model.addHistory(searchWord);
Future.delayed(
const Duration(milliseconds: 50000),
() => model.clear(),
);
FloatingSearchBar.of(context)!.close();
DefinitionProvider value = await databaseObject.definition(
searchWord, definitionList.searchType);
definitionList.updateDefinition(
searchWord, definitionListConsumer.searchType);
definitionListConsumer.updateDefinition(
value.id,
value.word,
value.definition,
Expand Down
26 changes: 13 additions & 13 deletions lib/services/app_review.dart
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
// import '../service_locator.dart';
// import 'local_storage_service.dart';
// import 'package:in_app_review/in_app_review.dart';
import '../service_locator.dart';
import 'local_storage_service.dart';
import 'package:in_app_review/in_app_review.dart';

// void appReview() async {
// if (locator<LocalStorageService>().appUsage > 15) {
// final InAppReview inAppReview = InAppReview.instance;
// if (await inAppReview.isAvailable()) {
// inAppReview.requestReview();
// }
// } else {
// locator<LocalStorageService>().appUsage++;
// }
// }
void appReview() async {
if (locator<LocalStorageService>().appUsage > 15) {
final InAppReview inAppReview = InAppReview.instance;
if (await inAppReview.isAvailable()) {
inAppReview.requestReview();
}
} else {
locator<LocalStorageService>().appUsage++;
}
}
2 changes: 2 additions & 0 deletions macos/Flutter/GeneratedPluginRegistrant.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import FlutterMacOS
import Foundation

import audio_session
import in_app_review
import just_audio
import package_info_plus
import path_provider_foundation
Expand All @@ -18,6 +19,7 @@ import wakelock_plus

func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
AudioSessionPlugin.register(with: registry.registrar(forPlugin: "AudioSessionPlugin"))
InAppReviewPlugin.register(with: registry.registrar(forPlugin: "InAppReviewPlugin"))
JustAudioPlugin.register(with: registry.registrar(forPlugin: "JustAudioPlugin"))
FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin"))
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
Expand Down
16 changes: 16 additions & 0 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,22 @@ packages:
url: "https://pub.dev"
source: hosted
version: "0.5.1"
in_app_review:
dependency: "direct main"
description:
name: in_app_review
sha256: "41ec6f30427ab09eb6ae1c85c4a2a624a145fc5d726f023de4d97170ec9e5466"
url: "https://pub.dev"
source: hosted
version: "2.0.8"
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"
io:
dependency: transitive
description:
Expand Down
4 changes: 2 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: A new Flutter project.

publish_to: "none" # Remove this line if you wish to publish to pub.dev

version: 1.15.5+64
version: 1.15.6+65

environment:
sdk: ">=2.16.0 <4.0.0"
Expand All @@ -22,7 +22,7 @@ dependencies:
shared_preferences: ^2.2.2
share_plus: ^7.2.1
get_it: ^7.6.4
# in_app_review: ^2.0.8
in_app_review: ^2.0.8
flutter_colorpicker: ^1.0.3
sqflite_common_ffi: ^2.3.0+2
html: ^0.15.4
Expand Down

0 comments on commit 3104078

Please sign in to comment.