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

Commit

Permalink
Merge branch 'develop' for 0.2.0 release
Browse files Browse the repository at this point in the history
  • Loading branch information
Boehrsi committed Mar 1, 2019
2 parents d71354b + 180d30e commit 56fedca
Show file tree
Hide file tree
Showing 46 changed files with 1,223 additions and 237 deletions.
38 changes: 38 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
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.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
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.
23 changes: 15 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,27 @@

OX Talk is a mail based chat app. This app provides the user interface for an IMAP / SMTP based chat on Android and iOS.

## Relevant information
- [Documentation](https://confluence-public.open-xchange.com/display/COIPublic/OX+Talk+Mobile+App)
- **Android state:** Currently in development
- **iOS state:** Pending

## Information
- [Documentation](https://github.com/open-xchange/ox-talk/wiki/Developer-Documentation)
- The IMAP / SMTP interactions are managed by the [delta_chat_core plugin](https://github.com/open-xchange/flutter-deltachat-core)

## Requirements
- Flutter 1.0 is used
- The latest Flutter stable version is used (if problems occur try the [Flutter Dev Channel](https://github.com/flutter/flutter/wiki/Flutter-build-release-channels))
- The [delta_chat_core plugin](https://github.com/open-xchange/flutter-deltachat-core) needs to be checked out right beside the OX Talk app (the repositories should be located in the same folder) and please follow the requirements given by that project

## Execution of the Flutter app
As for now (08.11.2018) it is required to execute the example app inside the project from console using ```flutter run --target-platform android-arm``` as the DCC is written as 32 bit program and Flutter is a
64 bit program (see https://github.com/flutter/flutter/issues/15530). When using an IDE use ```--target-platform android-arm``` as additional argument in your run configuration.
## Execution
- Build and run the project via your IDE / Flutter CLI

## Development
To be able to edit / extend the ox_talk app the following steps are important after checking out / altering the project:
- No special requirements
To be able to edit / extend this project the following steps are important:

- Perform all actions mentioned under **Execution**
- Implement your changes
- Add tests and code for the test suite
- Create a pull request

### Flutter

Expand Down
6 changes: 4 additions & 2 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@ import 'package:bloc/bloc.dart';
import 'package:delta_chat_core/delta_chat_core.dart';
import 'package:flutter/material.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:ox_talk/source/data/config.dart';
import 'package:ox_talk/source/log/bloc_delegate.dart';
import 'package:ox_talk/source/chatlist/create_chat.dart';
import 'package:ox_talk/source/chat/create_chat.dart';
import 'package:ox_talk/source/contact/contact_change.dart';
import 'package:ox_talk/source/l10n/localizations.dart';
import 'package:ox_talk/source/login/login.dart';
Expand Down Expand Up @@ -132,7 +133,8 @@ class _OxTalkState extends State<_OxTalk> {
Future _setupDefaultValues() async {
String status = await _context.getConfigValue(Context.configSelfStatus);
if (status == AppLocalizations.of(context).deltaChatStatusDefaultValue) {
await _context.setConfigValue(Context.configSelfStatus, AppLocalizations.of(context).editUserSettingsStatusDefaultValue);
Config config = Config();
config.setValue(Context.configSelfStatus, AppLocalizations.of(context).editUserSettingsStatusDefaultValue);
}
}

Expand Down
90 changes: 90 additions & 0 deletions lib/source/chat/change_chat_bloc.dart
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));
}

}
65 changes: 65 additions & 0 deletions lib/source/chat/change_chat_event.dart
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});
}
90 changes: 90 additions & 0 deletions lib/source/chat/change_chat_state.dart
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,
);
}
17 changes: 12 additions & 5 deletions lib/source/chat/chat.dart
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:ox_talk/source/chat/chat_bloc.dart';
import 'package:ox_talk/source/chat/chat_event.dart';
import 'package:ox_talk/source/chat/chat_state.dart';
import 'package:ox_talk/source/chat/messages_bloc.dart';
import 'package:ox_talk/source/chat/messages_event.dart';
import 'package:ox_talk/source/chat/messages_state.dart';
import 'package:ox_talk/source/message/messages_bloc.dart';
import 'package:ox_talk/source/message/messages_event.dart';
import 'package:ox_talk/source/message/messages_state.dart';
import 'package:ox_talk/source/widgets/avatar.dart';

import 'message_item.dart';
import 'package:ox_talk/source/message/message_item.dart';

class ChatScreen extends StatefulWidget {
final int _chatId;
Expand Down Expand Up @@ -150,7 +150,14 @@ class _ChatScreenState extends State<ChatScreen> {
size: 18,
))
: Container(),
Text(subTitle, style: TextStyle(fontSize: 14)),
Expanded(
child: Text(
subTitle,
style: TextStyle(fontSize: 14),
softWrap: true,
overflow: TextOverflow.ellipsis,
),
),
],
),
],
Expand Down
Loading

0 comments on commit 56fedca

Please sign in to comment.