This repository has been archived by the owner on Oct 19, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' for 0.2.0 release
- Loading branch information
Showing
46 changed files
with
1,223 additions
and
237 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
--- | ||
name: Bug report | ||
about: Create a report to help us improve | ||
title: '' | ||
labels: '' | ||
assignees: '' | ||
|
||
--- | ||
|
||
**Describe the bug** | ||
A clear and concise description of what the bug is. | ||
|
||
**To Reproduce** | ||
Occurrence: [always / 5 out of 10 times / rarely] | ||
Steps to reproduce the behavior: | ||
1. Go to '...' | ||
2. Click on '....' | ||
3. Scroll down to '....' | ||
4. See error | ||
|
||
**Expected behavior** | ||
A clear and concise description of what you expected to happen. | ||
|
||
**Screenshots** | ||
If applicable, add screenshots to help explain your problem. | ||
|
||
**App information (please complete the following information):** | ||
- App version: [e.g. 0.4.0] | ||
- Plugin version: [e.g. 0.4.0] | ||
- Delta Chat Core version: [e.g. 0.40.0] | ||
- Flutter version: [e.g. 1.0] | ||
|
||
**Smartphone (please complete the following information):** | ||
- Device: [e.g. iPhone6] | ||
- OS: [e.g. iOS8.1] | ||
|
||
**Additional context** | ||
Add any other context about the problem here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
name: Feature request | ||
about: Suggest an idea for this project | ||
title: '' | ||
labels: '' | ||
assignees: '' | ||
|
||
--- | ||
|
||
**Is your feature request related to a problem? Please describe.** | ||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] | ||
|
||
**Describe the solution you'd like** | ||
A clear and concise description of what you want to happen. | ||
|
||
**Describe alternatives you've considered** | ||
A clear and concise description of any alternative solutions you've considered. | ||
|
||
**Additional context** | ||
Add any other context or screenshots about the feature request here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
/* | ||
* OPEN-XCHANGE legal information | ||
* | ||
* All intellectual property rights in the Software are protected by | ||
* international copyright laws. | ||
* | ||
* | ||
* In some countries OX, OX Open-Xchange and open xchange | ||
* as well as the corresponding Logos OX Open-Xchange and OX are registered | ||
* trademarks of the OX Software GmbH group of companies. | ||
* The use of the Logos is not covered by the Mozilla Public License 2.0 (MPL 2.0). | ||
* Instead, you are allowed to use these Logos according to the terms and | ||
* conditions of the Creative Commons License, Version 2.5, Attribution, | ||
* Non-commercial, ShareAlike, and the interpretation of the term | ||
* Non-commercial applicable to the aforementioned license is published | ||
* on the web site https://www.open-xchange.com/terms-and-conditions/. | ||
* | ||
* Please make sure that third-party modules and libraries are used | ||
* according to their respective licenses. | ||
* | ||
* Any modifications to this package must retain all copyright notices | ||
* of the original copyright holder(s) for the original code used. | ||
* | ||
* After any such modifications, the original and derivative code shall remain | ||
* under the copyright of the copyright holder(s) and/or original author(s) as stated here: | ||
* https://www.open-xchange.com/legal/. The contributing author shall be | ||
* given Attribution for the derivative code and a license granting use. | ||
* | ||
* Copyright (C) 2016-2020 OX Software GmbH | ||
* Mail: [email protected] | ||
* | ||
* | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
* | ||
* This program is distributed in the hope that it will be useful, but | ||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | ||
* or FITNESS FOR A PARTICULAR PURPOSE. See the Mozilla Public License 2.0 | ||
* for more details. | ||
*/ | ||
|
||
import 'dart:async'; | ||
|
||
import 'package:bloc/bloc.dart'; | ||
import 'package:delta_chat_core/delta_chat_core.dart'; | ||
import 'package:ox_talk/source/chat/change_chat_event.dart'; | ||
import 'package:ox_talk/source/chat/change_chat_state.dart'; | ||
import 'package:ox_talk/source/data/chat_repository.dart'; | ||
import 'package:ox_talk/source/data/repository.dart'; | ||
import 'package:ox_talk/source/data/repository_manager.dart'; | ||
|
||
class ChangeChatBloc extends Bloc<ChangeChatEvent, ChangeChatState> { | ||
Repository<ChatMsg> messagesRepository; | ||
|
||
@override | ||
ChangeChatState get initialState => CreateChatStateInitial(); | ||
|
||
@override | ||
Stream<ChangeChatState> mapEventToState(ChangeChatState currentState, ChangeChatEvent event) async* { | ||
if (event is CreateChat) { | ||
yield CreateChatStateLoading(); | ||
try { | ||
messagesRepository = RepositoryManager.get(RepositoryType.chatMessage, event.chatId); | ||
_createChat(contactId: event.contactId, messageId: event.messageId, verified: event.verified, name: event.name); | ||
} catch (error) { | ||
yield CreateChatStateFailure(error: error.toString()); | ||
} | ||
} else if (event is ChatCreated) { | ||
yield CreateChatStateSuccess(chatId: event.chatId); | ||
} | ||
} | ||
|
||
void _createChat({int contactId, int messageId, bool verified, String name}) async { | ||
Context context = Context(); | ||
var chatId; | ||
if (contactId != null) { | ||
chatId = await context.createChatByContactId(contactId); | ||
} else if (messageId != null) { | ||
messagesRepository.remove(messageId); | ||
chatId = await context.createChatByMessageId(messageId); | ||
} else if (verified != null && name != null) { | ||
chatId = await context.createGroupChat(verified, name); | ||
} | ||
Repository<Chat> chatRepository = ChatRepository(Chat.getCreator()); | ||
chatRepository.putIfAbsent(id: chatId); | ||
dispatch(ChatCreated(chatId: chatId)); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/* | ||
* OPEN-XCHANGE legal information | ||
* | ||
* All intellectual property rights in the Software are protected by | ||
* international copyright laws. | ||
* | ||
* | ||
* In some countries OX, OX Open-Xchange and open xchange | ||
* as well as the corresponding Logos OX Open-Xchange and OX are registered | ||
* trademarks of the OX Software GmbH group of companies. | ||
* The use of the Logos is not covered by the Mozilla Public License 2.0 (MPL 2.0). | ||
* Instead, you are allowed to use these Logos according to the terms and | ||
* conditions of the Creative Commons License, Version 2.5, Attribution, | ||
* Non-commercial, ShareAlike, and the interpretation of the term | ||
* Non-commercial applicable to the aforementioned license is published | ||
* on the web site https://www.open-xchange.com/terms-and-conditions/. | ||
* | ||
* Please make sure that third-party modules and libraries are used | ||
* according to their respective licenses. | ||
* | ||
* Any modifications to this package must retain all copyright notices | ||
* of the original copyright holder(s) for the original code used. | ||
* | ||
* After any such modifications, the original and derivative code shall remain | ||
* under the copyright of the copyright holder(s) and/or original author(s) as stated here: | ||
* https://www.open-xchange.com/legal/. The contributing author shall be | ||
* given Attribution for the derivative code and a license granting use. | ||
* | ||
* Copyright (C) 2016-2020 OX Software GmbH | ||
* Mail: [email protected] | ||
* | ||
* | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
* | ||
* This program is distributed in the hope that it will be useful, but | ||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | ||
* or FITNESS FOR A PARTICULAR PURPOSE. See the Mozilla Public License 2.0 | ||
* for more details. | ||
*/ | ||
|
||
abstract class ChangeChatEvent {} | ||
|
||
class CreateChat extends ChangeChatEvent { | ||
final int contactId; | ||
final int messageId; | ||
final int chatId; | ||
final bool verified; | ||
final String name; | ||
|
||
CreateChat({ | ||
this.contactId, | ||
this.messageId, | ||
this.chatId, | ||
this.verified, | ||
this.name, | ||
}); | ||
} | ||
|
||
class ChatCreated extends ChangeChatEvent { | ||
final int chatId; | ||
|
||
ChatCreated({this.chatId}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
/* | ||
* OPEN-XCHANGE legal information | ||
* | ||
* All intellectual property rights in the Software are protected by | ||
* international copyright laws. | ||
* | ||
* | ||
* In some countries OX, OX Open-Xchange and open xchange | ||
* as well as the corresponding Logos OX Open-Xchange and OX are registered | ||
* trademarks of the OX Software GmbH group of companies. | ||
* The use of the Logos is not covered by the Mozilla Public License 2.0 (MPL 2.0). | ||
* Instead, you are allowed to use these Logos according to the terms and | ||
* conditions of the Creative Commons License, Version 2.5, Attribution, | ||
* Non-commercial, ShareAlike, and the interpretation of the term | ||
* Non-commercial applicable to the aforementioned license is published | ||
* on the web site https://www.open-xchange.com/terms-and-conditions/. | ||
* | ||
* Please make sure that third-party modules and libraries are used | ||
* according to their respective licenses. | ||
* | ||
* Any modifications to this package must retain all copyright notices | ||
* of the original copyright holder(s) for the original code used. | ||
* | ||
* After any such modifications, the original and derivative code shall remain | ||
* under the copyright of the copyright holder(s) and/or original author(s) as stated here: | ||
* https://www.open-xchange.com/legal/. The contributing author shall be | ||
* given Attribution for the derivative code and a license granting use. | ||
* | ||
* Copyright (C) 2016-2020 OX Software GmbH | ||
* Mail: [email protected] | ||
* | ||
* | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
* | ||
* This program is distributed in the hope that it will be useful, but | ||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | ||
* or FITNESS FOR A PARTICULAR PURPOSE. See the Mozilla Public License 2.0 | ||
* for more details. | ||
*/ | ||
|
||
import 'package:meta/meta.dart'; | ||
import 'package:ox_talk/source/base/bloc_base_state.dart'; | ||
|
||
abstract class ChangeChatState extends BaseState { | ||
ChangeChatState({ | ||
@required isLoading, | ||
@required isSuccess, | ||
@required error, | ||
}) : super(isLoading: isLoading, isSuccess: isSuccess, error: error); | ||
} | ||
|
||
class CreateChatStateInitial extends ChangeChatState { | ||
CreateChatStateInitial() | ||
: super( | ||
isLoading: false, | ||
isSuccess: false, | ||
error: '', | ||
); | ||
} | ||
|
||
class CreateChatStateLoading extends ChangeChatState { | ||
CreateChatStateLoading() | ||
: super( | ||
isLoading: true, | ||
isSuccess: false, | ||
error: '', | ||
); | ||
} | ||
|
||
class CreateChatStateSuccess extends ChangeChatState { | ||
final int chatId; | ||
|
||
CreateChatStateSuccess({@required this.chatId}) | ||
: super( | ||
isLoading: false, | ||
isSuccess: true, | ||
error: '', | ||
); | ||
} | ||
|
||
class CreateChatStateFailure extends ChangeChatState { | ||
CreateChatStateFailure({@required error}) | ||
: super( | ||
isLoading: false, | ||
isSuccess: false, | ||
error: error, | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.