Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
beasy-mobile
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
4
Issues
4
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
G
beasy-mobile
Commits
69210286
Commit
69210286
authored
May 17, 2024
by
G
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
a good enough implementation using the device security system.
- ask for password when hidden (on click) - insta hide when visible (on click)
parent
d18e9f36
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
1 deletion
+22
-1
app.json
app.json
+8
-0
BalanceContainer.tsx
src/components/BalanceContainer.tsx
+14
-1
No files found.
app.json
View file @
69210286
...
@@ -23,6 +23,14 @@
...
@@ -23,6 +23,14 @@
},
},
"web"
:
{
"web"
:
{
"favicon"
:
"./assets/favicon.png"
"favicon"
:
"./assets/favicon.png"
},
"plugins"
:
[
[
"expo-local-authentication"
,
{
"faceIDPermission"
:
"Allow B-Easy to use Face ID."
}
}
]
]
}
}
}
}
src/components/BalanceContainer.tsx
View file @
69210286
import
Box
from
"@components/bases/Box"
;
import
Box
from
"@components/bases/Box"
;
import
Text
from
"@components/bases/Text"
;
import
Text
from
"@components/bases/Text"
;
import
{
images
}
from
"@styles/Commons"
;
import
{
images
}
from
"@styles/Commons"
;
import
*
as
LocalAuthentication
from
"expo-local-authentication"
;
import
{
useState
}
from
"react"
;
import
{
useState
}
from
"react"
;
import
{
Image
,
TouchableOpacity
}
from
"react-native"
;
import
{
Image
,
TouchableOpacity
}
from
"react-native"
;
...
@@ -9,6 +10,18 @@ type Props = { balance: number; label: string };
...
@@ -9,6 +10,18 @@ type Props = { balance: number; label: string };
const
BalanceContainer
=
({
label
,
balance
}:
Props
)
=>
{
const
BalanceContainer
=
({
label
,
balance
}:
Props
)
=>
{
const
[
showBalance
,
setShowBalance
]
=
useState
(
false
);
const
[
showBalance
,
setShowBalance
]
=
useState
(
false
);
const
handleLocalAuthentication
=
async
()
=>
{
console
.
log
(
"handleLocalAuthentication :: start"
);
if
(
showBalance
)
{
return
setShowBalance
(
false
);
}
const
result
=
await
LocalAuthentication
.
authenticateAsync
();
if
(
result
.
success
)
{
setShowBalance
(
true
);
}
console
.
log
(
"handleLocalAuthentication :: end"
,
result
);
};
return
(
return
(
<
Box
<
Box
position=
{
"relative"
}
position=
{
"relative"
}
...
@@ -31,7 +44,7 @@ const BalanceContainer = ({ label, balance }: Props) => {
...
@@ -31,7 +44,7 @@ const BalanceContainer = ({ label, balance }: Props) => {
</
Box
>
</
Box
>
<
Box
alignItems=
{
"center"
}
gap=
{
"s"
}
>
<
Box
alignItems=
{
"center"
}
gap=
{
"s"
}
>
<
TouchableOpacity
onPress=
{
()
=>
setShowBalance
(
!
showBalance
)
}
>
<
TouchableOpacity
onPress=
{
handleLocalAuthentication
}
>
<
Box
height=
{
50
}
alignItems=
{
"center"
}
justifyContent=
{
"center"
}
>
<
Box
height=
{
50
}
alignItems=
{
"center"
}
justifyContent=
{
"center"
}
>
{
showBalance
?
(
{
showBalance
?
(
<
Text
fontSize=
{
30
}
variant=
{
"black"
}
>
<
Text
fontSize=
{
30
}
variant=
{
"black"
}
>
...
...
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