Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
moecube
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
JoyJ
moecube
Commits
99468679
Commit
99468679
authored
Dec 20, 2016
by
wudizhanche1000
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
apps.json移动到服务端
parent
e133d336
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
27 deletions
+45
-27
app/apps.service.ts
app/apps.service.ts
+15
-5
app/lobby.component.ts
app/lobby.component.ts
+30
-22
No files found.
app/apps.service.ts
View file @
99468679
...
...
@@ -57,7 +57,7 @@ export class AppsService {
private
downloadService
:
DownloadService
,
private
ngZone
:
NgZone
)
{
}
get
lastVisted
():
App
|
undefined
{
get
lastVis
i
ted
():
App
|
undefined
{
let
id
=
localStorage
.
getItem
(
"
last_visited
"
);
if
(
id
)
{
return
this
.
apps
.
get
(
id
);
...
...
@@ -65,16 +65,26 @@ export class AppsService {
return
undefined
;
}
set
lastVisted
(
app
:
App
|
undefined
)
{
set
lastVis
i
ted
(
app
:
App
|
undefined
)
{
if
(
app
)
{
localStorage
.
setItem
(
"
last_visited
"
,
app
.
id
);
}
}
async
loadApps
()
{
let
data
=
await
this
.
http
.
get
(
'
./apps.json
'
).
map
((
response
)
=>
response
.
json
()).
toPromise
();
this
.
apps
=
this
.
loadAppsList
(
data
);
let
appsURL
=
'
https://wudizhanche.mycard.moe/downloads/apps.json
'
;
try
{
let
data
=
await
this
.
http
.
get
(
appsURL
).
map
((
response
)
=>
response
.
json
()).
toPromise
();
localStorage
.
setItem
(
"
apps_json
"
,
appsURL
);
this
.
apps
=
this
.
loadAppsList
(
data
);
}
catch
(
e
)
{
let
data
=
localStorage
.
getItem
(
"
apps_json
"
);
if
(
data
)
{
this
.
apps
=
this
.
loadAppsList
(
data
);
}
else
{
this
.
apps
=
new
Map
();
}
}
return
this
.
apps
;
}
...
...
app/lobby.component.ts
View file @
99468679
...
...
@@ -30,34 +30,42 @@ export class LobbyComponent implements OnInit {
async
ngOnInit
()
{
this
.
apps
=
await
this
.
appsService
.
loadApps
();
for
(
let
app
of
this
.
apps
.
values
())
{
this
.
appsService
.
update
(
app
);
}
this
.
chooseApp
(
this
.
appsService
.
lastVisted
||
this
.
apps
.
get
(
"
ygopro
"
)
!
);
if
(
this
.
apps
.
size
>
0
)
{
this
.
chooseApp
(
this
.
appsService
.
lastVisited
||
this
.
apps
.
get
(
"
ygopro
"
)
!
);
// 初始化聊天室
let
url
=
new
URL
(
'
candy/index.html
'
,
location
.
href
);
let
params
:
URLSearchParams
=
url
[
'
searchParams
'
];
// TypeScrpt 缺了 url.searchParams 的定义
params
.
set
(
'
jid
'
,
this
.
loginService
.
user
.
username
+
'
@mycard.moe
'
);
params
.
set
(
'
password
'
,
this
.
loginService
.
user
.
external_id
.
toString
());
params
.
set
(
'
nickname
'
,
this
.
loginService
.
user
.
username
);
switch
(
this
.
settingsService
.
getLocale
())
{
case
'
zh-CN
'
:
params
.
set
(
'
language
'
,
'
cn
'
);
break
;
default
:
params
.
set
(
'
language
'
,
'
en
'
);
}
if
(
this
.
currentApp
.
conference
)
{
params
.
set
(
'
autojoin
'
,
this
.
currentApp
.
conference
+
'
@conference.mycard.moe
'
);
// 初始化聊天室
let
url
=
new
URL
(
'
candy/index.html
'
,
location
.
href
);
let
params
:
URLSearchParams
=
url
[
'
searchParams
'
];
// TypeScrpt 缺了 url.searchParams 的定义
params
.
set
(
'
jid
'
,
this
.
loginService
.
user
.
username
+
'
@mycard.moe
'
);
params
.
set
(
'
password
'
,
this
.
loginService
.
user
.
external_id
.
toString
());
params
.
set
(
'
nickname
'
,
this
.
loginService
.
user
.
username
);
switch
(
this
.
settingsService
.
getLocale
())
{
case
'
zh-CN
'
:
params
.
set
(
'
language
'
,
'
cn
'
);
break
;
default
:
params
.
set
(
'
language
'
,
'
en
'
);
}
if
(
this
.
currentApp
.
conference
)
{
params
.
set
(
'
autojoin
'
,
this
.
currentApp
.
conference
+
'
@conference.mycard.moe
'
);
}
this
.
candy_url
=
url
;
await
this
.
appsService
.
migrate
();
for
(
let
app
of
this
.
apps
.
values
())
{
await
this
.
appsService
.
update
(
app
);
}
}
else
{
if
(
confirm
(
"
获取程序列表失败,是否重试?
"
))
{
location
.
reload
();
}
else
{
window
.
close
();
}
}
this
.
candy_url
=
url
;
await
this
.
appsService
.
migrate
();
}
chooseApp
(
app
:
App
)
{
this
.
currentApp
=
app
;
this
.
appsService
.
lastVisted
=
app
;
this
.
appsService
.
lastVis
i
ted
=
app
;
if
(
this
.
candy
&&
this
.
currentApp
.
conference
)
{
(
<
WebViewElement
>
this
.
candy
.
nativeElement
).
send
(
'
join
'
,
this
.
currentApp
.
conference
+
'
@conference.mycard.moe
'
);
}
...
...
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