package com.kaixed.kchat;

import android.app.Application;
import android.content.Context;
import android.util.Log;

import com.kaixed.kchat.database.ObjectBox;
import com.tencent.mmkv.MMKV;

import io.objectbox.android.Admin;

/**
 * @Author: kaixed
 * @Date: 2024/5/4 10:37
 * @Description: 应用程序application类
 */
public class KchatApplication extends Application {
    private static KchatApplication instance;

    @Override
    public void onCreate() {
        super.onCreate();
        instance = this;
        String rootDir = MMKV.initialize(this);
        Log.d("mmkv root: ", rootDir);

        ObjectBox.init(this);


        boolean started = new Admin(ObjectBox.get()).start(this);
        Log.i("ObjectBoxAdmin", "Started: " + started);

    }

    @Override
    protected void attachBaseContext(Context base) {
//        TheRouter.setDebug(true);
        super.attachBaseContext(base);
    }

    public static KchatApplication getInstance() {
        return instance;
    }
}
