40 lines
1.4 KiB
Swift
40 lines
1.4 KiB
Swift
//
|
|
// BaseViewController.swift
|
|
// MusicPlayer
|
|
//
|
|
// Created by Mr.Zhou on 2024/3/27.
|
|
//
|
|
|
|
import UIKit
|
|
///A面基类页面
|
|
class MPSideA_BaseViewController: MP_BaseViewController {
|
|
///音乐文件缺失
|
|
var nullMusicAction:ActionBlock?
|
|
override func viewDidLoad() {
|
|
super.viewDidLoad()
|
|
}
|
|
//音乐文件缺失
|
|
@objc func fileMissAction(_ sender:Notification) {
|
|
DispatchQueue.main.async {
|
|
[weak self] in
|
|
//弹出删除音乐框
|
|
let alert = UIAlertController(title: "Missing Files", message: "The current music file is missing and will remove remove the music from the catalog. If you want to continue using the music file, please re-import it!", preferredStyle: .alert)
|
|
let okAction = UIAlertAction(title: "OK", style: .destructive) { [weak self] (_) in
|
|
guard let music = MPSideA_MediaCenterManager.shared.getMusic() else {
|
|
return
|
|
}
|
|
//从表中删除当前音乐实体
|
|
MPSideA_MusicModel.delete(music)
|
|
MPSideA_MediaCenterManager.shared.setMusic(nil)
|
|
//执行删除闭包
|
|
guard self?.nullMusicAction != nil else {
|
|
return
|
|
}
|
|
self?.nullMusicAction!()
|
|
}
|
|
alert.addAction(okAction)
|
|
self?.present(alert, animated: true)
|
|
}
|
|
}
|
|
}
|