Skip to content

Commit 3366447

Browse files
authored
Implement more options and fix general bugs (#229)
2 parents 90b8366 + 40d5016 commit 3366447

31 files changed

+531
-266
lines changed

AppImageBuilder.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,5 +84,5 @@ AppDir:
8484
command: ./AppRun
8585
AppImage:
8686
arch: x86_64
87-
comp: None
87+
comp: gzip
8888
update-information: guess

lib/api/api.dart

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ import 'package:xml2json/xml2json.dart';
2929
export 'events.dart';
3030
export 'ptz.dart';
3131

32+
enum ServerAdditionResponse {
33+
validated,
34+
versionMismatch,
35+
unknown;
36+
}
37+
3238
class API {
3339
static final API instance = API();
3440

@@ -49,7 +55,10 @@ class API {
4955
/// If the attributes present in [Server] are correct, then the
5056
/// returned object will have [Server.serverUUID] & [Server.cookie]
5157
/// present in it otherwise `null`.
52-
Future<Server> checkServerCredentials(Server server) async {
58+
Future<(ServerAdditionResponse response, Server server)>
59+
checkServerCredentials(
60+
Server server,
61+
) async {
5362
debugPrint('Checking server credentials for server ${server.id}');
5463
try {
5564
final uri = Uri.https(
@@ -79,12 +88,19 @@ class API {
7988
);
8089

8190
if (response.statusCode == 200) {
91+
if (body == 'Route error!') {
92+
server.online = false;
93+
return (ServerAdditionResponse.versionMismatch, server);
94+
}
8295
final json = await compute(jsonDecode, body);
83-
return server.copyWith(
84-
serverUUID: json['server_uuid'],
85-
cookie:
86-
response.headers['set-cookie'] ?? response.headers['Set-Cookie'],
87-
online: true,
96+
return (
97+
ServerAdditionResponse.validated,
98+
server.copyWith(
99+
serverUUID: json['server_uuid'],
100+
cookie: response.headers['set-cookie'] ??
101+
response.headers['Set-Cookie'],
102+
online: true,
103+
)
88104
);
89105
} else {
90106
debugPrint(body);
@@ -97,7 +113,7 @@ class API {
97113

98114
server.online = false;
99115
}
100-
return server;
116+
return (ServerAdditionResponse.unknown, server);
101117
}
102118

103119
/// Gets [Device] devices present on the [server] after login.

lib/api/api_helpers.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ abstract class APIHelpers {
8787
int attempts = 50,
8888
}) async {
8989
final events = await API.instance.getEvents(
90-
await API.instance.checkServerCredentials(server),
90+
(await API.instance.checkServerCredentials(server)).$2,
9191
);
9292
debugPrint(events.map((e) => e.id).toList().toString());
9393
Future<String?> getThumbnailForMediaID(int mediaID) async {

lib/firebase_messaging_background_handler.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ abstract class FirebaseConfiguration {
437437
storage.add({kStorageNotificationToken: token});
438438
for (final server in ServersProvider.instance.servers) {
439439
API.instance.registerNotificationToken(
440-
await API.instance.checkServerCredentials(server),
440+
(await API.instance.checkServerCredentials(server)).$2,
441441
token,
442442
);
443443
}
@@ -456,7 +456,7 @@ abstract class FirebaseConfiguration {
456456
await storage.add({kStorageNotificationToken: token});
457457
for (final server in ServersProvider.instance.servers) {
458458
API.instance.registerNotificationToken(
459-
await API.instance.checkServerCredentials(server),
459+
(await API.instance.checkServerCredentials(server)).$2,
460460
token,
461461
);
462462
}

lib/l10n/app_en.arb

Lines changed: 56 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,15 @@
6464
}
6565
}
6666
},
67-
"serverAlreadyAdded": "The {serverName} server is already added",
67+
"serverAlreadyAdded": "The {serverName} server is already added.",
6868
"@serverAlreadyAdded": {
6969
"placeholders": {
7070
"serverName": {
7171
"type": "String"
7272
}
7373
}
7474
},
75+
"serverVersionMismatch": "Tried to add a server with an unsupported version. Please upgrade your server and try again!",
7576
"noServersAvailable": "No servers available",
7677
"error": "Error",
7778
"videoError": "An error happened while trying to play the video.",
@@ -159,8 +160,6 @@
159160
}
160161
}
161162
},
162-
"dateFormat": "Date Format",
163-
"timeFormat": "Time Format",
164163
"nDevices": "{n, plural, =0{No devices} =1{1 device} other{{n} devices}}",
165164
"@nDevices": {
166165
"placeholders": {
@@ -215,8 +214,6 @@
215214
"cameraRefreshPeriodDescription": "The interval between camera refreshes. It ensures the camera video is still valid from time to time.",
216215
"@Layouts": {},
217216
"cycle": "Cycle",
218-
"cycleTogglePeriod": "Layout cycle toggle period",
219-
"cycleTogglePeriodDescription": "The interval between layout changes when the cycle mode is enabled.",
220217
"fallbackLayoutName": "Layout {layout}",
221218
"@fallbackLayoutName": {
222219
"placeholders": {
@@ -451,11 +448,6 @@
451448
}
452449
}
453450
},
454-
"@BETA FEATURES": {},
455-
"betaFeatures": "Beta features",
456-
"matrixedViewZoom": "Matrixed view zoom",
457-
"matrixedViewZoomDescription": "Zoom in on a 16x16 matrix view to see more detail.",
458-
"matrixType": "Matrix type",
459451
"@CURRENT TASKS": {},
460452
"currentTasks": "Current tasks",
461453
"noCurrentTasks": "No tasks",
@@ -464,14 +456,65 @@
464456
"taskDownloadingEvent": "Downloading event",
465457
"@@@SETTINGS": {},
466458
"defaultField": "Default",
467-
"@@APPEARANCE": {},
459+
"@@GENERAL": {},
460+
"general": "General",
461+
"cycleTogglePeriod": "Layout cycle toggle period",
462+
"cycleTogglePeriodDescription": "The interval between layout changes when the cycle mode is enabled.",
463+
"notifications": "Notifications",
464+
"notificationsEnabled": "Notifications enabled",
465+
"notificationClickBehavior": "Notification Click Behavior",
466+
"notificationClickBehaviorDescription": "Choose what happens when you click on a notification.",
467+
"showEventsScreen": "Show events history",
468+
"@@EVENTS_AND_DOWNLOADS": {},
469+
"chooseEveryDownloadsLocation": "Choose the location for every download",
470+
"chooseEveryDownloadsLocationDescription": "Whether to choose the location for each download or use the default location. When enabled, you will be prompted to choose the download directory for each download.",
471+
"allowCloseWhenDownloading": "Allow closing the app when downloading",
472+
"events": "Events",
473+
"initialEventSpeed": "Initial event speed",
474+
"initialEventVolume": "Initial event volume",
475+
"differentEventColors": "Different events by colors",
476+
"differentEventColorsDescription": "Whether to show different colors for events in the timeline. This assists to easily differentiate the events.",
477+
"initialTimelinePoint": "Initial point",
478+
"initialTimelinePointDescription": "The initial point of the timeline.",
479+
"beginningInitialPoint": "Beginning",
480+
"firstEventInitialPoint": "First event",
481+
"hourAgoInitialPoint": "1 hour ago",
482+
"@@APPLICATION": {},
468483
"theme": "Theme",
469484
"themeDescription": "Change the appearance of the app",
470485
"system": "System",
471486
"light": "Light",
472487
"dark": "Dark",
473-
"@@MISC": {},
474-
"general": "General",
488+
"dateFormat": "Date Format",
489+
"dateFormatDescription": "What format to use for displaying dates",
490+
"timeFormat": "Time Format",
491+
"timeFormatDescription": "What format to use for displaying time",
492+
"@@PRIVACY_AND_SECURITY": {},
493+
"privacyAndSecurity": "Privacy and Security",
494+
"allowDataCollection": "Allow Bluecherry to collect usage data",
495+
"allowDataCollectionDescription": "Allow Bluecherry to collect data to improve the app and provide better services. Data is collected anonymously and does not contain any personal information.",
496+
"automaticallyReportErrors": "Automatically report errors",
497+
"automaticallyReportErrorsDescription": "Automatically send error reports to Bluecherry to help improve the app. Error reports may contain personal information.",
498+
"privacyPolicy": "Privacy Policy",
499+
"termsOfService": "Terms of Service",
500+
"@@ADVANCED_OPTIONS": {},
501+
"matrixZoom": "Area Magnification",
502+
"matrixedViewZoom": "Area Magnification enabled",
503+
"matrixedViewZoomDescription": "Magnify a area of the matrix view when selected. This is useful when you have a lot of cameras and want to see a specific area in more detail, or when a multicast stream is provided.",
504+
"matrixType": "Matrix type",
505+
"defaultMatrixSize": "Default Magnification Proportion",
506+
"softwareZoom": "Software zoom",
507+
"softwareZoomDescription": "When enabled, the magnification will not happen in the GPU. This is useful when the hardware magnification is not working properly.",
508+
"softwareZoomDescriptionMacOS": "When enabled, the magnification will not happen in the GPU. This is useful when the hardware magnification is not working properly. On macOS, this can not be disabled.",
509+
"developerOptions": "Developer options",
510+
"openLogFile": "Open log file",
511+
"openAppDataDirectory": "Open app data directory",
512+
"debugInfo": "Debug info",
513+
"debugInfoDescription": "Display useful information for debugging, such as video metadata and other useful information for debugging purposes.",
514+
"restoreDefaults": "Restore Defaults",
515+
"restoreDefaultsDescription": "Restore all settings to their default values. This will not affect the servers you have added.",
516+
"areYouSure": "Are you sure?",
517+
"areYouSureDescription": "This will restore all settings to their default values. This will not affect your servers or any other data.",
475518
"miscellaneous": "Miscellaneous",
476519
"wakelock": "Keep screen awake",
477520
"wakelockDescription": "Keep screen awake while watching live streams or recordings.",
@@ -490,10 +533,6 @@
490533
}
491534
}
492535
},
493-
"@Notification click": {},
494-
"notificationClickBehavior": "Notification Click Behavior",
495-
"notificationClickBehaviorDescription": "Choose what happens when you click on a notification.",
496-
"showEventsScreen": "Show events history",
497536
"@@STREAMING": {},
498537
"streamingSettings": "Streaming settings",
499538
"streamingType": "Streaming type",

lib/l10n/app_fr.arb

Lines changed: 55 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@
6868
}
6969
}
7070
},
71+
"serverVersionMismatch": "Tried to add a server with an unsupported version. Please upgrade your server and try again!",
7172
"noServersAvailable": "Aucun serveur disponible",
7273
"error": "Erreur",
7374
"videoError": "Une erreur est survenue lors de la lecture de la vidé.",
@@ -153,8 +154,6 @@
153154
}
154155
}
155156
},
156-
"dateFormat": "Format de la date",
157-
"timeFormat": "Format de l'heure",
158157
"nDevices": "{n} appareils",
159158
"@nDevices": {
160159
"placeholders": {
@@ -205,8 +204,6 @@
205204
"cameraRefreshPeriodDescription": "The interval between camera refreshes. It ensures the camera video is still valid from time to time.",
206205
"@Layouts": {},
207206
"cycle": "Cycle",
208-
"cycleTogglePeriod": "Durée du cycle de basculement",
209-
"cycleTogglePeriodDescription": "The interval between layout changes when the cycle mode is enabled.",
210207
"fallbackLayoutName": "Disposition {layout}",
211208
"@fallbackLayoutName": {
212209
"placeholders": {
@@ -427,11 +424,6 @@
427424
}
428425
}
429426
},
430-
"@BETA FEATURES": {},
431-
"betaFeatures": "Beta features",
432-
"matrixedViewZoom": "Matrixed view zoom",
433-
"matrixedViewZoomDescription": "Zoom in on a 16x16 matrixed view to see more detail.",
434-
"matrixType": "Matrix type",
435427
"@CURRENT TASKS": {},
436428
"currentTasks": "Tâche courante",
437429
"noCurrentTasks": "Aucune tâche",
@@ -440,14 +432,65 @@
440432
"taskDownloadingEvent": "Téléchargement de l'évènement",
441433
"@@@SETTINGS": {},
442434
"defaultField": "Default",
443-
"@@APPEARANCE": {},
435+
"@@GENERAL": {},
436+
"general": "Général",
437+
"cycleTogglePeriod": "Durée du cycle de basculement",
438+
"cycleTogglePeriodDescription": "The interval between layout changes when the cycle mode is enabled.",
439+
"notifications": "Notifications",
440+
"notificationsEnabled": "Notifications enabled",
441+
"notificationClickBehavior": "Action de clic sur les notifications",
442+
"notificationClickBehaviorDescription": "Choose what happens when you click on a notification.",
443+
"showEventsScreen": "Montrer le navigateur d'événements",
444+
"@@EVENTS_AND_DOWNLOADS": {},
445+
"chooseEveryDownloadsLocation": "Choose the location for every download",
446+
"chooseEveryDownloadsLocationDescription": "Whether to choose the location for each download or use the default location. When enabled, you will be prompted to choose the download directory for each download.",
447+
"allowCloseWhenDownloading": "Block the app from closing when there are ongoing downloads",
448+
"events": "Events",
449+
"initialEventSpeed": "Initial speed",
450+
"initialEventVolume": "Initial volume",
451+
"differentEventColors": "Different event colors",
452+
"differentEventColorsDescription": "Whether to show different colors for events in the timeline. This assists to easily differentiate the events.",
453+
"initialTimelinePoint": "Initial point",
454+
"initialTimelinePointDescription": "The initial point of the timeline.",
455+
"beginningInitialPoint": "Beginning",
456+
"firstEventInitialPoint": "First event",
457+
"hourAgoInitialPoint": "1 hour ago",
458+
"@@APPLICATION": {},
444459
"theme": "Thème",
445460
"themeDescription": "Modifier l'apparence de l'application",
446461
"system": "Système",
447462
"light": "Clair",
448463
"dark": "Sombre",
449-
"@@MISC": {},
450-
"general": "Général",
464+
"dateFormat": "Format de la date",
465+
"dateFormatDescription": "What format to use for displaying dates",
466+
"timeFormat": "Format de l'heure",
467+
"timeFormatDescription": "What format to use for displaying time",
468+
"@@PRIVACY_AND_SECURITY": {},
469+
"privacyAndSecurity": "Privacy and Security",
470+
"allowDataCollection": "Allow Bluecherry to collect usage data",
471+
"allowDataCollectionDescription": "Allow Bluecherry to collect data to improve the app and provide better services. Data is collected anonymously and does not contain any personal information.",
472+
"automaticallyReportErrors": "Automatically report errors",
473+
"automaticallyReportErrorsDescription": "Automatically send error reports to Bluecherry to help improve the app. Error reports may contain personal information.",
474+
"privacyPolicy": "Privacy Policy",
475+
"termsOfService": "Terms of Service",
476+
"@@ADVANCED_OPTIONS": {},
477+
"matrixZoom": "Matrix Zoom",
478+
"matrixedViewZoom": "Matrixed view zoom",
479+
"matrixedViewZoomDescription": "Zoom in on a 16x16 matrixed view to see more detail.",
480+
"matrixType": "Matrix type",
481+
"defaultMatrixSize": "Default Matrix Size",
482+
"softwareZoom": "Software zoom",
483+
"softwareZoomDescription": "When enabled, the matrix zoom will not happen in the GPU. This is useful when the hardware zoom is not working properly.",
484+
"softwareZoomDescriptionMacOS": "When enabled, the matrix zoom will not happen in the GPU. This is useful when the hardware zoom is not working properly. On macOS, this can not be disabled.",
485+
"developerOptions": "Developer options",
486+
"openLogFile": "Open log file",
487+
"openAppDataDirectory": "Open app data directory",
488+
"debugInfo": "Debug info",
489+
"debugInfoDescription": "Display useful information for debugging, such as video metadata and other useful information for debugging purposes.",
490+
"restoreDefaults": "Restore Defaults",
491+
"restoreDefaultsDescription": "Restore all settings to their default values. This will not affect the servers you have added.",
492+
"areYouSure": "Are you sure?",
493+
"areYouSureDescription": "This will restore all settings to their default values. This will not affect your servers or any other data.",
451494
"miscellaneous": "Divers",
452495
"wakelock": "Keep screen on",
453496
"wakelockDescription": "Keep screen on while watching live streams or recordings.",
@@ -464,10 +507,6 @@
464507
"time": {}
465508
}
466509
},
467-
"@Notification click": {},
468-
"notificationClickBehavior": "Action de clic sur les notifications",
469-
"notificationClickBehaviorDescription": "Choose what happens when you click on a notification.",
470-
"showEventsScreen": "Montrer le navigateur d'événements",
471510
"@@STREAMING": {},
472511
"streamingSettings": "Paramètre de diffusion",
473512
"streamingType": "Type de diffusion",

0 commit comments

Comments
 (0)