Added google play testing accounts and testing environment
This commit is contained in:
76
lib/model/timetable/endpointData.dart
Normal file
76
lib/model/timetable/endpointData.dart
Normal file
@ -0,0 +1,76 @@
|
||||
|
||||
import '../accountData.dart';
|
||||
|
||||
enum EndpointMode {
|
||||
live,
|
||||
stage,
|
||||
}
|
||||
|
||||
class EndpointOptions {
|
||||
Endpoint live;
|
||||
Endpoint? staged;
|
||||
EndpointOptions({required this.live, required this.staged});
|
||||
|
||||
Endpoint get(EndpointMode mode) {
|
||||
if(staged == null || mode == EndpointMode.live) return live;
|
||||
return staged!;
|
||||
}
|
||||
}
|
||||
|
||||
class Endpoint {
|
||||
String domain;
|
||||
String path;
|
||||
|
||||
Endpoint({required this.domain, this.path = ""});
|
||||
|
||||
String full() {
|
||||
return domain + path;
|
||||
}
|
||||
}
|
||||
|
||||
class EndpointData {
|
||||
static final EndpointData _instance = EndpointData._construct();
|
||||
|
||||
String? usernameOverride;
|
||||
|
||||
factory EndpointData() {
|
||||
return _instance;
|
||||
}
|
||||
|
||||
EndpointData._construct();
|
||||
|
||||
EndpointMode getEndpointMode() {
|
||||
late String existingName;
|
||||
if(usernameOverride != null) {
|
||||
existingName = usernameOverride!;
|
||||
} else {
|
||||
existingName = AccountData().getUsername();
|
||||
}
|
||||
return existingName.startsWith("google") ? EndpointMode.stage : EndpointMode.live;
|
||||
}
|
||||
|
||||
Endpoint webuntis() {
|
||||
return EndpointOptions(
|
||||
live: Endpoint(
|
||||
domain: "peleus.webuntis.com",
|
||||
),
|
||||
staged: Endpoint(
|
||||
domain: "mhsl.eu",
|
||||
path: "/marianum/marianummobile/webuntis/public/index.php/api"
|
||||
),
|
||||
).get(getEndpointMode());
|
||||
}
|
||||
|
||||
Endpoint nextcloud() {
|
||||
return EndpointOptions(
|
||||
live: Endpoint(
|
||||
domain: "cloud.marianum-fulda.de",
|
||||
),
|
||||
staged: Endpoint(
|
||||
domain: "mhsl.eu",
|
||||
path: "/marianum/marianummobile/cloud",
|
||||
)
|
||||
).get(getEndpointMode());
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user