neilalexander / seaglass

A truly native Matrix client for macOS - written in Swift/Cocoa, with E2E encryption support
Other
529 stars 34 forks source link

Update SwiftMatrixSDK to v0.11.6 #134

Closed MattHardcastle closed 2 years ago

MattHardcastle commented 4 years ago

I popped into the chat a couple weeks and mentioned I wanted to help a little. Brining the MatrixSDK up to date was one of the tasks mentioned. This change doesn't bring it completely up to date but it's a step closer.


The SwiftMatrixSDK developers have documented all the breaking changes between v0.10 and v0.11 of SwiftMatrixSDK in the release notes for v0.11.0. Those notes are available on GitHub at the following address https://github.com/matrix-org/matrix-ios-sdk/releases/tag/v0.11.0

Only two of them appear to impact Seaglass, so I'm summarizing those here:

1) MXRoom: liveTimeline and state accesses are now asynchronous.

Most of the changes to support this involved wrapping the code that accessed the async property in a closure. There were a few places that required further rework, like adding state as an initialize to an object or a parameter to a method so they could be available when the method returned.

2) MXRoomState: Create an MXRoomMembers property. All members getter methods has been to the new class.

The MXRoomState changes to the member class required adding an extra .members in a few places to get access to the members array that used to be directly on MXRoomState but is not in the MXRoomMembers property on MXRoomState.

aaronraimist commented 4 years ago

I'm guessing this is because CircleCI is set to build with Xcode 10.2.1 https://github.com/neilalexander/seaglass/blob/master/.circleci/config.yml#L5 which comes with an old version of Cocoapods. Changing this line to Xcode 11.3.1 would likely fix the issue.

aaronraimist commented 4 years ago

Yep so that fixed that. That just leaves the AVAudioSession issue. How did you build it on your computer and avoid that problem?

MattHardcastle commented 4 years ago

I removed those AVClient lines from the headers in the CocoaPods portion of the XCode Project to get it to build. I recall getting the same AVAudioSession issues before upgrading the client and thinking, "the CI system must just handle this." Now it's pretty clear these errors are related to the xCode upgrade.

I believe I need to add a flag around those AVAudioSession objects in SwiftMatrixSDK to resolve this issue. CocoaPods doesn't support patching a library, so a fork is the only option.

My current plan is to Fork SwiftMatrixSDK, remove those unsupported objects on macOS using a compile-time flag, and then finish upgrading to the latest SwiftMatrixSDK. Also, attempt to get the compile-time flag change from my fork back into the SwiftMatrixSDK mainline.

This upgrade branch has a lot of changes. I was hoping to stage each version bump to master to avoid a massive PR, but understand the project maintainer may be reluctant to merge a PR that uses "some guys" fork of SwiftMatrixSDK.

That's my plan. Please stop me if sounds crazy to you.

aaronraimist commented 4 years ago

As of v0.15.2 it looks like they CI the SDK on macOS as well and have removed those places where AVAudioSession is used when it it is being built for macOS https://github.com/matrix-org/matrix-ios-sdk/commit/39c560bc12ba9bfcfb873c2e00ba2c278f5ebbd2.

I think your plan sounds fine to make a fork (as long as it is open source and easy to see that the only change is an #if and an #endif) until we get caught back up with the current release.

MattHardcastle commented 4 years ago

Thanks for digging up that commit, @aaronraimist . I cherry-picked it onto a branch based on the v0.11.6 tag in my fork of matrix-ios-sdk. It cleared up the build issue.

michaelsmoody commented 4 years ago

I'm curious if we'll be merging this into a new release of Seaglass in the near future? (Thank you for Seaglass, it's the most beautiful Matrix client on macOS, but does need this and other updates).

EDIT: Upstream has also added macOS as a target.

neilalexander commented 4 years ago

I'm curious if we'll be merging this into a new release of Seaglass in the near future? (Thank you for Seaglass, it's the most beautiful Matrix client on macOS, but does need this and other updates).

Yes, I plan to merge it. I will try and make some time to look at this more closely.