// // Eumn.swift // Lookfit // // Created by lemo. on 2020/3/28. // Copyright © 2020 Sheldon. All rights reserved. // import Foundation enum FunctionType { case findPhone, handUp, callRemind, messageRemind, remoteCamera, notice, heartCheck, dialPush, firmwareUpgrade, unBinding, notDisturb, alarmClock, sedentary, drinkRemind, heartRateMonitor, tempeartureCheck, wechatSport,telephoneBook,businessCard,theWallet,music func title() -> String { switch self { case .findPhone: return MultiLanguageKey.findDevice.localized case .handUp: return MultiLanguageKey.handUp.localized case .callRemind: return MultiLanguageKey.callRemind.localized case .messageRemind: return MultiLanguageKey.messageRemind.localized case .remoteCamera: return MultiLanguageKey.remoteCamera.localized case .notice: return MultiLanguageKey.notice.localized case .heartCheck: return MultiLanguageKey.heartCheck.localized case .dialPush: return MultiLanguageKey.dialPush.localized case .firmwareUpgrade: return MultiLanguageKey.firmwareUpgrade.localized case .unBinding: return MultiLanguageKey.unBinding.localized case .notDisturb: return MultiLanguageKey.notDisturb.localized case .alarmClock: return MultiLanguageKey.alarmClock.localized case .sedentary: return MultiLanguageKey.sedentary.localized case .drinkRemind: return MultiLanguageKey.drinkRemind.localized case .tempeartureCheck: return MultiLanguageKey.temperatureCheck.localized case .wechatSport: return MultiLanguageKey.wechatSport.localized case .telephoneBook: return MultiLanguageKey.telephoneBook.localized case .businessCard: return MultiLanguageKey.businessCard.localized case .theWallet: return MultiLanguageKey.theWallet.localized case .music: return MultiLanguageKey.music.localized default: return "" } } func isSwitch() -> Bool { switch self { case .handUp, .callRemind, .messageRemind: return true default: return false } } } enum PushType: Int { case call, message, qq, wechat, whatsapp, messenger, twitter, linkedin, instagram, facebook, line, viber, skype, outlook, others case all /// 转换推送至 /// - Parameters: /// - currenValue: 当前值 /// - type: 类型 /// - isOn: 开关 func tranfromPushValue(currenValue: Int, isOn: Bool) -> Int { // 全选开关 if self == .all { return isOn ? 65535 : 0 } if isOn { return 1 << rawValue | currenValue } return ~(1 << rawValue) & currenValue } /// 获取当前类型开关 /// - Parameter currenValue: 值 func getSwitchState(currenValue: Int) -> Bool { if self == .all { return currenValue == 65535 } return ((currenValue & (1 << self.rawValue)) >> rawValue) == 1 } var title: String { switch self { case .call: return MultiLanguageKey.callRemind.localized case .message: return MultiLanguageKey.messageRemind.localized case .qq: return MultiLanguageKey.qqRemind.localized case .wechat: return MultiLanguageKey.wechatRemind.localized case .whatsapp: return MultiLanguageKey.whatsappRemind.localized case .messenger: return MultiLanguageKey.messengerRemind.localized case .twitter: return MultiLanguageKey.twitterRemind.localized case .linkedin: return MultiLanguageKey.linkedinRemind.localized case .instagram: return MultiLanguageKey.instagramRemind.localized case .facebook: return MultiLanguageKey.facebookRemind.localized case .line: return MultiLanguageKey.lineRemind.localized case .viber: return MultiLanguageKey.viberRemind.localized case .skype: return MultiLanguageKey.skypeRemind.localized case .outlook: return MultiLanguageKey.outlookRemind.localized case .all: return MultiLanguageKey.allSelect.localized case .others: return MultiLanguageKey.othersRemind.localized } } } fileprivate let sportTypeNameArr: [String] = ["所有运动", "健走", "户外跑", "室内跑", "爬山", "越野跑", "半马", "全马", "跳绳", "羽毛球", "篮球", "骑行", "滑冰", "健身房", "瑜伽", "网球", "乒乓球", "足球", "游泳", "性爱", "室内骑行", "室内健走", "自由训练"] enum SportType: Int { // 占位,hasvalue+1 case placeholder = 0 /// 健走 1 case walkTraining /// 跑步 2 case runTraining // 室内跑 3 case runInsideTraining /// 爬山 4 case climbingTraining /// "越野跑" 5 case crossRunTraining /// 半马 6 case halfHorseTraining /// 全马 7 case marathonTraining /// 跳绳 8 case jumpRopeTraining /// 羽毛球 9 case badmintonTraining /// 篮球 10 case basketballTraning /// 骑行 11 case cyclingTraining /// 滑冰 12 case skatingTraining /// 健身房 13 case fitnessTraining /// 瑜伽 14 case yogaTraining /// 网球 15 case tennisTraining /// 乒乓球 16 case pingpongTraining /// 足球 17 case footballTraining /// 游泳 18 case swimmingTraining /// 性爱 19 case sexTraining /// 室内骑行 20 case indoorCyclingTraining /// 室内健走 21 case indoorWalkTraining /// 自由训练 22 case freeTraining } extension SportType { /// 运动类型名称 var sportTypeName: String { return sportTypeNameArr[self.rawValue] } /// 类型图标 var sportImg: UIImage? { switch self { /// 健走 1 case .walkTraining: return R.image.icon_walk() /// 跑步 2 case .runTraining: return R.image.icon_run() // 室内跑 3 case .runInsideTraining: return R.image.icon_runindoor() /// 爬山 4 case .climbingTraining: return R.image.icon_climb() /// 越野跑 5 case .crossRunTraining: return R.image.icon_yyp() /// 半马 6 case .halfHorseTraining: return R.image.icon_bm() /// 全马 7 case .marathonTraining: return R.image.icon_qm() /// 跳绳 8 case .jumpRopeTraining: return R.image.icon_skipping() /// 羽毛球 9 case .badmintonTraining: return R.image.icon_badminton() /// 篮球 10 case .basketballTraning: return R.image.icon_basketball() /// 骑行 11 case .cyclingTraining: return R.image.icon_bike() /// 滑冰 12 case .skatingTraining: return R.image.icon_skating() /// 健身房 13 case .fitnessTraining: return R.image.icon_gym() /// 瑜伽 14 case .yogaTraining: return R.image.icon_yoga() /// 网球 15 case .tennisTraining: return R.image.icon_tennis() /// 乒乓球 16 case .pingpongTraining: return R.image.icon_pingpong() /// 足球 17 case .footballTraining: return R.image.icon_football() /// 游泳 18 case .swimmingTraining: return R.image.icon_swim() /// 性爱 19 case .sexTraining: return R.image.icon_sex() /// 室内骑行 20 case .indoorCyclingTraining: return R.image.icon_indoor_cycling() /// 室内健走 21 case .indoorWalkTraining: return R.image.icon_indoor_walking() /// 自由训练 22 case .freeTraining: return R.image.icon_free() default: return nil } } } enum HealthType { case step case sleep case heartRate case sport case temperature case bloodPressure case bloodOxygen var titleLocalized: String { switch self { case .step: return MultiLanguageKey.step.localized case .sleep: return MultiLanguageKey.sleep.localized case .heartRate: return MultiLanguageKey.heartRate.localized case .sport: return MultiLanguageKey.sport.localized case .temperature: return MultiLanguageKey.temperature.localized case .bloodPressure: return MultiLanguageKey.bloodPressure.localized case .bloodOxygen: return MultiLanguageKey.bloodOxygen.localized } } }