Android Parse SDK in RxJava


License

License

Categories

Categories

FST Data Data Formats Serialization
GroupId

GroupId

com.infstory
ArtifactId

ArtifactId

rxparse
Last Version

Last Version

1.0.1
Release Date

Release Date

Type

Type

aar
Description

Description

Android Parse SDK in RxJava
Android Parse SDK in RxJava
Project URL

Project URL

https://github.com/yongjhih/RxParse
Source Code Management

Source Code Management

https://github.com/yongjhih/RxParse

Download rxparse

How to add to project

<!-- https://jarcasting.com/artifacts/com.infstory/rxparse/ -->
<dependency>
    <groupId>com.infstory</groupId>
    <artifactId>rxparse</artifactId>
    <version>1.0.1</version>
    <type>aar</type>
</dependency>
// https://jarcasting.com/artifacts/com.infstory/rxparse/
implementation 'com.infstory:rxparse:1.0.1'
// https://jarcasting.com/artifacts/com.infstory/rxparse/
implementation ("com.infstory:rxparse:1.0.1")
'com.infstory:rxparse:aar:1.0.1'
<dependency org="com.infstory" name="rxparse" rev="1.0.1">
  <artifact name="rxparse" type="aar" />
</dependency>
@Grapes(
@Grab(group='com.infstory', module='rxparse', version='1.0.1')
)
libraryDependencies += "com.infstory" % "rxparse" % "1.0.1"
[com.infstory/rxparse "1.0.1"]

Dependencies

compile (3)

Group / Artifact Type Version
io.reactivex : rxjava jar 1.0.7
com.infstory » parse jar 1.8.1
com.parse.bolts : bolts-android jar 1.1.4

Project Modules

There are no modules declared in this project.

RxParse

Android Arsenal JitPack Download javadoc Build Status Gitter Chat Coverage Status Bountysource Codacy Badge

rxparse.png

javadoc:

  • rxparse: javadoc
  • rxparse-facebook-v3: javadoc
  • rxparse-facebook-v4: javadoc

Usage of RxJava2

find

<T extends ParseObject> Observable<T> ParseObservable.find(ParseQuery<T>);

Before:

ParseUser.getQuery().findInBackground(new FindCallback() {
    @Override
    public done(ParseUser user, ParseException e) {
        if (e == null) System.out.println(user);
    }
});

After:

Observable<ParseUser> users = ParseObservable.find(ParseUser.getQuery());
users.subscribe(user -> System.out.println(user.getObjectId()));
Observable<ParseUser> users = ParseObservable.find(ParseUser.getQuery().setLimit(1000));

count

Before:

ParseUser.getQuery().countInBackground(new CountCallback() {
    @Override
    public done(int count, ParseException e) {
        if (e == null) System.out.println(count);
    }
});

After:

Single<Integer> count = ParseObservable.count(ParseUser.getQuery());
count.subscirbe(c -> System.out.println(c));

Sign in with facebook

After:

ParseFacebookObservable.logIn(Arrays.asList("public_profile", "email"), activity).subscribe(user -> {
  System.out.println("user: " + user);
});

Get my commented posts

Before:

ParseComment.getQuery().whereEqualTo("from", ParseUser.getCurrentUser()).findInBackground(new FindCallback<ParseComment> {
    @Override
    public done(List<ParseComment> comments, ParseException e) {
        if (e != null) return;

        ParsePost.getQuery().whereContainedIn("comments", comments).findInBackground(new FindCallback<ParsePost>() {
            @Override
            public done(List<ParsePost> posts, ParseException e2) {
                if (e2 != null) return;

                // ...
            }
        });
    }
});

After:

ParseObservable.find(ParseComment.getQuery().whereEqualTo("from", ParseUser.getCurrentUser()))
    .toList()
    .flatMap(comments -> ParseObservable.find(ParsePost.getQuery().whereContainedIn("comments", comments)))
    .subscribe(posts -> {});

Parse cloud code: ParseObservable.callFunction()

Map<String, Object> params = new HashMap<>();
params.put("accessToken", googleToken());
ParseObservable.callFunction("signInWithGoogle", params).subscribe(parseToken -> {});

Usage of RxJava1

count

Before:

ParseUser.getQuery().countInBackground(new CountCallback() {
    @Override
    public done(int count, ParseException e) {
        if (e == null) System.out.println(count);
    }
});

After:

Observable<Integer> count = ParseObservable.count(ParseUser.getQuery());
count.subscirbe(c -> System.out.println(c));

Installation

RxJava2

via jitpack.io

repositories {
    jcenter()
    maven { url "https://jitpack.io" }
}

dependencies {
    compile 'com.github.yongjhih.RxParse:rxparse2:2.1.0'
    //compile 'com.github.yongjhih.RxParse:rxparse2-facebook-v3:2.1.0' // if needed
    //compile 'com.github.yongjhih.RxParse:rxparse2-facebook-v4:2.1.0' // if needed

    // SNAPSHOT
    //compile 'com.github.yongjhih.RxParse:rxparse2:-SNAPSHOT'
    //compile 'com.github.yongjhih.RxParse:rxparse2-facebook-v3:-SNAPSHOT' // if needed
    //compile 'com.github.yongjhih.RxParse:rxparse2-facebook-v4:-SNAPSHOT' // if needed
}

via jcenter

repositories {
    jcenter()

}

dependencies {
    compile 'com.infstory:rxparse2:2.1.0'
    //compile 'com.infstory:rxparse2-facebook-v3:2.1.0' // if needed
    //compile 'com.infstory:rxparse2-facebook-v4:2.1.0' // if needed
}

RxJava1

repositories {
    jcenter()
    maven { url "https://jitpack.io" }
}

dependencies {
    compile 'com.github.yongjhih.RxParse:rxparse:2.0.3'
    //compile 'com.github.yongjhih.RxParse:rxparse-facebook-v3:2.0.3' // if needed
    //compile 'com.github.yongjhih.RxParse:rxparse-facebook-v4:2.0.3' // if needed
}

via jcenter

repositories {
    jcenter()

}

dependencies {
    compile 'com.infstory:rxparse:2.0.3'
    //compile 'com.infstory:rxparse-facebook-v3:2.0.3' // if needed
    //compile 'com.infstory:rxparse-facebook-v4:2.0.3' // if needed
}

Test

./gradlew clean :rxparse:assembleDebug :rxparse:testDebug --tests='*.ParseObservableTest'

Deploy

./gradlew :rxparse2:build :rxparse2:bintrayUpload
./gradlew :rxparse2-facebook-v3:build :rxparse2-facebook-v3:bintrayUpload
./gradlew :rxparse2-facebook-v4:build :rxparse2-facebook-v4:bintrayUpload

LICENSE

Copyright 2015 8tory, Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Versions

Version
1.0.1