Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
0656937
ячейка новостей сверстана из нескольких ячеек. Новость - секция
ioscoder-RS Mar 15, 2020
e207aab
реализована бесконечная дозагрузка новостей
ioscoder-RS Mar 15, 2020
54f1c3c
высота ячейки collectionView теперь равна нулю, если в сообщении нет …
ioscoder-RS Mar 15, 2020
45e07e1
добавил функционал Pull-to-refresh
ioscoder-RS Mar 16, 2020
af5dbd6
layout добавил
ioscoder-RS Mar 16, 2020
294a164
удалил задвоение и добавил задержку между вопросами
ioscoder-RS Mar 17, 2020
77100cb
Автонастройка высоты текста + исправлен баг по обновлению сообщений
ioscoder-RS Mar 19, 2020
3e1f353
Формат отображения данных поправил + легкий рефакторинг
ioscoder-RS Mar 19, 2020
643830f
 сделал video/preview опциональным
ioscoder-RS Mar 19, 2020
68754c3
реализовал делегат ячейки и перерисовку из ViewController'а
ioscoder-RS Mar 20, 2020
6c3e442
облегчил модель данных. Добавил опционалы в парсинговой структуре VKNews
ioscoder-RS Mar 23, 2020
2764b32
убрал Texture
ioscoder-RS Mar 23, 2020
74f28b4
Реализован тип ячейки link
ioscoder-RS Mar 24, 2020
41ef160
Добавил Compositional Layout, исправил баг в фото друзей, удалил код …
ioscoder-RS Mar 27, 2020
935c361
добавил Compositional Layout в фотографии пользователя + добавил пров…
ioscoder-RS Mar 28, 2020
9688dfe
Исправлена ошибка с логином
ioscoder-RS Mar 29, 2020
2390124
добавил иконку профиля на экран новостей
ioscoder-RS Mar 29, 2020
169e2f8
Многопользовательский режим. Возможность сменить пользователя
ioscoder-RS Apr 1, 2020
3b4a003
почистил лишние файлы (google.info.plist)
ioscoder-RS Apr 1, 2020
965164b
восстановил googleservice-Info-plist
ioscoder-RS Apr 1, 2020
19a70d3
delete GoogleService-Info.plist
ioscoder-RS Apr 2, 2020
0de9508
return gooogleService-info.plist
ioscoder-RS Apr 2, 2020
ada89c1
x
ioscoder-RS Apr 6, 2020
fdde58a
minor changes
ioscoder-RS Apr 6, 2020
9c8bb93
ручная верстка констрейнтов реализована
ioscoder-RS Apr 6, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Binary file removed 20-02-2020-morning.zip
Binary file not shown.
367 changes: 171 additions & 196 deletions GeekbrainsUI.xcodeproj/project.pbxproj
100644 → 100755

Large diffs are not rendered by default.

Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
3 changes: 3 additions & 0 deletions GeekbrainsUI.xcworkspace/contents.xcworkspacedata
100644 → 100755

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Empty file modified GeekbrainsUI.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
100644 → 100755
Empty file.
Empty file.
Empty file.
Binary file modified GeekbrainsUI.xcworkspace/xcuserdata/raskin-sa.xcuserdatad/UserInterfaceState.xcuserstate
100644 → 100755
Binary file not shown.
Empty file.
694 changes: 443 additions & 251 deletions ...rainsUI.xcworkspace/xcuserdata/raskin-sa.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
100644 → 100755

Large diffs are not rendered by default.

Empty file.
43 changes: 0 additions & 43 deletions GeekbrainsUI/AnimatedTransitions/FadePopPushAnimation.swift

This file was deleted.

34 changes: 0 additions & 34 deletions GeekbrainsUI/AnimationPop/ImageViewerPresenter.swift

This file was deleted.

43 changes: 0 additions & 43 deletions GeekbrainsUI/AnimationPop/PopAnimator.swift

This file was deleted.

27 changes: 0 additions & 27 deletions GeekbrainsUI/AnimationPop/UIApplication+Controller.swift

This file was deleted.

56 changes: 0 additions & 56 deletions GeekbrainsUI/Animations/Animator.swift

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ class CustomAnimator : NSObject, UIViewControllerAnimatedTransitioning {
var duration : TimeInterval
var isPresenting : Bool
var originFrame : CGRect
var image : UIImage
var imageURL : String


public let CustomAnimatorTag = 99

init(duration : TimeInterval, isPresenting : Bool, originFrame : CGRect, image : UIImage) {
init(duration : TimeInterval, isPresenting : Bool, originFrame : CGRect, imageURL : String) {
self.duration = duration
self.isPresenting = isPresenting
self.originFrame = originFrame
self.image = image
self.imageURL = imageURL
}

func animateTransition(using transitionContext: UIViewControllerContextTransitioning) {
Expand All @@ -49,12 +49,14 @@ class CustomAnimator : NSObject, UIViewControllerAnimatedTransitioning {

guard let artwork = detailView.viewWithTag(CustomAnimatorTag) as? UIImageView else { return }

artwork.image = image
guard let url = URL(string: imageURL ) else {return}

artwork.kf.setImage(with: url)
artwork.alpha = 0


let transitionImageView = UIImageView(frame: isPresenting ? originFrame : artwork.frame)
transitionImageView.image = image
transitionImageView.kf.setImage(with: url)

container.addSubview(transitionImageView)

Expand Down
File renamed without changes.
Empty file modified GeekbrainsUI/Animations/EmitterSnow.swift
100644 → 100755
Empty file.
Empty file modified GeekbrainsUI/Animations/LoadIndicators.swift
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion GeekbrainsUI/AppDelegate.swift
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.

setRealmConfig(version: 7)
setRealmConfig(version: 15)

FirebaseApp.configure()

Expand Down
82 changes: 81 additions & 1 deletion GeekbrainsUI/Application/AppFunctions.swift
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//

import UIKit
import WebKit

func showYesNoMessage(view: UIViewController, title: String, messagetext: String, completion:@escaping (_ result:Bool) -> Void) {

Expand All @@ -28,6 +29,11 @@ func showYesNoMessage(view: UIViewController, title: String, messagetext: String

}// func showYesNoMessage




/// калькулятор форматов: https://nsdateformatter.com

func convertUnixTime(unixTime:Int)-> String {
//функция конвертации UNIX-даты
let unixTimestamp = unixTime
Expand All @@ -39,5 +45,79 @@ func convertUnixTime(unixTime:Int)-> String {
dateFormatter.locale = Locale(identifier: "ru_RU")
dateFormatter.dateFormat = "EEEE, HH:mm" //Specify your format that you want
return (dateFormatter.string(from: date))

}

func viewableUnixTime(unixTime:Int) -> String {

let unixTimestamp = unixTime
let date = Date(timeIntervalSince1970: TimeInterval(unixTimestamp))
let dateFormatter = DateFormatter()
let timeFormatter = DateFormatter()

//отсчитываем 6 дней назад от текущей даты
let before = Date().addingTimeInterval(-(60*60*24*6))

timeFormatter.dateFormat = "HH:mm"
dateFormatter.timeZone = TimeZone(abbreviation: "GMT")
dateFormatter.locale = Locale(identifier: "ru_RU")

if Calendar.current.isDateInToday(date) {

return "сегодня в \(timeFormatter.string(from: date))"
}
else if Calendar.current.isDateInYesterday(date) {
return "вчера в \(timeFormatter.string(from: date))"
}
else if date > before {
dateFormatter.dateFormat = "EEEE"
return "\(dateFormatter.string(from: date)) в \(timeFormatter.string(from: date))"
}
else {
dateFormatter.dateFormat = "d MMMM"
return "\(dateFormatter.string(from: date)) \(timeFormatter.string(from: date))"
}
}

extension String {
func getHeight(constraintedWidth width: CGFloat, font: UIFont) -> CGFloat {
let label = UILabel(frame: CGRect(x: 0, y: 0, width: width, height: .greatestFiniteMagnitude))
label.numberOfLines = 0
label.text = self
label.font = font
label.sizeToFit()

return ceil(label.frame.height)
}
}


extension UIViewController {
func showAlert(error: Error) {
let alertVC = UIAlertController(title: "Error", message: error.localizedDescription, preferredStyle: .alert)

alertVC.addAction(UIAlertAction(title: "Ok", style: .default, handler: nil))
present(alertVC, animated: true, completion: nil)
}
}


extension WKWebView {

private var httpCookieStore: WKHTTPCookieStore { return WKWebsiteDataStore.default().httpCookieStore }

func getCookies(for domain: String? = nil, completion: @escaping ([String : Any])->()) {
var cookieDict = [String : AnyObject]()
httpCookieStore.getAllCookies { cookies in
for cookie in cookies {
if let domain = domain {
if cookie.domain.contains(domain) {
cookieDict[cookie.name] = cookie.properties as AnyObject?
}
} else {
cookieDict[cookie.name] = cookie.properties as AnyObject?
}
}
completion(cookieDict)
}
}
}
17 changes: 15 additions & 2 deletions GeekbrainsUI/Application/AppVariables.swift
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import Foundation
import UIKit

let debugMode = 0 //1 - debug on, 0 - debug off
let debugPrefetchMode = false //true - печатает лог, falsе - не печатает

enum DatabaseType {
case Realm
Expand All @@ -21,5 +22,17 @@ enum DatabaseType {
var databaseMode = true //флаг пишем ли в БД или только с Web работаем
var webMode = false //флаг работаем офлайн или с обращением к интернету



//extension Date {
// var millisecondsSince1970:Int64 {
// return Int64((self.timeIntervalSince1970 * 1000.0).rounded())
// }
//
// init(milliseconds:Int64) {
// self = Date(timeIntervalSince1970: TimeInterval(milliseconds) / 1000)
// }
//}

struct Section<T>{
var title: String
var items: [T]
}
1 change: 1 addition & 0 deletions GeekbrainsUI/Model/Singleton.swift → GeekbrainsUI/Application/Singleton.swift
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ class Session {
var userId = "0"
var webView = WKWebView()
var version = ""
var appVersion = 0.0
}
Loading