Skip to content

Commit

Permalink
Merge pull request #923 from BlueBubblesApp/development
Browse files Browse the repository at this point in the history
v1.2.0 release
  • Loading branch information
zlshames authored Jun 23, 2021
2 parents 5530bbb + 915868a commit 7611e27
Show file tree
Hide file tree
Showing 23 changed files with 2,505 additions and 249 deletions.
2 changes: 1 addition & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ android {
// version code: 1 0114 0 70 64

//noinspection AccidentalOctal
versionCode 11110064
versionCode 11200064
versionName flutterVersionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,10 @@ public void Handle() {
.setSmallIcon(R.mipmap.ic_stat_icon)
.setAllowSystemGeneratedContextualActions(true)
.setAutoCancel(true)
// Tell android that it's a message/conversation
.setCategory(NotificationCompat.CATEGORY_MESSAGE)
// Set the priority to high since it's a message they should see
.setPriority(NotificationCompat.PRIORITY_HIGH)
.setContentIntent(openIntent)
.addAction(dismissAction)
.addAction(replyAction)
Expand Down
17 changes: 17 additions & 0 deletions assets/changelog/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,23 @@

Below are the last few BlueBubbles App release changelogs

## v1.2.0

* UX: Adds `%` symbol to the attachment preview quality slider
* UX: Attachment preview quality slider now increments in steps of 5 instead of 10
* UX: Message details popup menu is now re-organized a bit for better user-experience
* UX: Adds better support for .heic images (at partial quality)
* UX: Sets the priority of notifications to `high` in effort to fix notification issues
* New Feature: Ability to start a new conversation within message details popup
* New Feature: Ability to forward a message within message details popup
* New Feature: Ability to rename a conversation (locally on Android only)
* New Feature: Ability to mute/unmute videos from the preview
* New Feature: Redacted mode is now honored in the conversation details page
* New Feature: Settings toggle to enable/disable filtered chats (leave this disabled if you don't have issues)
* Bug Fix: Fixes issue where not all chats would load into your chat list (only top 10)
* Bug Fix: Removes copy options for messages without text (or images)
* Bug Fix: Fixes issue where the recipient's avatar would show for your reactions

## v1.1.1

* Bug Fix: Fixes grey screen when creating a new chat
Expand Down
40 changes: 25 additions & 15 deletions lib/blocs/chat_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,12 @@ class ChatBloc {
}

List<Chat> _archivedChats = [];
List<Chat> get archivedChats {
final ids = _archivedChats.map((e) => e.guid).toSet();
_archivedChats.retainWhere((element) => ids.remove(element.guid));
return _archivedChats;
}

List<Chat> get archivedChats => _archivedChats;
Completer<void> chatRequest;

static final ChatBloc _chatBloc = ChatBloc._internal();
Expand Down Expand Up @@ -258,33 +262,38 @@ class ChatBloc {
_chats = [];
}

int batches = (count < batchSize) ? batchSize : (count / batchSize).floor();
int batches = (count < batchSize) ? batchSize : (count / batchSize).ceil();
for (int i = 0; i < batches; i++) {
List<Chat> chats = await Chat.getChats(limit: batchSize, offset: i * batchSize, archived: archived);
if (chats.length == 0) break;

for (Chat chat in chats) {
bool existing = false;
for (Chat existingChat in _chats) {
for (Chat existingChat in (archived ? _archivedChats : _chats)) {
if (existingChat.guid == chat.guid) {
existing = true;
break;
}
}

if (existing) continue;
_chats.add(chat);
if (archived) {
_archivedChats.add(chat);
} else {
_chats.add(chat);
}

await initTileValsForChat(chat);
}

await this.addToSink(this.chats);
await this.addToSink((archived) ? this.archivedChats : this.chats, archived: archived);
}

// If this is for archived chats, return now
if (archived) return;

// For non-archived chats, do some more processing
debugPrint("[ChatBloc] -> Finished fetching chats (${_chats.length})");
debugPrint("[ChatBloc] -> Finished fetching chats (${_chats.length}). (archived: $archived)");
await updateAllShareTargets();

if (chatRequest != null && !chatRequest.isCompleted) {
Expand Down Expand Up @@ -381,23 +390,24 @@ class ChatBloc {
refreshChats();
}

Future<void> addToSink(List<Chat> chats) async {
Future<void> addToSink(List<Chat> chats, {bool archived = false}) async {
for (int i = 0; i < chats.length; i++) {
if (isNullOrEmpty(chats[i].participants)) {
await chats[i].getParticipants();
}
}

_chatController.sink.add(chats);
if (archived && !_archivedChatController.isClosed) {
_archivedChatController.sink.add(chats);
} else if (!_chatController.isClosed) {
_chatController.sink.add(chats);
}
}

dispose() {
_chatController.close();
_tileValController.close();
_archivedChatController.close();

if (_messageSubscription != null) {
_messageSubscription.cancel();
}
_chatController?.close();
_tileValController?.close();
_archivedChatController?.close();
_messageSubscription?.cancel();
}
}
4 changes: 3 additions & 1 deletion lib/helpers/message_helper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,9 @@ class MessageHelper {

List<String> items = matches.map((m) => m.toString()).toList();

String replaced = text.replaceAll(pattern, "").replaceAll(String.fromCharCode(65039), "").trim();
String replaced = text.replaceAll(pattern, "").replaceAll(String.fromCharCode(65039), "");
RegExp darkSunglasses = RegExp('\u{1F576}');
replaced = replaced.replaceAll(darkSunglasses, "").trim();
return items.length <= 3 && replaced.isEmpty;
}

Expand Down
4 changes: 2 additions & 2 deletions lib/helpers/redacted_helper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ import 'package:bluebubbles/managers/settings_manager.dart';
import 'package:bluebubbles/repository/models/chat.dart';
import 'package:flutter/widgets.dart';

String getContactName(BuildContext context, String contactTitle, String contactAddress) {
String getContactName(BuildContext context, String contactTitle, String contactAddress, {Chat currentChat}) {
final bool redactedMode = SettingsManager()?.settings?.redactedMode ?? false;
final bool hideInfo = redactedMode && (SettingsManager()?.settings?.hideContactInfo ?? false);
final bool generateName = redactedMode && (SettingsManager()?.settings?.generateFakeContactNames ?? false);

String contactName = contactTitle;
if (hideInfo) {
Chat currentChat = CurrentChat.of(context)?.chat;
currentChat = CurrentChat.of(context)?.chat ?? currentChat;
int index = (currentChat?.participants ?? []).indexWhere((h) => h.address == contactAddress);
List<String> fakeNames = currentChat?.fakeParticipants ?? [];
if (generateName) {
Expand Down
18 changes: 17 additions & 1 deletion lib/layouts/conversation_details/attachment_details_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,23 @@ class _AttachmentDetailsCardState extends State<AttachmentDetailsCard> {
File file = new File(
"${SettingsManager().appDocDir.path}/attachments/${attachment.guid}/${attachment.transferName}",
);

final bool hideAttachments =
SettingsManager().settings.redactedMode && SettingsManager().settings.hideAttachments;
final bool hideAttachmentTypes =
SettingsManager().settings.redactedMode && SettingsManager().settings.hideAttachmentTypes;
if (hideAttachments && !hideAttachmentTypes)
return Container(
alignment: Alignment.center,
color: Theme.of(context).accentColor,
child: Text(
widget.attachment.mimeType,
textAlign: TextAlign.center,
),
);
if (hideAttachments)
return Container(
color: Theme.of(context).accentColor,
);
if (!file.existsSync()) {
return Stack(
alignment: Alignment.center,
Expand Down
11 changes: 8 additions & 3 deletions lib/layouts/conversation_details/contact_tile.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import 'dart:ui';

import 'package:bluebubbles/blocs/chat_bloc.dart';
import 'package:bluebubbles/helpers/redacted_helper.dart';
import 'package:bluebubbles/helpers/utils.dart';
import 'package:bluebubbles/layouts/widgets/contact_avatar_widget.dart';
import 'package:bluebubbles/managers/contact_manager.dart';
import 'package:bluebubbles/managers/settings_manager.dart';
import 'package:bluebubbles/repository/models/chat.dart';
import 'package:bluebubbles/repository/models/handle.dart';
import 'package:bluebubbles/socket_manager.dart';
Expand Down Expand Up @@ -104,6 +106,9 @@ class _ContactTileState extends State<ContactTile> {
}

Widget _buildContactTile() {
final bool redactedMode = SettingsManager()?.settings?.redactedMode ?? false;
final bool hideInfo = redactedMode && (SettingsManager()?.settings?.hideContactInfo ?? false);
final bool generateName = redactedMode && (SettingsManager()?.settings?.generateFakeContactNames ?? false);
return InkWell(
onLongPress: () {
Clipboard.setData(new ClipboardData(text: widget.handle.address));
Expand All @@ -119,9 +124,9 @@ class _ContactTileState extends State<ContactTile> {
}
},
child: ListTile(
title: (contact?.displayName != null)
title: (contact?.displayName != null || hideInfo || generateName)
? Text(
contact.displayName ?? "",
getContactName(context, contact?.displayName, widget.handle?.address, currentChat: widget.chat),
style: Theme.of(context).textTheme.bodyText1,
)
: FutureBuilder(
Expand All @@ -139,7 +144,7 @@ class _ContactTileState extends State<ContactTile> {
style: Theme.of(context).textTheme.bodyText1,
);
}),
subtitle: (contact == null)
subtitle: (contact == null || hideInfo || generateName)
? null
: FutureBuilder(
future: formatPhoneNumber(widget.handle?.address ?? ""),
Expand Down
Loading

0 comments on commit 7611e27

Please sign in to comment.