on master help sign in
Seem to be done for submission
ecf9e9filyakooo0
Melk.xcodeproj/project.pbxproj+1−1
@@ -133,6 +133,7 @@
133 children = (
133 children = (
134 09BF420F1F0833C100AFAD57 /* MainCoordinator.swift */,
134 09BF420F1F0833C100AFAD57 /* MainCoordinator.swift */,
135 09BF42551F08413000AFAD57 /* MainViewController.swift */,
135 09BF42551F08413000AFAD57 /* MainViewController.swift */,
136+ 09939A551F097DA90014719D /* TableViewCells.swift */,
136 );
137 );
137 name = Main;
138 name = Main;
138 sourceTree = "<group>";
139 sourceTree = "<group>";
@@ -192,7 +193,6 @@
192 09BF42111F08341B00AFAD57 /* MyWeirdness.swift */,
193 09BF42111F08341B00AFAD57 /* MyWeirdness.swift */,
193 09BF42121F08341B00AFAD57 /* PublicCrap.swift */,
194 09BF42121F08341B00AFAD57 /* PublicCrap.swift */,
194 09F03F351F1674ED000CE916 /* VKServer.swift */,
195 09F03F351F1674ED000CE916 /* VKServer.swift */,
195− 09939A551F097DA90014719D /* TableViewCells.swift */,
196 09BF420D1F0833A700AFAD57 /* LocalVKDataTypes.swift */,
196 09BF420D1F0833A700AFAD57 /* LocalVKDataTypes.swift */,
197 09BF42151F0834D400AFAD57 /* VKPublicCrap.swift */,
197 09BF42151F0834D400AFAD57 /* VKPublicCrap.swift */,
198 09BF42171F08352E00AFAD57 /* VKData.swift */,
198 09BF42171F08352E00AFAD57 /* VKData.swift */,
Melk.xcodeproj/xcuserdata/ilya.xcuserdatad/xcschemes/Melk.xcscheme+3−3
@@ -42,9 +42,9 @@
42 </AdditionalOptions>
42 </AdditionalOptions>
43 </TestAction>
43 </TestAction>
44 <LaunchAction
44 <LaunchAction
45− buildConfiguration = "Debug"
45+ buildConfiguration = "Release"
46− selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
46+ selectedDebuggerIdentifier = ""
47− selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
47+ selectedLauncherIdentifier = "Xcode.IDEFoundation.Launcher.PosixSpawn"
48 launchStyle = "0"
48 launchStyle = "0"
49 useCustomWorkingDirectory = "NO"
49 useCustomWorkingDirectory = "NO"
50 ignoresPersistentStateOnLaunch = "NO"
50 ignoresPersistentStateOnLaunch = "NO"
Melk/CardView.swift+45−10
@@ -18,12 +18,12 @@ class CardView: UIView {
18 }
18 }
19 var minWidth: CGFloat = 300 {
19 var minWidth: CGFloat = 300 {
20 didSet {
20 didSet {
21− update()
21+// update()
22 }
22 }
23 }
23 }
24 var height: CGFloat = 400 {
24 var height: CGFloat = 400 {
25 didSet {
25 didSet {
26− update()
26+// update()
27 }
27 }
28 }
28 }
29
29
@@ -31,17 +31,32 @@ class CardView: UIView {
31 super.init(frame: frame)
31 super.init(frame: frame)
32 layer.masksToBounds = true
32 layer.masksToBounds = true
33 layer.cornerRadius = 20
33 layer.cornerRadius = 20
34+ gradient.colors = [#colorLiteral(red: 0.9841352105, green: 0.9841352105, blue: 0.9841352105, alpha: 1).cgColor, #colorLiteral(red: 0.9456828237, green: 0.9456828237, blue: 0.9456828237, alpha: 1).cgColor]
35+ gradient.startPoint = CGPoint(x: 0.5, y: 0)
36+ gradient.endPoint = CGPoint(x: 0.5, y: 1)
37+ layer.addSublayer(gradient)
34− backgroundColor = #colorLiteral(red: 0.9638966278, green: 0.9734401588, blue: 0.9734401588, alpha: 1)
38+// backgroundColor = #colorLiteral(red: 0.9638966278, green: 0.9734401588, blue: 0.9734401588, alpha: 1)
35 }
39 }
36
40
37 required init?(coder aDecoder: NSCoder) {
41 required init?(coder aDecoder: NSCoder) {
38 fatalError("init(coder:) has not been implemented")
42 fatalError("init(coder:) has not been implemented")
39 }
43 }
44+
45+ private let gradient = CAGradientLayer()
46+
40
47
41 private let padding = CGPoint(x: 32, y: 32)
48 private let padding = CGPoint(x: 32, y: 32)
42 private let vPadding1: CGFloat = 16
49 private let vPadding1: CGFloat = 16
43 private let vPadding2: CGFloat = 16
50 private let vPadding2: CGFloat = 16
44− private let minTextHeight: CGFloat = 50
51+ private var minTextHeight: CGFloat {
52+ return CGFloat(height * 0.2)
53+ }
54+ private let gradientRatio: CGFloat = 0.2
55+ private let minGradientAmount: CGFloat = 70
56+ private let hiddenByGradient: CGFloat = 10
57+ private var maxAttachmentDim: CGFloat {
58+ return minWidth / 2.3
59+ }
45
60
46// private let avatar = UIImage()
61// private let avatar = UIImage()
47// private let name = UIImage()
62// private let name = UIImage()
@@ -54,10 +69,9 @@ class CardView: UIView {
54 addSubview(largeStack)
69 addSubview(largeStack)
55
70
56 let userView = StackView(axis: .horizontal, alignment: .center)
71 let userView = StackView(axis: .horizontal, alignment: .center)
57−// userView.backgroundColor = #colorLiteral(red: 0.5568627715, green: 0.3529411852, blue: 0.9686274529, alpha: 1)
58
72
59
73
60− let avatarDim: CGFloat = 50
74+ let avatarDim: CGFloat = 64
61 let avatar = UIImageView()
75 let avatar = UIImageView()
62 post?.owner?.avatar?.load(into: avatar)
76 post?.owner?.avatar?.load(into: avatar)
63 avatar.layer.cornerRadius = avatarDim/2
77 avatar.layer.cornerRadius = avatarDim/2
@@ -74,6 +88,7 @@ class CardView: UIView {
74 let lastName = post?.owner?.lastName ?? ""
88 let lastName = post?.owner?.lastName ?? ""
75 userName.text = "\(firstName) \(lastName)"
89 userName.text = "\(firstName) \(lastName)"
76 userName.font = UIFont.systemFont(ofSize: 28, weight: UIFontWeightHeavy)
90 userName.font = UIFont.systemFont(ofSize: 28, weight: UIFontWeightHeavy)
91+ userName.textColor = UIColor.darkText
77 userName.sizeToFit()
92 userName.sizeToFit()
78 userView.addArrangedSubview(.view(userName))
93 userView.addArrangedSubview(.view(userName))
79
94
@@ -93,7 +108,7 @@ class CardView: UIView {
93 photoView.verticalPadding = 8
108 photoView.verticalPadding = 8
94 photoView.padding = CGPoint.zero
109 photoView.padding = CGPoint.zero
95 photoView.maxWidth = width
110 photoView.maxWidth = width
96− var maxPhotoDim: CGFloat = 150
111+ var maxPhotoDim: CGFloat = maxAttachmentDim
97 if let attachments = post?.attachments {
112 if let attachments = post?.attachments {
98 for attachment in attachments {
113 for attachment in attachments {
99 if let v = attachment.value {
114 if let v = attachment.value {
@@ -103,6 +118,7 @@ class CardView: UIView {
103 var pHeight = photo.height.value >>> {CGFloat($0)} {
118 var pHeight = photo.height.value >>> {CGFloat($0)} {
104 let photoV = UIImageView()
119 let photoV = UIImageView()
105 photoV.layer.minificationFilter = kCAFilterTrilinear
120 photoV.layer.minificationFilter = kCAFilterTrilinear
121+ photoV.contentMode = .scaleAspectFill
106 photo.image?.load(into: photoV)
122 photo.image?.load(into: photoV)
107 var k: CGFloat!
123 var k: CGFloat!
108 if pWidth > pHeight {
124 if pWidth > pHeight {
@@ -125,10 +141,10 @@ class CardView: UIView {
125 photoView.layoutIfNeeded()
141 photoView.layoutIfNeeded()
126
142
127 var textHeight = height
143 var textHeight = height
128− textHeight -= padding.y + vPadding1 + userView.frame.height
144+ textHeight -= padding.y * 2 + vPadding1 + userView.frame.height
129 if let count = post?.attachments.count{
145 if let count = post?.attachments.count{
130 if count > 0 {
146 if count > 0 {
131− textHeight -= vPadding2 + photoView.frame.height + padding.y
147+ textHeight -= vPadding2 + photoView.frame.height
132 }
148 }
133 }
149 }
134 print(textHeight)
150 print(textHeight)
@@ -140,9 +156,25 @@ class CardView: UIView {
140 let bodyWidth: Double = Double(width)
156 let bodyWidth: Double = Double(width)
141 body.font = UIFont.systemFont(ofSize: 22, weight: UIFontWeightSemibold)
157 body.font = UIFont.systemFont(ofSize: 22, weight: UIFontWeightSemibold)
142 body.text = post?.body
158 body.text = post?.body
159+ body.textColor = UIColor.darkText
143 let size = body.textRect(forBounds: CGRect(x: 0, y: 0, width: bodyWidth, height: Double.infinity), limitedToNumberOfLines: 0).size
160 let size = body.textRect(forBounds: CGRect(x: 0, y: 0, width: bodyWidth, height: Double.infinity), limitedToNumberOfLines: 0).size
144− body.frame.size.height = min(size.height, textHeight)
145 body.frame.size.width = size.width
161 body.frame.size.width = size.width
162+ if size.height > textHeight {
163+ body.frame.size.height = textHeight
164+ let maskView = UIView()
165+ let maskLayer = CAGradientLayer()
166+ maskLayer.colors = [UIColor.black.cgColor, UIColor.clear.cgColor]
167+ maskLayer.endPoint = CGPoint(x: 0.5, y: 1 - (hiddenByGradient/textHeight))
168+ let minPoint = minGradientAmount / textHeight
169+ maskLayer.startPoint = CGPoint(x: 0.5, y: 1 - max(minPoint, gradientRatio))
170+ print(maskLayer.startPoint)
171+ maskLayer.frame = body.bounds
172+ maskView.frame = body.bounds
173+ maskView.layer.addSublayer(maskLayer)
174+ body.mask = maskView
175+ } else {
176+ body.frame.size.height = size.height
177+ }
146
178
147 largeStack.addArrangedSubview(.view(body))
179 largeStack.addArrangedSubview(.view(body))
148
180
@@ -157,5 +189,8 @@ class CardView: UIView {
157
189
158 frame.size = CGSize(width: width + padding.x * 2, height: min(height, largeStack.frame.height))
190 frame.size = CGSize(width: width + padding.x * 2, height: min(height, largeStack.frame.height))
159
191
192+ gradient.frame = self.bounds
193+ gradient.endPoint = CGPoint(x: 0.5, y: bounds.height / height)
194+
160 }
195 }
161}
196}
Melk/MainCoordinator.swift+8−2
@@ -27,6 +27,14 @@ class MainCoordinator {
27 deleteRealmIfMigrationNeeded: true)
27 deleteRealmIfMigrationNeeded: true)
28
28
29 navC = UINavigationController(rootViewController: mainVC)
29 navC = UINavigationController(rootViewController: mainVC)
30+
31+ mainVC.present = { tags in
32+ if tags.count > 0 {
33+ self.secondaryCoord.present(tag: tags.first!)
34+ self.stream.rules = tags
35+ self.stream.connect()
36+ }
37+ }
30 updateScreens()
38 updateScreens()
31 stream.handleResult = { result in
39 stream.handleResult = { result in
32 self.secondaryCoord.add(result: result)
40 self.secondaryCoord.add(result: result)
@@ -44,8 +52,6 @@ class MainCoordinator {
44// }
52// }
45 print("didAuthorize")
53 print("didAuthorize")
46 window.rootViewController = navC
54 window.rootViewController = navC
47− stream.rules = ["я", "а", "и"]
48− stream.connect()
49 }
55 }
50
56
51 func updateScreens() {
57 func updateScreens() {
Melk/MainViewController.swift+22−2
@@ -29,7 +29,9 @@ class MainViewController: UIViewController {
29 }
29 }
30
30
31 @objc private func presentTags() {
31 @objc private func presentTags() {
32−
32+ present?(
33+ mainView.tags.flatMap({$0}).filter({$0 != ""})
34+ )
33 }
35 }
34}
36}
35
37
@@ -45,6 +47,8 @@ class MainView: UIView {
45 tableView.rowHeight = UITableViewAutomaticDimension
47 tableView.rowHeight = UITableViewAutomaticDimension
46 tableView.register(TitleTableViewCell.self, forCellReuseIdentifier: TitleTableViewCell.identifier)
48 tableView.register(TitleTableViewCell.self, forCellReuseIdentifier: TitleTableViewCell.identifier)
47 tableView.register(TagTableViewCell.self, forCellReuseIdentifier: TagTableViewCell.identifier)
49 tableView.register(TagTableViewCell.self, forCellReuseIdentifier: TagTableViewCell.identifier)
50+ tableView.separatorStyle = .none
51+ tableView.allowsSelection = false
48 setNeedsLayout()
52 setNeedsLayout()
49 }
53 }
50
54
@@ -52,6 +56,17 @@ class MainView: UIView {
52 tableView.frame = bounds
56 tableView.frame = bounds
53 }
57 }
54
58
59+ fileprivate var tags: [String?] = [nil] {
60+ didSet {
61+ if tags.last! != nil && tags.last! != "" {
62+ if tags.count < 10 {
63+ tags.append(nil)
64+ tableView.insertRows(at: [IndexPath.init(row: tags.count - 1, section: 0)], with: .automatic)
65+ }
66+ }
67+ }
68+ }
69+
55 required init?(coder aDecoder: NSCoder) {
70 required init?(coder aDecoder: NSCoder) {
56 fatalError("init(coder:) has not been implemented")
71 fatalError("init(coder:) has not been implemented")
57 }
72 }
@@ -62,13 +77,18 @@ extension MainView: UITableViewDataSource {
62 if let cell = tableView.dequeueReusableCell(withIdentifier: TagTableViewCell.identifier) as? TagTableViewCell {
77 if let cell = tableView.dequeueReusableCell(withIdentifier: TagTableViewCell.identifier) as? TagTableViewCell {
63// cell.titleText = "Testing testing 1 2 3"
78// cell.titleText = "Testing testing 1 2 3"
64 cell.style = indexPath.item == 0 ? .large : .normal
79 cell.style = indexPath.item == 0 ? .large : .normal
80+ let index = indexPath.row
81+ cell.tagDidChange = { tag in
82+ self.tags[index] = tag
83+ }
84+ cell.tagString = tags[index]
65 return cell
85 return cell
66 }
86 }
67 return UITableViewCell()
87 return UITableViewCell()
68 }
88 }
69
89
70 func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
90 func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
71− return 3
91+ return tags.count
72 }
92 }
73
93
74 func numberOfSections(in tableView: UITableView) -> Int {
94 func numberOfSections(in tableView: UITableView) -> Int {
Melk/SecondaryCoordinator.swift+12
@@ -12,12 +12,21 @@ class SecondaryCoordinator {
12
12
13 var windows: [UIWindow] = []
13 var windows: [UIWindow] = []
14
14
15+ private var didStartPresenting = false
16+ private var tag: String = ""
17+
15 func add(result: StreamingServiceResult) {
18 func add(result: StreamingServiceResult) {
16 for vc in VCs {
19 for vc in VCs {
17 vc.add(result: result)
20 vc.add(result: result)
18 }
21 }
19 }
22 }
20
23
24+ func present(tag newTag: String) {
25+ didStartPresenting = true
26+ self.tag = newTag
27+ VCs.map({ $0.present(tag: newTag) })
28+ }
29+
21 init() {
30 init() {
22
31
23 }
32 }
@@ -36,6 +45,9 @@ class SecondaryCoordinator {
36 VCs.append(VC)
45 VCs.append(VC)
37 window.rootViewController = VC
46 window.rootViewController = VC
38 windows.append(window)
47 windows.append(window)
48+ if didStartPresenting {
49+ VC.present(tag: tag)
50+ }
39 }
51 }
40 }
52 }
41}
53}
Melk/SecondaryViewController.swift+53−4
@@ -19,6 +19,10 @@ class SecondaryViewController: UIViewController {
19 sView.add(result: result)
19 sView.add(result: result)
20 }
20 }
21
21
22+ func present(tag: String) {
23+ sView.present(tag: tag)
24+ }
25+
22 required init?(coder aDecoder: NSCoder) {
26 required init?(coder aDecoder: NSCoder) {
23 fatalError("init(coder:) has not been implemented")
27 fatalError("init(coder:) has not been implemented")
24 }
28 }
@@ -28,13 +32,38 @@ class SecondaryViewController: UIViewController {
28
32
29class SecondaryView: UIView {
33class SecondaryView: UIView {
30
34
35+ var mainTag: String? {
36+ get {
37+ return tagLabel.text
38+ }
39+ set {
40+ tagLabel.text = newValue
41+
42+ }
43+ }
44+
31
45
32 private let spacer: CGFloat = 32
46 private let spacer: CGFloat = 32
47+ private let bottomSpacer: CGFloat = 64
48+ private let tagSpacer: CGFloat = 32
49+ private let tagLabel = UILabel()
50+ private let melkLabel = UILabel()
51+
52+ func present(tag: String) {
53+ UIView.perform(.delete, on: [melkLabel], options: [], animations: nil) { (_) in
54+ self.melkLabel.removeFromSuperview()
55+ self.mainTag = tag
56+ self.tagLabel.sizeToFit()
57+ self.layoutIfNeeded(animated: true)
58+ }
59+ }
33
60
34 func add(result: StreamingServiceResult) {
61 func add(result: StreamingServiceResult) {
35 switch result {
62 switch result {
36 case .post(let post):
63 case .post(let post):
37 let card = CardContainer()
64 let card = CardContainer()
65+ card.minWidth = min(bounds.width / 2.3, 550)
66+ card.height = cardHeight
38 card.post = post
67 card.post = post
39 cards.addArrangedSubview(.spacer(spacer))
68 cards.addArrangedSubview(.spacer(spacer))
40 cards.addArrangedSubview(.view(card))
69 cards.addArrangedSubview(.view(card))
@@ -51,6 +80,15 @@ class SecondaryView: UIView {
51 super.init(frame: frame)
80 super.init(frame: frame)
52 backgroundColor = #colorLiteral(red: 1, green: 1, blue: 1, alpha: 1)
81 backgroundColor = #colorLiteral(red: 1, green: 1, blue: 1, alpha: 1)
53 addSubview(cards)
82 addSubview(cards)
83+
84+ melkLabel.text = "Melk"
85+ melkLabel.font = UIFont.systemFont(ofSize: 200, weight: UIFontWeightHeavy)
86+ melkLabel.textColor = #colorLiteral(red: 0.9601849914, green: 0.9601849914, blue: 0.9601849914, alpha: 1)
87+ addSubview(melkLabel)
88+
89+ tagLabel.font = UIFont.systemFont(ofSize: 69, weight: UIFontWeightBold)
90+ tagLabel.textColor = #colorLiteral(red: 0.3176470588, green: 0.3179988265, blue: 0.3179988265, alpha: 1)
91+ addSubview(tagLabel)
54 }
92 }
55
93
56 func setNeedsLayout(animated: Bool) {
94 func setNeedsLayout(animated: Bool) {
@@ -64,6 +102,7 @@ class SecondaryView: UIView {
64 private var animate: Bool = false
102 private var animate: Bool = false
65
103
66 private func cleanCards() {
104 private func cleanCards() {
105+ var offset = 0
67 outLoop: for (i, element) in cards.arrangedSubviews.enumerated() {
106 outLoop: for (i, element) in cards.arrangedSubviews.enumerated() {
68 switch element {
107 switch element {
69 case .view(let card):
108 case .view(let card):
@@ -71,8 +110,9 @@ class SecondaryView: UIView {
71 if cardFrame.intersects(bounds) {
110 if cardFrame.intersects(bounds) {
72 break outLoop
111 break outLoop
73 } else {
112 } else {
74− cards.arrangedSubviews.remove(at: i-1)
113+ cards.arrangedSubviews.remove(at: i-1-offset)
75− cards.arrangedSubviews.remove(at: i-1)
114+ cards.arrangedSubviews.remove(at: i-1-offset)
115+ offset += 2
76 }
116 }
77 case .spacer(_):
117 case .spacer(_):
78 break
118 break
@@ -80,13 +120,21 @@ class SecondaryView: UIView {
80 }
120 }
81 }
121 }
82
122
83− private let padding = CGPoint(x: 32, y: 32)
123+ private let padding = CGPoint(x: 32, y: 16)
124+ private var cardHeight: CGFloat = 400
84
125
85 override func layoutSubviews() {
126 override func layoutSubviews() {
86 super.layoutSubviews()
127 super.layoutSubviews()
128+
129+ melkLabel.sizeToFit()
130+ melkLabel.center = center
131+
87 let updates = {
132 let updates = {
133+ self.tagLabel.sizeToFit()
134+ self.tagLabel.center.x = self.center.x
135+ self.tagLabel.frame.origin.y = self.tagSpacer
136+ self.cards.frame.origin.y = self.tagLabel.frame.maxY + self.padding.y
88 self.cards.layoutIfNeeded()
137 self.cards.layoutIfNeeded()
89− self.cards.frame.origin.y = self.padding.y
90 self.cards.frame.origin.x = self.frame.width - self.padding.x - self.cards.frame.width
138 self.cards.frame.origin.x = self.frame.width - self.padding.x - self.cards.frame.width
91 }
139 }
92 if animate {
140 if animate {
@@ -98,6 +146,7 @@ class SecondaryView: UIView {
98 updates()
146 updates()
99 self.cleanCards()
147 self.cleanCards()
100 }
148 }
149+ cardHeight = bounds.height - tagLabel.frame.height - padding.y - tagSpacer - bottomSpacer
101 animate = false
150 animate = false
102 }
151 }
103
152
Melk/TableViewCells.swift+12−3
@@ -57,6 +57,12 @@ class TagTableViewCell: UITableViewCell {
57 }
57 }
58 }
58 }
59
59
60+ var tagDidChange: ((String?) -> ())?
61+
62+ @objc private func textDidChange() {
63+ tagDidChange?(tagString)
64+ }
65+
60 var style: TagStyle = .normal {
66 var style: TagStyle = .normal {
61 didSet {
67 didSet {
62 updateStyle()
68 updateStyle()
@@ -70,6 +76,9 @@ class TagTableViewCell: UITableViewCell {
70
76
71 textField.borderStyle = .roundedRect
77 textField.borderStyle = .roundedRect
72 textField.adjustsFontSizeToFitWidth = false
78 textField.adjustsFontSizeToFitWidth = false
79+ textField.autocapitalizationType = .none
80+ textField.autocorrectionType = .no
81+ textField.addTarget(self, action: #selector(self.textDidChange), for: .editingChanged)
73
82
74 contentView.addSubview(textField)
83 contentView.addSubview(textField)
75// textField.delegate = self
84// textField.delegate = self
@@ -92,7 +101,7 @@ class TagTableViewCell: UITableViewCell {
92 CGRect.infinite, limitedToNumberOfLines: 1)
101 CGRect.infinite, limitedToNumberOfLines: 1)
93 .height + 2*2
102 .height + 2*2
94
103
95− let frame = CGRect(x: 16, y: 8, width: bounds.width - 16*2, height: height)
104+ let frame = CGRect(x: 16, y: style == .large ? 32 : 4, width: bounds.width - 16*2, height: height)
96 textField.frame = frame
105 textField.frame = frame
97 print(textField.frame)
106 print(textField.frame)
98 }
107 }
@@ -103,8 +112,8 @@ class TagTableViewCell: UITableViewCell {
103
112
104
113
105 static let identifier = "io.Melk.tagTableViewCell"
114 static let identifier = "io.Melk.tagTableViewCell"
106− static let largeHeight: CGFloat = 37.5 + 8*2
115+ static let largeHeight: CGFloat = 37.5 + 16 + 32
107− static let normalHeight: CGFloat = 28.0 + 8*2
116+ static let normalHeight: CGFloat = 28.0 + 4*2
108}
117}
109
118
110//extension TagTableViewCell: UITextFieldDelegate {
119//extension TagTableViewCell: UITextFieldDelegate {
Melk/VKData.swift+7−7
@@ -289,13 +289,13 @@ class VKData {
289 photo.width.value = json["width"].int
289 photo.width.value = json["width"].int
290 photo.height.value = json["height"].int
290 photo.height.value = json["height"].int
291 var surl: String?
291 var surl: String?
292− if let imageSurl = json["photo_2560"].string {
292+// if let imageSurl = json["photo_2560"].string {
293− surl = imageSurl
293+// surl = imageSurl
294− } else if let imageSurl = json["photo_1280"].string {
294+// } else if let imageSurl = json["photo_1280"].string {
295− surl = imageSurl
295+// surl = imageSurl
296− } else if let imageSurl = json["photo_807"].string {
296+// } else if let imageSurl = json["photo_807"].string {
297− surl = imageSurl
297+// surl = imageSurl
298− } else if let imageSurl = json["photo_604"].string {
298+ /*} else*/ if let imageSurl = json["photo_604"].string {
299 surl = imageSurl
299 surl = imageSurl
300 } else if let imageSurl = json["photo_130"].string {
300 } else if let imageSurl = json["photo_130"].string {
301 surl = imageSurl
301 surl = imageSurl
Melk/VKServer.swift+1−1
@@ -118,6 +118,6 @@ class VKServer {
118}
118}
119
119
120fileprivate func url(`for` method: String) -> URL {
120fileprivate func url(`for` method: String) -> URL {
121− let surl = "https://api.vk.com/method/\(method)?access_token=\(accessKey)&v=\(vkAPIVersion)"
121+ let surl = "https://api.vk.com/method/\(method)?access_token=\(accessKey)&v=\(vkAPIVersion)&lang=0"
122 return URL.init(string: surl)!
122 return URL.init(string: surl)!
123}
123}