parent
							
								
									5e920f0fd0
								
							
						
					
					
						commit
						ae8dfe84a0
					
				@ -4,6 +4,7 @@ import 'dart:math';
 | 
			
		||||
import 'dart:typed_data';
 | 
			
		||||
import 'dart:ui' as ui;
 | 
			
		||||
 | 
			
		||||
import 'package:bot_toast/bot_toast.dart';
 | 
			
		||||
import 'package:desktop_multi_window/desktop_multi_window.dart';
 | 
			
		||||
import 'package:flutter/material.dart';
 | 
			
		||||
import 'package:flutter/services.dart';
 | 
			
		||||
@ -269,6 +270,8 @@ class FfiModel with ChangeNotifier {
 | 
			
		||||
      var name = evt['name'];
 | 
			
		||||
      if (name == 'msgbox') {
 | 
			
		||||
        handleMsgBox(evt, sessionId, peerId);
 | 
			
		||||
      } else if (name == 'toast') {
 | 
			
		||||
        handleToast(evt, sessionId, peerId);
 | 
			
		||||
      } else if (name == 'set_multiple_windows_session') {
 | 
			
		||||
        handleMultipleWindowsSession(evt, sessionId, peerId);
 | 
			
		||||
      } else if (name == 'peer_info') {
 | 
			
		||||
@ -595,6 +598,37 @@ class FfiModel with ChangeNotifier {
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  handleToast(Map<String, dynamic> evt, SessionID sessionId, String peerId) {
 | 
			
		||||
    final type = evt['type'] ?? 'info';
 | 
			
		||||
    final text = evt['text'] ?? '';
 | 
			
		||||
    final durMsc = evt['dur_msec'] ?? 2000;
 | 
			
		||||
    final duration = Duration(milliseconds: durMsc);
 | 
			
		||||
    if ((text).isEmpty) {
 | 
			
		||||
      BotToast.showLoading(
 | 
			
		||||
        duration: duration,
 | 
			
		||||
        clickClose: true,
 | 
			
		||||
        allowClick: true,
 | 
			
		||||
      );
 | 
			
		||||
    } else {
 | 
			
		||||
      if (type.contains('error')) {
 | 
			
		||||
        BotToast.showText(
 | 
			
		||||
          contentColor: Colors.red,
 | 
			
		||||
          text: translate(text),
 | 
			
		||||
          duration: duration,
 | 
			
		||||
          clickClose: true,
 | 
			
		||||
          onlyOne: true,
 | 
			
		||||
        );
 | 
			
		||||
      } else {
 | 
			
		||||
        BotToast.showText(
 | 
			
		||||
          text: translate(text),
 | 
			
		||||
          duration: duration,
 | 
			
		||||
          clickClose: true,
 | 
			
		||||
          onlyOne: true,
 | 
			
		||||
        );
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /// Show a message box with [type], [title] and [text].
 | 
			
		||||
  showMsgBox(SessionID sessionId, String type, String title, String text,
 | 
			
		||||
      String link, bool hasRetry, OverlayDialogManager dialogManager,
 | 
			
		||||
 | 
			
		||||
@ -651,5 +651,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Download", ""),
 | 
			
		||||
        ("Upload folder", ""),
 | 
			
		||||
        ("Upload files", ""),
 | 
			
		||||
        ("Clipboard is synchronized", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -651,5 +651,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Download", ""),
 | 
			
		||||
        ("Upload folder", ""),
 | 
			
		||||
        ("Upload files", ""),
 | 
			
		||||
        ("Clipboard is synchronized", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -651,5 +651,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Download", ""),
 | 
			
		||||
        ("Upload folder", ""),
 | 
			
		||||
        ("Upload files", ""),
 | 
			
		||||
        ("Clipboard is synchronized", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -651,5 +651,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Download", ""),
 | 
			
		||||
        ("Upload folder", ""),
 | 
			
		||||
        ("Upload files", ""),
 | 
			
		||||
        ("Clipboard is synchronized", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -651,5 +651,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Download", "下载"),
 | 
			
		||||
        ("Upload folder", "上传文件夹"),
 | 
			
		||||
        ("Upload files", "上传文件"),
 | 
			
		||||
        ("Clipboard is synchronized", "剪贴板已同步"),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -651,5 +651,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Download", ""),
 | 
			
		||||
        ("Upload folder", ""),
 | 
			
		||||
        ("Upload files", ""),
 | 
			
		||||
        ("Clipboard is synchronized", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -651,5 +651,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Download", ""),
 | 
			
		||||
        ("Upload folder", ""),
 | 
			
		||||
        ("Upload files", ""),
 | 
			
		||||
        ("Clipboard is synchronized", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -651,5 +651,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Download", "Herunterladen"),
 | 
			
		||||
        ("Upload folder", "Ordner hochladen"),
 | 
			
		||||
        ("Upload files", "Dateien hochladen"),
 | 
			
		||||
        ("Clipboard is synchronized", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -651,5 +651,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Download", ""),
 | 
			
		||||
        ("Upload folder", ""),
 | 
			
		||||
        ("Upload files", ""),
 | 
			
		||||
        ("Clipboard is synchronized", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -651,5 +651,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Download", ""),
 | 
			
		||||
        ("Upload folder", ""),
 | 
			
		||||
        ("Upload files", ""),
 | 
			
		||||
        ("Clipboard is synchronized", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -651,5 +651,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Download", ""),
 | 
			
		||||
        ("Upload folder", ""),
 | 
			
		||||
        ("Upload files", ""),
 | 
			
		||||
        ("Clipboard is synchronized", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -651,5 +651,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Download", ""),
 | 
			
		||||
        ("Upload folder", ""),
 | 
			
		||||
        ("Upload files", ""),
 | 
			
		||||
        ("Clipboard is synchronized", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -651,5 +651,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Download", ""),
 | 
			
		||||
        ("Upload folder", ""),
 | 
			
		||||
        ("Upload files", ""),
 | 
			
		||||
        ("Clipboard is synchronized", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -651,5 +651,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Download", ""),
 | 
			
		||||
        ("Upload folder", ""),
 | 
			
		||||
        ("Upload files", ""),
 | 
			
		||||
        ("Clipboard is synchronized", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -651,5 +651,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Download", ""),
 | 
			
		||||
        ("Upload folder", ""),
 | 
			
		||||
        ("Upload files", ""),
 | 
			
		||||
        ("Clipboard is synchronized", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -651,5 +651,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Download", ""),
 | 
			
		||||
        ("Upload folder", ""),
 | 
			
		||||
        ("Upload files", ""),
 | 
			
		||||
        ("Clipboard is synchronized", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -651,5 +651,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Download", ""),
 | 
			
		||||
        ("Upload folder", ""),
 | 
			
		||||
        ("Upload files", ""),
 | 
			
		||||
        ("Clipboard is synchronized", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -651,5 +651,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Download", ""),
 | 
			
		||||
        ("Upload folder", ""),
 | 
			
		||||
        ("Upload files", ""),
 | 
			
		||||
        ("Clipboard is synchronized", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -651,5 +651,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Download", ""),
 | 
			
		||||
        ("Upload folder", ""),
 | 
			
		||||
        ("Upload files", ""),
 | 
			
		||||
        ("Clipboard is synchronized", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -651,5 +651,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Download", "Download"),
 | 
			
		||||
        ("Upload folder", "Cartella upload"),
 | 
			
		||||
        ("Upload files", "File upload"),
 | 
			
		||||
        ("Clipboard is synchronized", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -651,5 +651,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Download", ""),
 | 
			
		||||
        ("Upload folder", ""),
 | 
			
		||||
        ("Upload files", ""),
 | 
			
		||||
        ("Clipboard is synchronized", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -651,5 +651,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Download", ""),
 | 
			
		||||
        ("Upload folder", ""),
 | 
			
		||||
        ("Upload files", ""),
 | 
			
		||||
        ("Clipboard is synchronized", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -651,5 +651,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Download", ""),
 | 
			
		||||
        ("Upload folder", ""),
 | 
			
		||||
        ("Upload files", ""),
 | 
			
		||||
        ("Clipboard is synchronized", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -651,5 +651,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Download", ""),
 | 
			
		||||
        ("Upload folder", ""),
 | 
			
		||||
        ("Upload files", ""),
 | 
			
		||||
        ("Clipboard is synchronized", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -651,5 +651,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Download", ""),
 | 
			
		||||
        ("Upload folder", ""),
 | 
			
		||||
        ("Upload files", ""),
 | 
			
		||||
        ("Clipboard is synchronized", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -651,5 +651,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Download", ""),
 | 
			
		||||
        ("Upload folder", ""),
 | 
			
		||||
        ("Upload files", ""),
 | 
			
		||||
        ("Clipboard is synchronized", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -651,5 +651,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Download", ""),
 | 
			
		||||
        ("Upload folder", ""),
 | 
			
		||||
        ("Upload files", ""),
 | 
			
		||||
        ("Clipboard is synchronized", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -651,5 +651,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Download", ""),
 | 
			
		||||
        ("Upload folder", ""),
 | 
			
		||||
        ("Upload files", ""),
 | 
			
		||||
        ("Clipboard is synchronized", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -651,5 +651,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Download", ""),
 | 
			
		||||
        ("Upload folder", ""),
 | 
			
		||||
        ("Upload files", ""),
 | 
			
		||||
        ("Clipboard is synchronized", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -651,5 +651,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Download", ""),
 | 
			
		||||
        ("Upload folder", ""),
 | 
			
		||||
        ("Upload files", ""),
 | 
			
		||||
        ("Clipboard is synchronized", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -651,5 +651,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Download", ""),
 | 
			
		||||
        ("Upload folder", ""),
 | 
			
		||||
        ("Upload files", ""),
 | 
			
		||||
        ("Clipboard is synchronized", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -651,5 +651,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Download", ""),
 | 
			
		||||
        ("Upload folder", ""),
 | 
			
		||||
        ("Upload files", ""),
 | 
			
		||||
        ("Clipboard is synchronized", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -651,5 +651,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Download", ""),
 | 
			
		||||
        ("Upload folder", ""),
 | 
			
		||||
        ("Upload files", ""),
 | 
			
		||||
        ("Clipboard is synchronized", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -651,5 +651,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Download", ""),
 | 
			
		||||
        ("Upload folder", ""),
 | 
			
		||||
        ("Upload files", ""),
 | 
			
		||||
        ("Clipboard is synchronized", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -651,5 +651,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Download", ""),
 | 
			
		||||
        ("Upload folder", ""),
 | 
			
		||||
        ("Upload files", ""),
 | 
			
		||||
        ("Clipboard is synchronized", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -651,5 +651,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Download", ""),
 | 
			
		||||
        ("Upload folder", ""),
 | 
			
		||||
        ("Upload files", ""),
 | 
			
		||||
        ("Clipboard is synchronized", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -651,5 +651,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Download", ""),
 | 
			
		||||
        ("Upload folder", ""),
 | 
			
		||||
        ("Upload files", ""),
 | 
			
		||||
        ("Clipboard is synchronized", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -651,5 +651,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Download", ""),
 | 
			
		||||
        ("Upload folder", ""),
 | 
			
		||||
        ("Upload files", ""),
 | 
			
		||||
        ("Clipboard is synchronized", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -651,5 +651,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Download", ""),
 | 
			
		||||
        ("Upload folder", ""),
 | 
			
		||||
        ("Upload files", ""),
 | 
			
		||||
        ("Clipboard is synchronized", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -651,5 +651,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Download", ""),
 | 
			
		||||
        ("Upload folder", ""),
 | 
			
		||||
        ("Upload files", ""),
 | 
			
		||||
        ("Clipboard is synchronized", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -651,5 +651,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Download", "下載"),
 | 
			
		||||
        ("Upload folder", "上傳資料夾"),
 | 
			
		||||
        ("Upload files", "上傳檔案"),
 | 
			
		||||
        ("Clipboard is synchronized", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -651,5 +651,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Download", ""),
 | 
			
		||||
        ("Upload folder", ""),
 | 
			
		||||
        ("Upload files", ""),
 | 
			
		||||
        ("Clipboard is synchronized", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -651,5 +651,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Download", ""),
 | 
			
		||||
        ("Upload folder", ""),
 | 
			
		||||
        ("Upload files", ""),
 | 
			
		||||
        ("Clipboard is synchronized", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user