Skip to content
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

chore(#264): add support for Hilt dependency injection #321

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from
Draft
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
4 changes: 4 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:7.1.3'
classpath 'com.github.spotbugs.snom:spotbugs-gradle-plugin:5.0.5'
classpath 'com.google.dagger:hilt-android-gradle-plugin:2.44.2'
}
}

apply plugin: 'com.android.application'
apply plugin: 'checkstyle'
apply plugin: 'pmd'
apply plugin: 'com.github.spotbugs'
apply plugin: 'com.google.dagger.hilt.android'
apply from: 'coverage.gradle'

// enable verbose lint warnings
Expand Down Expand Up @@ -412,6 +414,8 @@ dependencies {
implementation 'androidx.core:core:1.7.0'
implementation 'androidx.activity:activity:1.4.0'
implementation 'androidx.fragment:fragment:1.4.1'
implementation 'com.google.dagger:hilt-android:2.44.2'
annotationProcessor "com.google.dagger:hilt-compiler:2.44.2"
compileOnly 'com.github.spotbugs:spotbugs-annotations:4.5.3'
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
testImplementation 'junit:junit:4.13.2'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.MethodSorters;
import org.medicmobile.webapp.mobile.components.settings_dialog.SettingsDialogActivity;

import java.util.Locale;
@LargeTest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.MethodSorters;
import org.medicmobile.webapp.mobile.components.settings_dialog.SettingsDialogActivity;

import java.util.Locale;

Expand Down
5 changes: 3 additions & 2 deletions src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
<uses-permission android:name="android.permission.SEND_SMS"/>
-->

<application android:label="@string/app_name"
<application android:name=".ChtAndroidApplication"
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:allowBackup="false"
android:fullBackupContent="@xml/backup_rules_sdk_30_and_lower"
Expand All @@ -48,7 +49,7 @@
android:launchMode="singleTop"/>
<activity android:name="FreeSpaceWarningActivity"
android:screenOrientation="portrait"/>
<activity android:name="SettingsDialogActivity"
<activity android:name=".components.settings_dialog.SettingsDialogActivity"
android:screenOrientation="portrait"/>
<activity android:name="RequestLocationPermissionActivity"
android:screenOrientation="portrait"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package org.medicmobile.webapp.mobile;

import android.app.Application;

import dagger.hilt.android.HiltAndroidApp;

@HiltAndroidApp
public class ChtAndroidApplication extends Application {
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@

import androidx.core.content.ContextCompat;

import org.medicmobile.webapp.mobile.SettingsStore.SettingsException;

import java.util.Arrays;
import java.util.Optional;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

import androidx.annotation.Nullable;

import org.medicmobile.webapp.mobile.components.settings_dialog.SettingsDialogActivity;

import java.time.Clock;

@SuppressLint("ValidFragment")
Expand Down
Loading