Skip to content

Commit

Permalink
making variables final
Browse files Browse the repository at this point in the history
  • Loading branch information
tiholic committed Aug 3, 2020
1 parent d2614d4 commit f7bf23f
Showing 1 changed file with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@ private AblyFlutterMessage<AblyEventMessage<Object>> getMessage(Object message){
@Override
public void onListen(Object object, EventChannel.EventSink uiThreadEventSink) {
MainThreadEventSink eventSink = new MainThreadEventSink(uiThreadEventSink);
AblyFlutterMessage<AblyEventMessage<Object>> ablyMessage = getMessage(object);
AblyEventMessage<Object> eventMessage = ablyMessage.message;
String eventName = eventMessage.eventName;
final AblyFlutterMessage<AblyEventMessage<Object>> ablyMessage = getMessage(object);
final AblyEventMessage<Object> eventMessage = ablyMessage.message;
final String eventName = eventMessage.eventName;
try {
switch (eventName) {
case PlatformConstants.PlatformMethod.onRealtimeConnectionStateChanged:
Expand All @@ -108,11 +108,11 @@ public void onListen(Object object, EventChannel.EventSink uiThreadEventSink) {
break;
case PlatformConstants.PlatformMethod.onRealtimeChannelStateChanged:
assert eventMessage.message!=null : "event message is missing";
Map<String, Object> eventPayload = (Map<String, Object>) eventMessage.message;
String channelName = (String) eventPayload.get("channel");
ChannelOptions channelOptions = (ChannelOptions) eventPayload.get("options");
final Map<String, Object> eventPayload = (Map<String, Object>) eventMessage.message;
final String channelName = (String) eventPayload.get("channel");
final ChannelOptions channelOptions = (ChannelOptions) eventPayload.get("options");
try {
Channel channel = ablyLibrary.getRealtime(ablyMessage.handle).channels.get(channelName, channelOptions);
final Channel channel = ablyLibrary.getRealtime(ablyMessage.handle).channels.get(channelName, channelOptions);
channelStateListener = new PluginChannelStateListener(eventSink);
channel.on(channelStateListener);
} catch (AblyException ablyException) {
Expand All @@ -133,9 +133,9 @@ public void onCancel(Object object) {
System.out.println("Cannot process null input on cancel");
return;
}
AblyFlutterMessage<AblyEventMessage<Object>> ablyMessage = getMessage(object);
AblyEventMessage<Object> eventMessage = ablyMessage.message;
String eventName = eventMessage.eventName;
final AblyFlutterMessage<AblyEventMessage<Object>> ablyMessage = getMessage(object);
final AblyEventMessage<Object> eventMessage = ablyMessage.message;
final String eventName = eventMessage.eventName;
switch (eventName) {
case PlatformConstants.PlatformMethod.onRealtimeConnectionStateChanged:
ablyLibrary.getRealtime(ablyMessage.handle).connection.off(connectionStateListener);
Expand All @@ -144,8 +144,8 @@ public void onCancel(Object object) {
// Note: this and all other assert statements in this onCancel method are
// left as is as there is no way of propagating this error to flutter side
assert eventMessage.message!=null : "event message is missing";
Map<String, Object> eventPayload = (Map<String, Object>) eventMessage.message;
String channelName = (String) eventPayload.get("channel");
final Map<String, Object> eventPayload = (Map<String, Object>) eventMessage.message;
final String channelName = (String) eventPayload.get("channel");
ablyLibrary.getRealtime(ablyMessage.handle).channels.get(channelName).off(channelStateListener);
break;
}
Expand Down

0 comments on commit f7bf23f

Please sign in to comment.