Skip to content

Commit

Permalink
Upgraded to ZelloSDK v1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
1ec5 committed Sep 18, 2024
1 parent 33d279f commit d521808
Show file tree
Hide file tree
Showing 19 changed files with 921 additions and 51 deletions.
4 changes: 2 additions & 2 deletions Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ target 'ZelloSDKExampleApp' do
use_frameworks!

# Pods for ZelloSDKExampleApp
pod "ZelloSDK", "~> 0.4.0"
pod "ZelloSDK", "~> 1.0.0"

end

Expand All @@ -26,7 +26,7 @@ target 'SDKNotificationServiceExtension' do
use_frameworks!

# Pods for SDKNotificationServiceExtension
pod "ZelloSDK", "~> 0.4.0"
pod "ZelloSDK", "~> 1.0.0"

end

12 changes: 8 additions & 4 deletions Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,20 @@ PODS:
- SDWebImage (5.19.7):
- SDWebImage/Core (= 5.19.7)
- SDWebImage/Core (5.19.7)
- SnowplowTracker (6.0.8)
- zello-opus-ios (1.0.1)
- ZelloSDK (0.4.0):
- ZelloSDK (1.0.0):
- CocoaAsyncSocket (~> 7.6)
- CocoaLumberjack/Swift (~> 3.7)
- OpenSSL-Universal (~> 1.1)
- PhoneNumberKit/PhoneNumberKitCore (~> 3.6)
- PromisesSwift (~> 2.1)
- SDWebImage (~> 5.13)
- SnowplowTracker (~> 6.0)
- zello-opus-ios (~> 1.0)

DEPENDENCIES:
- ZelloSDK (~> 0.4.0)
- ZelloSDK (~> 1.0.0)

SPEC REPOS:
trunk:
Expand All @@ -33,6 +35,7 @@ SPEC REPOS:
- PromisesObjC
- PromisesSwift
- SDWebImage
- SnowplowTracker
- zello-opus-ios
- ZelloSDK

Expand All @@ -44,9 +47,10 @@ SPEC CHECKSUMS:
PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47
PromisesSwift: 9d77319bbe72ebf6d872900551f7eeba9bce2851
SDWebImage: 8a6b7b160b4d710e2a22b6900e25301075c34cb3
SnowplowTracker: c7dcb63a584038ac3459bc803bfedec98cf87de9
zello-opus-ios: 8c1f08799d7a147c86f21ec2a18f7b19f8c2ceed
ZelloSDK: 85bfe4d3f07077163ff0711b7fd24aa9b28789f9
ZelloSDK: 38bd1581f93072d521ee708064577fe009349f02

PODFILE CHECKSUM: 60c1219dc719fa1a13b42ac86949a576482ab6e0
PODFILE CHECKSUM: 3a005f8a86cb592f251f81749205f739c39b7541

COCOAPODS: 1.15.2
24 changes: 24 additions & 0 deletions ZelloSDKExampleApp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@
41C742882BB4974A00D519F7 /* ChannelsViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 41C742862BB4974A00D519F7 /* ChannelsViewModel.swift */; };
41C742A32BB498E500D519F7 /* SessionConnectButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 41C742A22BB498E500D519F7 /* SessionConnectButton.swift */; };
41C742A52BB49B3300D519F7 /* ListItemTalkButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 41C742A42BB49B3300D519F7 /* ListItemTalkButton.swift */; };
BA1D5B4C2C9A446C00C703D8 /* ConversationsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA1D5B492C9A446C00C703D8 /* ConversationsView.swift */; };
BA1D5B4D2C9A446C00C703D8 /* ConversationsViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA1D5B4A2C9A446C00C703D8 /* ConversationsViewModel.swift */; };
BA1D5B502C9A461400C703D8 /* UserSelectionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA1D5B4E2C9A461400C703D8 /* UserSelectionView.swift */; };
BA1D5B512C9A461400C703D8 /* ConnectButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA1D5B4F2C9A461400C703D8 /* ConnectButton.swift */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand Down Expand Up @@ -115,6 +119,10 @@
41FCD7172BB32EF900F06DDE /* ZelloSDKExampleApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ZelloSDKExampleApp.app; sourceTree = BUILT_PRODUCTS_DIR; };
B0C5266FA4CEED302DDF44FE /* Pods_SDKNotificationServiceExtension.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_SDKNotificationServiceExtension.framework; sourceTree = BUILT_PRODUCTS_DIR; };
B350D77533A95A10E3863DA7 /* Pods-ZelloSDKExampleApp.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ZelloSDKExampleApp.debug.xcconfig"; path = "Target Support Files/Pods-ZelloSDKExampleApp/Pods-ZelloSDKExampleApp.debug.xcconfig"; sourceTree = "<group>"; };
BA1D5B492C9A446C00C703D8 /* ConversationsView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConversationsView.swift; sourceTree = "<group>"; };
BA1D5B4A2C9A446C00C703D8 /* ConversationsViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConversationsViewModel.swift; sourceTree = "<group>"; };
BA1D5B4E2C9A461400C703D8 /* UserSelectionView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UserSelectionView.swift; sourceTree = "<group>"; };
BA1D5B4F2C9A461400C703D8 /* ConnectButton.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConnectButton.swift; sourceTree = "<group>"; };
BB9FBB5493D793D4A736E2C6 /* Pods-SDKNotificationServiceExtension.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SDKNotificationServiceExtension.debug.xcconfig"; path = "Target Support Files/Pods-SDKNotificationServiceExtension/Pods-SDKNotificationServiceExtension.debug.xcconfig"; sourceTree = "<group>"; };
CB79221BBBB40DCD8D0ECCA1 /* Pods_ZelloSDKExampleApp.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_ZelloSDKExampleApp.framework; sourceTree = BUILT_PRODUCTS_DIR; };
D00DED424D00407A04E92276 /* Pods-SDKNotificationServiceExtension.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SDKNotificationServiceExtension.release.xcconfig"; path = "Target Support Files/Pods-SDKNotificationServiceExtension/Pods-SDKNotificationServiceExtension.release.xcconfig"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -187,6 +195,7 @@
isa = PBXGroup;
children = (
00E5E4282C0F95000028F485 /* AlertPopupView.swift */,
BA1D5B4F2C9A461400C703D8 /* ConnectButton.swift */,
00B26A1B2BED169300BBD78D /* ConnectivityProvider.swift */,
00D7B9A12BF665BB005AB5F1 /* ConnectNavBarButton.swift */,
00D7B99B2BF409A8005AB5F1 /* ImagePopupView.swift */,
Expand All @@ -199,6 +208,7 @@
00B26A192BED0EBC00BBD78D /* StatusMessageView.swift */,
00D7B9B62BFD3A81005AB5F1 /* TextPopupView.swift */,
419D06FB2C46D99E0028FB3C /* HistoryPopupView.swift */,
BA1D5B4E2C9A461400C703D8 /* UserSelectionView.swift */,
416751012BB3AEA90095410A /* Types */,
);
path = Shared;
Expand Down Expand Up @@ -232,6 +242,7 @@
41B79CB22C3C7B0E001DD052 /* Recents */,
41FCD72C2BB3377C00F06DDE /* Users */,
41FCD72D2BB3378A00F06DDE /* Channels */,
BA1D5B4B2C9A446C00C703D8 /* Conversations */,
);
path = UI;
sourceTree = "<group>";
Expand Down Expand Up @@ -307,6 +318,15 @@
path = Channels;
sourceTree = "<group>";
};
BA1D5B4B2C9A446C00C703D8 /* Conversations */ = {
isa = PBXGroup;
children = (
BA1D5B492C9A446C00C703D8 /* ConversationsView.swift */,
BA1D5B4A2C9A446C00C703D8 /* ConversationsViewModel.swift */,
);
path = Conversations;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
Expand Down Expand Up @@ -485,6 +505,7 @@
00D7B9B72BFD3A81005AB5F1 /* TextPopupView.swift in Sources */,
41B79CB42C3C7B1A001DD052 /* RecentsView.swift in Sources */,
0071CC4B2C08B722002533CB /* MapView.swift in Sources */,
BA1D5B512C9A461400C703D8 /* ConnectButton.swift in Sources */,
00B26A232BED1BF200BBD78D /* SignInView.swift in Sources */,
00D7B9AB2BF7DB53005AB5F1 /* StatusActionSheet.swift in Sources */,
41C742802BB4969C00D519F7 /* IncomingVoiceMessageViewState.swift in Sources */,
Expand All @@ -496,15 +517,18 @@
00D7B99C2BF409A8005AB5F1 /* ImagePopupView.swift in Sources */,
00B26A1C2BED169300BBD78D /* ConnectivityProvider.swift in Sources */,
41C742A32BB498E500D519F7 /* SessionConnectButton.swift in Sources */,
BA1D5B4D2C9A446C00C703D8 /* ConversationsViewModel.swift in Sources */,
0071CC492C08B706002533CB /* LocationPopupView.swift in Sources */,
41C742832BB4973300D519F7 /* UsersView.swift in Sources */,
00B26A1A2BED0EBC00BBD78D /* StatusMessageView.swift in Sources */,
BA1D5B502C9A461400C703D8 /* UserSelectionView.swift in Sources */,
41B79CB62C3C7B40001DD052 /* RecentsViewModel.swift in Sources */,
00E5E4292C0F95000028F485 /* AlertPopupView.swift in Sources */,
41C742872BB4974A00D519F7 /* ChannelsView.swift in Sources */,
419D06FE2C46D9BA0028FB3C /* HistoryViewState.swift in Sources */,
41C7427C2BB4964700D519F7 /* ConnectionViewState.swift in Sources */,
41C742762BB492F500D519F7 /* ZelloService.swift in Sources */,
BA1D5B4C2C9A446C00C703D8 /* ConversationsView.swift in Sources */,
41C742882BB4974A00D519F7 /* ChannelsViewModel.swift in Sources */,
41C742642BB48FE800D519F7 /* ZelloSDKExampleAppApp.swift in Sources */,
41C742842BB4973300D519F7 /* UsersViewModel.swift in Sources */,
Expand Down
33 changes: 30 additions & 3 deletions ZelloSDKExampleApp/Services/ZelloService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class ZelloRepository: Zello.Delegate, ObservableObject {
@Published var connectionState: Zello.ConnectionState = .disconnected
@Published var users: [ZelloUser] = []
@Published var channels: [ZelloChannel] = []
@Published var groupConversations: [ZelloGroupConversation] = []
@Published var selectedContact: ZelloContact? = nil
@Published var statusMessage: String? = nil {
didSet {
Expand Down Expand Up @@ -69,6 +70,7 @@ class ZelloRepository: Zello.Delegate, ObservableObject {
func zelloDidUpdateContactList(_ zello: Zello) {
users = zello.users
channels = zello.channels
groupConversations = zello.groupConversations
emergencyChannel = zello.emergencyChannel
}

Expand Down Expand Up @@ -124,7 +126,7 @@ class ZelloRepository: Zello.Delegate, ObservableObject {
}

func zello(_ zello: Zello, didFailToSend textMessage: ZelloTextMessage) {
statusMessage = "Failed to send image message"
statusMessage = "Failed to send text message"
}

func zello(_ zello: Zello, didReceive locationMessage: ZelloLocationMessage) {
Expand All @@ -136,7 +138,7 @@ class ZelloRepository: Zello.Delegate, ObservableObject {
}

func zello(_ zello: Zello, didFailToSend locationMessage: ZelloLocationMessage) {
statusMessage = "Failed to send image message"
statusMessage = "Failed to send location message"
}

func zello(_ zello: Zello, didReceive alertMessage: ZelloAlertMessage) {
Expand All @@ -148,7 +150,7 @@ class ZelloRepository: Zello.Delegate, ObservableObject {
}

func zello(_ zello: Zello, didFailToSend alertMessage: ZelloAlertMessage) {
statusMessage = "Failed to send image message"
statusMessage = "Failed to send alert message"
}

func zello(_ zello: Zello, didStart outgoingEmergency: ZelloOutgoingEmergency) {
Expand Down Expand Up @@ -196,4 +198,29 @@ class ZelloRepository: Zello.Delegate, ObservableObject {
func clearHistory() {
history = nil
}

func zello(_ zello: Zello, didRename conversation: ZelloGroupConversation) {
groupConversations = zello.groupConversations
}

func zello(_ zello: Zello, didJoin conversation: ZelloGroupConversation) {
groupConversations = zello.groupConversations
}

func zello(_ zello: Zello, didCreate conversation: ZelloGroupConversation) {
groupConversations = zello.groupConversations
}

func zello(_ zello: Zello, didAdd users: [ZelloGroupConversationUser], to conversation: ZelloGroupConversation) {
groupConversations = zello.groupConversations
}

func zello(_ zello: Zello, didLeave conversation: ZelloGroupConversation) {
groupConversations = zello.groupConversations
}

func zello(_ zello: Zello, didRemove users: [ZelloGroupConversationUser], from conversation: ZelloGroupConversation) {
groupConversations = zello.groupConversations
}

}
6 changes: 5 additions & 1 deletion ZelloSDKExampleApp/Shared/AlertPopupView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@ struct AlertPopupView: View {
guard let alertMessage else { return nil }

if let author = alertMessage.channelUser {
return "\(author.name) -> \(alertMessage.contact.name)"
var displayName = alertMessage.contact.name
if let conversation = alertMessage.contact.asZelloGroupConversation() {
displayName = conversation.displayName
}
return "\(author.name) -> \(displayName)"
}
return alertMessage.contact.name
}
Expand Down
19 changes: 19 additions & 0 deletions ZelloSDKExampleApp/Shared/ConnectButton.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import SwiftUI

struct ConnectButton<ViewModel: ConnectivityProvider>: View {
@ObservedObject var viewModel: ViewModel
let onConnectButtonTapped: () -> Void

var body: some View {
let isConnected = viewModel.isConnected
let isConnecting = viewModel.isConnecting

SessionConnectButton(isConnected: isConnected, isConnecting: isConnecting) {
if isConnected {
viewModel.disconnect()
} else {
onConnectButtonTapped()
}
}
}
}
6 changes: 5 additions & 1 deletion ZelloSDKExampleApp/Shared/ImagePopupView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,11 @@ struct ImagePopupView: View {
guard let imageMessage else { return nil }

if let author = imageMessage.channelUser {
return "\(author.name) -> \(imageMessage.contact.name)"
var displayName = imageMessage.contact.name
if let conversation = imageMessage.contact.asZelloGroupConversation() {
displayName = conversation.displayName
}
return "\(author.name) -> \(displayName)"
}
return imageMessage.contact.name
}
Expand Down
32 changes: 26 additions & 6 deletions ZelloSDKExampleApp/Shared/InputDialog.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import ZelloSDK
enum InputAction: String {
case alert = "Alert"
case text = "Text"
case rename = "Rename Conversation"
}

struct InputDialog: View {
Expand All @@ -12,30 +13,42 @@ struct InputDialog: View {
@Binding var selectedLevel: ZelloAlertMessage.ChannelLevel?
let action: InputAction
let contact: ZelloContact
let conversation: ZelloGroupConversation?
var onSend: () -> Void

init(isVisible: Binding<Bool>,
text: Binding<String>,
selectedLevel: Binding<ZelloAlertMessage.ChannelLevel?> = .constant(nil),
action: InputAction,
contact: ZelloContact,
conversation: ZelloGroupConversation?,
onSend: @escaping () -> Void) {
self._isVisible = isVisible
self._text = text
self._selectedLevel = selectedLevel
self.action = action
self.contact = contact
self.onSend = onSend
self.conversation = conversation
}

var body: some View {
VStack {
Text("Send \(action) to \(contact.name)")
.padding()
if let conversation, action == .rename {
Text("Rename \(conversation.displayName)")
.padding()

TextField("Enter your message", text: $text)
.textFieldStyle(RoundedBorderTextFieldStyle())
.padding()
TextField("New name", text: $text)
.textFieldStyle(RoundedBorderTextFieldStyle())
.padding()
} else {
Text("Send \(action) to \(displayName())")
.padding()

TextField("Enter your message", text: $text)
.textFieldStyle(RoundedBorderTextFieldStyle())
.padding()
}

if selectedLevel != nil {
Picker("Select Level", selection: $selectedLevel.unwrap(defaultValue: .connected)) {
Expand All @@ -53,7 +66,7 @@ struct InputDialog: View {
}
.padding()

Button("Send") {
Button("Continue") {
onSend()
isVisible = false
}
Expand All @@ -65,6 +78,13 @@ struct InputDialog: View {
.shadow(radius: 10)
.padding()
}

func displayName() -> String {
if let conversation, !conversation.displayName.isEmpty {
return conversation.displayName
}
return contact.name
}
}

extension Binding where Value: ExpressibleByNilLiteral {
Expand Down
6 changes: 5 additions & 1 deletion ZelloSDKExampleApp/Shared/LocationPopupView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,11 @@ struct LocationPopupView: View {
guard let locationMessage else { return nil }

if let author = locationMessage.channelUser {
return "\(author.name) -> \(locationMessage.contact.name)"
var displayName = locationMessage.contact.name
if let conversation = locationMessage.contact.asZelloGroupConversation() {
displayName = conversation.displayName
}
return "\(author.name) -> \(displayName)"
}
return locationMessage.contact.name
}
Expand Down
6 changes: 5 additions & 1 deletion ZelloSDKExampleApp/Shared/TextPopupView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@ struct TextPopupView: View {
guard let textMessage else { return nil }

if let author = textMessage.channelUser {
return "\(author.name) -> \(textMessage.contact.name)"
var displayName = textMessage.contact.name
if let conversation = textMessage.contact.asZelloGroupConversation() {
displayName = conversation.displayName
}
return "\(author.name) -> \(displayName)"
}
return textMessage.contact.name
}
Expand Down
Loading

0 comments on commit d521808

Please sign in to comment.