From 8b03d5e38246abe7dc2aadf9d214e2275f046535 Mon Sep 17 00:00:00 2001 From: Dhruv Porwal Date: Wed, 25 Mar 2026 13:48:03 +0530 Subject: [PATCH 1/7] fix(ios): replace deprecated keyWindow with UIScene-safe connectedScenes lookup --- loans/ios/scloans.podspec | 2 +- .../Classes/SwiftScgatewayFlutterPlugin.swift | 41 ++++++++++++++++++- .../ios/scgateway_flutter_plugin.podspec | 2 +- .../ios/Flutter/AppFrameworkInfo.plist | 2 - smart_investing/ios/Podfile | 2 +- smart_investing/ios/Podfile.lock | 20 ++++----- .../ios/Runner.xcodeproj/project.pbxproj | 6 +-- smart_investing/ios/Runner/AppDelegate.swift | 7 +++- smart_investing/ios/Runner/Info.plist | 17 ++++++++ 9 files changed, 78 insertions(+), 21 deletions(-) diff --git a/loans/ios/scloans.podspec b/loans/ios/scloans.podspec index 80f3f0f..f578006 100644 --- a/loans/ios/scloans.podspec +++ b/loans/ios/scloans.podspec @@ -21,5 +21,5 @@ A new flutter plugin project. s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386' } s.swift_version = '5.0' - s.dependency 'SCLoans', '7.1.1' + s.dependency 'SCLoans-dhruv-migrate-to-sceneDelegate-80eca69', '7.1.1-39-debug' end diff --git a/scgateway/ios/Classes/SwiftScgatewayFlutterPlugin.swift b/scgateway/ios/Classes/SwiftScgatewayFlutterPlugin.swift index 91e5c81..f993b64 100644 --- a/scgateway/ios/Classes/SwiftScgatewayFlutterPlugin.swift +++ b/scgateway/ios/Classes/SwiftScgatewayFlutterPlugin.swift @@ -14,7 +14,46 @@ enum IntentType: String { public class SwiftScgatewayFlutterPlugin: NSObject, FlutterPlugin { @MainActor - let currentViewController: UIViewController = (UIApplication.shared.delegate?.window??.rootViewController)! + var currentViewController: UIViewController { + let foregroundScene = UIApplication.shared.connectedScenes + .filter({ $0.activationState == .foregroundActive }) + .compactMap({ $0 as? UIWindowScene }) + .first + + if let scene = foregroundScene { + let keyWindow: UIWindow? + if #available(iOS 15.0, *) { + keyWindow = scene.keyWindow + } else { + keyWindow = scene.windows.first(where: { $0.isKeyWindow }) + } + if let rootVC = keyWindow?.rootViewController { + return rootVC + } + } + + // Any connected scene fallback (covers edge cases where no scene is .foregroundActive yet) + if let windowScene = UIApplication.shared.connectedScenes + .compactMap({ $0 as? UIWindowScene }) + .first { + let window: UIWindow? + if #available(iOS 15.0, *) { + window = windowScene.keyWindow ?? windowScene.windows.first + } else { + window = windowScene.windows.first(where: { $0.isKeyWindow }) ?? windowScene.windows.first + } + if let rootVC = window?.rootViewController { + return rootVC + } + } + + // Fallback (AppDelegate-based window) + if let rootVC = UIApplication.shared.delegate?.window??.rootViewController { + return rootVC + } + + fatalError("SwiftScgatewayFlutterPlugin: No root view controller found. Ensure a UIWindow is set up in SceneDelegate or AppDelegate.") + } public static func register(with registrar: FlutterPluginRegistrar) { let channel = FlutterMethodChannel(name: "scgateway_flutter_plugin", binaryMessenger: registrar.messenger()) diff --git a/scgateway/ios/scgateway_flutter_plugin.podspec b/scgateway/ios/scgateway_flutter_plugin.podspec index deafa0a..4cc758b 100644 --- a/scgateway/ios/scgateway_flutter_plugin.podspec +++ b/scgateway/ios/scgateway_flutter_plugin.podspec @@ -15,7 +15,7 @@ Scgateway Flutter plugin. s.source = { :path => '.' } s.source_files = 'Classes/**/*' s.dependency 'Flutter' - s.dependency 'SCGateway', '7.1.4' + s.dependency 'SCGateway-dhruv-migrate-to-sceneDelegate-007ae6e', '7.1.6-24-debug' s.xcconfig = {'BUILD_LIBRARY_FOR_DISTRIBUTION' => 'YES'} s.vendored_frameworks = 'SCGateway.xcframework' s.platform = :ios, '13.0' diff --git a/smart_investing/ios/Flutter/AppFrameworkInfo.plist b/smart_investing/ios/Flutter/AppFrameworkInfo.plist index 7c56964..391a902 100644 --- a/smart_investing/ios/Flutter/AppFrameworkInfo.plist +++ b/smart_investing/ios/Flutter/AppFrameworkInfo.plist @@ -20,7 +20,5 @@ ???? CFBundleVersion 1.0 - MinimumOSVersion - 12.0 diff --git a/smart_investing/ios/Podfile b/smart_investing/ios/Podfile index a6ab13a..eedcb56 100644 --- a/smart_investing/ios/Podfile +++ b/smart_investing/ios/Podfile @@ -1,5 +1,5 @@ # Uncomment this line to define a global platform for your project -platform :ios, '14.0' +platform :ios, '15.0' source 'https://cdn.cocoapods.org' # private podspec for smallcase diff --git a/smart_investing/ios/Podfile.lock b/smart_investing/ios/Podfile.lock index 5688906..fb13912 100644 --- a/smart_investing/ios/Podfile.lock +++ b/smart_investing/ios/Podfile.lock @@ -6,14 +6,14 @@ PODS: - mixpanel_flutter (2.4.4): - Flutter - Mixpanel-swift (= 5.1.0) - - SCGateway (6.0.0) + - SCGateway (7.1.4) - scgateway_flutter_plugin (0.0.1): - Flutter - - SCGateway (= 6.0.0) + - SCGateway (= 7.1.4) - scloans (0.0.1): - Flutter - - SCLoans (= 6.0.0) - - SCLoans (6.0.0) + - SCLoans (= 7.1.1) + - SCLoans (7.1.1) DEPENDENCIES: - Flutter (from `Flutter`) @@ -38,14 +38,14 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/scloans/ios" SPEC CHECKSUMS: - Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7 + Flutter: cabc95a1d2626b1b06e7179b784ebcf0c0cde467 Mixpanel-swift: 7b26468fc0e2e521104e51d65c4bbf7cab8162f8 mixpanel_flutter: a0b6b937035899cd01951735ad5f87718b2ffee5 - SCGateway: f502f44122537b777861093ef97f67ccc311d4d0 - scgateway_flutter_plugin: 6cc6404fbc946cbf9b87f40277d9a11ab3c97422 - SCLoans: 9ec42243b84ba0c04564ee99f27c423c82a6b723 - scloans: 167ea92ebc32e70aa3560dc671153d7f421f02ca + SCGateway: 66313f5bd5c650bbde20941cf99c6059d544818a + scgateway_flutter_plugin: be9320b246499772148fbc2089b67d0c2a747121 + SCLoans: c01e392507599b9a4cbb28fae6c7aa3531c484c8 + scloans: 197f27e69914af5f743852b5c7c12f6d685bdef0 -PODFILE CHECKSUM: 32b0659ca3529b1ef2c9e5c229290749c8c79710 +PODFILE CHECKSUM: 06f3d79628f5881e8468842b1f97f7d12c291209 COCOAPODS: 1.16.2 diff --git a/smart_investing/ios/Runner.xcodeproj/project.pbxproj b/smart_investing/ios/Runner.xcodeproj/project.pbxproj index b9bc85c..d681ad1 100644 --- a/smart_investing/ios/Runner.xcodeproj/project.pbxproj +++ b/smart_investing/ios/Runner.xcodeproj/project.pbxproj @@ -454,7 +454,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; @@ -586,7 +586,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -637,7 +637,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; diff --git a/smart_investing/ios/Runner/AppDelegate.swift b/smart_investing/ios/Runner/AppDelegate.swift index 6266644..c30b367 100644 --- a/smart_investing/ios/Runner/AppDelegate.swift +++ b/smart_investing/ios/Runner/AppDelegate.swift @@ -2,12 +2,15 @@ import Flutter import UIKit @main -@objc class AppDelegate: FlutterAppDelegate { +@objc class AppDelegate: FlutterAppDelegate, FlutterImplicitEngineDelegate { override func application( _ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? ) -> Bool { - GeneratedPluginRegistrant.register(with: self) return super.application(application, didFinishLaunchingWithOptions: launchOptions) } + + func didInitializeImplicitFlutterEngine(_ engineBridge: FlutterImplicitEngineBridge) { + GeneratedPluginRegistrant.register(with: engineBridge.pluginRegistry) + } } diff --git a/smart_investing/ios/Runner/Info.plist b/smart_investing/ios/Runner/Info.plist index 804112c..9b0ea1e 100644 --- a/smart_investing/ios/Runner/Info.plist +++ b/smart_investing/ios/Runner/Info.plist @@ -83,5 +83,22 @@ UIApplicationSupportsIndirectInputEvents + UIApplicationSceneManifest + + UIApplicationSupportsMultipleScenes + + UISceneConfigurations + + UIWindowSceneSessionRoleApplication + + + UISceneConfigurationName + flutter + UISceneDelegateClassName + FlutterSceneDelegate + + + + From 0648e6d4df4715fe9d3ac9ef9f4234590a519484 Mon Sep 17 00:00:00 2001 From: Dhruv Porwal Date: Wed, 25 Mar 2026 14:07:22 +0530 Subject: [PATCH 2/7] update thread handling --- .../Classes/SwiftScgatewayFlutterPlugin.swift | 2 +- smart_investing/ios/Podfile.lock | 21 +++++----- smart_investing/ios/Runner/AppDelegate.swift | 2 +- smart_investing/pubspec.lock | 42 +++++++++---------- 4 files changed, 34 insertions(+), 33 deletions(-) diff --git a/scgateway/ios/Classes/SwiftScgatewayFlutterPlugin.swift b/scgateway/ios/Classes/SwiftScgatewayFlutterPlugin.swift index f993b64..9bab6c1 100644 --- a/scgateway/ios/Classes/SwiftScgatewayFlutterPlugin.swift +++ b/scgateway/ios/Classes/SwiftScgatewayFlutterPlugin.swift @@ -11,9 +11,9 @@ enum IntentType: String { case authoriseHoldings = "AUTHORISE_HOLDINGS" } +@MainActor public class SwiftScgatewayFlutterPlugin: NSObject, FlutterPlugin { - @MainActor var currentViewController: UIViewController { let foregroundScene = UIApplication.shared.connectedScenes .filter({ $0.activationState == .foregroundActive }) diff --git a/smart_investing/ios/Podfile.lock b/smart_investing/ios/Podfile.lock index fb13912..92bfd34 100644 --- a/smart_investing/ios/Podfile.lock +++ b/smart_investing/ios/Podfile.lock @@ -6,14 +6,14 @@ PODS: - mixpanel_flutter (2.4.4): - Flutter - Mixpanel-swift (= 5.1.0) - - SCGateway (7.1.4) + - SCGateway-dhruv-migrate-to-sceneDelegate-007ae6e (7.1.6-24-debug) - scgateway_flutter_plugin (0.0.1): - Flutter - - SCGateway (= 7.1.4) + - SCGateway-dhruv-migrate-to-sceneDelegate-007ae6e (= 7.1.6-24-debug) - scloans (0.0.1): - Flutter - - SCLoans (= 7.1.1) - - SCLoans (7.1.1) + - SCLoans-dhruv-migrate-to-sceneDelegate-80eca69 (= 7.1.1-39-debug) + - SCLoans-dhruv-migrate-to-sceneDelegate-80eca69 (7.1.1-39-debug) DEPENDENCIES: - Flutter (from `Flutter`) @@ -22,10 +22,11 @@ DEPENDENCIES: - scloans (from `.symlinks/plugins/scloans/ios`) SPEC REPOS: + https://github.com/smallcase/cocoapodspec-internal.git: + - SCGateway-dhruv-migrate-to-sceneDelegate-007ae6e + - SCLoans-dhruv-migrate-to-sceneDelegate-80eca69 trunk: - Mixpanel-swift - - SCGateway - - SCLoans EXTERNAL SOURCES: Flutter: @@ -41,10 +42,10 @@ SPEC CHECKSUMS: Flutter: cabc95a1d2626b1b06e7179b784ebcf0c0cde467 Mixpanel-swift: 7b26468fc0e2e521104e51d65c4bbf7cab8162f8 mixpanel_flutter: a0b6b937035899cd01951735ad5f87718b2ffee5 - SCGateway: 66313f5bd5c650bbde20941cf99c6059d544818a - scgateway_flutter_plugin: be9320b246499772148fbc2089b67d0c2a747121 - SCLoans: c01e392507599b9a4cbb28fae6c7aa3531c484c8 - scloans: 197f27e69914af5f743852b5c7c12f6d685bdef0 + SCGateway-dhruv-migrate-to-sceneDelegate-007ae6e: b09149fc113aa409ad828253763c720520a2b642 + scgateway_flutter_plugin: 3ed28fc720e0fdf9ca79c638509a5310788ce48b + scloans: 3c4c1632b4a972373933c81cf91b70265b9a606b + SCLoans-dhruv-migrate-to-sceneDelegate-80eca69: ab2115d77604c531216613247d237a8b08e283a4 PODFILE CHECKSUM: 06f3d79628f5881e8468842b1f97f7d12c291209 diff --git a/smart_investing/ios/Runner/AppDelegate.swift b/smart_investing/ios/Runner/AppDelegate.swift index c30b367..b7ca7b9 100644 --- a/smart_investing/ios/Runner/AppDelegate.swift +++ b/smart_investing/ios/Runner/AppDelegate.swift @@ -10,7 +10,7 @@ import UIKit return super.application(application, didFinishLaunchingWithOptions: launchOptions) } - func didInitializeImplicitFlutterEngine(_ engineBridge: FlutterImplicitEngineBridge) { + nonisolated func didInitializeImplicitFlutterEngine(_ engineBridge: FlutterImplicitEngineBridge) { GeneratedPluginRegistrant.register(with: engineBridge.pluginRegistry) } } diff --git a/smart_investing/pubspec.lock b/smart_investing/pubspec.lock index 0e8f0e3..f4b370a 100644 --- a/smart_investing/pubspec.lock +++ b/smart_investing/pubspec.lock @@ -109,10 +109,10 @@ packages: dependency: transitive description: name: characters - sha256: f71061c654a3380576a52b451dd5532377954cf9dbd272a78fc8479606670803 + sha256: faf38497bda5ead2a8c7615f4f7939df04333478bf32e4173fcb06d428b5716b url: "https://pub.dev" source: hosted - version: "1.4.0" + version: "1.4.1" checked_yaml: dependency: transitive description: @@ -372,26 +372,26 @@ packages: dependency: transitive description: name: leak_tracker - sha256: "6bb818ecbdffe216e81182c2f0714a2e62b593f4a4f13098713ff1685dfb6ab0" + sha256: "33e2e26bdd85a0112ec15400c8cbffea70d0f9c3407491f672a2fad47915e2de" url: "https://pub.dev" source: hosted - version: "10.0.9" + version: "11.0.2" leak_tracker_flutter_testing: dependency: transitive description: name: leak_tracker_flutter_testing - sha256: f8b613e7e6a13ec79cfdc0e97638fddb3ab848452eff057653abd3edba760573 + sha256: "1dbc140bb5a23c75ea9c4811222756104fbcd1a27173f0c34ca01e16bea473c1" url: "https://pub.dev" source: hosted - version: "3.0.9" + version: "3.0.10" leak_tracker_testing: dependency: transitive description: name: leak_tracker_testing - sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" + sha256: "8d5a2d49f4a66b49744b23b018848400d23e54caf9463f4eb20df3eb8acb2eb1" url: "https://pub.dev" source: hosted - version: "3.0.1" + version: "3.0.2" lints: dependency: transitive description: @@ -412,26 +412,26 @@ packages: dependency: transitive description: name: matcher - sha256: dc58c723c3c24bf8d3e2d3ad3f2f9d7bd9cf43ec6feaa64181775e60190153f2 + sha256: dc0b7dc7651697ea4ff3e69ef44b0407ea32c487a39fff6a4004fa585e901861 url: "https://pub.dev" source: hosted - version: "0.12.17" + version: "0.12.19" material_color_utilities: dependency: transitive description: name: material_color_utilities - sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec + sha256: "9c337007e82b1889149c82ed242ed1cb24a66044e30979c44912381e9be4c48b" url: "https://pub.dev" source: hosted - version: "0.11.1" + version: "0.13.0" meta: dependency: transitive description: name: meta - sha256: e3641ec5d63ebf0d9b41bd43201a66e3fc79a65db5f61fc181f04cd27aab950c + sha256: "23f08335362185a5ea2ad3a4e597f1375e78bce8a040df5c600c8d3552ef2394" url: "https://pub.dev" source: hosted - version: "1.16.0" + version: "1.17.0" mime: dependency: transitive description: @@ -518,14 +518,14 @@ packages: path: "../scgateway" relative: true source: path - version: "5.1.0" + version: "7.0.5" scloans: dependency: "direct main" description: path: "../loans" relative: true source: path - version: "4.0.0" + version: "5.1.1" shelf: dependency: transitive description: @@ -607,10 +607,10 @@ packages: dependency: transitive description: name: test_api - sha256: fb31f383e2ee25fbbfe06b40fe21e1e458d14080e3c67e7ba0acfde4df4e0bbd + sha256: "8161c84903fd860b26bfdefb7963b3f0b68fee7adea0f59ef805ecca346f0c7a" url: "https://pub.dev" source: hosted - version: "0.7.4" + version: "0.7.10" timing: dependency: transitive description: @@ -631,10 +631,10 @@ packages: dependency: transitive description: name: vector_math - sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" + sha256: d530bd74fea330e6e364cda7a85019c434070188383e1cd8d9777ee586914c5b url: "https://pub.dev" source: hosted - version: "2.1.4" + version: "2.2.0" vm_service: dependency: transitive description: @@ -676,5 +676,5 @@ packages: source: hosted version: "3.1.3" sdks: - dart: ">=3.8.1 <4.0.0" + dart: ">=3.9.0-0 <4.0.0" flutter: ">=3.18.0-18.0.pre.54" From 076c6f59d343fad37a8b134396ce046ebeecdfa0 Mon Sep 17 00:00:00 2001 From: Dhruv Porwal Date: Wed, 25 Mar 2026 14:27:25 +0530 Subject: [PATCH 3/7] fix(ios): replace deprecated keyWindow with UIScene-safe connectedScenes lookup --- loans/ios/Classes/ScLoanFlutterPlugin.swift | 43 +++++++++++++++++++-- smart_investing/ios/Runner/Info.plist | 4 ++ 2 files changed, 44 insertions(+), 3 deletions(-) diff --git a/loans/ios/Classes/ScLoanFlutterPlugin.swift b/loans/ios/Classes/ScLoanFlutterPlugin.swift index 667778c..b388c93 100644 --- a/loans/ios/Classes/ScLoanFlutterPlugin.swift +++ b/loans/ios/Classes/ScLoanFlutterPlugin.swift @@ -9,10 +9,47 @@ import Flutter import UIKit import Loans +@MainActor public class SwiftScLoanFlutterPlugin: NSObject, FlutterPlugin { - - @MainActor - let currentViewController: UIViewController = (UIApplication.shared.delegate?.window??.rootViewController)! + + var currentViewController: UIViewController { + let foregroundScene = UIApplication.shared.connectedScenes + .filter({ $0.activationState == .foregroundActive }) + .compactMap({ $0 as? UIWindowScene }) + .first + + if let scene = foregroundScene { + let keyWindow: UIWindow? + if #available(iOS 15.0, *) { + keyWindow = scene.keyWindow + } else { + keyWindow = scene.windows.first(where: { $0.isKeyWindow }) + } + if let rootVC = keyWindow?.rootViewController { + return rootVC + } + } + + if let windowScene = UIApplication.shared.connectedScenes + .compactMap({ $0 as? UIWindowScene }) + .first { + let window: UIWindow? + if #available(iOS 15.0, *) { + window = windowScene.keyWindow ?? windowScene.windows.first + } else { + window = windowScene.windows.first(where: { $0.isKeyWindow }) ?? windowScene.windows.first + } + if let rootVC = window?.rootViewController { + return rootVC + } + } + + if let rootVC = UIApplication.shared.delegate?.window??.rootViewController { + return rootVC + } + + fatalError("SwiftScLoanFlutterPlugin: No root view controller found. Ensure a UIWindow is set up in SceneDelegate or AppDelegate.") + } public static func register(with registrar: FlutterPluginRegistrar) { let channel = FlutterMethodChannel(name: "scloans", binaryMessenger: registrar.messenger()) diff --git a/smart_investing/ios/Runner/Info.plist b/smart_investing/ios/Runner/Info.plist index 9b0ea1e..83adf60 100644 --- a/smart_investing/ios/Runner/Info.plist +++ b/smart_investing/ios/Runner/Info.plist @@ -92,10 +92,14 @@ UIWindowSceneSessionRoleApplication + UISceneClassName + UIWindowScene UISceneConfigurationName flutter UISceneDelegateClassName FlutterSceneDelegate + UISceneStoryboardFile + Main From bc1df86b8bfb879c3c9e9c60ed86fbf4b9b0b3c2 Mon Sep 17 00:00:00 2001 From: Dhruv Porwal Date: Tue, 26 May 2026 11:44:08 +0530 Subject: [PATCH 4/7] feat: add IMR_SETUP intent support across Android, iOS, and Dart - Handle IMR_SETUP transaction result on Android - Add IMR_SETUP case to iOS IntentType enum and handle response - Expose IMR_SETUP constant in Dart ScgatewayIntent class - Bump Android SDK to 6.1.0, iOS SCGateway to 7.2.0 --- scgateway/android/build.gradle | 2 +- .../ScgatewayFlutterPluginTxnExt.kt | 9 +++++ .../Classes/SwiftScgatewayFlutterPlugin.swift | 35 +++++++++++++++++++ .../ios/scgateway_flutter_plugin.podspec | 2 +- scgateway/lib/scgateway_flutter_plugin.dart | 1 + 5 files changed, 47 insertions(+), 2 deletions(-) diff --git a/scgateway/android/build.gradle b/scgateway/android/build.gradle index 4a06427..3d3c819 100644 --- a/scgateway/android/build.gradle +++ b/scgateway/android/build.gradle @@ -64,5 +64,5 @@ android { dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" - implementation 'com.smallcase.gateway:sdk:6.0.5' + implementation 'com.smallcase.gateway:sdk:6.1.0' } diff --git a/scgateway/android/src/main/kotlin/com/example/scgateway_flutter_plugin/ScgatewayFlutterPluginTxnExt.kt b/scgateway/android/src/main/kotlin/com/example/scgateway_flutter_plugin/ScgatewayFlutterPluginTxnExt.kt index 37ddfa0..884655d 100644 --- a/scgateway/android/src/main/kotlin/com/example/scgateway_flutter_plugin/ScgatewayFlutterPluginTxnExt.kt +++ b/scgateway/android/src/main/kotlin/com/example/scgateway_flutter_plugin/ScgatewayFlutterPluginTxnExt.kt @@ -57,6 +57,15 @@ fun ScgatewayFlutterPlugin.txnOnSuccessCallback(transactionResult: TransactionRe result.success(transRes.toString()) + } + SmallcaseGatewaySdk.Result.IMR_SETUP -> { + + val transRes = JSONObject(transactionResult.data!!) + transRes.put("success", true) + transRes.put("transaction", "IMR_SETUP") + + result.success(transRes.toString()) + } else -> { diff --git a/scgateway/ios/Classes/SwiftScgatewayFlutterPlugin.swift b/scgateway/ios/Classes/SwiftScgatewayFlutterPlugin.swift index 9bab6c1..a5c575d 100644 --- a/scgateway/ios/Classes/SwiftScgatewayFlutterPlugin.swift +++ b/scgateway/ios/Classes/SwiftScgatewayFlutterPlugin.swift @@ -8,6 +8,7 @@ enum IntentType: String { case holding = "HOLDINGS_IMPORT" case fetchFunds = "FETCH_FUNDS" case sipSetup = "SIP_SETUP" + case imrSetup = "IMR_SETUP" case authoriseHoldings = "AUTHORISE_HOLDINGS" } @@ -344,6 +345,40 @@ public class SwiftScgatewayFlutterPlugin: NSObject, FlutterPlugin { /// Catch exception } + // MARK: IMR_SETUP + case .imrSetup(let smallcaseAuthToken, let imrAction, let transactionId, let signup): + + do { + let jsonEncoder = JSONEncoder() + let jsonData = try jsonEncoder.encode(imrAction) + + let data = try? JSONSerialization.jsonObject(with: jsonData, options: []) + + if let imrResponse = data as? [String: Any] { + + print("IMR_SETUP response: \(imrResponse)") + + var resDict: [String: Any] = [:] + + resDict["success"] = true + resDict["data"] = imrResponse + resDict["smallcaseAuthToken"] = smallcaseAuthToken + resDict["transaction"] = "IMR_SETUP" + resDict["transactionId"] = transactionId + resDict["signup"] = signup + + let jsonData = try! JSONSerialization.data(withJSONObject: resDict, options: []) + let jsonString = String(data: jsonData, encoding: .utf8) + + result(jsonString) + + return + } + + } catch { + /// Catch exception + } + default: return } diff --git a/scgateway/ios/scgateway_flutter_plugin.podspec b/scgateway/ios/scgateway_flutter_plugin.podspec index 4cc758b..7c3e438 100644 --- a/scgateway/ios/scgateway_flutter_plugin.podspec +++ b/scgateway/ios/scgateway_flutter_plugin.podspec @@ -15,7 +15,7 @@ Scgateway Flutter plugin. s.source = { :path => '.' } s.source_files = 'Classes/**/*' s.dependency 'Flutter' - s.dependency 'SCGateway-dhruv-migrate-to-sceneDelegate-007ae6e', '7.1.6-24-debug' + s.dependency 'SCGateway', '7.2.0' s.xcconfig = {'BUILD_LIBRARY_FOR_DISTRIBUTION' => 'YES'} s.vendored_frameworks = 'SCGateway.xcframework' s.platform = :ios, '13.0' diff --git a/scgateway/lib/scgateway_flutter_plugin.dart b/scgateway/lib/scgateway_flutter_plugin.dart index df4efab..d111623 100644 --- a/scgateway/lib/scgateway_flutter_plugin.dart +++ b/scgateway/lib/scgateway_flutter_plugin.dart @@ -12,6 +12,7 @@ class ScgatewayIntent { static const AUTHORISE_HOLDINGS = "AUTHORISE_HOLDINGS"; static const FETCH_FUNDS = "FETCH_FUNDS"; static const SIP_SETUP = "SIP_SETUP"; + static const IMR_SETUP = "IMR_SETUP"; static const CANCEL_AMO = "CANCEL_AMO"; static const MF_HOLDINGS_IMPORT = "MF_HOLDINGS_IMPORT"; } From 00434bc08c06d9602584c00727b8b338a8775c67 Mon Sep 17 00:00:00 2001 From: Dhruv Porwal Date: Wed, 27 May 2026 15:06:44 +0530 Subject: [PATCH 5/7] fix(ios): fix FlutterStreamHandler conformance --- scgateway/ios/Classes/SwiftScgatewayFlutterPlugin.swift | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/scgateway/ios/Classes/SwiftScgatewayFlutterPlugin.swift b/scgateway/ios/Classes/SwiftScgatewayFlutterPlugin.swift index d0c5bcb..d2009ab 100644 --- a/scgateway/ios/Classes/SwiftScgatewayFlutterPlugin.swift +++ b/scgateway/ios/Classes/SwiftScgatewayFlutterPlugin.swift @@ -12,9 +12,12 @@ enum IntentType: String { case authoriseHoldings = "AUTHORISE_HOLDINGS" } -@MainActor -public class SwiftScgatewayFlutterPlugin: NSObject, FlutterPlugin { - +public class SwiftScgatewayFlutterPlugin: NSObject, FlutterPlugin, FlutterStreamHandler { + + private var eventSink: FlutterEventSink? + private var notificationObserver: NSObjectProtocol? + + @MainActor var currentViewController: UIViewController { let foregroundScene = UIApplication.shared.connectedScenes .filter({ $0.activationState == .foregroundActive }) From 343e9a7ca9c1f0c36ef47c63919c81ab5101eb74 Mon Sep 17 00:00:00 2001 From: Dhruv Porwal Date: Wed, 27 May 2026 15:40:55 +0530 Subject: [PATCH 6/7] fix(ios): annotate plugin class with @MainActor to resolve Swift concurrency errors --- scgateway/ios/Classes/SwiftScgatewayFlutterPlugin.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scgateway/ios/Classes/SwiftScgatewayFlutterPlugin.swift b/scgateway/ios/Classes/SwiftScgatewayFlutterPlugin.swift index d2009ab..1f812f1 100644 --- a/scgateway/ios/Classes/SwiftScgatewayFlutterPlugin.swift +++ b/scgateway/ios/Classes/SwiftScgatewayFlutterPlugin.swift @@ -12,12 +12,12 @@ enum IntentType: String { case authoriseHoldings = "AUTHORISE_HOLDINGS" } +@MainActor public class SwiftScgatewayFlutterPlugin: NSObject, FlutterPlugin, FlutterStreamHandler { private var eventSink: FlutterEventSink? private var notificationObserver: NSObjectProtocol? - @MainActor var currentViewController: UIViewController { let foregroundScene = UIApplication.shared.connectedScenes .filter({ $0.activationState == .foregroundActive }) From e86d3d0e82b836d1fa522093f6a99d473187d9f5 Mon Sep 17 00:00:00 2001 From: Dhruv Porwal Date: Tue, 2 Jun 2026 13:51:57 +0530 Subject: [PATCH 7/7] chore: improve handling for nil data and null values in transaction error paths --- .../scgateway_flutter_plugin/ScgatewayFlutterPluginTxnExt.kt | 1 + scgateway/ios/Classes/SwiftScgatewayFlutterPlugin.swift | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/scgateway/android/src/main/kotlin/com/example/scgateway_flutter_plugin/ScgatewayFlutterPluginTxnExt.kt b/scgateway/android/src/main/kotlin/com/example/scgateway_flutter_plugin/ScgatewayFlutterPluginTxnExt.kt index 884655d..69db1a2 100644 --- a/scgateway/android/src/main/kotlin/com/example/scgateway_flutter_plugin/ScgatewayFlutterPluginTxnExt.kt +++ b/scgateway/android/src/main/kotlin/com/example/scgateway_flutter_plugin/ScgatewayFlutterPluginTxnExt.kt @@ -77,6 +77,7 @@ fun ScgatewayFlutterPlugin.txnOnSuccessCallback(transactionResult: TransactionRe } catch (e: Exception) { e.printStackTrace() + result.error("TXN_ERROR", e.message ?: "Unknown error in transaction callback", null) } } diff --git a/scgateway/ios/Classes/SwiftScgatewayFlutterPlugin.swift b/scgateway/ios/Classes/SwiftScgatewayFlutterPlugin.swift index 1f812f1..027d38a 100644 --- a/scgateway/ios/Classes/SwiftScgatewayFlutterPlugin.swift +++ b/scgateway/ios/Classes/SwiftScgatewayFlutterPlugin.swift @@ -404,7 +404,7 @@ public class SwiftScgatewayFlutterPlugin: NSObject, FlutterPlugin, FlutterStream resDict["transactionId"] = transactionId resDict["signup"] = signup - let jsonData = try! JSONSerialization.data(withJSONObject: resDict, options: []) + let jsonData = try JSONSerialization.data(withJSONObject: resDict, options: []) let jsonString = String(data: jsonData, encoding: .utf8) result(jsonString) @@ -413,7 +413,7 @@ public class SwiftScgatewayFlutterPlugin: NSObject, FlutterPlugin, FlutterStream } } catch { - /// Catch exception + result(FlutterError(code: "IMR_SETUP_ERROR", message: error.localizedDescription, details: nil)) } default: