Skip to content

Commit 7f40c69

Browse files
authored
v2 compatible (#28)
* disable audio modules for now * Update RoomView.swift * update * v2 * fix screen share * remove try * upgrade xcode settings * update * refactor * cancel connect button * use main actor instead of .main * fix crash This reverts commit b2d3a08. * fix ios compile * show node id * PublishOptionsView * fix publish view * stats * fix: PublishOptionsView * default to simulcast on * Update ParticipantView.swift * Update RoomView.swift * fix audio publish crash * update isMuted state etc * trigger re-connect * update debug scheme * update * use Sid and Identity types * Update ParticipantView.swift * Update Package.resolved
1 parent 87a00d5 commit 7f40c69

24 files changed

+1054
-703
lines changed

.periphery.yml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
retain_objc_accessible: true
2+
schemes:
3+
- Example (macOS Debug)
4+
targets:
5+
- LiveKitExample (macOS)
6+
workspace: LiveKitExample-dev.xcworkspace

.swift-version

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
5.7 # Xcode 14

.swiftformat

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
--exclude Sources/LiveKit/Protos
2+
--header "/*\n * Copyright {year} LiveKit\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */"

LiveKitExample-dev.xcworkspace/xcshareddata/swiftpm/Package.resolved

+21-12
Original file line numberDiff line numberDiff line change
@@ -11,30 +11,30 @@
1111
}
1212
},
1313
{
14-
"package": "Promises",
15-
"repositoryURL": "https://github.com/google/promises.git",
14+
"package": "SFSafeSymbols",
15+
"repositoryURL": "https://github.com/SFSafeSymbols/SFSafeSymbols",
1616
"state": {
1717
"branch": null,
18-
"revision": "e70e889c0196c76d22759eb50d6a0270ca9f1d9e",
19-
"version": "2.3.1"
18+
"revision": "7cca2d60925876b5953a2cf7341cd80fbeac983c",
19+
"version": "4.1.1"
2020
}
2121
},
2222
{
23-
"package": "SFSafeSymbols",
24-
"repositoryURL": "https://github.com/SFSafeSymbols/SFSafeSymbols",
23+
"package": "SwiftDocCPlugin",
24+
"repositoryURL": "https://github.com/apple/swift-docc-plugin",
2525
"state": {
2626
"branch": null,
27-
"revision": "7cca2d60925876b5953a2cf7341cd80fbeac983c",
28-
"version": "4.1.1"
27+
"revision": "26ac5758409154cc448d7ab82389c520fa8a8247",
28+
"version": "1.3.0"
2929
}
3030
},
3131
{
32-
"package": "WebRTC",
33-
"repositoryURL": "https://github.com/webrtc-sdk/Specs.git",
32+
"package": "SymbolKit",
33+
"repositoryURL": "https://github.com/apple/swift-docc-symbolkit",
3434
"state": {
3535
"branch": null,
36-
"revision": "4fa8d6d647fc759cdd0265fd413d2f28ea2e0e08",
37-
"version": "114.5735.8"
36+
"revision": "b45d1f2ed151d057b54504d653e0da5552844e34",
37+
"version": "1.0.0"
3838
}
3939
},
4040
{
@@ -54,6 +54,15 @@
5454
"revision": "65e8f29b2d63c4e38e736b25c27b83e012159be8",
5555
"version": "1.25.2"
5656
}
57+
},
58+
{
59+
"package": "WebRTC",
60+
"repositoryURL": "https://github.com/livekit/webrtc-xcframework.git",
61+
"state": {
62+
"branch": null,
63+
"revision": "da80ea5be0a2b92ca805ab7ee9ad191f6d938a5f",
64+
"version": "114.5735.10"
65+
}
5766
}
5867
]
5968
},

LiveKitExample.xcodeproj/project.pbxproj

+22-10
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@
99
/* Begin PBXBuildFile section */
1010
680FE2F227A8EF7700B6F6DB /* SFSafeSymbols in Frameworks */ = {isa = PBXBuildFile; productRef = 680FE2F127A8EF7700B6F6DB /* SFSafeSymbols */; };
1111
680FE2F427A8EFF700B6F6DB /* SFSafeSymbols in Frameworks */ = {isa = PBXBuildFile; productRef = 680FE2F327A8EFF700B6F6DB /* SFSafeSymbols */; };
12-
6816B1A8272D45DF005ADB85 /* ExampleObservableRoom.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6816B1A7272D45DF005ADB85 /* ExampleObservableRoom.swift */; };
13-
6816B1A9272D45DF005ADB85 /* ExampleObservableRoom.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6816B1A7272D45DF005ADB85 /* ExampleObservableRoom.swift */; };
12+
6816968E2AF96240008ED486 /* Participant+Helpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6816968D2AF96240008ED486 /* Participant+Helpers.swift */; };
13+
6816968F2AF96240008ED486 /* Participant+Helpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6816968D2AF96240008ED486 /* Participant+Helpers.swift */; };
14+
6816B1A8272D45DF005ADB85 /* ExampleRoomMessage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6816B1A7272D45DF005ADB85 /* ExampleRoomMessage.swift */; };
15+
6816B1A9272D45DF005ADB85 /* ExampleRoomMessage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6816B1A7272D45DF005ADB85 /* ExampleRoomMessage.swift */; };
1416
6816B1B0272D9198005ADB85 /* ParticipantView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6816B1AF272D9198005ADB85 /* ParticipantView.swift */; };
1517
6816B1B1272D9198005ADB85 /* ParticipantView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6816B1AF272D9198005ADB85 /* ParticipantView.swift */; };
1618
681A0AB727D888D80097E3F4 /* LiveKit in Frameworks */ = {isa = PBXBuildFile; productRef = 681A0AB627D888D80097E3F4 /* LiveKit */; };
@@ -31,6 +33,8 @@
3133
6847616527B44A1A001611BE /* Bundle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6847616327B44A1A001611BE /* Bundle.swift */; };
3234
6867533B27A65652003707B9 /* AppContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6867533A27A65652003707B9 /* AppContext.swift */; };
3335
6867533C27A65652003707B9 /* AppContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6867533A27A65652003707B9 /* AppContext.swift */; };
36+
687230F82B14AE0A0098CCE6 /* PublishOptionsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 687230F72B14AE0A0098CCE6 /* PublishOptionsView.swift */; };
37+
687230F92B14AE0A0098CCE6 /* PublishOptionsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 687230F72B14AE0A0098CCE6 /* PublishOptionsView.swift */; };
3438
68816CC127B4D6BC00E24622 /* KeychainAccess in Frameworks */ = {isa = PBXBuildFile; productRef = 68816CC027B4D6BC00E24622 /* KeychainAccess */; };
3539
68816CC327B4D94200E24622 /* KeychainAccess in Frameworks */ = {isa = PBXBuildFile; productRef = 68816CC227B4D94200E24622 /* KeychainAccess */; };
3640
68816CC527B4DCD500E24622 /* SecureStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 68816CC427B4DCD500E24622 /* SecureStore.swift */; };
@@ -72,7 +76,8 @@
7276
/* End PBXCopyFilesBuildPhase section */
7377

7478
/* Begin PBXFileReference section */
75-
6816B1A7272D45DF005ADB85 /* ExampleObservableRoom.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExampleObservableRoom.swift; sourceTree = "<group>"; };
79+
6816968D2AF96240008ED486 /* Participant+Helpers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Participant+Helpers.swift"; sourceTree = "<group>"; };
80+
6816B1A7272D45DF005ADB85 /* ExampleRoomMessage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExampleRoomMessage.swift; sourceTree = "<group>"; };
7681
6816B1AF272D9198005ADB85 /* ParticipantView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ParticipantView.swift; sourceTree = "<group>"; };
7782
681E3F38271FC772007BB547 /* RoomContext.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RoomContext.swift; sourceTree = "<group>"; };
7883
681E3F3E271FC795007BB547 /* Custom.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Custom.swift; sourceTree = "<group>"; };
@@ -88,6 +93,7 @@
8893
6865EA2527513B4500FFAFC3 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
8994
6865EA2D27513B6D00FFAFC3 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
9095
6867533A27A65652003707B9 /* AppContext.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppContext.swift; sourceTree = "<group>"; };
96+
687230F72B14AE0A0098CCE6 /* PublishOptionsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PublishOptionsView.swift; sourceTree = "<group>"; };
9197
68816CC427B4DCD500E24622 /* SecureStore.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecureStore.swift; sourceTree = "<group>"; };
9298
6884B77B2750507400732D47 /* ScreenShareSourcePickerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ScreenShareSourcePickerView.swift; sourceTree = "<group>"; };
9399
68B3853C271E780600711D5F /* LiveKitExample.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LiveKitExample.swift; sourceTree = "<group>"; };
@@ -148,9 +154,11 @@
148154
683720D427A0640D007DA986 /* Support */ = {
149155
isa = PBXGroup;
150156
children = (
157+
6816B1A7272D45DF005ADB85 /* ExampleRoomMessage.swift */,
151158
683720D127A06404007DA986 /* ConnectionHistory.swift */,
152159
6847616327B44A1A001611BE /* Bundle.swift */,
153160
68816CC427B4DCD500E24622 /* SecureStore.swift */,
161+
6816968D2AF96240008ED486 /* Participant+Helpers.swift */,
154162
);
155163
path = Support;
156164
sourceTree = "<group>";
@@ -189,6 +197,7 @@
189197
isa = PBXGroup;
190198
children = (
191199
6884B77B2750507400732D47 /* ScreenShareSourcePickerView.swift */,
200+
687230F72B14AE0A0098CCE6 /* PublishOptionsView.swift */,
192201
);
193202
path = Views;
194203
sourceTree = "<group>";
@@ -214,7 +223,6 @@
214223
681E3F42271FC7AD007BB547 /* ConnectView.swift */,
215224
681E3F41271FC7AC007BB547 /* RoomView.swift */,
216225
68B3853C271E780600711D5F /* LiveKitExample.swift */,
217-
6816B1A7272D45DF005ADB85 /* ExampleObservableRoom.swift */,
218226
6816B1AF272D9198005ADB85 /* ParticipantView.swift */,
219227
68B3853E271E780700711D5F /* Assets.xcassets */,
220228
);
@@ -403,10 +411,12 @@
403411
681E3F43271FC7AD007BB547 /* RoomView.swift in Sources */,
404412
6816B1B0272D9198005ADB85 /* ParticipantView.swift in Sources */,
405413
68816CC527B4DCD500E24622 /* SecureStore.swift in Sources */,
414+
6816968E2AF96240008ED486 /* Participant+Helpers.swift in Sources */,
406415
68B3854C271E780700711D5F /* LiveKitExample.swift in Sources */,
407416
681E3F3F271FC795007BB547 /* Custom.swift in Sources */,
408417
6847616427B44A1A001611BE /* Bundle.swift in Sources */,
409-
6816B1A8272D45DF005ADB85 /* ExampleObservableRoom.swift in Sources */,
418+
687230F82B14AE0A0098CCE6 /* PublishOptionsView.swift in Sources */,
419+
6816B1A8272D45DF005ADB85 /* ExampleRoomMessage.swift in Sources */,
410420
6884B77C2750507400732D47 /* ScreenShareSourcePickerView.swift in Sources */,
411421
);
412422
runOnlyForDeploymentPostprocessing = 0;
@@ -422,10 +432,12 @@
422432
681E3F44271FC7AD007BB547 /* RoomView.swift in Sources */,
423433
6816B1B1272D9198005ADB85 /* ParticipantView.swift in Sources */,
424434
68816CC627B4DCD500E24622 /* SecureStore.swift in Sources */,
435+
6816968F2AF96240008ED486 /* Participant+Helpers.swift in Sources */,
425436
68B3854D271E780700711D5F /* LiveKitExample.swift in Sources */,
426437
681E3F40271FC795007BB547 /* Custom.swift in Sources */,
427438
6847616527B44A1A001611BE /* Bundle.swift in Sources */,
428-
6816B1A9272D45DF005ADB85 /* ExampleObservableRoom.swift in Sources */,
439+
687230F92B14AE0A0098CCE6 /* PublishOptionsView.swift in Sources */,
440+
6816B1A9272D45DF005ADB85 /* ExampleRoomMessage.swift in Sources */,
429441
6884B77D2750507400732D47 /* ScreenShareSourcePickerView.swift in Sources */,
430442
);
431443
runOnlyForDeploymentPostprocessing = 0;
@@ -621,7 +633,7 @@
621633
CODE_SIGN_ENTITLEMENTS = "$(SRCROOT)/iOS/iOS.entitlements";
622634
CODE_SIGN_IDENTITY = "Apple Development";
623635
CODE_SIGN_STYLE = Automatic;
624-
CURRENT_PROJECT_VERSION = 30;
636+
CURRENT_PROJECT_VERSION = 33;
625637
DEVELOPMENT_TEAM = 76TVFCUKK7;
626638
ENABLE_PREVIEWS = YES;
627639
INFOPLIST_FILE = iOS/Info.plist;
@@ -636,7 +648,7 @@
636648
"$(inherited)",
637649
"@executable_path/Frameworks",
638650
);
639-
MARKETING_VERSION = 1.1.1;
651+
MARKETING_VERSION = 1.2.2;
640652
PRODUCT_BUNDLE_IDENTIFIER = io.livekit.example.SwiftSDK.1;
641653
PRODUCT_NAME = LiveKitExample;
642654
PROVISIONING_PROFILE_SPECIFIER = "";
@@ -655,7 +667,7 @@
655667
CODE_SIGN_ENTITLEMENTS = "$(SRCROOT)/iOS/iOS.entitlements";
656668
CODE_SIGN_IDENTITY = "Apple Development";
657669
CODE_SIGN_STYLE = Automatic;
658-
CURRENT_PROJECT_VERSION = 30;
670+
CURRENT_PROJECT_VERSION = 33;
659671
DEVELOPMENT_TEAM = 76TVFCUKK7;
660672
ENABLE_PREVIEWS = YES;
661673
INFOPLIST_FILE = iOS/Info.plist;
@@ -670,7 +682,7 @@
670682
"$(inherited)",
671683
"@executable_path/Frameworks",
672684
);
673-
MARKETING_VERSION = 1.1.1;
685+
MARKETING_VERSION = 1.2.2;
674686
PRODUCT_BUNDLE_IDENTIFIER = io.livekit.example.SwiftSDK.1;
675687
PRODUCT_NAME = LiveKitExample;
676688
PROVISIONING_PROFILE_SPECIFIER = "";

LiveKitExample.xcodeproj/xcshareddata/xcschemes/Example (iOS Debug).xcscheme

+7
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,13 @@
5252
ReferencedContainer = "container:LiveKitExample.xcodeproj">
5353
</BuildableReference>
5454
</BuildableProductRunnable>
55+
<AdditionalOptions>
56+
<AdditionalOption
57+
key = "MallocStackLogging"
58+
value = ""
59+
isEnabled = "YES">
60+
</AdditionalOption>
61+
</AdditionalOptions>
5562
</LaunchAction>
5663
<ProfileAction
5764
buildConfiguration = "Release"

LiveKitExample.xcodeproj/xcshareddata/xcschemes/Example (macOS Debug Thread).xcscheme

+7
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,13 @@
5252
ReferencedContainer = "container:LiveKitExample.xcodeproj">
5353
</BuildableReference>
5454
</BuildableProductRunnable>
55+
<AdditionalOptions>
56+
<AdditionalOption
57+
key = "NSZombieEnabled"
58+
value = "YES"
59+
isEnabled = "YES">
60+
</AdditionalOption>
61+
</AdditionalOptions>
5562
</LaunchAction>
5663
<ProfileAction
5764
buildConfiguration = "Release"

Shared/ConnectView.swift

+30-14
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,25 @@
1+
/*
2+
* Copyright 2024 LiveKit
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
117
import Foundation
2-
import SwiftUI
318
import LiveKit
419
import SFSafeSymbols
20+
import SwiftUI
521

622
struct ConnectView: View {
7-
823
@EnvironmentObject var appCtx: AppContext
924
@EnvironmentObject var roomCtx: RoomContext
1025
@EnvironmentObject var room: Room
@@ -13,14 +28,13 @@ struct ConnectView: View {
1328
GeometryReader { geometry in
1429
ScrollView {
1530
VStack(alignment: .center, spacing: 40.0) {
16-
1731
VStack(spacing: 10) {
1832
Image("logo")
1933
.resizable()
2034
.aspectRatio(contentMode: .fit)
2135
.frame(height: 30)
2236
.padding(.bottom, 10)
23-
Text("SDK Version \(LiveKit.version)")
37+
Text("SDK Version \(LiveKitSDK.version)")
2438
.opacity(0.5)
2539
Text("Example App Version \(Bundle.main.appVersionLong) (\(Bundle.main.appBuild))")
2640
.opacity(0.5)
@@ -82,13 +96,19 @@ struct ConnectView: View {
8296
}.frame(maxWidth: 350)
8397

8498
if case .connecting = room.connectionState {
85-
ProgressView()
99+
HStack(alignment: .center) {
100+
ProgressView()
101+
102+
LKButton(title: "Cancel") {
103+
roomCtx.cancelConnect()
104+
}
105+
}
86106
} else {
87107
HStack(alignment: .center) {
88108
Spacer()
89109

90110
LKButton(title: "Connect") {
91-
Task {
111+
Task.detached { @MainActor in
92112
let room = try await roomCtx.connect()
93113
appCtx.connectionHistory.update(room: room, e2ee: roomCtx.e2ee, e2eeKey: roomCtx.e2eeKey)
94114
}
@@ -98,7 +118,7 @@ struct ConnectView: View {
98118
Menu {
99119
ForEach(appCtx.connectionHistory.sortedByUpdated) { entry in
100120
Button {
101-
Task {
121+
Task.detached { @MainActor in
102122
let room = try await roomCtx.connect(entry: entry)
103123
appCtx.connectionHistory.update(room: room, e2ee: roomCtx.e2ee, e2eeKey: roomCtx.e2eeKey)
104124
}
@@ -107,7 +127,7 @@ struct ConnectView: View {
107127
.renderingMode(.original)
108128
Text([entry.roomName,
109129
entry.participantIdentity,
110-
entry.url].compactMap { $0 }.joined(separator: " "))
130+
entry.url].compactMap { String(describing: $0) }.joined(separator: " "))
111131
}
112132
}
113133

@@ -135,13 +155,11 @@ struct ConnectView: View {
135155
}
136156

137157
Spacer()
138-
139158
}
140-
141159
}
142160
}
143161
.padding()
144-
.frame(width: geometry.size.width) // Make the scroll view full-width
162+
.frame(width: geometry.size.width) // Make the scroll view full-width
145163
.frame(minHeight: geometry.size.height) // Set the content’s min height to the parent
146164
}
147165
}
@@ -150,9 +168,7 @@ struct ConnectView: View {
150168
#endif
151169
.alert(isPresented: $roomCtx.shouldShowDisconnectReason) {
152170
Alert(title: Text("Disconnected"),
153-
message: Text("Reason: " + (roomCtx.latestError != nil
154-
? String(describing: roomCtx.latestError!)
155-
: "Unknown")))
171+
message: Text("Reason: " + String(describing: roomCtx.latestError)))
156172
}
157173
}
158174
}

0 commit comments

Comments
 (0)