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
f343473e
Commit
f343473e
authored
Oct 27, 2016
by
神楽坂玲奈
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'v3' of github.com:mycard/mycard into v3
parents
e770e834
6d8cb676
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
54 additions
and
59 deletions
+54
-59
.gitignore
.gitignore
+1
-1
app/app-detail.component.ts
app/app-detail.component.ts
+4
-14
app/app.ts
app/app.ts
+4
-12
app/apps.service.ts
app/apps.service.ts
+45
-32
No files found.
.gitignore
View file @
f343473e
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
/dist/
/dist/
/cache/
/cache/
/typings/
/typings/
/npm-debug.log
/npm-debug.log
*
/.idea/
/.idea/
.DS_Store
.DS_Store
Thumbs.db
Thumbs.db
app/app-detail.component.ts
View file @
f343473e
...
@@ -42,7 +42,9 @@ export class AppDetailComponent implements OnInit {
...
@@ -42,7 +42,9 @@ export class AppDetailComponent implements OnInit {
};
};
get
isInstalled
()
{
get
isInstalled
()
{
return
this
.
checkInstall
(
this
.
appsService
.
currentApp
.
id
);
let
currentApp
=
this
.
appsService
.
currentApp
;
return
!!
(
currentApp
.
local
&&
currentApp
.
local
.
path
);
}
}
...
@@ -93,17 +95,6 @@ export class AppDetailComponent implements OnInit {
...
@@ -93,17 +95,6 @@ export class AppDetailComponent implements OnInit {
}
}
}
}
checkInstall
(
id
):
boolean
{
if
(
this
.
appsService
.
searchApp
(
id
))
{
let
local
=
this
.
appsService
.
searchApp
(
id
).
local
;
if
(
local
&&
local
.
path
)
{
return
true
;
}
}
return
false
;
}
uninstalling
:
boolean
;
uninstalling
:
boolean
;
uninstall
(
id
:
string
)
{
uninstall
(
id
:
string
)
{
...
@@ -141,8 +132,7 @@ export class AppDetailComponent implements OnInit {
...
@@ -141,8 +132,7 @@ export class AppDetailComponent implements OnInit {
let
open
=
''
;
let
open
=
''
;
let
openId
=
app
.
actions
[
process
.
platform
][
"
main
"
].
open
;
let
openId
=
app
.
actions
[
process
.
platform
][
"
main
"
].
open
;
if
(
openId
)
{
if
(
openId
)
{
//this.appsService.searchApp(openId).actions[process.platform]["main"].execute;
if
(
this
.
isInstalled
)
{
if
(
this
.
checkInstall
(
openId
))
{
open
=
this
.
path
.
join
(
this
.
appsService
.
searchApp
(
openId
).
local
.
path
,
this
.
appsService
.
searchApp
(
openId
).
actions
[
process
.
platform
][
"
main
"
].
execute
);
open
=
this
.
path
.
join
(
this
.
appsService
.
searchApp
(
openId
).
local
.
path
,
this
.
appsService
.
searchApp
(
openId
).
actions
[
process
.
platform
][
"
main
"
].
execute
);
args
.
push
(
execute
);
args
.
push
(
execute
);
}
else
{
}
else
{
...
...
app/app.ts
View file @
f343473e
...
@@ -29,7 +29,7 @@ export class App {
...
@@ -29,7 +29,7 @@ export class App {
homepage
:
string
;
homepage
:
string
;
category
:
string
;
category
:
string
;
parent
:
App
;
parent
:
App
;
actions
:
{[
platform
:
string
]:
{[
action
:
string
]:
{
execute
:
string
,
args
:
string
[],
env
:
{},
open
:
string
}
}};
actions
:
{[
action
:
string
]:
{
execute
:
string
,
args
:
string
[],
env
:
{},
open
:
App
}};
references
:
Map
<
string
,
App
>
;
references
:
Map
<
string
,
App
>
;
dependencies
:
Map
<
string
,
App
>
;
dependencies
:
Map
<
string
,
App
>
;
locales
:
string
[];
locales
:
string
[];
...
@@ -39,7 +39,7 @@ export class App {
...
@@ -39,7 +39,7 @@ export class App {
version
:
{[
platform
:
string
]:
string
};
version
:
{[
platform
:
string
]:
string
};
local
:
AppLocal
;
local
:
AppLocal
;
constructor
(
app
:
AppInterface
)
{
constructor
(
app
)
{
this
.
id
=
app
.
id
;
this
.
id
=
app
.
id
;
this
.
name
=
app
.
name
;
this
.
name
=
app
.
name
;
this
.
description
=
app
.
description
;
this
.
description
=
app
.
description
;
...
@@ -47,6 +47,8 @@ export class App {
...
@@ -47,6 +47,8 @@ export class App {
this
.
homepage
=
app
.
homepage
;
this
.
homepage
=
app
.
homepage
;
this
.
category
=
app
.
category
;
this
.
category
=
app
.
category
;
this
.
actions
=
app
.
actions
;
this
.
actions
=
app
.
actions
;
this
.
dependencies
=
app
.
dependencies
;
this
.
parent
=
app
.
parent
;
this
.
references
=
app
.
references
;
this
.
references
=
app
.
references
;
this
.
locales
=
app
.
locales
;
this
.
locales
=
app
.
locales
;
this
.
download
=
app
.
download
;
this
.
download
=
app
.
download
;
...
@@ -58,13 +60,3 @@ export class App {
...
@@ -58,13 +60,3 @@ export class App {
}
}
export
interface
AppInterface
extends
App
{
}
/*export interface TestInterface {
id: string;
name: {[locale: string]: string};
}
let test: TestInterface = <TestInterface>{id: '1', name: {"x": "Guy"}};
console.log(test)*/
\ No newline at end of file
app/apps.service.ts
View file @
f343473e
import
{
Injectable
}
from
"
@angular/core
"
;
import
{
Injectable
}
from
"
@angular/core
"
;
import
{
Http
}
from
"
@angular/http
"
;
import
{
Http
}
from
"
@angular/http
"
;
import
"
rxjs/Rx
"
;
import
{
App
}
from
"
./app
"
;
import
{
App
}
from
"
./app
"
;
import
{
TranslateService
}
from
"
ng2-translate
"
;
import
{
InstallConfig
}
from
"
./install-config
"
;
import
{
InstallConfig
}
from
"
./install-config
"
;
import
{
SettingsService
}
from
"
./settings.sevices
"
;
import
{
SettingsService
}
from
"
./settings.sevices
"
;
...
@@ -37,7 +35,6 @@ sudo.fork = function (modulePath, args, options) {
...
@@ -37,7 +35,6 @@ sudo.fork = function (modulePath, args, options) {
@
Injectable
()
@
Injectable
()
export
class
AppsService
{
export
class
AppsService
{
installConfig
:
InstallConfig
;
installConfig
:
InstallConfig
;
private
_currentApp
:
App
;
private
_currentApp
:
App
;
...
@@ -49,23 +46,8 @@ export class AppsService {
...
@@ -49,23 +46,8 @@ export class AppsService {
this
.
_currentApp
=
app
;
this
.
_currentApp
=
app
;
}
}
constructor
(
private
http
:
Http
,
private
translate
:
TranslateService
,
private
settingsService
:
SettingsService
)
{
constructor
(
private
http
:
Http
,
private
settingsService
:
SettingsService
)
{
let
loop
=
setInterval
(()
=>
{
this
.
loadApps
(()
=>
{
this
.
aria2
.
tellActive
().
then
((
res
)
=>
{
if
(
res
)
{
res
.
map
((
v
)
=>
{
let
index
=
this
.
downloadsInfo
.
findIndex
((
info
)
=>
{
return
info
.
gid
==
v
.
gid
;
});
this
.
downloadsInfo
[
index
].
progress
=
(
v
.
completedLength
/
v
.
totalLength
)
*
100
;
});
}
})
},
1000
);
this
.
getApps
(()
=>
{
//console.log(appsService.data)
if
(
this
.
data
.
size
>
0
)
{
if
(
this
.
data
.
size
>
0
)
{
this
.
currentApp
=
this
.
data
.
get
(
'
ygopro
'
);
this
.
currentApp
=
this
.
data
.
get
(
'
ygopro
'
);
}
}
...
@@ -201,7 +183,7 @@ export class AppsService {
...
@@ -201,7 +183,7 @@ export class AppsService {
return
dir
;
return
dir
;
}
}
get
Apps
(
callback
)
{
load
Apps
(
callback
)
{
this
.
http
.
get
(
'
./apps.json
'
)
this
.
http
.
get
(
'
./apps.json
'
)
.
map
(
response
=>
{
.
map
(
response
=>
{
let
apps
=
response
.
json
();
let
apps
=
response
.
json
();
...
@@ -217,7 +199,7 @@ export class AppsService {
...
@@ -217,7 +199,7 @@ export class AppsService {
return
app
;
return
app
;
});
});
return
apps
;
return
apps
;
}).
map
(
this
.
loadApps
)
}).
map
(
this
.
loadApps
List
)
.
subscribe
((
apps
)
=>
{
.
subscribe
((
apps
)
=>
{
this
.
data
=
apps
;
this
.
data
=
apps
;
if
(
typeof
(
callback
)
===
'
function
'
)
{
if
(
typeof
(
callback
)
===
'
function
'
)
{
...
@@ -235,24 +217,55 @@ export class AppsService {
...
@@ -235,24 +217,55 @@ export class AppsService {
return
value
;
return
value
;
}
}
loadApps
=
(
data
:
any
):
Map
<
string
,
App
>
=>
{
loadApps
List
=
(
data
:
any
):
Map
<
string
,
App
>
=>
{
let
result
=
new
Map
<
string
,
App
>
();
let
apps
=
new
Map
<
string
,
App
>
();
let
locale
=
this
.
settingsService
.
getLocale
();
let
locale
=
this
.
settingsService
.
getLocale
();
let
platform
=
process
.
platform
;
for
(
let
item
of
data
)
{
for
(
let
item
of
data
)
{
let
id
=
item
[
"
id
"
];
let
app
=
new
App
(
item
);
[
'
name
'
,
'
description
'
].
forEach
((
key
,
index
)
=>
{
let
value
=
item
[
key
][
locale
];
// 去除无关语言
[
'
name
'
,
'
description
'
].
forEach
((
key
)
=>
{
let
value
=
app
[
key
][
locale
];
if
(
!
value
)
{
if
(
!
value
)
{
value
=
item
[
key
][
"
en-US
"
];
value
=
app
[
key
][
"
en-US
"
];
}
}
item
[
key
]
=
value
;
app
[
key
]
=
value
;
});
});
let
app
=
new
App
(
item
);
// 去除平台无关的内容
result
.
set
(
id
,
app
);
[
'
actions
'
,
'
dependencies
'
,
'
references
'
,
'
download
'
].
forEach
((
key
)
=>
{
if
(
app
[
key
])
{
if
(
app
[
key
][
platform
])
{
app
[
key
]
=
app
[
key
][
platform
];
}
else
{
app
[
key
]
=
null
;
}
}
});
apps
.
set
(
item
.
id
,
app
);
}
for
(
let
id
of
Array
.
from
(
apps
.
keys
()))
{
[
'
dependencies
'
,
'
references
'
,
'
parent
'
].
forEach
((
key
)
=>
{
let
app
=
apps
.
get
(
id
);
let
value
=
app
[
key
];
if
(
value
)
{
if
(
Array
.
isArray
(
value
))
{
value
.
forEach
((
appId
,
index
,
array
)
=>
{
array
[
index
]
=
apps
.
get
(
appId
);
})
}
else
{
app
[
key
]
=
apps
.
get
(
value
);
}
}
});
}
}
return
result
;
return
apps
;
};
};
searchApp
(
id
):
App
{
searchApp
(
id
):
App
{
...
...
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