Skip to content

Commit

Permalink
Issue #SB-5513 feat : Updated deeplink for content player.
Browse files Browse the repository at this point in the history
  • Loading branch information
swayangjit committed Aug 1, 2018
1 parent 650e983 commit 491a4bd
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />

<data android:host="content-details" android:scheme="sunbird" />
<data android:host="c" android:scheme="@string/deeplink_base_url" />

</intent-filter>

Expand Down
2 changes: 1 addition & 1 deletion src/android/org/sunbird/deeplinks/DeepLinkNavigation.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public void validateAndHandleDeepLink(Intent intent, IValidateDeepLink iValidate

public void validateAndHandleDeepLink(Uri intentData, IValidateDeepLink iValidateDeepLink) {
if (intentData != null) {
if (DeepLinkUtility.isDeepLink(intentData)) { // If deeplink clicked from content's last page.
if (DeepLinkUtility.isDeepLink(mActivity,intentData)) { // If deeplink clicked from content's last page.
if (iValidateDeepLink != null) {
iValidateDeepLink.validLocalDeepLink();
}
Expand Down
15 changes: 13 additions & 2 deletions src/android/org/sunbird/deeplinks/DeepLinkUtility.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package org.sunbird.deeplinks;

import android.content.Context;
import android.net.Uri;

public class DeepLinkUtility {

public static boolean isDeepLink(Uri intentData){
if (intentData.getScheme().equalsIgnoreCase("ekstep") || intentData.getScheme().equalsIgnoreCase("sunbird")) {
public static boolean isDeepLink(Context context, Uri intentData) {
if (intentData.getScheme().equalsIgnoreCase(getStringResourceByName(context, "deeplink_base_url"))) {
return true;
}

Expand Down Expand Up @@ -35,4 +36,14 @@ public static boolean isDeepLinkHttps(Uri intentData) {

return false;
}

private static String getStringResourceByName(Context context, String string) {
if (context == null) {
return null;
} else {
String packageName = context.getPackageName();
int resId = context.getResources().getIdentifier(string, "string", packageName);
return context.getString(resId);
}
}
}

0 comments on commit 491a4bd

Please sign in to comment.