Giter VIP home page Giter VIP logo

proxypref's People

Contributors

konmik avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

hajoxx

proxypref's Issues

ProxyPref is "Null"

Hi. I've been using this library for a few days with dagger2 attached.
It worked fine. But as soon as I introduced Nucleous, proxyPref had broken.

Here is some code:

Proxy pref is built in NetModule:

@Module
public class NetModule {
    @Provides
    @Singleton
    FixedPreferences providesFixedPrefs(Application application) {
         return  ProxyPreferences
                .build(FixedPreferences.class, application.getSharedPreferences("fixedprefs", Context.MODE_PRIVATE));
    }
}

My interface:

public interface FixedPreferences {


    @DefaultString("a")
    String getAuthToken();
    void setAuthToken(String x);

    @DefaultLong(0l)
    Long getLastUploadUpdate();
    void setLastUploadUpdate(Long x);

    @DefaultLong(0l)
    Long getLastDownloadUpdate();
    void setLastDownloadUpdate(Long x);
}

I'm trying to inject it in BasePresenter:

public class BasePresenter<V extends NucleusAppCompatActivity> extends RxPresenter<V> {
    private static final String TAG = LogUtils.makeLogTag(BasePresenter.class.getSimpleName());
    @Inject
    FixedPreferences pref;
    @Inject
    FixedRecApi fixedRecApi; //this is a Retrofit Api. It works fine with dagger2 and Nucleous.
}

Then I extends BasePresenter by other presenters I have.

Everything was fine untill I intorduced Nucleous

Also please take into account this debug window. It says that proxyPrefs are loaded, but unaccessable.
proxypref

Invalid shared preferences type: rx.Observable<java.lang.Boolean>

Hey! Can you please share some example of how to use observables with proxypref.
I want to wrap all my access to shared preferences in rx chain.

//    @DefaultBoolean(false)
//    @Preference(PREF_ENABLE_NOTIFICATION)
    Observable<Boolean> isNotificationEnabled();

//    @Preference(PREF_ENABLE_NOTIFICATION)
    Observable<Void> setNotificationEnabled(Boolean b);

I've tried to do this, but it gives me the error in the title.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.