Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
kt-ios
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Виктор
kt-ios
Commits
b1c8e830
Commit
b1c8e830
authored
Oct 24, 2017
by
Olzhas Aldabergenov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bugs fixed
parent
d0bd26e8
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
111 additions
and
49 deletions
+111
-49
UserInterfaceState.xcuserstate
...cuserdata/neox.xcuserdatad/UserInterfaceState.xcuserstate
+0
-0
UserInterfaceState.xcuserstate
...cuserdata/neox.xcuserdatad/UserInterfaceState.xcuserstate
+0
-0
ActiveSession.swift
kt/Models/Cabinet/device/ActiveSession.swift
+38
-36
ServiceItem.swift
kt/Models/ServiceItem.swift
+5
-1
Main.storyboard
kt/Resources/Base.lproj/Main.storyboard
+0
-0
PromoViewController.swift
kt/ViewControllers/Promo/PromoViewController.swift
+6
-4
ServiceListController.swift
kt/ViewControllers/Service/ServiceListController.swift
+38
-2
ActiveSessionsCell.swift
...ws/Cabinet/device/activeSessions/ActiveSessionsCell.swift
+2
-2
PromoDescriptionView.swift
kt/Views/PromoDescriptionView.swift
+1
-1
ServiceCell.swift
kt/Views/ServiceCell.swift
+21
-3
No files found.
kt.xcodeproj/project.xcworkspace/xcuserdata/neox.xcuserdatad/UserInterfaceState.xcuserstate
View file @
b1c8e830
No preview for this file type
kt.xcworkspace/xcuserdata/neox.xcuserdatad/UserInterfaceState.xcuserstate
View file @
b1c8e830
No preview for this file type
kt/Models/Cabinet/device/ActiveSession.swift
View file @
b1c8e830
...
@@ -9,44 +9,46 @@
...
@@ -9,44 +9,46 @@
import
Foundation
import
Foundation
class
ActiveSession
{
class
ActiveSession
{
var
startTime
:
NSDate
?
var
startTime
:
NSDate
?
var
framedIpAddress
:
String
?
var
framedIpAddress
:
String
?
var
inputOctets
:
Int
?
//var inputOctets: Int?
var
outputOctets
:
Int
?
//var outputOctets: Int?
var
serviceInfo
:
String
?
var
serviceInfo
:
String
?
var
inputOctetNew
:
Int64
?
init
(
json
:
JSON
)
{
var
outputOctetNew
:
Int64
?
if
let
startTime
=
json
[
"start_time"
]
.
string
{
let
dateFormatter
=
NSDateFormatter
()
init
(
json
:
JSON
)
{
dateFormatter
.
locale
=
NSLocale
(
localeIdentifier
:
"en_US_POSIX"
)
if
let
startTime
=
json
[
"start_time"
]
.
string
{
dateFormatter
.
dateFormat
=
"dd-MM-yy"
let
dateFormatter
=
NSDateFormatter
()
self
.
startTime
=
dateFormatter
.
dateFromString
(
startTime
)
dateFormatter
.
locale
=
NSLocale
(
localeIdentifier
:
"en_US_POSIX"
)
if
self
.
startTime
==
nil
{
dateFormatter
.
dateFormat
=
"dd-MM-yy"
dateFormatter
.
dateFormat
=
"yy-MM-dd HH:mm:ss"
self
.
startTime
=
dateFormatter
.
dateFromString
(
startTime
)
self
.
startTime
=
dateFormatter
.
dateFromString
(
startTime
)
if
self
.
startTime
==
nil
{
dateFormatter
.
dateFormat
=
"yy-MM-dd HH:mm:ss"
self
.
startTime
=
dateFormatter
.
dateFromString
(
startTime
)
}
}
}
self
.
framedIpAddress
=
json
[
"framed_ip_address"
]
.
string
self
.
inputOctetNew
=
json
[
"input_octets"
]
.
int64
self
.
outputOctetNew
=
json
[
"output_octets"
]
.
int64
self
.
serviceInfo
=
json
[
"service_info"
]
.
string
}
}
self
.
framedIpAddress
=
json
[
"framed_ip_address"
]
.
string
self
.
inputOctets
=
json
[
"input_octets"
]
.
int
func
dateAndMonthFormat
()
->
String
?
{
self
.
outputOctets
=
json
[
"output_octets"
]
.
int
guard
let
systemDate
=
startTime
else
{
self
.
serviceInfo
=
json
[
"service_info"
]
.
string
return
nil
}
}
let
components
=
systemDate
.
getComponents
()
func
dateAndMonthFormat
()
->
String
?
{
let
year
=
components
.
year
guard
let
systemDate
=
startTime
else
{
let
month
=
components
.
month
return
nil
let
dateFormatter
=
NSDateFormatter
()
}
dateFormatter
.
locale
=
AppLocalization
.
language
()
.
locale
let
components
=
systemDate
.
getComponents
()
if
#available(iOS 9.0, *)
{
let
year
=
components
.
year
return
"
\(
dateFormatter
.
standaloneMonthSymbols
[
month
-
1
]
.
localizedCapitalizedString
)
\(
year
)
"
let
month
=
components
.
month
}
else
{
let
dateFormatter
=
NSDateFormatter
()
// Fallback on earlier versions
dateFormatter
.
locale
=
AppLocalization
.
language
()
.
locale
return
"
\(
dateFormatter
.
standaloneMonthSymbols
[
month
-
1
]
.
capitalizedStringWithLocale
(
NSLocale
.
currentLocale
())
)
\(
year
)
"
if
#available(iOS 9.0, *)
{
}
return
"
\(
dateFormatter
.
standaloneMonthSymbols
[
month
-
1
]
.
localizedCapitalizedString
)
\(
year
)
"
}
else
{
// Fallback on earlier versions
return
"
\(
dateFormatter
.
standaloneMonthSymbols
[
month
-
1
]
.
capitalizedStringWithLocale
(
NSLocale
.
currentLocale
())
)
\(
year
)
"
}
}
}
}
}
kt/Models/ServiceItem.swift
View file @
b1c8e830
...
@@ -24,6 +24,8 @@ class ServiceItem {
...
@@ -24,6 +24,8 @@ class ServiceItem {
var
rates
:
[
Rate
]
=
[]
var
rates
:
[
Rate
]
=
[]
var
service
:
Service
?
var
service
:
Service
?
var
isShowConnectButton
:
Bool
?
var
isShowConnectButton
:
Bool
?
var
imageUrl
:
String
?
var
description
:
String
?
var
tariffs
:
[
Tariff
]
!
var
tariffs
:
[
Tariff
]
!
...
@@ -49,12 +51,14 @@ class ServiceItem {
...
@@ -49,12 +51,14 @@ class ServiceItem {
// "verbose_description_full": "<p>Оптимальная защита, для активных интернет пользователей.</p>\n<p><strong>Можно установить на 2 устройства.</strong>
// "verbose_description_full": "<p>Оптимальная защита, для активных интернет пользователей.</p>\n<p><strong>Можно установить на 2 устройства.</strong>
init
(
id
:
Int
?
=
nil
,
name
:
String
,
key
:
String
?
=
nil
,
type
:
String
?
=
nil
,
data
:
[[
String
:
AnyObject
]]?
=
nil
)
{
init
(
id
:
Int
?
=
nil
,
name
:
String
,
key
:
String
?
=
nil
,
type
:
String
?
=
nil
,
data
:
[[
String
:
AnyObject
]]?
=
nil
,
imageUrlStr
:
String
?
=
nil
,
description
:
String
?
=
nil
)
{
self
.
id
=
id
self
.
id
=
id
self
.
name
=
name
self
.
name
=
name
self
.
type
=
type
self
.
type
=
type
self
.
data
=
data
self
.
data
=
data
self
.
key
=
key
self
.
key
=
key
self
.
imageUrl
=
imageUrlStr
self
.
description
=
description
}
}
init
(
json
:
JSON
)
{
init
(
json
:
JSON
)
{
...
...
kt/Resources/Base.lproj/Main.storyboard
View file @
b1c8e830
This source diff could not be displayed because it is too large. You can
view the blob
instead.
kt/ViewControllers/Promo/PromoViewController.swift
View file @
b1c8e830
...
@@ -40,7 +40,9 @@ class PromoViewController: UIViewController, UIScrollViewDelegate {
...
@@ -40,7 +40,9 @@ class PromoViewController: UIViewController, UIScrollViewDelegate {
}
}
private
func
configureSubviews
()
{
private
func
configureSubviews
()
{
bottomView
.
backgroundColor
=
Color
.
PromoBlueColor
//bottomView.backgroundColor = Color.PromoBlueColor
bottomScrollView
.
backgroundColor
=
UIColor
.
clearColor
()
bottomScrollView
.
tintColor
=
UIColor
.
clearColor
()
}
}
private
func
configurePageControl
()
{
private
func
configurePageControl
()
{
...
@@ -69,10 +71,10 @@ class PromoViewController: UIViewController, UIScrollViewDelegate {
...
@@ -69,10 +71,10 @@ class PromoViewController: UIViewController, UIScrollViewDelegate {
imageWrapperView
.
addSubview
(
imageView
)
imageWrapperView
.
addSubview
(
imageView
)
imageView
.
translatesAutoresizingMaskIntoConstraints
=
false
imageView
.
translatesAutoresizingMaskIntoConstraints
=
false
let
views
=
[
"image"
:
imageView
]
let
views
=
[
"image"
:
imageView
]
imageWrapperView
.
addConstraints
(
NSLayoutConstraint
.
constraintsWithVisualFormat
(
"H:|
-40-[image]-40-
|"
,
options
:
[],
metrics
:
nil
,
views
:
views
))
imageWrapperView
.
addConstraints
(
NSLayoutConstraint
.
constraintsWithVisualFormat
(
"H:|
[image]
|"
,
options
:
[],
metrics
:
nil
,
views
:
views
))
imageWrapperView
.
addConstraints
(
NSLayoutConstraint
.
constraintsWithVisualFormat
(
"V:|
-40-
[image]|"
,
options
:
[],
metrics
:
nil
,
views
:
views
))
imageWrapperView
.
addConstraints
(
NSLayoutConstraint
.
constraintsWithVisualFormat
(
"V:|[image]|"
,
options
:
[],
metrics
:
nil
,
views
:
views
))
imageView
.
image
=
UIImage
(
named
:
"promo_
\(
index
)
"
)
imageView
.
image
=
UIImage
(
named
:
"promo_
\(
index
)
"
)
imageView
.
contentMode
=
.
ScaleAspectFi
t
imageView
.
contentMode
=
.
ScaleAspectFi
ll
self
.
scrollView
.
addSubview
(
imageWrapperView
)
self
.
scrollView
.
addSubview
(
imageWrapperView
)
// bottom ScrollView
// bottom ScrollView
...
...
kt/ViewControllers/Service/ServiceListController.swift
View file @
b1c8e830
...
@@ -52,16 +52,38 @@ class ServiceListController: UIViewController, UITableViewDataSource, UITableVie
...
@@ -52,16 +52,38 @@ class ServiceListController: UIViewController, UITableViewDataSource, UITableVie
updateServicesList
()
updateServicesList
()
}
}
// func tableView(tableView: UITableView, estimatedHeightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
// return 250
// }
// func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
// return 250
// }
func
configureTableView
()
{
func
configureTableView
()
{
servicesTableView
.
estimatedRowHeight
=
10
0
servicesTableView
.
estimatedRowHeight
=
28
0
servicesTableView
.
rowHeight
=
UITableViewAutomaticDimension
servicesTableView
.
rowHeight
=
UITableViewAutomaticDimension
}
}
// func tableView(tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
// return 40
// }
// func tableView(tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
// let headerView = UIView()
// headerView.backgroundColor = UIColor.whiteColor()
// return headerView
// }
private
func
updateServicesList
()
{
private
func
updateServicesList
()
{
servicesList
=
[]
servicesList
=
[]
for
subItem
in
self
.
data
!
{
for
subItem
in
self
.
data
!
{
if
(
subItem
[
"data"
]
as?
[[
String
:
AnyObject
]])
==
nil
{
if
(
subItem
[
"data"
]
as?
[[
String
:
AnyObject
]])
==
nil
{
let
serviceItem
=
ServiceItem
(
id
:
subItem
[
"service_id"
]
as?
Int
,
name
:
subItem
[
"name"
]
as!
String
,
key
:
subItem
[
"key"
]
as?
String
,
type
:
subItem
[
"type"
]
as?
String
)
var
url
:
String
?
=
nil
var
description
:
String
?
=
nil
if
let
full
=
subItem
[
"full"
]
{
url
=
full
[
"seo_image"
]
as!
String
?
description
=
full
[
"seo_description"
]
as!
String
!
}
//let url = subItem["full"]?["seo_image"] as! String?
let
serviceItem
=
ServiceItem
(
id
:
subItem
[
"service_id"
]
as?
Int
,
name
:
subItem
[
"name"
]
as!
String
,
key
:
subItem
[
"key"
]
as?
String
,
type
:
subItem
[
"type"
]
as?
String
,
imageUrlStr
:
url
,
description
:
description
)
servicesList
.
append
(
serviceItem
)
servicesList
.
append
(
serviceItem
)
serviceItem
.
service
=
service
;
serviceItem
.
service
=
service
;
}
else
{
}
else
{
...
@@ -109,6 +131,20 @@ class ServiceListController: UIViewController, UITableViewDataSource, UITableVie
...
@@ -109,6 +131,20 @@ class ServiceListController: UIViewController, UITableViewDataSource, UITableVie
// MARK: UITableViewDataSource
// MARK: UITableViewDataSource
// func tableView(tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
// return 30
// }
//
// func tableView(tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
// let view = UIView()
// view.backgroundColor = UIColor.whiteColor()
// return view
// }
func
numberOfSectionsInTableView
(
tableView
:
UITableView
)
->
Int
{
return
1
//servicesList.count
}
func
tableView
(
tableView
:
UITableView
,
numberOfRowsInSection
section
:
Int
)
->
Int
{
func
tableView
(
tableView
:
UITableView
,
numberOfRowsInSection
section
:
Int
)
->
Int
{
return
servicesList
.
count
return
servicesList
.
count
}
}
...
...
kt/Views/Cabinet/device/activeSessions/ActiveSessionsCell.swift
View file @
b1c8e830
...
@@ -35,8 +35,8 @@ class ActiveSessionsCell: UITableViewCell {
...
@@ -35,8 +35,8 @@ class ActiveSessionsCell: UITableViewCell {
dateLabel
.
text
=
activeSession
.
dateAndMonthFormat
()
dateLabel
.
text
=
activeSession
.
dateAndMonthFormat
()
infoLabel
.
text
=
activeSession
.
serviceInfo
infoLabel
.
text
=
activeSession
.
serviceInfo
firstRightLabel
.
text
=
activeSession
.
framedIpAddress
firstRightLabel
.
text
=
activeSession
.
framedIpAddress
secondRightLabel
.
text
=
"
\(
activeSession
.
inputOctet
s
!
/
1048576
)
"
secondRightLabel
.
text
=
"
\(
activeSession
.
inputOctet
New
!
/
1048576
)
"
thirdRightLabel
.
text
=
"
\(
activeSession
.
outputOctet
s
!
/
1048576
)
"
thirdRightLabel
.
text
=
"
\(
activeSession
.
outputOctet
New
!
/
1048576
)
"
}
}
}
}
...
...
kt/Views/PromoDescriptionView.swift
View file @
b1c8e830
...
@@ -18,6 +18,6 @@ class PromoDescriptionView: UIView {
...
@@ -18,6 +18,6 @@ class PromoDescriptionView: UIView {
override
func
awakeFromNib
()
{
override
func
awakeFromNib
()
{
super
.
awakeFromNib
()
super
.
awakeFromNib
()
backgroundColor
=
Color
.
PromoBlueColor
backgroundColor
=
UIColor
.
clearColor
()
//
Color.PromoBlueColor
}
}
}
}
kt/Views/ServiceCell.swift
View file @
b1c8e830
...
@@ -11,18 +11,36 @@ import UIKit
...
@@ -11,18 +11,36 @@ import UIKit
class
ServiceCell
:
UITableViewCell
{
class
ServiceCell
:
UITableViewCell
{
@IBOutlet
private
weak
var
iconView
:
UIImageView
!
@IBOutlet
private
weak
var
iconView
:
UIImageView
!
@IBOutlet
private
weak
var
nameLabel
:
UILabel
!
@IBOutlet
private
weak
var
nameLabel
:
UILabel
!
@IBOutlet
weak
var
backgroundImage
:
UIImageView
!
@IBOutlet
weak
var
extraLabel
:
UILabel
!
func
setService
(
servicesItem
:
ServiceItem
,
withRow
row
:
Int
)
{
func
setService
(
servicesItem
:
ServiceItem
,
withRow
row
:
Int
)
{
contentView
.
backgroundColor
=
servicesItem
.
service
!.
colorForRow
(
row
)
//contentView.backgroundColor = UIColor(red: 1.0, green: 0.44, blue: 0.18, alpha: 1.0)
//contentView.backgroundColor = UIColor(red: 1.0, green: 0.44, blue: 0.18, alpha: 1.0)
iconView
.
image
=
UIImage
(
named
:
servicesItem
.
service
!.
imageName
)
iconView
.
image
=
UIImage
(
named
:
servicesItem
.
service
!.
imageName
)
nameLabel
.
setTextAndSizeToFit
(
servicesItem
.
name
)
nameLabel
.
setTextAndSizeToFit
(
servicesItem
.
name
)
selectedBackgroundView
=
UIView
(
frame
:
contentView
.
frame
)
selectedBackgroundView
=
UIView
(
frame
:
contentView
.
frame
)
selectedBackgroundView
!.
backgroundColor
=
servicesItem
.
service
!.
colorForRow
(
row
)
//selectedBackgroundView!.backgroundColor = UIColor(red: 0.0, green: 0.44, blue: 0.18, alpha: 1.0)
//selectedBackgroundView!.backgroundColor = UIColor(red: 0.0, green: 0.44, blue: 0.18, alpha: 1.0)
//selectedBackgroundView!.alpha = 0.8
//selectedBackgroundView!.alpha = 0.8
if
(
servicesItem
.
imageUrl
!=
nil
)
{
ImageLoader
.
sharedLoader
.
imageForUrl
(
servicesItem
.
imageUrl
!
)
{
(
image
,
url
)
in
self
.
backgroundImage
.
image
=
image
?
.
imageWithRenderingMode
(
.
AlwaysOriginal
)
}
self
.
iconView
.
alpha
=
0.0
self
.
nameLabel
.
textColor
=
UIColor
.
blackColor
()
// selectedBackgroundView!.backgroundColor = UIColor.clearColor()
}
else
{
self
.
iconView
.
alpha
=
0.0
self
.
nameLabel
.
textColor
=
UIColor
.
whiteColor
()
contentView
.
backgroundColor
=
servicesItem
.
service
!.
colorForRow
(
row
)
selectedBackgroundView
!.
backgroundColor
=
servicesItem
.
service
!.
colorForRow
(
row
)
self
.
backgroundImage
.
addConstraint
(
NSLayoutConstraint
(
item
:
self
.
backgroundImage
,
attribute
:
.
Height
,
relatedBy
:
.
Equal
,
toItem
:
nil
,
attribute
:
.
NotAnAttribute
,
multiplier
:
1.0
,
constant
:
0
))
}
self
.
extraLabel
.
text
=
servicesItem
.
description
}
}
override
func
setSelected
(
selected
:
Bool
,
animated
:
Bool
)
{
override
func
setSelected
(
selected
:
Bool
,
animated
:
Bool
)
{
...
...
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