-
Notifications
You must be signed in to change notification settings - Fork 7
Kaluga 1.0.0 Migration Guide
Tijl edited this page May 16, 2023
·
6 revisions
This is an overview of all the breaking changes made in Kaluga 1.0.0
Kaluga 1.0.0 moves to Kotlin 1.8 and enables the New Memory Model.
- Migrate from Coroutines
native-mt
dependencies to regular Coroutines dependencies. - Dependencies to
Stately
have been removed. For atomicity use AtomicFU. - Remove all
freeze()
calls as they no longer work.
-
TimeZone
has been renamed toKalugaTimeZone
. -
Locale
has been renamed toKalugaLocale
. -
ServiceMonitor
has been moved to theservice
Module. - Concurrent Collections (
com.splendo.kaluga.base.ConcurrentMutableList
) can be used instead of Stately.- Create using
concurrentMutableListOf()
/concurrentMutableMapOf()
/concurrentMutableSetOf()
.
- Create using
-
KalugaDate.epoch
andKalugaDate.now
now take aDuration
as offset. Legacy offsetInMilliseconds can still be used but requires importingcom.splendo.kaluga.base.utils.DefaultKalugaDate.Companion.epoch
orcom.splendo.kaluga.base.utils.DefaultKalugaDate.Companion.now
explicitly.
-
BaseAlertPresenter.Builder.buildAlert
now takes a closure ofAlert.Builder() -> Unit
instead ofAlertPresenter.Builder() -> Unit
.
-
LifecycleSubscribableMarker
has been renamed toLifecycleSubscribable
. -
BaseLifecycleViewModel
exposes a list ofLifecycleSubscribable
viaactiveLifecycleSubscribables
. To be used for Lifecycle binding instead of reflection (see also Android Architecture). These can be added through the constructor or viaaddLifecycleSubscribables()
. -
Navigator
may now throw aNavigatorException
if navigation fails.- Use
navigateWithSuccess()
to catch the exception and get a success state instead. - Use
navigateOrElse()
to catch the exception and provide a fallback.
- Use
-
Beacons
is now an interface. UseDefaultBeacons
to get a class implementation. -
BeaconInfo.seenMs()
has been deprecated in favour ofBeaconInfo.timeSinceLastSeen
.
-
Bluetooth.Builder
has been replaced byBaseBluetoothBuilder
.
-
RecurringTimer.state
is now aFlow
instead of aStateFlow
. UseRecurringTimer.currentState
to get the current state.
-
BaseDateTimePickerPresenter.Builder.buildDatePicker
now takes a closure ofDateTimePicker.Builder() -> Unit
instead ofBaseDateTimePickerPresenter.Builder() -> Unit
.
-
BaseHUD.Builder.build
now takes a closure ofHudConfig.Builder() -> Unit
instead ofBaseHUD.Builder() -> Unit
.
-
BaseKeyboardManager
now needs to be provided a type ofFocusHandler
to handle focus events. -
FocusHandler
is now a common interface.
See Android Keyboard and iOS Keyboard on how to handle this per platform.
-
Links
has been removed. Use aLinksManager
instead. -
LinksManager
has been moved tocom.splendo.kaluga.links
and is now the primary access point of this library.- Use
DefaultLinksManager
to get a default implementation.
- Use
-
LinksHandler
has been moved tocom.splendo.kaluga.links.handler
.
-
KnownLocation.time
now returns aKalugaDate
. -
Flow<Location>.known()
now returns aFlow<KnownLocation?>
instead ofFlow<KnownLocation>
and can be provided a maxAge. -
LocationStateRepo.Builder
has been removed. UseBaseLocationStateRepoBuilder
instead.
-
PermissionsBuilder
will throwPermissionsBuilderError
when getting aBasePermissionsBuilder
for aPermission
if it has not been registered. - Only one
BasePermissionsBuilder
can be registered toPermissionsBuilder
for aPermission
. When attempting to register a different builder,PermissionsBuilderError
will be thrown.- Use
unregister
to remove the currently registeredBasePermissionsBuilder
, orregisterOrGet
to only register if no builder has been registered yet.
- Use
- The same applies for
registerPermissionStateRepoBuilder
. - All
register<TYPE>Permission()
extensions can only be used once. Calling them twice will result in aPermissionsBuilderError
.- Use
register<TYPE>PermissionIfNotRegistered()
to only register a permission if it was not registered yet.
- Use
-
BackgroundStyle
has been renamed toKalugaBackgroundStyle
. -
ButtonStyle
has been renamed toKalugaButtonStyle
. -
Font
has been renamed toKalugaFont
. -
Image
has been renamed toKalugaImage
. -
TextAlignment
has been renamed toKalugaTextAlignment
. -
TextStyle
has been renamed toKalugaTextStyle
. -
KalugaImage.tinted() now returns the newly created TintedImage
.- See Android Resources and iOS Resources on how to render these.
-
DimensionlessScientificValue
has been removed. To getdecimalFraction
of aScientificValue
withPhysicalQuantity.Dimensionless
, importcom.splendo.kaluga.scientific.decimalFraction
.
-
Network
has been renamed toNetworkConnectionType
.-
NetworkConnectionType.Cellular
is now an object. -
NetworkConnectionType.Wifi
takes aisExpensive
parameter.
-
-
BaseNetworkManager
has been removed. -
NetworkManager
is now an interface that can be started/stopped usingstartMonitoring
/stopMonitoring
.- A platform specific
DefaultNetworkManager
exists.
- A platform specific
- To monitor the
NetworkState
use aBaseNetworkStateRepo
. -
NetworkStateRepo.Builder
has been removed. UseBaseNetworkStateRepoBuilder
instead.
Android Specific Changes:
-
AppCompatActivity.alertPresenterBuilder()
has been moved totest-utils-alerts
to prevent misuse on UI code.
- Since
LifecycleSubscribable
is now a common interface, the Android interface has been renamed toActivityLifecycleSubscribable
. -
LifecycleSubscriber
has been renamed toDefaultActivityLifecycleSubscribable
. -
AppCompatActivity.lifecycleManagerObserver()
has been moved totest-utils-architecture
to prevent misuse on UI code. - Since
getOrPutAndRemoveOnDestroyFromCache()
is no longer needed, it has been moved totest-utils-architecture
as well. -
BaseLifecycleViewModel.bind
will no longer use reflection to automatically subscribe toActivityLifecycleSubscribable
classes. Instead add anyActivityLifecycleSubscribable
toBaseLifecycleViewModel.activeLifecycleSubscribables
(either via the constructor oraddLifecycleSubscribables()
). -
ActivityNavigator
may now set a Fragment Result for theRemoveFragment
,PopFragment
,PopFragmentTo
, andDismissDialog
NavigationSpec
.
-
store()
andstoreAndRemember()
and store and remember have been deprecated since they do not account for configuration changes.- Instead use a regular viewmodel store. When using Koin, use Koin ViewModel for Composable to get a ViewModel.
-
RouteNavigator
,CombinedNavigator
, andModalBottomSheetNavigator
have been removed.- Instead use a
ComposableNavigator
orBottomSheetNavigator
. - To make these work, the LifecycleViewModel should be attached to the Composable view using
ViewModelComposable
.
- Instead use a
-
KalugaViewModelComposeActivity.Layout(VM)
has been changed toKalugaViewModelComposeActivity.ViewModel.Layout()
. -
KalugaViewModelComposeActivity.viewModel
has been changed toKalugaViewModelComposeActivity.createViewModel()
. -
ViewModelComposable
now automatically binds to allActivityLifecycleSubscribable
and the newly introducedComposableLifecycleSubscribable
. - See Architecture Compose ReadMe for more information.
- When writing a characteristic, the value will no longer be automatically read, in accordance with the latest Android api's. This behaviour was already inaccurate. Perform a Read/Notifying action on a characteristic to get its value after a write.
-
CharacteristicWrapper.writeType
now returns aCharacteristicWrapper.WriteType
instead of anInt
. -
DeviceWrapper.bondState
now returns aDeviceWrapper.BondState
instead of anInt
. -
ServiceWrapper.type
now returns aServiceWrapper.Type
instead of anInt
.
-
AppCompatActivity.datePickerPresenterBuilder()
has been moved totest-utils-date-time-picker
to prevent misuse on UI code.
-
AppCompatActivity.hudBuilder()
has been moved totest-utils-hud
to prevent misuse on UI code.
- Since
KeyboardManager
is now an interface, useViewKeyboardManager
to manage the keyboard for an XML View. -
ClearFocusHandler
andViewClearFocusHandler
have been removed.
For managing the keyboard on Compose, use the new Keyboard Compose Module.
- Notification permissions will now be requested on Android API 33 or higher.
- Make sure to add
android.permission.POST_NOTIFICATIONS
to your manifest.
- Make sure to add
- Convert a
TintedImage
to aDrawable
using thedrawable
extension method.
A new Resources Data Binding module has been introduced to use resources from XML View with Data Binding.
-
KalugaImage
andTintedImage
should be converted to anandroidx.compose.foundation.Image
using theComposable()
method.
-
AppCompatActivity.reviewManager()
has been removed to prevent misuse on UI code.
iOS Specific Changes:
When using SwiftUI make sure you use the latest Kaluga SwiftUI.
- The
RoutingState
fromKaluga SwiftUI
now properly works with animation. However it may modifyUINavigationBar.areAnimationsEnabled
during screen transitions. Make sure you dont change this value while navigating to a different route.
- Since
KeyboardManager
is now an interface, useUIKitKeyboardManager
to manage the keyboard for a UIView. - On SwiftUI make sure to enable the
includeKeyboard
setting and export theKeyboard Module
to your iOS code. - On SwiftUI use a
ValueKeyboardManager
. The Kaluga SwiftUI scripts offer aSwiftUIKeyboardManagerBuilder
that can be bound to a SwiftUI View.
-
KalugaButton.toButton()
now takes aButtonFrame
to modify the size of the button -
TintedImage
can be converted into aUIImage
using theuiImage
extension method -
TintedImage
can be converted into anImage
using theswiftUI
andresizableSwiftUI
extension methods