From 93892310d22777ae697eae2594852f953a73d0c4 Mon Sep 17 00:00:00 2001 From: Matthew Rice Date: Thu, 15 Sep 2016 11:05:20 -0600 Subject: [PATCH] Fixes link creation that broken in parent app. (#353) Change-Id: Ia762011943c616be42e6e0225275a276d965c465 --- .../instructure/canvasapi/utilities/APIHelpers.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/instructure/canvasapi/utilities/APIHelpers.java b/src/main/java/com/instructure/canvasapi/utilities/APIHelpers.java index 771d7a0..bf2335c 100644 --- a/src/main/java/com/instructure/canvasapi/utilities/APIHelpers.java +++ b/src/main/java/com/instructure/canvasapi/utilities/APIHelpers.java @@ -4,6 +4,7 @@ import android.content.SharedPreferences; import android.text.TextUtils; import android.util.Log; +import android.webkit.URLUtil; import com.google.gson.Gson; import com.instructure.canvasapi.api.AlertAPI; @@ -280,9 +281,7 @@ public static boolean setUserAgent(Context context, String userAgent) { /** * getFullDomain returns the protocol plus the domain. - * - * Returns "" if context is null or if the domain/token isn't set. - * @return + * @return "" if context is null or if the domain/token isn't set. */ public static String getFullDomain(Context context){ String protocol = loadProtocol(context); @@ -292,6 +291,11 @@ public static String getFullDomain(Context context){ return ""; } + if(URLUtil.isHttpsUrl(domain) || URLUtil.isHttpUrl(domain)) { + //already begins with https or http + return domain; + } + return protocol + "://" + domain; }