Skip to content

Commit 4c9d740

Browse files
author
randommodder
committed
Fixed bug that caused the add/edit screen of homework to not work on non-debug builds.
Added predictive back gestures (show what a back action does). Enable minify. You can now rename channel links (discord relations). Discord relations are now called "channel links". Added warning for mitm attack when using app in the web (or as webapp), whilst beautifying README
1 parent ae0c67e commit 4c9d740

File tree

7 files changed

+81
-80
lines changed

7 files changed

+81
-80
lines changed

README.md

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -28,37 +28,38 @@ You can "export"(send) your homework easily, by:
2828

2929
If the discord relations are configured, you can just click on the fetch icon in the upper right corner of the home screen. This may overwrite local changes, so be careful.
3030

31-
## Get Started / Installation
31+
## Getting Started / Installation
32+
<details open>
33+
<summary><h3 style="display:inline-block">An online(ish) app is enough for me </h3></summary>
3234

33-
### An online(ish) app is enough for me
35+
> <b>BE WARNED: If you use the app with a bot token on the web, you are sending your token to a CORS proxy that redirects it to discord. Someone (in this case Cloudflare) could sniff your token. Unfortunately a CORS proxy is needed on the web, because discord does not send adequate CORS.</b>
3436
35-
The GH page is called: [https://randommodderjdk.github.io/hw_manager_flutter](https://randommodderjdk.github.io/hw_manager_flutter)
36-
37-
#### iOS / iPadOS home screen
37+
If you took notice of this warning, you can just open the GitHub Pages app: [https://randommodderjdk.github.io/hw_manager_flutter](https://randommodderjdk.github.io/hw_manager_flutter)
3838

39+
<details> <summary><h4 style="display:inline-block">iOS / iPadOS web app</h4></summary>
3940
You have two options to add the website (always needs internet connection):
4041

41-
##### Use Safari's add to home screen
42-
Go to the website above and click on the share icon. There click on "Add to home screen", type in a name and submit.
43-
44-
##### Use a profile (WebClip)
45-
Go to [https://ivi.cx/](https://ivi.cx/) and enter the details you want. You can use for example the asset provided in this repository as an icon.
46-
47-
<br>
48-
49-
#### Android home screen app
42+
> ##### 1. Use Safari's "Add to Homescreen":
43+
> Go to the website above and click on the share icon. There click on "Add to home screen", type in a name and submit.
5044
51-
You can use chrome to create an web app on android. This is like the native app, especially when the browser caches it.
45+
> ##### 2. Use a profile (WebClip)
46+
> Go to [https://ivi.cx/](https://ivi.cx/) and enter the details you want. You can use for example the asset provided in this repository as an icon.
5247
48+
</details>
5349

54-
<br>
50+
<details> <summary><h4 style="display:inline-block">Android homescreen app</h4></summary>
51+
Use your browser to create a web app on android. Search for "Add Shortcut" or anything similar.
5552

53+
This is like the native app (except the security), especially when the browser caches it. Tested with Chromium-based browsers and firefox.
5654

57-
### I prefer the native app
55+
</details>
56+
</details>
57+
<details open><summary><h3 style="display:inline-block">I prefer the native app</h3></summary>
5858

5959
**If you are on android** and do not mind the debug certificate go ahead to releases and download your arch.
6060

6161
**If you are on ios**, download the ipa (native app) in the releases, if you know how to install it. This is again not really signed. I would recommend Alt-/Troll-/Sidestore. When Apple allows apps to finally be installed like on android, then do it that way.
6262

6363
**If you'd like any other platform**:
64-
Clone this repo, (add your platform,) and built HWM yourself.
64+
Clone this repo, (add your platform,), build HWM (and maybe contribute a GitHub action) yourself.
65+
</details>

lib/dialogs/dialog_discordrelation_form.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ class DiscordRelationFormContent extends StatelessWidget {
186186
print("SEARCH != null");
187187
}
188188
final DummyChannel channel = DummyChannel.snow(Snowflake.now(), channelNameController.text);
189-
field.didChange(channel);
189+
//field.didChange(channel);
190190
onChannelSelected(channel);
191191
}
192192
if (s.isEmpty) return null;
@@ -250,7 +250,7 @@ class DummyChannel implements GuildChannel {
250250
Future<List<Webhook>> fetchWebhooks() => throw UnimplementedError();
251251

252252
@override
253-
Future<void> follow(Snowflake id) => throw UnimplementedError();
253+
Future<void> follow(Snowflake id, {String? auditLogReason}) => throw UnimplementedError();
254254

255255
@override
256256
Future<Channel> get() => throw UnimplementedError();

lib/discord_util.dart

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,12 @@ class DiscordHelper {
6262
options: clientOptions(),
6363
);
6464
loggedInNotifier.notifyListeners();
65-
} on HttpResponseError {
65+
} on HttpResponseError catch (e) {
6666
_client = null;
6767
loggedInNotifier.notifyListeners();
68+
if (kDebugMode) {
69+
print("HTTPRESPONSE ERROR, whilst logging in: ${e.errorCode} ${e.message} ");
70+
}
6871
return false;
6972
}
7073
if (_client == null) {
@@ -145,11 +148,16 @@ class DiscordHelper {
145148

146149
static final channelTypeGroups = () {
147150
final channelTypeGroups = [
151+
// 5 0
148152
[ChannelType.guildAnnouncement, ChannelType.guildText],
149153
];
150-
channelTypeGroups.addAll(
151-
ChannelType.values.where((t) => !channelTypeGroups.expand((l) => l).contains(t)).map((t) => [t]).toList(),
152-
);
154+
155+
for (int i = 1; i < 5; i++) { // add 1-4 (including) each as own category
156+
channelTypeGroups.add([ChannelType(i)]);
157+
}
158+
for (int i = 10; i < 17; i++) { // add 10-16 (including) each as own category
159+
channelTypeGroups.add([ChannelType(i)]);
160+
}
153161
/*
154162
List<ChannelType> getTypeGroup(ChannelType type) => channelTypeGroups.firstWhere((g) => g.contains(type));
155163
@@ -371,7 +379,7 @@ class DiscordHelper {
371379
video: null,
372380
provider: null,
373381
author: null,
374-
fields: null);
382+
fields: null, type: EmbedType.article);
375383
assert(equalsIgnoreShortName(testS, testEmbed));
376384

377385
print("Does not have a matching local subject");

lib/l10n/app_de.arb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
"settingsUntisImportSuccess": "Fächer von WebUntis importiert",
2828
"untisLoginFailure": "Fehler bei Anmeldung",
2929
"untisLoginSuccess": "Anmeldung erfolgreich",
30-
"settingsDiscordRelationsTitle": "Discord-Verbindungen verwalten",
31-
"settingsDiscordRelationsDescription": "Entferne, ergänze oder editiere die Verbindungen zwischen dem Discord-Kanalnamen und dem zugehörigem Webhook",
30+
"settingsDiscordRelationsTitle": "Discord-Kanalverknüpfungen verwalten",
31+
"settingsDiscordRelationsDescription": "Entferne, ergänze oder editiere die Verknüpfung zwischen dem Discord-Kanalnamen und dem zugehörigem Webhook",
3232
"settingsDiscordRelationsBotToken": "Bot-Token zum Abrufen von Nachrichten",
3333
"settingsDiscordRelationsBotTryToken": "Token wird ausprobiert...",
3434
"settingsDiscordRelationsBotTryTokenSuccess": "Bot ist eingeloggt",
@@ -37,7 +37,7 @@
3737
"settingsDiscordRelationsImportDescription": "Importiere alle (Hausaufgaben-)Kanäle, welche in der Guilde des Bots sind. Hiernach können Discord-Kanäle zu Fächern zugeordnet werden, um Hausaufgaben von Discord abzurufen und (mit einem spezifiziertem Webhook) abzusenden.",
3838
"settingsDiscordRelationsImportSuccess": "{count, plural, =1 {Ein Discord-Kanal} other {{count} Discord-Kanäle}} importiert",
3939
"settingsDiscordRelationsImportFailure": "Kanalimport schlug fehl!",
40-
"discordRelationsTitle": "Discord-Verbindungen",
40+
"discordRelationsTitle": "Discord-Kanalverknüpfungen",
4141
"deleteDiscordRelationToast": "{longName} ({shortName}) entfernt",
4242
"deleteDiscordRelationToastUndo": "Rückgängig",
4343
"datePassed": "Vorbei seit dem {date}{hours, plural, =0{} other{ um {time}}}",
@@ -47,10 +47,10 @@
4747
"dateNextWeek": "{date}{hours, plural, =0{} other{ um {time}}}, nächste Woche",
4848
"dateAnywhereElse": "{weekday}, {date}{hours, plural, =0{} other{ um {time}}}",
4949
"dateTimeFieldLabel": "Bis zum",
50-
"dialogDiscordRelationAddTitle": "Füge eine Discord-Verbindung hinzu",
50+
"dialogDiscordRelationAddTitle": "Verknüpfe einen neuen Kanal",
5151
"dialogDiscordRelationAdd": "Hinzufügen",
5252
"dialogDiscordRelationAddCancel": "Abbrechen",
53-
"dialogDiscordRelationEditTitle": "Bearbeite Verbindung",
53+
"dialogDiscordRelationEditTitle": "Bearbeite Verknüpfung",
5454
"dialogDiscordRelationEdit": "Bearbeiten",
5555
"dialogDiscordRelationEditCancel": "Abbrechen",
5656
"dialogDiscordRelationChannelName": "Kanalname",
@@ -69,8 +69,8 @@
6969
"dialogSubjectFullNameValidator": "Gib einen gültigen Fachnamen ein!",
7070
"dialogSubjectShortName": "Optionales Kürzel",
7171
"dialogSubjectShortNameHint": "Ma (nützlich für Untis)",
72-
"dialogSubjectChannelName": "Discord-Verbindung",
73-
"dialogSubjectChannelNameHint": "Wähle eine Discord-Verbindung aus",
72+
"dialogSubjectChannelName": "Discord-Verknüpfung",
73+
"dialogSubjectChannelNameHint": "Wähle eine Kanalverknüpfung aus",
7474
"dialogHWSubject": "Fach",
7575
"dialogHWSubjectValidator": "Wähle oder gib ein gültiges Fach ein!",
7676
"dialogHWSubjectUntisFailure": "Konnte das Fach nicht innerhalb der nächsten Zeit finden!",

lib/l10n/app_en.arb

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -121,13 +121,13 @@
121121
"@untisLoginSuccess": {
122122
"description": "Toast notification, when WebUntis login succeeded"
123123
},
124-
"settingsDiscordRelationsTitle": "Discord relation overview",
124+
"settingsDiscordRelationsTitle": "Discord Channel Links Overview",
125125
"@settingsDiscordRelationsTitle": {
126-
"description": "Title for discord relations management route"
126+
"description": "Title for channel linkage management route"
127127
},
128-
"settingsDiscordRelationsDescription": "Delete, insert or edit the relations between discord channel name and corresponding webhook",
128+
"settingsDiscordRelationsDescription": "Delete, insert or edit the links between discord channel name and corresponding webhook",
129129
"@settingsDiscordRelationsDescription": {
130-
"description": "Description for discord relations management route"
130+
"description": "Description for discord channel linkage management route"
131131
},
132132
"settingsDiscordRelationsBotToken": "Bot Token for message fetching",
133133
"@settingsDiscordRelationsBotToken": {
@@ -147,15 +147,15 @@
147147
},
148148
"settingsDiscordRelationsImportTitle": "Import discord channels",
149149
"@settingsDiscordRelationsImportTitle": {
150-
"description": "Title for discord relations management route"
150+
"description": "Title for discord channel linkage management route"
151151
},
152152
"settingsDiscordRelationsImportDescription": "Import all homework discord channels, using the channel specified above as the identifier. After this, discord channels can be tied to subjects to fetch homework and (with a specified webhook) send homework.",
153153
"@settingsDiscordRelationsImportDescription": {
154154
"description": "Description for discord channel import"
155155
},
156156
"settingsDiscordRelationsImportSuccess": "Imported {count} discord channels",
157157
"@settingsDiscordRelationsImportSuccess": {
158-
"description": "Toast notification, when Discord relation import succeeds",
158+
"description": "Toast notification, when channel import succeeds",
159159
"placeholder": {
160160
"hours": {
161161
"type": "int",
@@ -166,15 +166,15 @@
166166
},
167167
"settingsDiscordRelationsImportFailure": "Could not import channels",
168168
"@settingsDiscordRelationsImportFailure": {
169-
"description": "Toast notification, when Discord relation import fails"
169+
"description": "Toast notification, when Discord channel import fails"
170170
},
171-
"discordRelationsTitle": "Discord relations",
171+
"discordRelationsTitle": "Discord Channel Linkage",
172172
"@discordRelationsTitle": {
173-
"description": "Shows title text of the discord relations route"
173+
"description": "Shows title text of the channel linkage route"
174174
},
175175
"deleteDiscordRelationToast": "Deleted {longName} ({shortName})",
176176
"@deleteDiscordRelationToast": {
177-
"description": "Text popping up from bottom when deleting discord relations",
177+
"description": "Text popping up from bottom when deleting discord channel links",
178178
"placeholders": {
179179
"longName": {
180180
"type": "String",
@@ -188,7 +188,7 @@
188188
},
189189
"deleteDiscordRelationToastUndo": "UNDO",
190190
"@deleteDiscordRelationToastUndo": {
191-
"description": "Button to undo deleting discord relation"
191+
"description": "Button to undo deleting discord channel link"
192192
},
193193
"datePassed": "Passed already since {date}{hours, plural, =0{} other{ at {time}}}",
194194
"@datePassed": {
@@ -315,35 +315,35 @@
315315
"@dateTimeFieldLabel": {
316316
"description": "Completes to e.g Until the 12. of June"
317317
},
318-
"dialogDiscordRelationAddTitle": "Add discord relation",
318+
"dialogDiscordRelationAddTitle": "Link new channel",
319319
"@dialogDiscordRelationAddTitle": {
320-
"description": "Title/tooltip of add relation dialog"
320+
"description": "Title/tooltip of add link dialog"
321321
},
322322
"dialogDiscordRelationAdd": "Add",
323323
"@dialogDiscordRelationAdd": {
324-
"description": "Submit button of add relation dialog"
324+
"description": "Submit button of add link dialog"
325325
},
326326
"dialogDiscordRelationAddCancel": "Cancel",
327327
"@dialogDiscordRelationAddCancel": {
328-
"description": "Cancel button of add relation dialog"
328+
"description": "Cancel button of add link dialog"
329329
},
330-
"dialogDiscordRelationEditTitle": "Edit relation",
330+
"dialogDiscordRelationEditTitle": "Edit channel link",
331331
"@dialogDiscordRelationEditTitle": {
332-
"description": "Title/tooltip of edit relation dialog"
332+
"description": "Title/tooltip of edit link dialog"
333333
},
334334
"dialogDiscordRelationEdit": "Edit",
335335
"@dialogDiscordRelationEdit": {
336-
"description": "Submit button of edit relation dialog"
336+
"description": "Submit button of edit link dialog"
337337
},
338338
"dialogDiscordRelationEditCancel": "Cancel",
339339
"@dialogDiscordRelationEditCancel": {
340-
"description": "Cancel button of edit relation dialog"
340+
"description": "Cancel button of edit link dialog"
341341
},
342342
"dialogDiscordRelationChannelName": "Channel name",
343343
"@dialogDiscordRelationChannelName": {
344344
"description": "The label of the subject's full name entered"
345345
},
346-
"dialogDiscordRelationChannelNameHint": "Klasse12.3",
346+
"dialogDiscordRelationChannelNameHint": "Class12.3",
347347
"@dialogDiscordRelationChannelNameHint": {
348348
"description": "A hint what you can write into relation's channel field"
349349
},
@@ -353,7 +353,7 @@
353353
},
354354
"dialogDiscordRelationUrl": "Webhook url",
355355
"@dialogDiscordRelationUrl": {
356-
"description": "The url of the relation's webhook"
356+
"description": "The url of the link's webhook"
357357
},
358358
"dialogDiscordRelationUrlHint": "https://discord.com/api/webhooks/8689847212939485983/D0dwgzujWHderrIjdIIPOikjdkwwO038jqQIa0dijdWdwDwgfGHxVS0PIUghU0i0auwJ",
359359
"@dialogDiscordRelationUrlHint": {
@@ -403,13 +403,13 @@
403403
"@dialogSubjectShortNameHint": {
404404
"description": "A hint what you can write into subject's short name field"
405405
},
406-
"dialogSubjectChannelName": "Relation channel name",
406+
"dialogSubjectChannelName": "Name of channel (link)",
407407
"@dialogSubjectChannelName": {
408-
"description": "The label of the subject's relation channel name"
408+
"description": "The label of the subject's discord channel name accordinig to channel links"
409409
},
410-
"dialogSubjectChannelNameHint": "Select discord relation",
410+
"dialogSubjectChannelNameHint": "Select channel link",
411411
"@dialogSubjectChannelNameHint": {
412-
"description": "A hint that you should use the dropdown for discord relations"
412+
"description": "A hint that you should use the dropdown for discord channel links"
413413
},
414414
"dialogHWSubject": "Subject",
415415
"@dialogHWSubject": {

0 commit comments

Comments
 (0)