Implement data sync and cleanup
This commit is contained in:
@@ -620,6 +620,25 @@ class _SettingsTab extends ConsumerWidget {
|
||||
MaterialPageRoute(
|
||||
builder: (context) => const ExportDataScreen()));
|
||||
}),
|
||||
_buildSettingsTile(
|
||||
context,
|
||||
Icons.sync,
|
||||
'Sync Data',
|
||||
onTap: () async {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('Syncing data...')),
|
||||
);
|
||||
await ref.read(cycleEntriesProvider.notifier).syncData();
|
||||
if (context.mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(
|
||||
content: Text('Sync complete'),
|
||||
backgroundColor: Colors.green,
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
]),
|
||||
const SizedBox(height: 16),
|
||||
_buildSettingsGroup(context, 'Account', [
|
||||
|
||||
@@ -390,6 +390,27 @@ class HusbandSettingsScreen extends ConsumerWidget {
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
ListTile(
|
||||
leading: const Icon(Icons.sync, color: Colors.blue),
|
||||
title: Text('Sync Data',
|
||||
style: GoogleFonts.outfit(
|
||||
fontWeight: FontWeight.w500, color: Colors.blue)),
|
||||
onTap: () async {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('Syncing data...')),
|
||||
);
|
||||
await ref.read(cycleEntriesProvider.notifier).syncData();
|
||||
if (context.mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(
|
||||
content: Text('Sync complete'),
|
||||
backgroundColor: Colors.green,
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
const Divider(height: 1),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.cloud_download_outlined,
|
||||
color: Colors.blue),
|
||||
|
||||
@@ -141,7 +141,7 @@ class _OnboardingScreenState extends ConsumerState<OnboardingScreen> {
|
||||
lastPeriodStartDate: _lastPeriodStart,
|
||||
isIrregularCycle: _isIrregularCycle,
|
||||
hasCompletedOnboarding: true,
|
||||
useExampleData: _useExampleData,
|
||||
// useExampleData: Removed
|
||||
isPadTrackingEnabled: _isPadTrackingEnabled,
|
||||
createdAt: DateTime.now(),
|
||||
updatedAt: DateTime.now(),
|
||||
@@ -149,15 +149,17 @@ class _OnboardingScreenState extends ConsumerState<OnboardingScreen> {
|
||||
|
||||
await ref.read(userProfileProvider.notifier).updateProfile(userProfile);
|
||||
|
||||
// Generate example data if requested
|
||||
// Generate example data if requested - REMOVED
|
||||
/*
|
||||
if (_useExampleData) {
|
||||
await ref
|
||||
.read(cycleEntriesProvider.notifier)
|
||||
.generateExampleData(userProfile.id);
|
||||
}
|
||||
*/
|
||||
|
||||
// Trigger partner connection notification if applicable
|
||||
if (!_skipPartnerConnection && !_useExampleData) {
|
||||
if (!_skipPartnerConnection) {
|
||||
await NotificationService().showPartnerUpdateNotification(
|
||||
title: 'Connection Successful!',
|
||||
body: 'You are now connected with your partner. Tap to start sharing.',
|
||||
|
||||
Reference in New Issue
Block a user