Skip to content
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

[CIS-363] Sample app improvements #549

Merged
merged 5 commits into from
Oct 14, 2020
Merged

Conversation

b-onc
Copy link
Contributor

@b-onc b-onc commented Oct 14, 2020

Question: should we also build sample app in iOS12?
Currently, Github Actions has Xcode11.7 as default. Default Xcode will be changed to Xcode 12.0 on October, 20, but we should still be fine.

@b-onc b-onc added the 🌐 SDK: StreamChat (LLC) Tasks related to the StreamChat LLC SDK label Oct 14, 2020
@codecov
Copy link

codecov bot commented Oct 14, 2020

Codecov Report

Merging #549 into main will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #549   +/-   ##
=======================================
  Coverage   88.59%   88.59%           
=======================================
  Files         155      155           
  Lines        5655     5655           
=======================================
  Hits         5010     5010           
  Misses        645      645           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f284589...076e070. Read the comment docs.

Copy link
Contributor

@VojtaStavik VojtaStavik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks! What was the fix in Sample app: fix logged assertion warnings about? I didn't get it from the commit.

]

if let user = users.randomElement() {
if let user = Configuration.TestUser.defaults.shuffled().first(where: { $0.id != userId }) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice trick 👍 I'd do filter { $0.id != userId}.randomElement() but yours is probably more efficient :)

@available(iOS 14, *)
struct ChatView: View {
/// The `ChannelController` used to interact with this channel. Will be synchronized in `onAppear`.
@StateObject var channel: ChatChannelController.ObservableObject
/// The `text` written in the message composer.
@State var text: String = ""
/// Binding for message actions and channel actions ActionSheet.
@State var actionSheetTrigger: Bool = false
/// Message being edited.
@State var editingMessage: ChatMessage?
import Combine
import StreamChatClient
import SwiftUI
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I don't think we need to intend code wrapped inside #if endif

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm, seems like formatter indented it, not me. I agree with you, let me check if I can disable that

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: should we also build sample app in iOS12?
I'd say yes just because we have so many #if checks in there :)

Fixed in 5e88f6b

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in f2b0892

Comment on lines 90 to 91
/// Protocol conformance needed for ActionSheet presenting.
extension ChatUser: Identifiable {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I already commented somewhere that this should live inside the SDK. Someone must have ignored it 🙃

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 63e1bca

@VojtaStavik
Copy link
Contributor

Question: should we also build sample app in iOS12?
I'd say yes just because we have so many #if checks in there :)

@b-onc
Copy link
Contributor Author

b-onc commented Oct 14, 2020

@VojtaStavik

What was the fix in Sample app: fix logged assertion warnings about? I didn't get it from the commit.

We were hiding the token cell in heightForRowAt by returning 0 as height, but to check if the cell was token cell, we were doing:

override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
        switch tableView.cellForRow(at: indexPath) {
        case jwtCell:
            return heightForJwtCell()
        default:
            return super.tableView(tableView, heightForRowAt: indexPath)
        }
    }

calling cellForRow(at:) inside heightForRowAt is illegal, so I refactored the logic for hiding the token cell. Now the animation is nicer too :)

@b-onc b-onc force-pushed the cis-363-sample-app-improvements branch from 16df8a3 to 5e88f6b Compare October 14, 2020 14:48
Comment on lines 127 to 129
/// Protocol conformance needed for ActionSheet presenting.
extension ChatUser: Identifiable {}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Think this should be in some iOS13 only user-related file like UserController+SwiftUI.swift
  • It should be public

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 04964ff
Doesn't need to be public since the original typealias is public

Bahadir Oncel added 5 commits October 14, 2020 18:28
Also mainlined how we're using test data/users
We're switching to SPM from Carthage since Carthage pre-building frameworks uses different swift versions for different Xcodes. Also refactored github actions to not use Carthage anymore for v3
@b-onc b-onc force-pushed the cis-363-sample-app-improvements branch from 04964ff to 076e070 Compare October 14, 2020 15:28
@b-onc b-onc merged commit 0ba953a into main Oct 14, 2020
@delete-merged-branch delete-merged-branch bot deleted the cis-363-sample-app-improvements branch October 14, 2020 15:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🌐 SDK: StreamChat (LLC) Tasks related to the StreamChat LLC SDK
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants