adding in rulebook global variable for the rules of the game
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
8909199C277EFDF30025F4BB /* joinSound.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = 8909199B277EFDF30025F4BB /* joinSound.mp3 */; };
|
||||
8909199E278155920025F4BB /* UserStatusView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8909199D278155920025F4BB /* UserStatusView.swift */; };
|
||||
890919A42781845D0025F4BB /* AlertToast in Frameworks */ = {isa = PBXBuildFile; productRef = 890919A32781845D0025F4BB /* AlertToast */; };
|
||||
890919A7278299590025F4BB /* RuleBook.swift in Sources */ = {isa = PBXBuildFile; fileRef = 890919A6278299590025F4BB /* RuleBook.swift */; };
|
||||
890C245D277BF628009B4A30 /* AgoraRtcKit in Frameworks */ = {isa = PBXBuildFile; productRef = 890C245C277BF628009B4A30 /* AgoraRtcKit */; };
|
||||
890C2460277BF896009B4A30 /* AgoraViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 890C245F277BF896009B4A30 /* AgoraViewController.swift */; };
|
||||
890C2462277BF935009B4A30 /* CallView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 890C2461277BF935009B4A30 /* CallView.swift */; };
|
||||
@@ -105,6 +106,7 @@
|
||||
89091998277EFDCC0025F4BB /* leaveSound.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = leaveSound.mp3; sourceTree = "<group>"; };
|
||||
8909199B277EFDF30025F4BB /* joinSound.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = joinSound.mp3; sourceTree = "<group>"; };
|
||||
8909199D278155920025F4BB /* UserStatusView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserStatusView.swift; sourceTree = "<group>"; };
|
||||
890919A6278299590025F4BB /* RuleBook.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RuleBook.swift; sourceTree = "<group>"; };
|
||||
890C245F277BF896009B4A30 /* AgoraViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AgoraViewController.swift; sourceTree = "<group>"; };
|
||||
890C2461277BF935009B4A30 /* CallView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CallView.swift; sourceTree = "<group>"; };
|
||||
890C2463277BFA97009B4A30 /* AgroRep.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AgroRep.swift; sourceTree = "<group>"; };
|
||||
@@ -211,6 +213,14 @@
|
||||
path = sounds;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
890919A5278299490025F4BB /* RuleBook */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
890919A6278299590025F4BB /* RuleBook.swift */,
|
||||
);
|
||||
path = RuleBook;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
890C245E277BF888009B4A30 /* VoiceCallTest */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@@ -285,6 +295,7 @@
|
||||
891A15F62765639B00B26659 /* Views */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
890919A5278299490025F4BB /* RuleBook */,
|
||||
89814681277D83CF00DA46CD /* Convos */,
|
||||
896CE7032770AE3400DB474E /* Inbox */,
|
||||
894E80BF276EFCF500624B72 /* AudioPlayer */,
|
||||
@@ -632,6 +643,7 @@
|
||||
891A160327656FC700B26659 /* HomeView.swift in Sources */,
|
||||
896CE70927712CED00DB474E /* StringExtension.swift in Sources */,
|
||||
89110714277166D6005797FA /* UserFriends.swift in Sources */,
|
||||
890919A7278299590025F4BB /* RuleBook.swift in Sources */,
|
||||
896CE70727711BAB00DB474E /* FindFriendsView.swift in Sources */,
|
||||
891A160B2765732700B26659 /* HomeViewModel.swift in Sources */,
|
||||
89814685277D857300DA46CD /* Convo.swift in Sources */,
|
||||
|
||||
@@ -22,7 +22,7 @@ struct FindFriendsView: View {
|
||||
// main content
|
||||
NavigationView {
|
||||
VStack {
|
||||
Text("You must have someone in your phone contacts to add them. Remember: \(self.authSessionStore.friendsArr.count)/10 spots filled in your circle. 🥬")
|
||||
Text("You must have someone in your phone contacts to add them. Remember: \(self.authSessionStore.friendsArr.count)/\(RuleBook.maxFriends) spots filled in your circle. 🥬")
|
||||
.font(.subheadline)
|
||||
.foregroundColor(Color.gray)
|
||||
.padding(.horizontal)
|
||||
@@ -102,7 +102,7 @@ struct ListContactRow: View {
|
||||
|
||||
@State var showAlert = false
|
||||
@State var alertText = "🌱Confirm Arjun into Your Circle?"
|
||||
@State var alertMessage = "Note: You can have a maximium of 12 people in your circle!"
|
||||
@State var alertMessage = "Note: You can have a maximium of \(RuleBook.maxFriends) people in your circle!"
|
||||
|
||||
var body: some View {
|
||||
if contact.isExisting { // add to circle
|
||||
@@ -122,7 +122,11 @@ struct ListContactRow: View {
|
||||
|
||||
Button {
|
||||
print("showing alert now")
|
||||
// TODO: show alert if circle is full
|
||||
if self.authSessionStore.friendsArr.count >= RuleBook.maxFriends {
|
||||
self.contactsVM.toast = .maxFriendsInCircle
|
||||
return
|
||||
}
|
||||
|
||||
self.showAlert.toggle()
|
||||
|
||||
} label: {
|
||||
@@ -138,7 +142,7 @@ struct ListContactRow: View {
|
||||
primaryButton: .default(Text("Cancel")),
|
||||
secondaryButton: .default(Text("Confirm")) {
|
||||
print("adding contact to circle")
|
||||
if self.authSessionStore.friendsArr.count >= 10 {
|
||||
if self.authSessionStore.friendsArr.count >= RuleBook.maxFriends {
|
||||
self.contactsVM.toast = .maxFriendsInCircle
|
||||
return
|
||||
}
|
||||
@@ -187,6 +191,7 @@ struct ListContactRow: View {
|
||||
UIApplication.shared.open(URL(string: strUrl)!, options: [:], completionHandler: nil)
|
||||
} else {
|
||||
print("phone number is nil of contact")
|
||||
self.contactsVM.toast = .generalError
|
||||
}
|
||||
} label: {
|
||||
Label("Invite", systemImage: "paperplane")
|
||||
|
||||
@@ -312,7 +312,7 @@ struct CircleGridView: View {
|
||||
secondaryButton: .default(Text("Add"), action: {
|
||||
// create user friend if have space in circle
|
||||
// TODO: view models should be able to do this validation, need some way of view models to speak to each other
|
||||
if self.authSessionStore.friendsArr.count >= 10 {
|
||||
if self.authSessionStore.friendsArr.count >= RuleBook.maxFriends {
|
||||
self.innerCircleVM.toast = .maxFriendsInCircle
|
||||
return
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
//
|
||||
// Rules.swift
|
||||
// nirvana-ios
|
||||
//
|
||||
// Created by Arjun Patel on 1/2/22.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
class RuleBook {
|
||||
static let maxFriends = 8
|
||||
}
|
||||
Reference in New Issue
Block a user