2018-03-07 10:48:32 +02:00
|
|
|
import Stream from './stream';
|
|
|
|
import StreamManager from './stream-manager';
|
2018-03-15 12:53:46 +02:00
|
|
|
import MiOS from '../../mios';
|
2018-03-07 10:48:32 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Drive stream connection
|
|
|
|
*/
|
|
|
|
export class DriveStream extends Stream {
|
2018-03-15 12:53:46 +02:00
|
|
|
constructor(os: MiOS, me) {
|
|
|
|
super(os, 'drive', {
|
2018-04-07 21:58:11 +03:00
|
|
|
i: me.token
|
2018-03-07 10:48:32 +02:00
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export class DriveStreamManager extends StreamManager<DriveStream> {
|
|
|
|
private me;
|
2018-03-15 12:53:46 +02:00
|
|
|
private os: MiOS;
|
2018-03-07 10:48:32 +02:00
|
|
|
|
2018-03-15 12:53:46 +02:00
|
|
|
constructor(os: MiOS, me) {
|
2018-03-07 10:48:32 +02:00
|
|
|
super();
|
|
|
|
|
|
|
|
this.me = me;
|
2018-03-15 12:53:46 +02:00
|
|
|
this.os = os;
|
2018-03-07 10:48:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public getConnection() {
|
|
|
|
if (this.connection == null) {
|
2018-03-15 12:53:46 +02:00
|
|
|
this.connection = new DriveStream(this.os, this.me);
|
2018-03-07 10:48:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return this.connection;
|
|
|
|
}
|
|
|
|
}
|