remove syncProgress from contact and wire contact row to search server's list
continuous-integration/drone/pr Build is passing
Details
continuous-integration/drone/pr Build is passing
Details
This commit is contained in:
parent
a4ce168aec
commit
f818d4f2f8
|
@ -26,7 +26,6 @@ class ContactInfoState extends ChangeNotifier {
|
||||||
// todo: a nicer way to model contacts, groups and other "entities"
|
// todo: a nicer way to model contacts, groups and other "entities"
|
||||||
late bool _isGroup;
|
late bool _isGroup;
|
||||||
String? _server;
|
String? _server;
|
||||||
double _serverSyncProgress = 0.0;
|
|
||||||
late bool _archived;
|
late bool _archived;
|
||||||
|
|
||||||
String? _acnCircuit;
|
String? _acnCircuit;
|
||||||
|
@ -177,12 +176,6 @@ class ContactInfoState extends ChangeNotifier {
|
||||||
// we only allow callers to fetch the server
|
// we only allow callers to fetch the server
|
||||||
get server => this._server;
|
get server => this._server;
|
||||||
|
|
||||||
double get serverSyncProgress => this._serverSyncProgress;
|
|
||||||
set serverSyncProgress(double newProgress) {
|
|
||||||
_serverSyncProgress = newProgress;
|
|
||||||
notifyListeners();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isOnline() {
|
bool isOnline() {
|
||||||
if (this.isGroup == true) {
|
if (this.isGroup == true) {
|
||||||
// We now have an out of sync warning so we will mark these as online...
|
// We now have an out of sync warning so we will mark these as online...
|
||||||
|
|
|
@ -42,11 +42,12 @@ class RemoteServerInfoState extends ChangeNotifier {
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// updateSyncProgressFor point takes a message's time, and updates the server sync progress,
|
||||||
|
// based on that point in time between the precalculated lastPreSyncMessagTime and Now
|
||||||
void updateSyncProgressFor(DateTime point) {
|
void updateSyncProgressFor(DateTime point) {
|
||||||
var range = lastPreSyncMessagTime.difference(DateTime.now());
|
var range = lastPreSyncMessagTime.difference(DateTime.now());
|
||||||
var pointFromStart = lastPreSyncMessagTime.difference(point);
|
var pointFromStart = lastPreSyncMessagTime.difference(point);
|
||||||
syncProgress = pointFromStart.inSeconds / range.inSeconds * 100;
|
syncProgress = pointFromStart.inSeconds / range.inSeconds;
|
||||||
groups.forEach((g) { g.serverSyncProgress = syncProgress;});
|
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ import 'package:cwtch/models/appstate.dart';
|
||||||
import 'package:cwtch/models/contact.dart';
|
import 'package:cwtch/models/contact.dart';
|
||||||
import 'package:cwtch/models/contactlist.dart';
|
import 'package:cwtch/models/contactlist.dart';
|
||||||
import 'package:cwtch/models/profile.dart';
|
import 'package:cwtch/models/profile.dart';
|
||||||
|
import 'package:cwtch/models/profilelist.dart';
|
||||||
import 'package:cwtch/views/profileserversview.dart';
|
import 'package:cwtch/views/profileserversview.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:cwtch/widgets/contactrow.dart';
|
import 'package:cwtch/widgets/contactrow.dart';
|
||||||
|
@ -154,8 +155,15 @@ class _ContactsViewState extends State<ContactsView> {
|
||||||
|
|
||||||
Widget _buildContactList() {
|
Widget _buildContactList() {
|
||||||
final tiles = Provider.of<ContactListState>(context).filteredList().map((ContactInfoState contact) {
|
final tiles = Provider.of<ContactListState>(context).filteredList().map((ContactInfoState contact) {
|
||||||
return ChangeNotifierProvider<ContactInfoState>.value(key: ValueKey(contact.profileOnion + "" + contact.onion), value: contact, builder: (_, __) => RepaintBoundary(child: ContactRow()));
|
return MultiProvider(
|
||||||
|
providers: [
|
||||||
|
ChangeNotifierProvider.value(value: contact),
|
||||||
|
ChangeNotifierProvider.value(value: Provider.of<ProfileInfoState>(context).serverList),
|
||||||
|
],
|
||||||
|
builder: (context, child) => RepaintBoundary(child: ContactRow()),
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
final divided = ListTile.divideTiles(
|
final divided = ListTile.divideTiles(
|
||||||
context: context,
|
context: context,
|
||||||
tiles: tiles,
|
tiles: tiles,
|
||||||
|
|
|
@ -67,7 +67,7 @@ class _ContactRowState extends State<ContactRow> {
|
||||||
visible: contact.isGroup && contact.status == "Authenticated",
|
visible: contact.isGroup && contact.status == "Authenticated",
|
||||||
child: LinearProgressIndicator(
|
child: LinearProgressIndicator(
|
||||||
color: Provider.of<Settings>(context).theme.defaultButtonActiveColor,
|
color: Provider.of<Settings>(context).theme.defaultButtonActiveColor,
|
||||||
value: contact.serverSyncProgress,
|
value: Provider.of<ProfileInfoState>(context).serverList.getServer(contact.server)?.syncProgress,
|
||||||
)),
|
)),
|
||||||
Visibility(
|
Visibility(
|
||||||
visible: !Provider.of<Settings>(context).streamerMode,
|
visible: !Provider.of<Settings>(context).streamerMode,
|
||||||
|
|
|
@ -91,7 +91,7 @@ class _ProfileRowState extends State<ProfileRow> {
|
||||||
return MultiProvider(
|
return MultiProvider(
|
||||||
providers: [
|
providers: [
|
||||||
ChangeNotifierProvider<ProfileInfoState>.value(value: profile),
|
ChangeNotifierProvider<ProfileInfoState>.value(value: profile),
|
||||||
ChangeNotifierProvider<ContactListState>.value(value: profile.contactList),
|
ChangeNotifierProvider<ContactListState>.value(value: profile.contactList)
|
||||||
],
|
],
|
||||||
builder: (innercontext, widget) {
|
builder: (innercontext, widget) {
|
||||||
var appState = Provider.of<AppState>(context);
|
var appState = Provider.of<AppState>(context);
|
||||||
|
|
Loading…
Reference in New Issue