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

feat(autocapture): auto capture element interactions #224

Merged
merged 31 commits into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
dc2a112
feat: add PostHogExampleAutocapture sample project
ioannisj Oct 17, 2024
26b97af
feat: add base autocapture integration
ioannisj Oct 17, 2024
8b1406f
feat(autocapture): process captured events
ioannisj Oct 23, 2024
3a0b5f6
feat(autocapture): add support for debouncing events for
ioannisj Oct 23, 2024
045f07c
feat(autocapture): update CHANGELOG.md
ioannisj Oct 24, 2024
d2eefda
feat(autocapture): add support for UIScrollView
ioannisj Oct 24, 2024
110835b
feat(autocapture): add support for UISwitch
ioannisj Oct 24, 2024
b16b265
feat(autocapture): add support for UIPickerView
ioannisj Oct 24, 2024
4b32319
feat(autocapture): add autocapture configuration
ioannisj Oct 25, 2024
d3d687d
feat(autocapture): fix UITextField sample
ioannisj Oct 25, 2024
f2857d1
feat(autocapture): fix support for UITextField
ioannisj Oct 25, 2024
9995435
fix(autocapture): replace with hedgelog
ioannisj Oct 30, 2024
3770e24
feat(autocapture): sanitize text similar to js sdk
ioannisj Oct 30, 2024
eebccf4
fix(autocapture): revert view controller name
ioannisj Oct 30, 2024
3c67b79
refactor(autocapture): route events to shared instance
ioannisj Oct 30, 2024
ef22d11
feat(autocapture): skip sensitive inputs and ph-no-capture
ioannisj Oct 30, 2024
4997575
fix(autocapture): invalidate and clear debounce timers on stop
ioannisj Oct 30, 2024
b14c5da
feat(tests): add unit tests
ioannisj Oct 31, 2024
6b4ff59
chore: format and lint
ioannisj Oct 31, 2024
52f16ba
Merge branch 'main' into feat/auto-capture-element-interactions
ioannisj Oct 31, 2024
0d19fce
chore(autocapture): lint file name
ioannisj Nov 1, 2024
1113c69
ci(test): run iOS tests
ioannisj Nov 1, 2024
56bbdc9
ci(tests): run on latest iOS version available
ioannisj Nov 1, 2024
b705fdc
ci(test): revert iOS tests
ioannisj Nov 1, 2024
cf70679
Merge branch 'main' into feat/auto-capture-element-interactions
ioannisj Nov 5, 2024
e04ec68
feat(autocapture): simplify configuration options
ioannisj Nov 7, 2024
35d7bfb
fix: lint
ioannisj Nov 7, 2024
333f170
Merge branch 'main' into feat/auto-capture-element-interactions
ioannisj Nov 7, 2024
02119ed
chore: revert new formats
ioannisj Nov 8, 2024
2c3574d
chore: revert workflow changes
ioannisj Nov 8, 2024
d5ca9e6
Merge branch 'main' into feat/auto-capture-element-interactions
ioannisj Nov 8, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ jobs:
with:
xcode-version: latest-stable
- name: Test SDK
run: make test
run: make test
6 changes: 6 additions & 0 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
excluded: # case-sensitive paths to ignore during linting. Takes precedence over `included`
- PostHogExample
- PostHogExampleWithSPM
- PostHogExampleAutocapture
- PostHogTests
- PostHog/Utils/ReadWriteLock.swift
- PostHog/Utils/Reachability.swift
Expand All @@ -19,6 +20,11 @@ file_length:
warning: 1000
error: 1200

identifier_name:
excluded:
- id
- ^ph_.*$

function_body_length:
- 1000 # warning
- 1200 # error
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
## Next

- add autocapture support for UIKit ([#224](https://github.com/PostHog/posthog-ios/pull/224))

## 3.14.2 - 2024-11-08

- fix issue with resetting accent color in SwiftUI app ([#238](https://github.com/PostHog/posthog-ios/pull/238))
Expand Down
60 changes: 60 additions & 0 deletions PostHog.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,12 @@
69F5181A2BAC81FC00F52C14 /* UITextInputTraits+Util.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69F518192BAC81FC00F52C14 /* UITextInputTraits+Util.swift */; };
69F518382BB2BA0100F52C14 /* PostHogSwizzler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69F518372BB2BA0100F52C14 /* PostHogSwizzler.swift */; };
69F5183A2BB2BA8300F52C14 /* UIApplicationTracker.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69F518392BB2BA8300F52C14 /* UIApplicationTracker.swift */; };
DA26419C2CC0499300CB427B /* PostHogAutocaptureEventTracker.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA26419A2CC0499300CB427B /* PostHogAutocaptureEventTracker.swift */; };
DA5B85882CD21CBB00686389 /* AutocaptureEventProcessing.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA5B85872CD21CBB00686389 /* AutocaptureEventProcessing.swift */; };
DA979D7B2CD370B700F56BAE /* PostHogAutocaptureEventTrackerSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA979D7A2CD370B700F56BAE /* PostHogAutocaptureEventTrackerSpec.swift */; };
DAC699D62CC790D9000D1D6B /* PostHogAutocaptureIntegration.swift in Sources */ = {isa = PBXBuildFile; fileRef = DAC699D52CC790D9000D1D6B /* PostHogAutocaptureIntegration.swift */; };
DAC699EC2CCA73E5000D1D6B /* ForwardingPickerViewDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = DAC699EB2CCA73E5000D1D6B /* ForwardingPickerViewDelegate.swift */; };
DACF6D5D2CD2F5BC00F14133 /* PostHogAutocaptureIntegrationSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = DACF6D5C2CD2F5BC00F14133 /* PostHogAutocaptureIntegrationSpec.swift */; };
DAD5DD0C2CB6DEF30087387B /* PostHogMaskViewModifier.swift in Sources */ = {isa = PBXBuildFile; fileRef = DAD5DD072CB6DEE70087387B /* PostHogMaskViewModifier.swift */; };
/* End PBXBuildFile section */

Expand Down Expand Up @@ -200,6 +206,13 @@
remoteGlobalIDString = 3AC745B4296D6FE60025C109;
remoteInfo = PostHog;
};
DA8D37282CBEAC03005EBD27 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = DA8D37242CBEAC02005EBD27 /* PostHogExampleAutocapture.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 228DB9F318BC53F1002BA12A;
remoteInfo = PostHogExampleAutocapture;
};
/* End PBXContainerItemProxy section */

/* Begin PBXCopyFilesBuildPhase section */
Expand Down Expand Up @@ -376,6 +389,13 @@
69F518192BAC81FC00F52C14 /* UITextInputTraits+Util.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UITextInputTraits+Util.swift"; sourceTree = "<group>"; };
69F518372BB2BA0100F52C14 /* PostHogSwizzler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PostHogSwizzler.swift; sourceTree = "<group>"; };
69F518392BB2BA8300F52C14 /* UIApplicationTracker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIApplicationTracker.swift; sourceTree = "<group>"; };
DA26419A2CC0499300CB427B /* PostHogAutocaptureEventTracker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PostHogAutocaptureEventTracker.swift; sourceTree = "<group>"; };
DA5B85872CD21CBB00686389 /* AutocaptureEventProcessing.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AutocaptureEventProcessing.swift; sourceTree = "<group>"; };
DA8D37242CBEAC02005EBD27 /* PostHogExampleAutocapture.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = PostHogExampleAutocapture.xcodeproj; path = PostHogExampleAutocapture/PostHogExampleAutocapture.xcodeproj; sourceTree = "<group>"; };
DA979D7A2CD370B700F56BAE /* PostHogAutocaptureEventTrackerSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PostHogAutocaptureEventTrackerSpec.swift; sourceTree = "<group>"; };
DAC699D52CC790D9000D1D6B /* PostHogAutocaptureIntegration.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PostHogAutocaptureIntegration.swift; sourceTree = "<group>"; };
DAC699EB2CCA73E5000D1D6B /* ForwardingPickerViewDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ForwardingPickerViewDelegate.swift; sourceTree = "<group>"; };
DACF6D5C2CD2F5BC00F14133 /* PostHogAutocaptureIntegrationSpec.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PostHogAutocaptureIntegrationSpec.swift; sourceTree = "<group>"; };
DAD5DD072CB6DEE70087387B /* PostHogMaskViewModifier.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PostHogMaskViewModifier.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

Expand Down Expand Up @@ -503,6 +523,7 @@
3AC745AB296D6FE60025C109 = {
isa = PBXGroup;
children = (
DA8D37242CBEAC02005EBD27 /* PostHogExampleAutocapture.xcodeproj */,
690FF1732AF3CE8A00A0B06B /* PostHogExampleWatchOS.xcodeproj */,
690FF0532AE7DB3700A0B06B /* PostHogExampleWithSPM.xcodeproj */,
690FF02F2AE7C5BA00A0B06B /* PostHogExampleWithPods.xcodeproj */,
Expand Down Expand Up @@ -536,6 +557,7 @@
3AC745B7296D6FE60025C109 /* PostHog */ = {
isa = PBXGroup;
children = (
DA26419B2CC0499300CB427B /* Autocapture */,
69EE82B82BA9C4DA00EB9542 /* Replay */,
69BA38E62B893F2200AA69D6 /* Resources */,
69779BED2AE6B29E00D7A48E /* Models */,
Expand Down Expand Up @@ -579,6 +601,8 @@
690FF0E22AEFD12900A0B06B /* PostHogConfigTest.swift */,
690FF0E82AEFD3BD00A0B06B /* PostHogQueueTest.swift */,
690FF0F42AF0F06100A0B06B /* PostHogSDKTest.swift */,
DACF6D5C2CD2F5BC00F14133 /* PostHogAutocaptureIntegrationSpec.swift */,
DA979D7A2CD370B700F56BAE /* PostHogAutocaptureEventTrackerSpec.swift */,
699C5FEE2C20242A007DB818 /* UUIDTest.swift */,
693E977C2C6257F9004B1030 /* ExampleSanitizer.swift */,
69ED1AB52C90711D00FE7A91 /* PostHogSDKPersonProfilesTest.swift */,
Expand Down Expand Up @@ -733,6 +757,25 @@
path = PostHogExampleStoryboard;
sourceTree = "<group>";
};
DA26419B2CC0499300CB427B /* Autocapture */ = {
isa = PBXGroup;
children = (
DA5B85872CD21CBB00686389 /* AutocaptureEventProcessing.swift */,
DAC699EB2CCA73E5000D1D6B /* ForwardingPickerViewDelegate.swift */,
DAC699D52CC790D9000D1D6B /* PostHogAutocaptureIntegration.swift */,
DA26419A2CC0499300CB427B /* PostHogAutocaptureEventTracker.swift */,
);
path = Autocapture;
sourceTree = "<group>";
};
DA8D37252CBEAC02005EBD27 /* Products */ = {
isa = PBXGroup;
children = (
DA8D37292CBEAC03005EBD27 /* PostHogExampleAutocapture.app */,
);
name = Products;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXHeadersBuildPhase section */
Expand Down Expand Up @@ -939,6 +982,10 @@
productRefGroup = 3AC745B6296D6FE60025C109 /* Products */;
projectDirPath = "";
projectReferences = (
{
ProductGroup = DA8D37252CBEAC02005EBD27 /* Products */;
ProjectRef = DA8D37242CBEAC02005EBD27 /* PostHogExampleAutocapture.xcodeproj */;
},
{
ProductGroup = 690FF1742AF3CE8A00A0B06B /* Products */;
ProjectRef = 690FF1732AF3CE8A00A0B06B /* PostHogExampleWatchOS.xcodeproj */;
Expand Down Expand Up @@ -994,6 +1041,13 @@
remoteRef = 690FF17A2AF3CE8B00A0B06B /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
DA8D37292CBEAC03005EBD27 /* PostHogExampleAutocapture.app */ = {
isa = PBXReferenceProxy;
fileType = wrapper.application;
path = PostHogExampleAutocapture.app;
remoteRef = DA8D37282CBEAC03005EBD27 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
/* End PBXReferenceProxy section */

/* Begin PBXResourcesBuildPhase section */
Expand Down Expand Up @@ -1093,10 +1147,14 @@
69779BEC2AE68E6900D7A48E /* UIViewController.swift in Sources */,
3A0F108929C9BD76002C0084 /* Errors.swift in Sources */,
3AE3FB37299162EA00AFFC18 /* PostHogApi.swift in Sources */,
DAC699D62CC790D9000D1D6B /* PostHogAutocaptureIntegration.swift in Sources */,
6926DA8E2ADD2876005760D2 /* PostHogContext.swift in Sources */,
690FF0AF2AEB9C1400A0B06B /* DateUtils.swift in Sources */,
69F518162BAC7F9200F52C14 /* UIView+Util.swift in Sources */,
69261D192AD9673500232EC7 /* PostHogBatchUploadInfo.swift in Sources */,
DAC699EC2CCA73E5000D1D6B /* ForwardingPickerViewDelegate.swift in Sources */,
DA26419C2CC0499300CB427B /* PostHogAutocaptureEventTracker.swift in Sources */,
DA5B85882CD21CBB00686389 /* AutocaptureEventProcessing.swift in Sources */,
69ED1A5C2C7F15F300FE7A91 /* PostHogSessionManager.swift in Sources */,
69F23A742BB3088E001194F6 /* URLSessionSwizzler.swift in Sources */,
69F518142BAC7F4300F52C14 /* Date+Util.swift in Sources */,
Expand Down Expand Up @@ -1136,8 +1194,10 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
DA979D7B2CD370B700F56BAE /* PostHogAutocaptureEventTrackerSpec.swift in Sources */,
690FF0F52AF0F06100A0B06B /* PostHogSDKTest.swift in Sources */,
690FF0E12AEFC59100A0B06B /* PostHogFileBackedQueueTest.swift in Sources */,
DACF6D5D2CD2F5BC00F14133 /* PostHogAutocaptureIntegrationSpec.swift in Sources */,
3A62647529CB0168007E8C07 /* TestPostHog.swift in Sources */,
699C5FEF2C20242A007DB818 /* UUIDTest.swift in Sources */,
69ED1AB62C90711D00FE7A91 /* PostHogSDKPersonProfilesTest.swift in Sources */,
Expand Down
14 changes: 14 additions & 0 deletions PostHog/Autocapture/AutocaptureEventProcessing.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//
// AutocaptureEventProcessing.swift
// PostHog
//
// Created by Yiannis Josephides on 30/10/2024.
//

#if os(iOS) || targetEnvironment(macCatalyst)
import Foundation

protocol AutocaptureEventProcessing: AnyObject {
func process(source: PostHogAutocaptureEventTracker.EventSource, event: PostHogAutocaptureEventTracker.EventData)
}
#endif
Loading
Loading