diff --git a/HabitRPG/UI/Login/LoginViewModel.swift b/HabitRPG/UI/Login/LoginViewModel.swift index f85a86177..5033f69e3 100644 --- a/HabitRPG/UI/Login/LoginViewModel.swift +++ b/HabitRPG/UI/Login/LoginViewModel.swift @@ -180,7 +180,7 @@ class LoginViewModel: LoginViewModelType, LoginViewModelInputs, LoginViewModelOu passwordText = self.prefillPasswordProperty.signal passwordRepeatText = self.prefillPasswordRepeatProperty.signal - showNextViewController = onSuccessfulLoginProperty.signal.combineLatest(with: authTypeProperty.signal) + showNextViewController = onSuccessfulLoginProperty.signal.withLatest(from: authTypeProperty.signal) .map({ (isNewUser, authType) -> String in if authType == .login && !isNewUser { return "MainSegue" diff --git a/HabitRPG/UI/Purchases/GiftSubscriptionViewController.swift b/HabitRPG/UI/Purchases/GiftSubscriptionViewController.swift index b5d8b54ad..3f19b2965 100644 --- a/HabitRPG/UI/Purchases/GiftSubscriptionViewController.swift +++ b/HabitRPG/UI/Purchases/GiftSubscriptionViewController.swift @@ -225,7 +225,7 @@ class GiftSubscriptionViewController: UIHostingController let alertController = HabiticaAlertController(title: L10n.giftConfirmationTitle, message: body) alertController.addCloseAction { _ in DispatchQueue.main.asyncAfter(deadline: DispatchTime.now()+1) { - self.performSegue(withIdentifier: "unwindToList", sender: self) + self.dismiss() } } alertController.show() diff --git a/HabitRPG/Utilities/NotificationManager.swift b/HabitRPG/Utilities/NotificationManager.swift index dee0f8310..d69f61bee 100644 --- a/HabitRPG/Utilities/NotificationManager.swift +++ b/HabitRPG/Utilities/NotificationManager.swift @@ -157,7 +157,7 @@ class NotificationManager { static func displayLoginIncentive(notification: NotificationProtocol) -> Bool { guard let loginIncentiveNotification = notification as? NotificationLoginIncentiveProtocol else { - return false + return true } let nextRewardAt = loginIncentiveNotification.nextRewardAt userRepository.retrieveUser().observeValues { user in diff --git a/HabitRPG/Utilities/SoundManager.swift b/HabitRPG/Utilities/SoundManager.swift index 301639b8c..d419c2646 100644 --- a/HabitRPG/Utilities/SoundManager.swift +++ b/HabitRPG/Utilities/SoundManager.swift @@ -151,17 +151,20 @@ class SoundManager { if currentTheme == SoundTheme.none { return } - guard let url = soundsDirectory?.appendingPathComponent("\(currentTheme.rawValue)/\(effect.rawValue).mp3") else { - return - } - - if !FileManager.default.fileExists(atPath: url.path) { - return - } - let queue = DispatchQueue(label: "sound", attributes: .concurrent) queue.async {[weak self] in do { + guard let theme = self?.currentTheme.rawValue else { + return + } + guard let url = self?.soundsDirectory?.appendingPathComponent("\(theme)/\(effect.rawValue).mp3") else { + return + } + + if !FileManager.default.fileExists(atPath: url.path) { + return + } + try AVAudioSession.sharedInstance().setCategory(.ambient, mode: .default) try AVAudioSession.sharedInstance().setActive(true) self?.player = try? AVAudioPlayer(contentsOf: url, fileTypeHint: AVFileType.mp3.rawValue) diff --git a/HabitRPG/Views/GroupInvitationListView.swift b/HabitRPG/Views/GroupInvitationListView.swift index 772275a5c..639462683 100644 --- a/HabitRPG/Views/GroupInvitationListView.swift +++ b/HabitRPG/Views/GroupInvitationListView.swift @@ -32,6 +32,7 @@ class GroupInvitationListView: UIView { let view = GroupInvitationView() view.set(invitation: invitation) view.responseAction = {[weak self] didAccept in + if !invitation.isValid { return } guard let groupID = invitation.id else { return }