Skip to content

Commit

Permalink
add logincount and update cms accordingly
Browse files Browse the repository at this point in the history
  • Loading branch information
NeXTormer committed Feb 7, 2024
1 parent f01c3bf commit 0a61f3a
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 7 deletions.
3 changes: 3 additions & 0 deletions firecms/deploy.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
yarn run build
firebase deploy --only hosting

6 changes: 6 additions & 0 deletions firecms/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ type FredericUser = {
// email: string,
has_purchased: boolean,
last_login: Date,
login_count: number,
last_os: string,
last_os_version: string,
is_developer: boolean,
Expand Down Expand Up @@ -314,6 +315,11 @@ const usersCollection = buildCollection<FredericUser>({
model: "date_time",
readOnly: true
}),
login_count: buildProperty({
name: "Login Count",
dataType: "number",
readOnly: true
}),
should_reload_data: buildProperty({
name: "Should reload data",
dataType: "boolean"
Expand Down
4 changes: 2 additions & 2 deletions lib/backend/analytics/frederic_analytics_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ abstract class FredericAnalyticsService {
// // Future<void> logEnterHomeScreen() {
// // return analytics.setCurrentScreen(screenName: 'Home');
// // }
// //
// //e
// // Future<void> logChangeColorTheme(FredericColorTheme theme) {
// // return analytics.logEvent(
// // name: 'change_color_theme', parameters: {'theme': theme.name});
Expand Down Expand Up @@ -189,7 +189,7 @@ class UmamiAnalyticsService extends FredericAnalyticsService {
}));

if (kDebugMode) {
// enabled = false;
enabled = false;
}
}

Expand Down
5 changes: 5 additions & 0 deletions lib/backend/database/firebase/firebase_auth_interface.dart
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ class FirebaseAuthInterface implements FredericAuthInterface {
'last_login': Timestamp.now(),
'last_os': Platform.operatingSystem,
'last_os_version': Platform.operatingSystemVersion,
'login_count': FieldValue.increment(1),
});

if (_box == null) _box = await Hive.openBox(_name);
Expand Down Expand Up @@ -233,6 +234,10 @@ class FirebaseAuthInterface implements FredericAuthInterface {
//TODO: find a way to move this to another class
//TODO: this breaks the abstraction of the auth interface maybe?
'has_purchased': trialEnabled ? false : true,
'last_login': Timestamp.now(),
'last_os': Platform.operatingSystem,
'last_os_version': Platform.operatingSystemVersion,
'login_count': 1,
});

final userDocument =
Expand Down
16 changes: 11 additions & 5 deletions lib/misc/bottom_sheet.dart
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
import 'package:cupertino_modal_sheet/cupertino_modal_sheet.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:sheet/route.dart';
import 'package:sheet/sheet.dart';

Future<void> showFredericBottomSheet(
{required BuildContext context,
bool enableDrag = false,
bool isDismissible = false,
bool isDismissible = true,
required Widget Function(BuildContext) builder}) {
HapticFeedback.lightImpact();
return Navigator.of(context)
.push(CupertinoSheetRoute<void>(builder: builder));

return showCupertinoModalSheet(
context: context,
builder: builder,
barrierDismissible: isDismissible,
);

// return Navigator.of(context)
// .push(CupertinoSheetRoute<void>(builder: builder));
// Navigator.of(context)
// .push(SheetRoute<void>(builder: builder, draggable: enableDrag));
}
Expand Down
2 changes: 2 additions & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ dependencies:
introduction_screen: ^3.1.12
cached_network_image: ^3.3.0


cupertino_modal_sheet: ^1.1.0
sheet:
git:
url: https://github.com/jamesblasco/modal_bottom_sheet.git
Expand Down

0 comments on commit 0a61f3a

Please sign in to comment.