Skip to content
This repository has been archived by the owner on Oct 19, 2022. It is now read-only.

Commit

Permalink
OT-476 Update all dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
Boehrsi committed Oct 24, 2019
1 parent d886922 commit 421911a
Show file tree
Hide file tree
Showing 83 changed files with 376 additions and 357 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ coverage/

# Tests
screenshots/
/test_driver/logs/log.txt

# Android related
**/android/**/gradle-wrapper.jar
Expand All @@ -39,6 +40,8 @@ screenshots/
**/android/gradlew.bat
**/android/local.properties
**/android/**/GeneratedPluginRegistrant.java
/android/key.properties


# iOS/XCode related
**/ios/**/*.mode1v3
Expand Down Expand Up @@ -74,4 +77,3 @@ screenshots/
!**/ios/**/default.perspectivev3
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
/android/key.properties
/test_driver/logs/log.txt
10 changes: 6 additions & 4 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ void main() {
BlocProvider<BackgroundBloc>(
builder: (BuildContext context) {
var backgroundBloc = BackgroundBloc();
backgroundBloc.dispatch(BackgroundListenerSetup());
backgroundBloc.add(BackgroundListenerSetup());
return backgroundBloc;
},
),
Expand Down Expand Up @@ -141,12 +141,14 @@ class OxCoi extends StatefulWidget {

class _OxCoiState extends State<OxCoi> {
MainBloc _mainBloc = MainBloc();
// Ignoring false positive https://github.com/felangel/bloc/issues/587
// ignore: close_sinks
ShareBloc shareBloc = ShareBloc();

@override
void initState() {
super.initState();
_mainBloc.dispatch(PrepareApp(context: context));
_mainBloc.add(PrepareApp(context: context));
}

@override
Expand All @@ -170,9 +172,9 @@ class _OxCoiState extends State<OxCoi> {
}

_loginSuccess() {
BlocProvider.of<PushBloc>(context).dispatch(RegisterPushResource());
BlocProvider.of<PushBloc>(context).add(RegisterPushResource());
Navigation navigation = Navigation();
navigation.popUntil(context, ModalRoute.withName(Navigation.root));
_mainBloc.dispatch(AppLoaded(configured: true));
_mainBloc.add(AppLoaded(configured: true));
}
}
4 changes: 2 additions & 2 deletions lib/src/antiMobbing/anti_mobbing_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,12 @@ class _AntiMobbingListState extends State<AntiMobbingList> {
void initState() {
super.initState();
navigation.current = Navigatable(Type.antiMobbingList);
_antiMobbingListBloc.dispatch(RequestMessages());
_antiMobbingListBloc.add(RequestMessages());
}

@override
void dispose() {
_antiMobbingListBloc.dispose();
_antiMobbingListBloc.close();
super.dispose();
}

Expand Down
8 changes: 4 additions & 4 deletions lib/src/antiMobbing/anti_mobbing_list_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@ class AntiMobbingListBloc extends Bloc<AntiMobbingListEvent, AntiMobbingListStat
}

@override
void dispose() {
void close() {
_messageListRepository?.removeListener(_repositoryStreamHandler);
_repositoryStreamHandler?.tearDown();
super.dispose();
super.close();
}

void _setupMessagesListener() async {
Expand All @@ -95,7 +95,7 @@ class AntiMobbingListBloc extends Bloc<AntiMobbingListEvent, AntiMobbingListStat
}
}

void _onMessagesChanged(event) => dispatch(UpdateMessages());
void _onMessagesChanged(event) => add(UpdateMessages());

void loadMessages() async {
List<int> dateMakerIds = List();
Expand All @@ -121,7 +121,7 @@ class AntiMobbingListBloc extends Bloc<AntiMobbingListEvent, AntiMobbingListStat
}
});

dispatch(MessagesLoaded(
add(MessagesLoaded(
messageIds: uniqueInviteMap.values.toList(growable: false),
messageLastUpdateValues: lastUpdateValues.toList(growable: false),
dateMarkerIds: dateMakerIds));
Expand Down
4 changes: 2 additions & 2 deletions lib/src/background/background_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ class BackgroundBloc extends Bloc<BackgroundEvent, BackgroundState> {

void setup() {
SystemChannels.lifecycle.setMessageHandler((state) async {
dispatch(BackgroundStateChange(state: state));
add(BackgroundStateChange(state: state));
return state;
});
dispatch(BackgroundStateChange(state: AppLifecycleState.resumed.toString()));
add(BackgroundStateChange(state: AppLifecycleState.resumed.toString()));
}
}
50 changes: 26 additions & 24 deletions lib/src/chat/chat.dart
Original file line number Diff line number Diff line change
Expand Up @@ -124,27 +124,27 @@ class _ChatState extends State<Chat> with ChatComposer, ChatCreateMixin, InviteM
void initState() {
super.initState();
navigation.current = Navigatable(Type.chat, params: [widget.chatId]);
_chatBloc.dispatch(RequestChat(chatId: widget.chatId, isHeadless: widget.headlessStart, messageId: widget.messageId));
final chatObservable = new Observable<ChatState>(_chatBloc.state);
_chatBloc.add(RequestChat(chatId: widget.chatId, isHeadless: widget.headlessStart, messageId: widget.messageId));
final chatObservable = new Observable<ChatState>(_chatBloc);
chatObservable.listen((state) {
if (state is ChatStateSuccess) {
_phoneNumbers = state.phoneNumbers;
_messageListBloc.dispatch(RequestMessages(chatId: widget.chatId, messageId: widget.messageId));
_messageListBloc.add(RequestMessages(chatId: widget.chatId, messageId: widget.messageId));
if (widget.newMessage != null || widget.newPath != null) {
if (widget.newPath.isEmpty) {
_messageListBloc.dispatch(SendMessage(text: widget.newMessage));
_messageListBloc.add(SendMessage(text: widget.newMessage));
} else {
_messageListBloc.dispatch(SendMessage(path: widget.newPath, fileType: widget.newFileType, text: widget.newMessage));
_messageListBloc.add(SendMessage(path: widget.newPath, fileType: widget.newFileType, text: widget.newMessage));
}
}
}
});
final chatComposerObservable = new Observable<ChatComposerState>(_chatComposerBloc.state);
final chatComposerObservable = new Observable<ChatComposerState>(_chatComposerBloc);
chatComposerObservable.listen((state) => handleChatComposer(state));
final messagesObservable = new Observable<MessageListState>(_messageListBloc.state);
final messagesObservable = new Observable<MessageListState>(_messageListBloc);
messagesObservable.listen((state) {
if (state is MessagesStateSuccess) {
_chatChangeBloc.dispatch(ChatMarkMessagesSeen(messageIds: state.messageIds));
_chatChangeBloc.add(ChatMarkMessagesSeen(messageIds: state.messageIds));
}
});

Expand Down Expand Up @@ -225,10 +225,10 @@ class _ChatState extends State<Chat> with ChatComposer, ChatCreateMixin, InviteM

@override
void dispose() {
_chatBloc.dispose();
_messageListBloc.dispose();
_chatComposerBloc.dispose();
_chatChangeBloc.dispose();
_chatBloc.close();
_messageListBloc.close();
_chatComposerBloc.close();
_chatChangeBloc.close();
super.dispose();
}

Expand Down Expand Up @@ -339,14 +339,16 @@ class _ChatState extends State<Chat> with ChatComposer, ChatCreateMixin, InviteM
}

_blockContact() {
_messageListBloc.dispose();
_messageListBloc.close();
// Ignoring false positive https://github.com/felangel/bloc/issues/587
// ignore: close_sinks
ContactChangeBloc contactChangeBloc = ContactChangeBloc();
contactChangeBloc.dispatch(BlockContact(messageId: widget.messageId, chatId: widget.chatId));
contactChangeBloc.add(BlockContact(messageId: widget.messageId, chatId: widget.chatId));
navigation.popUntil(context, ModalRoute.withName(Navigation.root));
}

_createChat() {
_messageListBloc.dispose();
_messageListBloc.close();
createChatFromMessage(context, widget.messageId, widget.chatId);
}

Expand Down Expand Up @@ -567,7 +569,7 @@ class _ChatState extends State<Chat> with ChatComposer, ChatCreateMixin, InviteM
_scrollController.jumpTo(0.0);
}
if (isInviteChat(widget.chatId)) {
_messageListBloc.dispose();
_messageListBloc.close();
createChatFromMessage(context, widget.messageId, widget.chatId, _handleCreateChatSuccess);
} else {
_onMessageSend();
Expand All @@ -594,10 +596,10 @@ class _ChatState extends State<Chat> with ChatComposer, ChatCreateMixin, InviteM
String text = _textController.text;
_textController.clear();
if (_filePath.isEmpty) {
_messageListBloc.dispatch(SendMessage(text: text));
_messageListBloc.add(SendMessage(text: text));
} else {
int type = getType();
_messageListBloc.dispatch(SendMessage(path: _filePath, fileType: type, text: text, isShared: widget.sharedData != null));
_messageListBloc.add(SendMessage(path: _filePath, fileType: type, text: text, isShared: widget.sharedData != null));
}

_closePreview();
Expand Down Expand Up @@ -639,22 +641,22 @@ class _ChatState extends State<Chat> with ChatComposer, ChatCreateMixin, InviteM

_onRecordAudioPressed() async {
if (ComposerModeType.isVoiceRecording != _getComposerType()) {
_chatComposerBloc.dispatch(StartAudioRecording());
_chatComposerBloc.add(StartAudioRecording());
} else {
_chatComposerBloc.dispatch(StopAudioRecording(shouldSend: true));
_chatComposerBloc.add(StopAudioRecording(shouldSend: true));
}
}

_onAudioRecordingAbort() {
_chatComposerBloc.dispatch(StopAudioRecording(shouldSend: false));
_chatComposerBloc.add(StopAudioRecording(shouldSend: false));
}

_onCaptureImagePressed() {
_chatComposerBloc.dispatch(StartImageOrVideoRecording(pickImage: true));
_chatComposerBloc.add(StartImageOrVideoRecording(pickImage: true));
}

_onRecordVideoPressed() {
_chatComposerBloc.dispatch(StartImageOrVideoRecording(pickImage: false));
_chatComposerBloc.add(StartImageOrVideoRecording(pickImage: false));
}

void _showAttachmentChooser() {
Expand Down Expand Up @@ -713,7 +715,7 @@ class _ChatState extends State<Chat> with ChatComposer, ChatCreateMixin, InviteM
void _closePreview() {
setState(() {
if (widget.sharedData != null) {
_messageListBloc.dispatch(DeleteCacheFile(path: _filePath));
_messageListBloc.add(DeleteCacheFile(path: _filePath));
}
_filePath = "";
_selectedExtension = "";
Expand Down
10 changes: 5 additions & 5 deletions lib/src/chat/chat_add_group_participants.dart
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class _ChatAddGroupParticipantsState extends State<ChatAddGroupParticipants> {
void initState() {
super.initState();
navigation.current = Navigatable(Type.chatAddGroupParticipants);
_contactListBloc.dispatch(RequestContacts(typeOrChatId: validContacts));
_contactListBloc.add(RequestContacts(typeOrChatId: validContacts));
}

@override
Expand Down Expand Up @@ -131,7 +131,7 @@ class _ChatAddGroupParticipantsState extends State<ChatAddGroupParticipants> {
}

Widget onBuildResultOrSuggestion(String query) {
_contactListBloc.dispatch(SearchContacts(query: query));
_contactListBloc.add(SearchContacts(query: query));
return buildList();
}

Expand Down Expand Up @@ -225,16 +225,16 @@ class _ChatAddGroupParticipantsState extends State<ChatAddGroupParticipants> {
}

void onSearchClose() {
_contactListBloc.dispatch(RequestContacts(typeOrChatId: validContacts));
_contactListBloc.add(RequestContacts(typeOrChatId: validContacts));
}

_itemTapped(int id) {
_contactListBloc.dispatch(ContactsSelectionChanged(id: id));
_contactListBloc.add(ContactsSelectionChanged(id: id));
}

_onSubmit() async {
if (_contactListBloc.contactsSelectedCount > 0) {
_chatChangeBloc.dispatch(ChatAddParticipants(chatId: widget.chatId, contactIds: _contactListBloc.contactsSelected));
_chatChangeBloc.add(ChatAddParticipants(chatId: widget.chatId, contactIds: _contactListBloc.contactsSelected));
navigation.pop(context);
} else {
showToast(L10n.get(L.groupAddNoParticipants));
Expand Down
8 changes: 4 additions & 4 deletions lib/src/chat/chat_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,10 @@ class ChatBloc extends Bloc<ChatEvent, ChatState> {
}

@override
void dispose() {
void close() {
_chatRepository.removeListener(_repositoryStreamHandler);
_repositoryStreamHandler?.tearDown();
super.dispose();
super.close();
}

void _setupChatListener() async {
Expand All @@ -131,7 +131,7 @@ class ChatBloc extends Bloc<ChatEvent, ChatState> {
String email = await contact.getAddress();
int colorValue = await contact.getColor();
Color color = rgbColorFromInt(colorValue);
dispatch(
add(
ChatLoaded(
name: name,
subTitle: email,
Expand Down Expand Up @@ -186,7 +186,7 @@ class ChatBloc extends Bloc<ChatEvent, ChatState> {
subTitle = await contact.getAddress();
}
}
dispatch(
add(
ChatLoaded(
name: name,
subTitle: subTitle,
Expand Down
4 changes: 2 additions & 2 deletions lib/src/chat/chat_change_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ class ChatChangeBloc extends Bloc<ChatChangeEvent, ChatChangeState> {
}
}
_chatRepository.putIfAbsent(id: chatId);
dispatch(ChatCreated(chatId: chatId));
add(ChatCreated(chatId: chatId));
}

void _deleteChat(int chatId) async {
Expand Down Expand Up @@ -173,7 +173,7 @@ class ChatChangeBloc extends Bloc<ChatChangeEvent, ChatChangeState> {
Context context = Context();
await context.setChatName(chatId, newName);
RepositoryManager.get(RepositoryType.chat).get(chatId).set(Chat.methodChatGetName, newName);
dispatch(SetNameCompleted());
add(SetNameCompleted());
}

void _setProfileImage(int chatId, String newPath) async {
Expand Down
8 changes: 4 additions & 4 deletions lib/src/chat/chat_composer_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ class ChatComposerBloc extends Bloc<ChatComposerEvent, ChatComposerState> {
_audioPath = await _flutterSound.startRecorder("$name", bitRate: 64000, numChannels: 1);
_recorderSubscription = _flutterSound.onRecorderStateChanged.listen((e) {
String timer = getTimerFromTimestamp(e.currentPosition.toInt());
dispatch(UpdateAudioRecording(timer: timer));
add(UpdateAudioRecording(timer: timer));
});
}

Expand All @@ -116,7 +116,7 @@ class ChatComposerBloc extends Bloc<ChatComposerEvent, ChatComposerState> {
} catch (err) {
print('stopRecorder error: $err');
}
dispatch(AudioRecordingStopped(audioPath: _audioPath, shouldSend: shouldSend));
add(AudioRecordingStopped(audioPath: _audioPath, shouldSend: shouldSend));
}

Future<void> startImageOrVideoRecorder(bool pickImage) async {
Expand All @@ -130,9 +130,9 @@ class ChatComposerBloc extends Bloc<ChatComposerEvent, ChatComposerState> {
type = ChatMsg.typeVideo;
}
if (file != null) {
dispatch(StopImageOrVideoRecording(filePath: file.path, type: type));
add(StopImageOrVideoRecording(filePath: file.path, type: type));
} else {
dispatch(StopImageOrVideoRecording(filePath: null, type: 0));
add(StopImageOrVideoRecording(filePath: null, type: 0));
}
}

Expand Down
8 changes: 4 additions & 4 deletions lib/src/chat/chat_create.dart
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,12 @@ class _ChatCreateState extends State<ChatCreate> {
void initState() {
super.initState();
navigation.current = Navigatable(Type.chatCreate);
_contactListBloc.dispatch(RequestContacts(typeOrChatId: validContacts));
_contactListBloc.add(RequestContacts(typeOrChatId: validContacts));
}

@override
void dispose() {
_contactListBloc.dispose();
_contactListBloc.close();
super.dispose();
}

Expand Down Expand Up @@ -112,12 +112,12 @@ class _ChatCreateState extends State<ChatCreate> {
}

Widget onBuildResultOrSuggestion(String query) {
_contactListBloc.dispatch(SearchContacts(query: query));
_contactListBloc.add(SearchContacts(query: query));
return buildList(false);
}

void onSearchClose() {
_contactListBloc.dispatch(RequestContacts(typeOrChatId: validContacts));
_contactListBloc.add(RequestContacts(typeOrChatId: validContacts));
}

Widget buildList(bool showNewContactAndAddGroup) {
Expand Down
Loading

0 comments on commit 421911a

Please sign in to comment.