43 lines
943 B
Dart
43 lines
943 B
Dart
|
import 'dart:convert';
|
||
|
|
||
|
import 'api.dart';
|
||
|
|
||
|
class InitialData {
|
||
|
bool darkMode;
|
||
|
bool password;
|
||
|
String mediacenterName;
|
||
|
String videoPath;
|
||
|
String tvShowPath;
|
||
|
bool tvShowEnabled;
|
||
|
bool fullDeleteEnabled;
|
||
|
|
||
|
InitialData(
|
||
|
this.darkMode,
|
||
|
this.password,
|
||
|
this.mediacenterName,
|
||
|
this.videoPath,
|
||
|
this.tvShowPath,
|
||
|
this.tvShowEnabled,
|
||
|
this.fullDeleteEnabled);
|
||
|
|
||
|
factory InitialData.fromJson(dynamic json) {
|
||
|
return InitialData(
|
||
|
json['DarkMode'] as bool,
|
||
|
json['Pasword'] as bool,
|
||
|
json['MediacenterName'] as String,
|
||
|
json['VideoPath'] as String,
|
||
|
json['TVShowPath'] as String,
|
||
|
json['TVShowEnabled'] as bool,
|
||
|
json['FullDeleteEnabled'] as bool,
|
||
|
);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
Future<InitialData> loadInitialData() async {
|
||
|
final data = await API.query("settings", "loadInitialData", {});
|
||
|
|
||
|
final d = jsonDecode(data);
|
||
|
final video = InitialData.fromJson(d);
|
||
|
return video;
|
||
|
}
|