Commit fad3d687 authored by David Cordero's avatar David Cordero Committed by Carola Nitz

Add Ruby and Swift linters and PR template

Add Swift and Ruby linters
Define PR template for GitHub
Define lint lane
Add lint step to circleci
Fix linter issues in Ruby and Swift code
parent 52352cd5
<!-- Thanks for contributing to _vlc-ios_! Before you submit your pull request, please make sure to check the following boxes by putting an x in the [ ] (don't: [x ], [ x], do: [x]) -->
### Checklist
- [ ] I've run `bundle exec fastlane test` from the root directory to see all new and existing tests pass
- [ ] I've followed the [vlc-ios code style](Docs/CodingStyle.md) and run `bundle exec fastlane lint` to ensure the code style is valid
- [ ] I've read the [Contribution Guidelines](https://github.com/videolan/vlc-ios#contribute)
- [ ] I've updated the documentation if necessary.
### Description
<!-- Describe your changes in detail -->
AllCops:
Include:
- '**/fastlane/Fastfile'
Exclude:
- Gemfile
- Podfile
- '**/Pods'
- '**/fastlane/Snapfile'
Documentation:
Enabled: false
Style/FrozenStringLiteralComment:
Enabled: false
Metrics/AbcSize:
Max: 20
Metrics/MethodLength:
Max: 30
Metrics/BlockLength:
Max: 30
Metrics/LineLength:
Max: 250
whitelist_rules:
- closing_brace
- colon
- comma
- control_statement
- custom_rules
- empty_count
- leading_whitespace
- legacy_cggeometry_functions
- legacy_constant
- legacy_constructor
- mark
- opening_brace
- operator_whitespace
- private_unit_test
- redundant_nil_coalesing
- redundant_string_enum_value
- return_arrow_whitespace
- syntactic_sugar
- trailing_semicolon
- void_return
excluded:
- Pods
- .bundle
colon:
apply_to_dictionaries: false
custom_rules:
equal_sign_whitespace:
message: "Expected only one space before and after ="
regex: "(([ ]{2,}=)|(=[ ]{2,}))"
{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf390
\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;\f1\fnil\fcharset0 Monaco;}
{\colortbl;\red255\green255\blue255;\red0\green134\blue2;\red195\green0\blue0;}
\paperw12240\paperh15840\vieww18380\viewh12620\viewkind0
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\qc
\f0\fs36 \cf0 Coding Rules\
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural
\fs24 \cf0 \
\fs28 Cocoa coding style for the naming.\
\
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\sl480\slmult1\pardirnatural
\f1\fs20 \cf0 variableNaming
\f0\fs28 variable should use capitalization on all word expect the first and never '_' ie\
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\fi540\pardirnatural
\b\fs24 \cf2 RIGHT\
\f1\b0\fs18 \cf0 BOOL isFirstTimeReading;\
int age;\
\f0\fs24 \
\b \cf3 WRONG\
\f1\b0\fs18 \cf0 BOOL is_first_time_reading;\
int Age;\
int isFirstTimeReading_ever;\
\
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\sl480\slmult1\pardirnatural
\f0\fs28 \cf0 Objective-C Instance variable must be prefixed with _\
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\fi540\pardirnatural
\b\fs24 \cf2 RIGHT\
\f1\b0\fs18 \cf0 @interface Object \{\
BOOL _isFirstTimeReading;\
int _age;\
\}\
\f0\fs24 \
\b \cf3 WRONG\
\f1\b0\fs18 \cf0 @interface Object \{\
BOOL isFirstTimeReading;\
int age;\
\}
\f0\fs28 \
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural
\fs24 \cf0 \
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\sl480\slmult1\pardirnatural
\f1\fs20 \cf0 Pointer *
\f0\fs28 must be preceded with a space and with no space after ie\
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\fi540\pardirnatural
\b\fs24 \cf2 RIGHT\
\f1\b0\fs18 \cf0 void *pointer;\
\f0\fs24 \
\b \cf3 WRONG\
\f1\b0\fs18 \cf0 void * pointer;\
void* pointer;\
void*pointer;\
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural
\f0\fs24 \cf0 \
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\sl480\slmult1\pardirnatural
\f1\fs20 \cf0 if
\f0\fs28 ,
\f1\fs18 switch
\f0\fs28 , and other keyword that are not function but takes parameter should have a space before ()\
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\fi540\pardirnatural
\b\fs24 \cf2 RIGHT\
\f1\b0\fs18 \cf0 if (a) \{\
...\
\}\
function();\
\f0\fs24 \
\b \cf3 WRONG\
\f1\b0\fs18 \cf0 if( a )\
if ( a )\
if(a)\
function ();\
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural
\f0\fs24 \cf0 \
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\sl480\slmult1\pardirnatural
\f1\fs18 \cf0 \{\}
\f0\fs28 usage\
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\li540\pardirnatural
\b\fs24 \cf2 RIGHT\
\f1\b0\fs18 \cf0 if (a) \{\
...\
\}\
while (a) \{\
...\
\}\
void function()\
\{\
...\
\}\
- (void)functionWithParameter:(BOOL)parameter\
\{\
...\
\}\
\f0\b\fs24 \cf3 WRONG
\b0 \cf0 \
\f1\fs18 - (void)function \{\
...\
\}\
if (a)\
\{\
...\
\}\
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural
\f0\fs24 \cf0 \
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\sl480\slmult1\pardirnatural
\fs28 \cf0 Prefer early
\f1\fs18 return
\f0\fs28 ie:\
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\fi540\pardirnatural
\b\fs24 \cf2 PREFER\
\f1\b0\fs18 \cf0 if (!a)\
return;\
\f0\fs24 \
\b \cf3 OVER\
\f1\b0\fs18 \cf0 if (a) \{\
...\
...\
\}\
\f0\fs24 \
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\sl480\slmult1\pardirnatural
\fs28 \cf0 Objective C code - Don't call multiply the same method\
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\li540\pardirnatural
\b\fs24 \cf2 RIGHT\
\f1\b0\fs18 \cf0 NSWindow *window = [self window];\
NSRect frame = [window frame];\
frame.origin.x = 0;\
[window setFrame:frame display:NO];\
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\fi540\pardirnatural
\f0\b\fs24 \cf3 WRONG\
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\li540\pardirnatural
\f1\b0\fs18 \cf0 NSRect frame = [[self window] frame];\
frame.origin.x = 0;\
[[self window] setFrame:frame display:NO];\
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\sl480\slmult1\pardirnatural
\f0\fs28 \cf0 objectAtIndex is gone - keep it like this\
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\li540\pardirnatural
\b\fs24 \cf2 RIGHT\
\f1\b0\fs18 \cf0 NSArray *array;\
\'85filled with lots of stuff\
id object = array[index];\
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\fi540\pardirnatural
\f0\b\fs24 \cf3 WRONG\
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\li540\pardirnatural
\f1\b0\fs18 \cf0 NSArray *array;\
\'85filled with lots of stuff\
id object = [array objectAtIndex:index];\
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\sl480\slmult1\pardirnatural
\f0\fs28 \cf0 NSArray literals improve readability - use them\
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\li540\pardirnatural
\b\fs24 \cf2 RIGHT\
\f1\b0\fs18 \cf0 NSArray *array = @[obj1, obj2, obj3];\
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\fi540\pardirnatural
\f0\b\fs24 \cf3 WRONG\
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\li540\pardirnatural
\f1\b0\fs18 \cf0 NSArray *array = [NSArray arrayWithObjects: obj1, obj2, obj3, nil];\
}
\ No newline at end of file
# Coding Rules
This document defines Swift and Objective-C code style rules for this project.
## Table of Contents
* [Swift](#swift)
* [Objective-C](#objective-c)
# Objective-c code style
## Swift
The swift code style rules are defined by [this set of swiftlint rules](../.swiftlint.yml)
## Objective-C
Variable names should use capitalization on all word expect the first, and never '_' ie
**Right:**
```obj-c
BOOL isFirstTimeReading;
int age;
NSArray *myArray;
```
**Wrong:**
```objc-c
BOOL is_first_time_reading;
int Age;
int isFirstTimeReading_ever;
```
Objective-C Instance variables must be prefixed with _
**Right:**
```obj-c
@interface Object {
BOOL _isFirstTimeReading;
int _age;
}
```
**Wrong:**
```objc-c
@interface Object {
BOOL isFirstTimeReading;
int age;
}
```
Pointer * must be preceded with a space and with no space after ie
**Right:**
```obj-c
void *pointer;
```
**Wrong:**
```objc-c
void * pointer;
void* pointer;
void*pointer;
```
If, switch, and other keyword that are not function but takes parameter should have a space before ()
**Right:**
```obj-c
if (a) {
...
}
function();
```
**Wrong:**
```objc-c
if( a )
if ( a )
if(a)
function ();
```
Brackets usage
**Right:**
```obj-c
if (a) {
...
}
while (a) {
...
}
void function()
{
...
}
- (void)functionWithParameter:(BOOL)parameter
{
...
}
```
**Wrong:**
```objc-c
- (void)function {
...
}
if (a)
{
...
}
```
Prefer early return ie:
**Prefer:**
```obj-c
if (!a)
return;
```
**Over:**
```objc-c
if (a) {
...
...
}
```
Objective C code - Don't call multiply the same method.
**Right:**
```obj-c
NSWindow *window = [self window];
NSRect frame = [window frame];
frame.origin.x = 0;
[window setFrame:frame display:NO];
```
**Wrong:**
```objc-c
NSRect frame = [[self window] frame];
frame.origin.x = 0;
[[self window] setFrame:frame display:NO];
objectAtIndex is gone - keep it like this
```
**Right:**
```obj-c
NSArray *array;
filled with lots of stuff
id object = array[index];
```
**Wrong:**
```objc-c
NSArray *array;
…filled with lots of stuff
id object = [array objectAtIndex:index];
NSArray literals improve readability - use them
```
**Right:**
```obj-c
NSArray *array = @[obj1, obj2, obj3];
```
**Wrong:**
```objc-c
NSArray *array = [NSArray arrayWithObjects: obj1, obj2, obj3, nil];
```
source "https://rubygems.org"
source 'https://rubygems.org'
gem 'fastlane', '2.82.0'
gem 'cocoapods', '1.4.0'
gem 'xcode-install', '2.3.1'
gem 'xcodeproj', '1.5.6'
gem 'cocoapods', '~> 1.4.0'
gem 'fastlane', '~> 2.82.0'
gem 'rubocop', '~> 0.54.0'
gem 'xcode-install', '~> 2.3.1'
gem 'xcodeproj', '~> 1.5.6'
plugins_path = File.join(File.dirname(__FILE__), 'fastlane', 'Pluginfile')
eval_gemfile(plugins_path) if File.exist?(plugins_path)
GEM
remote: https://rubygems.org/
specs:
CFPropertyList (2.3.6)
CFPropertyList (3.0.0)
activesupport (4.2.10)
i18n (~> 0.7)
minitest (~> 5.1)
......@@ -9,6 +9,7 @@ GEM
tzinfo (~> 1.1)
addressable (2.5.2)
public_suffix (>= 2.0.2, < 4.0)
ast (2.4.0)
atomos (0.1.2)
babosa (1.0.2)
claide (1.0.2)
......@@ -56,7 +57,7 @@ GEM
unf (>= 0.0.5, < 1.0.0)
dotenv (2.2.1)
escape (0.0.4)
excon (0.60.0)
excon (0.62.0)
faraday (0.14.0)
multipart-post (>= 1.2, < 3)
faraday-cookie_jar (0.0.6)
......@@ -99,9 +100,10 @@ GEM
xcodeproj (>= 1.5.2, < 2.0.0)
xcpretty (>= 0.2.4, < 1.0.0)
xcpretty-travis-formatter (>= 0.0.3)
fastlane-plugin-ruby (0.1.3)
fourflusher (2.0.1)
fuzzy_match (2.0.4)
gh_inspector (1.1.2)
gh_inspector (1.1.3)
google-api-client (0.13.6)
addressable (~> 2.5, >= 2.5.1)
googleauth (~> 0.5)
......@@ -135,23 +137,36 @@ GEM
mime-types-data (3.2016.0521)
mini_magick (4.5.1)
minitest (5.11.3)
molinillo (0.6.4)
molinillo (0.6.5)
multi_json (1.13.1)
multi_xml (0.6.0)
multipart-post (2.0.0)
nanaimo (0.2.3)
nanaimo (0.2.4)
nap (1.1.0)
netrc (0.11.0)
os (0.9.6)
parallel (1.12.1)
parser (2.5.0.5)
ast (~> 2.4.0)
plist (3.4.0)
powerpack (0.1.1)
public_suffix (2.0.5)
rainbow (3.0.0)
representable (3.0.4)
declarative (< 0.1.0)
declarative-option (< 0.2.0)
uber (< 0.2.0)
retriable (3.1.1)
rouge (2.0.7)
rubocop (0.54.0)
parallel (~> 1.10)
parser (>= 2.5)
powerpack (~> 0.1)
rainbow (>= 2.2.2, < 4.0)
ruby-progressbar (~> 1.7)
unicode-display_width (~> 1.0, >= 1.0.1)
ruby-macho (1.1.0)
ruby-progressbar (1.9.0)
rubyzip (1.2.1)
security (0.1.3)
signet (0.8.1)
......@@ -176,12 +191,15 @@ GEM
unf_ext (0.0.7.5)
unicode-display_width (1.3.0)
word_wrap (1.0.0)
xcodeproj (1.5.6)
CFPropertyList (~> 2.3.3)
xcode-install (2.3.1)
claide (>= 0.9.1, < 1.1.0)
fastlane (>= 2.1.0, < 3.0.0)
xcodeproj (1.5.7)
CFPropertyList (>= 2.3.3, < 4.0)
atomos (~> 0.1.2)
claide (>= 1.0.2, < 2.0)
colored2 (~> 3.1)
nanaimo (~> 0.2.3)
nanaimo (~> 0.2.4)
xcpretty (0.2.8)
rouge (~> 2.0.7)
xcpretty-travis-formatter (1.0.0)
......@@ -191,8 +209,12 @@ PLATFORMS
ruby
DEPENDENCIES
cocoapods (= 1.4.0)
fastlane (= 2.82.0)
cocoapods (~> 1.4.0)
fastlane (~> 2.82.0)
fastlane-plugin-ruby
rubocop (~> 0.54.0)
xcode-install (~> 2.3.1)
xcodeproj (~> 1.5.6)
BUNDLED WITH
1.16.1
......@@ -10,6 +10,7 @@ def shared_pods
pod 'VLC-WhiteRaccoon'
pod 'VLC-LiveSDK', '5.7.0x'
pod 'ObjectiveDropboxOfficial', :git => 'git://github.com/carolanitz/dropbox-sdk-obj-c.git' #update ios platform version
pod 'SwiftLint', '~> 0.25.0'
end
def iOS_pods
......
......@@ -52,6 +52,7 @@ PODS:
- xmlrpc
- PAPasscode (1.0)
- RESideMenu (4.0.7)
- SwiftLint (0.25.0)
- TVVLCKit (3.0.2)
- upnpx (1.4.0)
- VLC-LiveSDK (5.7.0x)
......@@ -79,6 +80,7 @@ DEPENDENCIES:
- OROpenSubtitleDownloader (from `https://github.com/orta/OROpenSubtitleDownloader.git`, commit `0509eac2`)
- PAPasscode (~> 1.0)
- RESideMenu (~> 4.0.7)
- SwiftLint (~> 0.25.0)
- TVVLCKit (= 3.0.2)
- upnpx (~> 1.4.0)
- VLC-LiveSDK (= 5.7.0x)
......@@ -139,6 +141,7 @@ SPEC CHECKSUMS:
OROpenSubtitleDownloader: 154b8c08acbf8836b77ac259018dc8b5baef907e
PAPasscode: b408fb87c530cad58a554e26482e87dbb14b7bc2
RESideMenu: f24c508404b49c667344c54aba7e590883533958
SwiftLint: e14651157288e9e01d6e1a71db7014fb5744a8ea
TVVLCKit: 178e4f82f8b57320774821384e42eaac403d2faa
upnpx: c695b99229e08154d23abe5c252cb64f1600f35d
VLC-LiveSDK: c9566a9edde968f969138f84cfd40b540a109b3f
......@@ -147,6 +150,6 @@ SPEC CHECKSUMS:
XKKeychain: 852ef663c56a7194c73d3c68e8d9d4f07b121d4f
xmlrpc: 109bb21d15ed6d108b2c1ac5973a6a223a50f5f4
PODFILE CHECKSUM: 6a912f6ba8819dae74bb05d7a721fd2430785700
PODFILE CHECKSUM: 7049ed97875cfde471396ccb609af0afd165ef7d
COCOAPODS: 1.4.0
......@@ -12,14 +12,14 @@
import Foundation
@objc(VLCService)
public class Services:NSObject {
public class Services: NSObject {
@objc let mediaDataSource = VLCMediaDataSource()
}
@objc class AppCoordinator : NSObject {
@objc class AppCoordinator: NSObject {
var childCoordinators: [NSObject] = []
private var tabBarController:UITabBarController
private var tabBarController: UITabBarController
private var services = Services()
@objc public init(tabBarController: UITabBarController) {
......
......@@ -10,7 +10,7 @@
* Refer to the COPYING file of the official project for license.
*****************************************************************************/
public enum SortOption:String {
public enum SortOption: String {
case alphabetically = "Name"
case insertonDate = "Date"
case size = "Size"
......
......@@ -10,13 +10,13 @@
* Refer to the COPYING file of the official project for license.
*****************************************************************************/
public class MediaDataSourceAndDelegate:NSObject, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout {
public class MediaDataSourceAndDelegate: NSObject, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout {
private let cellPadding:CGFloat = 5.0
private let cellPadding: CGFloat = 5.0
private var services: Services
public weak var delegate: UICollectionViewDelegate?
public convenience init(services:Services) {
public convenience init(services: Services) {
self.init()
self.services = services
}
......@@ -44,8 +44,8 @@ public class MediaDataSourceAndDelegate:NSObject, UICollectionViewDataSource, UI
public func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
let numberOfCells:CGFloat = collectionView.traitCollection.horizontalSizeClass == .regular ? 3.0 : 2.0
let aspectRatio:CGFloat = 10.0 / 16.0
let numberOfCells: CGFloat = collectionView.traitCollection.horizontalSizeClass == .regular ? 3.0 : 2.0
let aspectRatio: CGFloat = 10.0 / 16.0
// We have the number of cells and we always have numberofCells + 1 padding spaces. -pad-[Cell]-pad-[Cell]-pad-
// we then have the entire padding, we divide the entire padding by the number of Cells to know how much needs to be substracted from ech cell
......@@ -57,7 +57,7 @@ public class MediaDataSourceAndDelegate:NSObject, UICollectionViewDataSource, UI
}
public func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAt section: Int) -> UIEdgeInsets {
return UIEdgeInsetsMake(cellPadding, cellPadding, cellPadding, cellPadding);
return UIEdgeInsets(top: cellPadding, left: cellPadding, bottom: cellPadding, right: cellPadding)
}
public func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat {
......
......@@ -16,39 +16,39 @@ extension Notification.Name {
static let VLCThemeDidChangeNotification = Notification.Name("themeDidChangeNotfication")
}
@objcMembers public class ColorPalette : NSObject {
@objcMembers public class ColorPalette: NSObject {
public let isDark: Bool
public let name: String
public let background:UIColor
public let cellBackgroundA:UIColor
public let cellBackgroundB:UIColor
public let cellDetailTextColor:UIColor
public let cellTextColor:UIColor
public let lightTextColor:UIColor
public let sectionHeaderTextColor:UIColor
public let sectionHeaderTintColor:UIColor
public let settingsBackground:UIColor
public let settingsCellBackground:UIColor
public let settingsSeparatorColor:UIColor
public let tabBarColor:UIColor
public let orangeUI:UIColor
public let background: UIColor
public let cellBackgroundA: UIColor
public let cellBackgroundB: UIColor
public let cellDetailTextColor: UIColor
public let cellTextColor: UIColor
public let lightTextColor: UIColor
public let sectionHeaderTextColor: UIColor
public let sectionHeaderTintColor: UIColor
public let settingsBackground: UIColor
public let settingsCellBackground: UIColor
public let settingsSeparatorColor: UIColor
public let tabBarColor: UIColor
public let orangeUI: UIColor
public init(isDark: Bool,
name: String,
background:UIColor,
cellBackgroundA:UIColor,
cellBackgroundB:UIColor,
cellDetailTextColor:UIColor,
cellTextColor:UIColor,
lightTextColor:UIColor,
sectionHeaderTextColor:UIColor,
sectionHeaderTintColor:UIColor,
settingsBackground:UIColor,
settingsCellBackground:UIColor,
settingsSeparatorColor:UIColor,
tabBarColor:UIColor,
orangeUI:UIColor) {
background: UIColor,
cellBackgroundA: UIColor,
cellBackgroundB: UIColor,
cellDetailTextColor: UIColor,
cellTextColor: UIColor,
lightTextColor: UIColor,
sectionHeaderTextColor: UIColor,
sectionHeaderTintColor: UIColor,
settingsBackground: UIColor,
settingsCellBackground: UIColor,
settingsSeparatorColor: UIColor,
tabBarColor: UIColor,
orangeUI: UIColor) {
self.isDark = isDark
self.name = name
self.background = background
......@@ -67,7 +67,7 @@ extension Notification.Name {
}
}
@objcMembers public class PresentationTheme : NSObject {
@objcMembers public class PresentationTheme: NSObject {
public static let brightTheme = PresentationTheme(colors: brightPalette)
public static let darkTheme = PresentationTheme(colors: darkPalette)
......@@ -75,8 +75,7 @@ extension Notification.Name {
static var current: PresentationTheme = {
let isDarkTheme = UserDefaults.standard.bool(forKey: kVLCSettingAppTheme)
return isDarkTheme ? PresentationTheme.darkTheme : PresentationTheme.brightTheme