mirror of
https://github.com/amigan/calls.git
synced 2024-11-21 20:39:47 -05:00
wip
This commit is contained in:
parent
c71ecc1b79
commit
9395e8801e
3 changed files with 21 additions and 4 deletions
|
@ -1,6 +1,9 @@
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
import 'dart:io';
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
|
import 'package:just_audio/just_audio.dart';
|
||||||
|
import 'package:web_socket_channel/web_socket_channel.dart';
|
||||||
import '../pb/stillbox.pb.dart';
|
import '../pb/stillbox.pb.dart';
|
||||||
import 'stillbox_none.dart'
|
import 'stillbox_none.dart'
|
||||||
if (dart.library.io) 'stillbox_io.dart'
|
if (dart.library.io) 'stillbox_io.dart'
|
||||||
|
@ -76,8 +79,11 @@ class Stillbox extends ChangeNotifier {
|
||||||
if (!kIsWeb && token != null) {
|
if (!kIsWeb && token != null) {
|
||||||
storage.setKey('token', token);
|
storage.setKey('token', token);
|
||||||
}
|
}
|
||||||
await connect();
|
try {
|
||||||
return true;
|
await connect();
|
||||||
|
} on WebSocketChannelException catch(e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -87,6 +93,11 @@ class Stillbox extends ChangeNotifier {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
channel.connect(_wsUri);
|
channel.connect(_wsUri);
|
||||||
|
try {
|
||||||
|
await channel.channel?.ready;
|
||||||
|
} on WebSocketChannelException catch(e) {
|
||||||
|
_handleError(e);
|
||||||
|
}
|
||||||
channel.stream.listen((event) => _handleData(event),
|
channel.stream.listen((event) => _handleData(event),
|
||||||
onDone: () {
|
onDone: () {
|
||||||
connected = false;
|
connected = false;
|
||||||
|
|
|
@ -113,6 +113,11 @@ class _LoginState extends State<Login> {
|
||||||
const Duration(milliseconds: 0),
|
const Duration(milliseconds: 0),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
} else if (context.mounted) {
|
||||||
|
// display a snackbar
|
||||||
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
|
const SnackBar(content: Text('Login failed.')),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
|
|
|
@ -39,7 +39,7 @@ message Call {
|
||||||
}
|
}
|
||||||
|
|
||||||
message Hello {
|
message Hello {
|
||||||
Version version = 1;
|
ServerInfo server_info = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
message UserPopup {
|
message UserPopup {
|
||||||
|
@ -105,9 +105,10 @@ message Filter {
|
||||||
message Search {
|
message Search {
|
||||||
}
|
}
|
||||||
|
|
||||||
message Version {
|
message ServerInfo {
|
||||||
string server_name = 1;
|
string server_name = 1;
|
||||||
string version = 2;
|
string version = 2;
|
||||||
string built = 3;
|
string built = 3;
|
||||||
string platform = 4;
|
string platform = 4;
|
||||||
|
string db_size = 5;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue