Skip to content

Latest commit

 

History

History
337 lines (249 loc) · 11.4 KB

MIGRATION_GUIDE.md

File metadata and controls

337 lines (249 loc) · 11.4 KB

Migration Guide

This guide helps you migrate between major versions of OUDS Android.

Migrating to 3.0.0

Breaking changes in this version:

  1. Minimum Android SDK version updated to API 24
  2. OudsChipState: New Skeleton enum value
  3. Public classes no longer use data modifier
  4. Space token properties marked as restricted API
  5. OudsVersion marked as internal API

Breaking changes

1. Minimum Android SDK version updated to API 24

Impact: Applications targeting Android 6.0 (API 23) will no longer be able to use OUDS Android 3.0.0 and above.

Before (v2.x):

android {
    defaultConfig {
        minSdk = 23
    }
}

After (v3.0):

android {
    defaultConfig {
        minSdk = 24
    }
}

Recommendation: Use a version catalog (gradle/libs.versions.toml) to centralize SDK version management across your project modules.

Migration steps
  1. Update your app's minSdk to at least 24 in your build configuration
  2. Ensure your app no longer needs to support Android 6.0 (Marshmallow)
  3. Verify compatibility with your target user base

2. OudsChipState: New Skeleton enum value

A new Skeleton value has been added to the OudsChipState enum.

Impact: Applications with exhaustive when expressions on OudsChipState will fail to compile and may crash at runtime if upgraded without recompiling.

Before (v2.x):

OudsBasicSuggestionChip(...) {
    when (state) {
        OudsChipState.Enabled -> Icon1()
        OudsChipState.Hovered -> Icon2()
        OudsChipState.Pressed -> Icon3()
        OudsChipState.Disabled -> Icon4()
        OudsChipState.Focused -> Icon5()
    }
}

After (v3.0):

OudsBasicSuggestionChip(...) {
    when (state) {
        OudsChipState.Enabled -> Icon1()
        OudsChipState.Hovered -> Icon2()
        OudsChipState.Pressed -> Icon3()
        OudsChipState.Disabled -> Icon4()
        OudsChipState.Focused -> Icon5()
        OudsChipState.Skeleton -> Icon6()  // Add this branch
    }
}
Migration steps
  1. Search your codebase for exhaustive when expressions on OudsChipState
  2. Add the OudsChipState.Skeleton branch or add an else branch
  3. Recompile your application after upgrading

3. Public classes no longer use data modifier

To maintain binary compatibility in future releases, the data modifier has been removed from public API classes. This change allows OUDS Android to safely add new properties to these classes in minor or patch releases without breaking binary compatibility for existing compiled applications. When data classes add new properties, new componentN() methods are generated, which breaks binary compatibility. By removing the data modifier in this major release, future updates can extend these classes without causing breaking changes.

Impact: Auto-generated methods (copy(), componentN(), toString(), equals(), hashCode()) are no longer available on these classes.

Methods no longer available:

  • ❌ copy() - Cannot create modified copies with named parameters
  • ❌ componentN() - Destructuring declarations no longer supported
  • ❌ equals() / hashCode() - Auto-generated implementations no longer available
  • ❌ toString() - Formatted string representation no longer available

Affected classes:

Component configuration classes:

  • OudsAlertMessageActionLink
  • OudsBulletListTextStyle
  • OudsButtonLoader
  • OudsNavigationBarItem
  • OudsNavigationBarItemBadge
  • OudsTagLoader
  • OudsTextInputHelperLink
  • OudsTextInputLoader
  • OudsTopAppBarActionBadge

Theme token containers (and all nested classes):

  • OudsBorders
  • OudsColorScheme
  • OudsComponents
  • OudsEffects
  • OudsElevations
  • OudsGrids
  • OudsOpacities
  • OudsSizes
  • OudsSpaces
  • OudsTypography

Before (v2.x):

// Creating and modifying with copy()
val item = OudsNavigationBarItem(
    selected = false,
    onClick = { },
    icon = icon,
    label = "Home"
)
val updatedItem = item.copy(selected = true) // No longer works

// Destructuring
val (light, dark) = colorToken // No longer works

After (v3.0):

// Must create new instances instead of using copy()
val item = OudsNavigationBarItem(
    selected = false,
    onClick = { },
    icon = icon,
    label = "Home"
)
val updatedItem = OudsNavigationBarItem(
    selected = true,  // Updated value
    onClick = item.onClick,
    icon = item.icon,
    label = item.label
)

// Access properties directly instead of destructuring
val light = colorToken.light
val dark = colorToken.dark
Migration steps
  1. Search your codebase for .copy() calls on OUDS classes
  2. Replace with new constructor calls passing all required parameters
  3. Remove destructuring declarations (e.g., val (a, b) = instance) and use direct property access instead
  4. Recompile your application after upgrading

4. Space token properties marked as restricted API

Space token properties (except fixed and scaled) are now marked with @RestrictedOudsApi. Only OudsTheme.spaces.fixed and OudsTheme.spaces.scaled should be used for spacing in applications. Other space tokens are restricted to specific internal use cases.

Impact: Applications accessing restricted space token properties will fail to compile unless they opt-in.

Affected properties:

  • All properties in OudsSpaces.PaddingInline
  • All properties in OudsSpaces.PaddingBlock
  • All properties in OudsSpaces.Inset
  • All properties in OudsSpaces.ColumnGap
  • All properties in OudsSpaces.RowGap

Note: OudsTheme.spaces.fixed and OudsTheme.spaces.scaled remain unrestricted and should be used instead.

Migration steps
  1. Search your codebase for usage of OudsTheme.spaces.paddingInline, OudsTheme.spaces.paddingBlock, OudsTheme.spaces.inset, OudsTheme.spaces.columnGap, or OudsTheme.spaces.rowGap
  2. Replace with OudsTheme.spaces.fixed or OudsTheme.spaces.scaled which provide the standard spacing values
  3. If direct access to restricted tokens is necessary —most commonly when creating custom components—, opt-in by adding @OptIn(RestrictedOudsApi::class) at the call site or file level
  4. Recompile your application after upgrading

5. OudsVersion marked as internal API

OudsVersion contains automatically generated version information that can change without notice. This API is not intended for application use and has been marked with @InternalOudsApi to indicate it should not be relied upon.

Impact: Applications accessing OudsVersion will fail to compile unless they opt-in.

Affected API:

  • OudsVersion
Migration steps
  1. Search your codebase for usage of OudsVersion
  2. Remove dependency on OudsVersion as it contains automatically generated information that can change without notice
  3. Do not use this API - it is not intended for application use
  4. Recompile your application after upgrading

Migrating to 2.0.0

Breaking changes in this version:

  1. Space inset token reorganization
  2. Link component: paddingBlock structure change
  3. Progress indicator: default status changed to Neutral

Breaking changes

1. Space inset token reorganization

The space inset token scale has been reorganized to align with the latest Orange Unified Design System specifications. A new larger small token has been introduced, and all smaller tokens have shifted down by one size level.

Impact: Applications using OudsTheme.spaces.inset.* properties will experience visual spacing changes unless code is updated.

Property name changes
Old property (v1.x) New property (v2.0) Action required
small extraSmall Replace small with extraSmall
extraSmall twoExtraSmall Replace extraSmall with twoExtraSmall
twoExtraSmall threeExtraSmall Replace twoExtraSmall with threeExtraSmall
threeExtraSmall fourExtraSmall Replace threeExtraSmall with fourExtraSmall
fourExtraSmall fiveExtraSmall Replace fourExtraSmall with fiveExtraSmall
N/A small New larger size available

Note: Actual spacing values depend on your theme (Orange, Sosh, etc.). The table above shows the property name mappings to maintain equivalent semantic sizes across the update.

Code examples

Before (v1.x):

Modifier.padding(OudsTheme.spaces.inset.small)

After (v2.0):

// To maintain the same semantic size:
Modifier.padding(OudsTheme.spaces.inset.extraSmall)

// Or use the new larger small size:
Modifier.padding(OudsTheme.spaces.inset.small)
Migration steps
  1. Search your codebase for usage of OudsTheme.spaces.inset.* properties
  2. Review each usage to determine the intended spacing value
  3. Update property names according to the table above to maintain current spacing values
  4. Test visually to ensure layouts appear as expected
  5. Consider using the new small where a slightly larger spacing would improve your design

2. Link component: paddingBlock structure change

The OudsComponents.Link.Space.paddingBlock property has changed from a single Dp value to a structured object.

Before (v1.x):

val padding = OudsTheme.components.link.space.paddingBlock // Dp

After (v2.0):

// paddingBlock is now a data class with multiple properties:
val padding = OudsTheme.components.link.space.paddingBlock.default // Dp
// Available properties: default, small, compactDensityDefault, compactDensitySmall
Migration steps
  1. Find usages of OudsTheme.components.link.space.paddingBlock
  2. Choose the appropriate property based on your use case
  3. Update references to access the specific property

3. Progress indicator: default status changed to Neutral

The default status parameter for OudsCircularProgressIndicator and OudsLinearProgressIndicator has been changed from Accent to Neutral.

Impact: Progress indicators without an explicit status parameter will now display using neutral colors instead of accent colors.

Before (v1.x):

OudsLinearProgressIndicator() // Uses Accent status

After (v2.0):

// Now uses Neutral status by default
OudsLinearProgressIndicator()

// To maintain v1.x appearance:
OudsLinearProgressIndicator(status = OudsProgressIndicatorStatus.Accent)
Migration steps
  1. Review all progress indicator usages in your codebase
  2. For brand-related operations, explicitly set status = OudsProgressIndicatorStatus.Accent
  3. Test visually to ensure progress indicators match your intended design

Version history

3.0.0

  • Minimum Android SDK updated to API 24
  • OudsChipState Skeleton enum value addition
  • Public classes no longer use data modifier
  • Space token properties marked as restricted API
  • OudsVersion marked as internal API

2.0.0

  • Space inset token reorganization
  • Link component paddingBlock structure change
  • Progress indicator default status changed to Neutral

1.x.x

  • Previous stable releases