diff --git a/Sources/Kommunicate/Classes/KMConversationListViewController.swift b/Sources/Kommunicate/Classes/KMConversationListViewController.swift index 2c85106c..3d2c231d 100644 --- a/Sources/Kommunicate/Classes/KMConversationListViewController.swift +++ b/Sources/Kommunicate/Classes/KMConversationListViewController.swift @@ -486,7 +486,7 @@ public class KMConversationListViewController: ALKBaseViewController, Localizabl } override public func showAccountSuspensionView() { - let accountVC = ALKAccountSuspensionController() + let accountVC = ALKAccountSuspensionController(configuration: configuration) present(accountVC, animated: true, completion: nil) accountVC.isModalInPresentation = true accountVC.closePressed = { [weak self] in @@ -621,7 +621,7 @@ public class KMConversationListViewController: ALKBaseViewController, Localizabl } private func checkPlanAndShowSuspensionScreen() { - let accountVC = ALKAccountSuspensionController() + let accountVC = ALKAccountSuspensionController(configuration: configuration) accountVC.isModalInPresentation = true guard PricingPlan.shared.showSuspensionScreen() else { return } present(accountVC, animated: true, completion: nil) diff --git a/Sources/Kommunicate/Classes/KMConversationViewController.swift b/Sources/Kommunicate/Classes/KMConversationViewController.swift index 1adce2d2..152336c7 100644 --- a/Sources/Kommunicate/Classes/KMConversationViewController.swift +++ b/Sources/Kommunicate/Classes/KMConversationViewController.swift @@ -827,8 +827,8 @@ open class KMConversationViewController: ALKConversationViewController, KMUpdate } private func checkPlanAndShowSuspensionScreen() { - let accountVC = ALKAccountSuspensionController() - accountVC.isModalInPresentation = true + let accountVC = ALKAccountSuspensionController(configuration: configuration) + accountVC.isModalInPresentation = true guard PricingPlan.shared.showSuspensionScreen() else { return } present(accountVC, animated: true, completion: nil) accountVC.closePressed = { [weak self] in diff --git a/Sources/Kommunicate/Classes/PricingPlan.swift b/Sources/Kommunicate/Classes/PricingPlan.swift index 047df7f5..c620d6d2 100644 --- a/Sources/Kommunicate/Classes/PricingPlan.swift +++ b/Sources/Kommunicate/Classes/PricingPlan.swift @@ -19,6 +19,8 @@ struct PricingPlan { let startupPlan = 101 let startMonthlyPlan = 112 let startYearlyPlan = 113 + let trialPlan = 111 + let churnedPlan = 100 // Business Plans let businessPlans = ["trial", @@ -41,11 +43,17 @@ struct PricingPlan { func showSuspensionScreen() -> Bool { let isReleaseBuild = !utility.isThisDebugBuild() - let isFreePlan = userDefaultsHandler.getUserPricingPackage() == startupPlan - let isStartPlan = (userDefaultsHandler.getUserPricingPackage() == startMonthlyPlan || userDefaultsHandler.getUserPricingPackage() == startYearlyPlan) - let isNotAgent = userDefaultsHandler.getUserRoleType() != Int16(AL_APPLICATION_WEB_ADMIN.rawValue) - guard isReleaseBuild, isNotAgent, isFreePlan || isStartPlan else { return false } - return true + let userPlan = userDefaultsHandler.getUserPricingPackage() + let userRole = userDefaultsHandler.getUserRoleType() + + let isFreeOrStartOrTrialPlan: Bool = { + let startPlans = [startMonthlyPlan, startYearlyPlan] + return userPlan == startupPlan || startPlans.contains(Int(userPlan)) || userPlan == trialPlan || userPlan == churnedPlan + }() + + let isNotAdmin = userRole != Int16(AL_APPLICATION_WEB_ADMIN.rawValue) + + return isReleaseBuild && isNotAdmin && isFreeOrStartOrTrialPlan } func isBusinessPlanOrTrialPlan() -> Bool {