-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAppModule.java
More file actions
42 lines (31 loc) · 1.08 KB
/
AppModule.java
File metadata and controls
42 lines (31 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package com.tom.meeter;
import static com.tom.meeter.infrastructure.common.Globals.getServerPath;
import static com.tom.meeter.infrastructure.common.InfrastructureHelper.logMethod;
import static com.tom.meeter.infrastructure.common.RetrofitBuilder.createBuilder;
import android.app.Application;
import androidx.annotation.NonNull;
import com.tom.meeter.infrastructure.common.RetrofitBuilder;
import com.tom.meeter.infrastructure.components.UserLoader;
import com.tom.meeter.infrastructure.http.HttpClient;
import javax.inject.Singleton;
import dagger.Module;
import dagger.Provides;
@Module
public class AppModule {
private static final String TAG = AppModule.class.getCanonicalName();
public AppModule() {
logMethod(TAG, this);
}
@Singleton
@NonNull
@Provides
public HttpClient provideHttpClient(Application app) {
return new HttpClient(getServerPath(app));
}
@Singleton
@NonNull
@Provides
public UserLoader provideUserLoader(Application app) {
return createBuilder(app, RetrofitBuilder.jtm).create(UserLoader.class);
}
}