mirror of
				https://gitlab.com/famedly/fluffychat.git
				synced 2025-11-03 22:07:23 +01:00 
			
		
		
		
	android: back button cancels share (still pops)
This commit is contained in:
		
							parent
							
								
									01093c7e3d
								
							
						
					
					
						commit
						83c73cac9b
					
				@ -42,6 +42,12 @@ class ChatListController extends State<ChatList> {
 | 
			
		||||
 | 
			
		||||
  String get activeChat => VRouter.of(context).pathParameters['roomid'];
 | 
			
		||||
 | 
			
		||||
  SelectMode get selectMode => Matrix.of(context).shareContent != null
 | 
			
		||||
      ? SelectMode.share
 | 
			
		||||
      : selectedRoomIds.isEmpty
 | 
			
		||||
          ? SelectMode.normal
 | 
			
		||||
          : SelectMode.select;
 | 
			
		||||
 | 
			
		||||
  void _processIncomingSharedFiles(List<SharedMediaFile> files) {
 | 
			
		||||
    if (files?.isEmpty ?? true) return;
 | 
			
		||||
    VRouter.of(context).push('/rooms');
 | 
			
		||||
@ -234,11 +240,6 @@ class ChatListController extends State<ChatList> {
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  void cancelAction() {
 | 
			
		||||
    final selectMode = Matrix.of(context).shareContent != null
 | 
			
		||||
        ? SelectMode.share
 | 
			
		||||
        : selectedRoomIds.isEmpty
 | 
			
		||||
            ? SelectMode.normal
 | 
			
		||||
            : SelectMode.select;
 | 
			
		||||
    if (selectMode == SelectMode.share) {
 | 
			
		||||
      setState(() => Matrix.of(context).shareContent = null);
 | 
			
		||||
    } else {
 | 
			
		||||
 | 
			
		||||
@ -20,17 +20,12 @@ class ChatListView extends StatelessWidget {
 | 
			
		||||
    return StreamBuilder<Object>(
 | 
			
		||||
        stream: Matrix.of(context).onShareContentChanged.stream,
 | 
			
		||||
        builder: (_, __) {
 | 
			
		||||
          final selectMode = Matrix.of(context).shareContent != null
 | 
			
		||||
              ? SelectMode.share
 | 
			
		||||
              : controller.selectedRoomIds.isEmpty
 | 
			
		||||
                  ? SelectMode.normal
 | 
			
		||||
                  : SelectMode.select;
 | 
			
		||||
          final selectMode = controller.selectMode;
 | 
			
		||||
          return VWidgetGuard(
 | 
			
		||||
              onSystemPop: (redirector) async {
 | 
			
		||||
                if (controller.selectedRoomIds.isNotEmpty) {
 | 
			
		||||
                  controller.cancelAction();
 | 
			
		||||
                  redirector.stopRedirection();
 | 
			
		||||
                }
 | 
			
		||||
                final selMode = controller.selectMode;
 | 
			
		||||
                if (selMode != SelectMode.normal) controller.cancelAction();
 | 
			
		||||
                if (selMode == SelectMode.select) redirector.stopRedirection();
 | 
			
		||||
              },
 | 
			
		||||
              child: Scaffold(
 | 
			
		||||
                appBar: AppBar(
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user