user agent shit again

This commit is contained in:
Kima 2023-09-17 14:10:22 +02:00
parent f985889811
commit 5c6e54864d

View File

@ -3,18 +3,22 @@ import 'dart:io';
class Config {
String _userAgent;
Map? json;
static const String _version = String.fromEnvironment("APPVER", defaultValue: "2.2.0");
static const String _version =
String.fromEnvironment("APPVER", defaultValue: "3.0.4");
Config({required String userAgent, this.json}) : _userAgent = userAgent;
factory Config.fromJson(Map json) {
return Config(
userAgent: json["user_agent"] ?? "hu.refilc.naplo/\$0/\$1/\$2",
userAgent: json["user_agent"] ?? "hu.ekreta.student/\$0/\$1/\$2",
json: json,
);
}
String get userAgent => _userAgent.replaceAll("\$0", _version).replaceAll("\$1", platform).replaceAll("\$2", "0");
String get userAgent => _userAgent
.replaceAll("\$0", _version)
.replaceAll("\$1", platform)
.replaceAll("\$2", "0");
static String get platform {
if (Platform.isAndroid) {