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();
|
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);
|
_removeStates(widget.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void resetTool() {
|
|
||||||
_ffi.resetModifiers();
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget buildBody(BuildContext context) {
|
Widget buildBody(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: Theme.of(context).backgroundColor,
|
backgroundColor: Theme.of(context).backgroundColor,
|
||||||
|
@ -6,6 +6,8 @@ import 'package:flutter_hbb/models/platform_model.dart';
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
|
|
||||||
|
import '../common.dart';
|
||||||
|
|
||||||
class AbModel with ChangeNotifier {
|
class AbModel with ChangeNotifier {
|
||||||
var abLoading = false;
|
var abLoading = false;
|
||||||
var abError = "";
|
var abError = "";
|
||||||
@ -27,7 +29,7 @@ class AbModel with ChangeNotifier {
|
|||||||
final api = "${await getApiServer()}/api/ab/get";
|
final api = "${await getApiServer()}/api/ab/get";
|
||||||
try {
|
try {
|
||||||
final resp =
|
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") {
|
if (resp.body.isNotEmpty && resp.body.toLowerCase() != "null") {
|
||||||
Map<String, dynamic> json = jsonDecode(resp.body);
|
Map<String, dynamic> json = jsonDecode(resp.body);
|
||||||
if (json.containsKey('error')) {
|
if (json.containsKey('error')) {
|
||||||
@ -61,10 +63,6 @@ class AbModel with ChangeNotifier {
|
|||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<Map<String, String>>? _getHeaders() {
|
|
||||||
return _ffi?.getHttpHeaders();
|
|
||||||
}
|
|
||||||
|
|
||||||
void addId(String id) async {
|
void addId(String id) async {
|
||||||
if (idContainBy(id)) {
|
if (idContainBy(id)) {
|
||||||
return;
|
return;
|
||||||
@ -93,7 +91,7 @@ class AbModel with ChangeNotifier {
|
|||||||
abLoading = true;
|
abLoading = true;
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
final api = "${await getApiServer()}/api/ab";
|
final api = "${await getApiServer()}/api/ab";
|
||||||
var authHeaders = await _getHeaders() ?? Map<String, String>();
|
var authHeaders = await getHttpHeaders();
|
||||||
authHeaders['Content-Type'] = "application/json";
|
authHeaders['Content-Type'] = "application/json";
|
||||||
final body = jsonEncode({
|
final body = jsonEncode({
|
||||||
"data": jsonEncode({"tags": tags, "peers": peers})
|
"data": jsonEncode({"tags": tags, "peers": peers})
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'dart:io';
|
|
||||||
import 'dart:math';
|
import 'dart:math';
|
||||||
import 'dart:typed_data';
|
import 'dart:typed_data';
|
||||||
import 'dart:ui' as ui;
|
import 'dart:ui' as ui;
|
||||||
@ -1297,29 +1296,6 @@ class FFI {
|
|||||||
Future<bool> invokeMethod(String method, [dynamic arguments]) async {
|
Future<bool> invokeMethod(String method, [dynamic arguments]) async {
|
||||||
return await platformFFI.invokeMethod(method, arguments);
|
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 {
|
class Display {
|
||||||
|
@ -5,6 +5,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
|
|
||||||
|
import '../common.dart';
|
||||||
import 'model.dart';
|
import 'model.dart';
|
||||||
import 'platform_model.dart';
|
import 'platform_model.dart';
|
||||||
|
|
||||||
@ -35,7 +36,7 @@ class UserModel extends ChangeNotifier {
|
|||||||
"id": await bind.mainGetMyId(),
|
"id": await bind.mainGetMyId(),
|
||||||
"uuid": await bind.mainGetUuid(),
|
"uuid": await bind.mainGetUuid(),
|
||||||
},
|
},
|
||||||
headers: await _getHeaders());
|
headers: await getHttpHeaders());
|
||||||
await Future.wait([
|
await Future.wait([
|
||||||
bind.mainSetLocalOption(key: 'access_token', value: ''),
|
bind.mainSetLocalOption(key: 'access_token', value: ''),
|
||||||
bind.mainSetLocalOption(key: 'user_info', value: ''),
|
bind.mainSetLocalOption(key: 'user_info', value: ''),
|
||||||
@ -46,10 +47,6 @@ class UserModel extends ChangeNotifier {
|
|||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<Map<String, String>>? _getHeaders() {
|
|
||||||
return parent.target?.getHttpHeaders();
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<Map<String, dynamic>> login(String userName, String pass) async {
|
Future<Map<String, dynamic>> login(String userName, String pass) async {
|
||||||
final url = await bind.mainGetApiServer();
|
final url = await bind.mainGetApiServer();
|
||||||
try {
|
try {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user