Add Google calendar API and workspace sync
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user