Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1330,6 +1330,16 @@ public void getAndTrackDeepLink(@NonNull String uri, @NonNull IterableHelper.Ite
IterableDeeplinkManager.getAndTrackDeeplink(uri, onCallback);
}

/**
* Checks if a URL is an Iterable deep link (rewritten by Iterable)
*
* @param url The URL string to check
* @return true if the URL matches the Iterable deep link pattern
*/
public static boolean isIterableDeeplink(@Nullable String url) {
return IterableDeeplinkManager.isIterableDeeplink(url);
}

/**
* Handles an App Link
* For Iterable links, it will track the click and retrieve the original URL, pass it to
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package com.iterable.iterableapi;

import com.iterable.iterableapi.unit.TestRunner;

import org.junit.Test;
import org.junit.runner.RunWith;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

@RunWith(TestRunner.class)
public class IterableApiDeeplinkUnitTest {

@Test
public void testIsIterableDeeplinkReturnsTrueForValidDeeplink() {
assertTrue(IterableApi.isIterableDeeplink("https://links.iterable.com/a/abc123"));
}

@Test
public void testIsIterableDeeplinkReturnsFalseForNonRewriteLink() {
assertFalse(IterableApi.isIterableDeeplink("https://links.iterable.com/u/60402396fbd5433eb35397b47ab2fb83"));
}

@Test
public void testIsIterableDeeplinkReturnsFalseForNonIterableLink() {
assertFalse(IterableApi.isIterableDeeplink("https://example.com/some/path"));
}

@Test
public void testIsIterableDeeplinkReturnsFalseForNull() {
assertFalse(IterableApi.isIterableDeeplink(null));
}

@Test
public void testIsIterableDeeplinkReturnsFalseForEmptyString() {
assertFalse(IterableApi.isIterableDeeplink(""));
}
}
Loading