Skip to content

Commit

Permalink
Hotfix: Change FluffyChatApp to TwakeApp
Browse files Browse the repository at this point in the history
  • Loading branch information
nqhhdev authored and hoangdat committed Sep 14, 2023
1 parent 058cf7e commit ebb15ee
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ and recreate it. But when we use this method, we have a DOMException error.
```

## Decision
- Workout round
- Workaround
1. Check platform is Web we don't use deleteFromDisk() method. Only support for Mobile platform.
2. After we have used deleteFromDisk() method. When logging back in, you need to reopen the BoxCollection

Expand Down
6 changes: 3 additions & 3 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import 'package:flutter_secure_storage/flutter_secure_storage.dart';
import 'package:go_router/go_router.dart';
import 'package:matrix/matrix.dart';
import 'utils/background_push.dart';
import 'widgets/fluffy_chat_app.dart';
import 'widgets/twake_app.dart';
import 'widgets/lock_screen.dart';

void main() async {
Expand Down Expand Up @@ -71,11 +71,11 @@ Future<void> startGui(List<Client> clients) async {
runApp(
PlatformInfos.isMobile
? AppLock(
builder: (args) => FluffyChatApp(clients: clients),
builder: (args) => TwakeApp(clients: clients),
lockScreen: const LockScreen(),
enabled: pin?.isNotEmpty ?? false,
)
: FluffyChatApp(clients: clients),
: TwakeApp(clients: clients),
);
}

Expand Down
6 changes: 3 additions & 3 deletions lib/pages/chat_list/receive_sharing_intent_mixin.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:fluffychat/utils/matrix_sdk_extensions/matrix_file_extension.dart';
import 'package:fluffychat/utils/platform_infos.dart';
import 'package:fluffychat/utils/url_launcher.dart';
import 'package:fluffychat/widgets/fluffy_chat_app.dart';
import 'package:fluffychat/widgets/twake_app.dart';
import 'package:fluffychat/widgets/matrix.dart';
import 'package:flutter/material.dart';
import 'dart:async';
Expand Down Expand Up @@ -77,8 +77,8 @@ mixin ReceiveSharingIntentMixin<T extends StatefulWidget> on State<T> {

// For receiving shared Uris
intentUriStreamSubscription = linkStream.listen(_processIncomingUris);
if (FluffyChatApp.gotInitialLink == false) {
FluffyChatApp.gotInitialLink = true;
if (TwakeApp.gotInitialLink == false) {
TwakeApp.gotInitialLink = true;
getInitialLink().then(_processIncomingUris);
}
}
Expand Down
4 changes: 2 additions & 2 deletions lib/pages/invitation_selection/invitation_selection.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'package:fluffychat/pages/new_group/contacts_selection.dart';
import 'package:fluffychat/pages/new_group/contacts_selection_view.dart';
import 'package:fluffychat/widgets/fluffy_chat_app.dart';
import 'package:fluffychat/widgets/twake_app.dart';
import 'package:flutter/material.dart';

import 'package:adaptive_dialog/adaptive_dialog.dart';
Expand Down Expand Up @@ -100,7 +100,7 @@ class InvitationSelectionController
}

void onCloseDialogInvite() {
FluffyChatApp.router.routerDelegate.pop();
TwakeApp.router.routerDelegate.pop();
}

@override
Expand Down
4 changes: 2 additions & 2 deletions lib/utils/background_push.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import 'package:fcm_shared_isolate/fcm_shared_isolate.dart';
import 'package:fluffychat/domain/model/extensions/push/push_notification_extension.dart';
import 'package:fluffychat/utils/matrix_sdk_extensions/client_stories_extension.dart';
import 'package:fluffychat/utils/push_helper.dart';
import 'package:fluffychat/widgets/fluffy_chat_app.dart';
import 'package:fluffychat/widgets/twake_app.dart';
import 'package:fluffychat/widgets/matrix.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
Expand Down Expand Up @@ -349,7 +349,7 @@ class BackgroundPush {
?.content
.tryGet<String>('type') ==
ClientStoriesExtension.storiesRoomType;
FluffyChatApp.router.go('/rooms/$roomId');
TwakeApp.router.go('/rooms/$roomId');
} catch (e, s) {
Logs().e('[Push] Failed to open room', e, s);
}
Expand Down
6 changes: 3 additions & 3 deletions lib/utils/voip_plugin.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import 'package:webrtc_interface/webrtc_interface.dart' hide Navigator;
import 'package:fluffychat/pages/chat_list/chat_list.dart';
import 'package:fluffychat/pages/dialer/dialer.dart';
import 'package:fluffychat/utils/platform_infos.dart';
import 'package:fluffychat/widgets/fluffy_chat_app.dart';
import 'package:fluffychat/widgets/twake_app.dart';
import '../../utils/famedlysdk_store.dart';
import '../../utils/voip/callkeep_manager.dart';
import '../../utils/voip/user_media_manager.dart';
Expand Down Expand Up @@ -61,7 +61,7 @@ class VoipPlugin with WidgetsBindingObserver implements WebRTCDelegate {
void addCallingOverlay(String callId, CallSession call) {
final context = kIsWeb
? ChatList.contextForVoip!
: FluffyChatApp.routerKey.currentContext!; // web is weird
: TwakeApp.routerKey.currentContext!; // web is weird
if (overlayEntry != null) {
Logs().e('[VOIP] addCallingOverlay: The call session already exists?');
overlayEntry!.remove();
Expand Down Expand Up @@ -165,7 +165,7 @@ class VoipPlugin with WidgetsBindingObserver implements WebRTCDelegate {
addCallingOverlay(call.callId, call);
try {
if (!hasCallingAccount) {
ScaffoldMessenger.of(FluffyChatApp.routerKey.currentContext!)
ScaffoldMessenger.of(TwakeApp.routerKey.currentContext!)
.showSnackBar(
const SnackBar(
content: Text(
Expand Down
12 changes: 6 additions & 6 deletions lib/widgets/matrix.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import 'package:fluffychat/utils/platform_infos.dart';
import 'package:fluffychat/utils/uia_request_manager.dart';
import 'package:fluffychat/utils/url_launcher.dart';
import 'package:fluffychat/utils/voip_plugin.dart';
import 'package:fluffychat/widgets/fluffy_chat_app.dart';
import 'package:fluffychat/widgets/twake_app.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_app_lock/flutter_app_lock.dart';
Expand Down Expand Up @@ -179,7 +179,7 @@ class MatrixState extends State<Matrix> with WidgetsBindingObserver {
Logs().d('MatrixState::getLoginClient() Registering subs');
_registerSubs(_loginClientCandidate!.clientName);
_loginClientCandidate = null;
FluffyChatApp.router.go('/rooms');
TwakeApp.router.go('/rooms');
});
return candidate;
}
Expand Down Expand Up @@ -256,7 +256,7 @@ class MatrixState extends State<Matrix> with WidgetsBindingObserver {
bool webHasFocus = true;

String? get activeRoomId {
final route = FluffyChatApp.router.routeInformationProvider.value.location;
final route = TwakeApp.router.routeInformationProvider.value.location;
if (route == null || !route.startsWith('/rooms/')) return null;
return route.split('/')[2];
}
Expand Down Expand Up @@ -353,16 +353,16 @@ class MatrixState extends State<Matrix> with WidgetsBindingObserver {
);

if (state != LoginState.loggedIn) {
FluffyChatApp.router.go('/rooms');
TwakeApp.router.go('/rooms');
}
} else {
if (state == LoginState.loggedIn) {
Logs().v('[MATRIX] Log in successful');
setUpToMServicesInLogin(c);
FluffyChatApp.router.go('/rooms');
TwakeApp.router.go('/rooms');
} else {
Logs().v('[MATRIX] Log out successful');
FluffyChatApp.router.go('/home');
TwakeApp.router.go('/home');
}
}
});
Expand Down
4 changes: 2 additions & 2 deletions lib/widgets/mixins/popup_menu_widget_mixin.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:fluffychat/widgets/fluffy_chat_app.dart';
import 'package:fluffychat/widgets/twake_app.dart';
import 'package:fluffychat/widgets/twake_components/twake_icon_button.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
Expand All @@ -20,7 +20,7 @@ mixin PopupMenuWidgetMixin {
onTap: () {
/// Pop the current page, snackbar, dialog or bottomsheet in the stack
/// will close the currently open snackbar/dialog/bottomsheet AND the current page
FluffyChatApp.router.routerDelegate.pop();
TwakeApp.router.routerDelegate.pop();

onCallbackAction!.call();
},
Expand Down
10 changes: 5 additions & 5 deletions lib/widgets/fluffy_chat_app.dart → lib/widgets/twake_app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ import '../config/app_config.dart';
import '../utils/custom_scroll_behaviour.dart';
import 'matrix.dart';

class FluffyChatApp extends StatefulWidget {
class TwakeApp extends StatefulWidget {
final Widget? testWidget;
final List<Client> clients;
static GlobalKey<NavigatorState> routerKey = GlobalKey<NavigatorState>();

const FluffyChatApp({
const TwakeApp({
Key? key,
this.testWidget,
required this.clients,
Expand All @@ -36,10 +36,10 @@ class FluffyChatApp extends StatefulWidget {
);

@override
FluffyChatAppState createState() => FluffyChatAppState();
TwakeAppState createState() => TwakeAppState();
}

class FluffyChatAppState extends State<FluffyChatApp> {
class TwakeAppState extends State<TwakeApp> {
final networkConnectionService = getIt.get<NetworkConnectionService>();

@override
Expand Down Expand Up @@ -67,7 +67,7 @@ class FluffyChatAppState extends State<FluffyChatApp> {
scrollBehavior: CustomScrollBehavior(),
localizationsDelegates: L10n.localizationsDelegates,
supportedLocales: L10n.supportedLocales,
routerConfig: FluffyChatApp.router,
routerConfig: TwakeApp.router,
builder: (context, child) => Matrix(
clients: widget.clients,
child: child,
Expand Down

0 comments on commit ebb15ee

Please sign in to comment.