Contributions are highly encouraged!
When contributing code to Pattle, your code will be licensed under the AGPLv3.
General contribution steps
- Fork the project.
- Create a feature/bug branch named, for example:
- Make your changes.
- Add copyright notices
- If you have edited an existing file, add your copyright notice
under the existing ones last, in the format of:
Copyright (C) YEAR Full Name <email@example.com>Note the double space between
- If you created a file, add the license file header with your name and email. (See File headers)
- If you have edited an existing file, add your copyright notice under the existing ones last, in the format of:
- Commit your changes and create a merge request.
Note that if you're creating a new feature, you probably also need to implement an API call in Trace.
Every file has a license header with copyright notices. Every copyright notice is in the format of:
Copyright (C) YEAR Full Name <firstname.lastname@example.org>
Note the double space between the year and full name.
The creator of the file is on top, and every contributor afterwards is listed below in chronological order. An example file header would be:
/** * Copyright (C) 2018 Wilko Manger <email@example.com> * Copyright (C) 2018 Nathan van Beelen <firstname.lastname@example.org> * * This file is part of Pattle. * * Pattle is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Pattle 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 * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with Pattle. If not, see <https://www.gnu.org/licenses/>. */
Wilko Manger is the file creator, and
Nathan van Beelen contributed later on.
Pattle is structured and designed along the principles of MVVM. It's recommend that you read up on this before contributing.
- Anko: Android Kotlin helper
- Koin: Simple dependency injection
There are two top level packages:
representing the data and UI layer respectively.
data ├── chat │ ├── event │ │ └── model │ ├── message │ └── overview ├── media ├── sync └── user
data package contains a package for each type of resource, for example:
chat, where the latter is again divided into specific
resource packages like
An odd one out is the
user resource, it does not simply fetch
also handles other user management related tasks like logging in, registering,
checking if a username is available, etc.
These 'resource packages' can contain a
LocalSource, for example
MediaLocalSource. They will also include model data
classes representing the resource.
As the name implies, the
RemoteSource fetches from a remote source, often
times using Trace's
LocalSource handles data that has been saved locally, these sources are
mostly used for caching.
Every resource has a
Repository, which combines the two
Repository handles when to cache and when to fetch from a
ViewModels should only depend on the
Repository, not on individual
Every resource has a Koin module for dependency injection, containing the
sync package is not a resource, but manages syncing data between the
client and homeserver.
RemoteSources should subscribe to the
Flowable provided by the
SyncManager for new data.
ui ├── base ├── main │ ├── chat │ ├── chatoverview ├── start │ ├── phase │ │ ├── identity │ │ ├── info │ │ ├── key │ │ └── verify └── util
ui package represents the UI layer of the app.
base package contains a
BaseViewModel, which all
fragments and viewmodels inherit from, respectively.
main package covers the core part of application: messaging,
chat overview, creating chats, etc.
The package is divided in packages representing a main part of the application.
For example, the
chatoverview package contains the
which a user will see when they launch the app and are logged in.
start package covers all UI and logic when the user opens the app
for the first time, when they're not logged in or registered.
It also contains a
phase package, which is again divided into packages
representing a different phase of authentication:
identity: Phone, email or username input
key: For now only password, later on also token based (see #21.
verify*: Verify that the user is human
info*: Avatar and display name input
* Only used for registration.
Note that these phases are reused for both logging in and registering, see the authentication documentation for details.
util package contains classes that are reused accross the