Skip to content
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
checkpoint!
started testing affair fetching & displaying, it was working with synthetic data
  • Loading branch information
chat-grp committed Oct 7, 2023
commit 25ce6b1349f24bd2df363522583ab3d97eb12eae
23 changes: 11 additions & 12 deletions app/src/main/java/com/limelight/shagaMap/MapActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ class MapActivity : AppCompatActivity(), OnMapClickListener {
}
}


/*
private fun initializeTestButton() {
val testButton = findViewById<Button>(R.id.testButton)
testButton.setOnClickListener {
Expand Down Expand Up @@ -292,10 +292,12 @@ class MapActivity : AppCompatActivity(), OnMapClickListener {
}
}

*/





/*
private fun initializeTestButton() {
val testButton: Button = findViewById(R.id.testButton)
testButton.setOnClickListener {
Expand All @@ -322,7 +324,7 @@ class MapActivity : AppCompatActivity(), OnMapClickListener {
dueRentAmount = 0uL // Replace with actual value
)
)

val decodedAffairsDataList = mutableListOf<DecodedAffairsData>()
// Add this block to populate the AffairsDataHolder.affairsMap
testPayloads.forEach { affairData ->
affairData.let { nonNullData ->
Expand Down Expand Up @@ -379,27 +381,24 @@ class MapActivity : AppCompatActivity(), OnMapClickListener {
dueRentAmount = nonNullData.dueRentAmount
)
// Store the decoded data in the HashMap
decodedAffairsDataList.add(decodedData)
AffairsDataHolder.affairsMap[authorityKey] = decodedData
}
}
}
}

Log.d("MapActivity", "affairsMap: ${AffairsDataHolder.affairsMap.keys.joinToString(", ")}")
// Log to debug
Log.d("MapActivity", "Synthetic affairsMap: ${AffairsDataHolder.affairsMap.keys.joinToString(", ")}")
// Initialize MapPopulation if it's not already
Log.d("MapActivity", "affairsMap: ${AffairsDataHolder.affairsMap.keys.joinToString(", ")}")
val mapPopulation = MapPopulation()
// Create a list to collect valid MarkerProperties
val validMarkerProperties = mutableListOf<MapPopulation.MarkerProperties>()

lifecycleScope.launch(Dispatchers.IO) {
for (testPayload in testPayloads) {
val conversionResult =
mapPopulation.buildMarkerProperties(this@MapActivity, testPayload)
for (decodedData in decodedAffairsDataList) {
val conversionResult = mapPopulation.buildMarkerProperties(this@MapActivity, decodedData)
if (conversionResult.isFailure) {
// Log and handle the failure
Log.e("Test", "Conversion failed for payload: $testPayload")
Log.e("Test", "Conversion failed for payload: $decodedData")
continue
}

Expand All @@ -424,7 +423,7 @@ class MapActivity : AppCompatActivity(), OnMapClickListener {
}
}

*/




Expand Down