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
9
Issues
9
List
Boards
Labels
Service Desk
Milestones
Merge Requests
2
Merge Requests
2
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
MyCard
mycard
Commits
156c1688
Commit
156c1688
authored
May 03, 2023
by
mercury233
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add importEnabled
parent
d9b054c4
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
34 additions
and
4 deletions
+34
-4
app/app-detail.component.html
app/app-detail.component.html
+1
-1
app/mycard.component.html
app/mycard.component.html
+9
-2
app/mycard.component.ts
app/mycard.component.ts
+4
-1
app/settings.sevices.ts
app/settings.sevices.ts
+20
-0
No files found.
app/app-detail.component.html
View file @
156c1688
...
...
@@ -17,7 +17,7 @@
<!--应用已购买,未安装-->
<div
*ngIf=
"currentApp.isBought() && !currentApp.isInstalled()"
class=
"i-b"
>
<button
i18n
(click)=
"updateInstallOption(currentApp)"
type=
"button"
class=
"btn btn-primary btn-sm"
data-toggle=
"modal"
data-target=
"#install-modal"
>
安装
</button>
<button
i18n
*ngIf=
"currentApp.runnable()"
(click)=
"updateInstallOption(currentApp)"
type=
"button"
class=
"btn btn-secondary btn-sm"
data-toggle=
"modal"
data-target=
"#import-modal"
>
导入
</button>
<button
i18n
*ngIf=
"currentApp.runnable()
&& settingsService.getImportEnabled()
"
(click)=
"updateInstallOption(currentApp)"
type=
"button"
class=
"btn btn-secondary btn-sm"
data-toggle=
"modal"
data-target=
"#import-modal"
>
导入
</button>
</div>
<!--应用变更中-->
...
...
app/mycard.component.html
View file @
156c1688
...
...
@@ -67,14 +67,21 @@
<div
class=
"modal-body"
>
<div
class=
"container"
>
<div
class=
"form-group row"
>
<label
i18n
for=
"locale"
class=
"col-sm-
2
col-form-label"
>
语言
</label>
<div
class=
"col-sm-
10
"
>
<label
i18n
for=
"locale"
class=
"col-sm-
3
col-form-label"
>
语言
</label>
<div
class=
"col-sm-
9
"
>
<select
class=
"form-control"
id=
"locale"
[(ngModel)]=
"locale"
name=
"locale"
>
<option
value=
"en-US"
>
English
</option>
<option
value=
"zh-CN"
>
简体中文
</option>
</select>
</div>
</div>
<div
class=
"form-group row"
>
<label
i18n
class=
"col-sm-3 col-form-label"
>
允许导入
</label>
<div
class=
"col-sm-9"
>
<input
type=
"checkbox"
[(ngModel)]=
"importEnabled"
name=
"chkImportEnabled"
>
<label
i18n
for=
"chkImportEnabled"
>
我确认我在开发者指导下使用导入功能
</label>
</div>
</div>
</div>
</div>
<div
class=
"modal-footer"
>
...
...
app/mycard.component.ts
View file @
156c1688
...
...
@@ -37,6 +37,7 @@ export class MyCardComponent implements OnInit {
update_elements
:
Map
<
string
,
ElementRef
>
;
locale
:
string
;
importEnabled
:
boolean
;
resizing
:
HTMLElement
|
null
;
...
...
@@ -104,6 +105,7 @@ export class MyCardComponent implements OnInit {
});
this
.
locale
=
this
.
settingsService
.
getLocale
();
this
.
importEnabled
=
this
.
settingsService
.
getImportEnabled
();
}
...
...
@@ -159,8 +161,9 @@ export class MyCardComponent implements OnInit {
}
submit
()
{
this
.
settingsService
.
setImportEnabled
(
this
.
importEnabled
);
if
(
this
.
locale
!==
this
.
settingsService
.
getLocale
())
{
localStorage
.
setItem
(
SettingsService
.
SETTING_LOCALE
,
this
.
locale
);
this
.
settingsService
.
setLocale
(
this
.
locale
);
remote
.
app
.
relaunch
();
remote
.
app
.
quit
();
}
...
...
app/settings.sevices.ts
View file @
156c1688
...
...
@@ -21,10 +21,12 @@ export class SettingsService {
},
];
static
SETTING_LOCALE
=
'
locale
'
;
static
IMPORT_ENABLED
=
'
importEnabled
'
;
static
defaultLocale
=
remote
.
app
.
getLocale
();
locale
:
string
;
libraries
:
Library
[];
importEnabled
:
boolean
;
getLibraries
()
{
...
...
@@ -92,4 +94,22 @@ export class SettingsService {
this
.
locale
=
locale
;
localStorage
.
setItem
(
SettingsService
.
SETTING_LOCALE
,
locale
);
}
getImportEnabled
():
boolean
{
if
(
this
.
importEnabled
===
undefined
)
{
let
importEnabled
=
localStorage
.
getItem
(
SettingsService
.
IMPORT_ENABLED
);
if
(
!
importEnabled
)
{
this
.
importEnabled
=
false
;
localStorage
.
setItem
(
SettingsService
.
IMPORT_ENABLED
,
'
false
'
);
}
else
{
this
.
importEnabled
=
importEnabled
===
'
true
'
;
}
}
return
this
.
importEnabled
;
}
setImportEnabled
(
enabled
:
boolean
)
{
this
.
importEnabled
=
enabled
;
localStorage
.
setItem
(
SettingsService
.
IMPORT_ENABLED
,
enabled
?
'
true
'
:
'
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