Luscii Patient Actions SDK

This package is an unofficial Flutter plugin that integrates with the native SDKs provided by Luscii.

coverage style: very good analysis License: MIT

Generated by the Very Good CLI ๐Ÿค–

iOS

The Luscii SDK requires iOS 15.5 or higher.

Android

In order to get the Android build working, you need to add quite the setup. The Luscii SDK uses Hilt as a dependency so to get it working, you also need to include it into your app.

android/app/build.gradle

plugins {
    // All your current plugins
    id 'kotlin-kapt'
    id 'com.google.dagger.hilt.android'
}
android {
    defaultConfig {
        // The Luscii SDK requires 26
        minSdkVersion 26
    }
    buildFeatures {
      dataBinding = true
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
        coreLibraryDesugaringEnabled true // Luscii requires core library desugaring to be enabled
    }
}
    
dependencies {
    // All your current dependencies
    implementation "com.google.dagger:hilt-android:2.57.2"
    kapt "com.google.dagger:hilt-compiler:2.57.2"
    implementation 'androidx.window:window:1.3.0'
    implementation 'androidx.window:window-java:1.3.0'
    coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.1.5'
}
kapt {
    correctErrorTypes = true
}

android/build.gradle

allprojects {
    repositories {
        google()
        mavenCentral()

        // Add these two lines
        maven {
            url "https://jitpack.io"
        }
        maven {
            url = uri("https://maven.pkg.github.com/Luscii/actions-sdk-android")

            // Decide if you want to add these values to the gradle.properties or local.properties file
            credentials {
                 username = "githubusername"
                 password = "gh_someToken123"
            }
            
            // Loading credentials from gradle.properties or local.properties will look like this
            // credentials {
            //  username = project.findProperty("githubUsername") ?: ""
            //  password = project.findProperty("githubToken") ?: ""
            //}
        }
    }
}

android/app/main/AndroidManifest.xml

<manifest>
    <application
        ...
        android:name=".MyApplication" // Add a new class here (can be your own name)
        ...>

Create this new Application class so the AndroidManifest can find it:

import dagger.hilt.android.HiltAndroidApp
import io.flutter.app.FlutterApplication

@HiltAndroidApp
class MyApplication : FlutterApplication()

Look up your MainActivity, we need to make some changes:

import dagger.hilt.android.AndroidEntryPoint
import io.flutter.embedding.android.FlutterFragmentActivity

@AndroidEntryPoint
class MainActivity: FlutterFragmentActivity() {
}

FlutterActivity is not supported by Hilt, so we need to change it to a FlutterFragmentActivity.

Environments

By default, the SDK targets the production environment. You can switch to the acceptance or test environment for testing purposes.

Android

To use the acceptance SDK on Android, add the following property to your android/gradle.properties file:

lusciiUseAcceptanceSdk=true

To use the test SDK, use:

lusciiUseTestSdk=true

This will change the underlying dependency to com.luscii:sdk-acceptance or com.luscii:sdk-test respectively.

iOS

To target the acceptance or test environment on iOS, specify the iOSEnvironment parameter when initializing the SDK:

final result = await luscii_sdk.initialize(
  iOSEnvironment: LusciiEnvironment.acceptance, // or LusciiEnvironment.test
);

Support

This package is used in production and should be stable, but still expect frequent big API call changes

Function iOS Support Android Support
authenticate(String apiKey) โœ… โœ…
getTodayActions() โœ… โœ…
launchAction(String actionId) โœ… โœ…
actionFlowStream() โœ… โœ…
startSelfCareActivity() โŒ โŒ
getSelfCareActions() โœ… โœ…

Integration tests ๐Ÿงช

Very Good Flutter Plugin uses Patrol for integration tests. Those tests are located in the front facing package luscii_patient_actions_sdk example.

โ— In order to run the integration tests, you need to have the patrol_cli installed. Run flutter pub global activate patrol_cli.

To run the integration tests, run the following command from the root of the project:

cd luscii_patient_actions_sdk/example
patrol test integration_test/app_test.dart