Skip to content

Commit

Permalink
Error message was appearing in the wrong moment
Browse files Browse the repository at this point in the history
  • Loading branch information
RodrigoBertotti committed Nov 16, 2023
1 parent 2540fe7 commit d2b128a
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 9 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# 3.0.2
- Error message was appearing in the wrong moment

# 3.0.1
- Fix: "Ops, it should perform configure connection first"

# 3.0.0
Askless was redesigned and is even better! So you can build your App and backend like a pro!
- Several bug fixes
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ pubspec.yaml:
sdk: flutter
# Add this line:
askless: ^3.0.1
askless: ^3.0.2

**5 -** Import the package

Expand Down
6 changes: 3 additions & 3 deletions lib/constants.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ const REQUEST_PREFIX = 'REQ-';
const LISTEN_PREFIX = 'LIS-';

// TODO onupdate:
const CLIENT_LIBRARY_VERSION_NAME = '3.0.1';
const CLIENT_LIBRARY_VERSION_CODE = 5;
const CLIENT_LIBRARY_VERSION_NAME = '3.0.2';
const CLIENT_LIBRARY_VERSION_CODE = 6;

// TODO onupdate: CHECK README (# Add this line: askless: ^3.0.1)
// TODO onupdate: CHECK README (# Add this line: askless: ^3.0.2)

// TODO onupdate: add changelog
3 changes: 0 additions & 3 deletions lib/domain/services/authenticate_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ class AuthenticateService<USER_ID> {
Future<bool> waitForAuthentication(
{required bool neverTimeout, required bool Function() isPersevere, RequestType? requestType, String? route}) {
if (_authStatus == AuthStatus.authenticated) {
logger(
"(waitForAuthentication) Ops, this shouldn't happen, the App says it is authenticated but the server says is not authenticated",
level: Level.error);
return Future.value(true);
}
final completer = Completer<bool>();
Expand Down
3 changes: 3 additions & 0 deletions lib/domain/services/requests_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,9 @@ class RequestsService {
request.data.clientRequestId = '${REQUEST_PREFIX}_${randomAlphaNumeric(28)}';
logger("${request.data.getRoute() ?? ''}: NEW clientRequestId IS ${request.data.clientRequestId}, now it will wait for the authentication to finished...");
isAfterAuthentication = true;
if (getIt.get<AuthenticateService>().authStatus == AuthStatus.authenticated) {
logger("(waitForAuthentication, request_service.dart) Ops, this shouldn't happen, the App says it is authenticated but the server says is not authenticated", level: Level.error);
}
final authenticated = await getIt.get<AuthenticateService>().waitForAuthentication(
neverTimeout: neverTimeout,
isPersevere: isPersevere,
Expand Down
2 changes: 1 addition & 1 deletion lib/index.dart
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ class AsklessClient<USER_ID> {
///
/// [getWebRTCParams] For video and audio calls only. (optional)
///
/// ⚠️ **[Requires configuration, click here to proceed](#video-and-audio-calls)**
/// ⚠️ **[Requires configuration, click here to proceed](https://github.com/RodrigoBertotti/askless-flutter-client/blob/dev/documentation.md#video-and-audio-calls)**
///
/// A function that returns a future object of type `WebRTCParams` which allows you to
/// set `configuration` and `constraints` Map objects from WebRTC,
Expand Down
3 changes: 3 additions & 0 deletions lib/middleware/ListeningHandler.dart
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,9 @@ class ListeningHandler {
listenCli.clientRequestId = '${LISTEN_PREFIX}_${randomAlphaNumeric(28)}';
getIt.get<RequestsService>().runOperationInServer(data: listenCli, isPersevere: res.isPersevere, neverTimeout: true, ifRequiresAuthenticationWaitForIt: false).then((firstResponse) {
if (firstResponse.error?.code == AsklessErrorCode.pendingAuthentication) {
if (getIt.get<AuthenticateService>().authStatus == AuthStatus.authenticated) {
logger("(waitForAuthentication ListeningHandler) Ops, this shouldn't happen, the App says it is authenticated but the server says is not authenticated", level: Level.error);
}
getIt.get<AuthenticateService>().waitForAuthentication(neverTimeout: true, isPersevere: res.isPersevere, requestType: RequestType.LISTEN, route: listenCli.route).then((authenticated) {
if (!authenticated){
logger('waitForAuthentication failed', level: Level.error);
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: askless
description: Build Flutter Apps with PostgreSQL, MySQL, or any database, stream data changes through websockets effortlessly, handle websocket authentication like a pro and elevate your Flutter Chat App with video and audio calls!

version: 3.0.1 # TODO onupdate:
version: 3.0.2 # TODO onupdate:

environment:
sdk: '>=3.1.1 <4.0.0'
Expand Down

0 comments on commit d2b128a

Please sign in to comment.