Skip to content

Commit

Permalink
Addressed a few comments from the code review
Browse files Browse the repository at this point in the history
  • Loading branch information
marandaneto committed Oct 23, 2023
1 parent 1233cf3 commit 74d8247
Show file tree
Hide file tree
Showing 9 changed files with 45 additions and 156 deletions.
14 changes: 14 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Contributing
============

If you would like to contribute code to `posthog-ios` you can do so through
GitHub by forking the repository and opening a pull request against `master`.

Run `make bootstrap` to install all dependencies.

When submitting code, please make every effort to follow existing conventions
and style in order to keep the code as readable as possible. Please also make
sure your code compiles by `make build`. In addition please consider adding
unit tests covering your change, this will make your change much more likely to be accepted

Above all, thank you for contributing!
8 changes: 2 additions & 6 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
Copyright (c) 2020-2023 PostHog Inc.
MIT License

Portions of this software are licensed as follows:

* All content that resides under the "ee/" directory of this repository, if that directory exists, is licensed under the license defined in "ee/LICENSE".
* All third party components incorporated into the PostHog Software are licensed under the original license provided by the owner of the applicable component.
* Content outside of the above mentioned directories or restrictions above is available under the "MIT Expat" license as defined below.
Copyright (c) [2023] [PostHog]

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: build buildSdk buildExample format swiftLint swiftFormat test lint
.PHONY: build buildSdk buildExample format swiftLint swiftFormat test lint bootstrap

build: buildSdk buildExample

Expand All @@ -21,3 +21,9 @@ test:

lint:
swiftformat . --lint --swiftversion 5.3 && swiftlint

# requires gem and brew
bootstrap:
gem install xcpretty
brew install swiftlint
brew install swiftformat
18 changes: 9 additions & 9 deletions PostHog.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@
/* Begin PBXBuildFile section */
3A0F108329C47940002C0084 /* UIViewExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A0F108229C47940002C0084 /* UIViewExample.swift */; };
3A0F108529C9ABB6002C0084 /* ReadWriteLock.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A0F108429C9ABB6002C0084 /* ReadWriteLock.swift */; };
3A0F108729C9BD23002C0084 /* MethodSwizzler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A0F108629C9BD23002C0084 /* MethodSwizzler.swift */; };
3A0F108929C9BD76002C0084 /* Errors.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A0F108829C9BD76002C0084 /* Errors.swift */; };
3A2BCF4A299E2BDA008BB5F3 /* Swizzle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A2BCF49299E2BDA008BB5F3 /* Swizzle.swift */; };
3A2BCF4C299E4E35008BB5F3 /* QueueTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A2BCF4B299E4E35008BB5F3 /* QueueTest.swift */; };
3A2BCF52299F7724008BB5F3 /* CodableUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A2BCF51299F7724008BB5F3 /* CodableUtils.swift */; };
3A4F510D299A78E100B68D5E /* NSData+PHGGZIP.h in Headers */ = {isa = PBXBuildFile; fileRef = 3AE3FB3829924CE100AFFC18 /* NSData+PHGGZIP.h */; settings = {ATTRIBUTES = (Public, ); }; };
Expand Down Expand Up @@ -100,9 +98,7 @@
/* Begin PBXFileReference section */
3A0F108229C47940002C0084 /* UIViewExample.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIViewExample.swift; sourceTree = "<group>"; };
3A0F108429C9ABB6002C0084 /* ReadWriteLock.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReadWriteLock.swift; sourceTree = "<group>"; };
3A0F108629C9BD23002C0084 /* MethodSwizzler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MethodSwizzler.swift; sourceTree = "<group>"; };
3A0F108829C9BD76002C0084 /* Errors.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Errors.swift; sourceTree = "<group>"; };
3A2BCF49299E2BDA008BB5F3 /* Swizzle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Swizzle.swift; sourceTree = "<group>"; };
3A2BCF4B299E4E35008BB5F3 /* QueueTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = QueueTest.swift; sourceTree = "<group>"; };
3A2BCF51299F7724008BB5F3 /* CodableUtils.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CodableUtils.swift; sourceTree = "<group>"; };
3A580B4229E489D000C5C6F3 /* URLSession+body.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "URLSession+body.swift"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -230,10 +226,8 @@
3AE3FB3929924CE100AFFC18 /* NSData+PHGGZIP.m */,
3AE3FB422992985A00AFFC18 /* Reachability.swift */,
3AE3FB462992AB0000AFFC18 /* Hedgelog.swift */,
3A2BCF49299E2BDA008BB5F3 /* Swizzle.swift */,
3A2BCF51299F7724008BB5F3 /* CodableUtils.swift */,
3A0F108429C9ABB6002C0084 /* ReadWriteLock.swift */,
3A0F108629C9BD23002C0084 /* MethodSwizzler.swift */,
3A0F108829C9BD76002C0084 /* Errors.swift */,
);
path = Utils;
Expand Down Expand Up @@ -264,6 +258,7 @@
3AC745B7296D6FE60025C109 /* PostHog */ = {
isa = PBXGroup;
children = (
69779BED2AE6B29E00D7A48E /* Models */,
3AC745B8296D6FE60025C109 /* PostHog.h */,
3AA4C09B2988315D006C4731 /* Utils */,
3AE3FB36299162EA00AFFC18 /* PostHogApi.swift */,
Expand All @@ -274,7 +269,6 @@
3AE3FB48299391DF00AFFC18 /* PostHogStorage.swift */,
69261D122AD5685B00232EC7 /* PostHogFeatureFlags.swift */,
69261D182AD9673500232EC7 /* PostHogBatchUploadInfo.swift */,
69261D1A2AD9678C00232EC7 /* PostHogEvent.swift */,
69261D1C2AD967CD00232EC7 /* PostHogFileBackedQueue.swift */,
69261D1E2AD9681300232EC7 /* PostHogConsumerPayload.swift */,
69261D222AD9784200232EC7 /* PostHogVersion.swift */,
Expand Down Expand Up @@ -306,6 +300,14 @@
name = Frameworks;
sourceTree = "<group>";
};
69779BED2AE6B29E00D7A48E /* Models */ = {
isa = PBXGroup;
children = (
69261D1A2AD9678C00232EC7 /* PostHogEvent.swift */,
);
path = Models;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXHeadersBuildPhase section */
Expand Down Expand Up @@ -495,8 +497,6 @@
3AE3FB332991388500AFFC18 /* PostHogQueue.swift in Sources */,
3AE3FB3B29924CE100AFFC18 /* NSData+PHGGZIP.m in Sources */,
69261D1B2AD9678C00232EC7 /* PostHogEvent.swift in Sources */,
3A2BCF4A299E2BDA008BB5F3 /* Swizzle.swift in Sources */,
3A0F108729C9BD23002C0084 /* MethodSwizzler.swift in Sources */,
3AE3FB472992AB0000AFFC18 /* Hedgelog.swift in Sources */,
69261D132AD5685B00232EC7 /* PostHogFeatureFlags.swift in Sources */,
69261D1D2AD967CD00232EC7 /* PostHogFileBackedQueue.swift in Sources */,
Expand Down
File renamed without changes.
2 changes: 0 additions & 2 deletions PostHog/PostHogExtensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,5 @@ import Foundation

public extension PostHogSDK {
static let didStartNotification = Notification.Name("PostHogDidStart") // object: nil
static let didStartRecordingNotification = Notification.Name("PostHogDidStartRecording") // object: nil
static let didResetSessionNotification = Notification.Name("PostHogDidResetSession") // object: String
static let didReceiveFeatureFlags = Notification.Name("PostHogDidReceiveFeatureFlags") // object: nil
}
118 changes: 0 additions & 118 deletions PostHog/Utils/MethodSwizzler.swift

This file was deleted.

20 changes: 0 additions & 20 deletions PostHog/Utils/Swizzle.swift

This file was deleted.

13 changes: 13 additions & 0 deletions PostHogExample/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,20 @@ class AppDelegate: NSObject, UIApplicationDelegate {
// "iteration": iteration
// ])
// }

let defaultCenter = NotificationCenter.default

#if os(iOS) || os(tvOS)
defaultCenter.addObserver(self,
selector: #selector(self.receiveFeatureFlags),
name: PostHogSDK.didReceiveFeatureFlags,
object: nil)
#endif

return true
}

@objc func receiveFeatureFlags() {
print("receiveFeatureFlags")
}
}

0 comments on commit 74d8247

Please sign in to comment.