-
Notifications
You must be signed in to change notification settings - Fork 455
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix #1586: Migrate LinkBankAccountActivity to Compose #1590
fix #1586: Migrate LinkBankAccountActivity to Compose #1590
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also fix your build and format your code using ctrl+shift+L
before pushing. Moreover you can remove unused imports using ctrl+shift+O
mifospay/src/main/java/org/mifos/mobilewallet/mifospay/bank/ui/LinkBankAccountActivity.kt
Outdated
Show resolved
Hide resolved
mifospay/src/main/java/org/mifos/mobilewallet/mifospay/bank/ui/LinkBankAccountActivity.kt
Outdated
Show resolved
Hide resolved
mifospay/src/main/java/org/mifos/mobilewallet/mifospay/bank/ui/LinkBankAccountActivity.kt
Outdated
Show resolved
Hide resolved
mifospay/src/main/java/org/mifos/mobilewallet/mifospay/bank/ui/LinkBankAccountActivity.kt
Outdated
Show resolved
Hide resolved
mifospay/src/main/java/org/mifos/mobilewallet/mifospay/bank/ui/LinkBankAccountActivity.kt
Outdated
Show resolved
Hide resolved
mifospay/src/main/java/org/mifos/mobilewallet/mifospay/bank/ui/LinkBankAccountScreen.kt
Outdated
Show resolved
Hide resolved
mifospay/src/main/java/org/mifos/mobilewallet/mifospay/bank/ui/LinkBankAccountScreen.kt
Show resolved
Hide resolved
mifospay/src/main/java/org/mifos/mobilewallet/mifospay/bank/ui/LinkBankAccountScreen.kt
Outdated
Show resolved
Hide resolved
mifospay/src/main/java/org/mifos/mobilewallet/mifospay/bank/ui/LinkBankAccountScreen.kt
Outdated
Show resolved
Hide resolved
mifospay/src/main/java/org/mifos/mobilewallet/mifospay/bank/ui/LinkBankAccountScreen.kt
Outdated
Show resolved
Hide resolved
5f5688a
to
de9978f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please follow these points as well :
- Remove extra spaces
- Use material guidelines
- resolve conflicts
- i see changes in xml which shouldn't have happened
mifospay/src/main/java/org/mifos/mobilewallet/mifospay/bank/ui/ChooseSimDialogSheet.kt
Outdated
Show resolved
Hide resolved
color = primaryDarkBlue | ||
) | ||
|
||
Spacer(modifier = Modifier.height(15.dp)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change to 16.dp
mifospay/src/main/java/org/mifos/mobilewallet/mifospay/bank/ui/ChooseSimDialogSheet.kt
Outdated
Show resolved
Hide resolved
mifospay/src/main/java/org/mifos/mobilewallet/mifospay/bank/ui/ChooseSimDialogSheet.kt
Outdated
Show resolved
Hide resolved
mifospay/src/main/java/org/mifos/mobilewallet/mifospay/bank/ui/ChooseSimDialogSheet.kt
Outdated
Show resolved
Hide resolved
mifospay/src/main/java/org/mifos/mobilewallet/mifospay/bank/ui/LinkBankAccountScreen.kt
Outdated
Show resolved
Hide resolved
mifospay/src/main/java/org/mifos/mobilewallet/mifospay/bank/ui/LinkBankAccountScreen.kt
Show resolved
Hide resolved
mifospay/src/main/java/org/mifos/mobilewallet/mifospay/bank/ui/LinkBankAccountScreen.kt
Show resolved
Hide resolved
...pay/src/main/java/org/mifos/mobilewallet/mifospay/bank/presenter/LinkBankAccountViewModel.kt
Outdated
Show resolved
Hide resolved
...pay/src/main/java/org/mifos/mobilewallet/mifospay/bank/presenter/LinkBankAccountViewModel.kt
Outdated
Show resolved
Hide resolved
|
||
|
||
@HiltViewModel | ||
class LinkBankAccountViewModel @Inject constructor() : ViewModel() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@therajanmaurya Here i was getting an error changed the json from {"banks": []} to only []
val bankState = _bankState.asStateFlow() | ||
|
||
|
||
fun getAllBanks(context: Context) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fetch flowable banks list from here
You can have a query field
private val _bankSearchquery = MutableStateFlow<String>>("")
var bankSearchquery = _bankSearchquery.asStateFlow()
fun updateBankSearchquery(query: String) {
_bankSearchquery.update { query }
}
val banks: StateFlow<List<Bank>> = combine(
localAssetRepository.getBanks(),
bankSearchquery,
::Pair
)
.map {
val countries = it.first
signupData = signupData.copy(
countryId = countries.find { it.name == signupData.countryName }?.id ?: ""
)
val allBanks = it.first.map { Bank (it, R.drawable.ic_bank, 1)}.filter { it.name.contains(it.second) }
popularBanks = // add isPopular field in Bank set them above true if below bank name matches so you can filter with single source and show on ui
LoadedBankState(
allBanks = allBanks,
)
}
.stateIn(
scope = viewModelScope,
started = SharingStarted.WhileSubscribed(5_000),
initialValue = emptyList(),
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
using this implementation you don't need other fields as user type and you update query, it will automatically update the bank list.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@therajanmaurya here on init i am getting the banks like this. The popular banks is a separate thing in ui and some of the popular banks is not present in json. the popular banks have their own drawable as u can see
After that as per your search logic i am setting the filtered banks and the popular banks
Please let me know if any changes required.
...pay/src/main/java/org/mifos/mobilewallet/mifospay/bank/presenter/LinkBankAccountViewModel.kt
Outdated
Show resolved
Hide resolved
mifospay/src/main/java/org/mifos/mobilewallet/mifospay/bank/ui/LinkBankAccountScreen.kt
Outdated
Show resolved
Hide resolved
mifospay/src/main/java/org/mifos/mobilewallet/mifospay/bank/ui/LinkBankAccountScreen.kt
Outdated
Show resolved
Hide resolved
3a52a60
to
db3808b
Compare
bd5fc00
to
839bc9c
Compare
839bc9c
to
ea6eb48
Compare
Issue Fix
Fixes #1586
Screenshots
WhatsApp.Video.2024-03-26.at.9.59.46.PM.mp4
Description
Migrated Link Bank Account Activity and ChooseSimDialog to Compose
Apply the
AndroidStyle.xml
style template to your code in Android Studio.Run the unit tests with
./gradlew check
to make sure you didn't break anythingIf you have multiple commits please combine them into one commit by squashing them.