Compare commits

...
6 Commits
Author SHA1 Message Date
Florian Gabach 8ad819052c Bump to 2.1.2 2018-02-26 14:30:51 +01:00
Florian Gabach 318d3e1f8e Use DispatchGroup for download licences 2018-02-26 14:22:37 +01:00
Florian Gabach a7a6a1b315 Clean 2018-02-22 17:12:06 +01:00
Florian Gabach 96a45035a9 Update README.md 2017-12-26 14:15:15 +01:00
Florian Gabach 003ca5c285 Add framework.zip 2017-12-10 15:22:27 +01:00
Florian Gabach bc2e69440c Bump to 2.1.1 2017-12-10 15:18:17 +01:00
23 changed files with 37 additions and 41 deletions
+9
View File
@@ -1,5 +1,14 @@
Changelog
==========
### 2.1.2
- Use DispatchGroup for download
### 2.1.1
- Hide close button when push the controller
### 2.1.0
- Add push transition with `pushOpenSourceController(from: self)`
Binary file not shown.
@@ -19,6 +19,7 @@
76EAA8911E93F67B009A41DA /* Array+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 76EAA8901E93F67B009A41DA /* Array+Extensions.swift */; };
76EAA8941E93F681009A41DA /* OpenSourceController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 76EAA8921E93F681009A41DA /* OpenSourceController.swift */; };
76EAA8951E93F681009A41DA /* OpenSourceViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 76EAA8931E93F681009A41DA /* OpenSourceViewController.swift */; };
C33E4D96204442AC00142EE6 /* CHANGELOG.md in Resources */ = {isa = PBXBuildFile; fileRef = C33E4D95204442AC00142EE6 /* CHANGELOG.md */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
@@ -36,6 +37,7 @@
76EAA8901E93F67B009A41DA /* Array+Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "Array+Extensions.swift"; path = "../../Sources/Extensions/Array+Extensions.swift"; sourceTree = "<group>"; };
76EAA8921E93F681009A41DA /* OpenSourceController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = OpenSourceController.swift; path = ../../Sources/Controller/OpenSourceController.swift; sourceTree = "<group>"; };
76EAA8931E93F681009A41DA /* OpenSourceViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = OpenSourceViewController.swift; path = ../../Sources/Controller/OpenSourceViewController.swift; sourceTree = "<group>"; };
C33E4D95204442AC00142EE6 /* CHANGELOG.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; name = CHANGELOG.md; path = ../CHANGELOG.md; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -52,6 +54,7 @@
76EAA8581E93F2CC009A41DA = {
isa = PBXGroup;
children = (
C33E4D95204442AC00142EE6 /* CHANGELOG.md */,
76EAA8631E93F2CC009A41DA /* OpenSourceControllerDemo */,
76EAA8621E93F2CC009A41DA /* Products */,
);
@@ -157,6 +160,7 @@
76EAA86F1E93F2CC009A41DA /* LaunchScreen.storyboard in Resources */,
76EAA86C1E93F2CC009A41DA /* Assets.xcassets in Resources */,
76EAA86A1E93F2CC009A41DA /* Main.storyboard in Resources */,
C33E4D96204442AC00142EE6 /* CHANGELOG.md in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -41,7 +41,7 @@
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="476" y="138.98050974512745"/>
<point key="canvasLocation" x="815.20000000000005" y="138.98050974512745"/>
</scene>
</scenes>
</document>
@@ -14,14 +14,8 @@ class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
// MARK: - Action
/// Handle button click & show the controller with licences
@@ -49,10 +43,10 @@ class ViewController: UIViewController {
url: "https://raw.githubusercontent.com/kishikawakatsumi/KeychainAccess/master/LICENSE")]
// Present controller
openSourceVC.pushOpenSourceController(from: self)
openSourceVC.presentOpenSourceController(from: self)
}
// Customization
// MARK: - Customization
fileprivate func controllerCustomUI(openSourceVC: OpenSourceController) {
// Navigation bar title
Binary file not shown.
+1 -1
View File
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'OpenSourceController'
s.version = '2.1.0'
s.version = '2.1.2'
s.summary = 'Display all the librarys licence used in your application. Enjoy !'
s.description = 'Display a screen with all licence used in your apply can be painful to maintain. OpenSourceController was built to respond to this problem. OpenSourceController is a simple parser to display the licences which are used in your application.'
s.homepage = 'https://github.com/floriangbh/OpenSourceController'
-8
View File
@@ -124,14 +124,6 @@ OpenSourceController is currently write in english. If you need translation for
"Unable to load this licence." = "<your_translation>";
```
## Applications
Some applications already use this controller like :
- [Troll Generator](https://itunes.apple.com/fr/app/troll-generator/id1038097542?mt=8)
- [Giraf](https://itunes.apple.com/fr/app/giraf/id1136592561?mt=8)
What about yours ? If your application also use this library, feel free to contact me or make pull request on the README 😁
## Author
Florian Gabach, florian.gabach@gmail.com
@@ -40,6 +40,7 @@ public class OpenSourceController: NSObject {
open func pushOpenSourceController(from: UIViewController) {
// Create open source controller
let licenceController = OpenSourceViewController()
licenceController.showCloseButton = false // Don't show close button
// Init licence
licenceController.licences = self.licences
@@ -29,9 +29,12 @@ class OpenSourceViewController: UITableViewController {
/// Contains all licence object before downloaded
internal var licences: [LicenceFile]?
// Controller configuration for customization
/// Controller configuration for customization
internal var config = OpenSourceControllerConfig()
/// Do we need to show the close button ? (disable if push the controller)
internal var showCloseButton: Bool = true
/// Contains all licences object after downloaded
fileprivate var downloadedLicence: [LicenceFile]? {
didSet {
@@ -58,7 +61,11 @@ class OpenSourceViewController: UITableViewController {
fileprivate func prepare() {
self.prepareTableView()
self.prepareActivityIndicator()
self.prepareCloseButton()
if showCloseButton {
self.prepareCloseButton()
}
self.prepareStyle()
self.prepareLicences()
}
@@ -7,7 +7,6 @@
import Foundation
extension Array {
/// Get an index safely
func get(at index: Int) -> Element? {
guard index >= 0
+9 -11
View File
@@ -16,22 +16,20 @@ class LicenceDownloader: NSObject {
class func downloadLicences(licences: [LicenceFile],
config: OpenSourceControllerConfig,
completion: @escaping () -> Void) {
// Number of licences
let licenceCount = licences.count
// Already licence downloaded
var alreadyDownloaded = 0
let licenceGroupe = DispatchGroup()
// Download licence's detail for every lience
for licence in licences {
licenceGroupe.enter()
licence.downloadLicenceDetail(config: config, completion: { () in
alreadyDownloaded += 1
// If this is the last licence, perfom completion
if licenceCount == alreadyDownloaded {
completion()
}
licenceGroupe.leave()
})
}
// When everything is downloaded
licenceGroupe.notify(queue: .main) {
completion()
}
}
}
@@ -22,14 +22,6 @@ class OpenSourceTableViewCell: UITableViewCell {
super.init(coder: aDecoder)
}
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
}
override func layoutSubviews() {
super.layoutSubviews()
}
// MARK: - Prepare
func prepareCellComponent() {