|
11 | 11 |
|
12 | 12 | import java.util.*; |
13 | 13 |
|
| 14 | +import io.channel.plugin.android.enumerate.BubblePosition; |
| 15 | +import io.channel.plugin.android.open.option.BubbleOption; |
| 16 | + |
14 | 17 | /** |
15 | 18 | * Created by jerry on 2018. 10. 11.. |
16 | 19 | */ |
@@ -200,6 +203,25 @@ public static ChannelButtonOption toChannelButtonOption(ReadableMap channelButto |
200 | 203 | return null; |
201 | 204 | } |
202 | 205 |
|
| 206 | + public static BubbleOption toBubbleOption(ReadableMap bubbleOptionMap) { |
| 207 | + if (bubbleOptionMap != null) { |
| 208 | + String positionString = Utils.getString(bubbleOptionMap, Const.KEY_POSITION).getValue(); |
| 209 | + Double yPosition = Utils.getDouble(bubbleOptionMap, Const.KEY_Y_MARGIN).getValue(); |
| 210 | + |
| 211 | + if (positionString != null && yPosition != null) { |
| 212 | + switch (positionString) { |
| 213 | + case Const.KEY_BUBBLE_POSITION_TOP: |
| 214 | + return new BubbleOption(BubblePosition.TOP, yPosition.floatValue()); |
| 215 | + |
| 216 | + case Const.KEY_BUBBLE_POSITION_BOTTOM: |
| 217 | + return new BubbleOption(BubblePosition.BOTTOM, yPosition.floatValue()); |
| 218 | + } |
| 219 | + } |
| 220 | + } |
| 221 | + |
| 222 | + return null; |
| 223 | + } |
| 224 | + |
203 | 225 | private static Profile toProfile(ReadableMap profileMap) { |
204 | 226 | if (profileMap != null) { |
205 | 227 | Profile profile = Profile.create(); |
@@ -290,6 +312,11 @@ public static BootConfig toBootConfig(ReadableMap configMap) { |
290 | 312 | bootConfig.setChannelButtonOption(toChannelButtonOption(channelButtonOption.getValue())); |
291 | 313 | } |
292 | 314 |
|
| 315 | + MapEntry<ReadableMap> bubbleOption = Utils.getReadableMap(configMap, Const.KEY_BUBBLE_OPTION); |
| 316 | + if (bubbleOption.hasValue()) { |
| 317 | + bootConfig.setBubbleOption(toBubbleOption(bubbleOption.getValue())); |
| 318 | + } |
| 319 | + |
293 | 320 | MapEntry<ReadableMap> profile = Utils.getReadableMap(configMap, Const.KEY_PROFILE); |
294 | 321 | if (profile.hasValue()) { |
295 | 322 | bootConfig.setProfile(toProfile(profile.getValue())); |
|
0 commit comments