Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 6 additions & 45 deletions sama_chat_client/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,40 +3,6 @@ PODS:
- Flutter
- connectivity_plus (0.0.1):
- Flutter
- DKImagePickerController/Core (4.3.9):
- DKImagePickerController/ImageDataManager
- DKImagePickerController/Resource
- DKImagePickerController/ImageDataManager (4.3.9)
- DKImagePickerController/PhotoGallery (4.3.9):
- DKImagePickerController/Core
- DKPhotoGallery
- DKImagePickerController/Resource (4.3.9)
- DKPhotoGallery (0.0.19):
- DKPhotoGallery/Core (= 0.0.19)
- DKPhotoGallery/Model (= 0.0.19)
- DKPhotoGallery/Preview (= 0.0.19)
- DKPhotoGallery/Resource (= 0.0.19)
- SDWebImage
- SwiftyGif
- DKPhotoGallery/Core (0.0.19):
- DKPhotoGallery/Model
- DKPhotoGallery/Preview
- SDWebImage
- SwiftyGif
- DKPhotoGallery/Model (0.0.19):
- SDWebImage
- SwiftyGif
- DKPhotoGallery/Preview (0.0.19):
- DKPhotoGallery/Model
- DKPhotoGallery/Resource
- SDWebImage
- SwiftyGif
- DKPhotoGallery/Resource (0.0.19):
- SDWebImage
- SwiftyGif
- file_picker (0.0.1):
- DKImagePickerController/PhotoGallery
- Flutter
- Firebase/CoreOnly (11.15.0):
- FirebaseCore (~> 11.15.0)
- Firebase/Messaging (11.15.0):
Expand Down Expand Up @@ -109,6 +75,8 @@ PODS:
- GoogleUtilities/UserDefaults (8.1.0):
- GoogleUtilities/Logger
- GoogleUtilities/Privacy
- image_picker_ios (0.0.1):
- Flutter
- libwebp (1.5.0):
- libwebp/demux (= 1.5.0)
- libwebp/mux (= 1.5.0)
Expand Down Expand Up @@ -153,7 +121,6 @@ PODS:
- sqflite_darwin (0.0.4):
- Flutter
- FlutterMacOS
- SwiftyGif (5.4.5)
- url_launcher_ios (0.0.1):
- Flutter
- video_compress (0.3.0):
Expand All @@ -167,14 +134,14 @@ PODS:
DEPENDENCIES:
- app_set_id (from `.symlinks/plugins/app_set_id/ios`)
- connectivity_plus (from `.symlinks/plugins/connectivity_plus/ios`)
- file_picker (from `.symlinks/plugins/file_picker/ios`)
- firebase_core (from `.symlinks/plugins/firebase_core/ios`)
- firebase_messaging (from `.symlinks/plugins/firebase_messaging/ios`)
- Flutter (from `Flutter`)
- flutter_image_compress_common (from `.symlinks/plugins/flutter_image_compress_common/ios`)
- flutter_local_notifications (from `.symlinks/plugins/flutter_local_notifications/ios`)
- flutter_secure_storage (from `.symlinks/plugins/flutter_secure_storage/ios`)
- get_thumbnail_video (from `.symlinks/plugins/get_thumbnail_video/ios`)
- image_picker_ios (from `.symlinks/plugins/image_picker_ios/ios`)
- objectbox_flutter_libs (from `.symlinks/plugins/objectbox_flutter_libs/ios`)
- package_info_plus (from `.symlinks/plugins/package_info_plus/ios`)
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
Expand All @@ -188,8 +155,6 @@ DEPENDENCIES:

SPEC REPOS:
trunk:
- DKImagePickerController
- DKPhotoGallery
- Firebase
- FirebaseCore
- FirebaseCoreInternal
Expand All @@ -204,15 +169,12 @@ SPEC REPOS:
- PromisesObjC
- SDWebImage
- SDWebImageWebPCoder
- SwiftyGif

EXTERNAL SOURCES:
app_set_id:
:path: ".symlinks/plugins/app_set_id/ios"
connectivity_plus:
:path: ".symlinks/plugins/connectivity_plus/ios"
file_picker:
:path: ".symlinks/plugins/file_picker/ios"
firebase_core:
:path: ".symlinks/plugins/firebase_core/ios"
firebase_messaging:
Expand All @@ -227,6 +189,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/flutter_secure_storage/ios"
get_thumbnail_video:
:path: ".symlinks/plugins/get_thumbnail_video/ios"
image_picker_ios:
:path: ".symlinks/plugins/image_picker_ios/ios"
objectbox_flutter_libs:
:path: ".symlinks/plugins/objectbox_flutter_libs/ios"
package_info_plus:
Expand All @@ -251,9 +215,6 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
app_set_id: 0e0db3830db2bca1b67eecec1e2ab80b2bec48fa
connectivity_plus: 2a701ffec2c0ae28a48cf7540e279787e77c447d
DKImagePickerController: 946cec48c7873164274ecc4624d19e3da4c1ef3c
DKPhotoGallery: b3834fecb755ee09a593d7c9e389d8b5d6deed60
file_picker: b159e0c068aef54932bb15dc9fd1571818edaf49
Firebase: d99ac19b909cd2c548339c2241ecd0d1599ab02e
firebase_core: 99a37263b3c27536063a7b601d9e2a49400a433c
firebase_messaging: bf6697c61f31c7cc0f654131212ff04c0115c2c7
Expand All @@ -268,6 +229,7 @@ SPEC CHECKSUMS:
get_thumbnail_video: b9a180957daed3e9179e66268db51d8798e41f65
GoogleDataTransport: aae35b7ea0c09004c3797d53c8c41f66f219d6a7
GoogleUtilities: 00c88b9a86066ef77f0da2fab05f65d7768ed8e1
image_picker_ios: 4f2f91b01abdb52842a8e277617df877e40f905b
libwebp: 02b23773aedb6ff1fd38cec7a77b81414c6842a8
Mantle: c5aa8794a29a022dfbbfc9799af95f477a69b62d
nanopb: fad817b59e0457d11a5dfbde799381cd727c1275
Expand All @@ -281,7 +243,6 @@ SPEC CHECKSUMS:
SDWebImageWebPCoder: e38c0a70396191361d60c092933e22c20d5b1380
shared_preferences_foundation: 5086985c1d43c5ba4d5e69a4e8083a389e2909e6
sqflite_darwin: 5a7236e3b501866c1c9befc6771dfd73ffb8702d
SwiftyGif: 706c60cf65fa2bc5ee0313beece843c8eb8194d4
url_launcher_ios: bb13df5870e8c4234ca12609d04010a21be43dfa
video_compress: fce97e4fb1dfd88175aa07d2ffc8a2f297f87fbe
video_player_avfoundation: 7993f492ae0bd77edaea24d9dc051d8bb2cd7c86
Expand Down
2 changes: 1 addition & 1 deletion sama_chat_client/ios/Share Extension/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>NSExtensionActivationSupportsWebURLWithMaxCount</key>
<integer>1</integer>
<key>NSExtensionActivationSupportsImageWithMaxCount</key>
<integer>100</integer>
<integer>10</integer>
</dict>
</dict>
<key>NSExtensionMainStoryboard</key>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -552,17 +552,18 @@ class ConversationBloc extends Bloc<ConversationEvent, ConversationState> {
? messages.tryGet(messages.length - 2)
: messages.tryGet(messages.length - 1);

var shouldUpdate = state.messages.isNotEmpty &&
lastCurrentMsg != null &&
lastCurrentMsg.id != state.messages.lastOrNull?.id;
var shouldUpdate = state.messages.isNotEmpty;

var lastPrevMsg = shouldUpdate ? state.messages.last : null;
var lastPrevMsg = state.messages.lastOrNull;
var firstPrevMsg = state.messages.firstOrNull;

for (int i = 0; i < messages.length; i++) {
var message = messages[i];
var chatMessage = message.toChatMessage(
i == 0
? lastPrevMsg?.from != messages[i].from
? lastPrevMsg == firstPrevMsg ||
lastPrevMsg?.id == lastCurrentMsg?.id ||
lastPrevMsg?.from != messages[i].from
: isServiceMessage(messages[i - 1]) ||
messages[i - 1].from != messages[i].from,
i == messages.length - 1 ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ class SendMessageBloc extends Bloc<SendMessageEvent, SendMessageState> {
emit(state.copyWith(
isTextEmpty: event.text.trim().isEmpty,
text: event.text,
safeDraft: event.safeDraft,
status: SendMessageStatus.initial));
}

Expand Down Expand Up @@ -167,7 +168,7 @@ class SendMessageBloc extends Bloc<SendMessageEvent, SendMessageState> {
}

saveDraftIfExist() {
if (state.text.isNotEmpty) {
if (state.text.isNotEmpty && state.safeDraft) {
messagesRepository.saveDraftMessage(
state.text, currentConversation.id, state.replyMessage);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ final class SendTextMessage extends SendMessageEvent {

final class TextMessageChanged extends SendMessageEvent {
final String text;
final bool safeDraft;

const TextMessageChanged(this.text);
const TextMessageChanged(this.text, {this.safeDraft = true});
}

final class TextMessageClear extends SendMessageEvent {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ final class SendMessageState extends Equatable {
this.isTextEmpty = true,
this.text = '',
this.scroll = false,
this.safeDraft = true,
this.errorMessage,
this.draftMessage,
this.replyMessage,
Expand All @@ -18,6 +19,7 @@ final class SendMessageState extends Equatable {
final bool isTextEmpty;
final String text;
final bool scroll;
final bool safeDraft;
final String? errorMessage;
final MessageModel? draftMessage;
final MessageModel? replyMessage;
Expand All @@ -28,6 +30,7 @@ final class SendMessageState extends Equatable {
bool? isTextEmpty,
String? text,
bool? scroll,
bool? safeDraft,
String? errorMessage,
MessageModel? Function()? draftMessage,
MessageModel? Function()? replyMessage,
Expand All @@ -38,6 +41,7 @@ final class SendMessageState extends Equatable {
isTextEmpty: isTextEmpty ?? this.isTextEmpty,
text: text ?? this.text,
scroll: scroll ?? this.scroll,
safeDraft: safeDraft ?? this.safeDraft,
errorMessage: errorMessage ?? this.errorMessage,
draftMessage: draftMessage != null ? draftMessage() : this.draftMessage,
replyMessage: replyMessage != null ? replyMessage() : this.replyMessage,
Expand All @@ -56,6 +60,7 @@ final class SendMessageState extends Equatable {
isTextEmpty,
text,
scroll,
safeDraft,
errorMessage,
draftMessage,
replyMessage,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ class _MessageInputState extends State<MessageInput> {

if (widget.sharedMessage?.type == SharedMediaType.text ||
widget.sharedMessage?.type == SharedMediaType.url) {
BlocProvider.of<SendMessageBloc>(context)
.add(TextMessageChanged(widget.sharedMessage!.path));
BlocProvider.of<SendMessageBloc>(context).add(
TextMessageChanged(widget.sharedMessage!.path, safeDraft: false));
}
return MultiBlocListener(
listeners: [
Expand Down
4 changes: 2 additions & 2 deletions sama_chat_client/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ dependencies:
# receive_sharing_intent: ^1.8.1
receive_sharing_intent:
git:
url: https://github.com/KasemJaffer/receive_sharing_intent
ref: 2cea396843cd3ab1b5ec4334be4233864637874e
url: https://github.com/CubeRomanMagellan/receive_sharing_intent
ref: 9019083edf3ad8232076d8cc82933709f0003220
sama_sdk:
path: ../sama_sdk
scrollable_positioned_list: ^0.3.8
Expand Down