-
Notifications
You must be signed in to change notification settings - Fork 12
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
Add event logging upload #127
Conversation
Improve documentation and error handling . Remove extras Revert CrashLogging changes Don’t make the internal explicit Tiny fixes Fix docs
155f5b1
to
7dafc39
Compare
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.
@jkmassel My iOS chops are not up to par, so I have a bunch of questions with some of them being possibly stupid. I wanted to get @shiki to review my comments, but he said he was swamped this week. So if anything doesn't make sense to either one of us, we can do a rain dance and conjure him for help.
I skipped reviewing the tests now so I can do them separately once the implementation is all figured out. I hope that's OK with you.
Please let me know if you have any questions.
Automattic-Tracks-iOS/Services/EventLoggingNetworkService.swift
Outdated
Show resolved
Hide resolved
Automattic-Tracks-iOS/Services/EventLoggingNetworkService.swift
Outdated
Show resolved
Hide resolved
Automattic-Tracks-iOS/Services/EventLoggingNetworkService.swift
Outdated
Show resolved
Hide resolved
Automattic-Tracks-iOS/Event Logging/EventLoggingUploadManager.swift
Outdated
Show resolved
Hide resolved
Automattic-Tracks-iOS/Event Logging/EventLoggingUploadManager.swift
Outdated
Show resolved
Hide resolved
Automattic-Tracks-iOS/Event Logging/EventLoggingUploadManager.swift
Outdated
Show resolved
Hide resolved
09af253
to
4435485
Compare
4435485
to
6b135c5
Compare
We can’t guarantee it _won’t_ need to be translated.
Reworks EventLoggingUploadQueue to allow additional customization without subclassing.
1c3b452
to
810b5c9
Compare
Simplifies setup for this class by providing a dataSource and delegate at initialization
Reworks the EventLoggingUploadQueue to avoid exposing file parsing bits. Adds a test to cover the changes
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.
Hey! Sorry for the delay on this. I was able to do a quick look. @oguzkocer had some really great feedback that helped improve the code. So, I just have some tiny suggestions and comments.
It'd also be great if we can add comments to the public symbols like EventLoggingDataSource
and EventLoggingDelegate
. Comments like how they all connect together or how they should be used would be great. I suppose this could be in future iterations.
Automattic-Tracks-iOS/Event Logging/EventLoggingUploadManager.swift
Outdated
Show resolved
Hide resolved
Automattic-Tracks-iOS/Event Logging/EventLoggingUploadManager.swift
Outdated
Show resolved
Hide resolved
Automattic-Tracks-iOS/Event Logging/EventLoggingUploadManager.swift
Outdated
Show resolved
Hide resolved
Automattic-Tracks-iOSTests/Tests/Event Logging/EventLoggingNetworkServiceTests.swift
Show resolved
Hide resolved
The RW style guide suggests it this way: https://github.com/raywenderlich/swift-style-guide/#constants
I agree – I'll do this as part of the next PR – the instructions on how to use them make more sense in the context of the wrapper class for this functionality, so I think it'd be hard to review 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.
Looking good. I'm letting @oguzkocer have the final say since he's the lead reviewer. 🙂
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.
@jkmassel The implementation part of this PR turned out really well, thanks for taking the time to polish things up!
I left some non-blocking comments for the tests with some examples of how I like to write these type of tests hoping that you find it useful. Feel free to cherry pick them, implement them yourself, merge add/event-logging-upload-pr-suggestions
branch which contains all 3 commits or completely ignore them and merge this PR as is. :)
typealias LogFileCallback = (LogFile) -> () | ||
typealias ErrorWithLogFileCallback = (Error, LogFile) -> () | ||
|
||
enum MockError: Error { |
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.
Should we use a more specific name for the file? Since I can't comment on the file itself, I am adding it here.
case generic | ||
} | ||
|
||
class MockEventLoggingDataSource: EventLoggingDataSource { |
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.
I think the way this class is written is totally fine for tests, but here is how I would have written it myself: 8723261.
The idea is to promote immutability and control how this class can be used. It has 0 value in this PR in practice, but I thought I'd take the time to mention this in a couple places in this PR for future reference, only if you find it useful of course.
} | ||
} | ||
|
||
class MockEventLoggingDelegate: EventLoggingDelegate { |
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.
Very similar to my last comment, here is how I'd have written this class: c3debf1
import XCTest | ||
@testable import AutomatticTracks | ||
|
||
class EventLoggingUploadManagerTests: XCTestCase { |
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.
In my previous PR review I tried to explain my thought process for property usage, but it was hard to do so without examples, so I took the time to create one for this PR: f7d87b2.
Similar to my previous PRs it doesn't have much value in tests, but I hope that it'll at least present a good example of how to work with immutability in tests.
There are a couple other files with very minor possible improvements similar to these, but I am leaving these because it's much of the same thing and mentioning these from here after won't have any example value either.
@oguzkocer – I like the immutability suggestions for the tests – want to open another PR for those changes, and I can approve that one? |
@jkmassel Looks like |
Adds support for uploading encrypted logs.
Assigned to both @oguzkocer and @shiki, though either (or both) can approve and provide comments as desired.
In the scope of review, I'd love if you're able to comment specifically on whether:
EventLoggingUploadManager
seems reasonable. Not providing a delegate and a dataSource is a programmer error, so I used these to avoid a bunch of runtime error handling code that should never be called anyway.To Test: