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.
39 lines
1.3 KiB
39 lines
1.3 KiB
![]()
2 years ago
|
//
|
||
![]()
2 years ago
|
// NoticeViewModels.swift
|
||
![]()
1 year ago
|
// FireBoltt
|
||
![]()
2 years ago
|
//
|
||
|
// Created by lemo. on 2020/3/29.
|
||
|
// Copyright © 2020 Sheldon. All rights reserved.
|
||
|
//
|
||
|
|
||
|
import UIKit
|
||
|
|
||
![]()
2 years ago
|
class NoticeViewModels: ViewModel {
|
||
![]()
2 years ago
|
|
||
|
/// 数据源
|
||
|
let datasource = BehaviorRelay<[SectionModel<String, TableViewCellModel>]>.init(value: [])
|
||
|
/// 功能列表
|
||
|
let funcations: [[PushType]] = [[.all], [.qq, .wechat, .whatsapp, .messenger, .twitter, .linkedin, .instagram, .facebook, .line, .viber, .skype, .outlook,.others]]
|
||
|
|
||
|
override init() {
|
||
|
super.init()
|
||
![]()
1 year ago
|
fbloadFuncation()
|
||
![]()
2 years ago
|
}
|
||
|
|
||
![]()
1 year ago
|
func fbloadFuncation() {
|
||
![]()
2 years ago
|
var sections: [SectionModel<String, TableViewCellModel>] = []
|
||
|
funcations.forEach { (types) in
|
||
|
var cellModels: [TableViewCellModel] = []
|
||
|
types.enumerated().forEach { (index, type) in
|
||
|
let isBottomLine = index != types.count - 1
|
||
|
let isON = type.getSwitchState(currenValue: GlobalDeviceProfileModel.shareInstance.pushSetValue)
|
||
|
let cellModel = TableViewCellModel(title: type.title, isSwitch: true, description: nil, isArrows: false, isOn: isON, image: nil, isBottomLine: isBottomLine, pushType: type)
|
||
|
cellModels.append(cellModel)
|
||
|
}
|
||
|
sections.append(SectionModel(model: "", items: cellModels))
|
||
|
}
|
||
|
datasource.accept(sections)
|
||
|
}
|
||
|
|
||
|
}
|