-
Notifications
You must be signed in to change notification settings - Fork 37
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
chore: support to session replay #123
Merged
Merged
Changes from all commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
eeb0279
feat(wip): support to session replay (#116)
thisames 25a73b6
formatting
marandaneto 5f9db55
changes
marandaneto 544cf78
fix api key
marandaneto 55abdac
fixes
marandaneto 46415a3
fix
marandaneto e62d1aa
check active
marandaneto 2c7a2c0
format kotlin
marandaneto 36cfc02
fix version
marandaneto 93d8668
fix version
marandaneto dff6915
fix linters
marandaneto cb5d74b
fixes
marandaneto 041cec0
fix
marandaneto d68cdbf
pr id
marandaneto 61cfa15
fix
marandaneto ffb7b8e
rename project structure
marandaneto 30978f7
fixes
marandaneto 000ad97
fix CI
marandaneto e0b2d03
fix
marandaneto e435c5d
fix
marandaneto 0eefb10
fix
marandaneto e5f74a3
fix
marandaneto 3d2caac
fix
marandaneto 70420da
fix
marandaneto 7c470a9
fix
marandaneto 9be2f9b
fix
marandaneto 7be7f19
fix
marandaneto edbe026
fix
marandaneto 9b90835
fix
marandaneto 65cae26
fix
marandaneto c7157e0
fix
marandaneto 3d3f9c1
fix
marandaneto 4cc4ef5
weakref fix
marandaneto e309fc5
fixes
marandaneto File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,21 @@ | ||
.PHONY: formatKotlin formatSwift formatDart | ||
.PHONY: formatKotlin formatSwift formatDart checkDart installLinters | ||
|
||
installLinters: | ||
brew install ktlint | ||
brew install swiftformat | ||
|
||
# brew install ktlint | ||
# TODO: add ktlint steps in CI | ||
formatKotlin: | ||
ktlint --format | ||
ktlint --format --baseline=ktlint-baseline.xml | ||
|
||
# brew install swiftlint | ||
# TODO: add swiftlint steps in CI | ||
# swiftlint ios/Classes --fix conflicts with swiftformat | ||
formatSwift: | ||
swiftformat ios/Classes --swiftversion 5.3 | ||
swiftlint ios/Classes --fix | ||
|
||
formatDart: | ||
dart format . | ||
|
||
checkFormatDart: | ||
dart format --set-exit-if-changed ./ | ||
|
||
analyzeDart: | ||
dart analyze . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,3 +9,4 @@ | |
.cxx | ||
|
||
/.settings | ||
.project |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.posthog.posthog_flutter"> | ||
package="com.posthog.flutter"> | ||
</manifest> |
2 changes: 1 addition & 1 deletion
2
...posthog/posthog_flutter/PostHogVersion.kt → ...lin/com/posthog/flutter/PostHogVersion.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
package com.posthog.posthog_flutter | ||
package com.posthog.flutter | ||
|
||
internal val postHogVersion = "4.6.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
android/src/main/kotlin/com/posthog/flutter/SnapshotSender.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
package com.posthog.flutter | ||
|
||
import android.graphics.BitmapFactory | ||
import com.posthog.android.internal.base64 | ||
import com.posthog.internal.replay.RREvent | ||
import com.posthog.internal.replay.RRFullSnapshotEvent | ||
import com.posthog.internal.replay.RRMetaEvent | ||
import com.posthog.internal.replay.RRStyle | ||
import com.posthog.internal.replay.RRWireframe | ||
import com.posthog.internal.replay.capture | ||
|
||
class SnapshotSender { | ||
fun sendFullSnapshot( | ||
imageBytes: ByteArray, | ||
id: Int, | ||
x: Int, | ||
y: Int, | ||
) { | ||
val bitmap = BitmapFactory.decodeByteArray(imageBytes, 0, imageBytes.size) | ||
val base64String = bitmap.base64() | ||
|
||
val wireframe = | ||
RRWireframe( | ||
id = id, | ||
x = x, | ||
y = y, | ||
width = bitmap.width, | ||
height = bitmap.height, | ||
type = "screenshot", | ||
base64 = base64String, | ||
style = RRStyle(), | ||
) | ||
|
||
val snapshotEvent = | ||
RRFullSnapshotEvent( | ||
listOf(wireframe), | ||
initialOffsetTop = 0, | ||
initialOffsetLeft = 0, | ||
timestamp = System.currentTimeMillis(), | ||
) | ||
|
||
listOf(snapshotEvent).capture() | ||
} | ||
|
||
fun sendMetaEvent( | ||
width: Int, | ||
height: Int, | ||
screen: String, | ||
) { | ||
val metaEvent = | ||
RRMetaEvent( | ||
href = screen, | ||
width = width, | ||
height = height, | ||
timestamp = System.currentTimeMillis(), | ||
) | ||
|
||
val events = mutableListOf<RREvent>() | ||
events.add(metaEvent) | ||
|
||
events.capture() | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...sthog_flutter/PosthogFlutterPluginTest.kt → ...sthog/flutter/PosthogFlutterPluginTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...e/posthog_flutter_example/MainActivity.kt → ...otlin/com/example/flutter/MainActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
org.gradle.jvmargs=-Xmx4G | ||
android.useAndroidX=true | ||
android.suppressUnsupportedCompileSdk=34 | ||
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
import UIKit | ||
import Flutter | ||
|
||
@UIApplicationMain | ||
@main | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is new but its the sample so its ok |
||
@objc class AppDelegate: FlutterAppDelegate { | ||
override func application( | ||
_ application: UIApplication, | ||
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
needed for latest versions and we want to keep back compatibility so not bumping the sample