Skip to content

Commit

Permalink
Merge pull request #242 from TechnicalTeam-BVCOENM/rateAppWidget
Browse files Browse the repository at this point in the history
Rate app widget
  • Loading branch information
psantosh16 authored Aug 27, 2024
2 parents 1c7bb87 + 32811c1 commit cba8eee
Show file tree
Hide file tree
Showing 8 changed files with 63 additions and 2 deletions.
10 changes: 10 additions & 0 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@
<uses-permission android:name="android.permission.WRITE_CALENDAR" />
<uses-permission android:name="android.permission.READ_CALENDAR" />
<queries>
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />

<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />

<data android:scheme="http" />
<data android:scheme="https" />
<data android:host="abhiyaan.dynalinks.app" />
</intent-filter>
<intent>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
Expand Down
1 change: 1 addition & 0 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
allprojects {
ext.kotlin_version = '1.9.22'
repositories {
google()
mavenCentral()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,6 @@ class DetailedEventViewModel extends BaseViewModel {
value:
"${eventData.title} Event Share button clicked : ${eventData.docID}");
await Share.share(
'Check out this event on Abhiyaan App\n\n${eventData.title}\n${eventData.about}\n${DateFormat('dd-MM-yyyy').format(eventData.startDate.toDate())} to ${DateFormat('dd-MM-yyyy').format(eventData.endDate.toDate())}\n${eventData.location}\n\nContact Details:\n${eventData.cName}\n${eventData.cEmail}\n${eventData.cPhone}\n\n${eventData.registerUrl}');
'Check out this event on Abhiyaan App\n\n${eventData.title}\n${eventData.about}\n${DateFormat('dd-MM-yyyy').format(eventData.startDate.toDate())} to ${DateFormat('dd-MM-yyyy').format(eventData.endDate.toDate())}\n${eventData.location}\n\nContact Details:\n${eventData.cName}\n${eventData.cEmail}\n${eventData.cPhone}\n\n${eventData.registerUrl}\n\nCheckout Abhiyaan App:\nhttp://abhiyaan.dynalinks.app/android');
}
}
1 change: 0 additions & 1 deletion lib/ui/views/event/event_view_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ class EventViewModel extends BaseViewModel {
_gallery = await runBusyFuture(_firestoreService.getGalleryImages());
_bestMemories = await runBusyFuture(_firestoreService.getAllMemories());
_gallery.sort((a, b) => b.year.compareTo(a.year));

getRemainingEvents();
notifyListeners();
getTodaysEvent();
Expand Down
3 changes: 3 additions & 0 deletions lib/ui/views/profile/profile_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:abhiyaan/ui/common/circular_loading_indicator.dart';
import 'package:abhiyaan/file_exporter.dart';
import 'package:abhiyaan/ui/common/url_launcher.dart';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:in_app_review/in_app_review.dart';
part 'profile_view_model.dart';
part "profile_view_component.dart";

Expand Down Expand Up @@ -57,6 +58,8 @@ class ProfileView extends StatelessWidget {
// Others
const ProfileSectionText(title: 'Others'),
16.verticalSpace,
const RateAppTile(),
16.verticalSpace,
const HelpSupportTile(),
16.verticalSpace,
const PrivacyPolicyTile(),
Expand Down
40 changes: 40 additions & 0 deletions lib/ui/views/profile/profile_view_component.dart
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,46 @@ class HelpSupportTile extends ViewModelWidget<ProfileViewModel> {
);
}
}
class RateAppTile extends ViewModelWidget<ProfileViewModel> {
const RateAppTile({
super.key,
});

@override
Widget build(BuildContext context, ProfileViewModel viewModel) {
return GestureDetector(
onTap: () {
viewModel.rateApp();
},
child: ListTile(
tileColor: context.colorScheme.card,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12.r),
),
leading: SizedBox(
child: Icon(
Icons.star_border_outlined,
size: 30.r,
color: context.colorScheme.secondary.withOpacity(0.6),
),
),
title: Text(
"Rate App",
style: FontThemeClass().body(
context,
color: context.colorScheme.primaryText,
fontWeight: FontWeight.w500,
),
),
trailing: Icon(
Icons.arrow_forward_ios_rounded,
size: 20.r,
color: context.colorScheme.primaryText.withOpacity(0.5),
),
),
);
}
}

class PrivacyPolicyTile extends ViewModelWidget<ProfileViewModel> {
const PrivacyPolicyTile({
Expand Down
7 changes: 7 additions & 0 deletions lib/ui/views/profile/profile_view_model.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
part of 'profile_view.dart';

class ProfileViewModel extends BaseViewModel {
final InAppReview inAppReview = InAppReview.instance;
final log = getLogger('ProfileView');
final _analyticsService = locator<AnalyticsService>();
final _navigationService = locator<NavigationService>();
Expand Down Expand Up @@ -59,4 +60,10 @@ class ProfileViewModel extends BaseViewModel {

notifyListeners();
}

void rateApp() async {
if (await inAppReview.isAvailable()) {
await inAppReview.requestReview();
}
}
}
1 change: 1 addition & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ dependencies:
mailer: ^6.0.1
flutter_staggered_grid_view: ^0.7.0
add_2_calendar: ^3.0.1
in_app_review: ^2.0.9

dev_dependencies:
flutter_test:
Expand Down

0 comments on commit cba8eee

Please sign in to comment.