Skip to content

Commit be6438d

Browse files
feat: surveys iOS GA (#202)
* feat: surveys iOS GA * Update CHANGELOG.md Co-authored-by: Manoel Aranda Neto <[email protected]> * fix: default to false for survey configuration --------- Co-authored-by: Manoel Aranda Neto <[email protected]>
1 parent 42c130d commit be6438d

File tree

4 files changed

+24
-19
lines changed

4 files changed

+24
-19
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
## Next
22

3+
## 5.4.1
4+
5+
- chore: update posthog-ios dependency to min. 3.31.0 (([#202](https://github.com/PostHog/posthog-flutter/pull/202)))
6+
37
## 5.4.0
48

59
- feat: surveys for Android ([#198](https://github.com/PostHog/posthog-flutter/pull/198))

android/src/main/kotlin/com/posthog/flutter/PosthogFlutterPlugin.kt

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -572,22 +572,24 @@ class PosthogFlutterPlugin :
572572
return
573573
}
574574

575-
var uri = try {
576-
Uri.parse(raw)
577-
} catch (e: Throwable) {
578-
result.error("InvalidArguments", "Malformed URL: $raw", null)
579-
return
580-
}
575+
var uri =
576+
try {
577+
Uri.parse(raw)
578+
} catch (e: Throwable) {
579+
result.error("InvalidArguments", "Malformed URL: $raw", null)
580+
return
581+
}
581582

582583
// If no scheme provided (e.g., "example.com"), default to https://
583584
if (uri.scheme.isNullOrEmpty()) {
584585
uri = Uri.parse("https://$raw")
585586
}
586587

587-
val intent = Intent(Intent.ACTION_VIEW, uri).apply {
588-
addCategory(Intent.CATEGORY_BROWSABLE)
589-
addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
590-
}
588+
val intent =
589+
Intent(Intent.ACTION_VIEW, uri).apply {
590+
addCategory(Intent.CATEGORY_BROWSABLE)
591+
addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
592+
}
591593

592594
try {
593595
applicationContext.startActivity(intent)

ios/Classes/PosthogFlutterPlugin.swift

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@_spi(Experimental) import PostHog
1+
import PostHog
22
#if os(iOS)
33
import Flutter
44
import UIKit
@@ -134,12 +134,11 @@ public class PosthogFlutterPlugin: NSObject, FlutterPlugin {
134134

135135
// configure surveys
136136
if #available(iOS 15.0, *) {
137-
if let surveys: Bool = posthogConfig["surveys"] as? Bool {
138-
config.surveys = surveys
139-
if surveys {
140-
// if surveys are enabled, assign this instance as the survey delegate (we'll take over rendering)
141-
config.surveysConfig.surveysDelegate = instance
142-
}
137+
let surveys: Bool = posthogConfig["surveys"] as? Bool ?? false
138+
config.surveys = surveys
139+
if surveys {
140+
// if surveys are enabled, assign this instance as the survey delegate (we'll take over rendering)
141+
config.surveysConfig.surveysDelegate = instance
143142
}
144143
}
145144
#endif

ios/posthog_flutter.podspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ Postog flutter plugin
2121
s.ios.dependency 'Flutter'
2222
s.osx.dependency 'FlutterMacOS'
2323

24-
# ~> Version 3.30.1 up to, but not including, 4.0.0
25-
s.dependency 'PostHog', '>= 3.30.1', '< 4.0.0'
24+
# ~> Version 3.31.0 up to, but not including, 4.0.0
25+
s.dependency 'PostHog', '>= 3.31.0', '< 4.0.0'
2626

2727
s.ios.deployment_target = '13.0'
2828
# PH iOS SDK 3.0.0 requires >= 10.15

0 commit comments

Comments
 (0)