claude refactorings, flutter best practices, platform dependent changes, general cleanup
This commit is contained in:
+3
-3
@@ -2,14 +2,14 @@ import 'dart:convert';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:http/http.dart';
|
||||
|
||||
import '../../mhslApi.dart';
|
||||
import 'getBreakersResponse.dart';
|
||||
import '../../mhsl_api.dart';
|
||||
import 'get_breakers_response.dart';
|
||||
|
||||
class GetBreakers extends MhslApi<GetBreakersResponse> {
|
||||
GetBreakers() : super('breaker/');
|
||||
|
||||
@override
|
||||
GetBreakersResponse assemble(String raw) => GetBreakersResponse.fromJson(jsonDecode(raw));
|
||||
GetBreakersResponse assemble(String raw) => GetBreakersResponse.fromJson(jsonDecode(raw) as Map<String, dynamic>);
|
||||
|
||||
@override
|
||||
Future<Response>? request(Uri uri) => http.get(uri);
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
import '../../../requestCache.dart';
|
||||
import 'getBreakers.dart';
|
||||
import 'getBreakersResponse.dart';
|
||||
import '../../../request_cache.dart';
|
||||
import 'get_breakers.dart';
|
||||
import 'get_breakers_response.dart';
|
||||
|
||||
class GetBreakersCache extends SimpleCache<GetBreakersResponse> {
|
||||
GetBreakersCache({super.onUpdate, super.renew})
|
||||
+2
-2
@@ -1,9 +1,9 @@
|
||||
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
import '../../../apiResponse.dart';
|
||||
import '../../../api_response.dart';
|
||||
|
||||
part 'getBreakersResponse.g.dart';
|
||||
part 'get_breakers_response.g.dart';
|
||||
|
||||
@JsonSerializable(explicitToJson: true)
|
||||
class GetBreakersResponse extends ApiResponse {
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'getBreakersResponse.dart';
|
||||
part of 'get_breakers_response.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
+2
-2
@@ -3,8 +3,8 @@ import 'dart:convert';
|
||||
import 'package:http/http.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
|
||||
import '../../mhslApi.dart';
|
||||
import 'addCustomTimetableEventParams.dart';
|
||||
import '../../mhsl_api.dart';
|
||||
import 'add_custom_timetable_event_params.dart';
|
||||
|
||||
class AddCustomTimetableEvent extends MhslApi<void> {
|
||||
AddCustomTimetableEventParams params;
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
import '../customTimetableEvent.dart';
|
||||
import '../custom_timetable_event.dart';
|
||||
|
||||
part 'addCustomTimetableEventParams.g.dart';
|
||||
part 'add_custom_timetable_event_params.g.dart';
|
||||
|
||||
@JsonSerializable(explicitToJson: true)
|
||||
class AddCustomTimetableEventParams {
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'addCustomTimetableEventParams.dart';
|
||||
part of 'add_custom_timetable_event_params.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
import '../mhslApi.dart';
|
||||
import '../mhsl_api.dart';
|
||||
|
||||
part 'customTimetableEvent.g.dart';
|
||||
part 'custom_timetable_event.g.dart';
|
||||
|
||||
@JsonSerializable()
|
||||
class CustomTimetableEvent {
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'customTimetableEvent.dart';
|
||||
part of 'custom_timetable_event.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
+3
-3
@@ -3,9 +3,9 @@ import 'dart:convert';
|
||||
import 'package:http/http.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
|
||||
import '../../mhslApi.dart';
|
||||
import 'getCustomTimetableEventParams.dart';
|
||||
import 'getCustomTimetableEventResponse.dart';
|
||||
import '../../mhsl_api.dart';
|
||||
import 'get_custom_timetable_event_params.dart';
|
||||
import 'get_custom_timetable_event_response.dart';
|
||||
|
||||
class GetCustomTimetableEvent extends MhslApi<GetCustomTimetableEventResponse> {
|
||||
GetCustomTimetableEventParams params;
|
||||
+4
-4
@@ -1,7 +1,7 @@
|
||||
import '../../../requestCache.dart';
|
||||
import 'getCustomTimetableEvent.dart';
|
||||
import 'getCustomTimetableEventParams.dart';
|
||||
import 'getCustomTimetableEventResponse.dart';
|
||||
import '../../../request_cache.dart';
|
||||
import 'get_custom_timetable_event.dart';
|
||||
import 'get_custom_timetable_event_params.dart';
|
||||
import 'get_custom_timetable_event_response.dart';
|
||||
|
||||
class GetCustomTimetableEventCache extends SimpleCache<GetCustomTimetableEventResponse> {
|
||||
GetCustomTimetableEventCache(
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
part 'getCustomTimetableEventParams.g.dart';
|
||||
part 'get_custom_timetable_event_params.g.dart';
|
||||
|
||||
@JsonSerializable()
|
||||
class GetCustomTimetableEventParams {
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'getCustomTimetableEventParams.dart';
|
||||
part of 'get_custom_timetable_event_params.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
+3
-3
@@ -1,9 +1,9 @@
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
import '../../../apiResponse.dart';
|
||||
import '../customTimetableEvent.dart';
|
||||
import '../../../api_response.dart';
|
||||
import '../custom_timetable_event.dart';
|
||||
|
||||
part 'getCustomTimetableEventResponse.g.dart';
|
||||
part 'get_custom_timetable_event_response.g.dart';
|
||||
|
||||
@JsonSerializable()
|
||||
class GetCustomTimetableEventResponse extends ApiResponse {
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'getCustomTimetableEventResponse.dart';
|
||||
part of 'get_custom_timetable_event_response.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
+2
-2
@@ -3,8 +3,8 @@ import 'dart:convert';
|
||||
import 'package:http/http.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
|
||||
import '../../mhslApi.dart';
|
||||
import 'removeCustomTimetableEventParams.dart';
|
||||
import '../../mhsl_api.dart';
|
||||
import 'remove_custom_timetable_event_params.dart';
|
||||
|
||||
class RemoveCustomTimetableEvent extends MhslApi<void> {
|
||||
RemoveCustomTimetableEventParams params;
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
part 'removeCustomTimetableEventParams.g.dart';
|
||||
part 'remove_custom_timetable_event_params.g.dart';
|
||||
|
||||
@JsonSerializable()
|
||||
class RemoveCustomTimetableEventParams {
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'removeCustomTimetableEventParams.dart';
|
||||
part of 'remove_custom_timetable_event_params.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
+2
-2
@@ -3,8 +3,8 @@ import 'dart:convert';
|
||||
import 'package:http/http.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
|
||||
import '../../mhslApi.dart';
|
||||
import 'updateCustomTimetableEventParams.dart';
|
||||
import '../../mhsl_api.dart';
|
||||
import 'update_custom_timetable_event_params.dart';
|
||||
|
||||
class UpdateCustomTimetableEvent extends MhslApi<void> {
|
||||
UpdateCustomTimetableEventParams params;
|
||||
+2
-2
@@ -1,9 +1,9 @@
|
||||
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
import '../customTimetableEvent.dart';
|
||||
import '../custom_timetable_event.dart';
|
||||
|
||||
part 'updateCustomTimetableEventParams.g.dart';
|
||||
part 'update_custom_timetable_event_params.g.dart';
|
||||
|
||||
@JsonSerializable(explicitToJson: true)
|
||||
class UpdateCustomTimetableEventParams {
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'updateCustomTimetableEventParams.dart';
|
||||
part of 'update_custom_timetable_event_params.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
@@ -5,7 +5,7 @@ import 'dart:io';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:jiffy/jiffy.dart';
|
||||
|
||||
import '../apiRequest.dart';
|
||||
import '../api_request.dart';
|
||||
import '../errors/network_exception.dart';
|
||||
import '../errors/parse_exception.dart';
|
||||
import '../errors/server_exception.dart';
|
||||
+2
-2
@@ -4,8 +4,8 @@ import 'dart:developer';
|
||||
|
||||
import 'package:http/http.dart' as http;
|
||||
|
||||
import '../../mhslApi.dart';
|
||||
import 'notifyRegisterParams.dart';
|
||||
import '../../mhsl_api.dart';
|
||||
import 'notify_register_params.dart';
|
||||
|
||||
class NotifyRegister extends MhslApi<void> {
|
||||
NotifyRegisterParams params;
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
part 'notifyRegisterParams.g.dart';
|
||||
part 'notify_register_params.g.dart';
|
||||
|
||||
@JsonSerializable()
|
||||
class NotifyRegisterParams {
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'notifyRegisterParams.dart';
|
||||
part of 'notify_register_params.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
+2
-2
@@ -3,8 +3,8 @@ import 'dart:convert';
|
||||
import 'package:http/http.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
|
||||
import '../../mhslApi.dart';
|
||||
import 'addFeedbackParams.dart';
|
||||
import '../../mhsl_api.dart';
|
||||
import 'add_feedback_params.dart';
|
||||
|
||||
|
||||
class AddFeedback extends MhslApi<void> {
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
part 'addFeedbackParams.g.dart';
|
||||
part 'add_feedback_params.g.dart';
|
||||
|
||||
@JsonSerializable()
|
||||
class AddFeedbackParams {
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'addFeedbackParams.dart';
|
||||
part of 'add_feedback_params.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
part 'updateUserIndexParams.g.dart';
|
||||
part 'update_user_index_params.g.dart';
|
||||
|
||||
@JsonSerializable()
|
||||
class UpdateUserIndexParams {
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'updateUserIndexParams.dart';
|
||||
part of 'update_user_index_params.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
+5
-4
@@ -1,4 +1,5 @@
|
||||
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'dart:developer';
|
||||
|
||||
@@ -7,8 +8,8 @@ import 'package:http/http.dart' as http;
|
||||
import 'package:package_info_plus/package_info_plus.dart';
|
||||
|
||||
import '../../../../../model/account_data.dart';
|
||||
import '../../../mhslApi.dart';
|
||||
import 'updateUserIndexParams.dart';
|
||||
import '../../../mhsl_api.dart';
|
||||
import 'update_user_index_params.dart';
|
||||
|
||||
class UpdateUserIndex extends MhslApi<void> {
|
||||
UpdateUserIndexParams params;
|
||||
@@ -25,7 +26,7 @@ class UpdateUserIndex extends MhslApi<void> {
|
||||
}
|
||||
|
||||
static Future<void> index() async {
|
||||
UpdateUserIndex(
|
||||
unawaited(UpdateUserIndex(
|
||||
UpdateUserIndexParams(
|
||||
username: AccountData().getUsername(),
|
||||
user: AccountData().getUserSecret(),
|
||||
@@ -33,6 +34,6 @@ class UpdateUserIndex extends MhslApi<void> {
|
||||
appVersion: int.parse((await PackageInfo.fromPlatform()).buildNumber),
|
||||
deviceInfo: jsonEncode((await DeviceInfoPlugin().deviceInfo).data).toString(),
|
||||
),
|
||||
).run();
|
||||
).run());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user