Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
LocalPass
localpass-mobile
Commits
fdce3523
Commit
fdce3523
authored
4 years ago
by
gabrielweich
Browse files
Options
Download
Email Patches
Plain Diff
melhora performance da listagem de espaço atraves da paralelizacao de requisicoes ao firebase
parent
c2cb8e62
dev
fix/double-header
service-interface
test/criacao-testes
1 merge request
!33
Fix/ Melhora performance da listagem de espaço atraves da paralelizacao de requisicoes ao firebase
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/pages/ListPlaces/ListPlaces.tsx
+7
-3
src/pages/ListPlaces/ListPlaces.tsx
src/services/PlacesService.tsx
+2
-7
src/services/PlacesService.tsx
with
9 additions
and
10 deletions
+9
-10
src/pages/ListPlaces/ListPlaces.tsx
View file @
fdce3523
...
...
@@ -59,9 +59,13 @@ const ListPlaces: React.FC<ListPlacesPageProps> = ({ navigation, route }) => {
setPeople
(
params
.
people
);
let
list
=
await
PlacesService
.
searchPlaces
(
params
);
for
(
let
i
=
0
;
i
<
list
.
length
;
i
++
)
{
list
[
i
].
imageURL
=
await
PlacesService
.
retrieveThumbnails
(
list
[
i
].
spaceId
);
}
const
images
=
await
Promise
.
all
(
list
.
map
(
place
=>
PlacesService
.
retrieveThumbnails
(
place
.
spaceId
)))
list
.
forEach
((
place
,
i
)
=>
{
place
.
imageURL
=
images
[
i
]
})
setInputs
(
list
);
}
})();
...
...
This diff is collapsed.
Click to expand it.
src/services/PlacesService.tsx
View file @
fdce3523
...
...
@@ -54,19 +54,14 @@ class PlacesService {
.
ref
(
"
spaces/
"
+
id
+
"
/photos/thumbnail/
"
)
.
listAll
()
.
then
(
async
(
results
)
=>
{
let
urls
:
string
[]
=
[];
for
(
let
i
=
0
;
i
<
results
.
items
.
length
;
i
++
)
{
await
results
.
items
[
i
].
getDownloadURL
().
then
((
url
)
=>
{
urls
.
push
(
url
);
});
}
const
urls
:
string
[]
=
await
Promise
.
all
(
results
.
items
.
map
((
item
,
i
)
=>
results
.
items
[
i
].
getDownloadURL
()))
return
urls
;
});
return
thumbnails
;
};
/*
// Retrieves a filtered list of listing objects
// Retrieves a filtered list of listing objects
// @param values, the filter parameters to be used
*/
public
async
searchPlaces
(
values
:
SearchParams
)
{
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help