Remove more references to old platform
This commit is contained in:
parent
6e83ce32f8
commit
cc1bcb7a72
19 changed files with 96 additions and 120 deletions
|
@ -10,7 +10,7 @@ import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import 'package:contacts_plus_plus/clients/api_client.dart';
|
import 'package:contacts_plus_plus/clients/api_client.dart';
|
||||||
import 'package:contacts_plus_plus/models/records/asset_upload_data.dart';
|
import 'package:contacts_plus_plus/models/records/asset_upload_data.dart';
|
||||||
import 'package:contacts_plus_plus/models/records/neos_db_asset.dart';
|
import 'package:contacts_plus_plus/models/records/resonite_db_asset.dart';
|
||||||
import 'package:contacts_plus_plus/models/records/preprocess_status.dart';
|
import 'package:contacts_plus_plus/models/records/preprocess_status.dart';
|
||||||
import 'package:contacts_plus_plus/models/records/record.dart';
|
import 'package:contacts_plus_plus/models/records/record.dart';
|
||||||
import 'package:http_parser/http_parser.dart';
|
import 'package:http_parser/http_parser.dart';
|
||||||
|
|
|
@ -2,16 +2,16 @@ import 'dart:async';
|
||||||
|
|
||||||
import 'package:contacts_plus_plus/apis/record_api.dart';
|
import 'package:contacts_plus_plus/apis/record_api.dart';
|
||||||
import 'package:contacts_plus_plus/clients/api_client.dart';
|
import 'package:contacts_plus_plus/clients/api_client.dart';
|
||||||
import 'package:contacts_plus_plus/models/inventory/neos_path.dart';
|
import 'package:contacts_plus_plus/models/inventory/resonite_directory.dart';
|
||||||
import 'package:contacts_plus_plus/models/records/record.dart';
|
import 'package:contacts_plus_plus/models/records/record.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
class InventoryClient extends ChangeNotifier {
|
class InventoryClient extends ChangeNotifier {
|
||||||
final ApiClient apiClient;
|
final ApiClient apiClient;
|
||||||
|
|
||||||
Future<NeosDirectory>? _currentDirectory;
|
Future<ResoniteDirectory>? _currentDirectory;
|
||||||
|
|
||||||
Future<NeosDirectory>? get directoryFuture => _currentDirectory;
|
Future<ResoniteDirectory>? get directoryFuture => _currentDirectory;
|
||||||
|
|
||||||
InventoryClient({required this.apiClient});
|
InventoryClient({required this.apiClient});
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ class InventoryClient extends ChangeNotifier {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<List<Record>> _getDirectory(Record record) async {
|
Future<List<Record>> _getDirectory(Record record) async {
|
||||||
NeosDirectory? dir;
|
ResoniteDirectory? dir;
|
||||||
try {
|
try {
|
||||||
dir = await _currentDirectory;
|
dir = await _currentDirectory;
|
||||||
} catch (_) {}
|
} catch (_) {}
|
||||||
|
@ -59,7 +59,7 @@ class InventoryClient extends ChangeNotifier {
|
||||||
if (dir == null || record.isRoot) {
|
if (dir == null || record.isRoot) {
|
||||||
records = await RecordApi.getUserRecordsAt(
|
records = await RecordApi.getUserRecordsAt(
|
||||||
apiClient,
|
apiClient,
|
||||||
path: NeosDirectory.rootName,
|
path: ResoniteDirectory.rootName,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
if (record.recordType == RecordType.link) {
|
if (record.recordType == RecordType.link) {
|
||||||
|
@ -79,12 +79,12 @@ class InventoryClient extends ChangeNotifier {
|
||||||
final rootRecord = Record.inventoryRoot();
|
final rootRecord = Record.inventoryRoot();
|
||||||
final rootFuture = _getDirectory(rootRecord).then(
|
final rootFuture = _getDirectory(rootRecord).then(
|
||||||
(records) {
|
(records) {
|
||||||
final rootDir = NeosDirectory(
|
final rootDir = ResoniteDirectory(
|
||||||
record: rootRecord,
|
record: rootRecord,
|
||||||
children: [],
|
children: [],
|
||||||
);
|
);
|
||||||
rootDir.children.addAll(
|
rootDir.children.addAll(
|
||||||
records.map((e) => NeosDirectory.fromRecord(record: e, parent: rootDir)).toList(),
|
records.map((e) => ResoniteDirectory.fromRecord(record: e, parent: rootDir)).toList(),
|
||||||
);
|
);
|
||||||
return rootDir;
|
return rootDir;
|
||||||
},
|
},
|
||||||
|
@ -103,8 +103,8 @@ class InventoryClient extends ChangeNotifier {
|
||||||
|
|
||||||
_currentDirectory = _getDirectory(dir.record).then(
|
_currentDirectory = _getDirectory(dir.record).then(
|
||||||
(records) {
|
(records) {
|
||||||
final children = records.map((record) => NeosDirectory.fromRecord(record: record, parent: dir)).toList();
|
final children = records.map((record) => ResoniteDirectory.fromRecord(record: record, parent: dir)).toList();
|
||||||
final newDir = NeosDirectory(record: dir.record, children: children, parent: dir.parent);
|
final newDir = ResoniteDirectory(record: dir.record, children: children, parent: dir.parent);
|
||||||
|
|
||||||
final parentIdx = dir.parent?.children.indexOf(dir) ?? -1;
|
final parentIdx = dir.parent?.children.indexOf(dir) ?? -1;
|
||||||
if (parentIdx != -1) {
|
if (parentIdx != -1) {
|
||||||
|
@ -142,7 +142,7 @@ class InventoryClient extends ChangeNotifier {
|
||||||
_currentDirectory = _getDirectory(record).then(
|
_currentDirectory = _getDirectory(record).then(
|
||||||
(records) {
|
(records) {
|
||||||
childDir.children.clear();
|
childDir.children.clear();
|
||||||
childDir.children.addAll(records.map((record) => NeosDirectory.fromRecord(record: record, parent: childDir)));
|
childDir.children.addAll(records.map((record) => ResoniteDirectory.fromRecord(record: record, parent: childDir)));
|
||||||
return childDir;
|
return childDir;
|
||||||
},
|
},
|
||||||
).onError((error, stackTrace) {
|
).onError((error, stackTrace) {
|
||||||
|
|
|
@ -238,7 +238,7 @@ class MessagingClient extends ChangeNotifier {
|
||||||
|
|
||||||
Future<void> _setupHub() async {
|
Future<void> _setupHub() async {
|
||||||
if (!_apiClient.isAuthenticated) {
|
if (!_apiClient.isAuthenticated) {
|
||||||
_logger.info("Tried to connect to Neos Hub without authentication, this is probably fine for now.");
|
_logger.info("Tried to connect to Resonite Hub without authentication, this is probably fine for now.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_hubManager.setHeaders(_apiClient.authorizationHeader);
|
_hubManager.setHeaders(_apiClient.authorizationHeader);
|
||||||
|
@ -247,6 +247,7 @@ class MessagingClient extends ChangeNotifier {
|
||||||
_hubManager.setHandler(EventTarget.receiveMessage, _onReceiveMessage);
|
_hubManager.setHandler(EventTarget.receiveMessage, _onReceiveMessage);
|
||||||
_hubManager.setHandler(EventTarget.messagesRead, _onMessagesRead);
|
_hubManager.setHandler(EventTarget.messagesRead, _onMessagesRead);
|
||||||
_hubManager.setHandler(EventTarget.receiveStatusUpdate, _onReceiveStatusUpdate);
|
_hubManager.setHandler(EventTarget.receiveStatusUpdate, _onReceiveStatusUpdate);
|
||||||
|
_hubManager.setHandler(EventTarget.receiveSessionUpdate, _onReceiveSessionUpdate);
|
||||||
|
|
||||||
await _hubManager.start();
|
await _hubManager.start();
|
||||||
_hubManager.send(
|
_hubManager.send(
|
||||||
|
@ -311,4 +312,6 @@ class MessagingClient extends ChangeNotifier {
|
||||||
}
|
}
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _onReceiveSessionUpdate(List args) {}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ class HubManager {
|
||||||
|
|
||||||
void _onDisconnected(error) async {
|
void _onDisconnected(error) async {
|
||||||
_wsChannel = null;
|
_wsChannel = null;
|
||||||
_logger.warning("Neos Hub connection died with error '$error', reconnecting...");
|
_logger.warning("Hub connection died with error '$error', reconnecting...");
|
||||||
await start();
|
await start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ class HubManager {
|
||||||
_isConnecting = true;
|
_isConnecting = true;
|
||||||
_wsChannel = await _tryConnect();
|
_wsChannel = await _tryConnect();
|
||||||
_isConnecting = false;
|
_isConnecting = false;
|
||||||
_logger.info("Connected to Neos Hub.");
|
_logger.info("Connected to Resonite Hub.");
|
||||||
_wsChannel!.done.then((error) => _onDisconnected(error));
|
_wsChannel!.done.then((error) => _onDisconnected(error));
|
||||||
_wsChannel!.listen(_handleEvent, onDone: () => _onDisconnected("Connection closed."), onError: _onDisconnected);
|
_wsChannel!.listen(_handleEvent, onDone: () => _onDisconnected("Connection closed."), onError: _onDisconnected);
|
||||||
_wsChannel!.add(_negotiationPacket);
|
_wsChannel!.add(_negotiationPacket);
|
||||||
|
@ -124,7 +124,7 @@ class HubManager {
|
||||||
if (responseHandler != null) {
|
if (responseHandler != null) {
|
||||||
_responseHandlers[invocationId] = responseHandler;
|
_responseHandlers[invocationId] = responseHandler;
|
||||||
}
|
}
|
||||||
if (_wsChannel == null) throw "Neos Hub is not connected";
|
if (_wsChannel == null) throw "Resonite Hub is not connected";
|
||||||
_wsChannel!.add(jsonEncode(data) + _eofChar);
|
_wsChannel!.add(jsonEncode(data) + _eofChar);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,64 +0,0 @@
|
||||||
import 'package:collection/collection.dart';
|
|
||||||
import 'package:contacts_plus_plus/stack.dart';
|
|
||||||
import 'package:contacts_plus_plus/models/records/record.dart';
|
|
||||||
|
|
||||||
|
|
||||||
class NeosPath {
|
|
||||||
static const _root = "Inventory";
|
|
||||||
final Stack<NeosDirectory> _pathStack = Stack<NeosDirectory>();
|
|
||||||
|
|
||||||
String get absolute {
|
|
||||||
if (_pathStack.isEmpty) return _root;
|
|
||||||
var path = _pathStack.entries.join("\\");
|
|
||||||
return "$_root\\$path";
|
|
||||||
}
|
|
||||||
|
|
||||||
NeosDirectory pop() => _pathStack.pop();
|
|
||||||
|
|
||||||
void push(NeosDirectory directory) => _pathStack.push(directory);
|
|
||||||
|
|
||||||
bool get isRoot => _pathStack.isEmpty;
|
|
||||||
|
|
||||||
/*
|
|
||||||
NeosDirectory get current => _pathStack.peek ?? NeosDirectory(name: _root);
|
|
||||||
|
|
||||||
void populateCurrent(String target, Iterable<Record> records) {
|
|
||||||
var currentDir = _pathStack.peek;
|
|
||||||
if (currentDir?.name != target) return;
|
|
||||||
currentDir?.records.addAll(records);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
class NeosDirectory {
|
|
||||||
static const rootName = "Inventory";
|
|
||||||
|
|
||||||
final Record record;
|
|
||||||
final NeosDirectory? parent;
|
|
||||||
final List<NeosDirectory> children;
|
|
||||||
|
|
||||||
NeosDirectory({required this.record, this.parent, required this.children});
|
|
||||||
|
|
||||||
factory NeosDirectory.fromRecord({required Record record, NeosDirectory? parent}) {
|
|
||||||
return NeosDirectory(record: record, parent: parent, children: []);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
String toString() {
|
|
||||||
return record.name;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool get isRoot => record.isRoot;
|
|
||||||
|
|
||||||
String get absolutePath => "${parent?.absolutePath ?? ""}/${(record.name)}";
|
|
||||||
|
|
||||||
List<String> get absolutePathSegments => (parent?.absolutePathSegments ?? []) + [record.name];
|
|
||||||
|
|
||||||
bool containsRecord(Record record) => children.where((element) => element.record.id == record.id).isNotEmpty;
|
|
||||||
|
|
||||||
List<Record> get records => children.map((e) => e.record).toList();
|
|
||||||
|
|
||||||
bool get isLoaded => children.isNotEmpty;
|
|
||||||
|
|
||||||
NeosDirectory? findChildByRecord(Record record) => children.firstWhereOrNull((element) => element.record.id == record.id);
|
|
||||||
}
|
|
36
lib/models/inventory/resonite_directory.dart
Normal file
36
lib/models/inventory/resonite_directory.dart
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
import 'package:collection/collection.dart';
|
||||||
|
import 'package:contacts_plus_plus/stack.dart';
|
||||||
|
import 'package:contacts_plus_plus/models/records/record.dart';
|
||||||
|
|
||||||
|
class ResoniteDirectory {
|
||||||
|
static const rootName = "Inventory";
|
||||||
|
|
||||||
|
final Record record;
|
||||||
|
final ResoniteDirectory? parent;
|
||||||
|
final List<ResoniteDirectory> children;
|
||||||
|
|
||||||
|
ResoniteDirectory({required this.record, this.parent, required this.children});
|
||||||
|
|
||||||
|
factory ResoniteDirectory.fromRecord({required Record record, ResoniteDirectory? parent}) {
|
||||||
|
return ResoniteDirectory(record: record, parent: parent, children: []);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return record.name;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool get isRoot => record.isRoot;
|
||||||
|
|
||||||
|
String get absolutePath => "${parent?.absolutePath ?? ""}/${(record.name)}";
|
||||||
|
|
||||||
|
List<String> get absolutePathSegments => (parent?.absolutePathSegments ?? []) + [record.name];
|
||||||
|
|
||||||
|
bool containsRecord(Record record) => children.where((element) => element.record.id == record.id).isNotEmpty;
|
||||||
|
|
||||||
|
List<Record> get records => children.map((e) => e.record).toList();
|
||||||
|
|
||||||
|
bool get isLoaded => children.isNotEmpty;
|
||||||
|
|
||||||
|
ResoniteDirectory? findChildByRecord(Record record) => children.firstWhereOrNull((element) => element.record.id == record.id);
|
||||||
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
import 'package:contacts_plus_plus/models/records/neos_db_asset.dart';
|
import 'package:contacts_plus_plus/models/records/resonite_db_asset.dart';
|
||||||
|
|
||||||
class AssetDiff extends ResoniteDBAsset{
|
class AssetDiff extends ResoniteDBAsset{
|
||||||
final Diff state;
|
final Diff state;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
import 'dart:typed_data';
|
import 'dart:typed_data';
|
||||||
|
|
||||||
import 'package:contacts_plus_plus/models/records/neos_db_asset.dart';
|
import 'package:contacts_plus_plus/models/records/resonite_db_asset.dart';
|
||||||
import 'package:path/path.dart';
|
import 'package:path/path.dart';
|
||||||
|
|
||||||
class AssetDigest {
|
class AssetDigest {
|
||||||
|
|
|
@ -2,7 +2,7 @@ import 'package:path/path.dart';
|
||||||
import 'package:uuid/uuid.dart';
|
import 'package:uuid/uuid.dart';
|
||||||
|
|
||||||
class JsonTemplate {
|
class JsonTemplate {
|
||||||
static const String thumbUrl = "neosdb:///8ed80703e48c3d1556093927b67298f3d5e10315e9f782ec56fc49d6366f09b7.webp";
|
static const String thumbUrl = "resdb:///8ed80703e48c3d1556093927b67298f3d5e10315e9f782ec56fc49d6366f09b7.webp";
|
||||||
final Map data;
|
final Map data;
|
||||||
|
|
||||||
JsonTemplate({required this.data});
|
JsonTemplate({required this.data});
|
||||||
|
@ -2371,7 +2371,7 @@ class JsonTemplate {
|
||||||
},
|
},
|
||||||
"URL": {
|
"URL": {
|
||||||
"ID": const Uuid().v4(),
|
"ID": const Uuid().v4(),
|
||||||
"Data": "@neosdb:///3738bf6fc560f7d08d872ce12b06f4d9337ac5da415b6de6008a49ca128658ec"
|
"Data": "@resdb:///3738bf6fc560f7d08d872ce12b06f4d9337ac5da415b6de6008a49ca128658ec"
|
||||||
},
|
},
|
||||||
"Readable": {
|
"Readable": {
|
||||||
"ID": const Uuid().v4(),
|
"ID": const Uuid().v4(),
|
||||||
|
@ -2444,7 +2444,7 @@ class JsonTemplate {
|
||||||
},
|
},
|
||||||
"URL": {
|
"URL": {
|
||||||
"ID": const Uuid().v4(),
|
"ID": const Uuid().v4(),
|
||||||
"Data": "@neosdb:///c801b8d2522fb554678f17f4597158b1af3f9be3abd6ce35d5a3112a81e2bf39"
|
"Data": "@resdb:///c801b8d2522fb554678f17f4597158b1af3f9be3abd6ce35d5a3112a81e2bf39"
|
||||||
},
|
},
|
||||||
"Padding": {
|
"Padding": {
|
||||||
"ID": const Uuid().v4(),
|
"ID": const Uuid().v4(),
|
||||||
|
@ -2478,7 +2478,7 @@ class JsonTemplate {
|
||||||
},
|
},
|
||||||
"URL": {
|
"URL": {
|
||||||
"ID": const Uuid().v4(),
|
"ID": const Uuid().v4(),
|
||||||
"Data": "@neosdb:///4cac521169034ddd416c6deffe2eb16234863761837df677a910697ec5babd25"
|
"Data": "@resdb:///4cac521169034ddd416c6deffe2eb16234863761837df677a910697ec5babd25"
|
||||||
},
|
},
|
||||||
"Padding": {
|
"Padding": {
|
||||||
"ID": const Uuid().v4(),
|
"ID": const Uuid().v4(),
|
||||||
|
@ -2512,7 +2512,7 @@ class JsonTemplate {
|
||||||
},
|
},
|
||||||
"URL": {
|
"URL": {
|
||||||
"ID": const Uuid().v4(),
|
"ID": const Uuid().v4(),
|
||||||
"Data": "@neosdb:///23e7ad7cb0a5a4cf75e07c9e0848b1eb06bba15e8fa9b8cb0579fc823c532927"
|
"Data": "@resdb:///23e7ad7cb0a5a4cf75e07c9e0848b1eb06bba15e8fa9b8cb0579fc823c532927"
|
||||||
},
|
},
|
||||||
"Padding": {
|
"Padding": {
|
||||||
"ID": const Uuid().v4(),
|
"ID": const Uuid().v4(),
|
||||||
|
@ -2546,7 +2546,7 @@ class JsonTemplate {
|
||||||
},
|
},
|
||||||
"URL": {
|
"URL": {
|
||||||
"ID": const Uuid().v4(),
|
"ID": const Uuid().v4(),
|
||||||
"Data": "@neosdb:///415dc6290378574135b64c808dc640c1df7531973290c4970c51fdeb849cb0c5"
|
"Data": "@resdb:///415dc6290378574135b64c808dc640c1df7531973290c4970c51fdeb849cb0c5"
|
||||||
},
|
},
|
||||||
"Padding": {
|
"Padding": {
|
||||||
"ID": const Uuid().v4(),
|
"ID": const Uuid().v4(),
|
||||||
|
@ -2580,7 +2580,7 @@ class JsonTemplate {
|
||||||
},
|
},
|
||||||
"URL": {
|
"URL": {
|
||||||
"ID": const Uuid().v4(),
|
"ID": const Uuid().v4(),
|
||||||
"Data": "@neosdb:///bcda0bcc22bab28ea4fedae800bfbf9ec76d71cc3b9f851779a35b7e438a839d"
|
"Data": "@resdb:///bcda0bcc22bab28ea4fedae800bfbf9ec76d71cc3b9f851779a35b7e438a839d"
|
||||||
},
|
},
|
||||||
"Padding": {
|
"Padding": {
|
||||||
"ID": const Uuid().v4(),
|
"ID": const Uuid().v4(),
|
||||||
|
@ -2720,7 +2720,7 @@ class JsonTemplate {
|
||||||
},
|
},
|
||||||
"URL": {
|
"URL": {
|
||||||
"ID": const Uuid().v4(),
|
"ID": const Uuid().v4(),
|
||||||
"Data": "@neosdb:///274f0d4ea4bce93abc224c9ae9f9a97a9a396b382c5338f71c738d1591dd5c35.webp"
|
"Data": "@resdb:///274f0d4ea4bce93abc224c9ae9f9a97a9a396b382c5338f71c738d1591dd5c35.webp"
|
||||||
},
|
},
|
||||||
"FilterMode": {
|
"FilterMode": {
|
||||||
"ID": const Uuid().v4(),
|
"ID": const Uuid().v4(),
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import 'package:contacts_plus_plus/auxiliary.dart';
|
import 'package:contacts_plus_plus/auxiliary.dart';
|
||||||
import 'package:contacts_plus_plus/models/message.dart';
|
import 'package:contacts_plus_plus/models/message.dart';
|
||||||
import 'package:contacts_plus_plus/models/records/asset_digest.dart';
|
import 'package:contacts_plus_plus/models/records/asset_digest.dart';
|
||||||
import 'package:contacts_plus_plus/models/records/neos_db_asset.dart';
|
import 'package:contacts_plus_plus/models/records/resonite_db_asset.dart';
|
||||||
import 'package:contacts_plus_plus/string_formatter.dart';
|
import 'package:contacts_plus_plus/string_formatter.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
|
@ -59,7 +59,7 @@ class Record {
|
||||||
isListed: false,
|
isListed: false,
|
||||||
isForPatreons: false,
|
isForPatreons: false,
|
||||||
lastModificationTime: DateTimeX.epoch,
|
lastModificationTime: DateTimeX.epoch,
|
||||||
neosDBManifest: [],
|
resoniteDBManifest: [],
|
||||||
lastModifyingUserId: "",
|
lastModifyingUserId: "",
|
||||||
lastModifyingMachineId: "",
|
lastModifyingMachineId: "",
|
||||||
creationTime: DateTimeX.epoch,
|
creationTime: DateTimeX.epoch,
|
||||||
|
@ -100,7 +100,7 @@ class Record {
|
||||||
final int rating;
|
final int rating;
|
||||||
final int randomOrder;
|
final int randomOrder;
|
||||||
final List<String> manifest;
|
final List<String> manifest;
|
||||||
final List<ResoniteDBAsset> neosDBManifest;
|
final List<ResoniteDBAsset> resoniteDBManifest;
|
||||||
final String url;
|
final String url;
|
||||||
final bool isValidOwnerId;
|
final bool isValidOwnerId;
|
||||||
final bool isValidRecordId;
|
final bool isValidRecordId;
|
||||||
|
@ -122,7 +122,7 @@ class Record {
|
||||||
required this.isListed,
|
required this.isListed,
|
||||||
required this.isForPatreons,
|
required this.isForPatreons,
|
||||||
required this.lastModificationTime,
|
required this.lastModificationTime,
|
||||||
required this.neosDBManifest,
|
required this.resoniteDBManifest,
|
||||||
required this.lastModifyingUserId,
|
required this.lastModifyingUserId,
|
||||||
required this.lastModifyingMachineId,
|
required this.lastModifyingMachineId,
|
||||||
required this.creationTime,
|
required this.creationTime,
|
||||||
|
@ -160,7 +160,7 @@ class Record {
|
||||||
isPublic: false,
|
isPublic: false,
|
||||||
isForPatreons: false,
|
isForPatreons: false,
|
||||||
isListed: false,
|
isListed: false,
|
||||||
neosDBManifest: digests.map((e) => e.asset).toList(),
|
resoniteDBManifest: digests.map((e) => e.asset).toList(),
|
||||||
globalVersion: 0,
|
globalVersion: 0,
|
||||||
localVersion: 1,
|
localVersion: 1,
|
||||||
lastModifyingUserId: userId,
|
lastModifyingUserId: userId,
|
||||||
|
@ -173,7 +173,7 @@ class Record {
|
||||||
path: '',
|
path: '',
|
||||||
description: '',
|
description: '',
|
||||||
manifest: digests.map((e) => e.dbUri).toList(),
|
manifest: digests.map((e) => e.dbUri).toList(),
|
||||||
url: "neosrec:///$userId/${combinedRecordId.id}",
|
url: "resrec:///$userId/${combinedRecordId.id}",
|
||||||
isValidOwnerId: true,
|
isValidOwnerId: true,
|
||||||
isValidRecordId: true,
|
isValidRecordId: true,
|
||||||
visits: 0,
|
visits: 0,
|
||||||
|
@ -199,14 +199,14 @@ class Record {
|
||||||
isForPatreons: map["isForPatreons"] ?? false,
|
isForPatreons: map["isForPatreons"] ?? false,
|
||||||
isListed: map["isListed"] ?? false,
|
isListed: map["isListed"] ?? false,
|
||||||
lastModificationTime: DateTime.tryParse(map["lastModificationTime"]) ?? DateTimeX.epoch,
|
lastModificationTime: DateTime.tryParse(map["lastModificationTime"]) ?? DateTimeX.epoch,
|
||||||
neosDBManifest: (map["neosDBManifest"] as List? ?? []).map((e) => ResoniteDBAsset.fromMap(e)).toList(),
|
resoniteDBManifest: (map["resoniteDBManifest"] as List? ?? []).map((e) => ResoniteDBAsset.fromMap(e)).toList(),
|
||||||
lastModifyingUserId: map["lastModifyingUserId"] ?? "",
|
lastModifyingUserId: map["lastModifyingUserId"] ?? "",
|
||||||
lastModifyingMachineId: map["lastModifyingMachineId"] ?? "",
|
lastModifyingMachineId: map["lastModifyingMachineId"] ?? "",
|
||||||
creationTime: DateTime.tryParse(map["lastModificationTime"]) ?? DateTimeX.epoch,
|
creationTime: DateTime.tryParse(map["lastModificationTime"]) ?? DateTimeX.epoch,
|
||||||
isSynced: map["isSynced"] ?? false,
|
isSynced: map["isSynced"] ?? false,
|
||||||
fetchedOn: DateTime.tryParse(map["fetchedOn"] ?? "") ?? DateTimeX.epoch,
|
fetchedOn: DateTime.tryParse(map["fetchedOn"] ?? "") ?? DateTimeX.epoch,
|
||||||
path: map["path"] ?? "",
|
path: map["path"] ?? "",
|
||||||
manifest: (map["neosDBManifest"] as List? ?? []).map((e) => e.toString()).toList(),
|
manifest: (map["resoniteDBManifest"] as List? ?? []).map((e) => e.toString()).toList(),
|
||||||
url: map["url"] ?? "",
|
url: map["url"] ?? "",
|
||||||
isValidOwnerId: map["isValidOwnerId"] == "true",
|
isValidOwnerId: map["isValidOwnerId"] == "true",
|
||||||
isValidRecordId: map["isValidRecordId"] == "true",
|
isValidRecordId: map["isValidRecordId"] == "true",
|
||||||
|
@ -220,7 +220,7 @@ class Record {
|
||||||
bool get isRoot => this == _rootRecord;
|
bool get isRoot => this == _rootRecord;
|
||||||
|
|
||||||
String get linkRecordId {
|
String get linkRecordId {
|
||||||
if (!assetUri.startsWith("neosrec")) {
|
if (!assetUri.startsWith("resrec")) {
|
||||||
throw "Record is not a link.";
|
throw "Record is not a link.";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -233,11 +233,11 @@ class Record {
|
||||||
}
|
}
|
||||||
|
|
||||||
String get linkOwnerId {
|
String get linkOwnerId {
|
||||||
if (!assetUri.startsWith("neosrec")) {
|
if (!assetUri.startsWith("resrec")) {
|
||||||
throw "Record is not a link.";
|
throw "Record is not a link.";
|
||||||
}
|
}
|
||||||
|
|
||||||
String ownerId = assetUri.replaceFirst("neosrec:///", "");
|
String ownerId = assetUri.replaceFirst("resrec:///", "");
|
||||||
|
|
||||||
final lastSlashIdx = ownerId.lastIndexOf("/");
|
final lastSlashIdx = ownerId.lastIndexOf("/");
|
||||||
if (lastSlashIdx == -1) {
|
if (lastSlashIdx == -1) {
|
||||||
|
@ -265,7 +265,7 @@ class Record {
|
||||||
bool? isListed,
|
bool? isListed,
|
||||||
bool? isDeleted,
|
bool? isDeleted,
|
||||||
DateTime? lastModificationTime,
|
DateTime? lastModificationTime,
|
||||||
List<ResoniteDBAsset>? neosDBManifest,
|
List<ResoniteDBAsset>? resoniteDBManifest,
|
||||||
String? lastModifyingUserId,
|
String? lastModifyingUserId,
|
||||||
String? lastModifyingMachineId,
|
String? lastModifyingMachineId,
|
||||||
DateTime? creationTime,
|
DateTime? creationTime,
|
||||||
|
@ -296,7 +296,7 @@ class Record {
|
||||||
isForPatreons: isForPatreons ?? this.isForPatreons,
|
isForPatreons: isForPatreons ?? this.isForPatreons,
|
||||||
isListed: isListed ?? this.isListed,
|
isListed: isListed ?? this.isListed,
|
||||||
lastModificationTime: lastModificationTime ?? this.lastModificationTime,
|
lastModificationTime: lastModificationTime ?? this.lastModificationTime,
|
||||||
neosDBManifest: neosDBManifest ?? this.neosDBManifest,
|
resoniteDBManifest: resoniteDBManifest ?? this.resoniteDBManifest,
|
||||||
lastModifyingUserId: lastModifyingUserId ?? this.lastModifyingUserId,
|
lastModifyingUserId: lastModifyingUserId ?? this.lastModifyingUserId,
|
||||||
lastModifyingMachineId: lastModifyingMachineId ?? this.lastModifyingMachineId,
|
lastModifyingMachineId: lastModifyingMachineId ?? this.lastModifyingMachineId,
|
||||||
creationTime: creationTime ?? this.creationTime,
|
creationTime: creationTime ?? this.creationTime,
|
||||||
|
@ -330,7 +330,7 @@ class Record {
|
||||||
"isForPatreons": isForPatreons,
|
"isForPatreons": isForPatreons,
|
||||||
"isListed": isListed,
|
"isListed": isListed,
|
||||||
"lastModificationTime": lastModificationTime.toUtc().toIso8601String(),
|
"lastModificationTime": lastModificationTime.toUtc().toIso8601String(),
|
||||||
"neosDBManifest": neosDBManifest.map((e) => e.toMap()).toList(),
|
"resoniteDBManifest": resoniteDBManifest.map((e) => e.toMap()).toList(),
|
||||||
"lastModifyingUserId": lastModifyingUserId,
|
"lastModifyingUserId": lastModifyingUserId,
|
||||||
"lastModifyingMachineId": lastModifyingMachineId,
|
"lastModifyingMachineId": lastModifyingMachineId,
|
||||||
"creationTime": creationTime.toUtc().toIso8601String(),
|
"creationTime": creationTime.toUtc().toIso8601String(),
|
||||||
|
|
|
@ -6,7 +6,7 @@ class Session {
|
||||||
final String name;
|
final String name;
|
||||||
final FormatNode formattedName;
|
final FormatNode formattedName;
|
||||||
final List<SessionUser> sessionUsers;
|
final List<SessionUser> sessionUsers;
|
||||||
final String thumbnail;
|
final String thumbnailUrl;
|
||||||
final int maxUsers;
|
final int maxUsers;
|
||||||
final bool hasEnded;
|
final bool hasEnded;
|
||||||
final bool isValid;
|
final bool isValid;
|
||||||
|
@ -22,7 +22,7 @@ class Session {
|
||||||
required this.id,
|
required this.id,
|
||||||
required this.name,
|
required this.name,
|
||||||
required this.sessionUsers,
|
required this.sessionUsers,
|
||||||
required this.thumbnail,
|
required this.thumbnailUrl,
|
||||||
required this.maxUsers,
|
required this.maxUsers,
|
||||||
required this.hasEnded,
|
required this.hasEnded,
|
||||||
required this.isValid,
|
required this.isValid,
|
||||||
|
@ -40,7 +40,7 @@ class Session {
|
||||||
id: "",
|
id: "",
|
||||||
name: "",
|
name: "",
|
||||||
sessionUsers: const [],
|
sessionUsers: const [],
|
||||||
thumbnail: "",
|
thumbnailUrl: "",
|
||||||
maxUsers: 0,
|
maxUsers: 0,
|
||||||
hasEnded: true,
|
hasEnded: true,
|
||||||
isValid: false,
|
isValid: false,
|
||||||
|
@ -60,7 +60,7 @@ class Session {
|
||||||
id: map["sessionId"],
|
id: map["sessionId"],
|
||||||
name: map["name"],
|
name: map["name"],
|
||||||
sessionUsers: (map["sessionUsers"] as List? ?? []).map((entry) => SessionUser.fromMap(entry)).toList(),
|
sessionUsers: (map["sessionUsers"] as List? ?? []).map((entry) => SessionUser.fromMap(entry)).toList(),
|
||||||
thumbnail: map["thumbnailUrl"] ?? "",
|
thumbnailUrl: map["thumbnailUrl"] ?? "",
|
||||||
maxUsers: map["maxUsers"] ?? 0,
|
maxUsers: map["maxUsers"] ?? 0,
|
||||||
hasEnded: map["hasEnded"] ?? false,
|
hasEnded: map["hasEnded"] ?? false,
|
||||||
isValid: map["isValid"] ?? true,
|
isValid: map["isValid"] ?? true,
|
||||||
|
@ -78,7 +78,7 @@ class Session {
|
||||||
"sessionId": id,
|
"sessionId": id,
|
||||||
"name": name,
|
"name": name,
|
||||||
"sessionUsers": shallow ? [] : sessionUsers.map((e) => e.toMap()).toList(),
|
"sessionUsers": shallow ? [] : sessionUsers.map((e) => e.toMap()).toList(),
|
||||||
"thumbnail": thumbnail,
|
"thumbnail": thumbnailUrl,
|
||||||
"maxUsers": maxUsers,
|
"maxUsers": maxUsers,
|
||||||
"hasEnded": hasEnded,
|
"hasEnded": hasEnded,
|
||||||
"isValid": isValid,
|
"isValid": isValid,
|
||||||
|
|
|
@ -7,7 +7,7 @@ import 'package:flutter/foundation.dart';
|
||||||
|
|
||||||
class Friend implements Comparable {
|
class Friend implements Comparable {
|
||||||
static const _emptyId = "-1";
|
static const _emptyId = "-1";
|
||||||
static const _neosBotId = "U-Resonite";
|
static const _resoniteBotId = "U-Resonite";
|
||||||
final String id;
|
final String id;
|
||||||
final String username;
|
final String username;
|
||||||
final String ownerId;
|
final String ownerId;
|
||||||
|
@ -29,7 +29,7 @@ class Friend implements Comparable {
|
||||||
username: map["contactUsername"],
|
username: map["contactUsername"],
|
||||||
ownerId: map["ownerId"] ?? map["id"],
|
ownerId: map["ownerId"] ?? map["id"],
|
||||||
// Neos bot status is always offline but should be displayed as online
|
// Neos bot status is always offline but should be displayed as online
|
||||||
userStatus: map["id"] == _neosBotId ? userStatus.copyWith(onlineStatus: OnlineStatus.online) : userStatus,
|
userStatus: map["id"] == _resoniteBotId ? userStatus.copyWith(onlineStatus: OnlineStatus.online) : userStatus,
|
||||||
userProfile: UserProfile.fromMap(map["profile"] ?? {}),
|
userProfile: UserProfile.fromMap(map["profile"] ?? {}),
|
||||||
contactStatus: FriendStatus.fromString(map["contactStatus"]),
|
contactStatus: FriendStatus.fromString(map["contactStatus"]),
|
||||||
latestMessageTime: map["latestMessageTime"] == null
|
latestMessageTime: map["latestMessageTime"] == null
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
import 'package:contacts_plus_plus/config.dart';
|
|
||||||
import 'package:contacts_plus_plus/models/session.dart';
|
import 'package:contacts_plus_plus/models/session.dart';
|
||||||
import 'package:contacts_plus_plus/models/users/online_status.dart';
|
import 'package:contacts_plus_plus/models/users/online_status.dart';
|
||||||
|
|
||||||
|
@ -75,7 +74,7 @@ class UserStatus {
|
||||||
(e) => e.toMap(),
|
(e) => e.toMap(),
|
||||||
)
|
)
|
||||||
.toList(),
|
.toList(),
|
||||||
"neosVersion": appVersion,
|
"appVersion": appVersion,
|
||||||
"outputDevice": outputDevice,
|
"outputDevice": outputDevice,
|
||||||
"isMobile": isMobile,
|
"isMobile": isMobile,
|
||||||
"compatibilityHash": compatibilityHash,
|
"compatibilityHash": compatibilityHash,
|
||||||
|
|
|
@ -4,7 +4,7 @@ import 'package:cached_network_image/cached_network_image.dart';
|
||||||
import 'package:collection/collection.dart';
|
import 'package:collection/collection.dart';
|
||||||
import 'package:contacts_plus_plus/auxiliary.dart';
|
import 'package:contacts_plus_plus/auxiliary.dart';
|
||||||
import 'package:contacts_plus_plus/clients/inventory_client.dart';
|
import 'package:contacts_plus_plus/clients/inventory_client.dart';
|
||||||
import 'package:contacts_plus_plus/models/inventory/neos_path.dart';
|
import 'package:contacts_plus_plus/models/inventory/resonite_directory.dart';
|
||||||
import 'package:contacts_plus_plus/models/records/record.dart';
|
import 'package:contacts_plus_plus/models/records/record.dart';
|
||||||
import 'package:contacts_plus_plus/widgets/default_error_widget.dart';
|
import 'package:contacts_plus_plus/widgets/default_error_widget.dart';
|
||||||
import 'package:contacts_plus_plus/widgets/inventory/object_inventory_tile.dart';
|
import 'package:contacts_plus_plus/widgets/inventory/object_inventory_tile.dart';
|
||||||
|
@ -37,7 +37,7 @@ class _InventoryBrowserState extends State<InventoryBrowser> with AutomaticKeepA
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
super.build(context);
|
super.build(context);
|
||||||
return Consumer<InventoryClient>(builder: (BuildContext context, InventoryClient iClient, Widget? child) {
|
return Consumer<InventoryClient>(builder: (BuildContext context, InventoryClient iClient, Widget? child) {
|
||||||
return FutureBuilder<NeosDirectory>(
|
return FutureBuilder<ResoniteDirectory>(
|
||||||
future: iClient.directoryFuture,
|
future: iClient.directoryFuture,
|
||||||
builder: (context, snapshot) {
|
builder: (context, snapshot) {
|
||||||
final currentDir = snapshot.data;
|
final currentDir = snapshot.data;
|
||||||
|
@ -57,7 +57,9 @@ class _InventoryBrowserState extends State<InventoryBrowser> with AutomaticKeepA
|
||||||
await iClient.reloadCurrentDirectory();
|
await iClient.reloadCurrentDirectory();
|
||||||
_refreshLimiter = Timer(_refreshLimit, () {});
|
_refreshLimiter = Timer(_refreshLimit, () {});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text("Refresh failed: $e")));
|
if (context.mounted) {
|
||||||
|
ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text("Refresh failed: $e")));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: Builder(
|
child: Builder(
|
||||||
|
|
|
@ -44,7 +44,7 @@ class MessageSessionInvite extends StatelessWidget {
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
GenericAvatar(
|
GenericAvatar(
|
||||||
imageUri: Aux.resdbToHttp(sessionInfo.thumbnail),
|
imageUri: Aux.resdbToHttp(sessionInfo.thumbnailUrl),
|
||||||
placeholderIcon: Icons.no_photography,
|
placeholderIcon: Icons.no_photography,
|
||||||
foregroundColor: foregroundColor,
|
foregroundColor: foregroundColor,
|
||||||
),
|
),
|
||||||
|
|
|
@ -14,7 +14,7 @@ class SessionPopup extends StatelessWidget {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final ScrollController userListScrollController = ScrollController();
|
final ScrollController userListScrollController = ScrollController();
|
||||||
final thumbnailUri = Aux.resdbToHttp(session.thumbnail);
|
final thumbnailUri = Aux.resdbToHttp(session.thumbnailUrl);
|
||||||
return Dialog(
|
return Dialog(
|
||||||
insetPadding: const EdgeInsets.all(32),
|
insetPadding: const EdgeInsets.all(32),
|
||||||
child: Container(
|
child: Container(
|
||||||
|
@ -145,7 +145,7 @@ class SessionTile extends StatelessWidget {
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
GenericAvatar(imageUri: Aux.resdbToHttp(session.thumbnail), placeholderIcon: Icons.no_photography),
|
GenericAvatar(imageUri: Aux.resdbToHttp(session.thumbnailUrl), placeholderIcon: Icons.no_photography),
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 12.0),
|
padding: const EdgeInsets.symmetric(horizontal: 12.0),
|
||||||
child: Column(
|
child: Column(
|
||||||
|
|
|
@ -92,7 +92,7 @@ class _SessionListState extends State<SessionList> with AutomaticKeepAliveClient
|
||||||
child: Hero(
|
child: Hero(
|
||||||
tag: session.id,
|
tag: session.id,
|
||||||
child: CachedNetworkImage(
|
child: CachedNetworkImage(
|
||||||
imageUrl: Aux.resdbToHttp(session.thumbnail),
|
imageUrl: Aux.resdbToHttp(session.thumbnailUrl),
|
||||||
fit: BoxFit.cover,
|
fit: BoxFit.cover,
|
||||||
errorWidget: (context, url, error) => const Center(
|
errorWidget: (context, url, error) => const Center(
|
||||||
child: Icon(
|
child: Icon(
|
||||||
|
|
|
@ -61,7 +61,7 @@ class _SessionViewState extends State<SessionView> {
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 192,
|
height: 192,
|
||||||
child: CachedNetworkImage(
|
child: CachedNetworkImage(
|
||||||
imageUrl: Aux.resdbToHttp(session.thumbnail),
|
imageUrl: Aux.resdbToHttp(session.thumbnailUrl),
|
||||||
imageBuilder: (context, image) {
|
imageBuilder: (context, image) {
|
||||||
return Material(
|
return Material(
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
|
|
Loading…
Reference in a new issue