-
Notifications
You must be signed in to change notification settings - Fork 52
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
Conversation
@@ -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")) |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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.
PostHogTests/PostHogTests.swift
Outdated
@@ -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) |
There was a problem hiding this comment.
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
What does this PR do?
isFeatureEnabled
should returnfalse
if feature flag is disabledWhere 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: