Skip to content

Commit 58897aa

Browse files
committed
update api files for manage code.
1 parent 5da2a53 commit 58897aa

File tree

3 files changed

+0
-124
lines changed

3 files changed

+0
-124
lines changed

lib/Api/auth_api.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,6 @@ class AuthApi {
119119
BlocProvider.of<UserDetailBloc>(context, listen: false)
120120
.add(SetUsersListEvent(usersList: usersList));
121121
print('---USERS LIST---');
122-
print(response);
123122
}
124123
} catch (error) {
125124
print('--ERROR IN GET USER LIST--');

lib/Api/client_api.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ class ClientApi {
3434
BlocProvider.of<ClientSettingsBloc>(context, listen: false)
3535
.add(SetClientSettingsEvent(clientSettings: clientSetting));
3636
print('---CLIENT SETTINGS---');
37-
print(response);
3837
}
3938
} catch (error) {
4039
print('--ERROR IN GET CLIENT SETTINGS--');

lib/Api/event_handler_api.dart

Lines changed: 0 additions & 122 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,12 @@
11
import 'dart:collection';
22
import 'dart:convert';
3-
import 'dart:io';
4-
import 'package:awesome_notifications/awesome_notifications.dart';
5-
import 'package:battery_plus/battery_plus.dart';
6-
import 'package:duration/duration.dart';
73
import 'package:flutter/cupertino.dart';
8-
import 'package:flutter/services.dart';
94
import 'package:flutter_bloc/flutter_bloc.dart';
105
import 'package:flutter_client_sse/flutter_client_sse.dart';
116
import 'package:json_patch/json_patch.dart';
127
import 'package:wifi_iot/wifi_iot.dart';
13-
import 'package:flood_mobile/Api/torrent_api.dart';
148
import 'package:flood_mobile/Blocs/filter_torrent_bloc/filter_torrent_bloc.dart';
159
import 'package:flood_mobile/Blocs/home_screen_bloc/home_screen_bloc.dart';
16-
import 'package:flood_mobile/Blocs/power_management_bloc/power_management_bloc.dart';
17-
import 'package:flood_mobile/Constants/notification_keys.dart';
1810
import 'package:flood_mobile/Model/download_rate_model.dart';
1911
import 'package:flood_mobile/Model/torrent_model.dart';
2012
import 'package:flood_mobile/Services/file_size_helper.dart';
@@ -128,120 +120,6 @@ class EventHandlerApi {
128120
//Setting the full list of torrent
129121
BlocProvider.of<HomeScreenBloc>(context, listen: false)
130122
.add(SetTorrentListEvent(newTorrentList: torrentList));
131-
132-
final PowerManagementBloc powerManagementBloc =
133-
BlocProvider.of<PowerManagementBloc>(context, listen: false);
134-
//Exit screen on all download finished
135-
if (powerManagementBloc.state.shutDownWhenFinishDownload &&
136-
isAllDownloadFinished(context)) {
137-
SystemChannels.platform.invokeMethod('SystemNavigator.pop');
138-
exit(0);
139-
}
140-
141-
//Turn off wifi on all download finished
142-
if (powerManagementBloc.state.shutDownWifi &&
143-
isAllDownloadFinished(context)) {
144-
turnOffWiFi(powerManagementBloc.state.shutDownWifi);
145-
}
146-
147-
// Stop all download on low battery
148-
Battery _battery = Battery();
149-
int currentBatteryLevel = await _battery.batteryLevel;
150-
bool isBatteryLimitSet =
151-
powerManagementBloc.state.batteryLimitLevel > 0 ? true : false;
152-
if (isBatteryLimitSet &&
153-
currentBatteryLevel <= powerManagementBloc.state.batteryLimitLevel) {
154-
BlocProvider.of<HomeScreenBloc>(context, listen: false)
155-
.state
156-
.torrentList
157-
.forEach((element) {
158-
if (element.status.contains('downloading')) {
159-
TorrentApi.stopTorrent(hashes: [element.hash], context: context);
160-
}
161-
});
162-
}
163-
}
164-
165-
static Future<void> showNotification(int id, BuildContext context) async {
166-
late bool displayNotification;
167-
late bool isPaused;
168-
isPaused = true;
169-
HomeScreenState homeModel =
170-
BlocProvider.of<HomeScreenBloc>(context, listen: false).state;
171-
172-
// Skip finished torrents
173-
if (homeModel.torrentList[id].status.contains('complete')) {
174-
displayNotification = false;
175-
} else {
176-
displayNotification = true;
177-
}
178-
179-
// Torrent not being downloaded
180-
if (homeModel.torrentList[id].status.contains('downloading')) {
181-
// Change to the 'RESUME' action
182-
isPaused = false;
183-
}
184-
185-
// Torrent Paused
186-
else {
187-
isPaused = true;
188-
}
189-
190-
// Create notification for unfinished downloads
191-
if (displayNotification) {
192-
AwesomeNotifications().createNotification(
193-
content: NotificationContent(
194-
id: id,
195-
actionType: ActionType.Default,
196-
channelKey: NotificationConstants.DOWNLOADS_CHANNEL_KEY,
197-
category: NotificationCategory.Progress,
198-
notificationLayout: NotificationLayout.ProgressBar,
199-
title: homeModel.torrentList[id].name,
200-
body: isPaused
201-
? "Stopped ETA: ∞"
202-
: "Downloading ETA: " +
203-
prettyDuration(
204-
Duration(
205-
seconds: homeModel.torrentList[id].eta.toInt(),
206-
),
207-
abbreviated: true,
208-
),
209-
progress: homeModel.torrentList[id].percentComplete.round(),
210-
summary: isPaused ? 'Paused' : 'Downloading',
211-
locked: true,
212-
autoDismissible: false,
213-
showWhen: false,
214-
),
215-
actionButtons: [
216-
NotificationActionButton(
217-
key: isPaused
218-
? NotificationConstants.RESUME_ACTION_KEY
219-
: NotificationConstants.PAUSE_ACTION_KEY,
220-
label: isPaused ? 'Resume' : 'Pause',
221-
actionType: ActionType.KeepOnTop,
222-
enabled: true,
223-
autoDismissible: false,
224-
),
225-
],
226-
);
227-
}
228-
}
229-
230-
static Future<void> showEventNotification(
231-
int id, BuildContext context) async {
232-
AwesomeNotifications().createNotification(
233-
content: NotificationContent(
234-
id: id,
235-
autoDismissible: false,
236-
channelKey: NotificationConstants.PUSH_NOTIFICATION_CHANNEL_KEY,
237-
category: NotificationCategory.Event,
238-
notificationLayout: NotificationLayout.Default,
239-
title: BlocProvider.of<HomeScreenBloc>(context, listen: false)
240-
.state
241-
.torrentList[id]
242-
.name,
243-
body: "Download Finished",
244-
));
245123
}
246124

247125
static Future<void> filterDataRephrasor(

0 commit comments

Comments
 (0)