Skip to content

issue_3321_seperate_firebaseapp #3327

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jan 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public class FirebaseModelDownloader {
FirebaseApp firebaseApp, FirebaseInstallationsApi firebaseInstallationsApi) {
this.firebaseOptions = firebaseApp.getOptions();
this.sharedPreferencesUtil = new SharedPreferencesUtil(firebaseApp);
this.eventLogger = FirebaseMlLogger.getInstance();
this.eventLogger = FirebaseMlLogger.getInstance(firebaseApp);
this.fileDownloadService = new ModelFileDownloadService(firebaseApp);
this.modelDownloadService =
new CustomModelDownloadService(firebaseApp, firebaseInstallationsApi);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ public static FirebaseMlLogger getInstance() {
return FirebaseApp.getInstance().get(FirebaseMlLogger.class);
}

@NonNull
public static FirebaseMlLogger getInstance(@NonNull FirebaseApp app) {
return app.get(FirebaseMlLogger.class);
}

void logModelInfoRetrieverFailure(CustomModel model, ErrorCode errorCode) {
logModelInfoRetrieverFailure(model, errorCode, NO_FAILURE_VALUE);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public class ModelFileDownloadService {
public ModelFileDownloadService(@NonNull FirebaseApp firebaseApp) {
this.context = firebaseApp.getApplicationContext();
downloadManager = (DownloadManager) context.getSystemService(Context.DOWNLOAD_SERVICE);
this.fileManager = ModelFileManager.getInstance();
this.fileManager = ModelFileManager.getInstance(firebaseApp);
this.sharedPreferencesUtil = new SharedPreferencesUtil(firebaseApp);
this.isInitialLoad = true;
this.eventLogger = FirebaseMlLogger.getInstance();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ public static ModelFileManager getInstance() {
return FirebaseApp.getInstance().get(ModelFileManager.class);
}

@NonNull
public static ModelFileManager getInstance(@NonNull FirebaseApp app) {
return app.get(ModelFileManager.class);
}

void deleteNonLatestCustomModels() throws FirebaseMlException {
File root = getDirImpl("");

Expand Down