Skip to content

Commit 443a35e

Browse files
feat: enhance event display with color-coded parsing and structured UI
- Add color-coded event backgrounds based on event types (success/error/warning/info) - Parse JSON events into structured key-value display instead of raw JSON - Extract event UI logic into separate stateful widgets for consistency - Add event management features: copy, clear, counter, proper lifecycle - Support loan-specific event types (approved, disbursed, rejected, etc.) - Implement proper event stream listening with start/stop lifecycle - Maintain consistent architecture between ConnectScreen and SILoansPage
1 parent f791e5b commit 443a35e

File tree

4 files changed

+704
-206
lines changed

4 files changed

+704
-206
lines changed

loans/ios/Classes/ScLoanEventsHandler.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import Foundation
22
import Flutter
3+
import Loans
34

45
class ScLoanEventsHandler: NSObject {
56

@@ -19,7 +20,7 @@ class ScLoanEventsHandler: NSObject {
1920

2021
private func setupNotificationListener() {
2122
NotificationCenter.default.addObserver(
22-
forName: Notification.Name("scloans_notification"),
23+
forName: ScLoan.scLoansNotificationName,
2324
object: nil,
2425
queue: .main
2526
) { [weak self] notification in
@@ -30,7 +31,7 @@ class ScLoanEventsHandler: NSObject {
3031
private func handleNotification(_ notification: Notification) {
3132
guard let eventStreamHandler = eventStreamHandler,
3233
let userInfo = notification.userInfo,
33-
let jsonString = userInfo["payload_str"] as? String else { return }
34+
let jsonString = userInfo[ScLoanNotification.strigifiedPayloadKey] as? String else { return }
3435

3536
eventStreamHandler.sendEvent(jsonString)
3637
}

scgateway/ios/Classes/ScgatewayEventsHandler.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import Foundation
22
import Flutter
3+
import SCGateway
34

45
class ScgatewayEventsHandler: NSObject {
56

@@ -19,7 +20,7 @@ class ScgatewayEventsHandler: NSObject {
1920

2021
private func setupNotificationListener() {
2122
NotificationCenter.default.addObserver(
22-
forName: Notification.Name("scg_notification"),
23+
forName: SCGateway.scgNotificationName,
2324
object: nil,
2425
queue: .main
2526
) { [weak self] notification in
@@ -30,7 +31,7 @@ class ScgatewayEventsHandler: NSObject {
3031
private func handleNotification(_ notification: Notification) {
3132
guard let eventStreamHandler = eventStreamHandler,
3233
let userInfo = notification.userInfo,
33-
let jsonString = userInfo["payload_str"] as? String else { return }
34+
let jsonString = userInfo[SCGNotification.strigifiedPayloadKey] as? String else { return }
3435

3536
eventStreamHandler.sendEvent(jsonString)
3637
}

0 commit comments

Comments
 (0)