Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
C
clone_excelso
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
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
Prasetya Saputra
clone_excelso
Commits
abe58700
Commit
abe58700
authored
Sep 03, 2020
by
Afid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix check version, hanya kasih dialog kalo versi apps dibawah versi apps diserver
parent
9bc361e1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
6 deletions
+31
-6
CheckVersion.js
function/CheckVersion.js
+31
-6
No files found.
function/CheckVersion.js
View file @
abe58700
import
Axios
from
'axios'
;
import
Axios
from
'axios'
;
import
Constants
from
'expo-constants'
;
import
Constants
from
'expo-constants'
;
import
{
Alert
}
from
'react-native'
;
import
{
Alert
,
Linking
}
from
'react-native'
;
function
compareVersion
(
v1
,
v2
)
{
if
(
typeof
v1
!==
'string'
)
return
false
;
if
(
typeof
v2
!==
'string'
)
return
false
;
v1
=
v1
.
split
(
'.'
);
v2
=
v2
.
split
(
'.'
);
const
k
=
Math
.
min
(
v1
.
length
,
v2
.
length
);
for
(
let
i
=
0
;
i
<
k
;
++
i
)
{
v1
[
i
]
=
parseInt
(
v1
[
i
],
10
);
v2
[
i
]
=
parseInt
(
v2
[
i
],
10
);
if
(
v1
[
i
]
>
v2
[
i
])
return
1
;
if
(
v1
[
i
]
<
v2
[
i
])
return
-
1
;
}
return
v1
.
length
==
v2
.
length
?
0
:
(
v1
.
length
<
v2
.
length
?
-
1
:
1
);
}
export
default
function
CheckVersion
(
navigation
)
{
export
default
function
CheckVersion
(
navigation
)
{
let
version
=
Constants
.
manifest
.
version
let
version
=
Constants
.
manifest
.
version
Axios
.
get
(
'https://excelso.ravintolavip.com/cms/v2/detail/apps-version'
).
then
(
respon
=>
{
Axios
.
get
(
'https://excelso.ravintolavip.com/cms/v2/detail/apps-version'
).
then
(
respon
=>
{
let
version_server
=
respon
.
data
.
content5
let
version_server
=
respon
.
data
.
content5
let
msg_res
=
respon
.
data
.
content6
let
msg_res
=
respon
.
data
.
content6
if
(
version_server
!==
version
)
{
if
(
compareVersion
(
version
,
version_server
)
==
-
1
)
{
Alert
.
alert
(
Alert
.
alert
(
'Update Version'
,
'Update Version'
,
msg_res
,
msg_res
,
[
[
{
{
text
:
'Cancel'
,
text
:
'Nanti'
,
onPress
:
()
=>
console
.
log
(
'Cancel Pressed'
),
style
:
'cancel'
style
:
'cancel'
},
},
{
text
:
'OK'
,
onPress
:
()
=>
navigation
.
navigate
(
'UpdateVersion'
)
}
{
text
:
'Update'
,
onPress
:
()
=>
{
if
(
Platform
.
OS
===
'ios'
)
{
Linking
.
openURL
(
'https://apps.apple.com/id/app/excelso/id1434669847'
)
}
else
{
Linking
.
openURL
(
'https://play.google.com/store/apps/details?id=id.web.ravintola.excelsocrm'
)
}
}
}
],
],
{
cancelable
:
false
}
{
cancelable
:
false
}
);
);
...
...
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