Skip to content

Commit

Permalink
Release Initial UI SDK (#123)
Browse files Browse the repository at this point in the history
* Update dependencies and add initial module setup

* Barebones/default setup for UI builder

* Add bootstrap fetching to headless SDK

* Barebones workbench app that configures, launches, and prints the result of an authentication flow (non-working)

* SDK-1108 SDK-1109

* Rename containing folder, start adding in styles/type/themes

* repackage

* Start adding in state

* Start adding in some UI and testing things in the workbench

* Debugging; Parcelize all response data

* Working on various OAuth flows

* Remove wallets, start adding in voyager for navigation, make oauth providers configurable

* Text/Whatsapp 99% working

* Some refactoring for reusability

* Navigate to confirmation screen after OTP; Add back button

* start working on OTP confirmation screen

* Pass OTP options through

* Recreate OutlinedTextField with controllable padding, get OTPEntry set up

* Authenticate OTP

* SMS/WhatsApp OTP done

* EmailOTP working, switching app contexts doesn't break the flow, everything is parcelable, hooray

* Start working on determining next page by user status

* Add user search endpoints to Consumer StytchClient

* Add logic to mainscreen for figuring out where a user goes after entering email address; Add placeholders for the new screens

* Cleanup/mark some todos

* Churning away through new user creation screens/flows

* Renaming for consistency/clarity

* Password strength indicator done

* Share the create account viewmodel; fix the coloring of PSI bar; Create with password is done

* Refactor and provide failure error messages for email/password states

* Enforce Product/OTP matching; No tabs when only an email is available

* Reuse EML/OTP confirmation screens for returning users with no passwords

* Start working on password reset sent screen. Will need to be extended for breached/dedupe states and forgot password flow

* Refactoring/cleaning up state/events

* Finish cleaning up/refactoring states

* Password reset start low is done

* Add ReturningUserWithPassword (login) screen

* Combine some screens and do some renaming

* Update PasswordResetSentScreen with all variations; Add some helper methods; Lint

* More reuse

* Clean up and add set password screen

* Start debugging password reset deeplinks

* Password reset deeplinks caught and redirected

* Add UI error types; Setup reset_password handling for returning users

* Use savedstatehandle instead of creating stateflows directly

* Add more OAuth providers

* lint

* Clean up oauth stuff to avoid big ol where clause

* Add ui lint tasks and lint

* Update viewmodels for testing; Start adding tests

* Tests for data classes

* Add scaffolding for remaining VM tests

* Add more unit tests

* Single source of truth for app state

* Refactor OAuth providers for testability; Add remaining viewmodel unit tests

* Support LUDS in password UI

* Scaffolding. Can get tests that all run with the same config, but want to figure out how we can make conditional configs

* Add tests for the default UI

* The only way I can think to test multiple configs

* Still playing around

* Test AuthenticationActivity

* Ok, NOW this is in a good place to start implementing tests

* Start trying to test the global app wrapper, but it's not working

* Get screen AND app wrapper tests working

* EMLConfirmationScreen tests

* NewUserScreen

* SetPasswordScreen

* ReturningUserScreen

* OTPConfirmationScreen

* PasswordResetSentScreen

* Fix some broken unit tests

* Add a UI test workflow

* Add necessary placeholder to existing workflows

* update workflow

* update workflow

* update workflow

* Publishing should be configured, testing the docs generation stuff

* Apparently voyager doesn't cleanly handle deeplinks and we need to handle it ourselves

* Remove unnecessary branch triggers

* Update dokka and configure for multi module; Update UI module to expose SDK module, so developers only need to include one or the other

* Add documentation for the UI module; Simplify documentation to single-version-multi-module for now; Remove unnecessary configurations; Update visibility of certain objects; Add a getter for the publicToken in StytchClient and bump the version number; Update dokka script to run new multi-module script

* Create manually triggered, separate publish tasks for SDK and UI

* Update tests to account for recent refactoring

* Fix alert dialog button colors in light mode

* Fix alignment of LUDS indicators

* SDK-1391 Event logging infrastructure and logging when UI SDK is launched (#124)

* Add infrastructure and testing for event logging

* Switch StytchProductConfig items to use Int instead of UInt because Moshi doesn't like them; Update return type for Event logging since it returns a 204; Update apis to send lists of events, since that's what web-backend expects

* Update tests to account for changes in event and config

* Linst

* Lint

* Ensure UI waits for StytchClient to be initialized, seems to just be an issue for UI tests

* Safer way to handle checking stytchclient initialization state to account for real world scenarios vs ui tests
  • Loading branch information
jhaven-stytch authored Jan 22, 2024
1 parent fab805e commit 3b625c5
Show file tree
Hide file tree
Showing 215 changed files with 10,952 additions and 171 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ jobs:
STYTCH_B2B_PUBLIC_TOKEN: 'abc123'
STYTCH_B2B_ORG_ID: 'abc123'
PASSKEYS_DOMAIN: 'abc123'
STYTCH_UI_PUBLIC_TOKEN: 'abc123'
UI_GOOGLE_CLIENT_ID: 'abc123'

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
name: Publish
name: Publish Headless SDK

on:
release:
types: [released]
workflow_dispatch:

jobs:
publish:
Expand All @@ -14,6 +13,8 @@ jobs:
STYTCH_B2B_PUBLIC_TOKEN: 'abc123'
STYTCH_B2B_ORG_ID: 'abc123'
PASSKEYS_DOMAIN: 'abc123'
STYTCH_UI_PUBLIC_TOKEN: 'abc123'
UI_GOOGLE_CLIENT_ID: 'abc123'
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
Expand All @@ -24,9 +25,9 @@ jobs:
- name: Release build
run: ./gradlew :sdk:assembleRelease
- name: Source jar
run: ./gradlew androidSourcesJar
run: ./gradlew :sdk:androidSourcesJar
- name: Publish to Maven Central
run: ./gradlew publishReleasePublicationToSonatypeRepository --max-workers 1 closeAndReleaseSonatypeStagingRepository
run: ./gradlew :sdk:publishReleasePublicationToSonatypeRepository --max-workers 1 closeAndReleaseSonatypeStagingRepository
env:
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
Expand Down
37 changes: 37 additions & 0 deletions .github/workflows/publishUi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Publish UI SDK

on:
workflow_dispatch:

jobs:
publish:
name: Release build and publish
runs-on: ubuntu-latest
env:
STYTCH_PUBLIC_TOKEN: 'abc123'
GOOGLE_OAUTH_CLIENT_ID: 'abc123'
STYTCH_B2B_PUBLIC_TOKEN: 'abc123'
STYTCH_B2B_ORG_ID: 'abc123'
PASSKEYS_DOMAIN: 'abc123'
STYTCH_UI_PUBLIC_TOKEN: 'abc123'
UI_GOOGLE_CLIENT_ID: 'abc123'
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: zulu
java-version: 17

- name: Release build
run: ./gradlew :ui:assembleRelease
- name: Source jar
run: ./gradlew :ui:androidSourcesJar
- name: Publish to Maven Central
run: ./gradlew :ui:publishReleasePublicationToSonatypeRepository --max-workers 1 closeAndReleaseSonatypeStagingRepository
env:
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }}
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }}
2 changes: 2 additions & 0 deletions .github/workflows/runOnGithub.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,5 @@ jobs:
STYTCH_B2B_PUBLIC_TOKEN: 'abc123'
STYTCH_B2B_ORG_ID: 'abc123'
PASSKEYS_DOMAIN: 'abc123'
STYTCH_UI_PUBLIC_TOKEN: 'abc123'
UI_GOOGLE_CLIENT_ID: 'abc123'
63 changes: 63 additions & 0 deletions .github/workflows/uiTests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: uiTests

on:
workflow_dispatch:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
test:
runs-on: macos-latest
steps:
- name: checkout
uses: actions/checkout@v3

- name: setup java
uses: actions/setup-java@v3
with:
distribution: zulu
java-version: 17

- name: Gradle cache
uses: gradle/gradle-build-action@v2

- name: AVD cache
uses: actions/cache@v3
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd

- name: create AVD and generate snapshot for caching
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 34
target: google_apis
arch: x86_64
force-avd-creation: false
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: false
script: echo "Generated AVD snapshot for caching."

- name: run ui tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 34
target: google_apis
arch: x86_64
force-avd-creation: false
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: true
script: ./gradlew :ui:connectedCheck
env:
STYTCH_PUBLIC_TOKEN: 'abc123'
GOOGLE_OAUTH_CLIENT_ID: 'abc123'
STYTCH_B2B_PUBLIC_TOKEN: 'abc123'
STYTCH_B2B_ORG_ID: 'abc123'
PASSKEYS_DOMAIN: 'abc123'
STYTCH_UI_PUBLIC_TOKEN: 'abc123'
UI_GOOGLE_CLIENT_ID: 'abc123'
4 changes: 3 additions & 1 deletion .github/workflows/versionedDocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,10 @@ jobs:
STYTCH_B2B_PUBLIC_TOKEN: 'abc123'
STYTCH_B2B_ORG_ID: 'abc123'
PASSKEYS_DOMAIN: 'abc123'
STYTCH_UI_PUBLIC_TOKEN: 'abc123'
UI_GOOGLE_CLIENT_ID: 'abc123'
working-directory: main
run: ./gradlew sdk:dokkaHtml
run: ./gradlew sdk:dokkaHtmlMultiModule

- name: Zip docs site
run: |
Expand Down
38 changes: 37 additions & 1 deletion .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions b2bExampleApp/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,16 @@ android {
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = '1.8'
jvmTarget = '17'
freeCompilerArgs += "-Xopt-in=kotlin.RequiresOptIn"
}

composeOptions {
kotlinCompilerExtensionVersion "1.3.0"
kotlinCompilerExtensionVersion "1.4.8"
}
namespace 'com.stytch.exampleapp.b2b'
}
Expand Down
31 changes: 24 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,23 +1,27 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
kotlin_version = '1.7.10'
dokka_version = '1.7.10'
kotlin_version = '1.8.22'
dokka_version = '1.9.10'
retrofit_version = '2.9.0'
okhttp_version = '4.10.0'
compose_version = '1.2.0'
moshi_version = '1.13.0'
kotlin_coroutines_version = '1.6.4'
okhttp_version = '4.11.0'
compose_version = '1.4.3'
moshi_version = '1.15.0'
kotlin_coroutines_version = '1.7.2'
}
repositories {
google()
mavenCentral()
maven {
url = uri("https://storage.googleapis.com/r8-releases/raw")
}
}
dependencies {
classpath 'com.android.tools.build:gradle:8.1.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath("org.jetbrains.dokka:dokka-gradle-plugin:$dokka_version")
classpath("org.jetbrains.dokka:versioning-plugin:$dokka_version")
classpath("com.android.tools:r8:8.2.33")
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
Expand All @@ -28,6 +32,7 @@ plugins {
id "org.jlleitschuh.gradle.ktlint" version "11.0.0"
id "io.gitlab.arturbosch.detekt" version "1.22.0-RC3"
//id 'nl.neotech.plugin.rootcoverage' version '1.6.0'
id "org.jetbrains.dokka" version "$dokka_version"
}
/*
rootCoverage {
Expand Down Expand Up @@ -67,7 +72,19 @@ task clean(type: Delete) {
}

tasks.register("runOnGitHub") {
dependsOn(":sdk:lint", ":sdk:ktlintCheck", ":sdk:testDebugUnitTest")
dependsOn(
":sdk:lint",
":ui:lint",
":sdk:ktlintCheck",
":ui:ktlintCheck",
":sdk:testDebugUnitTest",
":ui:testDebugUnitTest"
// TODO: add UI tests once they are done
)
group = "custom"
description = "\$ ./gradlew runOnGitHub # runs on GitHub Action"
}

tasks.dokkaHtmlMultiModule.configure {
outputDirectory.set(file("$projectDir/docs"))
}
8 changes: 5 additions & 3 deletions config/detekt/detekt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ complexity:
threshold: 60
LongParameterList:
active: true
functionThreshold: 6
functionThreshold: 10
constructorThreshold: 7
ignoreDefaultParameters: false
ignoreDataClasses: true
Expand Down Expand Up @@ -333,6 +333,7 @@ naming:
functionPattern: '[a-z][a-zA-Z0-9]*'
excludeClassPattern: '$^'
ignoreOverridden: true
ignoreAnnotated: ['Composable']
FunctionParameterNaming:
active: true
parameterPattern: '[a-z][A-Za-z0-9]*'
Expand Down Expand Up @@ -365,7 +366,7 @@ naming:
packagePattern: '[a-z]+(\.[a-z][A-Za-z0-9]*)*'
TopLevelPropertyNaming:
active: true
constantPattern: '[A-Z][_A-Z0-9]*'
constantPattern: '[A-Z][A-Za-z0-9]*'
propertyPattern: '[A-Za-z][_A-Za-z0-9]*'
privatePropertyPattern: '_?[A-Za-z][_A-Za-z0-9]*'
VariableMaxLength:
Expand Down Expand Up @@ -571,7 +572,7 @@ style:
- '1'
- '2'
ignoreHashCodeFunction: true
ignorePropertyDeclaration: false
ignorePropertyDeclaration: true
ignoreLocalVariableDeclaration: false
ignoreConstantDeclaration: true
ignoreCompanionObjectPropertyDeclaration: true
Expand Down Expand Up @@ -683,6 +684,7 @@ style:
UnusedPrivateMember:
active: true
allowedNames: '(_|ignored|expected|serialVersionUID)'
ignoreAnnotated: ['Preview']
UseAnyOrNoneInsteadOfFind:
active: true
UseArrayLiteralsInAnnotations:
Expand Down
8 changes: 4 additions & 4 deletions consumerExampleApp/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,16 @@ android {
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = '1.8'
jvmTarget = '17'
freeCompilerArgs += "-Xopt-in=kotlin.RequiresOptIn"
}

composeOptions {
kotlinCompilerExtensionVersion "1.3.0"
kotlinCompilerExtensionVersion "1.4.8"
}
namespace 'com.stytch.exampleapp'
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import android.app.Application
import androidx.fragment.app.FragmentActivity
import androidx.lifecycle.AndroidViewModel
import androidx.lifecycle.viewModelScope
import com.stytch.sdk.consumer.biometrics.Biometrics
import com.stytch.sdk.consumer.StytchClient
import com.stytch.sdk.consumer.biometrics.Biometrics
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.launch
Expand Down
Loading

0 comments on commit 3b625c5

Please sign in to comment.