Automattic / Automattic-Tracks-iOS

Client library for tracking user events for later analysis
GNU General Public License v2.0
40 stars 12 forks source link

Remove deprecated `statusBarFrame` usages #273

Closed mokagio closed 4 months ago

mokagio commented 7 months ago

The 3.1.0 CI deployment failed because of deprecation warnings:

- WARN  \| xcodebuild:  /opt/ci/builds/builder/automattic/tracks-ios/Sources/Model/ObjC/Common/TracksDeviceInformation.m:177:48:
  warning: 'statusBarFrame' is deprecated: first deprecated in iOS 13.0
    - Use the statusBarManager property of the window scene instead. [-Wdeprecated-declarations]

We could work around this by passing --allow-warnings to the pod validation command via our CI plugin, but I think it's best we remain strict in our validation and address this deprecation. It's deprecated for a reason, after all.

It should be straightforward to update the code to use the new recommended syntax (see StackOverflow, for example).

crazytonyli commented 6 months ago

This statusBarFrame is used to track status bar height. But is that information really useful to us? If it's not, can we just delete it?

There is also another similar deprecated API usage: statusBarOrientation. It's used to track device orientation. I think this information can be useful. But I think it's more appropriate to use UIDevice.orientation instead.

bjhomer commented 4 months ago

Another problem: both of these APIs can only accessed on the main thread. This means that every Tracks call from a non-main thread is making a blocking call to the main thread to fetch the status bar frame.

If nobody's using this information, I'd agree with removing it.