Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

isFeatureEnabled now returns false if disabled #74

Merged
merged 3 commits into from
Oct 9, 2023

Conversation

marandaneto
Copy link
Member

@marandaneto marandaneto commented Oct 8, 2023

What does this PR do?

isFeatureEnabled should return false if feature flag is disabled

Where should the reviewer start?
PHGPostHog.m

How should this be manually tested?
Demo project has one flag for each case, you can just call isFeatureEnabled with them.

Any background context you want to provide?

Relates to PostHog/posthog-android#42

What are the relevant tickets?

Screenshots or screencasts (if UI/UX change)

Questions:

  • Does the docs need an update?
  • Are there any security concerns?
  • Do we need to update engineering / success?

@@ -2,7 +2,7 @@ import UIKit
import PostHog

// Use your own apiKey!
let PostHog = PHGPostHog(configuration: PHGPostHogConfiguration(apiKey: "b2XoQDHA5YhWQAjr2FZ4qIckgyEqXyY8"))
let PostHog = PHGPostHog(configuration: PHGPostHogConfiguration(apiKey: "_6SG-F7I1vCuZ-HdJL3VZQqjBlaSb1_20hDPwqMNnGI"))
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Defaults to "Demo".

@@ -27,13 +27,24 @@ class FeatureFlagTests: QuickSpec {
it("checks flag is enabled") {
_ = stubRequest("POST", "https://app.posthog.test/decide/?v=3" as LSMatcheable)
.andReturn(200)?
.withBody("{\"featureFlags\":{\"some-flag\":\"true\"}}" as LSHTTPBody);
.withBody("{\"featureFlags\":{\"some-flag\": true}}" as LSHTTPBody);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

String escaping was making the test wrong, fixed all of them.

@@ -97,22 +97,22 @@ class PostHogTests: QuickSpec {

it("fires Application Opened during UIApplicationWillEnterForeground") {
testMiddleware.swallowEvent = true
NotificationCenter.default.post(name: UIApplication.willEnterForegroundNotification, object: testApplication)
NotificationCenter.default.post(name: NSNotification.Name.UIApplicationWillEnterForeground, object: testApplication)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UIApplication.x is deprecated in favor of NSNotification.Name.x

@marandaneto marandaneto merged commit 74d803c into master Oct 9, 2023
@marandaneto marandaneto deleted the fix/disabled-flag branch October 9, 2023 11:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants