Skip to content

Commit 0934670

Browse files
Added setAdvertisingID func
1 parent d8696ef commit 0934670

File tree

6 files changed

+21
-2
lines changed

6 files changed

+21
-2
lines changed

ios/Classes/SwiftQonversionFlutterSdkPlugin.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ public class SwiftQonversionFlutterSdkPlugin: NSObject, FlutterPlugin {
4545
case "setDebugMode":
4646
Qonversion.setDebugMode()
4747
return result(nil)
48+
49+
case "setAdvertisingID":
50+
Qonversion.setAdvertisingID()
51+
return result(nil)
4852

4953
case "offerings":
5054
return offerings(result)

ios/qonversion_flutter.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Pod::Spec.new do |s|
1616
s.source_files = 'Classes/**/*'
1717
s.dependency 'Flutter'
1818
s.platform = :ios, '9.0'
19-
s.dependency 'Qonversion', '2.11.3'
19+
s.dependency 'Qonversion', '2.13.2'
2020

2121
# Flutter.framework does not contain a i386 slice. Only x86_64 simulators are supported.
2222
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'VALID_ARCHS[sdk=iphonesimulator*]' => 'x86_64' }

lib/src/constants.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ class Constants {
2929
static const mSyncPurchases = 'syncPurchases';
3030
static const mAddAttributionData = 'addAttributionData';
3131
static const mSetDebugMode = 'setDebugMode';
32+
static const mSetAdvertisingID = 'setAdvertisingID';
3233
static const mOfferings = 'offerings';
3334
static const mCheckTrialIntroEligibility = 'checkTrialIntroEligibility';
3435
static const mStoreSdkInfo = 'storeSdkInfo';

lib/src/qonversion.dart

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,16 @@ class Qonversion {
192192
static Future<void> setDebugMode() =>
193193
_channel.invokeMethod(Constants.mSetDebugMode);
194194

195+
/// iOS only. Returns `null` if called on Android.
196+
/// On iOS 14.5+, after requesting the app tracking permission using ATT, you need to notify Qonversion if tracking is allowed and IDFA is available.
197+
static Future<void> setAdvertisingID() {
198+
if (Platform.isAndroid) {
199+
return null;
200+
}
201+
202+
return _channel.invokeMethod(Constants.mSetAdvertisingID);
203+
}
204+
195205
/// Return Qonversion Offerings Object
196206
/// An offering is a group of products that you can offer to a user on a given paywall based on your business logic.
197207
/// For example, you can offer one set of products on a paywall immediately after onboarding and another set of products with discounts later on if a user has not converted.

macos/Classes/SwiftQonversionFlutterSdkPlugin.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ public class SwiftQonversionFlutterSdkPlugin: NSObject, FlutterPlugin {
4545
case "setDebugMode":
4646
Qonversion.setDebugMode()
4747
return result(nil)
48+
49+
case "setAdvertisingID":
50+
Qonversion.setAdvertisingID()
51+
return result(nil)
4852

4953
case "offerings":
5054
return offerings(result)

macos/qonversion_flutter.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Pod::Spec.new do |s|
1616
s.source_files = 'Classes/**/*'
1717
s.dependency 'FlutterMacOS'
1818
s.platform = :osx, '10.12'
19-
s.dependency 'Qonversion', '2.11.3'
19+
s.dependency 'Qonversion', '2.13.2'
2020
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' }
2121
s.swift_version = '5.0'
2222
s.static_framework = true

0 commit comments

Comments
 (0)