Skip to content

Commit

Permalink
cobaltians/Cobalt#189 reversing params for subscribe and unsubscribe
Browse files Browse the repository at this point in the history
  • Loading branch information
ggendre committed Apr 25, 2019
1 parent aa31894 commit 46dd459
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
16 changes: 8 additions & 8 deletions src/main/java/org/cobaltians/cobalt/Cobalt.java
Original file line number Diff line number Diff line change
Expand Up @@ -503,24 +503,24 @@ public static void publishMessage(@Nullable JSONObject message, @NonNull String

/**
* Subscribes the specified PubSubInterface to messages sent via the specified channel.
* @param listener the PubSubInterface the PubSubReceiver will have to use to send messages.
* @param channel the channel the PubSubReceiver subscribes.
* @param listener the PubSubInterface the PubSubReceiver will have to use to send messages.
*/
public static void subscribeToChannel(@NonNull PubSubInterface listener,
@NonNull String channel)
public static void subscribeToChannel(@NonNull String channel,
@NonNull PubSubInterface listener)
{
PubSub.getInstance().subscribeToChannel(listener, channel);
PubSub.getInstance().subscribeToChannel(channel, listener);
}

/**
* Unsubscribes the specified PubSubInterface from messages sent via the specified channel.
* @param listener the PubSubInterface to unsubscribes from the channel.
* @param channel the channel from which the messages come from.
* @param listener the PubSubInterface to unsubscribes from the channel.
*/
public static void unsubscribeFromChannel(@NonNull PubSubInterface listener,
@NonNull String channel)
public static void unsubscribeFromChannel(@NonNull String channel,
@NonNull PubSubInterface listener)
{
PubSub.getInstance().unsubscribeFromChannel(listener, channel);
PubSub.getInstance().unsubscribeFromChannel(channel, listener);
}

private JSONObject getConfiguration() {
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/org/cobaltians/cobalt/pubsub/PubSub.java
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,11 @@ public final void unsubscribeWebFromChannel(@NonNull CobaltFragment fragment,
/**
* Subscribes the specified PubSubInterface to messages sent via the specified channel.
* @implNote if no PubSubReceiver was created for the specified PubSubInterface, creates it.
* @param listener the PubSubInterface the PubSubReceiver will have to use to send messages.
* @param channel the channel the PubSubReceiver subscribes.
* @param listener the PubSubInterface the PubSubReceiver will have to use to send messages.
*/
public final void subscribeToChannel(@NonNull PubSubInterface listener,
@NonNull String channel)
public final void subscribeToChannel(@NonNull String channel,
@NonNull PubSubInterface listener)
{
PubSubReceiver subscribingReceiver = null;

Expand All @@ -190,11 +190,11 @@ public final void subscribeToChannel(@NonNull PubSubInterface listener,

/**
* Unsubscribes the specified PubSubInterface from messages sent via the specified channel.
* @param listener the PubSubInterface to unsubscribes from the channel.
* @param channel the channel from which the messages come from.
* @param listener the PubSubInterface to unsubscribes from the channel.
*/
public final void unsubscribeFromChannel(@NonNull PubSubInterface listener,
@NonNull String channel)
public final void unsubscribeFromChannel(@NonNull String channel,
@NonNull PubSubInterface listener)
{
PubSubReceiver unsubscribingReceiver = null;

Expand Down

0 comments on commit 46dd459

Please sign in to comment.