package com.adealink.weparty.setting

import androidx.fragment.app.FragmentManager
import androidx.lifecycle.ViewModelProvider
import androidx.lifecycle.ViewModelStoreOwner
import com.adealink.frame.spi.RegisterService
import com.adealink.weparty.module.setting.ISettingService
import com.adealink.weparty.module.setting.Setting
import com.adealink.weparty.module.setting.viewmodel.ISettingViewModel
import com.adealink.weparty.setting.language.LanguageSettingDialog
import com.adealink.weparty.setting.viewmodel.SettingViewModel

@RegisterService(ISettingService::class)
class SettingServiceImpl : ISettingService {

    override fun showLanguageSettingDialog(fragmentManager: FragmentManager) {
        LanguageSettingDialog().show(fragmentManager, Setting.Language.PATH)
    }

    override fun getSettingViewModel(owner: ViewModelStoreOwner): ISettingViewModel? {
        return ViewModelProvider(owner)[SettingViewModel::class.java]
    }

    override fun getService(): ISettingService {
        return this
    }

    override fun onLogout() {

    }


}