Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
mycard
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
syntax_j
mycard
Commits
70650f20
Commit
70650f20
authored
Dec 13, 2016
by
wudizhanche1000
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add: 启动时定位到最后访问
parent
a2a1bac4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
5 deletions
+30
-5
app/apps.service.ts
app/apps.service.ts
+26
-2
app/lobby.component.ts
app/lobby.component.ts
+4
-3
No files found.
app/apps.service.ts
View file @
70650f20
...
...
@@ -55,8 +55,23 @@ export class AppsService {
private
downloadService
:
DownloadService
,
private
ngZone
:
NgZone
)
{
}
get
lastVisted
():
App
|
undefined
{
let
id
=
localStorage
.
getItem
(
"
last_visited
"
);
if
(
id
)
{
return
this
.
apps
.
get
(
id
);
}
return
undefined
;
}
set
lastVisted
(
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
();
let
data
=
await
this
.
http
.
get
(
'
./apps.json
'
).
map
((
response
)
=>
response
.
json
()).
toPromise
();
this
.
apps
=
this
.
loadAppsList
(
data
);
return
this
.
apps
;
}
...
...
@@ -253,6 +268,15 @@ export class AppsService {
this
.
findChildren
(
app
).
every
((
child
)
=>
(
child
.
isInstalled
()
&&
child
.
isReady
())
||
!
child
.
isInstalled
());
}
async
importApp
(
app
:
App
,
appPath
:
string
)
{
if
(
!
app
.
isInstalled
())
{
app
.
status
.
status
=
"
ready
"
;
app
.
local
=
new
AppLocal
();
app
.
local
.
path
=
appPath
;
await
this
.
update
(
app
,
true
);
}
}
sha256sum
(
file
:
string
):
Promise
<
string
>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
let
input
=
fs
.
createReadStream
(
file
);
...
...
@@ -308,7 +332,7 @@ export class AppsService {
}
else
{
readyToUpdate
=
app
.
isReady
()
&&
mods
.
every
((
mod
)
=>
mod
.
isReady
());
}
if
(
readyToUpdate
&&
(
app
.
local
!
.
version
!==
app
.
version
||
verify
))
{
if
(
readyToUpdate
&&
(
verify
||
app
.
local
!
.
version
!==
app
.
version
))
{
app
.
status
.
status
=
"
updating
"
;
try
{
Logger
.
info
(
"
Checking updating:
"
,
app
);
...
...
app/lobby.component.ts
View file @
70650f20
...
...
@@ -31,10 +31,10 @@ export class LobbyComponent implements OnInit {
async
ngOnInit
()
{
this
.
apps
=
await
this
.
appsService
.
loadApps
();
await
this
.
appsService
.
migrate
();
for
(
let
app
of
this
.
apps
.
values
())
{
for
(
let
app
of
this
.
apps
.
values
())
{
this
.
appsService
.
update
(
app
);
}
this
.
chooseApp
(
Array
.
from
(
this
.
apps
.
values
()).
find
(
app
=>
app
.
isInstalled
())
||
this
.
apps
.
get
(
"
ygopro
"
)
!
);
this
.
chooseApp
(
this
.
appsService
.
lastVisted
||
this
.
apps
.
get
(
"
ygopro
"
)
!
);
// 初始化聊天室
let
url
=
new
URL
(
'
candy/index.html
'
,
location
.
href
);
...
...
@@ -42,7 +42,7 @@ export class LobbyComponent implements OnInit {
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
())
{
switch
(
this
.
settingsService
.
getLocale
())
{
case
'
zh-CN
'
:
params
.
set
(
'
language
'
,
'
cn
'
);
break
;
...
...
@@ -57,6 +57,7 @@ export class LobbyComponent implements OnInit {
chooseApp
(
app
:
App
)
{
this
.
currentApp
=
app
;
this
.
appsService
.
lastVisted
=
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