feat: Add auto-sync, fix partner linking UI, update sharing settings

- Add 10-second periodic auto-sync to CycleEntriesNotifier
- Fix husband_devotional_screen: use partnerId for isConnected check, navigate to SharingSettingsScreen instead of legacy mock dialog
- Remove obsolete _showConnectDialog method and mock data import
- Update husband_settings_screen: show 'Partner Settings' with linked partner name when connected
- Add SharingSettingsScreen: Pad Supplies toggle (disabled when pad tracking off), Intimacy always enabled
- Add CORS OPTIONS handler to backend server
- Add _ensureServerRegistration for reliable partner linking
- Add copy button to Invite Partner dialog
- Dynamic base URL for web (uses window.location.hostname)
This commit is contained in:
2026-01-09 17:20:49 -06:00
parent d28898cb81
commit 1c2c56e9e2
21 changed files with 1690 additions and 493 deletions

View File

@@ -9,6 +9,8 @@ import '../../widgets/scripture_card.dart';
import '../../models/user_profile.dart';
import '../../models/teaching_plan.dart';
import '../../providers/scripture_provider.dart'; // Import the new provider
import '../prayer/prayer_request_screen.dart';
import '../settings/sharing_settings_screen.dart';
class DevotionalScreen extends ConsumerStatefulWidget {
const DevotionalScreen({super.key});
@@ -372,9 +374,16 @@ class _DevotionalScreenState extends ConsumerState<DevotionalScreen> {
const SizedBox(width: 12),
Expanded(
child: ElevatedButton.icon(
onPressed: () {},
icon: const Icon(Icons.edit_note),
label: const Text('Journal'),
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const PrayerRequestScreen(),
),
);
},
icon: const Icon(Icons.spa_outlined),
label: const Text('Prayer Requests'),
),
),
],
@@ -623,7 +632,14 @@ class _DevotionalScreenState extends ConsumerState<DevotionalScreen> {
const SizedBox(height: 16),
Center(
child: OutlinedButton.icon(
onPressed: () => _showShareDialog(context),
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const SharingSettingsScreen(),
),
);
},
icon: const Icon(Icons.link, size: 18),
label: const Text('Connect with Husband'),
style: OutlinedButton.styleFrom(
@@ -636,70 +652,4 @@ class _DevotionalScreenState extends ConsumerState<DevotionalScreen> {
),
);
}
void _showShareDialog(BuildContext context) {
// Generate a simple pairing code (in a real app, this would be stored/validated)
final userProfile = ref.read(userProfileProvider);
final pairingCode =
userProfile?.id.substring(0, 6).toUpperCase() ?? 'ABC123';
showDialog(
context: context,
builder: (context) => AlertDialog(
title: const Row(
children: [
Icon(Icons.share_outlined, color: AppColors.navyBlue),
SizedBox(width: 8),
Text('Share with Husband'),
],
),
content: Column(
mainAxisSize: MainAxisSize.min,
children: [
Text(
'Share this code with your husband so he can connect to your cycle data:',
style:
GoogleFonts.outfit(fontSize: 14, color: AppColors.warmGray),
),
const SizedBox(height: 24),
Container(
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 16),
decoration: BoxDecoration(
color: AppColors.navyBlue.withValues(alpha: 0.1),
borderRadius: BorderRadius.circular(12),
border: Border.all(
color: AppColors.navyBlue.withValues(alpha: 0.3)),
),
child: SelectableText(
pairingCode,
style: GoogleFonts.outfit(
fontSize: 32,
fontWeight: FontWeight.bold,
letterSpacing: 4,
color: AppColors.navyBlue,
),
),
),
const SizedBox(height: 16),
Text(
'He can enter this in his app under Settings > Connect with Wife.',
style:
GoogleFonts.outfit(fontSize: 12, color: AppColors.warmGray),
textAlign: TextAlign.center,
),
],
),
actions: [
ElevatedButton(
onPressed: () => Navigator.pop(context),
style: ElevatedButton.styleFrom(
backgroundColor: AppColors.navyBlue,
foregroundColor: Colors.white,
),
child: const Text('Done'),
),
],
),
);
}
}