restoreConnection method
Implementation
@override
Future<bool> restoreConnection() async {
_closeGateways();
var connection = await _storage.getItem(key: IStorage.keyConnection);
if (connection == null) {
return false;
}
final decodeConnection = jsonDecode(connection) as Map<String, dynamic>;
if (!decodeConnection.containsKey('session')) {
return false;
}
_session = BridgeSession(stored: decodeConnection['session']);
_gateway = BridgeGateway(
_storage,
_session.bridgeUrl!,
_session.sessionCrypto.sessionId,
_gatewayListener,
_gatewayErrorsListener,
);
await _gateway!.registerSession();
for (final listener in _listeners) {
listener(decodeConnection['connect_event']);
}
return true;
}