forked from cwtch.im/cwtch-ui
Fix #457 + Formatting
This commit is contained in:
parent
fa52b741bf
commit
9d4abc3725
|
@ -145,7 +145,7 @@ class ContactInfoState extends ChangeNotifier {
|
||||||
}
|
}
|
||||||
|
|
||||||
void selected() {
|
void selected() {
|
||||||
this._newMarkerMsgIndex = this._unreadMessages-1;
|
this._newMarkerMsgIndex = this._unreadMessages - 1;
|
||||||
this._unreadMessages = 0;
|
this._unreadMessages = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,6 @@ abstract class Message {
|
||||||
}
|
}
|
||||||
|
|
||||||
Message compileOverlay(MessageInfo messageInfo) {
|
Message compileOverlay(MessageInfo messageInfo) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
dynamic message = jsonDecode(messageInfo.wrapper);
|
dynamic message = jsonDecode(messageInfo.wrapper);
|
||||||
var content = message['d'] as dynamic;
|
var content = message['d'] as dynamic;
|
||||||
|
@ -93,7 +92,6 @@ class ByIndex implements CacheHandler {
|
||||||
amount += index - start;
|
amount += index - start;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// check that we aren't asking for messages beyond stored messages
|
// check that we aren't asking for messages beyond stored messages
|
||||||
if (start + amount >= cache.storageMessageCount) {
|
if (start + amount >= cache.storageMessageCount) {
|
||||||
amount = cache.storageMessageCount - start;
|
amount = cache.storageMessageCount - start;
|
||||||
|
|
|
@ -59,7 +59,8 @@ class QuotedMessage extends Message {
|
||||||
return ChangeNotifierProvider.value(
|
return ChangeNotifierProvider.value(
|
||||||
value: this.metadata,
|
value: this.metadata,
|
||||||
builder: (bcontext, child) {
|
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) {
|
} catch (e) {
|
||||||
return MalformedBubble();
|
return MalformedBubble();
|
||||||
|
|
|
@ -34,7 +34,8 @@ class TextMessage extends Message {
|
||||||
value: this.metadata,
|
value: this.metadata,
|
||||||
builder: (bcontext, child) {
|
builder: (bcontext, child) {
|
||||||
return MessageRow(
|
return MessageRow(
|
||||||
MessageBubble(this.content), index,
|
MessageBubble(this.content),
|
||||||
|
index,
|
||||||
key: key,
|
key: key,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -32,11 +32,7 @@ void selectConversation(BuildContext context, int handle) {
|
||||||
var initialIndex = Provider.of<ProfileInfoState>(context, listen: false).contactList.getContact(handle)!.unreadMessages;
|
var initialIndex = Provider.of<ProfileInfoState>(context, listen: false).contactList.getContact(handle)!.unreadMessages;
|
||||||
var previouslySelected = Provider.of<AppState>(context, listen: false).selectedConversation;
|
var previouslySelected = Provider.of<AppState>(context, listen: false).selectedConversation;
|
||||||
if (previouslySelected != null) {
|
if (previouslySelected != null) {
|
||||||
Provider
|
Provider.of<ProfileInfoState>(context, listen: false).contactList.getContact(previouslySelected)!.unselected();
|
||||||
.of<ProfileInfoState>(context, listen: false)
|
|
||||||
.contactList
|
|
||||||
.getContact(previouslySelected)!
|
|
||||||
.unselected();
|
|
||||||
}
|
}
|
||||||
Provider.of<ProfileInfoState>(context, listen: false).contactList.getContact(handle)!.selected();
|
Provider.of<ProfileInfoState>(context, listen: false).contactList.getContact(handle)!.selected();
|
||||||
// triggers update in Double/TripleColumnView
|
// triggers update in Double/TripleColumnView
|
||||||
|
|
|
@ -110,6 +110,7 @@ class _GlobalSettingsViewState extends State<GlobalSettingsView> {
|
||||||
trailing: Container(
|
trailing: Container(
|
||||||
width: MediaQuery.of(context).size.width / 4,
|
width: MediaQuery.of(context).size.width / 4,
|
||||||
child: DropdownButton(
|
child: DropdownButton(
|
||||||
|
isExpanded: true,
|
||||||
value: Provider.of<Settings>(context).locale.languageCode,
|
value: Provider.of<Settings>(context).locale.languageCode,
|
||||||
onChanged: (String? newValue) {
|
onChanged: (String? newValue) {
|
||||||
setState(() {
|
setState(() {
|
||||||
|
@ -146,7 +147,7 @@ class _GlobalSettingsViewState extends State<GlobalSettingsView> {
|
||||||
width: MediaQuery.of(context).size.width / 4,
|
width: MediaQuery.of(context).size.width / 4,
|
||||||
child: DropdownButton<String>(
|
child: DropdownButton<String>(
|
||||||
key: Key("DropdownTheme"),
|
key: Key("DropdownTheme"),
|
||||||
isDense: true,
|
isExpanded: true,
|
||||||
value: Provider.of<Settings>(context).theme.theme,
|
value: Provider.of<Settings>(context).theme.theme,
|
||||||
onChanged: (String? newValue) {
|
onChanged: (String? newValue) {
|
||||||
setState(() {
|
setState(() {
|
||||||
|
@ -168,6 +169,7 @@ class _GlobalSettingsViewState extends State<GlobalSettingsView> {
|
||||||
trailing: Container(
|
trailing: Container(
|
||||||
width: MediaQuery.of(context).size.width / 4,
|
width: MediaQuery.of(context).size.width / 4,
|
||||||
child: DropdownButton(
|
child: DropdownButton(
|
||||||
|
isExpanded: true,
|
||||||
value: settings.uiColumnModePortrait.toString(),
|
value: settings.uiColumnModePortrait.toString(),
|
||||||
onChanged: (String? newValue) {
|
onChanged: (String? newValue) {
|
||||||
settings.uiColumnModePortrait = Settings.uiColumnModeFromString(newValue!);
|
settings.uiColumnModePortrait = Settings.uiColumnModeFromString(newValue!);
|
||||||
|
@ -249,6 +251,7 @@ class _GlobalSettingsViewState extends State<GlobalSettingsView> {
|
||||||
trailing: Container(
|
trailing: Container(
|
||||||
width: MediaQuery.of(context).size.width / 4,
|
width: MediaQuery.of(context).size.width / 4,
|
||||||
child: DropdownButton(
|
child: DropdownButton(
|
||||||
|
isExpanded: true,
|
||||||
value: settings.notificationPolicy,
|
value: settings.notificationPolicy,
|
||||||
onChanged: (NotificationPolicy? newValue) {
|
onChanged: (NotificationPolicy? newValue) {
|
||||||
settings.notificationPolicy = newValue!;
|
settings.notificationPolicy = newValue!;
|
||||||
|
|
|
@ -171,11 +171,7 @@ class _MessageViewState extends State<MessageView> {
|
||||||
|
|
||||||
var previouslySelected = Provider.of<AppState>(context, listen: false).selectedConversation;
|
var previouslySelected = Provider.of<AppState>(context, listen: false).selectedConversation;
|
||||||
if (previouslySelected != null) {
|
if (previouslySelected != null) {
|
||||||
Provider
|
Provider.of<ProfileInfoState>(context, listen: false).contactList.getContact(previouslySelected)!.unselected();
|
||||||
.of<ProfileInfoState>(context, listen: false)
|
|
||||||
.contactList
|
|
||||||
.getContact(previouslySelected)!
|
|
||||||
.unselected();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Provider.of<AppState>(context, listen: false).selectedConversation = null;
|
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) {
|
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!;
|
var conversationId = Provider.of<AppState>(context, listen: false).selectedConversation!;
|
||||||
MessageCache? cache = Provider.of<ProfileInfoState>(context, listen: false).contactList.getContact(conversationId)?.messageCache;
|
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) {
|
.then((MessageInfo? data) {
|
||||||
try {
|
try {
|
||||||
var bytes1 = utf8.encode(data!.metadata.senderHandle + data.wrapper);
|
var bytes1 = utf8.encode(data!.metadata.senderHandle + data.wrapper);
|
||||||
|
|
Loading…
Reference in New Issue