From b70c31b029db2f96a916da6a247596e695e120ad Mon Sep 17 00:00:00 2001 From: Sanu gupta Date: Thu, 3 Aug 2023 18:35:46 +0530 Subject: [PATCH] update-campaign-data-functions (#16) Asana link - https://app.asana.com/0/0/1205191087237874/f --- CHANGELOG.md | 4 +- README.md | 2 +- android/build.gradle | 2 +- .../TrackierfluttersdkPlugin.kt | 141 ++++++++++++++++- .../SwiftTrackierfluttersdkPlugin.swift | 148 +++++++++++++++--- ios/trackier_sdk_flutter.podspec | 2 +- lib/trackierfluttersdk.dart | 65 ++++++++ pubspec.yaml | 2 +- 8 files changed, 332 insertions(+), 34 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8a9554d..c064f61 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,3 @@ -## 1.6.41 +## 1.6.46 -- update: added updatePostbackConversion function in iOS \ No newline at end of file +- update: added the campaigns data functions \ No newline at end of file diff --git a/README.md b/README.md index 503d311..6323435 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ You can add the flutter sdk in two ways:- ``` dependencies: - trackier_sdk_flutter: ^1.6.41 + trackier_sdk_flutter: ^1.6.46 ``` 2. By using cli command. you need to run the below command in `terminal/cmd`. diff --git a/android/build.gradle b/android/build.gradle index 1fe9cf1..1f8ed6b 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -39,6 +39,6 @@ android { dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation 'androidx.annotation:annotation:1.2.0' - implementation 'com.trackier:android-sdk:1.6.39' + implementation 'com.trackier:android-sdk:1.6.46' implementation 'com.android.installreferrer:installreferrer:2.2' } diff --git a/android/src/main/kotlin/com/example/trackierfluttersdk/TrackierfluttersdkPlugin.kt b/android/src/main/kotlin/com/example/trackierfluttersdk/TrackierfluttersdkPlugin.kt index 33a6450..69e95ce 100644 --- a/android/src/main/kotlin/com/example/trackierfluttersdk/TrackierfluttersdkPlugin.kt +++ b/android/src/main/kotlin/com/example/trackierfluttersdk/TrackierfluttersdkPlugin.kt @@ -63,6 +63,74 @@ class TrackierfluttersdkPlugin : FlutterPlugin, MethodCallHandler { "setUserPhone" -> { setUserPhone(call, result) } + + "getAd" -> { + getAd(call, result) + } + + "getAdID" -> { + getAdID(call, result) + } + + "getAdSet" -> { + getAdSet(call, result) + } + + "getAdSetID" -> { + getAdSetID(call, result) + } + + "getCampaign" -> { + getCampaign(call, result) + } + + "getCampaignID" -> { + getCampaignID(call, result) + } + + "getChannel" -> { + getChannel(call, result) + } + + "getP1" -> { + getP1(call, result) + } + + "getP2" -> { + getP2(call, result) + } + + "getP3" -> { + getP3(call, result) + } + + "getP4" -> { + getP4(call, result) + } + + "getP5" -> { + getP5(call, result) + } + + "getClickId" -> { + getClickId(call, result) + } + + "getDlv" -> { + getDlv(call, result) + } + + "getPid" -> { + getPid(call, result) + } + + "getIsRetargeting" -> { + getIsRetargeting(call, result) + } + + "setPreinstallAttribution" -> { + setPreinstallAttribution(call, result) + } } } @@ -89,7 +157,7 @@ class TrackierfluttersdkPlugin : FlutterPlugin, MethodCallHandler { environment = configMap.get("environment") as String } trackierSDKConfig = TrackierSDKConfig(context, appToken, environment) - trackierSDKConfig.setSDKVersion("1.6.41") + trackierSDKConfig.setSDKVersion("1.6.46") trackierSDKConfig.setSDKType("flutter_sdk") trackierSDKConfig.setAppSecret(secretId, secretKey) @@ -253,7 +321,76 @@ class TrackierfluttersdkPlugin : FlutterPlugin, MethodCallHandler { val installID = TrackierSDK.getTrackierId() result.success(installID) } - + + private fun getAd(call: MethodCall, result: Result) { + result.success(TrackierSDK.getAd()) + } + private fun getAdID(call: MethodCall, result: Result) { + result.success(TrackierSDK.getAdID()) + } + private fun getAdSet(call: MethodCall, result: Result) { + result.success(TrackierSDK.getAdSet()) + } + + private fun getAdSetID(call: MethodCall, result: Result) { + result.success(TrackierSDK.getAdSetID()) + } + + private fun getCampaign(call: MethodCall, result: Result) { + result.success(TrackierSDK.getCampaign()) + } + + private fun getCampaignID(call: MethodCall, result: Result) { + result.success(TrackierSDK.getCampaignID()) + } + + private fun getChannel(call: MethodCall, result: Result) { + result.success(TrackierSDK.getChannel()) + } + + private fun getP1(call: MethodCall, result: Result) { + result.success(TrackierSDK.getP1()) + } + + private fun getP2(call: MethodCall, result: Result) { + result.success(TrackierSDK.getP2()) + } + + private fun getP3(call: MethodCall, result: Result) { + result.success(TrackierSDK.getP3()) + } + + private fun getP4(call: MethodCall, result: Result) { + result.success(TrackierSDK.getP4()) + } + + private fun getP5(call: MethodCall, result: Result) { + result.success(TrackierSDK.getP5()) + } + + private fun getClickId(call: MethodCall, result: Result) { + result.success(TrackierSDK.getClickId()) + } + + private fun getDlv(call: MethodCall, result: Result) { + result.success(TrackierSDK.getDlv()) + } + + private fun getPid(call: MethodCall, result: Result) { + result.success(TrackierSDK.getPid()) + } + + private fun getIsRetargeting(call: MethodCall, result: Result) { + result.success(TrackierSDK.getIsRetargeting()) + } + + private fun setPreinstallAttribution(call: MethodCall, result: Result) { + val pid = call.argument("pid").toString() + val campaign = call.argument("campaign").toString() + val campaignId = call.argument("campaignId").toString() + TrackierSDK.setPreinstallAttribution(pid, campaign, campaignId) + } + override fun onDetachedFromEngine(@NonNull binding: FlutterPlugin.FlutterPluginBinding) { channel.setMethodCallHandler(null) } diff --git a/ios/Classes/SwiftTrackierfluttersdkPlugin.swift b/ios/Classes/SwiftTrackierfluttersdkPlugin.swift index 694fca3..efb3093 100644 --- a/ios/Classes/SwiftTrackierfluttersdkPlugin.swift +++ b/ios/Classes/SwiftTrackierfluttersdkPlugin.swift @@ -23,31 +23,63 @@ public class SwiftTrackierfluttersdkPlugin: NSObject, FlutterPlugin, DeepLinkLis } public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) { - result("iOS " + UIDevice.current.systemVersion) - if (call.method == "setUserId") { - let dict = call.arguments as? String - if (dict != nil) { setUserId(dict: dict!) } - } else if (call.method == "setUserEmail") { - let dict = call.arguments as? String - if (dict != nil) { setUserEmail(dict: dict!) } - } else if (call.method == "setUserPhone") { - let dict = call.arguments as? String - if (dict != nil) { setUserPhone(dict: dict!) } - } else if (call.method == "setUserName") { - let dict = call.arguments as? String - if (dict != nil) { setUserName(dict: dict!) } - } else if (call.method == "setUserAdditonalDetail") { - let dict = call.arguments as? [String:Any] - if (dict != nil) { setUserAdditionalDetails(dict: dict!) } - } else if (call.method == "updatePostbackConversion") { - let dict = call.arguments as? Int - if (dict != nil) { updatePostbackConversion(dict: dict!) } - } else if (call.method == "initializeSDK") { - let dict = call.arguments as? [String:Any] - if (dict != nil) { initializeSDK(dict: dict) } - } else if (call.method == "trackierEvent") { - let dict = call.arguments as? [String:Any] - if (dict != nil) { trackEvent(dict: dict) } + //result("iOS " + UIDevice.current.systemVersion) + if (call.method == "setUserId") { + let dict = call.arguments as? String + if (dict != nil) { setUserId(dict: dict!) } + } else if (call.method == "setUserEmail") { + let dict = call.arguments as? String + if (dict != nil) { setUserEmail(dict: dict!) } + } else if (call.method == "setUserPhone") { + let dict = call.arguments as? String + if (dict != nil) { setUserPhone(dict: dict!) } + } else if (call.method == "setUserName") { + let dict = call.arguments as? String + if (dict != nil) { setUserName(dict: dict!) } + } else if (call.method == "setUserAdditonalDetail") { + let dict = call.arguments as? [String:Any] + if (dict != nil) { setUserAdditionalDetails(dict: dict!) } + } else if (call.method == "updatePostbackConversion") { + let dict = call.arguments as? Int + if (dict != nil) { updatePostbackConversion(dict: dict!) } + } else if (call.method == "initializeSDK") { + let dict = call.arguments as? [String:Any] + if (dict != nil) { initializeSDK(dict: dict) } + } else if (call.method == "trackierEvent") { + let dict = call.arguments as? [String:Any] + if (dict != nil) { trackEvent(dict: dict) } + } else if (call.method == "getAd") { + getAd(result: result) + } else if (call.method == "getAdID") { + getAdID(result: result) + } else if (call.method == "getAdSet") { + getAdSet(result: result) + } else if (call.method == "getAdSetID") { + getAdSetID(result: result) + } else if (call.method == "getCampaign") { + getCampaign(result: result) + } else if (call.method == "getCampaignID") { + getCampaignID(result: result) + } else if (call.method == "getP1") { + getP1(result: result) + } else if (call.method == "getP2") { + getP2(result: result) + } else if (call.method == "getP3") { + getP3(result: result) + } else if (call.method == "getP4") { + getP4(result: result) + } else if (call.method == "getP5") { + getP5(result: result) + } else if (call.method == "getClickId") { + getClickId(result: result) + } else if (call.method == "getDlv") { + getDlv(result: result) + } else if (call.method == "getPid") { + getPid(result: result) + } else if (call.method == "getIsRetargeting") { + getIsRetargeting(result: result) + } else { + result(FlutterMethodNotImplemented) } } @@ -81,6 +113,70 @@ public class SwiftTrackierfluttersdkPlugin: NSObject, FlutterPlugin, DeepLinkLis TrackierSDK.updatePostbackConversion(conversionValue: postbackConversion) } + func getAd(result: FlutterResult) -> Void { + result("sanu") + } + + func getAdID(result: FlutterResult) -> Void { + result("sanu22") + } + + func getAdSet(result: FlutterResult) -> Void { + result(TrackierSDK.getAdSet()) + } + + func getAdSetID(result: FlutterResult) -> Void { + result(TrackierSDK.getAdSetID()) + } + + func getCampaign(result: FlutterResult) -> Void { + result(TrackierSDK.getCampaign()) + } + + func getCampaignID(result: FlutterResult) -> Void { + result(TrackierSDK.getCampaignID()) + } + + func getChannel(result: FlutterResult) -> Void { + result(TrackierSDK.getChannel()) + } + + func getP1(result: FlutterResult) -> Void { + result(TrackierSDK.getP1()) + } + + func getP2(result: FlutterResult) -> Void { + result(TrackierSDK.getP2()) + } + + func getP3(result: FlutterResult) -> Void { + result(TrackierSDK.getP3()) + } + + func getP4(result: FlutterResult) -> Void { + result(TrackierSDK.getP4()) + } + + func getP5(result: FlutterResult) -> Void { + result(TrackierSDK.getP5()) + } + + func getClickId(result: FlutterResult) -> Void { + result(TrackierSDK.getClickId()) + } + + func getDlv(result: FlutterResult) -> Void { + result(TrackierSDK.getDlv()) + } + + func getPid(result: FlutterResult) -> Void { + result(TrackierSDK.getPid()) + } + + func getIsRetargeting(result: FlutterResult) -> Void { + result(TrackierSDK.getIsRetargeting()) + } + func initializeSDK(dict: Optional>) -> Void { let appToken = "\(dict?["appToken"] as? String ?? "")" let environment = "\(dict?["environment"] as? String ?? "")" @@ -89,7 +185,7 @@ public class SwiftTrackierfluttersdkPlugin: NSObject, FlutterPlugin, DeepLinkLis let deeplinkKey = "\(dict?["deeplinkCallback"] as? String ?? "")" let config = TrackierSDKConfig(appToken: appToken , env: environment) config.setAppSecret(secretId: secretId, secretKey: secretKey) - config.setSDKVersion(sdkVersion: "1.6.41") + config.setSDKVersion(sdkVersion: "1.6.46") if (!deeplinkKey.isEmpty) { config.setDeeplinkListerner(listener: self) } diff --git a/ios/trackier_sdk_flutter.podspec b/ios/trackier_sdk_flutter.podspec index 4eaecb8..cb94dc0 100644 --- a/ios/trackier_sdk_flutter.podspec +++ b/ios/trackier_sdk_flutter.podspec @@ -4,7 +4,7 @@ # Pod::Spec.new do |s| s.name = 'trackier_sdk_flutter' - s.version = '1.6.40' + s.version = '1.6.46' s.summary = 'Trackier flutter SDK' s.description = <<-DESC This is Trackier flutter SDK diff --git a/lib/trackierfluttersdk.dart b/lib/trackierfluttersdk.dart index d5d9ec5..2ec07a9 100644 --- a/lib/trackierfluttersdk.dart +++ b/lib/trackierfluttersdk.dart @@ -49,8 +49,73 @@ class Trackierfluttersdk { _channel.invokeMethod('setUserAdditonalDetail', userAdditonalDetail); } + static void setPreinstallAttribution(String pid, String campaign, String campaignId) { + final Map parameters = {'pid': pid, 'campaign': campaign, 'campaignId': campaignId,}; + _channel.invokeMethod('setPreinstallAttribution', parameters); + } + static Future getTrackierId() async { final String installID = await _channel.invokeMethod('getTrackierId'); return installID; } + + static Future getAd() async { + return await _channel.invokeMethod('getAd'); + } + + static Future getAdID() async { + return await _channel.invokeMethod('getAdID'); + } + + static Future getAdSet() async { + return await _channel.invokeMethod('getAdSet'); + } + + static Future getAdSetID() async { + return await _channel.invokeMethod('getAdSetID'); + } + + static Future getCampaign() async { + return await _channel.invokeMethod('getCampaign'); + } + + static Future getCampaignID() async { + return await _channel.invokeMethod('getCampaignID'); + } + + static Future getP1() async { + return await _channel.invokeMethod('getP1'); + } + + static Future getP2() async { + return await _channel.invokeMethod('getP2'); + } + + static Future getP3() async { + return await _channel.invokeMethod('getP3'); + } + + static Future getP4() async { + return await _channel.invokeMethod('getP4'); + } + + static Future getP5() async { + return await _channel.invokeMethod('getP5'); + } + + static Future getClickId() async { + return await _channel.invokeMethod('getClickId'); + } + + static Future getDlv() async { + return await _channel.invokeMethod('getDlv'); + } + + static Future getPid() async { + return await _channel.invokeMethod('getPid'); + } + + static Future getIsRetargeting() async { + return await _channel.invokeMethod('getIsRetargeting'); + } } diff --git a/pubspec.yaml b/pubspec.yaml index af0d10a..026639e 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: trackier_sdk_flutter description: This is trackier flutter SDK -version: 1.6.41 +version: 1.6.46 homepage: https://github.com/trackier/flutter-sdk environment: