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
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
78 additions
and
16 deletions
+78
-16
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
+6
-4
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
+20
-2
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
...
...
@@ -11,9 +11,11 @@ import Foundation
class
ActiveSession
{
var
startTime
:
NSDate
?
var
framedIpAddress
:
String
?
var
inputOctets
:
Int
?
var
outputOctets
:
Int
?
//
var inputOctets: Int?
//
var outputOctets: Int?
var
serviceInfo
:
String
?
var
inputOctetNew
:
Int64
?
var
outputOctetNew
:
Int64
?
init
(
json
:
JSON
)
{
if
let
startTime
=
json
[
"start_time"
]
.
string
{
...
...
@@ -27,8 +29,8 @@ class ActiveSession {
}
}
self
.
framedIpAddress
=
json
[
"framed_ip_address"
]
.
string
self
.
inputOctets
=
json
[
"input_octets"
]
.
int
self
.
outputOctets
=
json
[
"output_octets"
]
.
int
self
.
inputOctetNew
=
json
[
"input_octets"
]
.
int64
self
.
outputOctetNew
=
json
[
"output_octets"
]
.
int64
self
.
serviceInfo
=
json
[
"service_info"
]
.
string
}
...
...
kt/Models/ServiceItem.swift
View file @
b1c8e830
...
...
@@ -24,6 +24,8 @@ class ServiceItem {
var
rates
:
[
Rate
]
=
[]
var
service
:
Service
?
var
isShowConnectButton
:
Bool
?
var
imageUrl
:
String
?
var
description
:
String
?
var
tariffs
:
[
Tariff
]
!
...
...
@@ -49,12 +51,14 @@ class ServiceItem {
// "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
.
name
=
name
self
.
type
=
type
self
.
data
=
data
self
.
key
=
key
self
.
imageUrl
=
imageUrlStr
self
.
description
=
description
}
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 {
}
private
func
configureSubviews
()
{
bottomView
.
backgroundColor
=
Color
.
PromoBlueColor
//bottomView.backgroundColor = Color.PromoBlueColor
bottomScrollView
.
backgroundColor
=
UIColor
.
clearColor
()
bottomScrollView
.
tintColor
=
UIColor
.
clearColor
()
}
private
func
configurePageControl
()
{
...
...
@@ -69,10 +71,10 @@ class PromoViewController: UIViewController, UIScrollViewDelegate {
imageWrapperView
.
addSubview
(
imageView
)
imageView
.
translatesAutoresizingMaskIntoConstraints
=
false
let
views
=
[
"image"
:
imageView
]
imageWrapperView
.
addConstraints
(
NSLayoutConstraint
.
constraintsWithVisualFormat
(
"H:|
-40-[image]-40-
|"
,
options
:
[],
metrics
:
nil
,
views
:
views
))
imageWrapperView
.
addConstraints
(
NSLayoutConstraint
.
constraintsWithVisualFormat
(
"V:|
-40-
[image]|"
,
options
:
[],
metrics
:
nil
,
views
:
views
))
imageWrapperView
.
addConstraints
(
NSLayoutConstraint
.
constraintsWithVisualFormat
(
"H:|
[image]
|"
,
options
:
[],
metrics
:
nil
,
views
:
views
))
imageWrapperView
.
addConstraints
(
NSLayoutConstraint
.
constraintsWithVisualFormat
(
"V:|[image]|"
,
options
:
[],
metrics
:
nil
,
views
:
views
))
imageView
.
image
=
UIImage
(
named
:
"promo_
\(
index
)
"
)
imageView
.
contentMode
=
.
ScaleAspectFi
t
imageView
.
contentMode
=
.
ScaleAspectFi
ll
self
.
scrollView
.
addSubview
(
imageWrapperView
)
// bottom ScrollView
...
...
kt/ViewControllers/Service/ServiceListController.swift
View file @
b1c8e830
...
...
@@ -52,16 +52,38 @@ class ServiceListController: UIViewController, UITableViewDataSource, UITableVie
updateServicesList
()
}
// func tableView(tableView: UITableView, estimatedHeightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
// return 250
// }
// func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
// return 250
// }
func
configureTableView
()
{
servicesTableView
.
estimatedRowHeight
=
10
0
servicesTableView
.
estimatedRowHeight
=
28
0
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
()
{
servicesList
=
[]
for
subItem
in
self
.
data
!
{
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
)
serviceItem
.
service
=
service
;
}
else
{
...
...
@@ -109,6 +131,20 @@ class ServiceListController: UIViewController, UITableViewDataSource, UITableVie
// 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
{
return
servicesList
.
count
}
...
...
kt/Views/Cabinet/device/activeSessions/ActiveSessionsCell.swift
View file @
b1c8e830
...
...
@@ -35,8 +35,8 @@ class ActiveSessionsCell: UITableViewCell {
dateLabel
.
text
=
activeSession
.
dateAndMonthFormat
()
infoLabel
.
text
=
activeSession
.
serviceInfo
firstRightLabel
.
text
=
activeSession
.
framedIpAddress
secondRightLabel
.
text
=
"
\(
activeSession
.
inputOctet
s
!
/
1048576
)
"
thirdRightLabel
.
text
=
"
\(
activeSession
.
outputOctet
s
!
/
1048576
)
"
secondRightLabel
.
text
=
"
\(
activeSession
.
inputOctet
New
!
/
1048576
)
"
thirdRightLabel
.
text
=
"
\(
activeSession
.
outputOctet
New
!
/
1048576
)
"
}
}
...
...
kt/Views/PromoDescriptionView.swift
View file @
b1c8e830
...
...
@@ -18,6 +18,6 @@ class PromoDescriptionView: UIView {
override
func
awakeFromNib
()
{
super
.
awakeFromNib
()
backgroundColor
=
Color
.
PromoBlueColor
backgroundColor
=
UIColor
.
clearColor
()
//
Color.PromoBlueColor
}
}
kt/Views/ServiceCell.swift
View file @
b1c8e830
...
...
@@ -11,18 +11,36 @@ import UIKit
class
ServiceCell
:
UITableViewCell
{
@IBOutlet
private
weak
var
iconView
:
UIImageView
!
@IBOutlet
private
weak
var
nameLabel
:
UILabel
!
@IBOutlet
weak
var
backgroundImage
:
UIImageView
!
@IBOutlet
weak
var
extraLabel
:
UILabel
!
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)
iconView
.
image
=
UIImage
(
named
:
servicesItem
.
service
!.
imageName
)
nameLabel
.
setTextAndSizeToFit
(
servicesItem
.
name
)
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!.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
)
{
...
...
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