Skip to content
Open
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
311 changes: 155 additions & 156 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,222 +6,221 @@ This document provides guidelines and instructions to make the contribution proc

## Table of Contents

- [What You Can Contribute](#what-you-can-contribute)
- [Contribution Ideas](#contribution-ideas)
- [How to Contribute](#how-to-contribute)
- [Setting Up Development Environment](#setting-up-development-environment)
- [Creating a Professional Pull Request](#creating-a-professional-pull-request)
- [Code of Conduct](#code-of-conduct)
- [Getting Started](#getting-started)
- [Setting Up the Development Environment](#setting-up-the-development-environment)
- [Building the Project](#building-the-project)
- [GitHub Actions CI](#github-actions-ci)
- [Project Structure](#project-structure)
- [Bug Reports](#bug-reports)
- [Feature Requests](#feature-requests)
- [Pull Requests](#pull-requests)
- [Coding Guidelines](#coding-guidelines)
- [Testing](#testing)
- [Troubleshooting](#troubleshooting)
- [Community](#community)

## Code of Conduct

By participating in this project, you agree to abide by the [Rocket.Chat Code of Conduct](https://github.com/RocketChat/Rocket.Chat/blob/develop/CODE_OF_CONDUCT.md). Please read and follow it to ensure a respectful and inclusive environment for all contributors.

## Getting Started

1. Fork the repository on GitHub.
2. Clone the forked repository to your local machine.
3. Follow the instructions below to set up the development environment.
4. Identify an issue or feature you want to work on or create a new issue to discuss your ideas.
5. Before starting the implementation, discuss your approach in the issue comments to ensure that your work aligns with the project's direction and goals.

## Setting Up the Development Environment

To set up the development environment for the Rocket.Chat Flutter SDK, follow these steps:

**Local Setup**
---

Clone the repository:
## What You Can Contribute

```sh
git clone https://github.com/your-username/Rocket_Chat_FlutterSDK.git
```
This is an official **Rocket.Chat Flutter SDK** with a monorepo structure using **Melos**. It contains two main packages:

Congratulations. 🎉. You've successfully cloned our repository, and you are ready to make your first contribution. Before you can start making code changes, there are a few things to configure.
### Packages:
1. **rocket_chat_api** - REST API wrapper for Rocket.Chat
2. **rocket_chat_embeddedchat_component** - Embedded chat UI component

**Melos Setup**
### Current State:
- **rocket_chat_api**: Contains placeholder code (needs full REST API implementation)
- **rocket_chat_embeddedchat_component**: Has basic models and services implemented

RCFlutterSDK uses `Melos` to manage our mono-repository. For those unfamiliar, Melos is used to split up large code bases into separate independently versioned packages. To install Melos, developers can run the following command:
---

```bash
pub global activate melos
```

Once activated, users can now "bootstrap" their local clone by running the following:

```bash
melos bootstrap
```
## Contribution Ideas

Bootstrap will automatically fetch and link dependencies for all packages in the repository. It is the Melos equivalent of running `flutter pub get`.
### High Priority:
1. **Complete rocket_chat_api** - Implement REST API wrapper methods:
- Authentication (login, logout, refresh token)
- Channels/Rooms (create, list, info, members)
- Messages (send, delete, update, reactions)
- Users (info, presence, status)
- Upload/Download files

You're all set, Happy coding!
2. **Add WebSocket support** - Real-time messaging via Rocket.Chat WebSocket API

## Building the Project
3. **Add more UI components**:
- Room list view
- User avatar components
- Message reactions UI
- File attachment handling
- Typing indicators
- Message editing
- Thread support

When building a package, you will not receive a standalone output file like an APK or an app bundle, as the package is meant to be used as a dependency in other Flutter projects. **Ensure that the package is built without any errors and can be easily imported and used in other projects** using following command:
4. **Add state management** - Provider/Riverpod/Bloc integration

1. Install the required dependencies:
5. **Add tests** - Unit and widget tests

```bash
melos bootstrap
```
### Medium Priority:
- Error handling improvements
- Offline support
- Caching layer
- Pagination helpers
- Input validation

2. Run test with melos, hit:
---

```bash
melos run test
```
## How to Contribute

3. Analyze code with melos, hit:
### Step 1: Fork the Repository

```bash
melos run analyze
```
1. Go to [Rocket.Chat Flutter SDK](https://github.com/RocketChat/Rocket.Chat.Flutter.SDK)
2. Click the **Fork** button in the top-right corner
3. Select your GitHub account to create the fork

4. Compile and dry-run publish with Melos, hit:
### Step 2: Clone Your Fork

```bash
melos run publish
```
```
bash
# Clone your forked repository
git clone https://github.com/aburiro/Rocket.Chat.Flutter.SDK.git

### Build Artifacts
# Navigate to the project directory
cd Rocket.Chat.Flutter.SDK
```

For the sample apps included in each package, you can build them as you would with any other Flutter application, and you'll get an output file (e.g., APK for Android) after the build process is completed.
### Step 3: Set Up Development Environment

To build a sample package:
```
bash
# Install Melos globally
pub global activate melos

1. Navigate to the app's root directory
# Bootstrap the project (installs all dependencies)
melos bootstrap

```sh
cd rocket_chat_api/sample_app
```
or
```sh
cd rocket_chat_embeddedchat_component/sample_app
```
2. Get all dependencies
# Verify the setup by running tests
melos run test

```bash
flutter pub get
```
# Analyze code for issues
melos run analyze
```

3. Run:
```bash
flutter build <platform>
```
### Step 4: Create a Feature Branch

Replace `<platform>` with the platform you are targeting (e.g., `apk`, `ios`, `web`).
After building, the artifacts for each sample apps will be located in the following directories:
```
bash
# Create a new branch with a descriptive name
#

- `rocket_chat_embeddedchat_component`: `packages/rocket_chat_embeddedchat_component/sample_app/build/outputs`
- `rocket_chat_api`: `packages/rocket_chat_api/sample_app/build/outputs`
```

### Error Logs
### Step 5: Make Your Changes

If the build process encounters any errors, check the terminal or debug console in your development environment (e.g., VSCode) for error messages and stack traces.
1. Implement your feature or fix
2. Write tests for your changes
3. Follow the coding guidelines:
- Follow [Effective Dart](https://dart.dev/guides/language/effective-dart) guidelines
- Keep functions and classes focused on single responsibility
- Comment complex logic
- Use meaningful names for variables and functions

## GitHub Actions CI
### Step 6: Commit Your Changes

The project is integrated with GitHub Actions CI, which automatically builds and tests the packages on every push and pull request. The CI configuration can be found in `.github/workflows/ci.yml`.
```
bash
# Stage your changes
git add .

### CI Logs
# Commit with a descriptive message
git commit -m "Add: Implement authentication API methods

If the CI process fails, logs can be accessed from the "Actions" tab in the GitHub repository. Click on the specific run, and then select the failed job to view the logs.
- Added login, logout, and refreshToken methods
- Added proper error handling
- Added unit tests for authentication"
```

## Project Structure
### Step 7: Push to Your Fork

- `.github`: GitHub files including issue templates, pull request templates, and GitHub Action scripts.
```
bash
# Push your changes to your forked repository

- `packages/`: contains all the packages for Rocket Chat.
- `rocket_chat_api/`: contains the core package for Rocket Chat Flutter.
- `lib/`: contains the source code for the package.
- `test/`: contains unit, widget and integration tests for the package.
- `pubspec.yaml`: contains the package dependencies and other metadata.
- `sample_app`: contains the example Flutter application for the rocket_chat_api.
```

- `rocket_chat_embeddedchat_component/`: contains the Flutter UI package for Rocket Chat.
- `lib/`: contains the source code for the package.
- `test/`: contains unit, widget and integration tests for the package.
- `pubspec.yaml`: contains the package dependencies and other metadata.
- `sample_app`: contains the example Flutter application for the rocket_chat_embeddedchat_component.
- `.gitignore`: Listing of files and file extensions ignored for this project.
- `README`: Project overview and usage guide.
- `LICENSE`: Legal.
- `melos.yaml`: Configuration file used to control [Melos](https://pub.dev/packages/melos), our mono-repo management tool of choice.
---

## Creating a Professional Pull Request

## Bug Reports
### Step 1: Open Pull Request

When reporting a bug, please include the following information:
1. Go to your forked repository on GitHub
2. Click **Compare & pull request**
3. Or navigate to the original repository and click **New pull request**

- A clear and concise description of the issue.
- Steps to reproduce the problem.
- Any relevant logs or error messages.
- Information about your environment, such as the Flutter and Dart versions, OS, and device (if applicable).
- Possible solutions or workarounds, if you have any.
### Step 2: Write a Professional PR Description

Please create an issue using the "Bug report" template on GitHub.
Use this template:

## Feature Requests
```
markdown
## Description
[Short description of what this PR does]

## Type of Change
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] Documentation update

## How Has This Been Tested?
[Describe the tests you ran to verify your changes]

## Checklist:
- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been merged and published in downstream modules

When requesting a new feature, please include the following information:

- A clear and concise description of the feature.
- An explanation of why the feature is useful and how it aligns with the project's goals.
- Any relevant examples or use cases.
- Possible implementation approaches or considerations, if you have any.
```

Please create an issue using the "Feature request" template on GitHub.

## Pull Requests
## Setting Up Development Environment

Before submitting a pull request, please make sure that your changes adhere to the following guidelines:
### Prerequisites:
- Flutter SDK (latest stable version)
- Dart SDK
- Git
- A code editor (VS Code recommended)

- The code follows the project's coding guidelines and best practices.
- The code has been tested, and all tests pass.
- The code is well-documented, and any new features or changes are explained in the issue and PR comments.
- The PR is linked to a relevant issue, and the issue is referenced in the PR description.
- The PR title and description clearly describe the changes and their purpose.
### Build Commands:

## Coding Guidelines
```
bash
# Install dependencies
melos bootstrap

- Follow the [Effective Dart](https://dart.dev/guides/language/effective-dart) guidelines.
- Adhere to the project's code style and linting rules.
- Write clean, maintainable, and modular code.
- Keep functions and classes focused on a single responsibility.
- Comment your code to explain complex or unusual logic.
- Use meaningful names for variables, functions, and classes.
# Run tests
melos run test

## Testing
# Analyze code
melos run analyze

- Write unit, integration, and widget tests for your code.
- Make sure all tests pass before submitting a pull request.
- Update or add new tests if you make changes to existing code or implement new features.
- Follow the project's testing best practices and conventions.
# Build example app
cd packages/rocket_chat_embeddedchat_component/example
flutter build apk
```

## Troubleshooting
---

If you encounter any issues during the build process or while using the package, follow these steps to troubleshoot:
## Code of Conduct

1. **Check the build logs**: Make sure to carefully examine the build logs in the terminal or your IDE's debug console for any error messages or warnings.
2. **Verify dependencies**: Double-check your `pubspec.yaml` file to ensure that all dependencies are listed and their versions are compatible.
3. **Flutter doctor**: Run `flutter doctor` to identify any potential issues with your Flutter installation or development environment.
4. **Clean and rebuild**: Sometimes, issues can be resolved by simply cleaning your project's build cache and rebuilding. Run `flutter clean` followed by build instruction to perform a clean rebuild of your project.
5. **Search for known issues**: Check the package's GitHub repository for any reported issues or ongoing discussions related to your problem.
6. **Ask for help**: If you're still having trouble, don't hesitate to reach out to the Rocket.Chat community or create a new issue on the GitHub repository.
By participating in this project, you agree to abide by the [Rocket.Chat Code of Conduct](https://github.com/RocketChat/Rocket.Chat/blob/develop/CODE_OF_CONDUCT.md). Please read and follow it to ensure a respectful and inclusive environment for all contributors.

For more specific guidance on troubleshooting, please provide detailed information about the issue you're facing, including error messages, logs, and any steps you've already taken to resolve the problem.
---

## Community
## Need Help?

We value the contribution of each member of our community and encourage open and respectful communication. If you have any questions or need assistance, feel free to reach out in the project's communication channels, such as GitHub issues or the Rocket.Chat community.
- Check existing [Issues](https://github.com/RocketChat/Rocket.Chat.Flutter.SDK/issues)
- Check [Discussions](https://github.com/RocketChat/Rocket.Chat.Flutter.SDK/discussions)
- Join Rocket.Chat community

Thank you for your interest in contributing to the Rocket.Chat Flutter SDK! Together, we can make this project better and help shape the future of Rocket.Chat and its integrations.
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
library rocket_chat_embeddedchat_component;

/// A Calculator.
class Calculator {
/// Returns [value] plus 1.
int addOne(int value) => value + 1;
}
// Models
export 'src/models/models.dart';

// Services
export 'src/services/services.dart';

// Widgets
export 'src/widgets/widgets.dart';
Loading