Skip to content

Commit

Permalink
Merge branch 'feature/short_trans' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
nixzhu committed Aug 12, 2016
2 parents edc4204 + 066ddc8 commit 0582870
Show file tree
Hide file tree
Showing 46 changed files with 351 additions and 212 deletions.
4 changes: 4 additions & 0 deletions Yep.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
500EED981BF07A3000C6BABC /* ConversationViewController+Feed.swift in Sources */ = {isa = PBXBuildFile; fileRef = 500EED971BF07A3000C6BABC /* ConversationViewController+Feed.swift */; };
500EED9A1BF1B81000C6BABC /* MediaPreviewViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 500EED991BF1B81000C6BABC /* MediaPreviewViewController.swift */; };
500EED9D1BF1B84A00C6BABC /* MediaPreview.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 500EED9C1BF1B84A00C6BABC /* MediaPreview.storyboard */; };
5010BD241D5D734200111342 /* String+Trans.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5010BD231D5D734200111342 /* String+Trans.swift */; };
501138261BCB59120055A014 /* FeedConversationsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 501138251BCB59120055A014 /* FeedConversationsViewController.swift */; };
5011382C1BCB5E150055A014 /* FeedConversationDockCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5011382A1BCB5E150055A014 /* FeedConversationDockCell.swift */; };
5011382D1BCB5E150055A014 /* FeedConversationDockCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 5011382B1BCB5E150055A014 /* FeedConversationDockCell.xib */; };
Expand Down Expand Up @@ -841,6 +842,7 @@
500EED971BF07A3000C6BABC /* ConversationViewController+Feed.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "ConversationViewController+Feed.swift"; path = "ViewControllers/Conversation/ConversationViewController+Feed.swift"; sourceTree = "<group>"; };
500EED991BF1B81000C6BABC /* MediaPreviewViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = MediaPreviewViewController.swift; path = ViewControllers/MediaPreview/MediaPreviewViewController.swift; sourceTree = "<group>"; };
500EED9C1BF1B84A00C6BABC /* MediaPreview.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = MediaPreview.storyboard; path = ViewControllers/MediaPreview/MediaPreview.storyboard; sourceTree = "<group>"; };
5010BD231D5D734200111342 /* String+Trans.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "String+Trans.swift"; path = "Extensions/String+Trans.swift"; sourceTree = "<group>"; };
501138251BCB59120055A014 /* FeedConversationsViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = FeedConversationsViewController.swift; path = ViewControllers/FeedConversations/FeedConversationsViewController.swift; sourceTree = "<group>"; };
5011382A1BCB5E150055A014 /* FeedConversationDockCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = FeedConversationDockCell.swift; path = Views/Cells/FeedConversationDock/FeedConversationDockCell.swift; sourceTree = "<group>"; };
5011382B1BCB5E150055A014 /* FeedConversationDockCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = FeedConversationDockCell.xib; path = Views/Cells/FeedConversationDock/FeedConversationDockCell.xib; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1989,6 +1991,7 @@
50B22E451C588B6200219625 /* CGImage+Yep.swift */,
506EC2091AC95BFC00CE42B3 /* UIFont+Yep.swift */,
0A3E605F1ACCA9C0003DC853 /* String+Yep.swift */,
5010BD231D5D734200111342 /* String+Trans.swift */,
50553F921ADBA50600F80B59 /* NSDate+Yep.swift */,
0AEB1CC51B0E742400178C9C /* Double+Yep.swift */,
504F8C031D49E8810046F6AA /* UIApplication+Yep.swift */,
Expand Down Expand Up @@ -4852,6 +4855,7 @@
504F41251ACE2D1D00FBB19A /* SampleView.swift in Sources */,
50E7C70B1CF6FC3B00E8D951 /* DiscoverContainerViewController.swift in Sources */,
50E392C01C22B30300C0CECB /* FeedGithubRepoCell.swift in Sources */,
5010BD241D5D734200111342 /* String+Trans.swift in Sources */,
50B9C5DF1D226B4500BCB8BD /* ConversationViewController+Views.swift in Sources */,
50A640EC1B6F4E420050E4A3 /* DoNotDisturbPeriodViewController.swift in Sources */,
50512A8E1D2CF9DC007BBBF3 /* ChatViewController+Preview.swift in Sources */,
Expand Down
2 changes: 1 addition & 1 deletion Yep/AlbumListController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ final class AlbumListController: UITableViewController {
override func viewDidLoad() {
super.viewDidLoad()

let cancelButton = UIBarButtonItem(title: NSLocalizedString("Cancel", comment: ""), style: .Plain, target: self, action: #selector(AlbumListController.cancel(_:)))
let cancelButton = UIBarButtonItem(title: String.trans_cancel, style: .Plain, target: self, action: #selector(AlbumListController.cancel(_:)))
navigationItem.rightBarButtonItem = cancelButton
navigationItem.hidesBackButton = true

Expand Down
132 changes: 132 additions & 0 deletions Yep/Extensions/String+Trans.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
//
// String+Trans.swift
// Yep
//
// Created by NIX on 16/8/12.
// Copyright © 2016年 Catch Inc. All rights reserved.
//

import Foundation

extension String {

static var trans_titleAbout: String {
return NSLocalizedString("title.about", comment: "")
}

static var trans_promptAcceptFriendRequestFailed: String {
return NSLocalizedString("prompt.accept_friend_request_failed", comment: "")
}

static func trans_promptSuccessfullyAddedSkill(skill: String, to set: String) -> String {
return String(format: NSLocalizedString("prompt.added_skill%@_to_set%@_successfully", comment: ""), skill, set)
}

static var trans_promptAlsoDeleteThisFeed: String {
return NSLocalizedString("prompt.also_delete_this_feed", comment: "")
}

static var trans_titleAvailableFriends: String {
return NSLocalizedString("title.available_friends", comment: "")
}

static var trans_buttonBack: String {
return NSLocalizedString("button.back", comment: "")
}

static var trans_infoBeginChatJustNow: String {
return NSLocalizedString("info.begin_chat_just_now", comment: "")
}

static var trans_titleBlock: String {
return NSLocalizedString("title.block", comment: "")
}

static var trans_titleBlockedCreators: String {
return NSLocalizedString("title.blocked_creators", comment: "")
}

static var trans_titleBlockedUsers: String {
return NSLocalizedString("title.blocked_users", comment: "")
}

static var trans_subtitleBuildWorldTogether: String {
return NSLocalizedString("subtitle.build_world_together", comment: "")
}

static var trans_promptTapNextAgreeTerms: String {
return NSLocalizedString("prompt.tap_next_agree_terms", comment: "")
}

static var trans_buttonCallMe: String {
return NSLocalizedString("button.call_me", comment: "")
}

static var trans_buttonCalling: String {
return NSLocalizedString("button.calling", comment: "")
}

static var trans_titleCamera: String {
return NSLocalizedString("title.camera", comment: "")
}

static var trans_promptCancelRecommendedFeedFailed: String {
return NSLocalizedString("prompt.cancel_recommended_feed_failed", comment: "")
}

static var trans_cancel: String {
return NSLocalizedString("cancel", comment: "")
}

static var trans_titleCancelRecommended: String {
return NSLocalizedString("title.cancel_recommended", comment: "")
}

static var trans_titleChangeMobile: String {
return NSLocalizedString("title.change_mobile", comment: "")
}

static var trans_titleChangeSkills: String {
return NSLocalizedString("title.change_skills", comment: "")
}

static var trans_titleChangeItNow: String {
return NSLocalizedString("title.change_it_now", comment: "")
}

static var trans_promptChannel: String {
return NSLocalizedString("prompt.channel", comment: "")
}

static var trans_titleChatRecords: String {
return NSLocalizedString("title.chat_records", comment: "")
}

static var trans_titleChat: String {
return NSLocalizedString("title.chat", comment: "")
}

static var trans_titleChats: String {
return NSLocalizedString("title.chats", comment: "")
}
}

extension String {

static var trans_reportAdvertising: String {
return NSLocalizedString("report.advertising", comment: "")
}

static var trans_reportPorno: String {
return NSLocalizedString("report.porno", comment: "")
}

static var trans_reportScams: String {
return NSLocalizedString("report.scams", comment: "")
}

static var trans_reportOther: String {
return NSLocalizedString("report.other", comment: "")
}
}

30 changes: 23 additions & 7 deletions Yep/Extensions/UIViewController+Yep.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,22 @@ extension UIViewController {

// MAKR: - Report

extension ReportReason {

var title: String {
switch self {
case .Porno:
return String.trans_reportPorno
case .Advertising:
return String.trans_reportAdvertising
case .Scams:
return String.trans_reportScams
case .Other:
return String.trans_reportOther
}
}
}

extension UIViewController {

enum ReportObject {
Expand Down Expand Up @@ -95,30 +111,30 @@ extension UIViewController {

let reportAlertController = UIAlertController(title: NSLocalizedString("Report Reason", comment: ""), message: nil, preferredStyle: .ActionSheet)

let pornoReasonAction: UIAlertAction = UIAlertAction(title: ReportReason.Porno.description, style: .Default) { action -> Void in
let pornoReasonAction: UIAlertAction = UIAlertAction(title: ReportReason.Porno.title, style: .Default) { _ in
reportWithReason(.Porno)
}
reportAlertController.addAction(pornoReasonAction)

let advertisingReasonAction: UIAlertAction = UIAlertAction(title: ReportReason.Advertising.description, style: .Default) { action -> Void in
let advertisingReasonAction: UIAlertAction = UIAlertAction(title: ReportReason.Advertising.title, style: .Default) { _ in
reportWithReason(.Advertising)
}
reportAlertController.addAction(advertisingReasonAction)

let scamsReasonAction: UIAlertAction = UIAlertAction(title: ReportReason.Scams.description, style: .Default) { action -> Void in
let scamsReasonAction: UIAlertAction = UIAlertAction(title: ReportReason.Scams.title, style: .Default) { _ in
reportWithReason(.Scams)
}
reportAlertController.addAction(scamsReasonAction)

let otherReasonAction: UIAlertAction = UIAlertAction(title: ReportReason.Other("").description, style: .Default) { [weak self] action -> Void in
YepAlert.textInput(title: NSLocalizedString("Other Reason", comment: ""), message: nil, placeholder: nil, oldText: nil, confirmTitle: NSLocalizedString("OK", comment: ""), cancelTitle: NSLocalizedString("Cancel", comment: ""), inViewController: self, withConfirmAction: { text in
let otherReasonAction: UIAlertAction = UIAlertAction(title: ReportReason.Other("").title, style: .Default) { [weak self] _ in
YepAlert.textInput(title: NSLocalizedString("Other Reason", comment: ""), message: nil, placeholder: nil, oldText: nil, confirmTitle: NSLocalizedString("OK", comment: ""), cancelTitle: String.trans_cancel, inViewController: self, withConfirmAction: { text in
reportWithReason(.Other(text))
}, cancelAction: nil)
}
reportAlertController.addAction(otherReasonAction)

let cancelAction: UIAlertAction = UIAlertAction(title: NSLocalizedString("Cancel", comment: ""), style: .Cancel) { action -> Void in
self.dismissViewControllerAnimated(true, completion: nil)
let cancelAction: UIAlertAction = UIAlertAction(title: String.trans_cancel, style: .Cancel) { [weak self] _ in
self?.dismissViewControllerAnimated(true, completion: nil)
}
reportAlertController.addAction(cancelAction)

Expand Down
10 changes: 5 additions & 5 deletions Yep/Helpers/YepAlert.swift
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ extension UIViewController {
func alertCanNotAccessCameraRoll() {

SafeDispatch.async {
YepAlert.confirmOrCancel(title: NSLocalizedString("Sorry", comment: ""), message: NSLocalizedString("Yep can not access your Camera Roll!\nBut you can change it in iOS Settings.", comment: ""), confirmTitle: NSLocalizedString("Change it now", comment: ""), cancelTitle: NSLocalizedString("Dismiss", comment: ""), inViewController: self, withConfirmAction: {
YepAlert.confirmOrCancel(title: NSLocalizedString("Sorry", comment: ""), message: NSLocalizedString("Yep can not access your Camera Roll!\nBut you can change it in iOS Settings.", comment: ""), confirmTitle: String.trans_titleChangeItNow, cancelTitle: NSLocalizedString("Dismiss", comment: ""), inViewController: self, withConfirmAction: {

UIApplication.sharedApplication().openURL(NSURL(string: UIApplicationOpenSettingsURLString)!)

Expand All @@ -141,7 +141,7 @@ extension UIViewController {
func alertCanNotOpenCamera() {

SafeDispatch.async {
YepAlert.confirmOrCancel(title: NSLocalizedString("Sorry", comment: ""), message: NSLocalizedString("Yep can not open your Camera!\nBut you can change it in iOS Settings.", comment: ""), confirmTitle: NSLocalizedString("Change it now", comment: ""), cancelTitle: NSLocalizedString("Dismiss", comment: ""), inViewController: self, withConfirmAction: {
YepAlert.confirmOrCancel(title: NSLocalizedString("Sorry", comment: ""), message: NSLocalizedString("Yep can not open your Camera!\nBut you can change it in iOS Settings.", comment: ""), confirmTitle: String.trans_titleChangeItNow, cancelTitle: NSLocalizedString("Dismiss", comment: ""), inViewController: self, withConfirmAction: {

UIApplication.sharedApplication().openURL(NSURL(string: UIApplicationOpenSettingsURLString)!)

Expand All @@ -153,7 +153,7 @@ extension UIViewController {
func alertCanNotAccessMicrophone() {

SafeDispatch.async {
YepAlert.confirmOrCancel(title: NSLocalizedString("Sorry", comment: ""), message: NSLocalizedString("Yep can not access your Microphone!\nBut you can change it in iOS Settings.", comment: ""), confirmTitle: NSLocalizedString("Change it now", comment: ""), cancelTitle: NSLocalizedString("Dismiss", comment: ""), inViewController: self, withConfirmAction: {
YepAlert.confirmOrCancel(title: NSLocalizedString("Sorry", comment: ""), message: NSLocalizedString("Yep can not access your Microphone!\nBut you can change it in iOS Settings.", comment: ""), confirmTitle: String.trans_titleChangeItNow, cancelTitle: NSLocalizedString("Dismiss", comment: ""), inViewController: self, withConfirmAction: {

UIApplication.sharedApplication().openURL(NSURL(string: UIApplicationOpenSettingsURLString)!)

Expand All @@ -165,7 +165,7 @@ extension UIViewController {
func alertCanNotAccessContacts() {

SafeDispatch.async {
YepAlert.confirmOrCancel(title: NSLocalizedString("Sorry", comment: ""), message: NSLocalizedString("Yep can not read your Contacts!\nBut you can change it in iOS Settings.", comment: ""), confirmTitle: NSLocalizedString("Change it now", comment: ""), cancelTitle: NSLocalizedString("Dismiss", comment: ""), inViewController: self, withConfirmAction: {
YepAlert.confirmOrCancel(title: NSLocalizedString("Sorry", comment: ""), message: NSLocalizedString("Yep can not read your Contacts!\nBut you can change it in iOS Settings.", comment: ""), confirmTitle: String.trans_titleChangeItNow, cancelTitle: NSLocalizedString("Dismiss", comment: ""), inViewController: self, withConfirmAction: {

UIApplication.sharedApplication().openURL(NSURL(string: UIApplicationOpenSettingsURLString)!)

Expand All @@ -177,7 +177,7 @@ extension UIViewController {
func alertCanNotAccessLocation() {

SafeDispatch.async {
YepAlert.confirmOrCancel(title: NSLocalizedString("Sorry", comment: ""), message: NSLocalizedString("Yep can not get your Location!\nBut you can change it in iOS Settings.", comment: ""), confirmTitle: NSLocalizedString("Change it now", comment: ""), cancelTitle: NSLocalizedString("Dismiss", comment: ""), inViewController: self, withConfirmAction: {
YepAlert.confirmOrCancel(title: NSLocalizedString("Sorry", comment: ""), message: NSLocalizedString("Yep can not get your Location!\nBut you can change it in iOS Settings.", comment: ""), confirmTitle: String.trans_titleChangeItNow, cancelTitle: NSLocalizedString("Dismiss", comment: ""), inViewController: self, withConfirmAction: {

UIApplication.sharedApplication().openURL(NSURL(string: UIApplicationOpenSettingsURLString)!)

Expand Down
2 changes: 1 addition & 1 deletion Yep/ViewControllers/About/AboutViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ final class AboutViewController: SegueViewController {
override func viewDidLoad() {
super.viewDidLoad()

title = NSLocalizedString("About", comment: "")
title = String.trans_titleAbout

appLogoImageViewTopConstraint.constant = Ruler.iPhoneVertical(0, 20, 40, 60).value
appNameLabelTopConstraint.constant = Ruler.iPhoneVertical(10, 20, 20, 20).value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ final class AddFriendsViewController: SegueViewController {
override func viewDidLoad() {
super.viewDidLoad()

title = NSLocalizedString("Add Friends", comment: "")
title = NSLocalizedString("title.add_friends", comment: "")
}

private var isFirstAppear: Bool = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ final class BlackListViewController: BaseViewController {
override func viewDidLoad() {
super.viewDidLoad()

title = NSLocalizedString("Blocked Users", comment: "")
title = String.trans_titleBlockedUsers

activityIndicator.startAnimating()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ final class ChangeMobileViewController: UIViewController {

view.backgroundColor = UIColor.yepViewBackgroundColor()

navigationItem.titleView = NavigationTitleLabel(title: NSLocalizedString("Change Mobile", comment: ""))
navigationItem.titleView = NavigationTitleLabel(title: String.trans_titleChangeMobile)

navigationItem.rightBarButtonItem = nextButton

Expand Down
2 changes: 1 addition & 1 deletion Yep/ViewControllers/Contacts/ContactsViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ extension ContactsViewController: UITableViewDataSource, UITableViewDelegate {

tableView?.setEditing(false, animated: true)

YepAlert.confirmOrCancel(title: NSLocalizedString("Unfriend", comment: ""), message: String(format: NSLocalizedString("Do you want to unfriend with %@?", comment: ""), nickname), confirmTitle: NSLocalizedString("Confirm", comment: ""), cancelTitle: NSLocalizedString("Cancel", comment: ""), inViewController: self, withConfirmAction: {
YepAlert.confirmOrCancel(title: NSLocalizedString("Unfriend", comment: ""), message: String(format: NSLocalizedString("Do you want to unfriend with %@?", comment: ""), nickname), confirmTitle: NSLocalizedString("Confirm", comment: ""), cancelTitle: String.trans_cancel, inViewController: self, withConfirmAction: {

unfriend(withUserID: userID, failureHandler: { [weak self] (reason, errorMessage) in
let message = errorMessage ?? NSLocalizedString("Unfriend failed!", comment: "")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ final class ConversationMoreViewManager {

private func makeBlockItem(blocked blocked: Bool) -> ActionSheetView.Item {
return .Default(
title: blocked ? NSLocalizedString("Unblock", comment: "") : NSLocalizedString("Block", comment: ""),
title: blocked ? NSLocalizedString("Unblock", comment: "") : String.trans_titleBlock,
titleColor: UIColor.redColor(),
action: { [weak self] in
self?.toggleBlockAction?()
Expand Down
Loading

0 comments on commit 0582870

Please sign in to comment.