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
f2b58e75
Commit
f2b58e75
authored
6 months ago
by
vjrj
Browse files
Options
Downloads
Patches
Plain Diff
Added v2 methods
parent
b58a9fea
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/ui/widgets/first_screen/contact_search_page.dart
+15
-3
15 additions, 3 deletions
lib/ui/widgets/first_screen/contact_search_page.dart
lib/ui/widgets/first_screen/pay_contact_search_button.dart
+1
-1
1 addition, 1 deletion
lib/ui/widgets/first_screen/pay_contact_search_button.dart
with
16 additions
and
4 deletions
lib/ui/widgets/first_screen/contact_search_page.dart
+
15
−
3
View file @
f2b58e75
...
...
@@ -10,6 +10,7 @@ import 'package:flutter_bloc/flutter_bloc.dart';
import
'package:flutter_nfc_kit/flutter_nfc_kit.dart'
;
import
'package:http/http.dart'
;
import
'../../../data/models/app_cubit.dart'
;
import
'../../../data/models/contact.dart'
;
import
'../../../data/models/contact_cubit.dart'
;
import
'../../../data/models/contact_state.dart'
;
...
...
@@ -50,6 +51,7 @@ class _ContactSearchPageState extends State<ContactSearchPage> {
final
FocusNode
_searchFocusNode
=
FocusNode
();
String
_searchTerm
=
''
;
String
_previousSearchTerm
=
''
;
late
bool
isV2
;
List
<
Contact
>
_results
=
<
Contact
>[];
bool
_isLoading
=
false
;
...
...
@@ -58,6 +60,7 @@ class _ContactSearchPageState extends State<ContactSearchPage> {
Future
<
void
>
_search
()
async
{
final
ContactsCubit
contactsCubit
=
context
.
read
<
ContactsCubit
>();
if
(
_searchTerm
.
length
<
3
)
{
ScaffoldMessenger
.
of
(
context
)
.
showSnackBar
(
SnackBar
(
content:
Text
(
tr
(
'search_limitation'
))),
...
...
@@ -89,7 +92,7 @@ class _ContactSearchPageState extends State<ContactSearchPage> {
}
});
if
(
isConnected
)
{
if
(
isConnected
&&
!
isV2
)
{
final
Response
cPlusResponse
=
await
searchCPlusUser
(
_searchTerm
);
if
(
cPlusResponse
.
statusCode
!=
404
)
{
// Add cplus users
...
...
@@ -111,9 +114,12 @@ class _ContactSearchPageState extends State<ContactSearchPage> {
}
if
(
isConnected
)
{
if
(
_searchTerm
.
length
>
=
8
)
{
if
(
_searchTerm
.
length
>
=
3
)
{
// Only search wot if it's a long key
final
List
<
Contact
>
wotResults
=
await
searchWotV1
(
_searchTerm
);
final
List
<
Contact
>
wotResults
=
isV2
?
await
searchWotV2
(
'.*
$_searchTerm
.*'
)
:
await
searchWotV1
(
_searchTerm
);
// ignore: prefer_foreach
for
(
final
Contact
c
in
wotResults
)
{
ContactsCache
()
.
addContact
(
c
);
...
...
@@ -455,6 +461,10 @@ class _ContactSearchPageState extends State<ContactSearchPage> {
});
_handleUri
(
widget
.
uri
);
_isMultiSelect
=
widget
.
startInMultiSelect
;
final
PaymentCubit
paymentCubit
=
context
.
read
<
PaymentCubit
>();
_selectedContacts
.
addAll
(
paymentCubit
.
contacts
);
_results
.
addAll
(
paymentCubit
.
contacts
);
isV2
=
context
.
read
<
AppCubit
>()
.
isV2
();
}
Future
<
void
>
_handleUri
(
String
?
uri
)
async
{
...
...
@@ -474,6 +484,7 @@ class _ContactSearchPageState extends State<ContactSearchPage> {
contact
.
subtitle
!=
null
?
Text
(
contact
.
subtitle
!
)
:
null
;
final
List
<
String
>
ids
=
_selectedContacts
.
map
((
Contact
c
)
=
>
c
.
pubKey
)
.
toList
();
final
bool
isV2
=
context
.
read
<
AppCubit
>()
.
isV2
();
return
_isMultiSelect
?
CheckboxListTile
(
title:
Text
(
contact
.
title
),
...
...
@@ -499,6 +510,7 @@ class _ContactSearchPageState extends State<ContactSearchPage> {
contact
,
index
,
context
,
isV2:
isV2
,
onLongPress:
()
{
setState
(()
{
_isMultiSelect
=
true
;
...
...
This diff is collapsed.
Click to expand it.
lib/ui/widgets/first_screen/pay_contact_search_button.dart
+
1
−
1
View file @
f2b58e75
...
...
@@ -55,7 +55,7 @@ class _PayContactSearchButtonState extends State<PayContactSearchButton> {
),
);
}
else
{
return
const
PayRecipientWidget
();
return
PayRecipientWidget
(
searchUse:
widget
.
searchUse
);
}
});
}
...
...
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