Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit90e5e97

Browse files
committed
store tutorial id/version on server
1 parent1b99222 commit90e5e97

File tree

4 files changed

+10
-5
lines changed

4 files changed

+10
-5
lines changed

‎src/Channel.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import setupActions from './actions/setupActions'
66
importsolutionActionsfrom'./actions/solutionActions'
77

88
interfaceChannel{
9-
receive(action:CR.Action):void
9+
receive(action:CR.Action):Promise<void>
1010
send(action:CR.Action):Promise<void>
1111
}
1212

@@ -27,14 +27,14 @@ class Channel implements Channel {
2727
}
2828

2929
// receive from webview
30-
publicreceive=(action:CR.Action)=>{
30+
publicreceive=async(action:CR.Action)=>{
3131
constactionType:string=typeofaction==='string' ?action :action.type
3232
console.log('RECEIVED:',actionType)
3333
switch(actionType){
3434
// continue from tutorial from local storage
3535
case'TUTORIAL_LOAD_STORED':
36-
consttutorial=this.storage.tutorial.get()
37-
conststepProgress=this.storage.stepProgress.get()
36+
consttutorial=awaitthis.storage.tutorial.get()
37+
conststepProgress=awaitthis.storage.stepProgress.get()
3838

3939
console.log('looking at stored')
4040
console.log(JSON.stringify(tutorial))

‎src/services/storage/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,15 @@ class Storage<T> {
1515
}
1616
publicget=async():Promise<T|null>=>{
1717
constvalue:string|undefined=awaitthis.storage.get(this.key)
18+
// console.log(`STORAGE.get ${this.key} : ${JSON.stringify(value)}`)
1819
if(value){
1920
returnJSON.parse(value)
2021
}
2122
returnnull
2223
}
2324
publicset=(value:T):void=>{
2425
conststringValue=JSON.stringify(value)
26+
// console.log(`STORAGE.set ${this.key} ${JSON.stringify(value)}`)
2527
this.storage.update(this.key,stringValue)
2628
}
2729
publicupdate=async(value:T):Promise<void>=>{

‎web-app/src/services/state/actions/context.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ import * as selectors from '../../selectors'
66
exportdefault{
77
continueTutorial:(context:CR.MachineContext,event:CR.MachineEvent)=>{
88

9-
const{tutorial, stepProgress}=event.data.payload
9+
const{tutorial, stepProgress}=event.payload
10+
// NOTE: tutorial does not contain levels/stages/steps etc.
1011

1112
constprogress:CR.Progress={
1213
steps:stepProgress,

‎web-app/src/services/state/actions/editor.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ export default {
1616
thrownewError('Invalid tutorial for tutorial config')
1717
}
1818
constpayload={
19+
id:tutorial.id,
20+
version:tutorial.version.version,
1921
codingLanguage:tutorial.codingLanguage,
2022
testRunner:tutorial.testRunner,
2123
repo:tutorial.repo,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp