Add Google calendar API and workspace sync

This commit is contained in:
zsolt
2026-08-13 00:50:47 +02:00
parent 164f7ccad7
commit ab6ce48a83
11 changed files with 1119 additions and 677 deletions
+26
View File
@@ -58,6 +58,32 @@ DateTime? parseDate(String value) {
return DateTime(year, month, day);
}
DateTime? parseGoogleEventDate(Map<String, dynamic> value) {
final dateTime = value['dateTime'] as String?;
if (dateTime != null && dateTime.trim().isNotEmpty) {
return DateTime.tryParse(dateTime)?.toLocal();
}
final date = value['date'] as String?;
if (date == null || date.trim().isEmpty) return null;
final parsed = DateTime.tryParse(date);
if (parsed == null) return null;
return DateTime(parsed.year, parsed.month, parsed.day);
}
Color parseGoogleColor(String? value) {
final raw = value?.trim();
if (raw == null || !raw.startsWith('#')) {
return const Color(0xFF4285F4);
}
final hex = raw.substring(1);
if (hex.length != 6) return const Color(0xFF4285F4);
final colorValue = int.tryParse(hex, radix: 16);
if (colorValue == null) return const Color(0xFF4285F4);
return Color(0xFF000000 | colorValue);
}
String uniqueId() => DateTime.now().microsecondsSinceEpoch.toString();
String normalizeJarvisUrl(String value) {