Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
com.splendo.kaluga:camera-permissions-iosarm32
Advanced tools
Collection of Kotlin Flow based libraries
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.
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 ViewModel
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: BaseViewModel() {
val hudBuilder = HUD.Builder()
suspend fun doWork() =
hudBuilder.presentDuring {
delay(1000)
}
}
Kaluga contains an example project that is used to test the developed modules.
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:0.2.1")
}
You can also use the SNAPSHOT
version based on the latest in the develop
branch:
repositories {
maven("https://oss.sonatype.org/content/repositories/snapshots/")
}
dependencies {
implementation("com.splendo.kaluga:alerts:0.2.2-SNAPSHOT")
}
Please mind that in order for kaluga to work properly on iOS it declares a strict dependency on the native-mt
version of the kotlinx.coroutines
library. If you want to use a different version make your own strict dependency declaration. This can be done simply by adding !!
, for example: implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2-native-mt!!")
.
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.
Module | Usage | Artifact Name |
---|---|---|
alerts | Used for Showing Alert Dialogs | com.splendo.kaluga:alerts |
architecture | MVVM architecture | com.splendo.kaluga:architecture |
architecture-compose | Compose extensions for architecture | com.splendo.kaluga:architecture-compose |
base | Core components of Kaluga. Contains threading, flowables and localization features | com.splendo.kaluga.base |
date-time | Contains multiplatform classes to work with date and time | com.splendo.kaluga.date-time |
date-timepicker | Used for showing a Date or Time Picker | com.splendo.kaluga.date-time-picker |
hud | Used for showing a Loading indicator HUD | com.splendo.kaluga.hud |
keyboard | Used for showing and hiding the keyboard | com.splendo.kaluga.keyboard |
links | Used for decoding url into an object | com.splendo.kaluga.links |
location | Provides the User' geolocation | com.splendo.kaluga.location |
logging | Shared console logging | com.splendo.kaluga.logging |
base-permissions | Managing permissions, used in conjunction with modules below | com.splendo.kaluga:base-permissions |
bluetooth-permissions | Managing bluetooth permissions | com.splendo.kaluga:bluetooth-permissions |
calendar-permissions | Managing calendar permissions | com.splendo.kaluga:calendar-permissions |
camera-permissions | Managing camera permissions | com.splendo.kaluga:camera-permissions |
contacts-permissions | Managing contacts permissions | com.splendo.kaluga:contacts-permissions |
location-permissions | Managing location permissions | com.splendo.kaluga:location-permissions |
microphone-permissions | Managing microphone permissions | com.splendo.kaluga:microphone-permissions |
notifications-permissions | Managing notifications permissions | com.splendo.kaluga:notifications-permissions |
storage-permissions | Managing storage permissions | com.splendo.kaluga:storage-permissions |
resources | Provides shared Strings, Images, Colors and Fonts | com.splendo.kaluga.resources |
review | Used for requesting the user to review the app | com.splendo.kaluga.review |
scientific | Scientific units and conversions | com.splendo.kaluga.scientific |
system | System APIs such as network, audio, battery | com.splendo.kaluga.system |
test-utils | Enables easier testing of Kaluga components | com.splendo.kaluga.test-utils |
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:
Project | Usage |
---|---|
kotlin-firebase-sdk | wraps most of the Firebase SDK APIs |
multiplatform-settings | store key/value data |
SQLDelight | access SQLite (and other SQL database) |
Kaluga also uses some multiplatform libraries itself, so our thanks to:
Project | Usage |
---|---|
kydra | powers the logging module |
stately | concurrency |
Koin | dependency injection |
see DEVELOP.
FAQs
Collection of Kotlin Flow based libraries
We found that com.splendo.kaluga:camera-permissions-iosarm32 demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.