Skip to content

Commit

Permalink
Merge pull request #37 from compose-us/fix/update-flottform-state
Browse files Browse the repository at this point in the history
Rename the flottformstate 'waiting-for-file' to 'waiting-for-data'
  • Loading branch information
nidhal-labidi authored Aug 26, 2024
2 parents 4fd7814 + 11c12b4 commit fdcad87
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion flottform/forms/src/flottform-channel-host.ts
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ export class FlottformChannelHost extends EventEmitter<FlottformEventMap> {

this.dataChannel.onopen = (e) => {
this.logger.log('data channel opened');
this.changeState('waiting-for-file');
this.changeState('waiting-for-data');
};

this.dataChannel.onclose = (e) => {
Expand Down
2 changes: 1 addition & 1 deletion flottform/forms/src/flottform-file-input-host.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ export class FlottformFileInputHost extends EventEmitter<Listeners> {
this.channel?.on('waiting-for-ice', () => {
this.emit('webrtc:waiting-for-ice');
});
this.channel?.on('waiting-for-file', () => {
this.channel?.on('waiting-for-data', () => {
this.emit('webrtc:waiting-for-file');
this.emit('connected');
});
Expand Down
6 changes: 3 additions & 3 deletions flottform/forms/src/flottform-text-input-host.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type Listeners = {
event: { link: string; qrCode: string; channel: FlottformChannelHost }
];
'webrtc:waiting-for-ice': [];
'webrtc:waiting-for-file': [];
'webrtc:waiting-for-data': [];
};

const noop = () => {};
Expand Down Expand Up @@ -99,8 +99,8 @@ export class FlottformTextInputHost extends EventEmitter<Listeners> {
this.channel?.on('waiting-for-ice', () => {
this.emit('webrtc:waiting-for-ice');
});
this.channel?.on('waiting-for-file', () => {
this.emit('webrtc:waiting-for-file');
this.channel?.on('waiting-for-data', () => {
this.emit('webrtc:waiting-for-data');
this.emit('connected');
});
this.channel?.on('receiving-data', (e) => {
Expand Down
4 changes: 2 additions & 2 deletions flottform/forms/src/internal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export type FlottformState =
| 'new'
| 'waiting-for-client'
| 'waiting-for-ice'
| 'waiting-for-file'
| 'waiting-for-data'
| 'receiving-data'
| 'done'
| 'error';
Expand Down Expand Up @@ -101,7 +101,7 @@ export type FlottformEventMap = {
channel: FlottformChannelHost;
}
];
'waiting-for-file': [];
'waiting-for-data': [];
'waiting-for-ice': [];
'receiving-data': [e: MessageEvent<any>];
'file-received': [{ fileMeta: FileMetaInfos; arrayBuffer: Array<ArrayBuffer> }];
Expand Down

0 comments on commit fdcad87

Please sign in to comment.