-
Notifications
You must be signed in to change notification settings - Fork 124
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
RUMM-2507 Create an ApplicationLaunch view during session initialization #1160
Changes from 6 commits
0eca578
727fd54
34cfc1e
add1dae
40e29cf
0fbf63d
a75a83c
f1fd808
125b1f6
1ab7b2e
dc406a4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -149,14 +149,28 @@ internal class RUMViewScope: RUMScope, RUMContextProvider { | |||||||||||||||
// Propagate to User Action scope | ||||||||||||||||
userActionScope = userActionScope?.scope(byPropagating: command, context: context, writer: writer) | ||||||||||||||||
|
||||||||||||||||
// Send "application start" action if this is the very first view tracked in the app | ||||||||||||||||
let hasSentNoViewUpdatesYet = version == 0 | ||||||||||||||||
if isInitialView, hasSentNoViewUpdatesYet { | ||||||||||||||||
sendApplicationStartAction(context: context, writer: writer) | ||||||||||||||||
needsViewUpdate = true | ||||||||||||||||
} | ||||||||||||||||
|
||||||||||||||||
// Apply side effects | ||||||||||||||||
switch command { | ||||||||||||||||
// Application Launch | ||||||||||||||||
case is RUMApplicationStartCommand: | ||||||||||||||||
sendApplicationStartAction(context: context, writer: writer) | ||||||||||||||||
if !isInitialView || viewPath != RUMOffViewEventsHandlingRule.Constants.applicationLaunchViewURL { | ||||||||||||||||
DD.telemetry.error( | ||||||||||||||||
id: "application-start-error", | ||||||||||||||||
message: "An RUMApplicationStartCommand got sent to something other than the ApplicationLaunch view.", | ||||||||||||||||
kind: nil, | ||||||||||||||||
stack: nil | ||||||||||||||||
) | ||||||||||||||||
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. /nit You can use other signature available
Suggested change
The 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. Maybe we can add the command type as part of the message, I'm afraid |
||||||||||||||||
} | ||||||||||||||||
// Application Launch also serves as a StartView command for this view | ||||||||||||||||
didReceiveStartCommand = true | ||||||||||||||||
needsViewUpdate = true | ||||||||||||||||
|
||||||||||||||||
// View commands | ||||||||||||||||
case let command as RUMStartViewCommand where identity.equals(command.identity): | ||||||||||||||||
if didReceiveStartCommand { | ||||||||||||||||
|
@@ -346,9 +360,9 @@ internal class RUMViewScope: RUMScope, RUMContextProvider { | |||||||||||||||
// a RUM view on `SwiftUI.View/onAppear`. | ||||||||||||||||
// | ||||||||||||||||
// In that case, we consider the time between the application | ||||||||||||||||
// launch and the first view start as the application loading | ||||||||||||||||
// launch and the sdkInitialization as the application loading | ||||||||||||||||
// time. | ||||||||||||||||
loadingTime = viewStartTime.timeIntervalSince(launchDate).toInt64Nanoseconds | ||||||||||||||||
loadingTime = context.sdkInitDate.timeIntervalSince(launchDate).toInt64Nanoseconds | ||||||||||||||||
} | ||||||||||||||||
|
||||||||||||||||
let actionEvent = RUMActionEvent( | ||||||||||||||||
|
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.
It rather seems we're starting initial session (along with the
ApplicationLaunch
view) on first command received byRUMApplicationScope
. It looks different than what we say in PR description (and what we want):No? If that is true, it would make more sense to just send the new command right after application scope init, somewhere here.
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.
Ah, I think I get it - we always do it (start the AL view), it is just that we await for any other command to do it. Makes sense - if the app starts idle and nothing happens, no session will be started 👍.
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.
That was my thought yes. It also made things a little bit cleaner as I could just use the context / writer as part of the command I was already recieving.