Skip to content
This repository has been archived by the owner on Nov 5, 2024. It is now read-only.

Commit

Permalink
Fix-2903
Browse files Browse the repository at this point in the history
  • Loading branch information
YatinGarg07 committed Jan 31, 2024
1 parent ed4866d commit a91d550
Show file tree
Hide file tree
Showing 10 changed files with 104 additions and 11 deletions.
75 changes: 75 additions & 0 deletions ivy-data/src/test/java/com/ivy/data/migration/MigrationTest.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
package com.ivy.data.migration

import androidx.room.Room
import androidx.room.testing.MigrationTestHelper
import androidx.sqlite.db.framework.FrameworkSQLiteOpenHelperFactory
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.platform.app.InstrumentationRegistry
import com.ivy.data.db.IvyRoomDatabase
import com.ivy.data.db.IvyRoomDatabase.Companion.DB_NAME
import com.ivy.domain.db.migration.Migration105to106_TrnRecurringRules
import com.ivy.domain.db.migration.Migration106to107_Wishlist
import com.ivy.domain.db.migration.Migration107to108_Sync
import com.ivy.domain.db.migration.Migration108to109_Users
import com.ivy.domain.db.migration.Migration109to110_PlannedPayments
import com.ivy.domain.db.migration.Migration110to111_PlannedPaymentRule
import com.ivy.domain.db.migration.Migration111to112_User_testUser
import com.ivy.domain.db.migration.Migration112to113_ExchangeRates
import com.ivy.domain.db.migration.Migration113to114_Multi_Currency
import com.ivy.domain.db.migration.Migration114to115_Category_Account_Icons
import com.ivy.domain.db.migration.Migration115to116_Account_Include_In_Balance
import com.ivy.domain.db.migration.Migration116to117_SalteEdgeIntgration
import com.ivy.domain.db.migration.Migration117to118_Budgets
import com.ivy.domain.db.migration.Migration118to119_Loans
import com.ivy.domain.db.migration.Migration119to120_LoanTransactions
import com.ivy.domain.db.migration.Migration120to121_DropWishlistItem
import com.ivy.domain.db.migration.Migration122to123_ExchangeRates
import io.kotest.core.spec.style.AnnotationSpec
import io.kotest.core.spec.style.FunSpec
import org.junit.runner.RunWith


private val TEST_DB = DB_NAME

class MigrationTest : AnnotationSpec(){
// Array of all migrations.
private val ALL_MIGRATIONS = arrayOf(
Migration105to106_TrnRecurringRules(),
Migration106to107_Wishlist(),
Migration107to108_Sync(),
Migration108to109_Users(),
Migration109to110_PlannedPayments(),
Migration110to111_PlannedPaymentRule(),
Migration111to112_User_testUser(),
Migration112to113_ExchangeRates(),
Migration113to114_Multi_Currency(),
Migration114to115_Category_Account_Icons(),
Migration115to116_Account_Include_In_Balance(),
Migration116to117_SalteEdgeIntgration(),
Migration117to118_Budgets(),
Migration118to119_Loans(),
Migration119to120_LoanTransactions(),
Migration120to121_DropWishlistItem(),
Migration122to123_ExchangeRates()
)


// val helper = MigrationTestHelper(
// InstrumentationRegistry.getInstrumentation(),
// IvyRoomDatabase::class.java,
// listOf(IvyRoomDatabase.DeleteSEMigration()),
// FrameworkSQLiteOpenHelperFactory()
// )

@Test
fun testAllMigration(){

Room.databaseBuilder(
InstrumentationRegistry.getInstrumentation().targetContext,
IvyRoomDatabase::class.java,
TEST_DB
).addMigrations(*ALL_MIGRATIONS).build().apply {
openHelper.writableDatabase.close()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import com.ivy.wallet.ui.theme.Gray
import com.ivy.wallet.ui.theme.Orange
import com.ivy.wallet.ui.theme.White
import com.ivy.wallet.ui.theme.components.BalanceRow
import com.ivy.wallet.ui.theme.components.IvyCircleButton
import com.ivy.legacy.legacy.ui.theme.components.IvyCircleButton
import com.ivy.wallet.ui.theme.components.IvyDividerLine
import com.ivy.wallet.ui.theme.modal.ChoosePeriodModal
import com.ivy.wallet.ui.theme.modal.ChoosePeriodModalData
Expand Down
25 changes: 19 additions & 6 deletions screen-main/src/main/java/com/ivy/main/MainBottomBar.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.ivy.main

import android.util.Log
import androidx.annotation.DrawableRes
import androidx.compose.animation.core.animateDpAsState
import androidx.compose.animation.core.animateFloatAsState
Expand Down Expand Up @@ -59,12 +60,14 @@ import com.ivy.wallet.ui.theme.GradientIvy
import com.ivy.wallet.ui.theme.Green
import com.ivy.wallet.ui.theme.Ivy
import com.ivy.wallet.ui.theme.White
import com.ivy.wallet.ui.theme.components.IvyCircleButton
import com.ivy.legacy.legacy.ui.theme.components.IvyCircleButton
import com.ivy.wallet.ui.theme.GradientRed
import com.ivy.wallet.ui.theme.components.IvyIcon
import com.ivy.wallet.ui.theme.components.IvyOutlinedButton
import com.ivy.wallet.ui.theme.gradientExpenses
import com.ivy.wallet.ui.theme.modal.AddModalBackHandling
import com.ivy.wallet.ui.theme.pureBlur
import timber.log.Timber
import java.util.UUID
import kotlin.math.abs
import kotlin.math.roundToInt
Expand Down Expand Up @@ -180,16 +183,26 @@ fun BoxWithConstraintsScope.BottomBar(
var dragOffset by remember {
mutableStateOf(Offset.Zero)
}
// + & x button

val fabStartXOffset = FAB_BUTTON_SIZE.toDensityPx()
val fabStartYOffset = navigationBarInset() + FAB_BUTTON_SIZE.toDensityPx()

// // + & x button
IvyCircleButton(
modifier = Modifier
.layout { measurable, constraints ->

val maxWidthAllowedByParent = constraints.maxWidth
val maxHeightAllowedByParent = constraints.maxHeight

val placeable = measurable.measure(constraints)
layout(placeable.width, placeable.height) {
placeable.place(
x = fabStartX.roundToInt(),
y = fabStartY.roundToInt()
)
placeable.placeRelative(

x = (maxWidthAllowedByParent / 2 - fabStartXOffset / 2).roundToInt(),
y = (maxHeightAllowedByParent - fabStartYOffset).roundToInt()

)
}
}
.size(FAB_BUTTON_SIZE)
Expand Down
2 changes: 2 additions & 0 deletions temp-legacy-code/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ dependencies {
implementation(projects.ivyNavigation)
implementation(projects.ivyData)

implementation(projects.ivyDesign)

implementation(libs.bundles.activity)
implementation(libs.bundles.opencsv)
implementation(libs.bundles.firebase)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.unit.dp
import com.ivy.legacy.legacy.ui.theme.components.IvyCircleButton
import com.ivy.resources.R
import com.ivy.wallet.ui.theme.GradientRed
import com.ivy.wallet.ui.theme.White
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.ivy.wallet.ui.theme.components
package com.ivy.legacy.legacy.ui.theme.components

import androidx.annotation.DrawableRes
import androidx.compose.foundation.background
Expand All @@ -21,6 +21,7 @@ import com.ivy.wallet.ui.theme.Gradient
import com.ivy.wallet.ui.theme.GradientIvy
import com.ivy.wallet.ui.theme.GradientRed
import com.ivy.wallet.ui.theme.White
import com.ivy.wallet.ui.theme.components.IvyIcon

@Deprecated("Old design system. Use `:ivy-design` and Material3")
@Composable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.ivy.design.l0_system.UI
import com.ivy.design.l0_system.style
import com.ivy.legacy.legacy.ui.theme.components.IvyCircleButton
import com.ivy.legacy.utils.numberBetween
import com.ivy.legacy.utils.swap
import com.ivy.resources.R
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import com.ivy.wallet.ui.theme.GradientGreen
import com.ivy.wallet.ui.theme.GradientRed
import com.ivy.wallet.ui.theme.White
import com.ivy.wallet.ui.theme.components.IvyButton
import com.ivy.wallet.ui.theme.components.IvyCircleButton
import com.ivy.legacy.legacy.ui.theme.components.IvyCircleButton
import com.ivy.wallet.ui.theme.components.IvyOutlinedButton

@Deprecated("Old design system. Use `:ivy-design` and Material3")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ import com.ivy.wallet.ui.theme.GradientIvy
import com.ivy.wallet.ui.theme.Gray
import com.ivy.wallet.ui.theme.White
import com.ivy.wallet.ui.theme.components.IntervalPickerRow
import com.ivy.wallet.ui.theme.components.IvyCircleButton
import com.ivy.legacy.legacy.ui.theme.components.IvyCircleButton
import com.ivy.wallet.ui.theme.components.IvyDividerLine
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ import com.ivy.wallet.ui.theme.Orange
import com.ivy.wallet.ui.theme.Red
import com.ivy.wallet.ui.theme.components.ItemIconSDefaultIcon
import com.ivy.wallet.ui.theme.components.IvyBorderButton
import com.ivy.wallet.ui.theme.components.IvyCircleButton
import com.ivy.legacy.legacy.ui.theme.components.IvyCircleButton
import com.ivy.wallet.ui.theme.components.WrapContentRow
import com.ivy.wallet.ui.theme.findContrastTextColor
import com.ivy.wallet.ui.theme.modal.IvyModal
Expand Down

0 comments on commit a91d550

Please sign in to comment.