Skip to content

Commit

Permalink
Fixes link creation that broken in parent app. (#353)
Browse files Browse the repository at this point in the history
Change-Id: Ia762011943c616be42e6e0225275a276d965c465
  • Loading branch information
matthewrice345 authored Sep 15, 2016
1 parent 95ff6fe commit 9389231
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand All @@ -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;
}

Expand Down

0 comments on commit 9389231

Please sign in to comment.