Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
bh_face_counter
Overview
Overview
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
黄天晨
bh_face_counter
Commits
360778c1
Commit
360778c1
authored
Jun 29, 2020
by
zeven
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
远程安装APK
parent
d008286e
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
1 deletions
+30
-1
android
android
+1
-1
App.js
src/App.js
+26
-0
Installer.js
src/utils/Installer.js
+3
-0
No files found.
android
@
24e88792
Subproject commit
a3cbda867ae325953176a19a5ed9da46db9d686e
Subproject commit
24e88792277dde5f5560c1ae701ffbdcb9e47969
src/App.js
View file @
360778c1
...
...
@@ -10,6 +10,7 @@ import router from './router';
import
models
from
'./models'
;
import
dva
from
'./utils/dva'
;
import
Restart
from
'./utils/Restart'
;
import
Installer
from
'./utils/Installer'
;
import
{
counterInterval
}
from
'./utils/authInterval'
;
import
{
host
}
from
'./utils/config'
;
...
...
@@ -88,6 +89,31 @@ class App extends React.Component {
dispatch
({
type
:
'admin/version'
});
});
}
if
(
!
window
.
socket
.
hasListeners
(
'installApp'
))
{
window
.
socket
.
on
(
'installApp'
,
({
url
})
=>
{
if
(
!
url
)
{
Toast
.
show
(
'下载链接不能为空'
);
return
;
}
const
match
=
url
.
match
(
/http
(
s*
)
:
\/\/
.+
\/(
.+
)
/
);
if
(
!
match
)
{
Toast
.
show
(
'下载链接错误'
);
return
;
}
const
file
=
match
[
2
];
Installer
.
download
(
url
,
file
).
then
(
apk
=>
{
if
(
apk
)
{
Installer
.
install
(
apk
);
}
});
});
}
if
(
!
window
.
socket
.
hasListeners
(
'uninstallApp'
))
{
window
.
socket
.
on
(
'uninstallApp'
,
({
pkg
})
=>
{
// packageName eg: com.vsu.package
Installer
.
uninstall
(
pkg
);
});
}
};
refresh
=
async
()
=>
{
...
...
src/utils/Installer.js
0 → 100644
View file @
360778c1
import
{
NativeModules
}
from
'react-native'
;
export
default
NativeModules
.
Installer
;
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