subtle improvements to controls

This commit is contained in:
talksik
2022-01-02 22:21:02 -08:00
parent 74444d9b20
commit ccdcf9668f
4 changed files with 10 additions and 7 deletions
@@ -90,8 +90,6 @@ class ConvoViewModel: NSObject, ObservableObject {
return self.selectedConvoId != nil return self.selectedConvoId != nil
} }
static var maxUsersInConvo = 8
static var relevancyAcceptance = 0.5
func initializeAgoraEngine() { func initializeAgoraEngine() {
self.agoraKit = AgoraRtcEngineKit.sharedEngine(withAppId: "c8dfd65deb5c4741bd564085627139d0", delegate: self) self.agoraKit = AgoraRtcEngineKit.sharedEngine(withAppId: "c8dfd65deb5c4741bd564085627139d0", delegate: self)
@@ -198,7 +196,7 @@ class ConvoViewModel: NSObject, ObservableObject {
let relevancyScore = Double(relevancyCount) / Double(convo.users.count) let relevancyScore = Double(relevancyCount) / Double(convo.users.count)
print("relevancy score: \(relevancyScore)") print("relevancy score: \(relevancyScore)")
if relevancyScore > Self.relevancyAcceptance && convo.users.count > 1 { //offchance that it's just the one person in the convo right now, don't want to see it until there are at least 2 people if relevancyScore > RuleBook.convoRelevancyAcceptance && convo.users.count > 1 { //offchance that it's just the one person in the convo right now, don't want to see it until there are at least 2 people
print("this convo counts as relevant!!!") print("this convo counts as relevant!!!")
return true return true
@@ -268,7 +266,7 @@ class ConvoViewModel: NSObject, ObservableObject {
} }
// safe case, not really possible // safe case, not really possible
if convo.users.count >= Self.maxUsersInConvo { if convo.users.count >= RuleBook.maxUsersInConvo {
self.toast = .maxLimitUsers self.toast = .maxLimitUsers
return return
} }
@@ -302,7 +300,7 @@ class ConvoViewModel: NSObject, ObservableObject {
return return
} }
if convo!.users.count >= Self.maxUsersInConvo { if convo!.users.count >= RuleBook.maxUsersInConvo {
self.toast = .maxLimitUsers self.toast = .maxLimitUsers
return return
} }
@@ -338,7 +336,7 @@ class ConvoViewModel: NSObject, ObservableObject {
} }
// TODO: put as an environment variable // TODO: put as an environment variable
if convo!.users.count >= Self.maxUsersInConvo { if convo!.users.count >= RuleBook.maxUsersInConvo {
self.toast = .maxLimitUsers self.toast = .maxLimitUsers
return return
} }
@@ -357,6 +357,7 @@ struct CircleGridView: View {
} //lazygrid // TODO: add padding based on if we are on any cornering item to allow the bubble to enlargen } //lazygrid // TODO: add padding based on if we are on any cornering item to allow the bubble to enlargen
.padding(.trailing, Self.size / 2 + Self.spacingBetweenColumns / 2) // because of the offset of last column .padding(.trailing, Self.size / 2 + Self.spacingBetweenColumns / 2) // because of the offset of last column
.padding(.top, Self.size / 2 + Self.spacingBetweenRows / 2) // because we are going under the nav bar .padding(.top, Self.size / 2 + Self.spacingBetweenRows / 2) // because we are going under the nav bar
// .id(UUID())
}// scrollview }// scrollview
.onAppear { .onAppear {
// scrolling to first person in grid // scrolling to first person in grid
@@ -61,7 +61,7 @@ class InnerCircleViewModel: ObservableObject {
case .problemSendingClip: case .problemSendingClip:
return AlertToast(displayMode: .hud, type: .error(Color.orange), title: "problem sending clip", subTitle: "please try again") return AlertToast(displayMode: .hud, type: .error(Color.orange), title: "problem sending clip", subTitle: "please try again")
case .startedClip: case .startedClip:
return AlertToast(displayMode: .hud, type: .systemImage("waveform.circle.fill", Color.orange)) return AlertToast(displayMode: .hud, type: .systemImage("waveform.and.mic", Color.orange), subTitle: "you're on")
default: default:
return AlertToast(displayMode: .hud, type: .error(Color.orange), title: "Something went wrong ‼️") return AlertToast(displayMode: .hud, type: .error(Color.orange), title: "Something went wrong ‼️")
} }
@@ -117,6 +117,8 @@ extension InnerCircleViewModel {
audioRecorder.record() audioRecorder.record()
isRecording = true isRecording = true
self.toast = .startedClip
self.audioLocalUrl = filePath // setting this for later use when recording is stopped self.audioLocalUrl = filePath // setting this for later use when recording is stopped
} catch { } catch {
@@ -9,4 +9,6 @@ import Foundation
class RuleBook { class RuleBook {
static let maxFriends = 8 static let maxFriends = 8
static let maxUsersInConvo = 8
static let convoRelevancyAcceptance = 0.5 // anything above this number
} }