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

visionOS Beta Platform Support #124

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions iOS/DittoChat.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -969,8 +969,8 @@
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/getditto/DittoSwiftTools.git";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 4.4.0;
kind = exactVersion;
version = "4.8.0-visionos-beta.1";
};
};
14BF945B29786731001F672D /* XCRemoteSwiftPackageReference "CodeScanner" */ = {
Expand All @@ -985,8 +985,8 @@
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/getditto/DittoSwiftPackage";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 4.7.0;
kind = exactVersion;
version = "4.8.0-visionos-beta.1";
};
};
14CADB5E293FF00700BED068 /* XCRemoteSwiftPackageReference "Fakery" */ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/getditto/DittoSwiftPackage",
"state" : {
"revision" : "8f32d91b4a8d903e2e1da9abdae9f685c152f65d",
"version" : "4.7.2"
"revision" : "7964986665af7acd1065cf7c8fcab584ec580bbd",
"version" : "4.8.0-visionos-beta.1"
}
},
{
"identity" : "dittoswifttools",
"kind" : "remoteSourceControl",
"location" : "https://github.com/getditto/DittoSwiftTools.git",
"state" : {
"revision" : "c121a51ce7dba950df94689e3f5a695342883fa0",
"version" : "4.4.0"
"revision" : "ad84a398fb5f8878066f3c556c12493d989b8949",
"version" : "4.8.0-visionos-beta.1"
}
},
{
Expand Down
16 changes: 14 additions & 2 deletions iOS/DittoChat/Data/DittoService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,21 @@ extension DittoInstance {
default:
DittoLogger.enabled = true
DittoLogger.minimumLogLevel = DittoLogLevel(rawValue: logOption.rawValue)!
if let logFileURL = DittoLogManager.shared.logFileURL {
DittoLogger.setLogFileURL(logFileURL)
let logsDirectoryName = "debug-logs"
let logFileName = "logs.txt"

let logsDirectory = FileManager.default
.urls(for: .cachesDirectory, in: .userDomainMask).first!
.appendingPathComponent(logsDirectoryName, isDirectory: true)

do {
try FileManager.default.createDirectory(at: logsDirectory,
withIntermediateDirectories: true)
} catch let error {
assertionFailure("Failed to create logs directory: \(error)")
}

DittoLogger.setLogFileURL(logsDirectory.appendingPathComponent(logFileName))
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions iOS/DittoChat/Screens/ChatScreen/ChatScreen.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ struct ChatScreen: View {
}
}
}
#if !os(visionOS)
.scrollDismissesKeyboard(.interactively)
#endif
.onAppear {
DispatchQueue.main.async {
scrollToBottom(proxy: proxy)
Expand Down
4 changes: 4 additions & 0 deletions iOS/DittoChat/Screens/CodeScanner/ScannerView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
//
// Copyright © 2023 DittoLive Incorporated. All rights reserved.

// AVMetadataObject is unavailable in visionOS
#if !os(visionOS)
import CodeScanner
import SwiftUI

Expand Down Expand Up @@ -72,3 +74,5 @@ struct ScannerView_Previews: PreviewProvider {
ScannerView()
}
}

#endif
2 changes: 2 additions & 0 deletions iOS/DittoChat/Screens/MessageEditView/MessageEditView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ struct MessageEditView: View {
}

}
#if !os(visionOS)
.scrollDismissesKeyboard(.interactively)
#endif
.onAppear {
DispatchQueue.main.async {
withAnimation {
Expand Down
2 changes: 2 additions & 0 deletions iOS/DittoChat/Screens/RoomsListScreen/RoomsListScreen.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,15 @@ struct RoomsListScreen: View {
.sheet(isPresented: $viewModel.presentProfileScreen) {
ProfileScreen()
}
#if !os(visionOS)
.sheet(isPresented: $viewModel.presentScannerView) {
ScannerView(
successAction: { code in
viewModel.joinPrivateRoom(code: code)
}
)
}
#endif
.sheet(isPresented: $viewModel.presentCreateRoomScreen) {
RoomEditScreen()
}
Expand Down
4 changes: 2 additions & 2 deletions iOS/DittoChat/Utilities/Utils.swift
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,10 @@ extension Bundle {

extension CGFloat {
static var screenWidth: CGFloat {
UIScreen.main.bounds.width
.infinity
}
static var screenHeight: CGFloat {
UIScreen.main.bounds.height
.infinity
}
}

Expand Down