Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
ginkgo
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
vjrj
ginkgo
Commits
262efcea
Commit
262efcea
authored
1 year ago
by
vjrj
Browse files
Options
Downloads
Patches
Plain Diff
Improve notification. Use cron instead of once
parent
5afb7895
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
lib/data/models/transaction_cubit.dart
+1
-1
1 addition, 1 deletion
lib/data/models/transaction_cubit.dart
lib/main.dart
+17
-15
17 additions, 15 deletions
lib/main.dart
pubspec.lock
+8
-0
8 additions, 0 deletions
pubspec.lock
pubspec.yaml
+1
-0
1 addition, 0 deletions
pubspec.yaml
with
27 additions
and
16 deletions
lib/data/models/transaction_cubit.dart
+
1
−
1
View file @
262efcea
...
...
@@ -68,7 +68,7 @@ class TransactionsCubit extends HydratedCubit<TransactionsAndBalanceState> {
final
Contact
to
=
await
ContactsCache
()
.
getContact
(
tx
.
from
);
NotificationController
.
createNewNotification
(
tx
.
time
.
millisecondsSinceEpoch
.
toString
(),
amount:
tx
.
amount
/
100
,
amount:
-
tx
.
amount
/
100
,
to:
to
.
title
);
emit
(
newState
.
copyWith
(
lastSentNotification:
tx
.
time
));
}
...
...
This diff is collapsed.
Click to expand it.
lib/main.dart
+
17
−
15
View file @
262efcea
import
'dart:io'
;
import
'package:connectivity_wrapper/connectivity_wrapper.dart'
;
import
'package:cron/cron.dart'
;
import
'package:easy_localization/easy_localization.dart'
;
import
'package:filesystem_picker/filesystem_picker.dart'
;
import
'package:flutter/foundation.dart'
;
...
...
@@ -276,6 +277,22 @@ class _GinkgoAppState extends State<GinkgoApp> {
NodeManager
()
.
loadFromCubit
(
context
.
read
<
NodeListCubit
>());
// Only after at least the action method is set, the notification events are delivered
NotificationController
.
startListeningNotificationEvents
();
final
Cron
cron
=
Cron
();
cron
.
schedule
(
Schedule
.
parse
(
kReleaseMode
?
'*/10 * * * *'
:
'*/2 * * * *'
),
()
async
{
logger
(
'---------- fetchTransactions via cron'
);
fetchTransactions
(
context
);
});
Once
.
runHourly
(
'load_nodes'
,
callback:
()
{
logger
(
'load nodes via once'
);
_loadNodes
();
},
fallback:
()
{
_printNodeStatus
(
prefix:
'After once hourly having'
);
});
Once
.
runDaily
(
'clear_errors'
,
callback:
()
{
logger
(
'clearErrors via once'
);
NodeManager
()
.
cleanErrorStats
();
});
}
@override
...
...
@@ -288,21 +305,6 @@ class _GinkgoAppState extends State<GinkgoApp> {
Widget
build
(
BuildContext
context
)
{
return
BlocBuilder
<
NodeListCubit
,
NodeListState
>(
builder:
(
BuildContext
nodeContext
,
NodeListState
state
)
{
Once
.
runHourly
(
'load_nodes'
,
callback:
()
=
>
_loadNodes
(),
fallback:
()
{
_printNodeStatus
(
prefix:
'After once hourly having'
);
});
Once
.
runCustom
(
'clear_errors'
,
callback:
()
{
NodeManager
()
.
cleanErrorStats
();
},
duration:
const
Duration
(
minutes:
90
));
Once
.
runCustom
(
'fetch_transactions'
,
callback:
()
{
logger
(
'---------- fetchTransactions via once'
);
fetchTransactions
(
context
);
},
fallback:
()
{
logger
(
'fetch_transactions fallback, already called'
);
},
duration:
const
Duration
(
minutes:
kReleaseMode
?
10
:
2
));
// Not necessary with previous one ?? fetchTransactions(context);
return
ConnectivityAppWrapper
(
app:
FilesystemPickerDefaultOptions
(
fileTileSelectMode:
FileTileSelectMode
.
wholeTile
,
...
...
This diff is collapsed.
Click to expand it.
pubspec.lock
+
8
−
0
View file @
262efcea
...
...
@@ -273,6 +273,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "5.0.2"
cron:
dependency: "direct main"
description:
name: cron
sha256: d98aa8cdad0cccdb6b098e6a1fb89339c180d8a229145fa4cd8c6fc538f0e35f
url: "https://pub.dev"
source: hosted
version: "0.5.1"
cross_file:
dependency: transitive
description:
...
...
This diff is collapsed.
Click to expand it.
pubspec.yaml
+
1
−
0
View file @
262efcea
...
...
@@ -72,6 +72,7 @@ dependencies:
path
:
^1.8.2
path_provider
:
^2.0.14
awesome_notifications
:
^0.7.4+1
cron
:
^0.5.1
dev_dependencies
:
flutter_test
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment