Skip to content

Conversation

@idelrich
Copy link

This new file adds a new class to the library that can handle "Multiple Subscriptions" and uses the existing SubscriptionListener class to notify the parent once all of the contained subscriptions are ready. It also adds a convenience getter to test if a subscription set is ready. The class can be used with a single subscription as well.

A sample of the "Multiple Subscriptions" might look like:

    mSubscription = new MeteorSubscription(mMeteor, new MeteorSubscription[]{
            new MeteorSubscription("activeCompetitions", null),
            new MeteorSubscription("recentGames", new Object[]{30}),
            new MeteorSubscription("recentGameScores", new Object[]{30}),
            new MeteorSubscription("activeGames", null),
            new MeteorSubscription("activeGameScores", new Object[]{true})
    
    }).start(new SubscribeListener() {
        @Override public void onSuccess() {
            Log.d("LS", "All subscriptions ready");
        }

        @Override public void onError(String error, String reason, String details) {
            Log.d("LS", "Error subscribing" + error + " [ " + reason + " ] ~> " + details);
        }
    });

All subscriptions can be stopped by calling mSubscription.stop();

Stephen
(stephen@chatorr.ca)

This new file adds a new class to the library that can handle "Multiple Subscriptions" and uses the existing SubscriptionListener class to notify the parent once all of the contained subscriptions are ready. It also adds a convenience getter to test if a subscription set is ready. The class can be used with a single subscription as well. 

A sample of the "Multiple Subscriptions" might look like:

        mSubscription = new MeteorSubscription(mMeteor, new MeteorSubscription[]{
                new MeteorSubscription("activeCompetitions", null),
                new MeteorSubscription("recentGames", new Object[]{30}),
                new MeteorSubscription("recentGameScores", new Object[]{30}),
                new MeteorSubscription("activeGames", null),
                new MeteorSubscription("activeGameScores", new Object[]{true})
        
        }).start(new SubscribeListener() {
            @OverRide public void onSuccess() {
                Log.d("LS", "All subscriptions ready");
            }

            @OverRide public void onError(String error, String reason, String details) {
                Log.d("LS", "Error subscribing" + error + " [ " + reason + " ] ~> " + details);
            }
        });

All subscriptions can be stopped by calling mSubscription.stop();

Stephen
(stephen@chatorr.ca)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant