Skip to content

[MS-1292] Refactor feature/login to use Kotlin Serialization instead of Jackson#1526

Merged
meladRaouf merged 1 commit into
mainfrom
ks-feature-login-module
Jan 12, 2026
Merged

[MS-1292] Refactor feature/login to use Kotlin Serialization instead of Jackson#1526
meladRaouf merged 1 commit into
mainfrom
ks-feature-login-module

Conversation

@meladRaouf
Copy link
Copy Markdown
Collaborator

JIRA ticket
Will be released in: 2026.1.0

Notable changes

  • Refactor feature/login to use Kotlin Serialization instead of Jackson to parse the qr code results json

Testing guidance

  • Login in SID using qrcode scanner to scan the project id and secret

Additional work checklist

  • Effect on other features and security has been considered
  • Design document marked as "In development" (if applicable)
  • External (Gitbook) and internal (Confluence) Documentation is up-to-date (or ticket created)
  • Test cases in Testiny are up to date (or ticket created)
  • Other teams notified about the changes (if applicable)

@cla-bot cla-bot Bot added the ... label Jan 12, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the feature/login module to use Kotlin Serialization instead of Jackson for parsing QR code JSON results. This is part of a broader migration effort to standardize on Kotlin Serialization across the codebase.

Changes:

  • Replaced Jackson annotations with Kotlin Serialization annotations in QrCodeContent data class
  • Updated LoginFormViewModel to use JsonHelper.json.decodeFromString() instead of JsonHelper.fromJson()
  • Removed Jackson dependencies from build.gradle.kts files
  • Updated tests to use actual JSON strings instead of mocking the JSON parsing

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
infra/ui-base/build.gradle.kts Removed Jackson dependency from ui-base module
feature/login/build.gradle.kts Removed Jackson dependency and added Kotlin Serialization plugin
feature/login/src/main/java/com/simprints/feature/login/screens/qrscanner/QrCodeContent.kt Replaced Jackson @JsonProperty with Kotlin Serialization @SerialName annotation and added @Serializable
feature/login/src/main/java/com/simprints/feature/login/screens/form/LoginFormViewModel.kt Updated JSON parsing to use Kotlin Serialization API; added blank lines in when expression
feature/login/src/test/java/com/simprints/feature/login/screens/form/LoginFormViewModelTest.kt Updated tests to use actual JSON strings and removed JsonHelper mock; changed to wildcard imports

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

import androidx.arch.core.executor.testing.InstantTaskExecutorRule
import androidx.lifecycle.Observer
import com.google.common.truth.Truth.assertThat
import com.google.common.truth.Truth.*
Copy link

Copilot AI Jan 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wildcard imports should be avoided. Instead of using import com.google.common.truth.Truth.* and import io.mockk.*, explicitly import only the functions and classes that are used in this file. This makes dependencies clearer and avoids potential naming conflicts.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Explicitly allowed in tests.

import io.mockk.clearMocks
import io.mockk.coEvery
import io.mockk.every
import io.mockk.*
Copy link

Copilot AI Jan 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wildcard imports should be avoided. Instead of using import io.mockk.*, explicitly import only the functions and classes that are used in this file (e.g., MockKAnnotations, clearMocks, coEvery, every, mockk, slot, verify). This makes dependencies clearer and avoids potential naming conflicts.

Suggested change
import io.mockk.*
import io.mockk.MockKAnnotations
import io.mockk.clearMocks
import io.mockk.coEvery
import io.mockk.every
import io.mockk.mockk
import io.mockk.slot
import io.mockk.verify

Copilot uses AI. Check for mistakes.
Comment on lines +65 to +79

AuthenticateDataResult.BadCredentials -> SignInState.BadCredentials

AuthenticateDataResult.IntegrityException -> SignInState.IntegrityException

AuthenticateDataResult.IntegrityServiceTemporaryDown -> SignInState.IntegrityServiceTemporaryDown

AuthenticateDataResult.MissingOrOutdatedGooglePlayStoreApp -> SignInState.MissingOrOutdatedGooglePlayStoreApp

AuthenticateDataResult.Offline -> SignInState.Offline

AuthenticateDataResult.TechnicalFailure -> SignInState.TechnicalFailure

AuthenticateDataResult.Unknown -> SignInState.Unknown

Copy link

Copilot AI Jan 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The blank lines between each branch of the when expression are unnecessary and inconsistent with typical Kotlin style conventions. Consider removing these extra blank lines to make the code more compact and readable.

Suggested change
AuthenticateDataResult.BadCredentials -> SignInState.BadCredentials
AuthenticateDataResult.IntegrityException -> SignInState.IntegrityException
AuthenticateDataResult.IntegrityServiceTemporaryDown -> SignInState.IntegrityServiceTemporaryDown
AuthenticateDataResult.MissingOrOutdatedGooglePlayStoreApp -> SignInState.MissingOrOutdatedGooglePlayStoreApp
AuthenticateDataResult.Offline -> SignInState.Offline
AuthenticateDataResult.TechnicalFailure -> SignInState.TechnicalFailure
AuthenticateDataResult.Unknown -> SignInState.Unknown
AuthenticateDataResult.BadCredentials -> SignInState.BadCredentials
AuthenticateDataResult.IntegrityException -> SignInState.IntegrityException
AuthenticateDataResult.IntegrityServiceTemporaryDown -> SignInState.IntegrityServiceTemporaryDown
AuthenticateDataResult.MissingOrOutdatedGooglePlayStoreApp -> SignInState.MissingOrOutdatedGooglePlayStoreApp
AuthenticateDataResult.Offline -> SignInState.Offline
AuthenticateDataResult.TechnicalFailure -> SignInState.TechnicalFailure
AuthenticateDataResult.Unknown -> SignInState.Unknown

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will look into disabling those rules.

@sonarqubecloud
Copy link
Copy Markdown

@meladRaouf meladRaouf merged commit 03f51bd into main Jan 12, 2026
19 checks passed
@meladRaouf meladRaouf deleted the ks-feature-login-module branch January 12, 2026 14:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants