mirror of
https://github.com/wahyd4/Yep.git
synced 2026-08-18 17:25:59 +10:00
Merge branch 'develop' of https://github.com/CatchChat/Yep into develop
This commit is contained in:
@@ -2,6 +2,7 @@ source 'https://github.com/CocoaPods/Specs.git'
|
||||
platform :ios, '8.0'
|
||||
use_frameworks!
|
||||
|
||||
pod 'Ruler'
|
||||
pod 'Proposer'
|
||||
pod 'APAddressBook/Swift'
|
||||
pod 'FXBlurView'
|
||||
|
||||
+4
-1
@@ -36,6 +36,7 @@ PODS:
|
||||
- Realm/Headers (0.93.2)
|
||||
- RealmSwift (0.93.2):
|
||||
- Realm (= 0.93.2)
|
||||
- Ruler (0.5)
|
||||
- SocketRocket (0.4)
|
||||
- TPKeyboardAvoiding (1.2.8)
|
||||
|
||||
@@ -48,6 +49,7 @@ DEPENDENCIES:
|
||||
- pop
|
||||
- Proposer
|
||||
- RealmSwift
|
||||
- Ruler
|
||||
- TPKeyboardAvoiding (~> 1.2)
|
||||
|
||||
EXTERNAL SOURCES:
|
||||
@@ -65,7 +67,8 @@ SPEC CHECKSUMS:
|
||||
Proposer: 6fa2c0dc88b5445aed16786c6717d3676586ff9b
|
||||
Realm: 2fdd0ae74f730e190384e0338d8a0d3654df8220
|
||||
RealmSwift: 231b064da9f98b1c4f325fe1f1cb8756aae2b8d6
|
||||
Ruler: bf01a372f064c900c089c78abd75c2685a86ecba
|
||||
SocketRocket: 01443933b7bc362621325f4607b80b4286a99707
|
||||
TPKeyboardAvoiding: f1ef0028fe9ba98ef2871cf55b4bbc39cae0267b
|
||||
|
||||
COCOAPODS: 0.37.2
|
||||
COCOAPODS: 0.38.0
|
||||
|
||||
@@ -175,7 +175,6 @@
|
||||
508F8FDB1B0479E700461B0B /* SocialWorkInstagramViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 508F8FDA1B0479E700461B0B /* SocialWorkInstagramViewController.swift */; };
|
||||
508F8FDE1B049ACF00461B0B /* InstagramMediaCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 508F8FDC1B049ACF00461B0B /* InstagramMediaCell.swift */; };
|
||||
508F8FDF1B049ACF00461B0B /* InstagramMediaCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 508F8FDD1B049ACF00461B0B /* InstagramMediaCell.xib */; };
|
||||
508F8FE21B04B1F900461B0B /* UIDevice+Yep.swift in Sources */ = {isa = PBXBuildFile; fileRef = 508F8FE11B04B1F900461B0B /* UIDevice+Yep.swift */; };
|
||||
5099B9C41AB9510D002F940B /* RankView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5099B9C31AB9510D002F940B /* RankView.swift */; };
|
||||
5099B9C71AB99F7B002F940B /* RegisterPickAvatarViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5099B9C61AB99F7B002F940B /* RegisterPickAvatarViewController.swift */; };
|
||||
5099B9C91AB9A7CB002F940B /* CameraPreviewView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5099B9C81AB9A7CB002F940B /* CameraPreviewView.swift */; };
|
||||
@@ -400,7 +399,6 @@
|
||||
508F8FDA1B0479E700461B0B /* SocialWorkInstagramViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SocialWorkInstagramViewController.swift; path = ViewControllers/SocialWorks/SocialWorkInstagramViewController.swift; sourceTree = "<group>"; };
|
||||
508F8FDC1B049ACF00461B0B /* InstagramMediaCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = InstagramMediaCell.swift; path = Views/Cells/InstagramMedia/InstagramMediaCell.swift; sourceTree = "<group>"; };
|
||||
508F8FDD1B049ACF00461B0B /* InstagramMediaCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = InstagramMediaCell.xib; path = Views/Cells/InstagramMedia/InstagramMediaCell.xib; sourceTree = "<group>"; };
|
||||
508F8FE11B04B1F900461B0B /* UIDevice+Yep.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "UIDevice+Yep.swift"; path = "Extensions/UIDevice+Yep.swift"; sourceTree = "<group>"; };
|
||||
5099B9C31AB9510D002F940B /* RankView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = RankView.swift; path = Views/Rank/RankView.swift; sourceTree = "<group>"; };
|
||||
5099B9C61AB99F7B002F940B /* RegisterPickAvatarViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = RegisterPickAvatarViewController.swift; path = ViewControllers/Register/RegisterPickAvatarViewController.swift; sourceTree = "<group>"; };
|
||||
5099B9C81AB9A7CB002F940B /* CameraPreviewView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = CameraPreviewView.swift; path = Views/CameraPreview/CameraPreviewView.swift; sourceTree = "<group>"; };
|
||||
@@ -753,7 +751,6 @@
|
||||
0A3E605F1ACCA9C0003DC853 /* String+Yep.swift */,
|
||||
50A9D44A1ACD37A8000B2599 /* NSFileManager+Yep.swift */,
|
||||
50553F921ADBA50600F80B59 /* NSDate+Yep.swift */,
|
||||
508F8FE11B04B1F900461B0B /* UIDevice+Yep.swift */,
|
||||
0AEB1CC51B0E742400178C9C /* Double+Yep.swift */,
|
||||
503A54EC1B328ADB002077BD /* NSLocale+Yep.swift */,
|
||||
501560D61B427FD6000933F0 /* Results+Yep.swift */,
|
||||
@@ -1700,7 +1697,6 @@
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
508F8FE21B04B1F900461B0B /* UIDevice+Yep.swift in Sources */,
|
||||
50894CFE1AEA5A78000981AF /* EditProfileViewController.swift in Sources */,
|
||||
50CDBE421ACA9B4200459CE0 /* ChatRightImageCell.swift in Sources */,
|
||||
5099B9C41AB9510D002F940B /* RankView.swift in Sources */,
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import Ruler
|
||||
|
||||
class YepConfig {
|
||||
|
||||
@@ -86,7 +87,7 @@ class YepConfig {
|
||||
}
|
||||
|
||||
struct Profile {
|
||||
static let leftEdgeInset: CGFloat = UIDevice.matchWidthFrom(20, 38, 40)
|
||||
static let leftEdgeInset: CGFloat = Ruler.match(.iPhoneWidths(20, 38, 40))
|
||||
static let rightEdgeInset: CGFloat = leftEdgeInset
|
||||
static let introductionLabelFont = UIFont(name: "Helvetica-Light", size: 14)!
|
||||
}
|
||||
@@ -105,7 +106,7 @@ class YepConfig {
|
||||
|
||||
struct SocialWorkGithub {
|
||||
struct Repo {
|
||||
static let leftEdgeInset = UIDevice.matchWidthFrom(20, 38, 40)
|
||||
static let leftEdgeInset = Ruler.match(.iPhoneWidths(20, 38, 40))
|
||||
static let rightEdgeInset = leftEdgeInset
|
||||
}
|
||||
}
|
||||
@@ -117,8 +118,8 @@ class YepConfig {
|
||||
struct ChatCell {
|
||||
static let gapBetweenDotImageViewAndBubble: CGFloat = 5
|
||||
|
||||
static let mediaPreferredWidth: CGFloat = UIDevice.matchWidthFrom(192, 225, 250)
|
||||
static let mediaPreferredHeight: CGFloat = UIDevice.matchWidthFrom(208, 244, 270)
|
||||
static let mediaPreferredWidth: CGFloat = Ruler.match(.iPhoneWidths(192, 225, 250))
|
||||
static let mediaPreferredHeight: CGFloat = Ruler.match(.iPhoneWidths(208, 244, 270))
|
||||
|
||||
static let mediaMinWidth: CGFloat = 60
|
||||
static let mediaMinHeight: CGFloat = 30
|
||||
|
||||
@@ -1,91 +0,0 @@
|
||||
//
|
||||
// UIDevice+Yep.swift
|
||||
// Yep
|
||||
//
|
||||
// Created by NIX on 15/5/14.
|
||||
// Copyright (c) 2015年 Catch Inc. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
extension UIDevice {
|
||||
|
||||
// 只考虑宽度的模型
|
||||
|
||||
enum ScreenWidthModel {
|
||||
case Classic
|
||||
case Bigger
|
||||
case BiggerPlus
|
||||
}
|
||||
|
||||
static let screenWidthModel: ScreenWidthModel = {
|
||||
|
||||
let screen = UIScreen.mainScreen()
|
||||
let nativeWidth = screen.nativeBounds.size.width
|
||||
|
||||
if nativeWidth == 320 * 2 {
|
||||
return .Classic
|
||||
|
||||
} else if nativeWidth == 375 * 2 {
|
||||
return .Bigger
|
||||
|
||||
} else if nativeWidth == 414 * 3 {
|
||||
return .BiggerPlus
|
||||
}
|
||||
|
||||
return .Bigger // Default
|
||||
}()
|
||||
|
||||
class func matchWidthFrom(classic: CGFloat, _ bigger: CGFloat, _ biggerPlus: CGFloat) -> CGFloat {
|
||||
switch screenWidthModel {
|
||||
case .Classic:
|
||||
return classic
|
||||
case .Bigger:
|
||||
return bigger
|
||||
case .BiggerPlus:
|
||||
return biggerPlus
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 整个屏幕的模型
|
||||
|
||||
enum ScreenModel {
|
||||
case Inch35
|
||||
case Inch4
|
||||
case Bigger
|
||||
case BiggerPlus
|
||||
}
|
||||
|
||||
static let screenModel: ScreenModel = {
|
||||
|
||||
let screen = UIScreen.mainScreen()
|
||||
let nativeWidth = screen.nativeBounds.size.width
|
||||
|
||||
if nativeWidth == 320 * 2 {
|
||||
let nativeHeight = screen.nativeBounds.size.height
|
||||
return nativeHeight > (480 * 2) ? .Inch4 : .Inch35
|
||||
|
||||
} else if nativeWidth == 375 * 2 {
|
||||
return .Bigger
|
||||
|
||||
} else if nativeWidth == 414 * 3 {
|
||||
return .BiggerPlus
|
||||
}
|
||||
|
||||
return .Bigger // Default
|
||||
}()
|
||||
|
||||
class func matchFrom(inch35: CGFloat, _ inch4: CGFloat, _ bigger: CGFloat, _ biggerPlus: CGFloat) -> CGFloat {
|
||||
switch screenModel {
|
||||
case .Inch35:
|
||||
return inch35
|
||||
case .Inch4:
|
||||
return inch4
|
||||
case .Bigger:
|
||||
return bigger
|
||||
case .BiggerPlus:
|
||||
return biggerPlus
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,11 +7,12 @@
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import Ruler
|
||||
|
||||
extension UIImage {
|
||||
|
||||
func roundImageOfRadius(radius: CGFloat) -> UIImage {
|
||||
let radius = floor(radius - UIDevice.matchWidthFrom(0.5, 0.5, 1.5))
|
||||
let radius = floor(radius - Ruler.match(.iPhoneWidths(0.5, 0.5, 1.5)))
|
||||
return self.largestCenteredSquareImage().resizeToTargetSize(CGSize(width: radius * 2, height: radius * 2)).roundImage()
|
||||
}
|
||||
|
||||
|
||||
@@ -20,18 +20,18 @@ func skillsFromUserSkillList(userSkillList: List<UserSkill>) -> [Skill] {
|
||||
userSkills.append(userSkill)
|
||||
}
|
||||
|
||||
return userSkills.map({ userSkill -> Skill? in
|
||||
return userSkills.map({ userSkill -> Skill in
|
||||
|
||||
var skillCategory: SkillCategory?
|
||||
|
||||
if let category = userSkill.category {
|
||||
let skillCategory = SkillCategory(id: category.skillCategoryID, name: category.name, localName: category.localName, skills: [])
|
||||
|
||||
let skill = Skill(category: skillCategory, id: userSkill.skillID, name: userSkill.name, localName: userSkill.localName, coverURLString: userSkill.coverURLString)
|
||||
|
||||
return skill
|
||||
skillCategory = SkillCategory(id: category.skillCategoryID, name: category.name, localName: category.localName, skills: [])
|
||||
}
|
||||
|
||||
return nil
|
||||
let skill = Skill(category: skillCategory, id: userSkill.skillID, name: userSkill.name, localName: userSkill.localName, coverURLString: userSkill.coverURLString)
|
||||
|
||||
}).filter({ $0 != nil }).map({ skill in skill! })
|
||||
return skill
|
||||
})
|
||||
}
|
||||
|
||||
func userSkillsFromSkills(skills: [Skill], inRealm realm: Realm) -> [UserSkill] {
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import Ruler
|
||||
|
||||
class EditNicknameAndBadgeViewController: UITableViewController {
|
||||
|
||||
@@ -49,7 +50,7 @@ class EditNicknameAndBadgeViewController: UITableViewController {
|
||||
nicknameTextField.text = YepUserDefaults.nickname.value
|
||||
nicknameTextField.delegate = self
|
||||
|
||||
let gap = UIDevice.matchWidthFrom(10, 25, 32)
|
||||
let gap = Ruler.match(.iPhoneWidths(10, 25, 32))
|
||||
centerLeft1GapConstraint.constant = gap
|
||||
centerRight1GapConstraint.constant = gap
|
||||
left1Left2GapConstraint.constant = gap
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import Ruler
|
||||
|
||||
class LoginByMobileViewController: UIViewController {
|
||||
|
||||
@@ -41,8 +42,8 @@ class LoginByMobileViewController: UIViewController {
|
||||
mobileNumberTextField.delegate = self
|
||||
mobileNumberTextField.addTarget(self, action: "textFieldDidChange:", forControlEvents: .EditingChanged)
|
||||
|
||||
pickMobileNumberPromptLabelTopConstraint.constant = UIDevice.matchFrom(30, 50, 60, 60)
|
||||
mobileNumberTextFieldTopConstraint.constant = UIDevice.matchFrom(30, 40, 50, 50)
|
||||
pickMobileNumberPromptLabelTopConstraint.constant = Ruler.match(.iPhoneHeights(30, 50, 60, 60))
|
||||
mobileNumberTextFieldTopConstraint.constant = Ruler.match(.iPhoneHeights(30, 40, 50, 50))
|
||||
}
|
||||
|
||||
override func viewWillAppear(animated: Bool) {
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import Ruler
|
||||
|
||||
class LoginVerifyMobileViewController: UIViewController {
|
||||
|
||||
@@ -59,9 +60,9 @@ class LoginVerifyMobileViewController: UIViewController {
|
||||
callMePromptLabel.text = NSLocalizedString("Didn't get it?", comment: "")
|
||||
callMeButton.setTitle(NSLocalizedString("Call me", comment: ""), forState: .Normal)
|
||||
|
||||
verifyMobileNumberPromptLabelTopConstraint.constant = UIDevice.matchFrom(30, 50, 60, 60)
|
||||
verifyCodeTextFieldTopConstraint.constant = UIDevice.matchFrom(30, 40, 50, 50)
|
||||
callMeButtonTopConstraint.constant = UIDevice.matchFrom(10, 20, 40, 40)
|
||||
verifyMobileNumberPromptLabelTopConstraint.constant = Ruler.match(.iPhoneHeights(30, 50, 60, 60))
|
||||
verifyCodeTextFieldTopConstraint.constant = Ruler.match(.iPhoneHeights(30, 40, 50, 50))
|
||||
callMeButtonTopConstraint.constant = Ruler.match(.iPhoneHeights(10, 20, 40, 40))
|
||||
}
|
||||
|
||||
override func viewWillAppear(animated: Bool) {
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import Ruler
|
||||
|
||||
class RegisterPickMobileViewController: UIViewController {
|
||||
|
||||
@@ -41,8 +42,8 @@ class RegisterPickMobileViewController: UIViewController {
|
||||
mobileNumberTextField.delegate = self
|
||||
mobileNumberTextField.addTarget(self, action: "textFieldDidChange:", forControlEvents: .EditingChanged)
|
||||
|
||||
pickMobileNumberPromptLabelTopConstraint.constant = UIDevice.matchFrom(30, 50, 60, 60)
|
||||
mobileNumberTextFieldTopConstraint.constant = UIDevice.matchFrom(30, 40, 50, 50)
|
||||
pickMobileNumberPromptLabelTopConstraint.constant = Ruler.match(.iPhoneHeights(30, 50, 60, 60))
|
||||
mobileNumberTextFieldTopConstraint.constant = Ruler.match(.iPhoneHeights(30, 40, 50, 50))
|
||||
}
|
||||
|
||||
override func viewWillAppear(animated: Bool) {
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import Ruler
|
||||
|
||||
class RegisterPickNameViewController: UIViewController {
|
||||
|
||||
@@ -33,8 +34,8 @@ class RegisterPickNameViewController: UIViewController {
|
||||
nameTextField.delegate = self
|
||||
nameTextField.addTarget(self, action: "textFieldDidChange:", forControlEvents: .EditingChanged)
|
||||
|
||||
pickNamePromptLabelTopConstraint.constant = UIDevice.matchFrom(30, 50, 60, 60)
|
||||
nameTextFieldTopConstraint.constant = UIDevice.matchFrom(30, 40, 50, 50)
|
||||
pickNamePromptLabelTopConstraint.constant = Ruler.match(.iPhoneHeights(30, 50, 60, 60))
|
||||
nameTextFieldTopConstraint.constant = Ruler.match(.iPhoneHeights(30, 40, 50, 50))
|
||||
}
|
||||
|
||||
override func viewWillAppear(animated: Bool) {
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import Ruler
|
||||
|
||||
class RegisterVerifyMobileViewController: UIViewController {
|
||||
|
||||
@@ -59,9 +60,9 @@ class RegisterVerifyMobileViewController: UIViewController {
|
||||
callMePromptLabel.text = NSLocalizedString("Didn't get it?", comment: "")
|
||||
callMeButton.setTitle(NSLocalizedString("Call me", comment: ""), forState: .Normal)
|
||||
|
||||
verifyMobileNumberPromptLabelTopConstraint.constant = UIDevice.matchFrom(30, 50, 60, 60)
|
||||
verifyCodeTextFieldTopConstraint.constant = UIDevice.matchFrom(30, 40, 50, 50)
|
||||
callMeButtonTopConstraint.constant = UIDevice.matchFrom(10, 20, 40, 40)
|
||||
verifyMobileNumberPromptLabelTopConstraint.constant = Ruler.match(.iPhoneHeights(30, 50, 60, 60))
|
||||
verifyCodeTextFieldTopConstraint.constant = Ruler.match(.iPhoneHeights(30, 40, 50, 50))
|
||||
callMeButtonTopConstraint.constant = Ruler.match(.iPhoneHeights(10, 20, 40, 40))
|
||||
}
|
||||
|
||||
override func viewWillAppear(animated: Bool) {
|
||||
|
||||
Reference in New Issue
Block a user