feat(backend): fixed an issue with no mobile replays for android tracker

This commit is contained in:
Alexander 2024-04-05 17:00:45 +02:00
parent 54156fc81d
commit daddedebcc
4 changed files with 7 additions and 4 deletions

View file

@ -169,7 +169,7 @@ func main() {
}
}
}
if sess != nil && sess.Platform == "ios" {
if sess != nil && (sess.Platform == "ios" || sess.Platform == "android") {
msg := &messages.IOSSessionEnd{Timestamp: timestamp}
if err := producer.Produce(cfg.TopicRawIOS, sessionID, msg.Encode()); err != nil {
log.Error(sessCtx, "can't send iOSSessionEnd to mobile topic: %s", err)

View file

@ -58,7 +58,7 @@ func main() {
}
return msg, nil
}
sessCtx := context.WithValue(context.Background(), "sessionID", sessID)
sessCtx := context.WithValue(context.Background(), "sessionID", fmt.Sprintf("%d", sessID))
if _, err := checkSessionEnd(data); err == nil {
if err := srv.PackScreenshots(sessCtx, sessID, workDir+"/screenshots/"+strconv.FormatUint(sessID, 10)+"/"); err != nil {

View file

@ -105,8 +105,9 @@ func (e *Router) startSessionHandlerIOS(w http.ResponseWriter, r *http.Request)
r = r.WithContext(context.WithValue(r.Context(), "sessionID", fmt.Sprintf("%d", sessionID)))
geoInfo := e.ExtractGeoData(r)
platform, os, screen := "ios", "IOS", ""
deviceType, platform, os, screen := ios.GetIOSDeviceType(req.UserDevice), "ios", "IOS", ""
if req.Platform != "" && req.Platform != "ios" {
deviceType = req.UserDeviceType
platform = req.Platform
os = "Android"
screen = fmt.Sprintf("%d:%d", req.Width, req.Height)
@ -126,7 +127,7 @@ func (e *Router) startSessionHandlerIOS(w http.ResponseWriter, r *http.Request)
UserOS: os,
UserOSVersion: req.UserOSVersion,
UserDevice: ios.MapIOSDevice(req.UserDevice),
UserDeviceType: ios.GetIOSDeviceType(req.UserDevice),
UserDeviceType: deviceType,
UserCountry: geoInfo.Country,
UserState: geoInfo.State,
UserCity: geoInfo.City,
@ -168,6 +169,7 @@ func (e *Router) startSessionHandlerIOS(w http.ResponseWriter, r *http.Request)
func (e *Router) pushMessagesHandlerIOS(w http.ResponseWriter, r *http.Request) {
startTime := time.Now()
sessionData, err := e.services.Tokenizer.ParseFromHTTPRequest(r)
if sessionData != nil {
r = r.WithContext(context.WithValue(r.Context(), "sessionID", fmt.Sprintf("%d", sessionData.ID)))

View file

@ -54,6 +54,7 @@ type StartMobileSessionRequest struct {
UserUUID *string `json:"userUUID"`
UserOSVersion string `json:"userOSVersion"`
UserDevice string `json:"userDevice"`
UserDeviceType string `json:"userDeviceType"`
Timestamp uint64 `json:"timestamp"`
Timezone string `json:"timezone"`
DeviceMemory uint64 `json:"deviceMemory"`