Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
Companion App iOS
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
3
Issues
3
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
card10
Companion App iOS
Commits
93bc2994
Commit
93bc2994
authored
Aug 22, 2019
by
Roddi Deecke
Committed by
Thomas Mellenthin
Aug 24, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix "Syntactic Sugar" violations
parent
9905a3cf
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
14 additions
and
15 deletions
+14
-15
.swiftlint.yml
.swiftlint.yml
+0
-1
card10badge/Bluetooth/BluetoothManager.swift
card10badge/Bluetooth/BluetoothManager.swift
+3
-3
card10badge/Card10TabBarController.swift
card10badge/Card10TabBarController.swift
+1
-1
card10badge/Hatchery/HatcheryClient.swift
card10badge/Hatchery/HatcheryClient.swift
+7
-7
card10badge/Hatchery/HatcheryEgg.swift
card10badge/Hatchery/HatcheryEgg.swift
+2
-2
card10badge/Scanner/ScannerTableViewController.swift
card10badge/Scanner/ScannerTableViewController.swift
+1
-1
No files found.
.swiftlint.yml
View file @
93bc2994
...
...
@@ -16,7 +16,6 @@ disabled_rules:
-
function_parameter_count
-
line_length
-
force_cast
-
syntactic_sugar
-
implicit_getter
-
todo
-
file_length
...
...
card10badge/Bluetooth/BluetoothManager.swift
View file @
93bc2994
...
...
@@ -9,7 +9,7 @@
import
CoreBluetooth
protocol
BluetoothManagerDelegate
:
class
{
func
didFindNewPeripherals
(
_
peripherals
:
Array
<
FoundPeripheral
>
?)
func
didFindNewPeripherals
(
_
peripherals
:
[
FoundPeripheral
]
?)
func
didConnectToPeripheal
(
_
peripheral
:
FoundPeripheral
?)
func
didDisconnectFromPeripheral
()
func
didGetNewLightSensorData
(
_
data
:
UInt16
)
...
...
@@ -20,7 +20,7 @@ protocol BluetoothManagerDelegate: class {
// Provide default empty implementation to avoid empty boilerplate in the delegate
extension
BluetoothManagerDelegate
{
func
didFindNewPeripherals
(
_
peripherals
:
Array
<
FoundPeripheral
>
?)
{}
func
didFindNewPeripherals
(
_
peripherals
:
[
FoundPeripheral
]
?)
{}
func
didConnectToPeripheal
(
_
peripheral
:
FoundPeripheral
?)
{}
func
didDisconnectFromPeripheral
()
{}
func
didGetNewLightSensorData
(
_
data
:
UInt16
)
{}
...
...
@@ -97,7 +97,7 @@ class BluetoothManager: NSObject, CBCentralManagerDelegate, CBPeripheralDelegate
let
card10TXWriteCharacteristicUUID
=
CBUUID
(
string
:
"42230101-2342-2342-2342-234223422342"
)
let
card10RXReadCharacteristicUUID
=
CBUUID
(
string
:
"42230102-2342-2342-2342-234223422342"
)
private(set)
public
var
foundPeripheral
:
Array
<
FoundPeripheral
>
private(set)
public
var
foundPeripheral
:
[
FoundPeripheral
]
public
var
connectedPeripheral
:
CBPeripheral
?
/// Holds BluetoothManagerDelegates weakly
...
...
card10badge/Card10TabBarController.swift
View file @
93bc2994
...
...
@@ -11,7 +11,7 @@ import CoreBluetooth
public
class
Card10TabBarController
:
UITabBarController
,
UITabBarControllerDelegate
,
BluetoothManagerDelegate
{
var
allViewControllers
:
Array
<
UIViewController
>
?
=
[]
var
allViewControllers
:
[
UIViewController
]
?
=
[]
public
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
...
...
card10badge/Hatchery/HatcheryClient.swift
View file @
93bc2994
...
...
@@ -27,7 +27,7 @@ extension HatcheryClientDelegate {
class
HatcheryClient
:
NSObject
,
URLSessionDelegate
{
let
hatcheryBaseURL
:
URL
=
URL
(
string
:
"https://badge.team/"
)
!
private(set)
public
var
loadedEggs
:
Array
<
Array
<
HatcheryEgg
>>
=
[]
private(set)
public
var
loadedEggs
:
[[
HatcheryEgg
]]
=
[]
weak
var
delegate
:
HatcheryClientDelegate
?
...
...
@@ -59,8 +59,8 @@ class HatcheryClient: NSObject, URLSessionDelegate {
let
json
=
try
JSONSerialization
.
jsonObject
(
with
:
data
!
,
options
:
[])
if
let
jsonArray
=
json
as?
[
Any
]
{
self
.
loadedEggs
.
removeAll
()
var
loadedEggsUncategorized
:
Array
<
HatcheryEgg
>
=
[]
for
case
let
dictionary
as
Dictionary
<
String
,
Any
>
in
jsonArray
{
var
loadedEggsUncategorized
:
[
HatcheryEgg
]
=
[]
for
case
let
dictionary
as
[
String
:
Any
]
in
jsonArray
{
loadedEggsUncategorized
.
append
(
HatcheryEgg
.
init
(
dictionary
:
dictionary
))
}
...
...
@@ -69,7 +69,7 @@ class HatcheryClient: NSObject, URLSessionDelegate {
uniqueCategories
=
uniqueCategories
.
sorted
{
$0
.
lowercased
()
<
$1
.
lowercased
()
}
for
category
in
uniqueCategories
{
var
eggsForCategory
:
Array
<
HatcheryEgg
>
=
[]
var
eggsForCategory
:
[
HatcheryEgg
]
=
[]
for
egg
in
loadedEggsUncategorized
{
if
egg
.
category
==
category
{
eggsForCategory
.
append
(
egg
)
...
...
@@ -109,9 +109,9 @@ class HatcheryClient: NSObject, URLSessionDelegate {
do
{
let
json
=
try
JSONSerialization
.
jsonObject
(
with
:
data
!
,
options
:
[])
if
let
eggDict
=
json
as?
Dictionary
<
String
,
Any
>
{
if
let
releases
=
eggDict
[
"releases"
]
as?
Dictionary
<
String
,
Any
>
{
if
let
latestRelease
=
releases
[
revision
]
as?
Array
<
Dictionary
<
String
,
String
>>
{
if
let
eggDict
=
json
as?
[
String
:
Any
]
{
if
let
releases
=
eggDict
[
"releases"
]
as?
[
String
:
Any
]
{
if
let
latestRelease
=
releases
[
revision
]
as?
[[
String
:
String
]]
{
let
releaseURL
=
latestRelease
[
0
][
"url"
]
self
.
downloadRelease
(
fromURL
:
URL
(
string
:
releaseURL
!
)
!
)
}
...
...
card10badge/Hatchery/HatcheryEgg.swift
View file @
93bc2994
...
...
@@ -20,9 +20,9 @@ class HatcheryEgg: NSObject {
private(set)
public
var
sizeOfContent
:
Double
?
private(set)
public
var
category
:
String
?
let
dictionary
:
Dictionary
<
String
,
Any
>
let
dictionary
:
[
String
:
Any
]
init
(
dictionary
:
Dictionary
<
String
,
Any
>
)
{
init
(
dictionary
:
[
String
:
Any
]
)
{
self
.
dictionary
=
dictionary
self
.
name
=
dictionary
[
"name"
]
as?
String
...
...
card10badge/Scanner/ScannerTableViewController.swift
View file @
93bc2994
...
...
@@ -111,7 +111,7 @@ extension ScannerTableViewController {
extension
ScannerTableViewController
:
BluetoothManagerDelegate
{
func
didFindNewPeripherals
(
_
peripherals
:
Array
<
FoundPeripheral
>
?)
{
func
didFindNewPeripherals
(
_
peripherals
:
[
FoundPeripheral
]
?)
{
self
.
tableView
.
reloadSections
(
IndexSet
(
integer
:
0
),
with
:
.
automatic
)
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment