diff --git a/nirvana-ios.xcodeproj/project.pbxproj b/nirvana-ios.xcodeproj/project.pbxproj index 5220a96..1e6ac67 100644 --- a/nirvana-ios.xcodeproj/project.pbxproj +++ b/nirvana-ios.xcodeproj/project.pbxproj @@ -17,7 +17,6 @@ 890919A42781845D0025F4BB /* AlertToast in Frameworks */ = {isa = PBXBuildFile; productRef = 890919A32781845D0025F4BB /* AlertToast */; }; 890919A7278299590025F4BB /* RuleBook.swift in Sources */ = {isa = PBXBuildFile; fileRef = 890919A6278299590025F4BB /* RuleBook.swift */; }; 890919AB2782DC760025F4BB /* ProgressBarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 890919AA2782DC760025F4BB /* ProgressBarView.swift */; }; - 890919B3278424C70025F4BB /* woosh.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = 890919B2278424C70025F4BB /* woosh.mp3 */; }; 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 */; }; @@ -45,6 +44,7 @@ 892179E42765FEB8001E6C60 /* FooterControlsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 892179E32765FEB8001E6C60 /* FooterControlsView.swift */; }; 892179E62765FECD001E6C60 /* FooterControlsViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 892179E52765FECD001E6C60 /* FooterControlsViewModel.swift */; }; 89288ECB27675B9F00E962C4 /* OnboardingTemplateView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 89288ECA27675B9F00E962C4 /* OnboardingTemplateView.swift */; }; + 894E41D92784BB8000A68728 /* woosh.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = 894E41D82784BB8000A68728 /* woosh.mp3 */; }; 894E80BE276ED7A700624B72 /* avatars.swift in Sources */ = {isa = PBXBuildFile; fileRef = 894E80BD276ED7A700624B72 /* avatars.swift */; }; 894E80C1276EFD0500624B72 /* AudioPlayerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 894E80C0276EFD0400624B72 /* AudioPlayerView.swift */; }; 894E80C327702E5900624B72 /* AddBasicInfoViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 894E80C227702E5800624B72 /* AddBasicInfoViewModel.swift */; }; @@ -110,7 +110,6 @@ 8909199D278155920025F4BB /* UserStatusView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserStatusView.swift; sourceTree = ""; }; 890919A6278299590025F4BB /* RuleBook.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RuleBook.swift; sourceTree = ""; }; 890919AA2782DC760025F4BB /* ProgressBarView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProgressBarView.swift; sourceTree = ""; }; - 890919B2278424C70025F4BB /* woosh.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = woosh.mp3; sourceTree = ""; }; 890C245F277BF896009B4A30 /* AgoraViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AgoraViewController.swift; sourceTree = ""; }; 890C2461277BF935009B4A30 /* CallView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CallView.swift; sourceTree = ""; }; 890C2463277BFA97009B4A30 /* AgroRep.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AgroRep.swift; sourceTree = ""; }; @@ -137,6 +136,7 @@ 892179E32765FEB8001E6C60 /* FooterControlsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FooterControlsView.swift; sourceTree = ""; }; 892179E52765FECD001E6C60 /* FooterControlsViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FooterControlsViewModel.swift; sourceTree = ""; }; 89288ECA27675B9F00E962C4 /* OnboardingTemplateView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OnboardingTemplateView.swift; sourceTree = ""; }; + 894E41D82784BB8000A68728 /* woosh.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = woosh.mp3; sourceTree = ""; }; 894E80BD276ED7A700624B72 /* avatars.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = avatars.swift; sourceTree = ""; }; 894E80C0276EFD0400624B72 /* AudioPlayerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AudioPlayerView.swift; sourceTree = ""; }; 894E80C227702E5800624B72 /* AddBasicInfoViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddBasicInfoViewModel.swift; sourceTree = ""; }; @@ -211,8 +211,8 @@ 8909199A277EFDE50025F4BB /* sounds */ = { isa = PBXGroup; children = ( + 894E41D82784BB8000A68728 /* woosh.mp3 */, 8909199B277EFDF30025F4BB /* joinSound.mp3 */, - 890919B2278424C70025F4BB /* woosh.mp3 */, 89091998277EFDCC0025F4BB /* leaveSound.mp3 */, ); path = sounds; @@ -629,7 +629,7 @@ 891A15E827653A7100B26659 /* Preview Assets.xcassets in Resources */, 8909199C277EFDF30025F4BB /* joinSound.mp3 in Resources */, 891A15E527653A7100B26659 /* Assets.xcassets in Resources */, - 890919B3278424C70025F4BB /* woosh.mp3 in Resources */, + 894E41D92784BB8000A68728 /* woosh.mp3 in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/nirvana-ios/Views/InnerCircle/CircleGridView.swift b/nirvana-ios/Views/InnerCircle/CircleGridView.swift index 35f52ed..4c3f74a 100644 --- a/nirvana-ios/Views/InnerCircle/CircleGridView.swift +++ b/nirvana-ios/Views/InnerCircle/CircleGridView.swift @@ -369,8 +369,6 @@ struct CircleGridView: View { } self.animateLiveConvos = true - - self.innerCircleVM.playWoosh() } .onReceive(self.authSessionStore.$messagesArr) {_ in // TODO: don't know if this fires if I am active and I receive a message but that's not something I am allowing right now with the continuous convo feature @@ -383,8 +381,6 @@ struct CircleGridView: View { } // scrollview reader } - - private func haveNewMessageFromFriend(friendDbId: String) -> Bool { if self.authSessionStore.user != nil { let userId = self.authSessionStore.user!.id // O(1) // currUser who is signed in diff --git a/nirvana-ios/Views/InnerCircle/InnerCircleViewModel.swift b/nirvana-ios/Views/InnerCircle/InnerCircleViewModel.swift index 10e32c5..51ece8a 100644 --- a/nirvana-ios/Views/InnerCircle/InnerCircleViewModel.swift +++ b/nirvana-ios/Views/InnerCircle/InnerCircleViewModel.swift @@ -73,6 +73,7 @@ class InnerCircleViewModel: NSObject, ObservableObject { var audioRecorder : AVAudioRecorder! var queuePlayer = AVQueuePlayer() + var avplayer: AVPlayer? private var cachedPlayerItemsDict: [String: URL] = [:] // firebase audio url to local url @Published var isRecording : Bool = false @@ -203,24 +204,7 @@ extension InnerCircleViewModel { return FileManager.default.temporaryDirectory } - func playWoosh() { - if let wooshFilePath = Bundle.main.url(forResource: "woosh", withExtension: "mp3") { - self.stopPlayingAnyAudio() - - print(wooshFilePath) - - let player = AVPlayer(url: wooshFilePath) - player.play() - -// self.queuePlayer = AVQueuePlayer(playerItem: AVPlayerItem(url: wooshFilePath)) -// self.queuePlayer.automaticallyWaitsToMinimizeStalling = false -// self.queuePlayer.play() - } - else { - print("didn't get the ath") - } - } - + } // handling saving device token for notifications @@ -274,6 +258,24 @@ extension InnerCircleViewModel { // everything to do with listening to messages extension InnerCircleViewModel { + func playWoosh() { + if let wooshFilePath = Bundle.main.url(forResource: "woosh", withExtension: "mp3") { + self.stopPlayingAnyAudio() + + print(wooshFilePath) + + self.avplayer = AVPlayer(url: wooshFilePath) + avplayer?.play() + +// self.queuePlayer = AVQueuePlayer(playerItem: AVPlayerItem(url: wooshFilePath)) +// self.queuePlayer.automaticallyWaitsToMinimizeStalling = false +// self.queuePlayer.play() + } + else { + print("didn't get the ath") + } + } + func stopPlayingAnyAudio() { self.queuePlayer.removeAllItems() } diff --git a/nirvana-ios/sounds/woosh.mp3 b/nirvana-ios/sounds/woosh.mp3 index f65c2ce..898a690 100644 Binary files a/nirvana-ios/sounds/woosh.mp3 and b/nirvana-ios/sounds/woosh.mp3 differ