package com.uiui.zyappstore.service.main;

import android.content.Context;

import com.trello.rxlifecycle4.android.ActivityEvent;
import com.uiui.zyappstore.network.NetInterfaceManager;

import io.reactivex.rxjava3.subjects.BehaviorSubject;

public class MainSPresenter implements MainSContact.Presenter {
    private String TAG = MainSPresenter.class.getSimpleName();

    private MainSContact.MainView mView;
    private Context mContext;

    public MainSPresenter(Context context) {
        this.mContext = context;
    }

    private BehaviorSubject<ActivityEvent> lifecycle;

    public void setLifecycle(BehaviorSubject<ActivityEvent> lifecycle) {
        this.lifecycle = lifecycle;
    }

    public BehaviorSubject<ActivityEvent> getLifecycle() {
        return lifecycle;
    }

    @Override
    public void attachView(MainSContact.MainView view) {
        this.mView = view;
    }

    @Override
    public void detachView() {
        this.mView = null;
    }

    @Override
    public void getSnTag() {
        NetInterfaceManager.getInstance().setPushTags(new NetInterfaceManager.onCompleteCallback() {
            @Override
            public void onComplete() {
                mView.setSnTag();
            }
        });
    }
}
