twilio / twilio-video-app-ios

A collaboration application built with the Twilio Video iOS SDK
Apache License 2.0
246 stars 54 forks source link

Add stats screen back #192

Closed timrozum closed 2 years ago

timrozum commented 2 years ago

Provided a new way to access the stats screen.

I had to be strategic about this because StatsViewController is Objective-C, uses UIKit, and is doing a lot of things in one file.

This is how I handled it:

  1. Removed multiple complex UI gestures and instead used buttons to show and hide stats. This is easier for customers to discover and more consistent with the web app anyway.
  2. Removed quite a lot of code that referenced parentViewController. I didn't want to be doing tricky things when bridging to SwiftUI.
  3. Removed optimizations to pause stats collection when it is not visible. Stats will just always run now and I'm not aware of any issue with that. I didn't want to do any unnecessary coordination between SwiftUI and this complex old code.

I think we are lucky to get stats working again at all because the code is not very maintainable. We should do a complete rewrite sometime but it will take some reverse engineering.

Demo:

https://user-images.githubusercontent.com/1930363/158695781-70309018-121b-47dd-881c-d85bf6cf8203.mov

Landscape:

Simulator Screen Shot - iPhone 13 Pro - 2022-03-16 at 15 39 00