Skip to content

Commit

Permalink
minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Valentin committed May 2, 2024
1 parent 9ae1f87 commit 408afb6
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 8 deletions.
4 changes: 3 additions & 1 deletion MediaPickerExpample/MediaPickerExpample/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ final class ViewController: UIViewController {
mp?.showMediaPicker(
configuration: { [weak self] (config) in
guard let strongSelf = self else { return MPConfigurationMaker.default }
return MPConfigurationMaker(uiConfig: strongSelf.uiConfig, generalConfig: strongSelf.generalConfig)
return config
.setUIConfiguration(strongSelf.uiConfig)
.setGeneralConfiguration(strongSelf.generalConfig)
//---- or ----
//return config
// .setShowCameraCell(false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,10 @@ extension MPConfigurationMaker {
generalConfig.stringCatalogType = value
return self
}

@discardableResult
public func setGeneralConfiguration(_ value: MPGeneralConfiguration) -> MPConfigurationMakerExtendable {
generalConfig = value
return self
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,10 @@ extension MPConfigurationMaker {
uiConfig.showCameraCell = value
return self
}

@discardableResult
public func setUIConfiguration(_ value: MPUIConfiguration) -> MPConfigurationMakerExtendable {
uiConfig = value
return self
}
}
9 changes: 2 additions & 7 deletions Sources/General/MPConfigurationMaker.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public protocol MPUIConfigMakerExtendable: NSObjectProtocol {
func setNavigationAppearance(_ value: MPNavigationAppearance) -> MPConfigurationMakerExtendable
func setPrimaryBackgroundColor(_ value: UIColor) -> MPConfigurationMakerExtendable
func setShowCameraCell(_ value: Bool) -> MPConfigurationMakerExtendable
func setUIConfiguration(_ value: MPUIConfiguration) -> MPConfigurationMakerExtendable
}

public protocol MPGeneralConfigMakerExtendable: NSObjectProtocol {
Expand All @@ -42,13 +43,13 @@ public protocol MPGeneralConfigMakerExtendable: NSObjectProtocol {
func setBundleLangsDeploy(_ value: Bundle) -> MPConfigurationMakerExtendable
func setKeysLangsDeploy(_ value: [String: String]) -> MPConfigurationMakerExtendable
func setStringCatalogType(_ value: MPGeneralConfiguration.StringCatalogType) -> MPConfigurationMakerExtendable
func setGeneralConfiguration(_ value: MPGeneralConfiguration) -> MPConfigurationMakerExtendable
}

public protocol MPConfigurationMakerExtendable: MPUIConfigMakerExtendable, MPGeneralConfigMakerExtendable {
var uiConfig: MPUIConfiguration { get }
var generalConfig: MPGeneralConfiguration { get }
static var `default`: MPConfigurationMakerExtendable { get }
init(uiConfig: MPUIConfiguration, generalConfig: MPGeneralConfiguration)
}

public final class MPConfigurationMaker: NSObject, MPConfigurationMakerExtendable {
Expand All @@ -62,10 +63,4 @@ public final class MPConfigurationMaker: NSObject, MPConfigurationMakerExtendabl
override init() {
super.init()
}

public convenience init(uiConfig: MPUIConfiguration, generalConfig: MPGeneralConfiguration) {
self.init()
self.uiConfig = uiConfig
self.generalConfig = generalConfig
}
}

0 comments on commit 408afb6

Please sign in to comment.