Skip to content

Commit 651fab2

Browse files
committed
Add server list to models
1 parent 6357d3b commit 651fab2

File tree

10 files changed

+1523
-1309
lines changed

10 files changed

+1523
-1309
lines changed

api/lib/src/models/server.dart

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,13 @@ final class LanGameServer extends GameServer with LanGameServerMappable {
3030
@MappableClass()
3131
final class ListGameServer extends GameServer with ListGameServerMappable {
3232
final String name;
33+
final bool highlighted;
3334

3435
ListGameServer({
3536
this.name = '',
3637
required super.address,
3738
super.secure = true,
39+
this.highlighted = false,
3840
});
3941

4042
@override
@@ -118,3 +120,10 @@ final class ServerState with ServerStateMappable {
118120

119121
const ServerState({this.link, this.players = const []});
120122
}
123+
124+
@MappableClass()
125+
final class ServerList with ServerListMappable {
126+
final List<ListGameServer> servers;
127+
128+
const ServerList({this.servers = const []});
129+
}

api/lib/src/models/server.mapper.dart

Lines changed: 124 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -202,19 +202,24 @@ class ListGameServerMapper extends ClassMapperBase<ListGameServer> {
202202
static bool _$secure(ListGameServer v) => v.secure;
203203
static const Field<ListGameServer, bool> _f$secure =
204204
Field('secure', _$secure, opt: true, def: true);
205+
static bool _$highlighted(ListGameServer v) => v.highlighted;
206+
static const Field<ListGameServer, bool> _f$highlighted =
207+
Field('highlighted', _$highlighted, opt: true, def: false);
205208

206209
@override
207210
final MappableFields<ListGameServer> fields = const {
208211
#name: _f$name,
209212
#address: _f$address,
210213
#secure: _f$secure,
214+
#highlighted: _f$highlighted,
211215
};
212216

213217
static ListGameServer _instantiate(DecodingData data) {
214218
return ListGameServer(
215219
name: data.dec(_f$name),
216220
address: data.dec(_f$address),
217-
secure: data.dec(_f$secure));
221+
secure: data.dec(_f$secure),
222+
highlighted: data.dec(_f$highlighted));
218223
}
219224

220225
@override
@@ -272,7 +277,7 @@ extension ListGameServerValueCopy<$R, $Out>
272277
abstract class ListGameServerCopyWith<$R, $In extends ListGameServer, $Out>
273278
implements GameServerCopyWith<$R, $In, $Out> {
274279
@override
275-
$R call({String? name, String? address, bool? secure});
280+
$R call({String? name, String? address, bool? secure, bool? highlighted});
276281
ListGameServerCopyWith<$R2, $In, $Out2> $chain<$R2, $Out2>(
277282
Then<$Out2, $R2> t);
278283
}
@@ -286,17 +291,19 @@ class _ListGameServerCopyWithImpl<$R, $Out>
286291
late final ClassMapperBase<ListGameServer> $mapper =
287292
ListGameServerMapper.ensureInitialized();
288293
@override
289-
$R call({String? name, String? address, bool? secure}) =>
294+
$R call({String? name, String? address, bool? secure, bool? highlighted}) =>
290295
$apply(FieldCopyWithData({
291296
if (name != null) #name: name,
292297
if (address != null) #address: address,
293-
if (secure != null) #secure: secure
298+
if (secure != null) #secure: secure,
299+
if (highlighted != null) #highlighted: highlighted
294300
}));
295301
@override
296302
ListGameServer $make(CopyWithData data) => ListGameServer(
297303
name: data.get(#name, or: $value.name),
298304
address: data.get(#address, or: $value.address),
299-
secure: data.get(#secure, or: $value.secure));
305+
secure: data.get(#secure, or: $value.secure),
306+
highlighted: data.get(#highlighted, or: $value.highlighted));
300307

301308
@override
302309
ListGameServerCopyWith<$R2, ListGameServer, $Out2> $chain<$R2, $Out2>(
@@ -993,3 +1000,115 @@ class _ServerStateCopyWithImpl<$R, $Out>
9931000
Then<$Out2, $R2> t) =>
9941001
_ServerStateCopyWithImpl<$R2, $Out2>($value, $cast, t);
9951002
}
1003+
1004+
class ServerListMapper extends ClassMapperBase<ServerList> {
1005+
ServerListMapper._();
1006+
1007+
static ServerListMapper? _instance;
1008+
static ServerListMapper ensureInitialized() {
1009+
if (_instance == null) {
1010+
MapperContainer.globals.use(_instance = ServerListMapper._());
1011+
ListGameServerMapper.ensureInitialized();
1012+
}
1013+
return _instance!;
1014+
}
1015+
1016+
@override
1017+
final String id = 'ServerList';
1018+
1019+
static List<ListGameServer> _$servers(ServerList v) => v.servers;
1020+
static const Field<ServerList, List<ListGameServer>> _f$servers =
1021+
Field('servers', _$servers, opt: true, def: const []);
1022+
1023+
@override
1024+
final MappableFields<ServerList> fields = const {
1025+
#servers: _f$servers,
1026+
};
1027+
1028+
static ServerList _instantiate(DecodingData data) {
1029+
return ServerList(servers: data.dec(_f$servers));
1030+
}
1031+
1032+
@override
1033+
final Function instantiate = _instantiate;
1034+
1035+
static ServerList fromMap(Map<String, dynamic> map) {
1036+
return ensureInitialized().decodeMap<ServerList>(map);
1037+
}
1038+
1039+
static ServerList fromJson(String json) {
1040+
return ensureInitialized().decodeJson<ServerList>(json);
1041+
}
1042+
}
1043+
1044+
mixin ServerListMappable {
1045+
String toJson() {
1046+
return ServerListMapper.ensureInitialized()
1047+
.encodeJson<ServerList>(this as ServerList);
1048+
}
1049+
1050+
Map<String, dynamic> toMap() {
1051+
return ServerListMapper.ensureInitialized()
1052+
.encodeMap<ServerList>(this as ServerList);
1053+
}
1054+
1055+
ServerListCopyWith<ServerList, ServerList, ServerList> get copyWith =>
1056+
_ServerListCopyWithImpl<ServerList, ServerList>(
1057+
this as ServerList, $identity, $identity);
1058+
@override
1059+
String toString() {
1060+
return ServerListMapper.ensureInitialized()
1061+
.stringifyValue(this as ServerList);
1062+
}
1063+
1064+
@override
1065+
bool operator ==(Object other) {
1066+
return ServerListMapper.ensureInitialized()
1067+
.equalsValue(this as ServerList, other);
1068+
}
1069+
1070+
@override
1071+
int get hashCode {
1072+
return ServerListMapper.ensureInitialized().hashValue(this as ServerList);
1073+
}
1074+
}
1075+
1076+
extension ServerListValueCopy<$R, $Out>
1077+
on ObjectCopyWith<$R, ServerList, $Out> {
1078+
ServerListCopyWith<$R, ServerList, $Out> get $asServerList =>
1079+
$base.as((v, t, t2) => _ServerListCopyWithImpl<$R, $Out>(v, t, t2));
1080+
}
1081+
1082+
abstract class ServerListCopyWith<$R, $In extends ServerList, $Out>
1083+
implements ClassCopyWith<$R, $In, $Out> {
1084+
ListCopyWith<$R, ListGameServer,
1085+
ListGameServerCopyWith<$R, ListGameServer, ListGameServer>> get servers;
1086+
$R call({List<ListGameServer>? servers});
1087+
ServerListCopyWith<$R2, $In, $Out2> $chain<$R2, $Out2>(Then<$Out2, $R2> t);
1088+
}
1089+
1090+
class _ServerListCopyWithImpl<$R, $Out>
1091+
extends ClassCopyWithBase<$R, ServerList, $Out>
1092+
implements ServerListCopyWith<$R, ServerList, $Out> {
1093+
_ServerListCopyWithImpl(super.value, super.then, super.then2);
1094+
1095+
@override
1096+
late final ClassMapperBase<ServerList> $mapper =
1097+
ServerListMapper.ensureInitialized();
1098+
@override
1099+
ListCopyWith<$R, ListGameServer,
1100+
ListGameServerCopyWith<$R, ListGameServer, ListGameServer>>
1101+
get servers => ListCopyWith($value.servers,
1102+
(v, t) => v.copyWith.$chain(t), (v) => call(servers: v));
1103+
@override
1104+
$R call({List<ListGameServer>? servers}) =>
1105+
$apply(FieldCopyWithData({if (servers != null) #servers: servers}));
1106+
@override
1107+
ServerList $make(CopyWithData data) =>
1108+
ServerList(servers: data.get(#servers, or: $value.servers));
1109+
1110+
@override
1111+
ServerListCopyWith<$R2, ServerList, $Out2> $chain<$R2, $Out2>(
1112+
Then<$Out2, $R2> t) =>
1113+
_ServerListCopyWithImpl<$R2, $Out2>($value, $cast, t);
1114+
}

api/pubspec.lock

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ packages:
1313
dependency: transitive
1414
description:
1515
name: analyzer
16-
sha256: f4c21c94eb4623b183c1014a470196b3910701bea9b926e6c91270d756e6fc60
16+
sha256: "904ae5bb474d32c38fb9482e2d925d5454cda04ddd0e55d2e6826bc72f6ba8c0"
1717
url: "https://pub.dev"
1818
source: hosted
19-
version: "7.4.1"
19+
version: "7.4.5"
2020
ansicolor:
2121
dependency: transitive
2222
description:
@@ -29,10 +29,10 @@ packages:
2929
dependency: "direct main"
3030
description:
3131
name: archive
32-
sha256: a7f37ff061d7abc2fcf213554b9dcaca713c5853afa5c065c44888bc9ccaf813
32+
sha256: "2fde1607386ab523f7a36bb3e7edb43bd58e6edaf2ffb29d8a6d578b297fdbbd"
3333
url: "https://pub.dev"
3434
source: hosted
35-
version: "4.0.6"
35+
version: "4.0.7"
3636
args:
3737
dependency: transitive
3838
description:
@@ -246,10 +246,10 @@ packages:
246246
dependency: transitive
247247
description:
248248
name: http
249-
sha256: fe7ab022b76f3034adc518fb6ea04a82387620e19977665ea18d30a1cf43442f
249+
sha256: "2c11f3f94c687ee9bad77c171151672986360b2b001d109814ee7140b2cf261b"
250250
url: "https://pub.dev"
251251
source: hosted
252-
version: "1.3.0"
252+
version: "1.4.0"
253253
http_multi_server:
254254
dependency: transitive
255255
description:
@@ -310,8 +310,8 @@ packages:
310310
dependency: "direct main"
311311
description:
312312
path: "packages/lw_file_system_api"
313-
ref: fcac45caf2dc178a1d81c0f0b633fbe8210a81a5
314-
resolved-ref: fcac45caf2dc178a1d81c0f0b633fbe8210a81a5
313+
ref: "2ecf53489240f055c841d7c8f92fe374cc6a27ae"
314+
resolved-ref: "2ecf53489240f055c841d7c8f92fe374cc6a27ae"
315315
url: "https://github.com/LinwoodDev/dart_pkgs.git"
316316
source: git
317317
version: "1.0.0"
@@ -520,10 +520,10 @@ packages:
520520
dependency: transitive
521521
description:
522522
name: web_socket
523-
sha256: bfe6f435f6ec49cb6c01da1e275ae4228719e59a6b067048c51e72d9d63bcc4b
523+
sha256: "34d64019aa8e36bf9842ac014bb5d2f5586ca73df5e4d9bf5c936975cae6982c"
524524
url: "https://pub.dev"
525525
source: hosted
526-
version: "1.0.0"
526+
version: "1.0.1"
527527
web_socket_channel:
528528
dependency: transitive
529529
description:

api/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ dependencies:
1414
lw_file_system_api:
1515
git:
1616
url: https://github.com/LinwoodDev/dart_pkgs.git
17-
ref: fcac45caf2dc178a1d81c0f0b633fbe8210a81a5
17+
ref: 2ecf53489240f055c841d7c8f92fe374cc6a27ae
1818
path: packages/lw_file_system_api
1919
networker:
2020
git:

app/android/Gemfile.lock

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,18 @@ GEM
1111
artifactory (3.0.17)
1212
atomos (0.1.3)
1313
aws-eventstream (1.3.2)
14-
aws-partitions (1.1090.0)
15-
aws-sdk-core (3.222.2)
14+
aws-partitions (1.1102.0)
15+
aws-sdk-core (3.223.0)
1616
aws-eventstream (~> 1, >= 1.3.0)
1717
aws-partitions (~> 1, >= 1.992.0)
1818
aws-sigv4 (~> 1.9)
1919
base64
2020
jmespath (~> 1, >= 1.6.1)
2121
logger
22-
aws-sdk-kms (1.99.0)
22+
aws-sdk-kms (1.100.0)
2323
aws-sdk-core (~> 3, >= 3.216.0)
2424
aws-sigv4 (~> 1.5)
25-
aws-sdk-s3 (1.183.0)
25+
aws-sdk-s3 (1.185.0)
2626
aws-sdk-core (~> 3, >= 3.216.0)
2727
aws-sdk-kms (~> 1)
2828
aws-sigv4 (~> 1.5)
@@ -71,7 +71,7 @@ GEM
7171
faraday_middleware (1.2.1)
7272
faraday (~> 1.0)
7373
fastimage (2.4.0)
74-
fastlane (2.227.1)
74+
fastlane (2.227.2)
7575
CFPropertyList (>= 2.3, < 4.0.0)
7676
addressable (>= 2.8, < 3.0.0)
7777
artifactory (~> 3.0)
@@ -158,7 +158,7 @@ GEM
158158
httpclient (2.9.0)
159159
mutex_m
160160
jmespath (1.6.2)
161-
json (2.10.2)
161+
json (2.11.3)
162162
jwt (2.10.1)
163163
base64
164164
logger (1.7.0)
@@ -173,7 +173,7 @@ GEM
173173
optparse (0.6.0)
174174
os (1.1.4)
175175
plist (3.7.2)
176-
public_suffix (6.0.1)
176+
public_suffix (6.0.2)
177177
rake (13.2.1)
178178
representable (3.2.0)
179179
declarative (< 0.1.0)
@@ -187,7 +187,7 @@ GEM
187187
screengrab (1.0.0)
188188
fastlane (>= 2.0.0, < 3.0.0)
189189
security (0.1.5)
190-
signet (0.19.0)
190+
signet (0.20.0)
191191
addressable (~> 2.8)
192192
faraday (>= 0.17.5, < 3.a)
193193
jwt (>= 1.5, < 3.0)

0 commit comments

Comments
 (0)