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

Integrate recording paused state #32

Draft
wants to merge 1 commit 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
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@
87E669B52AB4F02600073016 /* Popovers in Frameworks */ = {isa = PBXBuildFile; productRef = 87E669B42AB4F02600073016 /* Popovers */; };
87F2FEAB2ABD75FB00FB62C2 /* RoomStatesExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = 87F2FEAA2ABD75FB00FB62C2 /* RoomStatesExample.swift */; };
87FC805D2AD95990001DAED9 /* RoomModelStandaloneExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = 87FC805C2AD95990001DAED9 /* RoomModelStandaloneExample.swift */; };
9143E28E2AF948BA00E447C9 /* HMSRecordSessionMenuButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9143E28D2AF948BA00E447C9 /* HMSRecordSessionMenuButton.swift */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand Down Expand Up @@ -471,6 +472,7 @@
87B53FCE2AEFBD5D0061DE1A /* HMSRoomKit.docc */ = {isa = PBXFileReference; lastKnownFileType = folder.documentationcatalog; path = HMSRoomKit.docc; sourceTree = "<group>"; };
87F2FEAA2ABD75FB00FB62C2 /* RoomStatesExample.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomStatesExample.swift; sourceTree = "<group>"; };
87FC805C2AD95990001DAED9 /* RoomModelStandaloneExample.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RoomModelStandaloneExample.swift; sourceTree = "<group>"; };
9143E28D2AF948BA00E447C9 /* HMSRecordSessionMenuButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HMSRecordSessionMenuButton.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -889,6 +891,7 @@
87B53F7B2AEFBD5D0061DE1A /* HMSParticipantCountStatusView.swift */,
87B53F7C2AEFBD5D0061DE1A /* HMSRecordingStatusView.swift */,
87B53F7D2AEFBD5D0061DE1A /* HMSDefaultTileView.swift */,
9143E28D2AF948BA00E447C9 /* HMSRecordSessionMenuButton.swift */,
);
path = "UIComponents - Internal";
sourceTree = "<group>";
Expand Down Expand Up @@ -1322,6 +1325,7 @@
87B53FFE2AEFBD5D0061DE1A /* HMSStreamingStatusView.swift in Sources */,
87B53FD72AEFBD5D0061DE1A /* Environment.swift in Sources */,
87B540062AEFBD5D0061DE1A /* HMSShareScreenButton.swift in Sources */,
9143E28E2AF948BA00E447C9 /* HMSRecordSessionMenuButton.swift in Sources */,
87B540182AEFBD5D0061DE1A /* HMSEndCallButton.swift in Sources */,
87B540472AEFBD5D0061DE1A /* HMSPeerLayout.swift in Sources */,
87B53F122AEFBD520061DE1A /* HMSTrackModel-Base-Actions.swift in Sources */,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"images" : [
{
"filename" : "record-paused.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"template-rendering-intent" : "original"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ struct HMSOptionSheetView: View {
}

if roomModel.userCanStartStopRecording {
HMSSessionMenuButton(text: roomModel.recordingState != .stopped ? "Recording On" : "Start Recording", image: "record-on", highlighted: roomModel.recordingState != .stopped, isDisabled: roomModel.isUserHLSViewer)
HMSRecordSessionMenuButton()
.onTapGesture {
guard roomModel.recordingState == .stopped else {
guard roomModel.recordingState == .stopped || roomModel.recordingState == .none else {
internalSheet = .stopRecording
return
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
//
// HMSRecordSessionMenuButton.swift
// HMSRoomKit
//
// Created by Dmitry Fedoseyev on 06.11.2023.
//

import SwiftUI
import HMSRoomModels

struct HMSRecordSessionMenuButton: View {
@EnvironmentObject var roomModel: HMSRoomModel

var buttonText: String {
switch roomModel.recordingState {
case .starting, .started, .resumed:
return "Recording"
case .paused:
return "Recording\nPaused"
default:
return "Record"
}
}

var buttonImage: String {
switch roomModel.recordingState {
case .starting, .started, .resumed:
return "record-on"
case .paused:
return "Recording\nPaused"
default:
return "record-on"
}
}

var buttonImageColor: HMSThemeColor? {
switch roomModel.recordingState {
case .starting, .started, .resumed:
return .errorDefault
default:
return nil
}
}

var body: some View {
HMSSessionMenuButton(text: buttonText, image: buttonImage, highlighted: false, isDisabled: roomModel.isUserHLSViewer, imageForeground: buttonImageColor)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@ struct HMSRecordingStatusView: View {

var body: some View {

if roomModel.recordingState == .recording {
if roomModel.recordingState == .started || roomModel.recordingState == .resumed {
Image(assetName:"record-on")
.foreground(.errorDefault)
} else if roomModel.recordingState == .paused {
Image(assetName:"record-paused")
}
else if roomModel.recordingState == .initializing {
else if roomModel.recordingState == .starting {
HMSLoadingView {
Image(assetName: "loading-record")
.foreground(.onSurfaceHigh)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,22 @@ struct HMSSessionMenuButton: View {
var highlighted: Bool
var badgeText: String?
var isDisabled: Bool = false
var imageForeground: HMSThemeColor?

private var imageForegroundComputed: HMSThemeColor {
if let imageForeground = imageForeground {
return imageForeground
}

return isDisabled ? .onSurfaceLow : .onSurfaceHigh
}

var body: some View {
VStack {
Image(assetName: image)
.resizable()
.frame(width: 21, height: 20)
.foreground(isDisabled ? .onSurfaceLow : .onSurfaceHigh)
.foreground(imageForegroundComputed)
Text(text).font(.captionSemibold)
.multilineTextAlignment(.center)
.foreground(isDisabled ? .onSurfaceLow : .onSurfaceHigh)
Expand Down