Managed to embed Amity Social (AmityCommunityHomePageViewController) into my Flutter app. UI renders normally, and I can click most actions (Like, New Post, etc) but there are a few actions like clicking on Comment (see screenshot attached) that fail to respond to my clicks. I can see the Comment buttons reacting to my clicks, but they are not opening the comment section. Do you know what’s causing this?
Flutter code:
UiKitView amityView = UiKitView(
key: UniqueKey(),
viewType: viewType,
hitTestBehavior: PlatformViewHitTestBehavior.opaque,
layoutDirection: TextDirection.ltr,
creationParams: creationParams,
creationParamsCodec: const StandardMessageCodec());
runApp(CupertinoApp(
home: amityView,
));
AppDelegate.swift:
@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]?
) → Bool {
GeneratedPluginRegistrant.register(with: self)
weak var registrar = self.registrar(forPlugin: “amity-plugin”)
let controller = window?.rootViewController as! FlutterViewController
let factory = FLNativeViewFactory(messenger: registrar!.messenger(), controller:controller)
self.registrar(forPlugin: “amity-plugin”)!.register(
factory,
withId: “HomeFeed”)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
}
FLNativeView.swift:
class FLNativeViewFactory: NSObject, FlutterPlatformViewFactory {
private var messenger: FlutterBinaryMessenger
private var _controller:UIViewController
init(messenger: FlutterBinaryMessenger, controller:UIViewController) {
self.messenger = messenger
self._controller = controller
super.init()
}
func create(
withFrame frame: CGRect,
viewIdentifier viewId: Int64,
arguments args: Any?
) -> FlutterPlatformView {
return FLNativeView(
frame: frame,
viewIdentifier: viewId,
arguments: args,
binaryMessenger: messenger, controller:_controller)
}
}
class FLNativeView: NSObject, FlutterPlatformView {
private var _view: UIView
private var _controller:UIViewController
init(
frame: CGRect,
viewIdentifier viewId: Int64,
arguments args: Any?,
binaryMessenger messenger: FlutterBinaryMessenger?,
controller:UIViewController
) {
AmityUIKitManager.setup(apiKey: "b0efe05c6fd2a2671e34851d035d1089d65fdfb7e8333b2e", region:AmityRegion.US)
AmityUIKitManager.registerDevice(withUserId: amityUserId, displayName: amityDisplayName) { success, error in
print("[AmityUIKit] Login \(success ? "successfully" : "failed") \(error?.localizedDescription ?? "")")
}
_controller = controller
let homeController = AmityCommunityHomePageViewController.make()
_view = homeController.view
_controller.addChild(homeController)
homeController.didMove(toParent: _controller)
super.init()
}
func view() -> UIView {
return _view
}
}