Merge pull request #755 from pangeachat/design-updates

Design updates
pull/1423/head
ggurdin 1 year ago committed by GitHub
commit f4b590b376
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -402,64 +402,6 @@ class ChatDetailsView extends StatelessWidget {
startOpen: false,
),
const Divider(height: 1),
if (!room.isDirectChat)
if (room.isRoomAdmin)
ListTile(
title: Text(
room.isSpace
? L10n.of(context)!.archiveSpace
: L10n.of(context)!.archive,
style: TextStyle(
color:
Theme.of(context).colorScheme.secondary,
fontWeight: FontWeight.bold,
),
),
leading: CircleAvatar(
backgroundColor:
Theme.of(context).scaffoldBackgroundColor,
foregroundColor: iconColor,
child: const Icon(
Icons.archive_outlined,
),
),
onTap: () async {
var confirmed = OkCancelResult.ok;
var shouldGo = false;
// archiveSpace has its own popup; only show if not space
if (!room.isSpace) {
confirmed = await showOkCancelAlertDialog(
useRootNavigator: false,
context: context,
title: L10n.of(context)!.areYouSure,
okLabel: L10n.of(context)!.ok,
cancelLabel: L10n.of(context)!.cancel,
message: L10n.of(context)!
.archiveRoomDescription,
);
}
if (confirmed == OkCancelResult.ok) {
if (room.isSpace) {
shouldGo = await room.archiveSpace(
context,
Matrix.of(context).client,
);
} else {
final success =
await showFutureLoadingDialog(
context: context,
future: () async {
await room.archive();
},
);
shouldGo = (success.error == null);
}
if (shouldGo) {
context.go('/rooms');
}
}
},
),
ListTile(
title: Text(
L10n.of(context)!.leave,

@ -269,4 +269,16 @@ extension SettingCopy on ToolSetting {
return L10n.of(context)!.autoIGCToolDescription;
}
}
bool get isAvailableSetting {
switch (this) {
case ToolSetting.interactiveTranslator:
case ToolSetting.interactiveGrammar:
case ToolSetting.definitions:
return false;
case ToolSetting.immersionMode:
case ToolSetting.autoIGC:
return true;
}
}
}

@ -28,22 +28,12 @@ class SettingsLearningView extends StatelessWidget {
children: [
LanguageTile(controller),
CountryPickerTile(controller),
const SizedBox(height: 8),
const Divider(height: 1),
const SizedBox(height: 8),
// if (controller.pangeaController.permissionsController.isUser18())
// SwitchListTile.adaptive(
// activeColor: AppConfig.activeToggleColor,
// title: Text(L10n.of(context)!.publicProfileTitle),
// subtitle: Text(L10n.of(context)!.publicProfileDesc),
// value: controller.pangeaController.userController.isPublic,
// onChanged: (bool isPublicProfile) =>
// controller.setPublicProfile(isPublicProfile),
// ),
ListTile(
subtitle: Text(L10n.of(context)!.toggleToolSettingsDescription),
title: Text(L10n.of(context)!.toggleToolSettingsDescription),
),
for (final toolSetting in ToolSetting.values)
for (final toolSetting in ToolSetting.values
.where((tool) => tool.isAvailableSetting))
ProfileSettingsSwitchListTile.adaptive(
defaultValue: controller.getToolSetting(toolSetting),
title: toolSetting.toolName(context),
@ -66,18 +56,18 @@ class SettingsLearningView extends StatelessWidget {
return profile;
}),
),
ProfileSettingsSwitchListTile.adaptive(
defaultValue: controller.pangeaController.userController.profile
.userSettings.autoPlayMessages,
title: L10n.of(context)!.autoPlayTitle,
subtitle: L10n.of(context)!.autoPlayDesc,
onChange: (bool value) => controller
.pangeaController.userController
.updateProfile((profile) {
profile.userSettings.autoPlayMessages = value;
return profile;
}),
),
// ProfileSettingsSwitchListTile.adaptive(
// defaultValue: controller.pangeaController.userController.profile
// .userSettings.autoPlayMessages,
// title: L10n.of(context)!.autoPlayTitle,
// subtitle: L10n.of(context)!.autoPlayDesc,
// onChange: (bool value) => controller
// .pangeaController.userController
// .updateProfile((profile) {
// profile.userSettings.autoPlayMessages = value;
// return profile;
// }),
// ),
],
),
),

@ -1,7 +1,6 @@
import 'dart:async';
import 'package:adaptive_dialog/adaptive_dialog.dart';
import 'package:fluffychat/pangea/extensions/pangea_room_extension/pangea_room_extension.dart';
import 'package:fluffychat/pangea/utils/download_chat.dart';
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
@ -18,7 +17,6 @@ enum ChatPopupMenuActions {
leave,
search,
// #Pangea
archive,
downloadTxt,
downloadCsv,
downloadXlsx,
@ -118,25 +116,6 @@ class ChatSettingsPopupMenuState extends State<ChatSettingsPopupMenu> {
context.go('/rooms/${widget.room.id}/search');
break;
// #Pangea
case ChatPopupMenuActions.archive:
final confirmed = await showOkCancelAlertDialog(
useRootNavigator: false,
context: context,
title: L10n.of(context)!.areYouSure,
okLabel: L10n.of(context)!.ok,
cancelLabel: L10n.of(context)!.cancel,
message: L10n.of(context)!.archiveRoomDescription,
);
if (confirmed == OkCancelResult.ok) {
final success = await showFutureLoadingDialog(
context: context,
future: () => widget.room.archive(),
);
if (success.error == null) {
context.go('/rooms');
}
}
break;
case ChatPopupMenuActions.downloadTxt:
showFutureLoadingDialog(
context: context,
@ -246,18 +225,6 @@ class ChatSettingsPopupMenuState extends State<ChatSettingsPopupMenu> {
),
),
// #Pangea
if (!widget.room.isArchived)
if (widget.room.isRoomAdmin)
PopupMenuItem<ChatPopupMenuActions>(
value: ChatPopupMenuActions.archive,
child: Row(
children: [
const Icon(Icons.archive_outlined),
const SizedBox(width: 12),
Text(L10n.of(context)!.archive),
],
),
),
PopupMenuItem<ChatPopupMenuActions>(
value: ChatPopupMenuActions.downloadTxt,
child: Row(

Loading…
Cancel
Save