-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #178 from Alfresco/ADST-583
Adst 583
- Loading branch information
Showing
3 changed files
with
90 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ Pod::Spec.new do |s| | |
s.osx.deployment_target = '10.14' | ||
s.tvos.deployment_target = '12.0' | ||
s.swift_version = '5.0' | ||
s.version = '0.2.66' | ||
s.version = '0.2.67' | ||
s.source = {:git => 'https://github.com/Alfresco/alfresco-ios-swift-api.git', :tag => 'content/'+s.version.to_s} | ||
s.authors = {'Alfresco' => '[email protected]'} | ||
s.license = {:type => 'Apache License Version 2.0', :file => 'AlfrescoContent/LICENSE.md'} | ||
|
36 changes: 36 additions & 0 deletions
36
AlfrescoContent/AlfrescoContent/Classes/Swaggers/MobileConfigApi.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// | ||
// MobileConfigApi.swift | ||
// AlfrescoContent | ||
// | ||
// Created by Vinay Piplani on 11/09/24. | ||
// | ||
|
||
import Foundation | ||
|
||
open class MobileConfigApi: NSObject { | ||
|
||
open class func getMobileConfig(appConfig: String,withCallback completion: @escaping ((_ data: MobileConfigData?,_ error: Error?) -> Void)) { | ||
self.mobileConfig(appConfig: appConfig).execute { response, error in | ||
completion(response?.body, error) | ||
} | ||
} | ||
|
||
/** | ||
- GET Config Json | ||
This API is used to fetch list of menu. This is GET request | ||
*/ | ||
class func mobileConfig(appConfig: String) -> RequestBuilder<MobileConfigData> { | ||
let URLString = AlfrescoContentAPI.hostname + appConfig | ||
let parameters: [String:Any]? = nil | ||
let requestBuilder: RequestBuilder<MobileConfigData>.Type = AlfrescoContentAPI.requestBuilderFactory.getBuilder() | ||
// Create the request and set the appropriate headers | ||
let urlRequest = requestBuilder.init(method: "GET", URLString: URLString, parameters: parameters, isBody: false) | ||
|
||
// Set cache-control headers to force fetching the fresh data | ||
urlRequest.addHeader(name: "Cache-Control", value: "no-cache, no-store, must-revalidate") | ||
urlRequest.addHeader(name: "Pragma", value: "no-cache") | ||
urlRequest.addHeader(name: "Expires", value: "0") | ||
|
||
return urlRequest | ||
} | ||
} |
53 changes: 53 additions & 0 deletions
53
AlfrescoContent/AlfrescoContent/Classes/Swaggers/MobileConfigData.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// | ||
// MobileConfigData.swift | ||
// AlfrescoContent | ||
// | ||
// Created by Vinay Piplani on 11/09/24. | ||
// | ||
|
||
import Foundation | ||
|
||
// Enum for menu IDs | ||
public enum MenuId: String, Codable { | ||
case addFavorite = "app.menu.addFavourite" | ||
case removeFavorite = "app.menu.removeFavourite" | ||
case rename = "app.menu.rename" | ||
case move = "app.menu.move" | ||
case openWith = "app.menu.openWith" | ||
case download = "app.menu.download" | ||
case trash = "app.menu.trash" | ||
case addOffline = "app.menu.addOffline" | ||
case removeOffline = "app.menu.removeOffline" | ||
case restore = "app.menu.restore" | ||
case permanentlyDelete = "app.menu.permanentlyDelete" | ||
case startProcess = "app.menu.startProcess" | ||
|
||
// Fallback for unknown values | ||
case unknown | ||
|
||
public init(from decoder: Decoder) throws { | ||
let container = try decoder.singleValueContainer() | ||
let rawValue = try container.decode(String.self) | ||
self = MenuId(rawValue: rawValue) ?? .unknown | ||
} | ||
} | ||
|
||
// MARK: - AppConfig | ||
public struct MobileConfigData: Codable { | ||
public let featuresMobile: Features | ||
|
||
public enum CodingKeys: String, CodingKey { | ||
case featuresMobile = "features_mobile" | ||
} | ||
} | ||
|
||
// MARK: - Features | ||
public struct Features: Codable { | ||
public let menu: [Menu] | ||
} | ||
|
||
// MARK: - DynamicMenu | ||
public struct Menu: Codable { | ||
public let id: MenuId | ||
public let enabled: Bool | ||
} |