|
|
|
//
|
|
|
|
// Eumn.swift
|
|
|
|
// FireBoltt
|
|
|
|
//
|
|
|
|
// 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_FB.findDeviceFB.localized
|
|
|
|
case .handUp: return MultiLanguageKey_FB.handUpFB.localized
|
|
|
|
case .callRemind: return MultiLanguageKey_FB.callRemindFB.localized
|
|
|
|
case .messageRemind: return MultiLanguageKey_FB.messageRemindFB.localized
|
|
|
|
case .remoteCamera: return MultiLanguageKey_FB.remoteCameraFB.localized
|
|
|
|
case .notice: return MultiLanguageKey_FB.noticeFB.localized
|
|
|
|
case .heartCheck: return MultiLanguageKey_FB.heartCheckFB.localized
|
|
|
|
case .dialPush: return MultiLanguageKey_FB.dialPushFB.localized
|
|
|
|
case .firmwareUpgrade: return MultiLanguageKey_FB.firmwareUpgradeFB.localized
|
|
|
|
case .unBinding: return MultiLanguageKey_FB.unBindingFB.localized
|
|
|
|
case .notDisturb: return MultiLanguageKey_FB.notDisturbFB.localized
|
|
|
|
case .alarmClock: return MultiLanguageKey_FB.alarmClockFB.localized
|
|
|
|
case .sedentary: return MultiLanguageKey_FB.sedentaryFB.localized
|
|
|
|
case .drinkRemind: return MultiLanguageKey_FB.drinkRemindFB.localized
|
|
|
|
case .tempeartureCheck: return MultiLanguageKey_FB.temperatureCheckFB.localized
|
|
|
|
case .wechatSport: return MultiLanguageKey_FB.wechatSportFB.localized
|
|
|
|
case .telephoneBook: return MultiLanguageKey_FB.telephoneBookFB.localized
|
|
|
|
case .businessCard: return MultiLanguageKey_FB.businessCardFB.localized
|
|
|
|
case .theWallet: return MultiLanguageKey_FB.theWalletFB.localized
|
|
|
|
case .music: return MultiLanguageKey_FB.musicFB.localized
|
|
|
|
default: return ""
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func imgName() -> String {
|
|
|
|
switch self {
|
|
|
|
case .findPhone: return "icon_find" /// 找设备
|
|
|
|
case .handUp: return "icon_bright_screen" ///抬手亮屏
|
|
|
|
case .callRemind: return "icon_call_notification" ///来电通知
|
|
|
|
case .messageRemind: return "icon_message_notification" /// 短信提醒
|
|
|
|
case .remoteCamera: return "icon_camera" /// 远程拍照
|
|
|
|
case .notice: return "icon_app_notification" /// 应用通知
|
|
|
|
case .heartCheck: return "icon_hr" /// 心率监测
|
|
|
|
case .dialPush: return "icon_devide_dial" ///表盘推送
|
|
|
|
case .firmwareUpgrade: return "icon_version" ///固件升级
|
|
|
|
//case .unBinding: return "" ///解除绑定
|
|
|
|
case .notDisturb: return "icon_DND" /// 勿扰模式
|
|
|
|
case .alarmClock: return "icon_remind" /// 闹钟设置
|
|
|
|
case .sedentary: return "icon_sedentary" /// 久坐提醒
|
|
|
|
case .drinkRemind: return "icon_drink" /// 喝水提醒
|
|
|
|
case .tempeartureCheck: return "icon_temperature" /// 体温监测
|
|
|
|
case .wechatSport: return "fb_icon_wechat" /// 微信运动
|
|
|
|
case .telephoneBook: return "icon_phonebook" /// 通讯录
|
|
|
|
case .businessCard: return "icon_card" /// 名片
|
|
|
|
case .theWallet: return "icon_wallet" /// 钱包
|
|
|
|
case .music: return "icon_music" /// 音乐管理
|
|
|
|
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_FB.callRemindFB.localized
|
|
|
|
case .message: return MultiLanguageKey_FB.messageRemindFB.localized
|
|
|
|
case .qq: return MultiLanguageKey_FB.qqRemindFB.localized
|
|
|
|
case .wechat: return MultiLanguageKey_FB.wechatRemindFB.localized
|
|
|
|
case .whatsapp: return MultiLanguageKey_FB.whatsappRemindFB.localized
|
|
|
|
case .messenger: return MultiLanguageKey_FB.messengerRemindFB.localized
|
|
|
|
case .twitter: return MultiLanguageKey_FB.twitterRemindFB.localized
|
|
|
|
case .linkedin: return MultiLanguageKey_FB.linkedinRemindFB.localized
|
|
|
|
case .instagram: return MultiLanguageKey_FB.instagramRemindFB.localized
|
|
|
|
case .facebook: return MultiLanguageKey_FB.facebookRemindFB.localized
|
|
|
|
case .line: return MultiLanguageKey_FB.lineRemindFB.localized
|
|
|
|
case .viber: return MultiLanguageKey_FB.viberRemindFB.localized
|
|
|
|
case .skype: return MultiLanguageKey_FB.skypeRemindFB.localized
|
|
|
|
case .outlook: return MultiLanguageKey_FB.outlookRemindFB.localized
|
|
|
|
case .all: return MultiLanguageKey_FB.allSelectFB.localized
|
|
|
|
case .others: return MultiLanguageKey_FB.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.fb_icon_walk()
|
|
|
|
/// 跑步 2
|
|
|
|
case .runTraining: return R.image.fb_icon_run()
|
|
|
|
// 室内跑 3
|
|
|
|
case .runInsideTraining: return R.image.fb_icon_runindoor()
|
|
|
|
/// 爬山 4
|
|
|
|
case .climbingTraining: return R.image.fb_icon_climb()
|
|
|
|
/// 越野跑 5
|
|
|
|
case .crossRunTraining: return R.image.fb_icon_yyp()
|
|
|
|
/// 半马 6
|
|
|
|
case .halfHorseTraining: return R.image.fb_icon_bm()
|
|
|
|
/// 全马 7
|
|
|
|
case .marathonTraining: return R.image.fb_icon_qm()
|
|
|
|
/// 跳绳 8
|
|
|
|
case .jumpRopeTraining: return R.image.fb_icon_skipping()
|
|
|
|
/// 羽毛球 9
|
|
|
|
case .badmintonTraining: return R.image.fb_icon_badminton()
|
|
|
|
/// 篮球 10
|
|
|
|
case .basketballTraning: return R.image.fb_icon_basketball()
|
|
|
|
/// 骑行 11
|
|
|
|
case .cyclingTraining: return R.image.fb_icon_bike()
|
|
|
|
/// 滑冰 12
|
|
|
|
case .skatingTraining: return R.image.fb_icon_skating()
|
|
|
|
/// 健身房 13
|
|
|
|
case .fitnessTraining: return R.image.fb_icon_gym()
|
|
|
|
/// 瑜伽 14
|
|
|
|
case .yogaTraining: return R.image.fb_icon_yoga()
|
|
|
|
/// 网球 15
|
|
|
|
case .tennisTraining: return R.image.fb_icon_tennis()
|
|
|
|
/// 乒乓球 16
|
|
|
|
case .pingpongTraining: return R.image.fb_icon_pingpong()
|
|
|
|
/// 足球 17
|
|
|
|
case .footballTraining: return R.image.fb_icon_football()
|
|
|
|
/// 游泳 18
|
|
|
|
case .swimmingTraining: return R.image.fb_icon_swim()
|
|
|
|
/// 性爱 19
|
|
|
|
case .sexTraining: return R.image.fb_icon_sex()
|
|
|
|
/// 室内骑行 20
|
|
|
|
case .indoorCyclingTraining: return R.image.fb_icon_indoor_cycling()
|
|
|
|
/// 室内健走 21
|
|
|
|
case .indoorWalkTraining: return R.image.fb_icon_indoor_walking()
|
|
|
|
/// 自由训练 22
|
|
|
|
case .freeTraining: return R.image.fb_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_FB.stepFB.localized
|
|
|
|
case .sleep: return MultiLanguageKey_FB.sleepFB.localized
|
|
|
|
case .heartRate: return MultiLanguageKey_FB.heartRateFB.localized
|
|
|
|
case .sport: return MultiLanguageKey_FB.sportFB.localized
|
|
|
|
case .temperature: return MultiLanguageKey_FB.temperatureFB.localized
|
|
|
|
case .bloodPressure: return MultiLanguageKey_FB.bloodPressureFB.localized
|
|
|
|
case .bloodOxygen: return MultiLanguageKey_FB.bloodOxygenFB.localized
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|