Skip to content

Commit

Permalink
Various initial tweaks following code review.
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanceriu committed Nov 13, 2024
1 parent 8dd7890 commit 5256b58
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 17 deletions.
2 changes: 2 additions & 0 deletions ElementX.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@
25C4C1100B6EA79F5CC7CBB5 /* AppLockSetupPINScreenViewModelTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 989D7380D9C86B3A10D30B13 /* AppLockSetupPINScreenViewModelTests.swift */; };
260FFC1475EE94F641C3F3F9 /* PollFormScreenViewModelProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = A40F1985065500F0E7F61A27 /* PollFormScreenViewModelProtocol.swift */; };
261261778DEFAEFC042B875E /* JoinedRoomProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 07C6B0B087FE6601C3F77816 /* JoinedRoomProxy.swift */; };
26252AA9AED64010788F4C26 /* UIView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 05A3E8741D199CD1A37F4CBF /* UIView.swift */; };
2689D22EF1D10D22B0A4DAEA /* NotificationContentBuilder.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7BB243B26D54EF1A0C422C0 /* NotificationContentBuilder.swift */; };
273AB64B9A26B61C51858867 /* AsyncSequence.swift in Sources */ = {isa = PBXBuildFile; fileRef = A73A07BAEDD74C48795A996A /* AsyncSequence.swift */; };
274CE3C986841D15FD530BF5 /* ShimmerModifier.swift in Sources */ = {isa = PBXBuildFile; fileRef = 97CE98208321C4D66E363612 /* ShimmerModifier.swift */; };
Expand Down Expand Up @@ -6446,6 +6447,7 @@
5AC5CD6D893073EE4D9A277E /* ShareExtensionViewController.swift in Sources */,
069358C2C825A19DE6CB127E /* TracingConfiguration.swift in Sources */,
03BD83E8BDD23AE059802E0D /* UITestsScreenIdentifier.swift in Sources */,
26252AA9AED64010788F4C26 /* UIView.swift in Sources */,
66E9202BED03B5BB00E812A1 /* URL.swift in Sources */,
4E22086585CB3B35FEEFBBB9 /* UserPreference.swift in Sources */,
);
Expand Down
2 changes: 1 addition & 1 deletion ElementX/Sources/Application/AppCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ class AppCoordinator: AppCoordinatorProtocol, AuthenticationFlowCoordinatorDeleg
} else {
handleAppRoute(.childEventOnRoomAlias(eventID: eventID, alias: alias))
}
case .share(let payload):
case .share:
guard isExternalURL else {
MXLog.error("Received unexpected internal share route")
break
Expand Down
2 changes: 1 addition & 1 deletion ElementX/Sources/Application/Navigation/AppRoutes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ struct AppGroupURLParser: URLParser {
return nil
}

guard let query = url.query()?.removingPercentEncoding,
guard let query = url.query(percentEncoded: false),
let queryData = query.data(using: .utf8) else {
MXLog.error("Failed processing share parameters")
return nil
Expand Down
10 changes: 5 additions & 5 deletions ElementX/Sources/FlowCoordinators/RoomFlowCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -497,9 +497,9 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol {
break

case (.mediaUploadPicker, .presentMediaUploadPreview, .mediaUploadPreview(let fileURL)):
presentMediaUploadPreviewScreen(for: fileURL)
presentMediaUploadPreviewScreen(for: fileURL, animated: animated)
case (.room, .presentMediaUploadPreview, .mediaUploadPreview(let fileURL)):
presentMediaUploadPreviewScreen(for: fileURL)
presentMediaUploadPreviewScreen(for: fileURL, animated: animated)
case (.mediaUploadPreview, .dismissMediaUploadPreview, .room):
break

Expand Down Expand Up @@ -715,7 +715,7 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol {

switch presentationAction {
case .share(.mediaFile(_, let mediaFile)):
stateMachine.tryEvent(.presentMediaUploadPreview(fileURL: mediaFile.url))
stateMachine.tryEvent(.presentMediaUploadPreview(fileURL: mediaFile.url), userInfo: EventUserInfo(animated: animated))
default:
break
}
Expand Down Expand Up @@ -958,7 +958,7 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol {
}
}

private func presentMediaUploadPreviewScreen(for url: URL) {
private func presentMediaUploadPreviewScreen(for url: URL, animated: Bool) {
let stackCoordinator = NavigationStackCoordinator()

let parameters = MediaUploadPreviewScreenCoordinatorParameters(userIndicatorController: userIndicatorController,
Expand All @@ -982,7 +982,7 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol {

stackCoordinator.setRootCoordinator(mediaUploadPreviewScreenCoordinator)

navigationStackCoordinator.setSheetCoordinator(stackCoordinator) { [weak self] in
navigationStackCoordinator.setSheetCoordinator(stackCoordinator, animated: animated) { [weak self] in
self?.stateMachine.tryEvent(.dismissMediaUploadPreview)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -940,7 +940,8 @@ class UserSessionFlowCoordinator: FlowCoordinatorProtocol {
ShareExtensionPayload.mediaFile(roomID: roomID, mediaFile: mediaFile)
}

stateMachine.processEvent(.dismissedRoomSelectionScreen)
navigationSplitCoordinator.setSheetCoordinator(nil)

stateMachine.processEvent(.selectRoom(roomID: roomID,
via: [],
entryPoint: .share(sharePayload)),
Expand Down
2 changes: 2 additions & 0 deletions ElementX/Sources/Other/Extensions/UNNotificationContent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,8 @@ extension UNMutableNotificationContent {
return data
}

MXLog.info("Generating notification icon placeholder")

let data = Avatars.generatePlaceholderAvatarImageData(name: name, id: id, size: .init(width: 50, height: 50))

if let data {
Expand Down
2 changes: 1 addition & 1 deletion ElementX/Sources/Other/Extensions/URL.swift
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ extension URL: @retroactive ExpressibleByStringLiteral {
/// The app group temporary directory
static var appGroupTemporaryDirectory: URL {
let url = appGroupContainerDirectory
.appendingPathComponent("Temp", isDirectory: true)
.appendingPathComponent("tmp", isDirectory: true)

try? FileManager.default.createDirectoryIfNeeded(at: url)

Expand Down
8 changes: 1 addition & 7 deletions ShareExtension/Sources/ShareExtensionViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,9 @@ class ShareExtensionViewController: UIViewController {
super.viewDidLoad()

addChild(hostingController)
hostingController.view.translatesAutoresizingMaskIntoConstraints = false
view.addSubview(hostingController.view)
view.addMatchedSubview(hostingController.view)
hostingController.didMove(toParent: self)

NSLayoutConstraint.activate([view.topAnchor.constraint(equalTo: hostingController.view.topAnchor),
view.leftAnchor.constraint(equalTo: hostingController.view.leftAnchor),
view.bottomAnchor.constraint(equalTo: hostingController.view.bottomAnchor),
view.rightAnchor.constraint(equalTo: hostingController.view.rightAnchor)])

MXLog.configure(currentTarget: "shareextension", filePrefix: "shareextension", logLevel: appSettings.logLevel)
}

Expand Down
5 changes: 5 additions & 0 deletions ShareExtension/Sources/View/ShareExtensionView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ struct ShareExtensionView: View {
var body: some View {
ZStack {
ProgressView()
.frame(maxWidth: .infinity, maxHeight: .infinity)
}
.background(.compound.bgCanvasDefault)
}
}

#Preview {
ShareExtensionView()
}
3 changes: 2 additions & 1 deletion ShareExtension/SupportingFiles/target.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,9 @@ targets:
- path: ../../ElementX/Sources/Other/Extensions/FileManager.swift
- path: ../../ElementX/Sources/Other/Extensions/NSItemProvider.swift
- path: ../../ElementX/Sources/Other/Extensions/ProcessInfo.swift
- path: ../../ElementX/Sources/Other/Extensions/UIView.swift
- path: ../../ElementX/Sources/Other/Extensions/URL.swift
- path: ../../ElementX/Sources/Other/InfoPlistReader.swift
- path: ../../ElementX/Sources/Other/Logging
- path: ../../ElementX/Sources/UITests/UITestsScreenIdentifier.swift
- path: ../../ElementX/Sources/Other/UserPreference.swift
- path: ../../ElementX/Sources/UITests/UITestsScreenIdentifier.swift

0 comments on commit 5256b58

Please sign in to comment.