// ----------- Private Methods ----------// private LinkProperties createLinkPropertiesDict(KrollDict options, KrollDict controlParams) { Log.d(LCAT, "start createLinkPropertiesDict"); LinkProperties linkProperties = new LinkProperties(); if (options.containsKey("feature")) { linkProperties.setFeature(options.getString("feature")); } if (options.containsKey("alias")) { linkProperties.setAlias(options.getString("alias")); } if (options.containsKey("channel")) { linkProperties.setChannel(options.getString("channel")); } if (options.containsKey("stage")) { linkProperties.setStage(options.getString("stage")); } if (options.containsKey("duration")) { linkProperties.setDuration(options.getInt("duration")); } if (options.containsKey("tags")) { ArrayList<String> tags = (ArrayList<String>) options.get("tags"); for (String tag : tags) { linkProperties.addTag(tag); } } if (controlParams.containsKey("$fallback_url")) { Log.d(LCAT, "addControlParameter $fallback_url"); linkProperties.addControlParameter("$fallback_url", controlParams.getString("$fallback_url")); } if (controlParams.containsKey("$desktop_url")) { Log.d(LCAT, "addControlParameter $desktop_url"); linkProperties.addControlParameter("$desktop_url", controlParams.getString("$desktop_url")); } if (controlParams.containsKey("$android_url")) { Log.d(LCAT, "addControlParameter $android_url"); linkProperties.addControlParameter("$android_url", controlParams.getString("$android_url")); } if (controlParams.containsKey("$ios_url")) { Log.d(LCAT, "addControlParameter $ios_url"); linkProperties.addControlParameter("$ios_url", controlParams.getString("$ios_url")); } if (controlParams.containsKey("$ipad_url")) { Log.d(LCAT, "addControlParameter $ipad_url"); linkProperties.addControlParameter("$ipad_url", controlParams.getString("$ipad_url")); } if (controlParams.containsKey("$fire_url")) { Log.d(LCAT, "addControlParameter $fire_url"); linkProperties.addControlParameter("$fire_url", controlParams.getString("$fire_url")); } if (controlParams.containsKey("$blackberry_url")) { Log.d(LCAT, "addControlParameter $blackberry_url"); linkProperties.addControlParameter( "$blackberry_url", controlParams.getString("$blackberry_url")); } if (controlParams.containsKey("$windows_phone_url")) { Log.d(LCAT, "addControlParameter $windows_phone_url"); linkProperties.addControlParameter( "$windows_phone_url", controlParams.getString("$windows_phone_url")); } return linkProperties; }
@Kroll.method public void generateShortUrl(KrollDict options, KrollDict controlParams) { Log.d(LCAT, "start generateShortUrl"); LinkProperties linkProperties = new LinkProperties(); if (options.containsKey("feature")) { linkProperties.setFeature(options.getString("feature")); } if (options.containsKey("alias")) { linkProperties.setAlias(options.getString("alias")); } if (options.containsKey("channel")) { linkProperties.setChannel(options.getString("channel")); } if (options.containsKey("stage")) { linkProperties.setStage(options.getString("stage")); } if (options.containsKey("duration")) { linkProperties.setDuration(options.getInt("duration")); } if (options.containsKey("tags")) { ArrayList<String> tags = (ArrayList<String>) options.get("tags"); for (String tag : tags) { linkProperties.addTag(tag); } } if (controlParams.containsKey("$fallback_url")) { Log.d(LCAT, "addControlParameter $fallback_url"); linkProperties.addControlParameter("$fallback_url", controlParams.getString("$fallback_url")); } if (controlParams.containsKey("$desktop_url")) { Log.d(LCAT, "addControlParameter $desktop_url"); linkProperties.addControlParameter("$desktop_url", controlParams.getString("$desktop_url")); } if (controlParams.containsKey("$android_url")) { Log.d(LCAT, "addControlParameter $android_url"); linkProperties.addControlParameter("$android_url", controlParams.getString("$android_url")); } if (controlParams.containsKey("$ios_url")) { Log.d(LCAT, "addControlParameter $ios_url"); linkProperties.addControlParameter("$ios_url", controlParams.getString("$ios_url")); } if (controlParams.containsKey("$ipad_url")) { Log.d(LCAT, "addControlParameter $ipad_url"); linkProperties.addControlParameter("$ipad_url", controlParams.getString("$ipad_url")); } if (controlParams.containsKey("$fire_url")) { Log.d(LCAT, "addControlParameter $fire_url"); linkProperties.addControlParameter("$fire_url", controlParams.getString("$fire_url")); } if (controlParams.containsKey("$blackberry_url")) { Log.d(LCAT, "addControlParameter $blackberry_url"); linkProperties.addControlParameter( "$blackberry_url", controlParams.getString("$blackberry_url")); } if (controlParams.containsKey("$windows_phone_url")) { Log.d(LCAT, "addControlParameter $windows_phone_url"); linkProperties.addControlParameter( "$windows_phone_url", controlParams.getString("$windows_phone_url")); } final Activity activity = this.getActivity(); branchUniversalObject.generateShortUrl( activity, linkProperties, new GenerateShortUrlListener()); }