Skip to content

Commit 6b3ae07

Browse files
committed
enable notifications by default for new installs
1 parent 3f2e464 commit 6b3ae07

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

CHANGELOG.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
- Fix a bug with translations not applying to triggers
55
- Set default actions for more triggers
66
- Add gear pairing to onboarding
7-
7+
- Add marketing notifications toggle
8+
- Add UwU toggle (Whats this?)
89

910
### V 1.2.1
1011

@@ -90,7 +91,7 @@
9091

9192
- Fixed some bugs with Custom Actions
9293

93-
# Welcome!
94+
# Welcome
9495

9596
This is the first release of the all new Tail Company App!
9697
Theres so many improvements over our old app - heres the headlines

lib/Backend/firebase.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ Future<void> configurePushNotifications() async {
1717
options: DefaultFirebaseOptions.currentPlatform,
1818
);
1919
//Disable firebase and clear ID
20-
if (!HiveProxy.getOrDefault(settings, marketingNotificationsEnabled, defaultValue: marketingNotificationsEnabledDefault)) {
20+
if (!HiveProxy.getOrDefault(settings, marketingNotificationsEnabled, defaultValue: marketingNotificationsEnabledDefault) ||
21+
HiveProxy.getOrDefault(settings, hasCompletedOnboarding, defaultValue: hasCompletedOnboardingDefault) != hasCompletedOnboardingVersionToAgree) {
2122
await FirebaseInstallations.instance.delete();
2223
FirebaseMessaging.instance.setAutoInitEnabled(false);
2324
return;

lib/Frontend/pages/intro.dart

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,20 @@ class OnBoardingPageState extends ConsumerState<OnBoardingPage> {
3333
final Logger _introLogger = Logger("Onboarding");
3434
final introKey = GlobalKey<IntroductionScreenState>();
3535
bool bluetoothAccepted = false;
36-
bool privacyAccepted = HiveProxy.getOrDefault(settings, hasCompletedOnboarding, defaultValue: hasCompletedOnboardingDefault) == hasCompletedOnboardingVersionToAgree;
36+
bool privacyAccepted = false;
37+
@override
38+
void initState() {
39+
super.initState();
40+
//enable marketing notifications by default for new installs, but not existing ones
41+
HiveProxy.put(settings, marketingNotificationsEnabled, true);
42+
}
3743

3844
void _onIntroEnd(BuildContext context) {
3945
// Navigator.of(context).pushReplacement()
4046
plausible.event(name: "Complete Onboarding");
4147
_introLogger.info("Complete Onboarding");
42-
configurePushNotifications();
4348
HiveProxy.put(settings, hasCompletedOnboarding, hasCompletedOnboardingVersionToAgree);
49+
configurePushNotifications();
4450
const ActionPageRoute().pushReplacement(context);
4551
}
4652

0 commit comments

Comments
 (0)