Skip to content

Commit

Permalink
fix: obj-c bindings issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Shahroz16 committed Dec 30, 2022
1 parent 27cf8c5 commit 0dbe4ef
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 15 deletions.
1 change: 0 additions & 1 deletion example/ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,6 @@
};
97C147041CF9000F007C117D /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1420"
LastUpgradeVersion = "1300"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
26 changes: 13 additions & 13 deletions ios/Classes/SwiftCustomerIoPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@ public class SwiftCustomerIoPlugin: NSObject, FlutterPlugin {
}
}

private func identify(params : Dictionary<String, Any>){
private func identify(params : Dictionary<String, AnyHashable>){
guard let identifier = params[Keys.Tracking.identifier] as? String
else {
return
}

guard let attributes = params[Keys.Tracking.attributes] as? Dictionary<String, Any> else{
guard let attributes = params[Keys.Tracking.attributes] as? Dictionary<String, AnyHashable> else{
CustomerIO.shared.identify(identifier: identifier)
return
}
Expand All @@ -67,13 +67,13 @@ public class SwiftCustomerIoPlugin: NSObject, FlutterPlugin {
CustomerIO.shared.clearIdentify()
}

private func track(params : Dictionary<String, Any>) {
private func track(params : Dictionary<String, AnyHashable>) {
guard let name = params[Keys.Tracking.eventName] as? String
else {
return
}

guard let attributes = params[Keys.Tracking.attributes] as? Dictionary<String, Any> else{
guard let attributes = params[Keys.Tracking.attributes] as? Dictionary<String, AnyHashable> else{
CustomerIO.shared.track(name: name)
return
}
Expand All @@ -82,13 +82,13 @@ public class SwiftCustomerIoPlugin: NSObject, FlutterPlugin {

}

func screen(params : Dictionary<String, Any>) {
func screen(params : Dictionary<String, AnyHashable>) {
guard let name = params[Keys.Tracking.eventName] as? String
else {
return
}

guard let attributes = params[Keys.Tracking.attributes] as? Dictionary<String, Any> else{
guard let attributes = params[Keys.Tracking.attributes] as? Dictionary<String, AnyHashable> else{
CustomerIO.shared.screen(name: name)
return
}
Expand All @@ -97,24 +97,24 @@ public class SwiftCustomerIoPlugin: NSObject, FlutterPlugin {
}


private func setDeviceAttributes(params : Dictionary<String, Any>){
guard let attributes = params[Keys.Tracking.attributes] as? Dictionary<String, Any>
private func setDeviceAttributes(params : Dictionary<String, AnyHashable>){
guard let attributes = params[Keys.Tracking.attributes] as? Dictionary<String, AnyHashable>
else {
return
}
CustomerIO.shared.deviceAttributes = attributes
}

private func setProfileAttributes(params : Dictionary<String, Any>){
guard let attributes = params[Keys.Tracking.attributes] as? Dictionary<String, Any>
private func setProfileAttributes(params : Dictionary<String, AnyHashable>){
guard let attributes = params[Keys.Tracking.attributes] as? Dictionary<String, AnyHashable>
else {
return
}
CustomerIO.shared.profileAttributes = attributes
}


private func initialize(params : Dictionary<String, Any>){
private func initialize(params : Dictionary<String, AnyHashable>){
guard let siteId = params[Keys.Environment.siteId] as? String,
let apiKey = params[Keys.Environment.apiKey] as? String,
let region = params[Keys.Environment.region] as? String,
Expand Down Expand Up @@ -159,9 +159,9 @@ public class SwiftCustomerIoPlugin: NSObject, FlutterPlugin {

private extension FlutterMethodCall {
func toNativeMethodCall( result: @escaping FlutterResult,
method: (_: Dictionary<String, Any>) throws -> Void) {
method: (_: Dictionary<String, AnyHashable>) throws -> Void) {
do {
if let attributes = self.arguments as? Dictionary<String, Any> {
if let attributes = self.arguments as? Dictionary<String, AnyHashable> {
print(attributes)
try method(attributes)
result(true)
Expand Down

0 comments on commit 0dbe4ef

Please sign in to comment.