Reactor is key value database and is a great alternative to Shared Preferences.

Overview
Reactor

License API

Reactor is a fast and secure key-value library for Android, and has an embedded database based on the JSON structure and is a great alternative to Shared Preferences.

Features + Road map
First Edition 1.x.x
  • Save and restore a variety of objects (serialization and deserialization)
  • Symmetric encryption of objects (signed by target application at runtime + Hardware_ID)
  • Very high performance‍
  • Very low library size (No need for other libraries)
  • Supported and tested in API 15 and above
  • Minimal and easy to use :)
Second Edition 2.x.x
  • Save and restore all temporary object pool at runtime in RAM
  • Add a data branch (branches can be independent of the main branch)
  • Imports safe data from Shared Preferences to Reactor
  • ‍‍Change the underlying AES password generation
  • Change the storage infrastructure
  • ‍‍‍Add concurrency + thread-safe functionality

Donate BTC: 1HPZyUP9EJZi2S87QrvCDrE47qRV4i5Fze

Donate ETH or USDT: 0x4a4b0A26Eb31e9152653E4C08bCF10f04a0A02a9

Getting Started :

Add to your root build.gradle :Ï

allprojects {
  repositories {
      ...
      maven { url 'https://jitpack.io' }
    }
  }

Add the dependency :

dependencies {
    implementation 'com.github.aaaamirabbas:reactor:1.5.1'
}
Simple API (default) :

In Kotlin :

val reactor = Reactor(context)
val reactor = Reactor(context, false) // disable encryption

-----------------------------------------------------------

reactor.put("firstName", "abbas")
reactor.put("lastName", null)
reactor.put("age", 23)
reactor.put("customDataClass", SampleData())

-----------------------------------------------------------

val firstName = reactor.get<String>("firstName")
val lastName : String? = reactor.get("lastName")
val isDay = reactor.get<Boolean>("isDay", false)
val customDataClass = reactor.get("customDataClass")

-----------------------------------------------------------

reactor.remove<Int>("year", "week")
reactor.eraseAllData()

In Java :

Reactor reactor = new Reactor(getContext());
Reactor reactor = new Reactor(getContext(), false); // disable encryption

-----------------------------------------------------------

reactor.put("firstName", "abbas");
reactor.put("lastName", null);
reactor.put("age", 23);
reactor.put("customDataClass", new SampleData());

-----------------------------------------------------------

String firstName = reactor.get("firstName", "abbas");
String lastName = reactor.get("lastName", null);
Integer age = reactor.get("age", 26);
SampleData customDataClass = reactor.get("array");

-----------------------------------------------------------

reactor.remove("age", 0);
reactor.eraseAllData();
Custom data class Sample :
// definition
data class SampleData(
    val id: Int = 24,
    val name: String = "abbas"
) : ReactorContract

-----------------------------------------------------------

// save, restore, remove
reactor.put("simpleData", SampleData())
reactor.get<SampleData>("simpleData") // return null if is not found
reactor.remove<SampleData>("simpleData")
FAQ :
Need more help?
How to store and restore the custom class ?
You might also like...
D-KMP Architecture official sample: it uses a shared KMP ViewModel and Navigation for Compose and SwiftUI apps.
D-KMP Architecture official sample: it uses a shared KMP ViewModel and Navigation for Compose and SwiftUI apps.

D-KMP architecture - official sample This is the official sample of the D-KMP architecture, presenting a simple master/detail app, for Android, iOS an

Clean MVVM with eliminating the usage of context from view models by introducing hilt for DI and sealed classes for displaying Errors in views using shared flows (one time event), and Stateflow for data

Clean ViewModel with Sealed Classes Following are the purposes of this repo Showing how you can remove the need of context in ViewModels. I. By using

An application for tracking the value of crypto currency
An application for tracking the value of crypto currency

CriptoApp an application for tracking the value of crypto currency API https://m

ConstraintSetChangesTest - Simple project showing Changes of ConstraintSet value as part of mutable state in JetpackCompose.

ConstraintSetChangesTest Simple project showing Changes of ConstraintSet value as part of mutable state in JetpackCompose. Version: implementation

Android Ptrace Inject for all ABIs and all APIs. Help you inject Shared Library on Android.

Android Ptrace Inject 中文可以参考我的注释内容进行理解 我写的注释相对来说比较全面了 How to build Make sure you have CMake and Ninja in your PATH Edit CMakeLists.txt. Set ANDROID_ND

Shared ViewModel in Kotlin Multiplatform

multiplatform-viewmodel 🗳 Create shared ViewModel's for shared business logic using our ViewModel base class. Features Uses Jetpack ViewModel on Andr

🍭 GithubSearchKMM - Github Repos Search - Android - iOS - Kotlin Multiplatform Mobile using Jetpack Compose, SwiftUI, FlowRedux, Coroutines Flow, Dagger Hilt, Koin Dependency Injection, shared KMP ViewModel, Clean Architecture
🍭 GithubSearchKMM - Github Repos Search - Android - iOS - Kotlin Multiplatform Mobile using Jetpack Compose, SwiftUI, FlowRedux, Coroutines Flow, Dagger Hilt, Koin Dependency Injection, shared KMP ViewModel, Clean Architecture

GithubSearchKMM Github Repos Search - Kotlin Multiplatform Mobile using Jetpack Compose, SwiftUI, FlowRedux, Coroutines Flow, Dagger Hilt, Koin Depend

Beautifully designed Pokémon Database app for Android based on PokéAPI and powered by Kotlin.
Beautifully designed Pokémon Database app for Android based on PokéAPI and powered by Kotlin.

PokéFacts PokéFacts is an open-source Pokémon Database app for Android based on PokéAPI and powered by Kotlin. The app allows users to view Pokémons,

Note taking app using SOLID principles and CLEAN architecture patterns. Uses Room database, MVVM, Use cases

ShoppingNotes Note taking app using SOLID principles and CLEAN architecture patt

Comments
  • Flawed Encryption/Security

    Flawed Encryption/Security

    Currently library is using following method to get password for decryption, which is always constant.

    private fun getPassword(): String { val uuid = (getSign() + getUUID()) return getSHA256(uuid) ?: uuid }

    Passwords should be generated randomly for each sesssion and stored securely, like Android Keystore system: https://developer.android.com/training/articles/keystore

    pending 
    opened by sreejithbnaick 1
  • return null for class

    return null for class

    reactor return null object when i use this code:

    public UserModel getUserModel() {
    	return reactor.get("UserModel", new UserModel());
    }
    
    public void updateUserModel(UserModel value) {
    	reactor.put("UserModel", value);
    }
    
    good first issue invalid question 
    opened by sajjadintel 1
Releases(1.5.6)
Owner
AMIR ABBAS NAGHDI
I'm Senior Android Developer.
AMIR ABBAS NAGHDI
Astha Nayak 4 Oct 10, 2022
TinyDB Android Shared Preferences Turbo Turkce

TinyDB--Android-Shared-Preferences-Turbo-Turkce Bu sınıf, bir satır kod ile SharedPreferences çağrılarını ve daha fazlasını gerçekleştirmenizi sağlar.

Mehmet Abak 2 Nov 6, 2022
RSocket, WebFlux, Reactor, Kotlin, Coroutines

RSocket messaging services communication RSocket, WebFlux, Reactor, Kotlin, Coroutines edge-service <-~-> web-service <-~-> coroutines-service <-~-> r

Maksim Kostromin 2 Nov 12, 2021
An amazing expense tracker app, with great features and beautiful UI. Check it out!

My Expense Tracker Expense tracker app to keep your finances in order. Built entirely in Kotlin using modern architecture components. Build ??️ My Exp

Ken Ali 7 Oct 26, 2022
Minimum-mvvm-room-database - MVVM With Simple Room Database

Minimum MVVM Koin (Kotlin Dependency Injection) Coroutines View Model Lifecycle

Faisal Amir 7 Oct 9, 2022
Kotlin-dsl-sample - Preferences project on android

kotlin-dsl-example Sample preferences project on android. How to use val

null 1 Dec 30, 2021
A kotlin multiplatform BLS12-381 implementation for chia key management

KBLS KBLS is a kotlin multiplatform BLS12-381 implementation built for creating cross platform chia applications. Tips are much appreciated and will d

ChiaChat 7 Nov 21, 2022
A lightweight alternative to Android's ViewModels. The easiest way to retain instances in Activities, Fragments or Composables.

A lightweight alternative to Android's ViewModels. The easiest way to retain instances in Activities, Fragments or Composables.

Marcello Galhardo 264 Dec 27, 2022
Disk Usage/Free Utility - a better 'df' alternative

duf Disk Usage/Free Utility (Linux, BSD, macOS & Windows) Features User-friendly, colorful output Adjusts to your terminal's theme & width Sort the re

Christian Muehlhaeuser 10.3k Dec 31, 2022
LiveData 数据倒灌:别问,问就是不可预期 - Perfect alternative to SingleLiveEvent, supporting multiple observers.

前言 大家好,我是《Jetpack MVVM Best Practice》作者 KunMinX。 今天提到的 “数据倒灌” 一词,缘于我为了方便理解和记忆 “页面在 ‘二进宫’ 时收到旧数据推送” 的情况,而在 2019 年 自创并在网上传播的 关于此类现象的概括。 它主要发生在:通过 Shared

KunMinX 924 Jan 5, 2023