Skip to content

Commit

Permalink
added checks to remove ports (#624)
Browse files Browse the repository at this point in the history
* added checks to remove ports
#REF: #MNT-24096
  • Loading branch information
ankitgoyalgloballogic authored Dec 12, 2023
1 parent 6775153 commit 7bac83c
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import AlfrescoContent
class MultipleSelectionActionMenuViewModel {
private var nodes: [ListNode]
private var menuActions: [[ActionMenu]]
private let excludedActions: [ActionMenuType]
private var excludedActions: [ActionMenuType]
private var coordinatorServices: CoordinatorServices?
weak var delegate: ActionMenuViewModelDelegate?

Expand Down Expand Up @@ -73,6 +73,10 @@ class MultipleSelectionActionMenuViewModel {
} else {
menuActions = MultipleFilesActionMenuGeneric.actions(for: nodes)
}
let isFavoriteAllowed = UIFunction.isFavoriteAllowedForACSVersion()
if !isFavoriteAllowed {
excludedActions.append(contentsOf: [.addFavorite, .removeFavorite])
}

if !excludedActions.isEmpty {
for (index, var actionMenuGroup) in menuActions.enumerated() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import Foundation
import AlfrescoAuth

class AuthenticationParameters: Codable {
var unsecuredDefaultPort = "80"
var securedDefaultPort = "443"
var https = true
var port: String = "443"
var path: String = "alfresco"
Expand All @@ -30,18 +32,12 @@ class AuthenticationParameters: Codable {
var contentURL: String = ""
var fullHostnameURL: String {
var fullFormatURL = String(format: "%@://%@", https ? "https" : "http", hostname)
if !port.isEmpty {
fullFormatURL.append(contentsOf: String(format: ":%@", port))
}
return fullFormatURL
return urlWithPort(fullFormatURL: &fullFormatURL)
}

var fullContentURL: String {
var fullFormatURL = String(format: "%@://%@", https ? "https" : "http", contentURL)
if !port.isEmpty {
fullFormatURL.append(contentsOf: String(format: ":%@", port))
}
return fullFormatURL
return urlWithPort(fullFormatURL: &fullFormatURL)
}

var processAppClientID: String = "activiti-app"
Expand Down Expand Up @@ -82,4 +78,15 @@ class AuthenticationParameters: Codable {
redirectURI: redirectURI.encoding())
return authConfig
}

func urlWithPort(fullFormatURL: inout String) -> String {
if !port.isEmpty {
if https && port != securedDefaultPort {
fullFormatURL.append(contentsOf: String(format: ":%@", port))
} else if !https && port != unsecuredDefaultPort {
fullFormatURL.append(contentsOf: String(format: ":%@", port))
}
}
return fullFormatURL
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -118,14 +118,8 @@ extension RecentScreenCoordinator: ListItemActionDelegate {
from dataSource: ListComponentModelProtocol,
delegate: NodeActionsViewModelDelegate) {
if let navigationViewController = self.navigationViewController {
let isFavoriteAllowed = UIFunction.isFavoriteAllowedForACSVersion()
var excludedActions: [ActionMenuType] = []
if !isFavoriteAllowed {
excludedActions = [.addFavorite, .removeFavorite]
}

let actionMenuViewModel = MultipleSelectionActionMenuViewModel(nodes: nodes,
excludedActions: excludedActions,
coordinatorServices: coordinatorServices)

let nodeActionsModel = NodeActionsViewModel(node: nodes.first,
Expand Down

0 comments on commit 7bac83c

Please sign in to comment.