mirror of
https://github.com/rustdesk/rustdesk.git
synced 2025-01-19 00:13:01 +08:00
remove unused of model.dart
This commit is contained in:
parent
e9b9fc8cf3
commit
729f4c0733
@ -1095,3 +1095,10 @@ void connect(BuildContext context, String id,
|
||||
currentFocus.unfocus();
|
||||
}
|
||||
}
|
||||
|
||||
Future<Map<String, String>> getHttpHeaders() async {
|
||||
return {
|
||||
'Authorization':
|
||||
'Bearer ${await bind.mainGetLocalOption(key: 'access_token')}'
|
||||
};
|
||||
}
|
||||
|
@ -131,10 +131,6 @@ class _RemotePageState extends State<RemotePage>
|
||||
_removeStates(widget.id);
|
||||
}
|
||||
|
||||
void resetTool() {
|
||||
_ffi.resetModifiers();
|
||||
}
|
||||
|
||||
Widget buildBody(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: Theme.of(context).backgroundColor,
|
||||
|
@ -6,6 +6,8 @@ import 'package:flutter_hbb/models/platform_model.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
|
||||
import '../common.dart';
|
||||
|
||||
class AbModel with ChangeNotifier {
|
||||
var abLoading = false;
|
||||
var abError = "";
|
||||
@ -27,7 +29,7 @@ class AbModel with ChangeNotifier {
|
||||
final api = "${await getApiServer()}/api/ab/get";
|
||||
try {
|
||||
final resp =
|
||||
await http.post(Uri.parse(api), headers: await _getHeaders());
|
||||
await http.post(Uri.parse(api), headers: await getHttpHeaders());
|
||||
if (resp.body.isNotEmpty && resp.body.toLowerCase() != "null") {
|
||||
Map<String, dynamic> json = jsonDecode(resp.body);
|
||||
if (json.containsKey('error')) {
|
||||
@ -61,10 +63,6 @@ class AbModel with ChangeNotifier {
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
Future<Map<String, String>>? _getHeaders() {
|
||||
return _ffi?.getHttpHeaders();
|
||||
}
|
||||
|
||||
void addId(String id) async {
|
||||
if (idContainBy(id)) {
|
||||
return;
|
||||
@ -93,7 +91,7 @@ class AbModel with ChangeNotifier {
|
||||
abLoading = true;
|
||||
notifyListeners();
|
||||
final api = "${await getApiServer()}/api/ab";
|
||||
var authHeaders = await _getHeaders() ?? Map<String, String>();
|
||||
var authHeaders = await getHttpHeaders();
|
||||
authHeaders['Content-Type'] = "application/json";
|
||||
final body = jsonEncode({
|
||||
"data": jsonEncode({"tags": tags, "peers": peers})
|
||||
|
@ -1,6 +1,5 @@
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
import 'dart:math';
|
||||
import 'dart:typed_data';
|
||||
import 'dart:ui' as ui;
|
||||
@ -1297,29 +1296,6 @@ class FFI {
|
||||
Future<bool> invokeMethod(String method, [dynamic arguments]) async {
|
||||
return await platformFFI.invokeMethod(method, arguments);
|
||||
}
|
||||
|
||||
Future<List<String>> getAudioInputs() async {
|
||||
return await bind.mainGetSoundInputs();
|
||||
}
|
||||
|
||||
Future<String> getDefaultAudioInput() async {
|
||||
final input = await bind.mainGetOption(key: 'audio-input');
|
||||
if (input.isEmpty && Platform.isWindows) {
|
||||
return 'System Sound';
|
||||
}
|
||||
return input;
|
||||
}
|
||||
|
||||
setDefaultAudioInput(String input) {
|
||||
bind.mainSetOption(key: 'audio-input', value: input);
|
||||
}
|
||||
|
||||
Future<Map<String, String>> getHttpHeaders() async {
|
||||
return {
|
||||
'Authorization':
|
||||
'Bearer ${await bind.mainGetLocalOption(key: 'access_token')}'
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
class Display {
|
||||
|
@ -5,6 +5,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
|
||||
import '../common.dart';
|
||||
import 'model.dart';
|
||||
import 'platform_model.dart';
|
||||
|
||||
@ -35,7 +36,7 @@ class UserModel extends ChangeNotifier {
|
||||
"id": await bind.mainGetMyId(),
|
||||
"uuid": await bind.mainGetUuid(),
|
||||
},
|
||||
headers: await _getHeaders());
|
||||
headers: await getHttpHeaders());
|
||||
await Future.wait([
|
||||
bind.mainSetLocalOption(key: 'access_token', value: ''),
|
||||
bind.mainSetLocalOption(key: 'user_info', value: ''),
|
||||
@ -46,10 +47,6 @@ class UserModel extends ChangeNotifier {
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
Future<Map<String, String>>? _getHeaders() {
|
||||
return parent.target?.getHttpHeaders();
|
||||
}
|
||||
|
||||
Future<Map<String, dynamic>> login(String userName, String pass) async {
|
||||
final url = await bind.mainGetApiServer();
|
||||
try {
|
||||
|
Loading…
Reference in New Issue
Block a user