Giter Club home page Giter Club logo

Comments (9)

CaliCastle avatar CaliCastle commented on June 25, 2024

Quote from LouK in Slack discussion:

it seems that the selected state of an item persists across multiple presentations of a menu... is there a way to deselect a selected item, or to not have the selection latched when the menu is dismissed? Looked at the source but I don't see where the selection is maintained...it almost looks like the completion closure in actionSelected's UIView.animate is not executing.

using the manager... looks like this when presenting the menu after previously selecting the middle item:
image

from popmenu.

HackShitUp avatar HackShitUp commented on June 25, 2024

I'm seeing this issue and I thought it was an issue with how I programmed. But after reviewing the documentation countless times and viewing your examples, this bug is getting pretty annoying. Any updates?

from popmenu.

CaliCastle avatar CaliCastle commented on June 25, 2024

@HackShitUp sorry for the inconvenience it had caused you, yeah I am aware of this bug and there will be a patch for all of the issues by the end of month December, thank you for the support!

from popmenu.

CaliCastle avatar CaliCastle commented on June 25, 2024

@HackShitUp for now the easiest way as a workaround would be using the PopMenuViewController instance

from popmenu.

HackShitUp avatar HackShitUp commented on June 25, 2024

@CaliCastle Happy New Year (if you'are around the U.S. haha)! So I do use that in our application, but the issue still persists. Do you know why the carryovers occur? I can try and fix it myself if I can understand the problem

from popmenu.

CaliCastle avatar CaliCastle commented on June 25, 2024

@HackShitUp hi, happy New Years to you too!! Actually this fix is already completed in my local environment I just need to make some adjustments before releasing an update, it'll be sometime later this week, thanks for the support and using PopMenu, I appreciate it!

from popmenu.

HackShitUp avatar HackShitUp commented on June 25, 2024

from popmenu.

CaliCastle avatar CaliCastle commented on June 25, 2024

@HackShitUp fixed in v2.1.2

from popmenu.

HackShitUp avatar HackShitUp commented on June 25, 2024

@CaliCastle I still get this issue whenever I'm presenting it from a UICollectionViewCell.

// Unwrap the 'Capsule' PFObject
        guard capsule != nil else { return }
        
        // MARK: - UINotificationFeedbackGenerator
        let feedbackGenerator = UINotificationFeedbackGenerator()
        feedbackGenerator.notificationOccurred(.success)
        
        // MARK: - PopMenu
        let manager = PopMenuManager.default
        manager.popMenuAppearance.popMenuColor.backgroundColor = .solid(fill: .white)
        manager.popMenuAppearance.popMenuFont = UIFont.demibold(size: 14)
        manager.popMenuAppearance.popMenuCornerRadius = 16
        manager.popMenuAppearance.popMenuItemSeparator = .fill(.groupTableViewBackground, height: 1)
        manager.popMenuShouldDismissOnSelection = true
        
        // Unlock Capsule
        let unlockAction = PopMenuDefaultAction(title: "Unlock", image: UIImage(named: "Unlocked")!, color: UIColor.black) {
            (action: PopMenuAction) in
            // MARK: - PFObject(className: "Capsule")
            self.capsule["isPrivate"] = false
            self.capsule.saveInBackground(block: { (success: Bool, error: Error?) in
                if success {
                    // MARK: - CSAlertManager
                    CSAlertManager.shared.showAlertBanner(title: "✅ Unlocked Album", color: UIColor.black.withAlphaComponent(0.80))
                    
                    DispatchQueue.main.async {
                        // Reset the lockButton
                        self.lockButton.setImage(nil, for: .normal)
                    }
                    
                    // MARK: - NotificationCenter
                    NotificationCenter.default.post(name: GalleryViewController.reloadCapsules, object: nil)
                    
                } else {
                    print(error?.localizedDescription as Any)
                    // MARK: - CSAlertManager
                    CSAlertManager.shared.showAlertBanner(title: "💩 Couldn't Unlock Album", color: UIColor.black.withAlphaComponent(0.80))
                }
            })
        }
        
        // Lock Capsule
        let lockAction = PopMenuDefaultAction(title: "Lock", image: UIImage(named: "Locked")!, color: UIColor.black) {
            (action: PopMenuAction) in
            // MARK: - PFObject(className: "Capsule")
            self.capsule["isPrivate"] = true
            self.capsule.saveInBackground(block: { (success: Bool, error: Error?) in
                if success {
                    // MARK: - CSAlertManager
                    CSAlertManager.shared.showAlertBanner(title: "✅ Locked Album", color: UIColor.black.withAlphaComponent(0.80))
                    
                    DispatchQueue.main.async {
                        // Reset the lockButton
                        self.lockButton.setImage(UIImage(named: "Locked"), for: .normal)
                        self.lockButton.addTarget(self, action: #selector(self.unlockCapsule(_:)), for: .touchUpInside)
                    }
                    
                    // MARK: - NotificationCenter
                    NotificationCenter.default.post(name: GalleryViewController.reloadCapsules, object: nil)
                    
                } else {
                    print(error?.localizedDescription as Any)
                    // MARK: - CSAlertManager
                    CSAlertManager.shared.showAlertBanner(title: "💩 Couldn't Lock Album", color: UIColor.black.withAlphaComponent(0.80))
                }
            })
        }
        
        // Edit Capsule
        let editAction = PopMenuDefaultAction(title: "Edit Name", image: UIImage(named: "Pen")!, color: UIColor.black) {
            (action: PopMenuAction) in
            manager.popMenuDidDismiss = { didSelect in
                // MARK: - CSAlertManager
                CSAlertManager.shared.renameCapsule(self.capsule, completionHandler: { (object: PFObject, success: Bool) in
                    if success {
                        // MARK: - NotificationCenter
                        NotificationCenter.default.post(name: GalleryViewController.reloadCapsules, object: nil)
                    }
                })
            }
        }
        
        // Send Capsule
        let sendAction = PopMenuDefaultAction(title: "Send", image: UIImage(named: "TabChat")!, color: UIColor.black) {
            (action: PopMenuAction) in
            manager.popMenuDidDismiss = { didSelect in
                if didSelect == true {
                    
                    // MARK: - TagUsersViewController
                    let tagUsersVC = TagUsersViewController.init(delegate: self, type: .send, existingUsers: nil, object: self.capsule)
                    // MARK: - CSNavigationController
                    let csNavigationController = CSNavigationController.init(rootViewController: tagUsersVC, type: .pushPop)
                    csNavigationController.presentNavigationFrom(viewController: self.parentViewController!)
                }
            }
        }
        
        // Delete Capsule
        let leaveAction = PopMenuDefaultAction(title: "Leave Album", image: UIImage(named: "LeaveButton")!, color: UIColor.black) {
            (action: PopMenuAction) in
            manager.popMenuDidDismiss = { didSelect in
                if didSelect == true {
                    
                    // MARK: - UIAlertController
                    let alertController = UIAlertController.init(title: "Leave Album?", message: "Are you sure you would like to leave this album? Your friends would have to add you again to add moments to them.", preferredStyle: .actionSheet)
                    
                    // Leave Action
                    let leaveAction = UIAlertAction.init(title: "Leave Album", style: .destructive, handler: { (action: UIAlertAction) in
                        self.capsule.remove(PFUser.current()!.objectId!, forKey: "collaborators")
                        self.capsule.saveInBackground(block: { (success: Bool, error: Error?) in
                            if success {
                                
                                // Remove the 'Capsule' object id
                                PFUser.current()!.remove(self.capsule.objectId!, forKey: "autoSaveKeys")
                                PFUser.current()!.saveInBackground()
                                
                                // MARK: - CSAlertManager
                                CSAlertManager.shared.showAlertBanner(title: "😢 Sad to see you go...", color: UIColor.black.withAlphaComponent(0.80))
                                
                                // MARK: - NotificationCenter
                                NotificationCenter.default.post(name: GalleryViewController.reloadCapsules, object: nil)
                                
                            } else {
                                print(error?.localizedDescription as Any)
                                // MARK: - CSAlertManager
                                CSAlertManager.shared.showAlertBanner(title: "💩 Couldn't Unlock Album", color: UIColor.black.withAlphaComponent(0.80))
                            }
                        })
                    })
                    
                    // Cancel Action
                    let cancelAction = UIAlertAction.init(title: "Cancel", style: .cancel, handler: { (action: UIAlertAction) in
                        alertController.dismiss(animated: true, completion: nil)
                    })
                    
                    alertController.addAction(leaveAction)
                    alertController.addAction(cancelAction)
                    self.parentViewController?.present(alertController, animated: true, completion: nil)
                }
            }
        }

        if capsule!.value(forKey: "isPrivate") as! Bool == false {
            //
            // Lock
            //
            manager.addAction(lockAction)
        } else {
            //
            // Unlock
            //
            manager.addAction(unlockAction)
        }
        manager.addAction(editAction)
        manager.addAction(sendAction)
        manager.addAction(leaveAction)
        manager.present(sourceView: self)

from popmenu.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.