Skip to content

Shared preference fix. #31

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

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
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 @@ -7,14 +7,14 @@
import javax.inject.Singleton;

@Singleton
public class PreferencesHelper {
public class PrefHelper {

private static final String PREF_FILE_NAME = "mvpstarter_pref_file";

private final SharedPreferences preferences;

@Inject
PreferencesHelper(SharedPreferences sharedPreferences) {
PrefHelper(SharedPreferences sharedPreferences) {
preferences = sharedPreferences;
}

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

import dagger.Component;
import io.mvpstarter.sample.data.DataManager;
import io.mvpstarter.sample.data.local.PrefHelper;
import io.mvpstarter.sample.injection.ApplicationContext;
import io.mvpstarter.sample.injection.module.AppModule;

Expand All @@ -20,4 +21,6 @@ public interface AppComponent {
Application application();

DataManager apiManager();

PrefHelper prefHelper();
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import android.content.Context;
import android.content.SharedPreferences;

import javax.inject.Singleton;

import dagger.Module;
import dagger.Provides;
import io.mvpstarter.sample.injection.ApplicationContext;
Expand All @@ -30,7 +32,7 @@ Context provideContext() {
}

@Provides
@ApplicationContext
@Singleton
SharedPreferences provideSharedPreference(@ApplicationContext Context context) {
return context.getSharedPreferences(PREF_FILE_NAME, Context.MODE_PRIVATE);
}
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ buildscript {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0-beta2'
classpath 'com.android.tools.build:gradle:3.0.0-beta5'
//noinspection GradleDynamicVersion
classpath 'io.fabric.tools:gradle:1.+'
classpath 'com.google.gms:google-services:3.1.0'
Expand Down