@@ -16,6 +16,7 @@ import 'package:dipantau_desktop_client/feature/data/model/track_task/track_task
1616import 'package:dipantau_desktop_client/feature/data/model/track_user_lite/track_user_lite_response.dart' ;
1717import 'package:dipantau_desktop_client/feature/database/app_database.dart' ;
1818import 'package:dipantau_desktop_client/feature/database/entity/track/track.dart' ;
19+ import 'package:dipantau_desktop_client/feature/presentation/bloc/cron_tracking/cron_tracking_bloc.dart' ;
1920import 'package:dipantau_desktop_client/feature/presentation/bloc/home/home_bloc.dart' ;
2021import 'package:dipantau_desktop_client/feature/presentation/bloc/tracking/tracking_bloc.dart' ;
2122import 'package:dipantau_desktop_client/feature/presentation/bloc/user_profile/user_profile_bloc.dart' ;
@@ -54,6 +55,7 @@ class _HomePageState extends State<HomePage> with TrayListener, WindowListener {
5455 final homeBloc = sl <HomeBloc >();
5556 final trackingBloc = sl <TrackingBloc >();
5657 final userProfileBloc = sl <UserProfileBloc >();
58+ final cronTrackingBloc = sl <CronTrackingBloc >();
5759 final helper = sl <Helper >();
5860 final listTrackTask = < TrackTask > [];
5961 final widgetHelper = WidgetHelper ();
@@ -308,8 +310,8 @@ class _HomePageState extends State<HomePage> with TrayListener, WindowListener {
308310 bodyImage = BulkCreateTrackImageBody (files: files);
309311 }
310312 }
311- trackingBloc .add (
312- CronTrackingEvent (
313+ cronTrackingBloc .add (
314+ RunCronTrackingEvent (
313315 bodyData: bodyData,
314316 bodyImage: bodyImage,
315317 ),
@@ -362,7 +364,10 @@ class _HomePageState extends State<HomePage> with TrayListener, WindowListener {
362364 ),
363365 BlocProvider <UserProfileBloc >(
364366 create: (context) => userProfileBloc,
365- )
367+ ),
368+ BlocProvider <CronTrackingBloc >(
369+ create: (context) => cronTrackingBloc,
370+ ),
366371 ],
367372 child: MultiBlocListener (
368373 listeners: [
@@ -437,19 +442,6 @@ class _HomePageState extends State<HomePage> with TrayListener, WindowListener {
437442 }
438443 final trackEntityId = state.trackEntityId;
439444 trackDao.deleteTrackById (trackEntityId);
440- } else if (state is SuccessCronTrackingState ) {
441- // TODO: tampilkan info last sync at: 22:09 04 Jul 2023
442- // TODO: info ini akan ditampilkan dibagian paling bawah sama seperti tampilan hubstaff
443- final ids = state.ids;
444- final files = state.files;
445- trackDao.deleteMultipleTrackByIds (ids).then ((value) {
446- for (final itemFile in files) {
447- final file = File (itemFile);
448- if (file.existsSync ()) {
449- file.deleteSync ();
450- }
451- }
452- });
453445 }
454446 },
455447 ),
@@ -470,6 +462,24 @@ class _HomePageState extends State<HomePage> with TrayListener, WindowListener {
470462 }
471463 },
472464 ),
465+ BlocListener <CronTrackingBloc , CronTrackingState >(
466+ listener: (context, state) {
467+ if (state is SuccessRunCronTrackingState ) {
468+ // TODO: tampilkan info last sync at: 22:09 04 Jul 2023
469+ // TODO: info ini akan ditampilkan dibagian paling bawah sama seperti tampilan hubstaff
470+ final ids = state.ids;
471+ final files = state.files;
472+ trackDao.deleteMultipleTrackByIds (ids).then ((value) {
473+ for (final itemFile in files) {
474+ final file = File (itemFile);
475+ if (file.existsSync ()) {
476+ file.deleteSync ();
477+ }
478+ }
479+ });
480+ }
481+ },
482+ ),
473483 ],
474484 child: SizedBox (
475485 width: double .infinity,
0 commit comments