Implement basic graphql api map structure

This commit is contained in:
NaiJi 2022-07-25 17:06:55 +03:00
parent 2c9dcbe5e6
commit 7ead9a29ea
22 changed files with 1321 additions and 74 deletions

View File

@ -52,7 +52,8 @@
"copied_ssh": "SSH copied to clipboard",
"delete_ssh_text": "Delete SSH key?",
"about_app_page": {
"text": "Application version v.{}"
"application_version_text": "Application version v.{}",
"api_version_text": "Server API version v.{}"
},
"settings": {
"title": "Application settings",

View File

@ -52,7 +52,8 @@
"copied_ssh": "SSH ключ cкопирован в буфер",
"delete_ssh_text": "Удалить SSH ключ?",
"about_app_page": {
"text": "Версия приложения: v.{}"
"application_version_text": "Версия приложения v.{}",
"api_version_text": "Версия API сервера v.{}"
},
"settings": {
"title": "Настройки приложения",

View File

@ -14,4 +14,4 @@ targets:
json_serializable:
options:
create_factory: true
create_to_json: false
create_to_json: true

View File

@ -0,0 +1,25 @@
import 'package:graphql_flutter/graphql_flutter.dart';
abstract class ApiMap {
Future<GraphQLClient> getClient() async {
final httpLink = HttpLink(
'https://api.$rootAddress/graphql',
);
final Link graphQLLink = isWithToken
? AuthLink(
getToken: () async => authToken,
).concat(httpLink)
: httpLink;
return GraphQLClient(
cache: GraphQLCache(),
link: graphQLLink,
);
}
abstract final String? rootAddress;
abstract final bool hasLogger;
abstract final bool isWithToken;
abstract final String authToken;
}

View File

@ -0,0 +1,474 @@
import 'package:gql/ast.dart';
import 'package:graphql/client.dart' as graphql;
import 'package:json_annotation/json_annotation.dart';
import 'package:selfprivacy/utils/scalars.dart';
part 'get_api_tokens.graphql.g.dart';
@JsonSerializable(explicitToJson: true)
class Query$GetApiTokensQuery {
Query$GetApiTokensQuery({required this.api, required this.$__typename});
@override
factory Query$GetApiTokensQuery.fromJson(Map<String, dynamic> json) =>
_$Query$GetApiTokensQueryFromJson(json);
final Query$GetApiTokensQuery$api api;
@JsonKey(name: '__typename')
final String $__typename;
Map<String, dynamic> toJson() => _$Query$GetApiTokensQueryToJson(this);
int get hashCode {
final l$api = api;
final l$$__typename = $__typename;
return Object.hashAll([l$api, l$$__typename]);
}
@override
bool operator ==(Object other) {
if (identical(this, other)) return true;
if (!(other is Query$GetApiTokensQuery) || runtimeType != other.runtimeType)
return false;
final l$api = api;
final lOther$api = other.api;
if (l$api != lOther$api) return false;
final l$$__typename = $__typename;
final lOther$$__typename = other.$__typename;
if (l$$__typename != lOther$$__typename) return false;
return true;
}
}
extension UtilityExtension$Query$GetApiTokensQuery on Query$GetApiTokensQuery {
CopyWith$Query$GetApiTokensQuery<Query$GetApiTokensQuery> get copyWith =>
CopyWith$Query$GetApiTokensQuery(this, (i) => i);
}
abstract class CopyWith$Query$GetApiTokensQuery<TRes> {
factory CopyWith$Query$GetApiTokensQuery(Query$GetApiTokensQuery instance,
TRes Function(Query$GetApiTokensQuery) then) =
_CopyWithImpl$Query$GetApiTokensQuery;
factory CopyWith$Query$GetApiTokensQuery.stub(TRes res) =
_CopyWithStubImpl$Query$GetApiTokensQuery;
TRes call({Query$GetApiTokensQuery$api? api, String? $__typename});
CopyWith$Query$GetApiTokensQuery$api<TRes> get api;
}
class _CopyWithImpl$Query$GetApiTokensQuery<TRes>
implements CopyWith$Query$GetApiTokensQuery<TRes> {
_CopyWithImpl$Query$GetApiTokensQuery(this._instance, this._then);
final Query$GetApiTokensQuery _instance;
final TRes Function(Query$GetApiTokensQuery) _then;
static const _undefined = {};
TRes call({Object? api = _undefined, Object? $__typename = _undefined}) =>
_then(Query$GetApiTokensQuery(
api: api == _undefined || api == null
? _instance.api
: (api as Query$GetApiTokensQuery$api),
$__typename: $__typename == _undefined || $__typename == null
? _instance.$__typename
: ($__typename as String)));
CopyWith$Query$GetApiTokensQuery$api<TRes> get api {
final local$api = _instance.api;
return CopyWith$Query$GetApiTokensQuery$api(local$api, (e) => call(api: e));
}
}
class _CopyWithStubImpl$Query$GetApiTokensQuery<TRes>
implements CopyWith$Query$GetApiTokensQuery<TRes> {
_CopyWithStubImpl$Query$GetApiTokensQuery(this._res);
TRes _res;
call({Query$GetApiTokensQuery$api? api, String? $__typename}) => _res;
CopyWith$Query$GetApiTokensQuery$api<TRes> get api =>
CopyWith$Query$GetApiTokensQuery$api.stub(_res);
}
const documentNodeQueryGetApiTokensQuery = DocumentNode(definitions: [
OperationDefinitionNode(
type: OperationType.query,
name: NameNode(value: 'GetApiTokensQuery'),
variableDefinitions: [],
directives: [],
selectionSet: SelectionSetNode(selections: [
FieldNode(
name: NameNode(value: 'api'),
alias: null,
arguments: [],
directives: [],
selectionSet: SelectionSetNode(selections: [
FieldNode(
name: NameNode(value: 'devices'),
alias: null,
arguments: [],
directives: [],
selectionSet: SelectionSetNode(selections: [
FieldNode(
name: NameNode(value: 'creationDate'),
alias: null,
arguments: [],
directives: [],
selectionSet: null),
FieldNode(
name: NameNode(value: 'isCaller'),
alias: null,
arguments: [],
directives: [],
selectionSet: null),
FieldNode(
name: NameNode(value: 'name'),
alias: null,
arguments: [],
directives: [],
selectionSet: null),
FieldNode(
name: NameNode(value: '__typename'),
alias: null,
arguments: [],
directives: [],
selectionSet: null)
])),
FieldNode(
name: NameNode(value: '__typename'),
alias: null,
arguments: [],
directives: [],
selectionSet: null)
])),
FieldNode(
name: NameNode(value: '__typename'),
alias: null,
arguments: [],
directives: [],
selectionSet: null)
])),
]);
Query$GetApiTokensQuery _parserFn$Query$GetApiTokensQuery(
Map<String, dynamic> data) =>
Query$GetApiTokensQuery.fromJson(data);
class Options$Query$GetApiTokensQuery
extends graphql.QueryOptions<Query$GetApiTokensQuery> {
Options$Query$GetApiTokensQuery(
{String? operationName,
graphql.FetchPolicy? fetchPolicy,
graphql.ErrorPolicy? errorPolicy,
graphql.CacheRereadPolicy? cacheRereadPolicy,
Object? optimisticResult,
Duration? pollInterval,
graphql.Context? context})
: super(
operationName: operationName,
fetchPolicy: fetchPolicy,
errorPolicy: errorPolicy,
cacheRereadPolicy: cacheRereadPolicy,
optimisticResult: optimisticResult,
pollInterval: pollInterval,
context: context,
document: documentNodeQueryGetApiTokensQuery,
parserFn: _parserFn$Query$GetApiTokensQuery);
}
class WatchOptions$Query$GetApiTokensQuery
extends graphql.WatchQueryOptions<Query$GetApiTokensQuery> {
WatchOptions$Query$GetApiTokensQuery(
{String? operationName,
graphql.FetchPolicy? fetchPolicy,
graphql.ErrorPolicy? errorPolicy,
graphql.CacheRereadPolicy? cacheRereadPolicy,
Object? optimisticResult,
graphql.Context? context,
Duration? pollInterval,
bool? eagerlyFetchResults,
bool carryForwardDataOnException = true,
bool fetchResults = false})
: super(
operationName: operationName,
fetchPolicy: fetchPolicy,
errorPolicy: errorPolicy,
cacheRereadPolicy: cacheRereadPolicy,
optimisticResult: optimisticResult,
context: context,
document: documentNodeQueryGetApiTokensQuery,
pollInterval: pollInterval,
eagerlyFetchResults: eagerlyFetchResults,
carryForwardDataOnException: carryForwardDataOnException,
fetchResults: fetchResults,
parserFn: _parserFn$Query$GetApiTokensQuery);
}
class FetchMoreOptions$Query$GetApiTokensQuery
extends graphql.FetchMoreOptions {
FetchMoreOptions$Query$GetApiTokensQuery(
{required graphql.UpdateQuery updateQuery})
: super(
updateQuery: updateQuery,
document: documentNodeQueryGetApiTokensQuery);
}
extension ClientExtension$Query$GetApiTokensQuery on graphql.GraphQLClient {
Future<graphql.QueryResult<Query$GetApiTokensQuery>> query$GetApiTokensQuery(
[Options$Query$GetApiTokensQuery? options]) async =>
await this.query(options ?? Options$Query$GetApiTokensQuery());
graphql.ObservableQuery<Query$GetApiTokensQuery> watchQuery$GetApiTokensQuery(
[WatchOptions$Query$GetApiTokensQuery? options]) =>
this.watchQuery(options ?? WatchOptions$Query$GetApiTokensQuery());
void writeQuery$GetApiTokensQuery(
{required Query$GetApiTokensQuery data, bool broadcast = true}) =>
this.writeQuery(
graphql.Request(
operation: graphql.Operation(
document: documentNodeQueryGetApiTokensQuery)),
data: data.toJson(),
broadcast: broadcast);
Query$GetApiTokensQuery? readQuery$GetApiTokensQuery(
{bool optimistic = true}) {
final result = this.readQuery(
graphql.Request(
operation: graphql.Operation(
document: documentNodeQueryGetApiTokensQuery)),
optimistic: optimistic);
return result == null ? null : Query$GetApiTokensQuery.fromJson(result);
}
}
@JsonSerializable(explicitToJson: true)
class Query$GetApiTokensQuery$api {
Query$GetApiTokensQuery$api(
{required this.devices, required this.$__typename});
@override
factory Query$GetApiTokensQuery$api.fromJson(Map<String, dynamic> json) =>
_$Query$GetApiTokensQuery$apiFromJson(json);
final List<Query$GetApiTokensQuery$api$devices> devices;
@JsonKey(name: '__typename')
final String $__typename;
Map<String, dynamic> toJson() => _$Query$GetApiTokensQuery$apiToJson(this);
int get hashCode {
final l$devices = devices;
final l$$__typename = $__typename;
return Object.hashAll(
[Object.hashAll(l$devices.map((v) => v)), l$$__typename]);
}
@override
bool operator ==(Object other) {
if (identical(this, other)) return true;
if (!(other is Query$GetApiTokensQuery$api) ||
runtimeType != other.runtimeType) return false;
final l$devices = devices;
final lOther$devices = other.devices;
if (l$devices.length != lOther$devices.length) return false;
for (int i = 0; i < l$devices.length; i++) {
final l$devices$entry = l$devices[i];
final lOther$devices$entry = lOther$devices[i];
if (l$devices$entry != lOther$devices$entry) return false;
}
final l$$__typename = $__typename;
final lOther$$__typename = other.$__typename;
if (l$$__typename != lOther$$__typename) return false;
return true;
}
}
extension UtilityExtension$Query$GetApiTokensQuery$api
on Query$GetApiTokensQuery$api {
CopyWith$Query$GetApiTokensQuery$api<Query$GetApiTokensQuery$api>
get copyWith => CopyWith$Query$GetApiTokensQuery$api(this, (i) => i);
}
abstract class CopyWith$Query$GetApiTokensQuery$api<TRes> {
factory CopyWith$Query$GetApiTokensQuery$api(
Query$GetApiTokensQuery$api instance,
TRes Function(Query$GetApiTokensQuery$api) then) =
_CopyWithImpl$Query$GetApiTokensQuery$api;
factory CopyWith$Query$GetApiTokensQuery$api.stub(TRes res) =
_CopyWithStubImpl$Query$GetApiTokensQuery$api;
TRes call(
{List<Query$GetApiTokensQuery$api$devices>? devices,
String? $__typename});
TRes devices(
Iterable<Query$GetApiTokensQuery$api$devices> Function(
Iterable<
CopyWith$Query$GetApiTokensQuery$api$devices<
Query$GetApiTokensQuery$api$devices>>)
_fn);
}
class _CopyWithImpl$Query$GetApiTokensQuery$api<TRes>
implements CopyWith$Query$GetApiTokensQuery$api<TRes> {
_CopyWithImpl$Query$GetApiTokensQuery$api(this._instance, this._then);
final Query$GetApiTokensQuery$api _instance;
final TRes Function(Query$GetApiTokensQuery$api) _then;
static const _undefined = {};
TRes call({Object? devices = _undefined, Object? $__typename = _undefined}) =>
_then(Query$GetApiTokensQuery$api(
devices: devices == _undefined || devices == null
? _instance.devices
: (devices as List<Query$GetApiTokensQuery$api$devices>),
$__typename: $__typename == _undefined || $__typename == null
? _instance.$__typename
: ($__typename as String)));
TRes devices(
Iterable<Query$GetApiTokensQuery$api$devices> Function(
Iterable<
CopyWith$Query$GetApiTokensQuery$api$devices<
Query$GetApiTokensQuery$api$devices>>)
_fn) =>
call(
devices: _fn(_instance.devices.map((e) =>
CopyWith$Query$GetApiTokensQuery$api$devices(e, (i) => i)))
.toList());
}
class _CopyWithStubImpl$Query$GetApiTokensQuery$api<TRes>
implements CopyWith$Query$GetApiTokensQuery$api<TRes> {
_CopyWithStubImpl$Query$GetApiTokensQuery$api(this._res);
TRes _res;
call(
{List<Query$GetApiTokensQuery$api$devices>? devices,
String? $__typename}) =>
_res;
devices(_fn) => _res;
}
@JsonSerializable(explicitToJson: true)
class Query$GetApiTokensQuery$api$devices {
Query$GetApiTokensQuery$api$devices(
{required this.creationDate,
required this.isCaller,
required this.name,
required this.$__typename});
@override
factory Query$GetApiTokensQuery$api$devices.fromJson(
Map<String, dynamic> json) =>
_$Query$GetApiTokensQuery$api$devicesFromJson(json);
@JsonKey(fromJson: dateTimeFromJson, toJson: dateTimeToJson)
final DateTime creationDate;
final bool isCaller;
final String name;
@JsonKey(name: '__typename')
final String $__typename;
Map<String, dynamic> toJson() =>
_$Query$GetApiTokensQuery$api$devicesToJson(this);
int get hashCode {
final l$creationDate = creationDate;
final l$isCaller = isCaller;
final l$name = name;
final l$$__typename = $__typename;
return Object.hashAll([l$creationDate, l$isCaller, l$name, l$$__typename]);
}
@override
bool operator ==(Object other) {
if (identical(this, other)) return true;
if (!(other is Query$GetApiTokensQuery$api$devices) ||
runtimeType != other.runtimeType) return false;
final l$creationDate = creationDate;
final lOther$creationDate = other.creationDate;
if (l$creationDate != lOther$creationDate) return false;
final l$isCaller = isCaller;
final lOther$isCaller = other.isCaller;
if (l$isCaller != lOther$isCaller) return false;
final l$name = name;
final lOther$name = other.name;
if (l$name != lOther$name) return false;
final l$$__typename = $__typename;
final lOther$$__typename = other.$__typename;
if (l$$__typename != lOther$$__typename) return false;
return true;
}
}
extension UtilityExtension$Query$GetApiTokensQuery$api$devices
on Query$GetApiTokensQuery$api$devices {
CopyWith$Query$GetApiTokensQuery$api$devices<
Query$GetApiTokensQuery$api$devices>
get copyWith =>
CopyWith$Query$GetApiTokensQuery$api$devices(this, (i) => i);
}
abstract class CopyWith$Query$GetApiTokensQuery$api$devices<TRes> {
factory CopyWith$Query$GetApiTokensQuery$api$devices(
Query$GetApiTokensQuery$api$devices instance,
TRes Function(Query$GetApiTokensQuery$api$devices) then) =
_CopyWithImpl$Query$GetApiTokensQuery$api$devices;
factory CopyWith$Query$GetApiTokensQuery$api$devices.stub(TRes res) =
_CopyWithStubImpl$Query$GetApiTokensQuery$api$devices;
TRes call(
{DateTime? creationDate,
bool? isCaller,
String? name,
String? $__typename});
}
class _CopyWithImpl$Query$GetApiTokensQuery$api$devices<TRes>
implements CopyWith$Query$GetApiTokensQuery$api$devices<TRes> {
_CopyWithImpl$Query$GetApiTokensQuery$api$devices(this._instance, this._then);
final Query$GetApiTokensQuery$api$devices _instance;
final TRes Function(Query$GetApiTokensQuery$api$devices) _then;
static const _undefined = {};
TRes call(
{Object? creationDate = _undefined,
Object? isCaller = _undefined,
Object? name = _undefined,
Object? $__typename = _undefined}) =>
_then(Query$GetApiTokensQuery$api$devices(
creationDate: creationDate == _undefined || creationDate == null
? _instance.creationDate
: (creationDate as DateTime),
isCaller: isCaller == _undefined || isCaller == null
? _instance.isCaller
: (isCaller as bool),
name: name == _undefined || name == null
? _instance.name
: (name as String),
$__typename: $__typename == _undefined || $__typename == null
? _instance.$__typename
: ($__typename as String)));
}
class _CopyWithStubImpl$Query$GetApiTokensQuery$api$devices<TRes>
implements CopyWith$Query$GetApiTokensQuery$api$devices<TRes> {
_CopyWithStubImpl$Query$GetApiTokensQuery$api$devices(this._res);
TRes _res;
call(
{DateTime? creationDate,
bool? isCaller,
String? name,
String? $__typename}) =>
_res;
}

View File

@ -14,6 +14,13 @@ Query$GetApiTokensQuery _$Query$GetApiTokensQueryFromJson(
$__typename: json['__typename'] as String,
);
Map<String, dynamic> _$Query$GetApiTokensQueryToJson(
Query$GetApiTokensQuery instance) =>
<String, dynamic>{
'api': instance.api.toJson(),
'__typename': instance.$__typename,
};
Query$GetApiTokensQuery$api _$Query$GetApiTokensQuery$apiFromJson(
Map<String, dynamic> json) =>
Query$GetApiTokensQuery$api(
@ -24,6 +31,13 @@ Query$GetApiTokensQuery$api _$Query$GetApiTokensQuery$apiFromJson(
$__typename: json['__typename'] as String,
);
Map<String, dynamic> _$Query$GetApiTokensQuery$apiToJson(
Query$GetApiTokensQuery$api instance) =>
<String, dynamic>{
'devices': instance.devices.map((e) => e.toJson()).toList(),
'__typename': instance.$__typename,
};
Query$GetApiTokensQuery$api$devices
_$Query$GetApiTokensQuery$api$devicesFromJson(Map<String, dynamic> json) =>
Query$GetApiTokensQuery$api$devices(
@ -32,3 +46,12 @@ Query$GetApiTokensQuery$api$devices
name: json['name'] as String,
$__typename: json['__typename'] as String,
);
Map<String, dynamic> _$Query$GetApiTokensQuery$api$devicesToJson(
Query$GetApiTokensQuery$api$devices instance) =>
<String, dynamic>{
'creationDate': dateTimeToJson(instance.creationDate),
'isCaller': instance.isCaller,
'name': instance.name,
'__typename': instance.$__typename,
};

View File

@ -0,0 +1,301 @@
import 'package:gql/ast.dart';
import 'package:graphql/client.dart' as graphql;
import 'package:json_annotation/json_annotation.dart';
part 'get_api_version.graphql.g.dart';
@JsonSerializable(explicitToJson: true)
class Query$GetApiVersionQuery {
Query$GetApiVersionQuery({required this.api, required this.$__typename});
@override
factory Query$GetApiVersionQuery.fromJson(Map<String, dynamic> json) =>
_$Query$GetApiVersionQueryFromJson(json);
final Query$GetApiVersionQuery$api api;
@JsonKey(name: '__typename')
final String $__typename;
Map<String, dynamic> toJson() => _$Query$GetApiVersionQueryToJson(this);
int get hashCode {
final l$api = api;
final l$$__typename = $__typename;
return Object.hashAll([l$api, l$$__typename]);
}
@override
bool operator ==(Object other) {
if (identical(this, other)) return true;
if (!(other is Query$GetApiVersionQuery) ||
runtimeType != other.runtimeType) return false;
final l$api = api;
final lOther$api = other.api;
if (l$api != lOther$api) return false;
final l$$__typename = $__typename;
final lOther$$__typename = other.$__typename;
if (l$$__typename != lOther$$__typename) return false;
return true;
}
}
extension UtilityExtension$Query$GetApiVersionQuery
on Query$GetApiVersionQuery {
CopyWith$Query$GetApiVersionQuery<Query$GetApiVersionQuery> get copyWith =>
CopyWith$Query$GetApiVersionQuery(this, (i) => i);
}
abstract class CopyWith$Query$GetApiVersionQuery<TRes> {
factory CopyWith$Query$GetApiVersionQuery(Query$GetApiVersionQuery instance,
TRes Function(Query$GetApiVersionQuery) then) =
_CopyWithImpl$Query$GetApiVersionQuery;
factory CopyWith$Query$GetApiVersionQuery.stub(TRes res) =
_CopyWithStubImpl$Query$GetApiVersionQuery;
TRes call({Query$GetApiVersionQuery$api? api, String? $__typename});
CopyWith$Query$GetApiVersionQuery$api<TRes> get api;
}
class _CopyWithImpl$Query$GetApiVersionQuery<TRes>
implements CopyWith$Query$GetApiVersionQuery<TRes> {
_CopyWithImpl$Query$GetApiVersionQuery(this._instance, this._then);
final Query$GetApiVersionQuery _instance;
final TRes Function(Query$GetApiVersionQuery) _then;
static const _undefined = {};
TRes call({Object? api = _undefined, Object? $__typename = _undefined}) =>
_then(Query$GetApiVersionQuery(
api: api == _undefined || api == null
? _instance.api
: (api as Query$GetApiVersionQuery$api),
$__typename: $__typename == _undefined || $__typename == null
? _instance.$__typename
: ($__typename as String)));
CopyWith$Query$GetApiVersionQuery$api<TRes> get api {
final local$api = _instance.api;
return CopyWith$Query$GetApiVersionQuery$api(
local$api, (e) => call(api: e));
}
}
class _CopyWithStubImpl$Query$GetApiVersionQuery<TRes>
implements CopyWith$Query$GetApiVersionQuery<TRes> {
_CopyWithStubImpl$Query$GetApiVersionQuery(this._res);
TRes _res;
call({Query$GetApiVersionQuery$api? api, String? $__typename}) => _res;
CopyWith$Query$GetApiVersionQuery$api<TRes> get api =>
CopyWith$Query$GetApiVersionQuery$api.stub(_res);
}
const documentNodeQueryGetApiVersionQuery = DocumentNode(definitions: [
OperationDefinitionNode(
type: OperationType.query,
name: NameNode(value: 'GetApiVersionQuery'),
variableDefinitions: [],
directives: [],
selectionSet: SelectionSetNode(selections: [
FieldNode(
name: NameNode(value: 'api'),
alias: null,
arguments: [],
directives: [],
selectionSet: SelectionSetNode(selections: [
FieldNode(
name: NameNode(value: 'version'),
alias: null,
arguments: [],
directives: [],
selectionSet: null),
FieldNode(
name: NameNode(value: '__typename'),
alias: null,
arguments: [],
directives: [],
selectionSet: null)
])),
FieldNode(
name: NameNode(value: '__typename'),
alias: null,
arguments: [],
directives: [],
selectionSet: null)
])),
]);
Query$GetApiVersionQuery _parserFn$Query$GetApiVersionQuery(
Map<String, dynamic> data) =>
Query$GetApiVersionQuery.fromJson(data);
class Options$Query$GetApiVersionQuery
extends graphql.QueryOptions<Query$GetApiVersionQuery> {
Options$Query$GetApiVersionQuery(
{String? operationName,
graphql.FetchPolicy? fetchPolicy,
graphql.ErrorPolicy? errorPolicy,
graphql.CacheRereadPolicy? cacheRereadPolicy,
Object? optimisticResult,
Duration? pollInterval,
graphql.Context? context})
: super(
operationName: operationName,
fetchPolicy: fetchPolicy,
errorPolicy: errorPolicy,
cacheRereadPolicy: cacheRereadPolicy,
optimisticResult: optimisticResult,
pollInterval: pollInterval,
context: context,
document: documentNodeQueryGetApiVersionQuery,
parserFn: _parserFn$Query$GetApiVersionQuery);
}
class WatchOptions$Query$GetApiVersionQuery
extends graphql.WatchQueryOptions<Query$GetApiVersionQuery> {
WatchOptions$Query$GetApiVersionQuery(
{String? operationName,
graphql.FetchPolicy? fetchPolicy,
graphql.ErrorPolicy? errorPolicy,
graphql.CacheRereadPolicy? cacheRereadPolicy,
Object? optimisticResult,
graphql.Context? context,
Duration? pollInterval,
bool? eagerlyFetchResults,
bool carryForwardDataOnException = true,
bool fetchResults = false})
: super(
operationName: operationName,
fetchPolicy: fetchPolicy,
errorPolicy: errorPolicy,
cacheRereadPolicy: cacheRereadPolicy,
optimisticResult: optimisticResult,
context: context,
document: documentNodeQueryGetApiVersionQuery,
pollInterval: pollInterval,
eagerlyFetchResults: eagerlyFetchResults,
carryForwardDataOnException: carryForwardDataOnException,
fetchResults: fetchResults,
parserFn: _parserFn$Query$GetApiVersionQuery);
}
class FetchMoreOptions$Query$GetApiVersionQuery
extends graphql.FetchMoreOptions {
FetchMoreOptions$Query$GetApiVersionQuery(
{required graphql.UpdateQuery updateQuery})
: super(
updateQuery: updateQuery,
document: documentNodeQueryGetApiVersionQuery);
}
extension ClientExtension$Query$GetApiVersionQuery on graphql.GraphQLClient {
Future<graphql.QueryResult<Query$GetApiVersionQuery>>
query$GetApiVersionQuery(
[Options$Query$GetApiVersionQuery? options]) async =>
await this.query(options ?? Options$Query$GetApiVersionQuery());
graphql.ObservableQuery<Query$GetApiVersionQuery>
watchQuery$GetApiVersionQuery(
[WatchOptions$Query$GetApiVersionQuery? options]) =>
this.watchQuery(options ?? WatchOptions$Query$GetApiVersionQuery());
void writeQuery$GetApiVersionQuery(
{required Query$GetApiVersionQuery data, bool broadcast = true}) =>
this.writeQuery(
graphql.Request(
operation: graphql.Operation(
document: documentNodeQueryGetApiVersionQuery)),
data: data.toJson(),
broadcast: broadcast);
Query$GetApiVersionQuery? readQuery$GetApiVersionQuery(
{bool optimistic = true}) {
final result = this.readQuery(
graphql.Request(
operation: graphql.Operation(
document: documentNodeQueryGetApiVersionQuery)),
optimistic: optimistic);
return result == null ? null : Query$GetApiVersionQuery.fromJson(result);
}
}
@JsonSerializable(explicitToJson: true)
class Query$GetApiVersionQuery$api {
Query$GetApiVersionQuery$api(
{required this.version, required this.$__typename});
@override
factory Query$GetApiVersionQuery$api.fromJson(Map<String, dynamic> json) =>
_$Query$GetApiVersionQuery$apiFromJson(json);
final String version;
@JsonKey(name: '__typename')
final String $__typename;
Map<String, dynamic> toJson() => _$Query$GetApiVersionQuery$apiToJson(this);
int get hashCode {
final l$version = version;
final l$$__typename = $__typename;
return Object.hashAll([l$version, l$$__typename]);
}
@override
bool operator ==(Object other) {
if (identical(this, other)) return true;
if (!(other is Query$GetApiVersionQuery$api) ||
runtimeType != other.runtimeType) return false;
final l$version = version;
final lOther$version = other.version;
if (l$version != lOther$version) return false;
final l$$__typename = $__typename;
final lOther$$__typename = other.$__typename;
if (l$$__typename != lOther$$__typename) return false;
return true;
}
}
extension UtilityExtension$Query$GetApiVersionQuery$api
on Query$GetApiVersionQuery$api {
CopyWith$Query$GetApiVersionQuery$api<Query$GetApiVersionQuery$api>
get copyWith => CopyWith$Query$GetApiVersionQuery$api(this, (i) => i);
}
abstract class CopyWith$Query$GetApiVersionQuery$api<TRes> {
factory CopyWith$Query$GetApiVersionQuery$api(
Query$GetApiVersionQuery$api instance,
TRes Function(Query$GetApiVersionQuery$api) then) =
_CopyWithImpl$Query$GetApiVersionQuery$api;
factory CopyWith$Query$GetApiVersionQuery$api.stub(TRes res) =
_CopyWithStubImpl$Query$GetApiVersionQuery$api;
TRes call({String? version, String? $__typename});
}
class _CopyWithImpl$Query$GetApiVersionQuery$api<TRes>
implements CopyWith$Query$GetApiVersionQuery$api<TRes> {
_CopyWithImpl$Query$GetApiVersionQuery$api(this._instance, this._then);
final Query$GetApiVersionQuery$api _instance;
final TRes Function(Query$GetApiVersionQuery$api) _then;
static const _undefined = {};
TRes call({Object? version = _undefined, Object? $__typename = _undefined}) =>
_then(Query$GetApiVersionQuery$api(
version: version == _undefined || version == null
? _instance.version
: (version as String),
$__typename: $__typename == _undefined || $__typename == null
? _instance.$__typename
: ($__typename as String)));
}
class _CopyWithStubImpl$Query$GetApiVersionQuery$api<TRes>
implements CopyWith$Query$GetApiVersionQuery$api<TRes> {
_CopyWithStubImpl$Query$GetApiVersionQuery$api(this._res);
TRes _res;
call({String? version, String? $__typename}) => _res;
}

View File

@ -14,9 +14,23 @@ Query$GetApiVersionQuery _$Query$GetApiVersionQueryFromJson(
$__typename: json['__typename'] as String,
);
Map<String, dynamic> _$Query$GetApiVersionQueryToJson(
Query$GetApiVersionQuery instance) =>
<String, dynamic>{
'api': instance.api.toJson(),
'__typename': instance.$__typename,
};
Query$GetApiVersionQuery$api _$Query$GetApiVersionQuery$apiFromJson(
Map<String, dynamic> json) =>
Query$GetApiVersionQuery$api(
version: json['version'] as String,
$__typename: json['__typename'] as String,
);
Map<String, dynamic> _$Query$GetApiVersionQuery$apiToJson(
Query$GetApiVersionQuery$api instance) =>
<String, dynamic>{
'version': instance.version,
'__typename': instance.$__typename,
};

View File

@ -0,0 +1,274 @@
import 'package:json_annotation/json_annotation.dart';
import 'package:selfprivacy/utils/scalars.dart';
part 'schema.graphql.g.dart';
@JsonSerializable(explicitToJson: true)
class Input$RecoveryKeyLimitsInput {
Input$RecoveryKeyLimitsInput({this.expirationDate, this.uses});
@override
factory Input$RecoveryKeyLimitsInput.fromJson(Map<String, dynamic> json) =>
_$Input$RecoveryKeyLimitsInputFromJson(json);
@JsonKey(
fromJson: _nullable$dateTimeFromJson, toJson: _nullable$dateTimeToJson)
final DateTime? expirationDate;
final int? uses;
Map<String, dynamic> toJson() => _$Input$RecoveryKeyLimitsInputToJson(this);
int get hashCode {
final l$expirationDate = expirationDate;
final l$uses = uses;
return Object.hashAll([l$expirationDate, l$uses]);
}
@override
bool operator ==(Object other) {
if (identical(this, other)) return true;
if (!(other is Input$RecoveryKeyLimitsInput) ||
runtimeType != other.runtimeType) return false;
final l$expirationDate = expirationDate;
final lOther$expirationDate = other.expirationDate;
if (l$expirationDate != lOther$expirationDate) return false;
final l$uses = uses;
final lOther$uses = other.uses;
if (l$uses != lOther$uses) return false;
return true;
}
CopyWith$Input$RecoveryKeyLimitsInput<Input$RecoveryKeyLimitsInput>
get copyWith => CopyWith$Input$RecoveryKeyLimitsInput(this, (i) => i);
}
abstract class CopyWith$Input$RecoveryKeyLimitsInput<TRes> {
factory CopyWith$Input$RecoveryKeyLimitsInput(
Input$RecoveryKeyLimitsInput instance,
TRes Function(Input$RecoveryKeyLimitsInput) then) =
_CopyWithImpl$Input$RecoveryKeyLimitsInput;
factory CopyWith$Input$RecoveryKeyLimitsInput.stub(TRes res) =
_CopyWithStubImpl$Input$RecoveryKeyLimitsInput;
TRes call({DateTime? expirationDate, int? uses});
}
class _CopyWithImpl$Input$RecoveryKeyLimitsInput<TRes>
implements CopyWith$Input$RecoveryKeyLimitsInput<TRes> {
_CopyWithImpl$Input$RecoveryKeyLimitsInput(this._instance, this._then);
final Input$RecoveryKeyLimitsInput _instance;
final TRes Function(Input$RecoveryKeyLimitsInput) _then;
static const _undefined = {};
TRes call({Object? expirationDate = _undefined, Object? uses = _undefined}) =>
_then(Input$RecoveryKeyLimitsInput(
expirationDate: expirationDate == _undefined
? _instance.expirationDate
: (expirationDate as DateTime?),
uses: uses == _undefined ? _instance.uses : (uses as int?)));
}
class _CopyWithStubImpl$Input$RecoveryKeyLimitsInput<TRes>
implements CopyWith$Input$RecoveryKeyLimitsInput<TRes> {
_CopyWithStubImpl$Input$RecoveryKeyLimitsInput(this._res);
TRes _res;
call({DateTime? expirationDate, int? uses}) => _res;
}
@JsonSerializable(explicitToJson: true)
class Input$UseNewDeviceKeyInput {
Input$UseNewDeviceKeyInput({required this.key, required this.deviceName});
@override
factory Input$UseNewDeviceKeyInput.fromJson(Map<String, dynamic> json) =>
_$Input$UseNewDeviceKeyInputFromJson(json);
final String key;
final String deviceName;
Map<String, dynamic> toJson() => _$Input$UseNewDeviceKeyInputToJson(this);
int get hashCode {
final l$key = key;
final l$deviceName = deviceName;
return Object.hashAll([l$key, l$deviceName]);
}
@override
bool operator ==(Object other) {
if (identical(this, other)) return true;
if (!(other is Input$UseNewDeviceKeyInput) ||
runtimeType != other.runtimeType) return false;
final l$key = key;
final lOther$key = other.key;
if (l$key != lOther$key) return false;
final l$deviceName = deviceName;
final lOther$deviceName = other.deviceName;
if (l$deviceName != lOther$deviceName) return false;
return true;
}
CopyWith$Input$UseNewDeviceKeyInput<Input$UseNewDeviceKeyInput>
get copyWith => CopyWith$Input$UseNewDeviceKeyInput(this, (i) => i);
}
abstract class CopyWith$Input$UseNewDeviceKeyInput<TRes> {
factory CopyWith$Input$UseNewDeviceKeyInput(
Input$UseNewDeviceKeyInput instance,
TRes Function(Input$UseNewDeviceKeyInput) then) =
_CopyWithImpl$Input$UseNewDeviceKeyInput;
factory CopyWith$Input$UseNewDeviceKeyInput.stub(TRes res) =
_CopyWithStubImpl$Input$UseNewDeviceKeyInput;
TRes call({String? key, String? deviceName});
}
class _CopyWithImpl$Input$UseNewDeviceKeyInput<TRes>
implements CopyWith$Input$UseNewDeviceKeyInput<TRes> {
_CopyWithImpl$Input$UseNewDeviceKeyInput(this._instance, this._then);
final Input$UseNewDeviceKeyInput _instance;
final TRes Function(Input$UseNewDeviceKeyInput) _then;
static const _undefined = {};
TRes call({Object? key = _undefined, Object? deviceName = _undefined}) =>
_then(Input$UseNewDeviceKeyInput(
key: key == _undefined || key == null
? _instance.key
: (key as String),
deviceName: deviceName == _undefined || deviceName == null
? _instance.deviceName
: (deviceName as String)));
}
class _CopyWithStubImpl$Input$UseNewDeviceKeyInput<TRes>
implements CopyWith$Input$UseNewDeviceKeyInput<TRes> {
_CopyWithStubImpl$Input$UseNewDeviceKeyInput(this._res);
TRes _res;
call({String? key, String? deviceName}) => _res;
}
@JsonSerializable(explicitToJson: true)
class Input$UseRecoveryKeyInput {
Input$UseRecoveryKeyInput({required this.key, required this.deviceName});
@override
factory Input$UseRecoveryKeyInput.fromJson(Map<String, dynamic> json) =>
_$Input$UseRecoveryKeyInputFromJson(json);
final String key;
final String deviceName;
Map<String, dynamic> toJson() => _$Input$UseRecoveryKeyInputToJson(this);
int get hashCode {
final l$key = key;
final l$deviceName = deviceName;
return Object.hashAll([l$key, l$deviceName]);
}
@override
bool operator ==(Object other) {
if (identical(this, other)) return true;
if (!(other is Input$UseRecoveryKeyInput) ||
runtimeType != other.runtimeType) return false;
final l$key = key;
final lOther$key = other.key;
if (l$key != lOther$key) return false;
final l$deviceName = deviceName;
final lOther$deviceName = other.deviceName;
if (l$deviceName != lOther$deviceName) return false;
return true;
}
CopyWith$Input$UseRecoveryKeyInput<Input$UseRecoveryKeyInput> get copyWith =>
CopyWith$Input$UseRecoveryKeyInput(this, (i) => i);
}
abstract class CopyWith$Input$UseRecoveryKeyInput<TRes> {
factory CopyWith$Input$UseRecoveryKeyInput(Input$UseRecoveryKeyInput instance,
TRes Function(Input$UseRecoveryKeyInput) then) =
_CopyWithImpl$Input$UseRecoveryKeyInput;
factory CopyWith$Input$UseRecoveryKeyInput.stub(TRes res) =
_CopyWithStubImpl$Input$UseRecoveryKeyInput;
TRes call({String? key, String? deviceName});
}
class _CopyWithImpl$Input$UseRecoveryKeyInput<TRes>
implements CopyWith$Input$UseRecoveryKeyInput<TRes> {
_CopyWithImpl$Input$UseRecoveryKeyInput(this._instance, this._then);
final Input$UseRecoveryKeyInput _instance;
final TRes Function(Input$UseRecoveryKeyInput) _then;
static const _undefined = {};
TRes call({Object? key = _undefined, Object? deviceName = _undefined}) =>
_then(Input$UseRecoveryKeyInput(
key: key == _undefined || key == null
? _instance.key
: (key as String),
deviceName: deviceName == _undefined || deviceName == null
? _instance.deviceName
: (deviceName as String)));
}
class _CopyWithStubImpl$Input$UseRecoveryKeyInput<TRes>
implements CopyWith$Input$UseRecoveryKeyInput<TRes> {
_CopyWithStubImpl$Input$UseRecoveryKeyInput(this._res);
TRes _res;
call({String? key, String? deviceName}) => _res;
}
enum Enum$DnsProvider {
@JsonValue('CLOUDFLARE')
CLOUDFLARE,
$unknown
}
enum Enum$ServerProvider {
@JsonValue('HETZNER')
HETZNER,
$unknown
}
enum Enum$Severity {
@JsonValue('INFO')
INFO,
@JsonValue('WARNING')
WARNING,
@JsonValue('ERROR')
ERROR,
@JsonValue('CRITICAL')
CRITICAL,
@JsonValue('SUCCESS')
SUCCESS,
$unknown
}
const possibleTypesMap = {
'MutationReturnInterface': {
'ApiKeyMutationReturn',
'DeviceApiTokenMutationReturn',
'GenericMutationReturn'
}
};
DateTime? _nullable$dateTimeFromJson(dynamic data) =>
data == null ? null : dateTimeFromJson(data);
dynamic _nullable$dateTimeToJson(DateTime? data) =>
data == null ? null : dateTimeToJson(data);

View File

@ -13,6 +13,13 @@ Input$RecoveryKeyLimitsInput _$Input$RecoveryKeyLimitsInputFromJson(
uses: json['uses'] as int?,
);
Map<String, dynamic> _$Input$RecoveryKeyLimitsInputToJson(
Input$RecoveryKeyLimitsInput instance) =>
<String, dynamic>{
'expirationDate': _nullable$dateTimeToJson(instance.expirationDate),
'uses': instance.uses,
};
Input$UseNewDeviceKeyInput _$Input$UseNewDeviceKeyInputFromJson(
Map<String, dynamic> json) =>
Input$UseNewDeviceKeyInput(
@ -20,9 +27,23 @@ Input$UseNewDeviceKeyInput _$Input$UseNewDeviceKeyInputFromJson(
deviceName: json['deviceName'] as String,
);
Map<String, dynamic> _$Input$UseNewDeviceKeyInputToJson(
Input$UseNewDeviceKeyInput instance) =>
<String, dynamic>{
'key': instance.key,
'deviceName': instance.deviceName,
};
Input$UseRecoveryKeyInput _$Input$UseRecoveryKeyInputFromJson(
Map<String, dynamic> json) =>
Input$UseRecoveryKeyInput(
key: json['key'] as String,
deviceName: json['deviceName'] as String,
);
Map<String, dynamic> _$Input$UseRecoveryKeyInputToJson(
Input$UseRecoveryKeyInput instance) =>
<String, dynamic>{
'key': instance.key,
'deviceName': instance.deviceName,
};

View File

@ -0,0 +1,39 @@
import 'package:graphql/client.dart';
import 'package:selfprivacy/config/get_it_config.dart';
import 'package:selfprivacy/logic/api_maps/graphql_maps/api_map.dart';
import 'package:selfprivacy/logic/api_maps/graphql_maps/schema/get_api_version.graphql.dart';
import 'package:selfprivacy/logic/models/hive/server_domain.dart';
class ServerApi extends ApiMap {
ServerApi({
this.hasLogger = false,
this.isWithToken = true,
this.authToken = '',
}) {
final ServerDomain? serverDomain = getIt<ApiConfigModel>().serverDomain;
rootAddress = serverDomain?.domainName ?? '';
}
@override
bool hasLogger;
@override
bool isWithToken;
@override
String authToken;
@override
String? rootAddress;
Future<String?> getApiVersion() async {
QueryResult response;
final GraphQLClient client = await getClient();
String? apiVersion;
try {
response = await client.query$GetApiVersionQuery();
apiVersion = response.data!['api']['version'];
} catch (e) {
print(e);
}
return apiVersion;
}
}

View File

@ -49,9 +49,8 @@ class ServerApi extends ApiMap {
BaseOptions options = BaseOptions();
if (isWithToken) {
final ServerDomain? cloudFlareDomain =
getIt<ApiConfigModel>().serverDomain;
final String domainName = cloudFlareDomain!.domainName;
final ServerDomain? serverDomain = getIt<ApiConfigModel>().serverDomain;
final String domainName = serverDomain!.domainName;
final String? apiToken = getIt<ApiConfigModel>().serverDetails?.apiToken;
options = BaseOptions(

View File

@ -11,3 +11,9 @@ ApiToken _$ApiTokenFromJson(Map<String, dynamic> json) => ApiToken(
date: DateTime.parse(json['date'] as String),
isCaller: json['is_caller'] as bool,
);
Map<String, dynamic> _$ApiTokenToJson(ApiToken instance) => <String, dynamic>{
'name': instance.name,
'date': instance.date.toIso8601String(),
'is_caller': instance.isCaller,
};

View File

@ -11,12 +11,24 @@ Backup _$BackupFromJson(Map<String, dynamic> json) => Backup(
id: json['short_id'] as String,
);
Map<String, dynamic> _$BackupToJson(Backup instance) => <String, dynamic>{
'time': instance.time.toIso8601String(),
'short_id': instance.id,
};
BackupStatus _$BackupStatusFromJson(Map<String, dynamic> json) => BackupStatus(
status: $enumDecode(_$BackupStatusEnumEnumMap, json['status']),
progress: (json['progress'] as num).toDouble(),
errorMessage: json['error_message'] as String?,
);
Map<String, dynamic> _$BackupStatusToJson(BackupStatus instance) =>
<String, dynamic>{
'status': _$BackupStatusEnumEnumMap[instance.status]!,
'progress': instance.progress,
'error_message': instance.errorMessage,
};
const _$BackupStatusEnumEnumMap = {
BackupStatusEnum.noKey: 'NO_KEY',
BackupStatusEnum.notInitialized: 'NOT_INITIALIZED',

View File

@ -10,3 +10,9 @@ DeviceToken _$DeviceTokenFromJson(Map<String, dynamic> json) => DeviceToken(
device: json['device'] as String,
token: json['token'] as String,
);
Map<String, dynamic> _$DeviceTokenToJson(DeviceToken instance) =>
<String, dynamic>{
'device': instance.device,
'token': instance.token,
};

View File

@ -19,6 +19,18 @@ HetznerServerInfo _$HetznerServerInfoFromJson(Map<String, dynamic> json) =>
(json['volumes'] as List<dynamic>).map((e) => e as int).toList(),
);
Map<String, dynamic> _$HetznerServerInfoToJson(HetznerServerInfo instance) =>
<String, dynamic>{
'id': instance.id,
'name': instance.name,
'status': _$ServerStatusEnumMap[instance.status]!,
'created': instance.created.toIso8601String(),
'volumes': instance.volumes,
'server_type': instance.serverType,
'datacenter': instance.location,
'public_net': instance.publicNet,
};
const _$ServerStatusEnumMap = {
ServerStatus.running: 'running',
ServerStatus.initializing: 'initializing',
@ -37,6 +49,12 @@ HetznerPublicNetInfo _$HetznerPublicNetInfoFromJson(
HetznerIp4.fromJson(json['ipv4'] as Map<String, dynamic>),
);
Map<String, dynamic> _$HetznerPublicNetInfoToJson(
HetznerPublicNetInfo instance) =>
<String, dynamic>{
'ipv4': instance.ipv4,
};
HetznerIp4 _$HetznerIp4FromJson(Map<String, dynamic> json) => HetznerIp4(
json['id'] as int,
json['ip'] as String,
@ -44,6 +62,14 @@ HetznerIp4 _$HetznerIp4FromJson(Map<String, dynamic> json) => HetznerIp4(
json['dns_ptr'] as String,
);
Map<String, dynamic> _$HetznerIp4ToJson(HetznerIp4 instance) =>
<String, dynamic>{
'blocked': instance.blocked,
'dns_ptr': instance.reverseDns,
'id': instance.id,
'ip': instance.ip,
};
HetznerServerTypeInfo _$HetznerServerTypeInfoFromJson(
Map<String, dynamic> json) =>
HetznerServerTypeInfo(
@ -55,12 +81,27 @@ HetznerServerTypeInfo _$HetznerServerTypeInfoFromJson(
.toList(),
);
Map<String, dynamic> _$HetznerServerTypeInfoToJson(
HetznerServerTypeInfo instance) =>
<String, dynamic>{
'cores': instance.cores,
'memory': instance.memory,
'disk': instance.disk,
'prices': instance.prices,
};
HetznerPriceInfo _$HetznerPriceInfoFromJson(Map<String, dynamic> json) =>
HetznerPriceInfo(
HetznerPriceInfo.getPrice(json['price_hourly'] as Map),
HetznerPriceInfo.getPrice(json['price_monthly'] as Map),
);
Map<String, dynamic> _$HetznerPriceInfoToJson(HetznerPriceInfo instance) =>
<String, dynamic>{
'price_hourly': instance.hourly,
'price_monthly': instance.monthly,
};
HetznerLocation _$HetznerLocationFromJson(Map<String, dynamic> json) =>
HetznerLocation(
json['country'] as String,
@ -68,3 +109,11 @@ HetznerLocation _$HetznerLocationFromJson(Map<String, dynamic> json) =>
json['description'] as String,
json['network_zone'] as String,
);
Map<String, dynamic> _$HetznerLocationToJson(HetznerLocation instance) =>
<String, dynamic>{
'country': instance.country,
'city': instance.city,
'description': instance.description,
'network_zone': instance.zone,
};

View File

@ -17,3 +17,12 @@ RecoveryKeyStatus _$RecoveryKeyStatusFromJson(Map<String, dynamic> json) =>
: DateTime.parse(json['expiration'] as String),
usesLeft: json['uses_left'] as int?,
);
Map<String, dynamic> _$RecoveryKeyStatusToJson(RecoveryKeyStatus instance) =>
<String, dynamic>{
'exists': instance.exists,
'date': instance.date?.toIso8601String(),
'expiration': instance.expiration?.toIso8601String(),
'uses_left': instance.usesLeft,
'valid': instance.valid,
};

View File

@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:selfprivacy/config/brand_theme.dart';
import 'package:selfprivacy/logic/api_maps/graphql_maps/schema/server.dart';
import 'package:selfprivacy/ui/components/brand_divider/brand_divider.dart';
import 'package:selfprivacy/ui/components/brand_header/brand_header.dart';
import 'package:selfprivacy/ui/components/brand_text/brand_text.dart';
@ -23,9 +24,16 @@ class InfoPage extends StatelessWidget {
const BrandDivider(),
const SizedBox(height: 10),
FutureBuilder(
future: _version(),
future: _packageVersion(),
builder: (final context, final snapshot) => BrandText.body1(
'more.about_app_page.text'
'more.about_app_page.application_version_text'
.tr(args: [snapshot.data.toString()]),
),
),
FutureBuilder(
future: _apiVersion(),
builder: (final context, final snapshot) => BrandText.body1(
'more.about_app_page.api_version_text'
.tr(args: [snapshot.data.toString()]),
),
),
@ -34,7 +42,7 @@ class InfoPage extends StatelessWidget {
),
);
Future<String> _version() async {
Future<String> _packageVersion() async {
String packageVersion = 'unknown';
try {
final PackageInfo packageInfo = await PackageInfo.fromPlatform();
@ -45,4 +53,15 @@ class InfoPage extends StatelessWidget {
return packageVersion;
}
Future<String> _apiVersion() async {
String apiVersion = 'unknown';
try {
apiVersion = await ServerApi().getApiVersion() ?? apiVersion;
} catch (e) {
print(e);
}
return apiVersion;
}
}

View File

@ -29,13 +29,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.3.1"
asn1lib:
dependency: transitive
description:
name: asn1lib
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
async:
dependency: transitive
description:
@ -84,7 +77,7 @@ packages:
name: build_config
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
version: "1.1.0"
build_daemon:
dependency: transitive
description:
@ -105,7 +98,7 @@ packages:
name: build_runner
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.11"
version: "2.2.0"
build_runner_core:
dependency: transitive
description:
@ -175,14 +168,14 @@ packages:
name: connectivity_plus
url: "https://pub.dartlang.org"
source: hosted
version: "2.3.5"
version: "2.1.0"
connectivity_plus_linux:
dependency: transitive
description:
name: connectivity_plus_linux
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.1"
version: "1.1.0"
connectivity_plus_macos:
dependency: transitive
description:
@ -203,7 +196,7 @@ packages:
name: connectivity_plus_web
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.2"
version: "1.2.3"
connectivity_plus_windows:
dependency: transitive
description:
@ -246,13 +239,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
cupertino_icons:
dependency: "direct main"
description:
name: cupertino_icons
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.4"
dart_style:
dependency: transitive
description:
@ -266,14 +252,14 @@ packages:
name: dbus
url: "https://pub.dartlang.org"
source: hosted
version: "0.7.3"
version: "0.5.4"
device_info_plus:
dependency: "direct main"
description:
name: device_info_plus
url: "https://pub.dartlang.org"
source: hosted
version: "3.2.3"
version: "4.0.1"
device_info_plus_linux:
dependency: transitive
description:
@ -308,7 +294,7 @@ packages:
name: device_info_plus_windows
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.1"
version: "3.0.1"
dio:
dependency: "direct main"
description:
@ -322,7 +308,7 @@ packages:
name: dynamic_color
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.2"
version: "1.4.0"
easy_localization:
dependency: "direct main"
description:
@ -371,7 +357,7 @@ packages:
name: ffi
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.1"
version: "2.0.1"
file:
dependency: transitive
description:
@ -587,7 +573,7 @@ packages:
name: graphql_codegen
url: "https://pub.dartlang.org"
source: hosted
version: "0.9.0"
version: "0.10.2"
graphql_codegen_config:
dependency: transitive
description:
@ -622,7 +608,7 @@ packages:
name: hive
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
version: "2.2.3"
hive_flutter:
dependency: "direct main"
description:
@ -636,7 +622,7 @@ packages:
name: hive_generator
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.2"
version: "1.1.3"
http:
dependency: transitive
description:
@ -699,14 +685,14 @@ packages:
name: json_annotation
url: "https://pub.dartlang.org"
source: hosted
version: "4.5.0"
version: "4.6.0"
json_serializable:
dependency: "direct dev"
description:
name: json_serializable
url: "https://pub.dartlang.org"
source: hosted
version: "6.2.0"
version: "6.3.1"
lints:
dependency: transitive
description:
@ -818,7 +804,7 @@ packages:
name: nm
url: "https://pub.dartlang.org"
source: hosted
version: "0.5.0"
version: "0.3.0"
node_preamble:
dependency: transitive
description:
@ -881,7 +867,7 @@ packages:
name: path_provider_linux
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.6"
version: "2.1.7"
path_provider_macos:
dependency: transitive
description:
@ -902,7 +888,14 @@ packages:
name: path_provider_windows
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.6"
version: "2.1.0"
pedantic:
dependency: transitive
description:
name: pedantic
url: "https://pub.dartlang.org"
source: hosted
version: "1.11.1"
petitparser:
dependency: transitive
description:
@ -973,13 +966,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
quiver:
dependency: transitive
description:
name: quiver
url: "https://pub.dartlang.org"
source: hosted
version: "3.1.0"
recase:
dependency: transitive
description:
@ -993,7 +979,7 @@ packages:
name: rxdart
url: "https://pub.dartlang.org"
source: hosted
version: "0.27.4"
version: "0.27.5"
share_plus:
dependency: "direct main"
description:
@ -1160,13 +1146,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.2"
ssh_key:
dependency: "direct main"
description:
name: ssh_key
url: "https://pub.dartlang.org"
source: hosted
version: "0.7.1"
stack_trace:
dependency: transitive
description:
@ -1251,13 +1230,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
tuple:
dependency: transitive
description:
name: tuple
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
typed_data:
dependency: transitive
description:
@ -1404,7 +1376,7 @@ packages:
name: win32
url: "https://pub.dartlang.org"
source: hosted
version: "2.6.1"
version: "2.7.0"
xdg_directories:
dependency: transitive
description:

View File

@ -12,10 +12,9 @@ dependencies:
basic_utils: ^4.2.0
crypt: ^4.2.1
cubit_form: ^2.0.1
cupertino_icons: ^1.0.4
device_info_plus: ^3.2.3
device_info_plus: ^4.0.1
dio: ^4.0.4
dynamic_color: ^1.2.2
dynamic_color: ^1.4.0
easy_localization: ^3.0.0
either_option: ^2.0.1-dev.1
equatable: ^2.0.3
@ -28,14 +27,14 @@ dependencies:
get_it: ^7.2.0
gql: ^0.13.1
graphql: ^5.1.1
graphql_codegen: ^0.9.0
graphql_codegen: ^0.10.2
graphql_flutter: ^5.1.0
gtk_theme_fl: ^0.0.1
hive: ^2.0.5
hive: ^2.2.3
hive_flutter: ^1.1.0
intl: ^0.17.0
ionicons: ^0.1.2
json_annotation: ^4.4.0
json_annotation: ^4.6.0
local_auth: ^2.0.2
modal_bottom_sheet: ^2.0.1
nanoid: ^1.0.0
@ -44,7 +43,6 @@ dependencies:
provider: ^6.0.2
pub_semver: ^2.1.1
share_plus: ^4.0.4
ssh_key: ^0.7.1
system_theme: ^2.0.0
timezone: ^0.8.0
url_launcher: ^6.0.20
@ -53,10 +51,10 @@ dependencies:
dev_dependencies:
flutter_test:
sdk: flutter
build_runner: ^2.1.1
build_runner: ^2.2.0
flutter_launcher_icons: ^0.9.2
hive_generator: ^1.0.0
json_serializable: ^6.1.4
hive_generator: ^1.1.3
json_serializable: ^6.3.1
flutter_lints: ^2.0.1
flutter_icons:

View File

@ -7,6 +7,7 @@
#include "generated_plugin_registrant.h"
#include <connectivity_plus_windows/connectivity_plus_windows_plugin.h>
#include <dynamic_color/dynamic_color_plugin_c_api.h>
#include <flutter_secure_storage_windows/flutter_secure_storage_windows_plugin.h>
#include <system_theme/system_theme_plugin.h>
#include <url_launcher_windows/url_launcher_windows.h>
@ -14,6 +15,8 @@
void RegisterPlugins(flutter::PluginRegistry* registry) {
ConnectivityPlusWindowsPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("ConnectivityPlusWindowsPlugin"));
DynamicColorPluginCApiRegisterWithRegistrar(
registry->GetRegistrarForPlugin("DynamicColorPluginCApi"));
FlutterSecureStorageWindowsPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("FlutterSecureStorageWindowsPlugin"));
SystemThemePluginRegisterWithRegistrar(

View File

@ -4,6 +4,7 @@
list(APPEND FLUTTER_PLUGIN_LIST
connectivity_plus_windows
dynamic_color
flutter_secure_storage_windows
system_theme
url_launcher_windows