Skip to content

[CM-2439] Update UI Message to Indicate Subscription Requirement in Release Mode | iOS SDK #502

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 10, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 12 additions & 5 deletions Sources/Kommunicate/Classes/PricingPlan.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ struct PricingPlan {
let startupPlan = 101
let startMonthlyPlan = 112
let startYearlyPlan = 113
let trialPlan = 111

// Business Plans
let businessPlans = ["trial",
Expand All @@ -41,11 +42,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
}()

let isNotAdmin = userRole != Int16(AL_APPLICATION_WEB_ADMIN.rawValue)

return isReleaseBuild && isNotAdmin && isFreeOrStartOrTrialPlan
}

func isBusinessPlanOrTrialPlan() -> Bool {
Expand Down
Loading