Commit d752c4eb authored by Kateryna Kostiuk's avatar Kateryna Kostiuk Committed by Andreas Traczyk

project: support SwiftGen 6.0.2

Change-Id: I91ddf96ed268434407f362b5f630df43a71515b8
Reviewed-by: Andreas Traczyk's avatarAndreas Traczyk <andreas.traczyk@savoirfairelinux.com>
parent e26f8b9d
// swiftlint:disable all
// Generated using SwiftGen, by O.Halligon — https://github.com/SwiftGen/SwiftGen
#if os(OSX)
import AppKit.NSImage
internal typealias AssetColorTypeAlias = NSColor
internal typealias Image = NSImage
internal typealias AssetImageTypeAlias = NSImage
#elseif os(iOS) || os(tvOS) || os(watchOS)
import UIKit.UIImage
internal typealias AssetColorTypeAlias = UIColor
internal typealias Image = UIImage
internal typealias AssetImageTypeAlias = UIImage
#endif
// swiftlint:disable superfluous_disable_command
// swiftlint:disable file_length
@available(*, deprecated, renamed: "ImageAsset")
internal typealias AssetType = ImageAsset
internal struct ImageAsset {
internal fileprivate(set) var name: String
internal var image: Image {
let bundle = Bundle(for: BundleToken.self)
#if os(iOS) || os(tvOS)
let image = Image(named: name, in: bundle, compatibleWith: nil)
#elseif os(OSX)
let image = bundle.image(forResource: name)
#elseif os(watchOS)
let image = Image(named: name)
#endif
guard let result = image else { fatalError("Unable to load image named \(name).") }
return result
}
}
internal struct ColorAsset {
internal fileprivate(set) var name: String
#if swift(>=3.2)
@available(iOS 11.0, tvOS 11.0, watchOS 4.0, OSX 10.13, *)
internal var color: AssetColorTypeAlias {
return AssetColorTypeAlias(asset: self)
}
#endif
}
// MARK: - Asset Catalogs
// swiftlint:disable identifier_name line_length nesting type_body_length type_name
internal enum Asset {
......@@ -83,67 +55,20 @@ internal enum Asset {
internal static let unpauseCall = ImageAsset(name: "unpause_call")
internal static let videoMuted = ImageAsset(name: "video_muted")
internal static let videoRunning = ImageAsset(name: "video_running")
// swiftlint:disable trailing_comma
internal static let allColors: [ColorAsset] = [
]
internal static let allImages: [ImageAsset] = [
accountIcon,
addPerson,
attachmentIcon,
audioMuted,
audioRunning,
backButton,
backgroundRing,
blockIcon,
callButton,
camera,
clearConversation,
closeIcon,
contactRequestIcon,
conversationIcon,
cross,
device,
disableSpeakerphone,
doneIcon,
downloadIcon,
enableSpeakerphone,
fallbackAvatar,
icContactPicture,
moreSettings,
pauseCall,
qrCode,
qrCodeScan,
ringIcon,
ringLogo,
scan,
sendButton,
settingsIcon,
shareButton,
stopCall,
switchCamera,
unpauseCall,
videoMuted,
videoRunning,
]
// swiftlint:enable trailing_comma
@available(*, deprecated, renamed: "allImages")
internal static let allValues: [AssetType] = allImages
}
// swiftlint:enable identifier_name line_length nesting type_body_length type_name
internal extension Image {
@available(iOS 1.0, tvOS 1.0, watchOS 1.0, *)
@available(OSX, deprecated,
message: "This initializer is unsafe on macOS, please use the ImageAsset.image property")
convenience init!(asset: ImageAsset) {
#if os(iOS) || os(tvOS)
let bundle = Bundle(for: BundleToken.self)
self.init(named: asset.name, in: bundle, compatibleWith: nil)
#elseif os(OSX) || os(watchOS)
self.init(named: asset.name)
#endif
// MARK: - Implementation Details
internal struct ColorAsset {
internal fileprivate(set) var name: String
#if swift(>=3.2)
@available(iOS 11.0, tvOS 11.0, watchOS 4.0, OSX 10.13, *)
internal var color: AssetColorTypeAlias {
return AssetColorTypeAlias(asset: self)
}
#endif
}
internal extension AssetColorTypeAlias {
......@@ -162,4 +87,56 @@ internal extension AssetColorTypeAlias {
#endif
}
internal struct DataAsset {
internal fileprivate(set) var name: String
#if (os(iOS) || os(tvOS) || os(OSX)) && swift(>=3.2)
@available(iOS 9.0, tvOS 9.0, OSX 10.11, *)
internal var data: NSDataAsset {
return NSDataAsset(asset: self)
}
#endif
}
#if (os(iOS) || os(tvOS) || os(OSX)) && swift(>=3.2)
@available(iOS 9.0, tvOS 9.0, OSX 10.11, *)
internal extension NSDataAsset {
convenience init!(asset: DataAsset) {
let bundle = Bundle(for: BundleToken.self)
self.init(name: asset.name, bundle: bundle)
}
}
#endif
internal struct ImageAsset {
internal fileprivate(set) var name: String
internal var image: AssetImageTypeAlias {
let bundle = Bundle(for: BundleToken.self)
#if os(iOS) || os(tvOS)
let image = AssetImageTypeAlias(named: name, in: bundle, compatibleWith: nil)
#elseif os(OSX)
let image = bundle.image(forResource: name)
#elseif os(watchOS)
let image = AssetImageTypeAlias(named: name)
#endif
guard let result = image else { fatalError("Unable to load image named \(name).") }
return result
}
}
internal extension AssetImageTypeAlias {
@available(iOS 1.0, tvOS 1.0, watchOS 1.0, *)
@available(OSX, deprecated,
message: "This initializer is unsafe on macOS, please use the ImageAsset.image property")
convenience init!(asset: ImageAsset) {
#if os(iOS) || os(tvOS)
let bundle = Bundle(for: BundleToken.self)
self.init(named: asset.name, in: bundle, compatibleWith: nil)
#elseif os(OSX) || os(watchOS)
self.init(named: asset.name)
#endif
}
}
private final class BundleToken {}
// swiftlint:disable all
// Generated using SwiftGen, by O.Halligon — https://github.com/SwiftGen/SwiftGen
import Foundation
......@@ -5,10 +6,13 @@ import Foundation
// swiftlint:disable superfluous_disable_command
// swiftlint:disable file_length
// swiftlint:disable explicit_type_interface identifier_name line_length nesting type_body_length type_name
// MARK: - Strings
// swiftlint:disable explicit_type_interface function_parameter_count identifier_name line_length
// swiftlint:disable nesting type_body_length type_name
internal enum L10n {
internal enum Accountpage {
internal enum AccountPage {
/// Block List
internal static let blockedContacts = L10n.tr("Localizable", "accountPage.blockedContacts")
/// Account Details
......@@ -110,7 +114,7 @@ internal enum L10n {
internal static let unknown = L10n.tr("Localizable", "calls.unknown")
}
internal enum Contactpage {
internal enum ContactPage {
/// Block Contact
internal static let blockContact = L10n.tr("Localizable", "contactPage.blockContact")
/// Clear Chat
......@@ -123,7 +127,7 @@ internal enum L10n {
internal static let startVideoCall = L10n.tr("Localizable", "contactPage.startVideoCall")
}
internal enum Createaccount {
internal enum CreateAccount {
/// Choose strong password you will remember to protect your Ring account.
internal static let chooseStrongPassword = L10n.tr("Localizable", "createAccount.chooseStrongPassword")
/// Create your Ring account
......@@ -150,14 +154,14 @@ internal enum L10n {
internal static let waitCreateAccountTitle = L10n.tr("Localizable", "createAccount.waitCreateAccountTitle")
}
internal enum Createprofile {
internal enum CreateProfile {
/// Next
internal static let profileCreated = L10n.tr("Localizable", "createProfile.profileCreated")
/// Skip
internal static let skipCreateProfile = L10n.tr("Localizable", "createProfile.skipCreateProfile")
}
internal enum Datatransfer {
internal enum DataTransfer {
/// Accept
internal static let readableStatusAccept = L10n.tr("Localizable", "dataTransfer.readableStatusAccept")
/// Pending…
......@@ -189,7 +193,7 @@ internal enum L10n {
internal static let ok = L10n.tr("Localizable", "global.ok")
}
internal enum Linkdevice {
internal enum LinkDevice {
/// An error occured during the export
internal static let defaultError = L10n.tr("Localizable", "linkDevice.defaultError")
/// To complete the process, you need to open Ring on the new device and choose the option "Link this device to an account." Your pin is valid for 10 minutes
......@@ -204,7 +208,7 @@ internal enum L10n {
internal static let title = L10n.tr("Localizable", "linkDevice.title")
}
internal enum Linktoaccount {
internal enum LinkToAccount {
/// To generate the PIN code, go to the account managment settings on device that contain account you want to use. In devices settings Select "Link another device to this account". You will get the necessary PIN to complete this form. The PIN is only valid for 10 minutes.
internal static let explanationPinMessage = L10n.tr("Localizable", "linkToAccount.explanationPinMessage")
/// Link device
......@@ -256,7 +260,10 @@ internal enum L10n {
internal static let title = L10n.tr("Localizable", "welcome.title")
}
}
// swiftlint:enable explicit_type_interface identifier_name line_length nesting type_body_length type_name
// swiftlint:enable explicit_type_interface function_parameter_count identifier_name line_length
// swiftlint:enable nesting type_body_length type_name
// MARK: - Implementation Details
extension L10n {
fileprivate static func tr(_ table: String, _ key: String, _ args: CVarArg...) -> String {
......
......@@ -44,9 +44,9 @@ class ContactViewModel: ViewModel, Stateable {
var tableSection = Observable<[SectionModel<String, ContactActions>]>
.just([SectionModel(model: "ProfileInfoCell",
items:
[ ContactActions(title: L10n.Contactpage.startAudioCall, image: Asset.callButton),
ContactActions(title: L10n.Contactpage.startVideoCall, image: Asset.videoRunning),
ContactActions(title: L10n.Contactpage.sendMessage, image: Asset.conversationIcon)])])
[ ContactActions(title: L10n.ContactPage.startAudioCall, image: Asset.callButton),
ContactActions(title: L10n.ContactPage.startVideoCall, image: Asset.videoRunning),
ContactActions(title: L10n.ContactPage.sendMessage, image: Asset.conversationIcon)])])
var conversation: ConversationModel! {
didSet {
if let profile = conversation.participantProfile, let alias = profile.alias, !alias.isEmpty {
......@@ -77,11 +77,11 @@ class ContactViewModel: ViewModel, Stateable {
self.tableSection = Observable<[SectionModel<String, ContactActions>]>
.just([SectionModel(model: "ProfileInfoCell",
items:
[ ContactActions(title: L10n.Contactpage.startAudioCall, image: Asset.callButton),
ContactActions(title: L10n.Contactpage.startVideoCall, image: Asset.videoRunning),
ContactActions(title: L10n.Contactpage.sendMessage, image: Asset.conversationIcon),
ContactActions(title: L10n.Contactpage.clearConversation, image: Asset.clearConversation),
ContactActions(title: L10n.Contactpage.blockContact, image: Asset.blockIcon)])])
[ ContactActions(title: L10n.ContactPage.startAudioCall, image: Asset.callButton),
ContactActions(title: L10n.ContactPage.startVideoCall, image: Asset.videoRunning),
ContactActions(title: L10n.ContactPage.sendMessage, image: Asset.conversationIcon),
ContactActions(title: L10n.ContactPage.clearConversation, image: Asset.clearConversation),
ContactActions(title: L10n.ContactPage.blockContact, image: Asset.blockIcon)])])
}
self.contactService
.getContactRequestVCard(forContactWithRingId: conversation.recipientRingId)
......
......@@ -25,8 +25,8 @@ import Contacts
class EditProfileViewModel {
let disposeBag = DisposeBag()
let defaultImage = Image(named: "ic_contact_picture")
var image = Variable<Image?>(nil)
let defaultImage = UIImage(named: "ic_contact_picture")
var image = Variable<UIImage?>(nil)
var profileName = Variable<String>("")
init() {
......@@ -52,7 +52,7 @@ class EditProfileViewModel {
}
func updateImage(_ image: Image) {
func updateImage(_ image: UIImage) {
self.image.value = image
self.saveProfile()
}
......
......@@ -650,17 +650,17 @@ class ConversationViewController: UIViewController,
case .created:
if item.bubblePosition() == .sent {
cell.statusLabel.isHidden = false
cell.statusLabel.text = L10n.Datatransfer.readableStatusCreated
cell.statusLabel.text = L10n.DataTransfer.readableStatusCreated
cell.statusLabel.textColor = UIColor.darkGray
cell.progressBar.isHidden = true
cell.cancelButton.isHidden = false
cell.cancelButton.setTitle(L10n.Datatransfer.readableStatusCancel, for: .normal)
cell.cancelButton.setTitle(L10n.DataTransfer.readableStatusCancel, for: .normal)
cell.buttonsHeightConstraint?.constant = 24.0
}
case .error:
// show status
cell.statusLabel.isHidden = false
cell.statusLabel.text = L10n.Datatransfer.readableStatusError
cell.statusLabel.text = L10n.DataTransfer.readableStatusError
cell.statusLabel.textColor = UIColor.ringFailure
// hide everything and shrink cell
cell.progressBar.isHidden = true
......@@ -674,9 +674,9 @@ class ConversationViewController: UIViewController,
if item.bubblePosition() == .sent {
// status
cell.statusLabel.isHidden = false
cell.statusLabel.text = L10n.Datatransfer.readableStatusAwaiting
cell.statusLabel.text = L10n.DataTransfer.readableStatusAwaiting
cell.statusLabel.textColor = UIColor.ringSuccess
cell.cancelButton.setTitle(L10n.Datatransfer.readableStatusCancel, for: .normal)
cell.cancelButton.setTitle(L10n.DataTransfer.readableStatusCancel, for: .normal)
} else if item.bubblePosition() == .received {
// accept automatically if less than 10MB and is an image
if let transferId = item.daemonId,
......@@ -689,12 +689,12 @@ class ConversationViewController: UIViewController,
// hide status
cell.statusLabel.isHidden = true
cell.acceptButton?.isHidden = false
cell.cancelButton.setTitle(L10n.Datatransfer.readableStatusRefuse, for: .normal)
cell.cancelButton.setTitle(L10n.DataTransfer.readableStatusRefuse, for: .normal)
}
case .ongoing:
// status
cell.statusLabel.isHidden = false
cell.statusLabel.text = L10n.Datatransfer.readableStatusOngoing
cell.statusLabel.text = L10n.DataTransfer.readableStatusOngoing
cell.statusLabel.textColor = UIColor.darkGray
// start update progress timer process bar here
guard let transferId = item.daemonId else { return }
......@@ -705,12 +705,12 @@ class ConversationViewController: UIViewController,
// hide accept button only
cell.acceptButton?.isHidden = true
cell.cancelButton.isHidden = false
cell.cancelButton.setTitle(L10n.Datatransfer.readableStatusCancel, for: .normal)
cell.cancelButton.setTitle(L10n.DataTransfer.readableStatusCancel, for: .normal)
cell.buttonsHeightConstraint?.constant = 24.0
case .canceled:
// status
cell.statusLabel.isHidden = false
cell.statusLabel.text = L10n.Datatransfer.readableStatusCanceled
cell.statusLabel.text = L10n.DataTransfer.readableStatusCanceled
cell.statusLabel.textColor = UIColor.ringWarning
// hide everything and shrink cell
cell.progressBar.isHidden = true
......@@ -720,7 +720,7 @@ class ConversationViewController: UIViewController,
case .success:
// status
cell.statusLabel.isHidden = false
cell.statusLabel.text = L10n.Datatransfer.readableStatusSuccess
cell.statusLabel.text = L10n.DataTransfer.readableStatusSuccess
cell.statusLabel.textColor = UIColor.ringSuccess
// hide everything and shrink cell
cell.progressBar.isHidden = true
......@@ -773,7 +773,7 @@ extension ConversationViewController: UITableViewDataSource {
cell.configureFromItem(viewModel, self.messageViewModels, cellForRowAt: indexPath)
if item.isTransfer {
cell.acceptButton?.setTitle(L10n.Datatransfer.readableStatusAccept, for: .normal)
cell.acceptButton?.setTitle(L10n.DataTransfer.readableStatusAccept, for: .normal)
item.lastTransferStatus = .unknown
changeTransferStatus(cell, nil, item.message.transferStatus, item, viewModel)
item.transferStatus.asObservable()
......
......@@ -59,7 +59,7 @@ class LinkNewDeviceViewController: UIViewController, StoryboardBased, ViewModelB
}
private func showProgress() {
HUD.show(.labeledProgress(title: L10n.Linkdevice.hudMessage, subtitle: nil))
HUD.show(.labeledProgress(title: L10n.LinkDevice.hudMessage, subtitle: nil))
}
private func hideHud() {
HUD.hide(animated: false)
......@@ -94,7 +94,7 @@ class LinkNewDeviceViewController: UIViewController, StoryboardBased, ViewModelB
alert.addTextField { (textField) in
textField.isSecureTextEntry = true
textField.placeholder = L10n.Linktoaccount.passwordLabel
textField.placeholder = L10n.LinkToAccount.passwordLabel
}
self.present(alert, animated: true, completion: nil)
}
......
......@@ -36,11 +36,11 @@ enum PinError {
var description: String {
switch self {
case .passwordError:
return L10n.Linkdevice.passwordError
return L10n.LinkDevice.passwordError
case .networkError:
return L10n.Linkdevice.networkError
return L10n.LinkDevice.networkError
case .defaultError:
return L10n.Linkdevice.defaultError
return L10n.LinkDevice.defaultError
}
}
}
......@@ -89,8 +89,8 @@ class LinkNewDeviceViewModel: ViewModel, Stateable {
let disposeBag = DisposeBag()
// MARK: L10n
let linkDeviceTitleTitle = L10n.Linkdevice.title
let explanationMessage = L10n.Linkdevice.explanationMessage
let linkDeviceTitleTitle = L10n.LinkDevice.title
let explanationMessage = L10n.LinkDevice.explanationMessage
required init(with injectionBag: InjectionBag) {
self.accountService = injectionBag.accountService
......
......@@ -54,6 +54,6 @@ class BannedContactCell: UITableViewCell, NibReusable {
self.userNameLabel.text = item.contact.ringId
}
self.unblockButton.titleLabel?.text = L10n.Accountpage.unblockContact
self.unblockButton.titleLabel?.text = L10n.AccountPage.unblockContact
}
}
......@@ -35,7 +35,7 @@ class BlockListViewController: UIViewController, StoryboardBased, ViewModelBased
super.viewDidLoad()
self.configureRingNavigationBar()
self.navigationItem.title = L10n.Accountpage.blockedContacts
self.navigationItem.title = L10n.AccountPage.blockedContacts
}
override func viewWillAppear(_ animated: Bool) {
......
......@@ -221,8 +221,8 @@ class MeViewController: EditProfileViewController, StoryboardBased, ViewModelBas
case .proxy:
let cell = tableView.dequeueReusableCell(for: indexPath,
cellType: ProxyCell.self)
cell.proxyAddrsss.placeholder = L10n.Accountpage.proxyPaceholder
cell.enableProxyLabel.text = L10n.Accountpage.enableProxy
cell.proxyAddrsss.placeholder = L10n.AccountPage.proxyPaceholder
cell.enableProxyLabel.text = L10n.AccountPage.enableProxy
cell.proxyAddrsss.enablesReturnKeyAutomatically = true
self.viewModel.proxyEnabled.asDriver()
.drive(cell.switchProxy.rx.isOn)
......@@ -257,7 +257,7 @@ class MeViewController: EditProfileViewController, StoryboardBased, ViewModelBas
case .blockedList:
let cell = tableView.dequeueReusableCell(for: indexPath,
cellType: BlockContactsCell.self)
cell.label.text = L10n.Accountpage.blockedContacts
cell.label.text = L10n.AccountPage.blockedContacts
return cell
case .sectionHeader(let title):
......@@ -276,7 +276,7 @@ class MeViewController: EditProfileViewController, StoryboardBased, ViewModelBas
let cell = tableView.dequeueReusableCell(for: indexPath,
cellType: NotificationCell.self)
cell.selectionStyle = .none
cell.enableNotificationsLabel.text = L10n.Accountpage.enableNotifications
cell.enableNotificationsLabel.text = L10n.AccountPage.enableNotifications
self.viewModel.notificationsEnabled.asDriver()
.drive(cell.enableNotificationsSwitch.rx.value)
.disposed(by: cell.disposeBag)
......@@ -301,8 +301,8 @@ class MeViewController: EditProfileViewController, StoryboardBased, ViewModelBas
}
func proxyDisabledAlert() {
let alert = UIAlertController(title: L10n.Accountpage.proxyDisabledAlertTitle,
message: L10n.Accountpage.proxyDisabledAlertBody,
let alert = UIAlertController(title: L10n.AccountPage.proxyDisabledAlertTitle,
message: L10n.AccountPage.proxyDisabledAlertBody,
preferredStyle: .alert)
let actionCancel = UIAlertAction(title: L10n.Global.ok, style: .cancel) { [weak self]_ in
self?.viewModel.notificationsEnabled.value = false
......@@ -325,7 +325,7 @@ class MeViewController: EditProfileViewController, StoryboardBased, ViewModelBas
}
func askProxyAddressAlert() {
let alert = UIAlertController(title: L10n.Accountpage.proxyAddressAlert,
let alert = UIAlertController(title: L10n.AccountPage.proxyAddressAlert,
message: nil,
preferredStyle: .alert)
let actionCancel = UIAlertAction(title: L10n.Actions.cancelAction,
......@@ -333,7 +333,7 @@ class MeViewController: EditProfileViewController, StoryboardBased, ViewModelBas
self?.viewModel.proxyEnabled.value = false
alert.dismiss(animated: true, completion: nil)
}
let actionConfirm = UIAlertAction(title: L10n.Accountpage.saveProxyAddress,
let actionConfirm = UIAlertAction(title: L10n.AccountPage.saveProxyAddress,
style: .default) { [weak self] _ in
if let textFields = alert.textFields, let text = textFields[0].text, !text.isEmpty {
self?.viewModel.changeProxyAvailability(enable: true, proxyAddress: text)
......@@ -344,7 +344,7 @@ class MeViewController: EditProfileViewController, StoryboardBased, ViewModelBas
alert.addAction(actionConfirm)
alert.addTextField { [weak self] (textField) in
textField.placeholder = L10n.Accountpage.proxyPaceholder
textField.placeholder = L10n.AccountPage.proxyPaceholder
textField.text = self?.viewModel.proxyAddress.value
}
......
......@@ -129,12 +129,12 @@ class MeViewModel: ViewModel, Stateable {
lazy var accountCredentials: Observable<SettingsSection> = {
return Observable
.combineLatest(userName.startWith(""), ringId.startWith("")) { (name, ringID) in
var items: [SettingsSection.SectionRow] = [.sectionHeader(title: L10n.Accountpage.credentialsHeader),
var items: [SettingsSection.SectionRow] = [.sectionHeader(title: L10n.AccountPage.credentialsHeader),
.ordinary(label: "ringID: " + ringID)]
if !name.isEmpty {
items.append(.ordinary(label: L10n.Accountpage.username + " " + name))
items.append(.ordinary(label: L10n.AccountPage.username + " " + name))
} else {
items.append(.ordinary(label: L10n.Accountpage.usernameNotRegistered))
items.append(.ordinary(label: L10n.AccountPage.usernameNotRegistered))
}
return SettingsSection
.credentials(items: items)
......@@ -147,7 +147,7 @@ class MeViewModel: ViewModel, Stateable {
lazy var accountSettings: Observable<SettingsSection> = {
return Observable
.just(.accountSettings( items: [.sectionHeader(title: L10n.Accountpage.settingsHeader),
.just(.accountSettings( items: [.sectionHeader(title: L10n.AccountPage.settingsHeader),
.blockedList, .proxy, .notifications]))
}()
......@@ -170,7 +170,7 @@ class MeViewModel: ViewModel, Stateable {
}
}
if rows != nil {
rows?.insert(.sectionHeader(title: L10n.Accountpage.devicesListHeader), at: 0)
rows?.insert(.sectionHeader(title: L10n.AccountPage.devicesListHeader), at: 0)
let devicesSection: SettingsSection = .linkedDevices(items: rows!)
return devicesSection
}
......
......@@ -155,7 +155,7 @@ class CreateAccountViewController: UIViewController, StoryboardBased, ViewModelB
}
private func showAccountCreationInProgress() {
HUD.show(.labeledProgress(title: L10n.Createaccount.waitCreateAccountTitle, subtitle: nil))
HUD.show(.labeledProgress(title: L10n.CreateAccount.waitCreateAccountTitle, subtitle: nil))
}
private func showAccountCreationSuccess() {
......
......@@ -148,11 +148,11 @@ class CreateAccountViewModel: Stateable, ViewModel {
private let disposeBag = DisposeBag()
// MARK: L10n
let createAccountTitle = L10n.Createaccount.createAccountFormTitle
let createAccountTitle = L10n.CreateAccount.createAccountFormTitle
let createAccountButton = L10n.Welcome.createAccount
let usernameTitle = L10n.Createaccount.enterNewUsernamePlaceholder
let passwordTitle = L10n.Createaccount.newPasswordPlaceholder
let confirmPasswordTitle = L10n.Createaccount.repeatPasswordPlaceholder
let usernameTitle = L10n.CreateAccount.enterNewUsernamePlaceholder
let passwordTitle = L10n.CreateAccount.newPasswordPlaceholder
let confirmPasswordTitle = L10n.CreateAccount.repeatPasswordPlaceholder
// MARK: - Low level services
private let accountService: AccountsService
......@@ -175,11 +175,11 @@ class CreateAccountViewModel: Stateable, ViewModel {
}
if password.characters.count < 6 {
return .error(message: L10n.Createaccount.passwordCharactersNumberError)
return .error(message: L10n.CreateAccount.passwordCharactersNumberError)
}
if password != confirmPassword {
return .error(message: L10n.Createaccount.passwordNotMatchingError)
return .error(message: L10n.CreateAccount.passwordNotMatchingError)
}
return .validated
......@@ -226,11 +226,11 @@ class CreateAccountViewModel: Stateable, ViewModel {
self.nameService.usernameValidationStatus.asObservable().subscribe(onNext: { [weak self] (status) in
switch status {
case .lookingUp:
self?.usernameValidationState.value = .lookingForAvailibility(message: L10n.Createaccount.lookingForUsernameAvailability)
self?.usernameValidationState.value = .lookingForAvailibility(message: L10n.CreateAccount.lookingForUsernameAvailability)
case .invalid:
self?.usernameValidationState.value = .invalid(message: L10n.Createaccount.invalidUsername)
self?.usernameValidationState.value = .invalid(message: L10n.CreateAccount.invalidUsername)
case .alreadyTaken:
self?.usernameValidationState.value = .unavailable(message: L10n.Createaccount.usernameAlreadyTaken)
self?.usernameValidationState.value = .unavailable(message: L10n.CreateAccount.usernameAlreadyTaken)
default:
self?.usernameValidationState.value = .available
}
......
......@@ -51,10 +51,10 @@ class CreateProfileViewModel: Stateable, ViewModel {
lazy var skipButtonTitle: Observable<String> = {
return profileExists.map({ exists -> String in
if exists {
return L10n.Createprofile.profileCreated
return L10n.CreateProfile.profileCreated
}
return L10n.Createprofile.skipCreateProfile
}).startWith(L10n.Createprofile.skipCreateProfile)
return L10n.CreateProfile.skipCreateProfile
}).startWith(L10n.CreateProfile.skipCreateProfile)
}()
let disposeBag = DisposeBag()
......
......@@ -83,15 +83,15 @@ class LinkDeviceViewController: UIViewController, StoryboardBased, ViewModelBase
}
private func applyL10n() {
self.linkButton.setTitle(L10n.Linktoaccount.linkButtonTitle, for: .normal)
self.pinLabel.text = L10n.Linktoaccount.pinLabel
self.passwordLabel.text = L10n.Linktoaccount.passwordLabel
self.pinTextField.placeholder = L10n.Linktoaccount.pinPlaceholder
self.passwordTextField.placeholder = L10n.Linktoaccount.passwordPlaceholder
self.linkButton.setTitle(L10n.LinkToAccount.linkButtonTitle, for: .normal)
self.pinLabel.text = L10n.LinkToAccount.pinLabel
self.passwordLabel.text = L10n.LinkToAccount.passwordLabel
self.pinTextField.placeholder = L10n.LinkToAccount.pinPlaceholder
self.passwordTextField.placeholder = L10n.LinkToAccount.passwordPlaceholder
}
private func showCreationHUD() {
HUD.show(.labeledProgress(title: L10n.Linktoaccount.waitLinkToAccountTitle, subtitle: nil))
HUD.show(.labeledProgress(title: L10n.LinkToAccount.waitLinkToAccountTitle, subtitle: nil))
}
private func showLinkedSuccess() {
......@@ -120,7 +120,7 @@ class LinkDeviceViewController: UIViewController, StoryboardBased, ViewModelBase
popTip.textColor = UIColor.white
let offset: CGFloat = (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiom.pad) ? 60.0 : 80.0
popTip.offset = offset - scrollView.contentOffset.y
popTip.show(text: L10n.Linktoaccount.explanationPinMessage, direction: .down,
popTip.show(text: L10n.LinkToAccount.explanationPinMessage, direction: .down,
maxWidth: 250, in: self.view, from: pinInfoButton.frame)
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment