Conversation
| import Lucide | ||
| import Combine | ||
|
|
||
| public struct UserProfileModel: View { |
| case (.some(let sessionId), .none): | ||
| return ("accountId".localized(), sessionId) | ||
| case (.some(let sessionId), .some(_)): | ||
| return ("accountId".localized(), sessionId.splitIntoLines(charactersForLines: [23, 23, 20])) |
There was a problem hiding this comment.
I can't remember what the resolution was but I think Thomas mentioned that could be a problem if we (eventually) support dynamic font sizes - ie. is this going to break if a use increases the size to the max?
There was a problem hiding this comment.
Yeah, this is not the perfect design rules as the screen width can change and the font on iOS can have different character width than the design file. Normally we should make it wrap naturally, but I checked the chat history on this and we eventually agreed on applying the rules and using it as a "hope for the best" approach.
There are other rules like 33-33 I couldn't apply because it is already broken on normal iPhone 16 screen. If I have to argue, I'll say we shouldn't have these rules and just let it wrap naturally with proper paddings.
| switch (info.sessionId, info.blindedId) { | ||
| case (.some(let sessionId), .none): | ||
| return ("accountId".localized(), sessionId) | ||
| case (.some(let sessionId), .some(_)): |
There was a problem hiding this comment.
You can omit the (_) in the .some case here - case (.some(let sessionId), .some):
| return ("accountId".localized(), sessionId.splitIntoLines(charactersForLines: [23, 23, 20])) | ||
| case (.none, .some(let blindedId)): | ||
| return ("blindedId".localized(), blindedId) | ||
| default : return ("", "") // Shouldn't happen |
There was a problem hiding this comment.
Might be better to explicitly handle case (.none, .none) here instead of default in case the info.sessionId type changes to something that has additional cases (in which case we would want it to throw a build error so we can resolve it)
| withAnimation(.easeInOut(duration: 0.25)) { | ||
| isSessionIdCopied.toggle() | ||
| } | ||
| DispatchQueue.main.asyncAfter(deadline: .now() + .milliseconds(4250)) { |
| struct ConditionalTruncation: ViewModifier { | ||
| let shouldTruncate: Bool | ||
|
|
||
| func body(content: Content) -> some View { | ||
| if shouldTruncate { | ||
| content | ||
| .lineLimit(1) | ||
| .truncationMode(.middle) | ||
| } else { | ||
| content | ||
| } | ||
| } | ||
| } | ||
|
|
||
| extension View { | ||
| func shouldTruncate(_ condition: Bool) -> some View { | ||
| modifier(ConditionalTruncation(shouldTruncate: condition)) | ||
| } | ||
| } |
There was a problem hiding this comment.
Just wondering whether this should be in it's own file? (ie. do you think we might use it elsewhere at some point?)
| var backgroundColor: UIColor { | ||
| switch themeStyle { | ||
| case .light: return #colorLiteral(red: 0.1058823529, green: 0.1058823529, blue: 0.1058823529, alpha: 1) | ||
| default: return .white | ||
| } | ||
| } | ||
| var tintColor: UIColor { | ||
| switch themeStyle { | ||
| case .light: return .white | ||
| default: return #colorLiteral(red: 0.1058823529, green: 0.1058823529, blue: 0.1058823529, alpha: 1) | ||
| } | ||
| } |
There was a problem hiding this comment.
Should these literals be constants in Theme+Colours?
|
|
||
| for count in charactersForLines { | ||
| let end = self.index(start, offsetBy: count, limitedBy: self.endIndex) ?? self.endIndex | ||
| var line = String(self[start..<end]) |
There was a problem hiding this comment.
Will this crash if called on an empty string? (I think ..< has issues if start == end)
There was a problem hiding this comment.
It won't crash when start == end. Only when start > end will it crash because of Swift precondition check failure
|
|
||
| VStack(spacing: 0) { | ||
| content{ close() } | ||
| content { completion in close(completion: completion) } |
# Conflicts: # Session.xcodeproj/project.pbxproj
… modal in communities
No description provided.