// // Eumn.swift // Lookfit // // Created by lemo. on 2020/3/28. // Copyright © 2020 Sheldon. All rights reserved. // import Foundation enum FunctionTypeFireBoltt { 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.findDeviceFB.localized case .handUp: return MultiLanguageKey.handUpFB.localized case .callRemind: return MultiLanguageKey.callRemindFB.localized case .messageRemind: return MultiLanguageKey.messageRemindFB.localized case .remoteCamera: return MultiLanguageKey.remoteCameraFB.localized case .notice: return MultiLanguageKey.noticeFB.localized case .heartCheck: return MultiLanguageKey.heartCheckFB.localized case .dialPush: return MultiLanguageKey.dialPushFB.localized case .firmwareUpgrade: return MultiLanguageKey.firmwareUpgradeFB.localized case .unBinding: return MultiLanguageKey.unBindingFB.localized case .notDisturb: return MultiLanguageKey.notDisturbFB.localized case .alarmClock: return MultiLanguageKey.alarmClockFB.localized case .sedentary: return MultiLanguageKey.sedentaryFB.localized case .drinkRemind: return MultiLanguageKey.drinkRemindFB.localized case .tempeartureCheck: return MultiLanguageKey.temperatureCheckFB.localized case .wechatSport: return MultiLanguageKey.wechatSportFB.localized case .telephoneBook: return MultiLanguageKey.telephoneBookFB.localized case .businessCard: return MultiLanguageKey.businessCardFB.localized case .theWallet: return MultiLanguageKey.theWalletFB.localized case .music: return MultiLanguageKey.musicFB.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.callRemindFB.localized case .message: return MultiLanguageKey.messageRemindFB.localized case .qq: return MultiLanguageKey.qqRemindFB.localized case .wechat: return MultiLanguageKey.wechatRemindFB.localized case .whatsapp: return MultiLanguageKey.whatsappRemindFB.localized case .messenger: return MultiLanguageKey.messengerRemindFB.localized case .twitter: return MultiLanguageKey.twitterRemindFB.localized case .linkedin: return MultiLanguageKey.linkedinRemindFB.localized case .instagram: return MultiLanguageKey.instagramRemindFB.localized case .facebook: return MultiLanguageKey.facebookRemindFB.localized case .line: return MultiLanguageKey.lineRemindFB.localized case .viber: return MultiLanguageKey.viberRemindFB.localized case .skype: return MultiLanguageKey.skypeRemindFB.localized case .outlook: return MultiLanguageKey.outlookRemindFB.localized case .all: return MultiLanguageKey.allSelectFB.localized case .others: return MultiLanguageKey.othersRemindFB.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.stepFB.localized case .sleep: return MultiLanguageKey.sleepFB.localized case .heartRate: return MultiLanguageKey.heartRateFB.localized case .sport: return MultiLanguageKey.sportFB.localized case .temperature: return MultiLanguageKey.temperatureFB.localized case .bloodPressure: return MultiLanguageKey.bloodPressureFB.localized case .bloodOxygen: return MultiLanguageKey.bloodOxygenFB.localized } } }