|
|
@@ -1,9 +1,12 @@
|
|
|
package com.atmob.voiceai.data.repositories;
|
|
|
|
|
|
|
|
|
+import android.app.Application;
|
|
|
+
|
|
|
import androidx.annotation.IntDef;
|
|
|
import androidx.lifecycle.LiveData;
|
|
|
import androidx.lifecycle.MutableLiveData;
|
|
|
+import androidx.lifecycle.Observer;
|
|
|
|
|
|
import com.atmob.app.lib.handler.RxHttpHandler;
|
|
|
import com.atmob.app.lib.livedata.SingleLiveEvent;
|
|
|
@@ -21,6 +24,8 @@ import com.atmob.voiceai.data.api.response.VoiceInfoResponse;
|
|
|
import com.atmob.voiceai.data.api.response.VoiceListResponse;
|
|
|
import com.atmob.voiceai.data.api.response.VoiceTypeResponse;
|
|
|
import com.atmob.voiceai.data.consts.ErrorCode;
|
|
|
+import com.atmob.voiceai.handlers.EventHandler;
|
|
|
+import com.atmob.voiceai.sdk.firebase.FirebaseHelper;
|
|
|
import com.atmob.voiceai.utils.BoxingUtil;
|
|
|
import com.atmob.voiceai.utils.ThreePair;
|
|
|
|
|
|
@@ -32,6 +37,10 @@ import atmob.reactivex.rxjava3.core.Single;
|
|
|
import atmob.reactivex.rxjava3.core.SingleObserver;
|
|
|
import atmob.reactivex.rxjava3.disposables.Disposable;
|
|
|
import atmob.rxjava.utils.RxJavaUtil;
|
|
|
+import dagger.hilt.EntryPoint;
|
|
|
+import dagger.hilt.InstallIn;
|
|
|
+import dagger.hilt.android.EntryPointAccessors;
|
|
|
+import dagger.hilt.components.SingletonComponent;
|
|
|
|
|
|
@Singleton
|
|
|
public class VoiceAIRepository {
|
|
|
@@ -68,7 +77,6 @@ public class VoiceAIRepository {
|
|
|
this.atmobApi = atmobApi;
|
|
|
this.memberRepository = memberRepository;
|
|
|
this.historyRepository = historyRepository;
|
|
|
- refreshVoiceInfo();
|
|
|
}
|
|
|
|
|
|
public void setUseClonedVoiceEvent(int id) {
|
|
|
@@ -112,7 +120,7 @@ public class VoiceAIRepository {
|
|
|
}
|
|
|
|
|
|
|
|
|
- private void refreshVoiceInfo() {
|
|
|
+ public void refreshVoiceInfo() {
|
|
|
if (isRequestFreeGenerate || BoxingUtil.boxing(memberRepository.getIsMember().getValue())) {
|
|
|
return;
|
|
|
}
|
|
|
@@ -210,4 +218,17 @@ public class VoiceAIRepository {
|
|
|
}
|
|
|
|
|
|
|
|
|
+ public static VoiceAIRepository getVoiceAIRepository() {
|
|
|
+ Application application = ContextUtil.getApplication();
|
|
|
+ VoiceAIRepositoryEntryPoint entryPoint = EntryPointAccessors.fromApplication(application, VoiceAIRepositoryEntryPoint.class);
|
|
|
+ return entryPoint.voiceAIRepository();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @EntryPoint
|
|
|
+ @InstallIn(SingletonComponent.class)
|
|
|
+ interface VoiceAIRepositoryEntryPoint {
|
|
|
+ VoiceAIRepository voiceAIRepository();
|
|
|
+ }
|
|
|
+
|
|
|
}
|