Skip to content

Commit

Permalink
Update ModulesVC.swift
Browse files Browse the repository at this point in the history
  • Loading branch information
justinkumpe committed Jul 27, 2022
1 parent 43d49f6 commit 8f1757a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion ModulesVC/ModulesVC.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ open class ModulesVC: UIViewController, UICollectionViewDelegate, UICollectionVi
open var collectionViewBackgroundColor: UIColor = .clear
///Sets icon cache
public let iconCache = ImageCache(name: "iconCache")
///Sets the title of the alert displayed when user clicks on disabled module
open var disabledAlertTitle: String = "Access Denied"
///Sets the message of the alert displayed when user clicks on disabled module
open var disabledAlertMessage: String = "You do not have access to this module!"

///collectionView used for module icons
open var collectionView: UICollectionView = {
Expand Down Expand Up @@ -136,7 +140,7 @@ open class ModulesVC: UIViewController, UICollectionViewDelegate, UICollectionVi
///didSelectModule is called by default when a collectionView cell is tapped. By default this method will display Access Denied message if module isEnabled=false or perform segue withIdentifier module.action if module.action contains "segue"
open func didSelectModule(_ module: KModule) {
guard module.isEnabled else {
ShowAlert.centerView(theme: .error, title: "Access Denied", message: "You do not have access to \(module.title).", seconds: .infinity, invokeHaptics: true)
ShowAlert.centerView(theme: .error, title: self.disabledAlertTitle, message: self.disabledAlertMessage, seconds: .infinity, invokeHaptics: true)
return
}
if module.action.contains("segue") {
Expand Down

0 comments on commit 8f1757a

Please sign in to comment.