Skip to content

Commit

Permalink
chore(backend): support layout_snapshot attachments for gesture click
Browse files Browse the repository at this point in the history
  • Loading branch information
abhaysood committed Dec 8, 2024
1 parent af86156 commit 8ff9199
Show file tree
Hide file tree
Showing 52 changed files with 287,228 additions and 10,472 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ internal class LayoutSnapshot(private val nodes: List<Node>) {
* If a [targetNode] is provided, it will be highlighted in the visualization.
*
* @param targetNode Optional node to highlight in the SVG visualization
* @param width The width of the SVG to be generated.
* @param height The height of the SVG to be generated.
* @return An [Attachment] containing the SVG data with MIME type set to LAYOUT_SNAPSHOT
*/
fun generateSvgAttachment(targetNode: Node? = null, width: Int, height: Int): Attachment {
Expand Down
2 changes: 1 addition & 1 deletion android/sample/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@

<meta-data
android:name="sh.measure.android.API_KEY"
android:value="msrsh_014e789f898cfb0ddb03548b8a591eeedf22d63bdd178d6a412b3fb4a5e8d7f8_c2b4a820" />
android:value="msrsh_a1a9d99a7fd0729549f380d80a8c78098b0f6e143c57c81c0dff9758d5849685_ab7c6629" />
<meta-data
android:name="sh.measure.android.API_URL"
android:value="http://10.0.2.2:8080" />
Expand Down
2 changes: 1 addition & 1 deletion backend/api/event/attachment.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
)

// attachmentTypes is a list of all valid attachment types.
var attachmentTypes = []string{"screenshot", "android_method_trace"}
var attachmentTypes = []string{"screenshot", "android_method_trace", "layout_snapshot"}

type Attachment struct {
ID uuid.UUID `json:"id"`
Expand Down
3 changes: 3 additions & 0 deletions backend/api/measure/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -1717,6 +1717,9 @@ func (a *App) GetSessionEvents(ctx context.Context, sessionId uuid.UUID) (*Sessi
ev.GestureLongClick = &gestureLongClick
session.Events = append(session.Events, ev)
case event.TypeGestureClick:
if err := json.Unmarshal([]byte(attachments), &ev.Attachments); err != nil {
return nil, err
}
ev.GestureClick = &gestureClick
session.Events = append(session.Events, ev)
case event.TypeGestureScroll:
Expand Down
2 changes: 2 additions & 0 deletions backend/api/replay/gesture.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ type GestureClick struct {
X float32 `json:"x"`
Y float32 `json:"y"`
Timestamp time.Time `json:"timestamp"`
Attachments []event.Attachment `json:"attachments"`
}

// GetThreadName provides the name of the thread
Expand Down Expand Up @@ -102,6 +103,7 @@ func ComputeGestureClicks(events []event.EventField) (result []ThreadGrouper) {
event.GestureClick.X,
event.GestureClick.Y,
event.Timestamp,
event.Attachments,
}
result = append(result, gestureClicks)
}
Expand Down

This file was deleted.

Loading

0 comments on commit 8ff9199

Please sign in to comment.