Skip to content

Commit

Permalink
Merge branch 'main' into fix-issue-3315
Browse files Browse the repository at this point in the history
  • Loading branch information
mahmoodharis88 committed Jul 18, 2024
2 parents 0f71487 + 1a46521 commit b192386
Show file tree
Hide file tree
Showing 155 changed files with 2,448 additions and 1,967 deletions.
71 changes: 29 additions & 42 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,52 +1,39 @@
## Pull Request (PR) Checklist
## Pull request (PR) checklist
Please check if your pull request fulfills the following requirements:
- [ ] The PR is submitted to the `main` branch.
<!--💡 Tip: Tick checkboxes like this: [x] 💡-->
- [ ] I've read the [Contribution Guidelines](https://github.com/Ivy-Apps/ivy-wallet/blob/main/CONTRIBUTING.md) and my PR doesn't break the rules.
- [ ] I've read and understand the [Developer Guidelines](https://github.com/Ivy-Apps/ivy-wallet/blob/main/docs/Guidelines.md).
- [ ] I confirm that I've run the code locally and everything works as expected.
- [ ] 🎬 I've attached a **screen recoding** of the changes.
- [ ] My PR includes only the necessary changes to fix the issue (i.e., no unnecessary files or lines of code are changed).

> Tip: drag & drop the video to the PR description.
- [ ] 🎬 I've attached a **screen recording** of using the new code to the next paragraph (if applicable).
## Screen recording of interacting with your changes:
<!--💡 Tip: Drag & drop the video here. 💡-->

## What's changed?
<!--
Tip: you can attach screenshots using a markdown table.
Before | After
--|--
image1 | image2
-->

Describe with a few bullets **what's new:**
- a
- b
- c

> 💡 Tip: Please, attach screenshots and screen recordings. It helps a lot!
## Risk Factors

<!--💡 Tip: After each more important point leave one line empty and show your changes in markdown table with screenshots or screen recordings replacing {media}. In the end, it should look like this: 💡-->
- I've fixed...

Before|After
---------|---------
{media}|{media}
{media}|{media}
- ...
- ...
## Risk factors
**What may go wrong if we merge your PR?**

- a
- b

**In what cases your code won't work?**

- a
- b

## Does this PR closes any GitHub Issues?

Check **[Ivy Wallet Issues](https://github.com/Ivy-Apps/ivy-wallet/issues)**.

- Closes #ISSUE_NUMBER

> Replace `ISSUE_NUMBER` with the number of the GitHub issue that this PR is fixing. If you've done that correctly, you'll see the issue title linked when previewing your PR description.
> **!Note:** Do **not** link the PR number. Link the number/id of the GitHub Issue from [issues](https://github.com/Ivy-Apps/ivy-wallet/issues).
- ...
- ...

**In what cases won't your code work?**
- ...
- ...
## Does this PR close any GitHub issues?
- Closes #{ISSUE_NUMBER}
<!--❗For example: - Closes #123 ❗-->
<!--💡 Tip: Replace {ISSUE_NUMBER} with the number of Ivy Wallet ISSUE (https://github.com/Ivy-Apps/ivy-wallet/issues)(❗NOT PR❗) which this pull request fixes. If done correctly, you'll see the issue title linked on PR preview. 💡-->
<!--💡 Tip: Multiple issues:
- Closes #{ISSUE_NUMBER_1}, closes #{ISSUE_NUMBER_2}, closes #{ISSUE_NUMBER_3}
💡-->
## Troubleshooting CI failures ❌

GitHub Actions failing? Read our [CI Troubleshooting guide](https://github.com/Ivy-Apps/ivy-wallet/blob/main/docs/CI-Troubleshooting.md).
Pull request checks failing? Read our [CI Troubleshooting guide](https://github.com/Ivy-Apps/ivy-wallet/blob/main/docs/CI-Troubleshooting.md).
2 changes: 1 addition & 1 deletion .github/workflows/internal_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ jobs:
run: |
RELEASE_TAG=${{ env.TAG_NAME }}
RELEASE_URL="https://github.com/${GITHUB_REPOSITORY}/releases/tag/${RELEASE_TAG}"
CAPTION=$'🚀 Ivy Wallet '"$RELEASE_TAG"$' release\n\nCheck it out here: '"$RELEASE_URL"' \n\n🚢 Please, test the release candidate before we ship it.'
CAPTION=$'🚀 Ivy Wallet '"$RELEASE_TAG"$' release\n\nCheck it out here: '"$RELEASE_URL"' \n\n 🚢 Please, test the release candidate before we ship it.'
curl -F "chat_id=-1001647280565" \
-F "document=@app/build/outputs/apk/demo/app-demo.apk" \
Expand Down
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ captures/
.idea/codeStyles
.idea/kotlinc.xml
.DS_Store
.idea/deploymentTargetSelector.xml
.idea/other.xml

# Keystore files
# Uncomment the following lines if you do not want to check your keystore files in.
Expand Down Expand Up @@ -98,3 +100,6 @@ lint/reports/
# JS
node_modules/*
/ci-actions/compose-stability/ivy-compose-stability-report.txt

# Kotlin Compiler
.kotlin/sessions/*
1 change: 1 addition & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ plugins {
id("com.google.devtools.ksp")
id("com.google.gms.google-services")
id("com.google.firebase.crashlytics")
id("io.gitlab.arturbosch.detekt")
}

android {
Expand Down
3 changes: 1 addition & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="com.android.alarm.permission.SET_ALARM" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
android:maxSdkVersion="28"
Expand Down Expand Up @@ -106,4 +105,4 @@
</service>
</application>

</manifest>
</manifest>
1 change: 1 addition & 0 deletions app/src/main/java/com/ivy/IvyNavGraph.kt
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ import com.ivy.transactions.TransactionsScreen
@ExperimentalFoundationApi
@ExperimentalAnimationApi
@Composable
@Suppress("CyclomaticComplexMethod", "FunctionNaming")
fun BoxWithConstraintsScope.IvyNavGraph(screen: Screen?) {
when (screen) {
null -> {
Expand Down
61 changes: 10 additions & 51 deletions app/src/main/java/com/ivy/wallet/RootActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,6 @@ import androidx.compose.runtime.getValue
import androidx.core.content.ContextCompat
import androidx.core.view.WindowCompat
import androidx.lifecycle.viewmodel.compose.viewModel
import com.google.android.gms.auth.api.signin.GoogleSignIn
import com.google.android.gms.auth.api.signin.GoogleSignInAccount
import com.google.android.gms.auth.api.signin.GoogleSignInClient
import com.google.android.gms.auth.api.signin.GoogleSignInOptions
import com.google.android.gms.common.api.ApiException
import com.google.android.gms.tasks.Task
import com.google.android.material.datepicker.MaterialDatePicker
import com.google.android.material.timepicker.MaterialTimePicker
import com.google.android.material.timepicker.TimeFormat
Expand All @@ -56,12 +50,12 @@ import com.ivy.widget.balance.WalletBalanceWidgetReceiver
import com.ivy.widget.transaction.AddTransactionWidget
import com.ivy.widget.transaction.AddTransactionWidgetCompact
import dagger.hilt.android.AndroidEntryPoint
import timber.log.Timber
import java.time.LocalDate
import java.time.LocalTime
import javax.inject.Inject

@AndroidEntryPoint
@Suppress("TooManyFunctions")
class RootActivity : AppCompatActivity(), RootScreen {
@Inject
lateinit var ivyContext: IvyWalletCtx
Expand All @@ -72,9 +66,6 @@ class RootActivity : AppCompatActivity(), RootScreen {
@Inject
lateinit var customerJourneyLogic: CustomerJourneyCardsProvider

private lateinit var googleSignInLauncher: ActivityResultLauncher<GoogleSignInClient>
private lateinit var onGoogleSignInIdTokenResult: (idToken: String?) -> Unit

private lateinit var createFileLauncher: ActivityResultLauncher<String>
private lateinit var onFileCreated: (fileUri: Uri) -> Unit

Expand Down Expand Up @@ -154,9 +145,9 @@ class RootActivity : AppCompatActivity(), RootScreen {

private fun setupDatePicker() {
ivyContext.onShowDatePicker = { minDate,
maxDate,
initialDate,
onDatePicked ->
maxDate,
initialDate,
onDatePicked ->
val datePicker =
MaterialDatePicker.Builder.datePicker()
.setSelection(
Expand Down Expand Up @@ -203,53 +194,19 @@ class RootActivity : AppCompatActivity(), RootScreen {
.build()
picker.show(supportFragmentManager, "timePicker")
picker.addOnPositiveButtonClickListener {
onTimePicked(LocalTime.of(picker.hour, picker.minute).convertLocalToUTC().withSecond(0))
onTimePicked(
LocalTime.of(picker.hour, picker.minute).convertLocalToUTC().withSecond(0)
)
}
}
}

private fun setupActivityForResultLaunchers() {
googleSignInLauncher()

createFileLauncher()

openFileLauncher()
}

private fun googleSignInLauncher() {
googleSignInLauncher = activityForResultLauncher(
createIntent = { _, client ->
client.signInIntent
}
) { _, intent ->
try {
val task: Task<GoogleSignInAccount> =
GoogleSignIn.getSignedInAccountFromIntent(intent)
val account: GoogleSignInAccount = task.getResult(ApiException::class.java)
val idToken = account.idToken
Timber.d("idToken = $idToken")

onGoogleSignInIdTokenResult(idToken)
} catch (e: ApiException) {
e.sendToCrashlytics("GOOGLE_SIGN_IN - registerGoogleSignInContract(): ApiException")
e.printStackTrace()
onGoogleSignInIdTokenResult(null)
}
}

ivyContext.googleSignIn = { idTokenResult: (String?) -> Unit ->
onGoogleSignInIdTokenResult = idTokenResult

val gso = GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestEmail()
.requestProfile()
.requestIdToken("364763737033-t1d2qe7s0s8597k7anu3sb2nq79ot5tp.apps.googleusercontent.com")
.build()
val googleSignInClient = GoogleSignIn.getClient(this, gso)
googleSignInLauncher.launch(googleSignInClient)
}
}

private fun createFileLauncher() {
createFileLauncher = activityForResultLauncher(
createIntent = { _, fileName ->
Expand Down Expand Up @@ -344,7 +301,7 @@ class RootActivity : AppCompatActivity(), RootScreen {
)
.setAllowedAuthenticators(
BiometricManager.Authenticators.BIOMETRIC_WEAK or
BiometricManager.Authenticators.DEVICE_CREDENTIAL
BiometricManager.Authenticators.DEVICE_CREDENTIAL
)
.setConfirmationRequired(false)
.build()
Expand All @@ -362,6 +319,7 @@ class RootActivity : AppCompatActivity(), RootScreen {
}
}

@Suppress("TooGenericExceptionCaught", "PrintStackTrace")
override fun openUrlInBrowser(url: String) {
try {
val browserIntent = Intent(Intent.ACTION_VIEW)
Expand Down Expand Up @@ -390,6 +348,7 @@ class RootActivity : AppCompatActivity(), RootScreen {
startActivity(share)
}

@Suppress("SwallowedException")
override fun openGooglePlayAppPage(appId: String) {
try {
startActivity(Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=$appId")))
Expand Down
4 changes: 4 additions & 0 deletions app/src/main/java/com/ivy/wallet/RootViewModel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import java.util.concurrent.atomic.AtomicLong
import javax.inject.Inject

@HiltViewModel
@Suppress("LongParameterList", "TooManyFunctions")
class RootViewModel @Inject constructor(
private val ivyContext: IvyWalletCtx,
private val nav: Navigation,
Expand Down Expand Up @@ -103,6 +104,7 @@ class RootViewModel @Inject constructor(
}
}

@Suppress("SwallowedException")
private fun handleSpecialStart(intent: Intent): Boolean {
val addTrnType: TransactionType? = try {
intent.getSerializableExtra(EXTRA_ADD_TRANSACTION_TYPE) as? TransactionType
Expand All @@ -125,6 +127,7 @@ class RootViewModel @Inject constructor(
return false
}

@Suppress("EmptyFunctionBlock")
fun handleBiometricAuthResult(
onAuthSuccess: () -> Unit = {}
): BiometricPrompt.AuthenticationCallback {
Expand Down Expand Up @@ -169,6 +172,7 @@ class RootViewModel @Inject constructor(
private val userInactiveTime = AtomicLong(0)
private var userInactiveJob: Job? = null

@Suppress("MagicNumber")
fun startUserInactiveTimeCounter() {
if (userInactiveJob != null && userInactiveJob!!.isActive) return

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class MigrationsManager @Inject constructor(
)
}

@Suppress("TooGenericExceptionCaught", "PrintStackTrace", "MagicNumber")
suspend fun executeMigrations() {
delay(2_000L) // to not the make the app start slower

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.ivy.wallet.ui.applocked

import android.annotation.SuppressLint
import android.content.Context
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
Expand Down Expand Up @@ -37,7 +38,9 @@ import com.ivy.wallet.ui.theme.Gray
import com.ivy.wallet.ui.theme.White
import com.ivy.wallet.ui.theme.components.IvyButton

@SuppressLint("ComposeModifierMissing")
@Composable
@Suppress("LongMethod", "FunctionNaming")
fun BoxWithConstraintsScope.AppLockedScreen(
onShowOSBiometricsModal: () -> Unit,
onContinueWithoutAuthentication: () -> Unit
Expand Down Expand Up @@ -135,6 +138,7 @@ private fun osAuthentication(

@Preview
@Composable
@Suppress("FunctionNaming", "UnusedPrivateMember")
private fun Preview_Locked() {
IvyWalletPreview {
AppLockedScreen(
Expand Down
1 change: 0 additions & 1 deletion config/detekt/baseline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10637,7 +10637,6 @@
<ID>UnusedParameter:Title.kt$initialTransactionId: UUID?</ID>
<ID>UnusedPrivateMember:EditTransactionViewModel.kt$EditTransactionViewModel$private suspend fun transferToAmount( amount: Double ): Double?</ID>
<ID>UnusedPrivateMember:Migration109to110_PlannedPayments.kt$Migration109to110_PlannedPayments$private fun SupportSQLiteDatabase.addSyncColumns(tableName: String)</ID>
<ID>UnusedPrivateMember:OnboardingSplashLogin.kt$@Composable private fun LoginWithGoogleExplanation()</ID>
<ID>UnusedPrivateMember:SettingsScreen.kt$@Composable private fun AccountCardButton( @DrawableRes icon: Int, text: String, onClick: () -&gt; Unit )</ID>
<ID>UnusedPrivateProperty:AccountModal.kt$val context = LocalContext.current</ID>
<ID>UnusedPrivateProperty:DateExt.kt$val seconds = TimeUnit.MILLISECONDS.toSeconds(timeLeftAfterCalculations)</ID>
Expand Down
6 changes: 0 additions & 6 deletions config/detekt/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -509,12 +509,6 @@ style:
active: false
singleLine: 'never'
multiLine: 'always'
# OptionalWhenBraces is the deprecated rule, use OptionalWhenBraces instead.
# Use it now because BracesOnWhenStatements doesn't work as expected
# https://github.com/detekt/detekt/issues/6377
# Delete OptionalWhenBraces rule config after detekt#6377 fix
OptionalWhenBraces:
active: false
BracesOnWhenStatements:
active: false
singleLine: 'necessary'
Expand Down
2 changes: 1 addition & 1 deletion fastlane/metadata/android/en-GB/changelogs/default.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Ivy Wallet internal testing release, please refer to (https://github.com/Ivy-Apps/ivy-wallet/releases) for changelog.
Ivy Wallet periodic release, refer to (https://github.com/Ivy-Apps/ivy-wallet/releases) for changelog. If you find any issues, please report them in our GitHub repository.
Loading

0 comments on commit b192386

Please sign in to comment.