Merge branch 'feature/DE307-834' into 'develop'

Digital PCT265 story DE307-834: Prevent scroll reset on reconfigure.

### Summary
Prevent carousel reset on same data.

### JIRA Ticket
https://onejira.verizon.com/browse/DE307-834

Co-authored-by: Hedden, Kyle Matthew <kyle.hedden@verizonwireless.com>

See merge request https://gitlab.verizon.com/BPHV_MIPS/mvm_core_ui/-/merge_requests/1147
This commit is contained in:
Bruce, Matt R 2024-07-17 12:32:44 +00:00
commit a845f70b55

View File

@ -210,6 +210,7 @@ open class Carousel: View {
registerCells(with: carouselModel, delegateObject: delegateObject)
prepareMolecules(with: carouselModel)
pageIndex = 0
FormValidator.setupValidation(for: carouselModel, delegate: delegateObject?.formHolderDelegate)
setupPagingMolecule(carouselModel.pagingMolecule, delegateObject: delegateObject)
@ -250,8 +251,6 @@ open class Carousel: View {
} else {
loop = false
}
pageIndex = 0
}
open override func reset() {
@ -286,7 +285,7 @@ open class Carousel: View {
/// Registers the cells with the collection view
func registerCells(with carouselModel: CarouselModel, delegateObject: MVMCoreUIDelegateObject?) {
var registeredIds = [String]()
for molecule in carouselModel.molecules {
for molecule in carouselModel.visibleMolecules {
if let info = getMoleculeInfo(with: molecule, delegateObject: delegateObject) {
collectionView.register(info.class, forCellWithReuseIdentifier: info.identifier)
registeredIds.append(info.identifier)
@ -300,7 +299,7 @@ open class Carousel: View {
func hasSameCellRegistration(with carouselModel: CarouselModel, delegateObject: MVMCoreUIDelegateObject?) -> Bool {
guard let registeredMoleculeIds else { return false }
let incomingIds = carouselModel.molecules.map { molecule in
let incomingIds = carouselModel.visibleMolecules.map { molecule in
if let info = getMoleculeInfo(with: molecule, delegateObject: delegateObject) {
return info.identifier
} else {