Merge pull request 'Fix #457 + Formatting' (#459) from fix457 into trunk
continuous-integration/drone/push Build is pending Details

Reviewed-on: #459
This commit is contained in:
Dan Ballard 2022-05-11 19:56:11 +00:00
commit 427081c937
7 changed files with 14 additions and 18 deletions

View File

@ -145,7 +145,7 @@ class ContactInfoState extends ChangeNotifier {
}
void selected() {
this._newMarkerMsgIndex = this._unreadMessages-1;
this._newMarkerMsgIndex = this._unreadMessages - 1;
this._unreadMessages = 0;
}

View File

@ -38,8 +38,7 @@ abstract class Message {
}
Message compileOverlay(MessageInfo messageInfo) {
try {
try {
dynamic message = jsonDecode(messageInfo.wrapper);
var content = message['d'] as dynamic;
var overlay = int.parse(message['o'].toString());
@ -93,7 +92,6 @@ class ByIndex implements CacheHandler {
amount += index - start;
}
// check that we aren't asking for messages beyond stored messages
if (start + amount >= cache.storageMessageCount) {
amount = cache.storageMessageCount - start;

View File

@ -59,7 +59,8 @@ class QuotedMessage extends Message {
return ChangeNotifierProvider.value(
value: this.metadata,
builder: (bcontext, child) {
return MessageRow(QuotedMessageBubble(message["body"], messageHandler(bcontext, metadata.profileOnion, metadata.conversationIdentifier, ByContentHash(message["quotedHash"]))), index, key: key);
return MessageRow(QuotedMessageBubble(message["body"], messageHandler(bcontext, metadata.profileOnion, metadata.conversationIdentifier, ByContentHash(message["quotedHash"]))), index,
key: key);
});
} catch (e) {
return MalformedBubble();

View File

@ -34,7 +34,8 @@ class TextMessage extends Message {
value: this.metadata,
builder: (bcontext, child) {
return MessageRow(
MessageBubble(this.content), index,
MessageBubble(this.content),
index,
key: key,
);
});

View File

@ -32,11 +32,7 @@ void selectConversation(BuildContext context, int handle) {
var initialIndex = Provider.of<ProfileInfoState>(context, listen: false).contactList.getContact(handle)!.unreadMessages;
var previouslySelected = Provider.of<AppState>(context, listen: false).selectedConversation;
if (previouslySelected != null) {
Provider
.of<ProfileInfoState>(context, listen: false)
.contactList
.getContact(previouslySelected)!
.unselected();
Provider.of<ProfileInfoState>(context, listen: false).contactList.getContact(previouslySelected)!.unselected();
}
Provider.of<ProfileInfoState>(context, listen: false).contactList.getContact(handle)!.selected();
// triggers update in Double/TripleColumnView

View File

@ -110,6 +110,7 @@ class _GlobalSettingsViewState extends State<GlobalSettingsView> {
trailing: Container(
width: MediaQuery.of(context).size.width / 4,
child: DropdownButton(
isExpanded: true,
value: Provider.of<Settings>(context).locale.languageCode,
onChanged: (String? newValue) {
setState(() {
@ -146,7 +147,7 @@ class _GlobalSettingsViewState extends State<GlobalSettingsView> {
width: MediaQuery.of(context).size.width / 4,
child: DropdownButton<String>(
key: Key("DropdownTheme"),
isDense: true,
isExpanded: true,
value: Provider.of<Settings>(context).theme.theme,
onChanged: (String? newValue) {
setState(() {
@ -168,6 +169,7 @@ class _GlobalSettingsViewState extends State<GlobalSettingsView> {
trailing: Container(
width: MediaQuery.of(context).size.width / 4,
child: DropdownButton(
isExpanded: true,
value: settings.uiColumnModePortrait.toString(),
onChanged: (String? newValue) {
settings.uiColumnModePortrait = Settings.uiColumnModeFromString(newValue!);
@ -249,6 +251,7 @@ class _GlobalSettingsViewState extends State<GlobalSettingsView> {
trailing: Container(
width: MediaQuery.of(context).size.width / 4,
child: DropdownButton(
isExpanded: true,
value: settings.notificationPolicy,
onChanged: (NotificationPolicy? newValue) {
settings.notificationPolicy = newValue!;

View File

@ -171,11 +171,7 @@ class _MessageViewState extends State<MessageView> {
var previouslySelected = Provider.of<AppState>(context, listen: false).selectedConversation;
if (previouslySelected != null) {
Provider
.of<ProfileInfoState>(context, listen: false)
.contactList
.getContact(previouslySelected)!
.unselected();
Provider.of<ProfileInfoState>(context, listen: false).contactList.getContact(previouslySelected)!.unselected();
}
Provider.of<AppState>(context, listen: false).selectedConversation = null;
@ -230,7 +226,8 @@ class _MessageViewState extends State<MessageView> {
if (Provider.of<AppState>(context, listen: false).selectedConversation != null && Provider.of<AppState>(context, listen: false).selectedIndex != null) {
var conversationId = Provider.of<AppState>(context, listen: false).selectedConversation!;
MessageCache? cache = Provider.of<ProfileInfoState>(context, listen: false).contactList.getContact(conversationId)?.messageCache;
ById(Provider.of<AppState>(context, listen: false).selectedIndex!).get(Provider.of<FlwtchState>(context, listen: false).cwtch, Provider.of<AppState>(context, listen: false).selectedProfile!, conversationId, cache!)
ById(Provider.of<AppState>(context, listen: false).selectedIndex!)
.get(Provider.of<FlwtchState>(context, listen: false).cwtch, Provider.of<AppState>(context, listen: false).selectedProfile!, conversationId, cache!)
.then((MessageInfo? data) {
try {
var bytes1 = utf8.encode(data!.metadata.senderHandle + data.wrapper);