Skip to content

Commit 0938012

Browse files
committed
Remove firebase dynamic links
1 parent e88d8b1 commit 0938012

1 file changed

Lines changed: 0 additions & 49 deletions

File tree

bot/src/main/java/ml/duncte123/skybot/utils/AirUtils.java

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
package ml.duncte123.skybot.utils;
2020

2121
import com.fasterxml.jackson.core.JsonProcessingException;
22-
import com.fasterxml.jackson.databind.ObjectMapper;
2322
import com.fasterxml.jackson.databind.json.JsonMapper;
2423
import com.fasterxml.jackson.databind.node.ObjectNode;
2524
import com.github.natanbc.reliqua.limiter.RateLimiter;
@@ -370,52 +369,4 @@ public static PendingRequest<String> shortenUrl(String url, Variables variables,
370369
return new FakePendingRequest<>("JSON PARSING FAILED: " + e.getMessage());
371370
}
372371
}
373-
374-
// TODO: find replacement for firebase
375-
@Deprecated
376-
public static PendingRequest<String> shortenUrl(String url, String googleKey, ObjectMapper mapper) {
377-
return shortenUrl(url, googleKey, mapper, "duncte.bot");
378-
}
379-
380-
@Deprecated
381-
@Nonnull
382-
public static PendingRequest<String> shortenUrl(String url, String googleKey, ObjectMapper mapper, String prefix) {
383-
final ObjectNode json = mapper.createObjectNode();
384-
385-
json.set("dynamicLinkInfo",
386-
mapper.createObjectNode()
387-
.put("domainUriPrefix", prefix)
388-
.put("link", url)
389-
);
390-
json.set("suffix",
391-
mapper.createObjectNode()
392-
.put("option", "SHORT") // SHORT or UNGUESSABLE
393-
);
394-
395-
try {
396-
return WebUtils.ins.postRequest(
397-
"https://firebasedynamiclinks.googleapis.com/v1/shortLinks?key=" + googleKey,
398-
JSONRequestBody.fromJackson(json)
399-
)
400-
.setRateLimiter(RateLimiter.directLimiter())
401-
.build(
402-
(r) -> {
403-
final ObjectNode response = toJSONObject(r, mapper);
404-
405-
if (response == null) {
406-
return "Google did a fucky wucky and send invalid json";
407-
}
408-
409-
return response.get("shortLink").asText();
410-
},
411-
WebParserUtils::handleError
412-
);
413-
}
414-
catch (JsonProcessingException e) {
415-
e.printStackTrace();
416-
417-
// Return a fake pending request to make sure that things don't break
418-
return new FakePendingRequest<>("JSON PARSING FAILED: " + e.getMessage());
419-
}
420-
}
421372
}

0 commit comments

Comments
 (0)