Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

com.splendo.kaluga:architecture-androidlib-debug

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

com.splendo.kaluga:architecture-androidlib-debug

Collection of Kotlin Flow based libraries

  • 1.4.0
  • Source
  • Maven
  • Socket score

Version published
Maintainers
1
Source

Maven Central Build Status🤖 Build Status🍏

kaluga logo

This project is named after the Kaluga, the world's biggest freshwater fish, which is found in the icy Amur river.

Kaluga's main goal is to provide access to common features used in cross-platform mobile app development, separated into modules such as architecture (MVVM), location, permissions, bluetooth etc.

To reach this goal it uses Kotlin, specifically Kotlin Multiplatform which allows running Kotlin code not just on JVM+Android, but also iOS/iPadOS, amongst others (inndeed some kaluga modules also work for Kotlin.js and/or JVM standalone).

Where appropriate coroutines and Flow are used in the API. This enables developers to use cold streams for a modern and efficient design.

While Kaluga modules can be used individually, together they form a comprehensive approach to cross-platform development with shared native code and native UIs, including SwiftUI and Compose.

Short examples

With Kaluga it is possible to create cross-platform functionality in a few lines of code, that would normally take many lines of code even on just one platform.

Below are some examples, using a commonMain source-set:

Scanning for nearby devices with Bluetooth LE:

// will auto request permissions and try to enable bluetooth
BluetoothBuilder().create().devices().collect {
    i("discovered device: $it") // log found device
}

Showing a spinner while doing some work:


suspend fun doWork(hudBuilder: HUD.Builder) {
    hudBuilder.presentDuring { // shows spinner while code in this block is running
        // simulate doing work
        delay(1000)
    }
}
    

in this case, since HUD is a UI component the builder needs to be configured on the platform side:

val builder = HUD.Builder() // same for iOS and Android
// ...
builder.subscribe(activity) // this needs be done in the Android source-set to bind the HUD to the lifecycle of the Activity
// ...
builder.unsubscribe(activity) // when the Activity is stopped

However Kaluga's architecture module offers a cross-platform LifecycleViewModel class (which extends androidx.lifecycle.ViewModel on Android) that will automatically bind the builder to its lifecycle:

// this can just be in the commonMain source
class HudViewModel(private val hudBuilder: HUD.Builder): BaseLifecycleViewModel(hudBuilder) {
    
    suspend fun doWork() = 
        hudBuilder.presentDuring {
            delay(1000)
        }
}

More examples

Kaluga contains an example project that is used to test the developed modules.

Using Kaluga

For starting a new project based on Kaluga see the kaluga-starter repo, which shows how to do this step by step.

Kaluga is available on Maven Central. For example the Kaluga Alerts can be imported like this:

repositories {
    mavenCentral()
}
dependencies {
    implementation("com.splendo.kaluga:alerts:$kalugaVersion")
}

You can also use the SNAPSHOT version based on the latest in the develop branch:

repositories {
    maven("https://s01.oss.sonatype.org/content/repositories/snapshots/")
}
dependencies {
    implementation("com.splendo.kaluga:alerts:$kalugaDevelopVersion-SNAPSHOT")
}

To use kaluga with SwiftUI and/or Combine we have a repo with Sourcery templates to generate some Swift code to help get you started.

Available Modules

ModuleUsageArtifact Name
alertsUsed for Showing Alert Dialogscom.splendo.kaluga:alerts
architectureMVVM architecturecom.splendo.kaluga:architecture
architecture-composeCompose extensions for architecturecom.splendo.kaluga:architecture-compose
baseCore components of Kaluga. Contains threading, flowables and localization featurescom.splendo.kaluga:base
beaconsTracking the availability of Beacons using the Eddystone protocolcom.splendo.kaluga:beacons
bluetoothScanning for and communicating with BLE devicescom.splendo.kaluga:bluetooth
date-timeContains multiplatform classes to work with date and timecom.splendo.kaluga:date-time
date-timepickerUsed for showing a Date or Time Pickercom.splendo.kaluga:date-time-picker
hudUsed for showing a Loading indicator HUDcom.splendo.kaluga:hud
keyboardUsed for showing and hiding the keyboardcom.splendo.kaluga:keyboard
keyboard-composeCompose extensions for keyboardcom.splendo.kaluga:keyboard-compose
linksUsed for decoding url into an objectcom.splendo.kaluga:links
locationProvides the User' geolocationcom.splendo.kaluga:location
loggingShared console loggingcom.splendo.kaluga:logging
mediaPlaying audio/videocom.splendo.kaluga:media
base-permissionsManaging permissions, used in conjunction with modules belowcom.splendo.kaluga:base-permissions
bluetooth-permissionsManaging bluetooth permissionscom.splendo.kaluga:bluetooth-permissions
calendar-permissionsManaging calendar permissionscom.splendo.kaluga:calendar-permissions
camera-permissionsManaging camera permissionscom.splendo.kaluga:camera-permissions
contacts-permissionsManaging contacts permissionscom.splendo.kaluga:contacts-permissions
location-permissionsManaging location permissionscom.splendo.kaluga:location-permissions
microphone-permissionsManaging microphone permissionscom.splendo.kaluga:microphone-permissions
notifications-permissionsManaging notifications permissionscom.splendo.kaluga:notifications-permissions
storage-permissionsManaging storage permissionscom.splendo.kaluga:storage-permissions
resourcesProvides shared Strings, Images, Colors and Fontscom.splendo.kaluga:resources
resources-composeCompose extensions for resourcescom.splendo.kaluga:resources-compose
resources-databindingData Binding extensions for resourcescom.splendo.kaluga:resources-databinding
reviewUsed for requesting the user to review the appcom.splendo.kaluga:review
scientificScientific units and conversionscom.splendo.kaluga:scientific
serviceUsed for adding services to Kalugacom.splendo.kaluga:service
systemSystem APIs such as network, audio, batterycom.splendo.kaluga:system
test-utilsEnables easier testing of Kaluga componentscom.splendo.kaluga:test-utils
test-utils-baseEnables easier testing of Kaluga componentscom.splendo.kaluga:test-utils-base
test-utils-alertsEnables easier testing of Alerts modulecom.splendo.kaluga:test-utils-alerts
test-utils-architectureEnables easier testing of Architecture modulecom.splendo.kaluga:test-utils-architecture
test-utils-bluetoothEnables easier testing of Bluetooth modulecom.splendo.kaluga:test-utils-bluetooth
test-utils-date-time-pickerEnables easier testing of Date Time Picker modulecom.splendo.kaluga:test-utils-date-time-picker
test-utils-hudEnables easier testing of HUD modulecom.splendo.kaluga:test-utils-hud
test-utils-keyboardEnables easier testing of Keyboard modulecom.splendo.kaluga:test-utils-keyboard
test-utils-koinEnables easier testing with Koincom.splendo:kaluga.test-utils-koin
test-utils-locationEnables easier testing of Location modulecom.splendo.kaluga:test-utils-location
test-utils-permissionsEnables easier testing of Permissions modulescom.splendo.kaluga:test-utils-permissions
test-utils-resourcesEnables easier testing of Resources modulecom.splendo.kaluga:test-utils-resources
test-utils-serviceEnables easier testing of Service modulecom.splendo.kaluga:test-utils-service
test-utils-systemEnables easier testing of System modulecom.splendo.kaluga:test-utils-system

Friends of kaluga

Of course not every possible functionality is provided by kaluga. However, this is often because other good multiplatform libraries that work nicely with kaluga already exist. These use similar patterns such as coroutines and Flow, and include the following:

ProjectUsage
kotlin-firebase-sdkwraps most of the Firebase SDK APIs
multiplatform-settingsstore key/value data
SQLDelightaccess SQLite (and other SQL database)

Kaluga also uses some multiplatform libraries itself, so our thanks to:

ProjectUsage
Napierpowers the logging module
Koindependency injection

Developing Kaluga

see DEVELOP.

FAQs

Package last updated on 11 Jun 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc