All Projects → wordpress-mobile → WordPress-FluxC-Android

wordpress-mobile / WordPress-FluxC-Android

Licence: GPL-2.0 license
WordPress Network and Persistence layer based on the Flux architecture

Programming Languages

kotlin
9241 projects
java
68154 projects - #9 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to WordPress-FluxC-Android

Qxorm
QxOrm library - C++ Qt ORM (Object Relational Mapping) and ODM (Object Document Mapper) library - Official repository
Stars: ✭ 176 (+232.08%)
Mutual labels:  persistence
client-side-databases
An implementation of the exact same app in Firestore, AWS Datastore, PouchDB, RxDB and WatermelonDB
Stars: ✭ 787 (+1384.91%)
Mutual labels:  persistence
datanucleus-core
DataNucleus core persistence support - the basis for anything in DataNucleus
Stars: ✭ 112 (+111.32%)
Mutual labels:  persistence
Hydrated bloc
An extension to the bloc state management library which automatically persists and restores bloc states.
Stars: ✭ 181 (+241.51%)
Mutual labels:  persistence
Skopelos
A minimalistic, thread safe, non-boilerplate and super easy to use version of Active Record on Core Data. Simply all you need for doing Core Data. Swift flavour.
Stars: ✭ 231 (+335.85%)
Mutual labels:  persistence
UserDefault
The simplest way of using the UserDefaults with @propertyWrapper.
Stars: ✭ 17 (-67.92%)
Mutual labels:  persistence
Technowlogger
TechNowLogger is Windows/Linux Keylogger Generator which sends key-logs via email with other juicy target info
Stars: ✭ 172 (+224.53%)
Mutual labels:  persistence
jpa-unit
JUnit extension to test javax.persistence entities
Stars: ✭ 28 (-47.17%)
Mutual labels:  persistence
Data
ATK Data - Data Access Framework for high-latency databases (Cloud SQL/NoSQL).
Stars: ✭ 243 (+358.49%)
Mutual labels:  persistence
datanucleus-api-jdo
Support for DataNucleus persistence using the JDO API (JSR0012, JSR0243)
Stars: ✭ 18 (-66.04%)
Mutual labels:  persistence
Technowhorse
TechNowHorse is a RAT (Remote Administrator Trojan) Generator for Windows/Linux systems written in Python 3.
Stars: ✭ 189 (+256.6%)
Mutual labels:  persistence
Storagekit
Your Data Storage Troubleshooter 🛠
Stars: ✭ 225 (+324.53%)
Mutual labels:  persistence
Awesome-Android-Persistence
A curated list of awesome android persistence libraries about SQLite, ORM, Mobile Database, SharedPreferences, etc.
Stars: ✭ 69 (+30.19%)
Mutual labels:  persistence
Modernavplayer
ModernAVPlayer is a persistence AVPlayer wrapper
Stars: ✭ 179 (+237.74%)
Mutual labels:  persistence
derivejs
DeriveJS is a reactive ODM - Object Document Mapper - framework, a "wrapper" around a database, that removes all the hassle of data-persistence by handling it transparently in the background, in a DRY manner.
Stars: ✭ 54 (+1.89%)
Mutual labels:  persistence
Lucid
High performance and distributed KV store w/ REST API. 🦀
Stars: ✭ 171 (+222.64%)
Mutual labels:  persistence
mst-persist
Persist and hydrate MobX-state-tree stores (in < 100 LoC)
Stars: ✭ 75 (+41.51%)
Mutual labels:  persistence
soda-for-java
SODA (Simple Oracle Document Access) for Java is an Oracle library for writing Java apps that work with JSON (and not only JSON!) in the Oracle Database. SODA allows your Java app to use the Oracle Database as a NoSQL document store.
Stars: ✭ 61 (+15.09%)
Mutual labels:  persistence
aiohttp-client-cache
An async persistent cache for aiohttp requests
Stars: ✭ 63 (+18.87%)
Mutual labels:  persistence
stash
A small and user-friendly ETS wrapper for caching in Elixir
Stars: ✭ 51 (-3.77%)
Mutual labels:  persistence

WordPress-FluxC-Android

CircleCI

WordPress-FluxC-Android is a networking and persistence library that helps to connect and sync data from a WordPress site (self hosted, or wordpress.com site).

Based on the Flux pattern, we're using: Dagger2 for dependency injection, WellSql for persistence.

FluxC is pronounced ‘fluxy’, and stands for ‘Flux Capacitor’. This makes a double reference to the architecture model (since a capacitor is a kind of storage unit, or ‘store’). More importantly, a flux capacitor is the core component of the DeLorean time machine in Back to the Future, which ‘makes time travel possible.’

Most of our documentation for using and contributing to FluxC can be found in our wiki.

Using FluxC as a library

Please see our Using FluxC wiki page for setup instructions.

Building the library

The gradle build system will fetch all dependencies and generate files you need to build the project. You first need to generate the local.properties (replace YOUR_SDK_DIR with your actual android SDK directory) file and create the gradle.properties file. The easiest way is to copy our example:

$ echo "sdk.dir=YOUR_SDK_DIR" > local.properties
$ cp gradle.properties-example gradle.properties
$ ./gradlew fluxc:build

Building and running tests and the example app

$ cp -a example/properties-example/ example/properties/
$ ./gradlew cAT       # Regression tests
$ ./gradlew testDebug # Unit tests

Note: this uses the default example/properties/api.properties file. You'll have to get a WordPress.com OAuth2 ID and secret.

We have some tests connecting to real HTTP servers, URL and credentials are defined in example/properties/tests.properties, you must edit it or obtain the real file to run the tests.

Please note that, unless using special credentials which cannot be shared publicly, some of the WordPress.com connected tests will not pass unless the OAuth2 ID and secret are registered to the account that the test is attempting to log into.

OAuth2 Authentication

To test with your own OAuth2 ID and Secret you will need to create an application or view the details for your existing application with our WordPress.com applications manager.

When creating your application, you should select "Native client" for the application type. The applications manager currently requires a "redirect URL", but this isn't used for mobile apps. Just use "https://localhost".

Once you've created your application in the applications manager, you'll need to edit the example/properties/api.properties file and change the wp.OAUTH.APP.ID and wp.OAUTH.APP.SECRET fields.

Setting up Checkstyle

The FluxC project uses Checkstyle. You can run checkstyle using ./gradlew checkstyle. You can also view errors and warnings in realtime with the Checkstyle plugin. When importing the project into Android Studio, Checkstyle should be set up automatically. If it is not, follow the steps below.

You can install the CheckStyle-IDEA plugin in Android Studio here:

Android Studio > Preferences... > Plugins > CheckStyle-IDEA

Once installed, you can configure the plugin here:

Android Studio > Preferences... > Tools > Checkstyle

From there, add and enable the configuration file for FluxC, located at config/checkstyle.xml.

Using Detekt

The FluxC project uses detekt for Kotlin linting and code style check.

You can run detekt using ./gradlew detekt.

You can also view errors and warnings in realtime with the Detekt plugin.

You can install the detekt plugin in Android Studio here:

Android Studio > Preferences... > Plugins > detekt

Once installed, you can configure the plugin here:

Android Studio > Preferences... > Tools > Detekt

From there, add and enable the custom configuration file, located at config/detekt/detekt.yml.

If you want to use the AutoCorrect feature of the plugin, make sure that the option Enable formatting (ktlint) rules is enabled in the above settings, then you will be able to reformat any file according to detekt's rules using the refactor menu AutoCorrect by Detekt Rules

Contributing

Actions

Each store should have a corresponding enum defining actions for that store. For example, SiteStore's actions are defined in the SiteAction enum.

Action naming guide:

FETCH_X - request data from the server
PUSH_X - send data to the server
UPDATE_X - local change
REMOVE_X - local remove
DELETE_X - request deletion on the server

Each action enum should be annotated with @ActionEnum, with individual actions receiving an @Action annotation with an optional payloadType setting (see SiteAction for an example).

Endpoints

Endpoints for each of the supported APIs are centralized in a generated endpoint file: WPCOMREST.java and XMLRPC.java (also WPAPI.java).

To add a new endpoint, first add it to the appropriate fluxc-processor/src/main/resources/*.txt file, and then rebuild the project to update the generated (Java) endpoint file.

Note that, for WordPress.com REST API endpoints, the final endpoint will be normalized to include a trailing slash.

Response Models

Create a class implementing Response interface in a corresponding package in org.wordpress.android.fluxc.network.rest tree.

Prefer using nullable types in response models to prevent crashes when the API changes. Map nullable types to non-nullable types (if applicable) when mapping response models to domain models.

On Changed Events

All On Changed Events extend the OnChanged class. They encapsulate an error field. Events can be checked for an error by calling event.isError().

On Changed Events naming guide:

onXChanged(int rowsAffected) - Keep X singular even if multiple X were changed
onXRemoved(int rowsAffected) - Keep X singular even if multiple X were removed

Need help to build or hack?

Say hello on our Slack channel: #mobile.

LICENSE

WordPress-FluxC-Android is an Open Source project covered by the GNU General Public License version 2.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].