You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

231 lines
8.2 KiB

//
// 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
}
}
}