-
Notifications
You must be signed in to change notification settings - Fork 5
Add Grace Period Contracts check service #1028
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
zaelgohary
wants to merge
13
commits into
development
Choose a base branch
from
development_grace_period_contracts
base: development
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
cc43b89
Add notifications screen
zaelgohary 92b3f63
Add loading state, edit icon, refactor checkNodeStatus
zaelgohary b6e6263
Replace node status notification logic to notifications user data
zaelgohary 6da1244
Ignore reflectable files, remove print
zaelgohary 4310c8b
Add contract check service
zaelgohary 20ee532
Add contracts check service, edit main.dart to call backgroundFetchHe…
zaelgohary c206c4a
Merge branch 'development' of https://github.com/threefoldtech/threef…
zaelgohary 4026d05
Remove test btn
zaelgohary 239c899
Revert registered screen change
zaelgohary 996712e
Fix analyze workflow
zaelgohary a63d95d
Fix automatic dialog dismissal
zaelgohary 1f25f57
Merge branch 'development' of https://github.com/threefoldtech/threef…
zaelgohary e1ed692
Add notification screen, fix layout issues, edit show dialogue to han…
zaelgohary File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| import 'package:flutter_riverpod/flutter_riverpod.dart'; | ||
| import 'package:gridproxy_client/models/contracts.dart'; | ||
| import 'package:threebotlogin/helpers/logger.dart'; | ||
| import 'package:threebotlogin/models/wallet.dart'; | ||
| import 'package:threebotlogin/providers/wallets_provider.dart'; | ||
| import 'package:threebotlogin/services/gridproxy_service.dart'; | ||
| import 'package:threebotlogin/services/tfchain_service.dart'; | ||
|
|
||
| final contractCheckServiceProvider = Provider<ContractCheckService>((ref) { | ||
| return ContractCheckService(ref); | ||
| }); | ||
|
|
||
| class ContractCheckService { | ||
| final Ref _ref; | ||
|
|
||
| ContractCheckService(this._ref); | ||
|
|
||
| Future<List<ContractInfo>> checkContractsState() async { | ||
| List<ContractInfo> allContracts = []; | ||
|
|
||
| try { | ||
| final walletsNotifierInstance = _ref.read(walletsNotifier.notifier); | ||
| await walletsNotifierInstance.waitUntilListed(); | ||
|
|
||
| final List<Wallet> wallets = _ref.read(walletsNotifier); | ||
| if (wallets.isEmpty) return []; | ||
|
|
||
| for (final w in wallets) { | ||
| final twinId = await getTwinId(w.tfchainSecret); | ||
| if (twinId != 0) { | ||
| List<ContractInfo> contracts = | ||
| await getGracePeriodContractsByTwinId(twinId); | ||
| allContracts.addAll(contracts); | ||
| } | ||
| } | ||
| return allContracts; | ||
| } catch (e) { | ||
| logger.e('[ContractCheckService] Error checking contract state: $e'); | ||
| return []; | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Surely can be done but there's a contract page where users can check all their contracts details. Maybe we can refer to the contracts page but after its PR is merged? Or redirect to the contract details page on notification click?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good idae
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I opened the issue below. If all works well, we can approve this PR.