mirror of
https://github.com/rustdesk/rustdesk.git
synced 2025-12-13 11:35:56 +00:00
@@ -1,5 +1,6 @@
|
||||
import 'dart:convert';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_hbb/common.dart';
|
||||
import 'package:flutter_hbb/consts.dart';
|
||||
|
||||
import 'package:flutter_hbb/models/peer_model.dart';
|
||||
@@ -188,3 +189,107 @@ class RequestException implements Exception {
|
||||
return "RequestException, statusCode: $statusCode, error: $cause";
|
||||
}
|
||||
}
|
||||
|
||||
enum ShareRule {
|
||||
read(1),
|
||||
readWrite(2),
|
||||
fullControl(3);
|
||||
|
||||
const ShareRule(this.value);
|
||||
final int value;
|
||||
|
||||
static String desc(int v) {
|
||||
if (v == ShareRule.read.value) {
|
||||
return translate('Read-only');
|
||||
}
|
||||
if (v == ShareRule.readWrite.value) {
|
||||
return translate('Read/Write');
|
||||
}
|
||||
if (v == ShareRule.fullControl.value) {
|
||||
return translate('Full Control');
|
||||
}
|
||||
return v.toString();
|
||||
}
|
||||
|
||||
static String shortDesc(int v) {
|
||||
if (v == ShareRule.read.value) {
|
||||
return 'R';
|
||||
}
|
||||
if (v == ShareRule.readWrite.value) {
|
||||
return 'RW';
|
||||
}
|
||||
if (v == ShareRule.fullControl.value) {
|
||||
return 'F';
|
||||
}
|
||||
return v.toString();
|
||||
}
|
||||
|
||||
static ShareRule? fromValue(int v) {
|
||||
if (v == ShareRule.read.value) {
|
||||
return ShareRule.read;
|
||||
}
|
||||
if (v == ShareRule.readWrite.value) {
|
||||
return ShareRule.readWrite;
|
||||
}
|
||||
if (v == ShareRule.fullControl.value) {
|
||||
return ShareRule.fullControl;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
enum ShareLevel {
|
||||
user(1),
|
||||
group(2),
|
||||
team(3);
|
||||
|
||||
const ShareLevel(this.value);
|
||||
final int value;
|
||||
|
||||
static String teamName = translate('Everyone');
|
||||
}
|
||||
|
||||
class AbProfile {
|
||||
String guid;
|
||||
String name;
|
||||
String owner;
|
||||
String? note;
|
||||
int rule;
|
||||
|
||||
AbProfile(this.guid, this.name, this.owner, this.note, this.rule);
|
||||
|
||||
AbProfile.fromJson(Map<String, dynamic> json)
|
||||
: guid = json['guid'] ?? '',
|
||||
name = json['name'] ?? '',
|
||||
owner = json['owner'] ?? '',
|
||||
note = json['note'] ?? '',
|
||||
rule = json['rule'] ?? 0;
|
||||
}
|
||||
|
||||
class AbTag {
|
||||
String name;
|
||||
int color;
|
||||
|
||||
AbTag(this.name, this.color);
|
||||
|
||||
AbTag.fromJson(Map<String, dynamic> json)
|
||||
: name = json['name'] ?? '',
|
||||
color = json['color'] ?? '';
|
||||
}
|
||||
|
||||
class AbRulePayload {
|
||||
String guid;
|
||||
int level;
|
||||
String name;
|
||||
int rule;
|
||||
String? group;
|
||||
|
||||
AbRulePayload(this.guid, this.level, this.name, this.rule, {this.group});
|
||||
|
||||
AbRulePayload.fromJson(Map<String, dynamic> json)
|
||||
: guid = json['guid'] ?? '',
|
||||
level = json['level'] ?? 0,
|
||||
name = json['name'] ?? '',
|
||||
rule = json['rule'] ?? 0,
|
||||
group = json['group'];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user