@@ -1465,6 +1465,56 @@ public interface BranchLinkCreateListener {
14651465 void onLinkCreate (String url , BranchError error );
14661466 }
14671467
1468+ /**
1469+ * Interface for handling last attributed touch data callbacks.
1470+ *
1471+ * @see JSONObject
1472+ * @see BranchError
1473+ */
1474+ public interface BranchLastAttributedTouchDataListener {
1475+ /**
1476+ * Called when last attributed touch data is successfully retrieved.
1477+ *
1478+ * @param jsonObject The last attributed touch data as a JSONObject
1479+ * @param error null if successful, otherwise contains error information
1480+ */
1481+ void onDataFetched (JSONObject jsonObject , BranchError error );
1482+ }
1483+
1484+ /**
1485+ * Interface for handling native link share callbacks.
1486+ *
1487+ * @see String
1488+ * @see BranchError
1489+ */
1490+ public interface BranchNativeLinkShareListener {
1491+ /**
1492+ * Called when a link is shared successfully.
1493+ *
1494+ * @param sharedLink The shared link URL
1495+ * @param sharedBy The channel through which the link was shared
1496+ * @param error null if successful, otherwise contains error information
1497+ */
1498+ void onLinkShareResponse (String sharedLink , String sharedBy , BranchError error );
1499+
1500+ /**
1501+ * Called when a channel is selected for sharing.
1502+ *
1503+ * @param selectedChannel The name of the selected channel
1504+ */
1505+ void onChannelSelected (String selectedChannel );
1506+
1507+ /**
1508+ * Called when the share link dialog is launched.
1509+ */
1510+ void onShareLinkDialogLaunched ();
1511+
1512+ /**
1513+ * Called when the share link dialog is dismissed.
1514+ */
1515+ void onShareLinkDialogDismissed ();
1516+ }
1517+
14681518 /**
14691519 * <p>An Interface class that is implemented by all classes that make use of
14701520
@@ -2307,4 +2357,97 @@ private void launchExternalBrowser(String url) {
23072357 BranchLogger .e ("launchExternalBrowser caught exception: " + ex );
23082358 }
23092359 }
2360+
2361+ /**
2362+ * Sets the referrer GCLID valid for window.
2363+ *
2364+ * Minimum of 0 milliseconds
2365+ * Maximum of 3 years
2366+ * @param window A {@link Long} value specifying the number of milliseconds to wait before
2367+ * deleting the locally persisted GCLID value.
2368+ */
2369+ public void setReferrerGclidValidForWindow (long window ){
2370+ if (prefHelper_ != null ){
2371+ prefHelper_ .setReferrerGclidValidForWindow (window );
2372+ }
2373+ }
2374+
2375+ /**
2376+ * Enables referring url attribution for preinstalled apps.
2377+ *
2378+ * By default, Branch prioritizes preinstall attribution on preinstalled apps.
2379+ * Some clients prefer the referring link, when present, to be prioritized over preinstall attribution.
2380+ */
2381+ public static void setReferringLinkAttributionForPreinstalledAppsEnabled () {
2382+ referringLinkAttributionForPreinstalledAppsEnabled = true ;
2383+ }
2384+
2385+ /**
2386+ * Returns whether referring link attribution for preinstalled apps is enabled.
2387+ *
2388+ * @return {@link Boolean} true if referring link attribution for preinstalled apps is enabled, false otherwise.
2389+ */
2390+ public static boolean isReferringLinkAttributionForPreinstalledAppsEnabled () {
2391+ return referringLinkAttributionForPreinstalledAppsEnabled ;
2392+ }
2393+
2394+ /**
2395+ * Sets whether user agent synchronization is enabled.
2396+ *
2397+ * @param sync {@link Boolean} true to enable user agent synchronization, false to disable.
2398+ */
2399+ public static void setIsUserAgentSync (boolean sync ){
2400+ userAgentSync = sync ;
2401+ }
2402+
2403+ /**
2404+ * Returns whether user agent synchronization is enabled.
2405+ *
2406+ * @return {@link Boolean} true if user agent synchronization is enabled, false otherwise.
2407+ */
2408+ public static boolean getIsUserAgentSync (){
2409+ return userAgentSync ;
2410+ }
2411+
2412+ /**
2413+ * Gets the available last attributed touch data. The attribution window is set to the value last
2414+ * saved via PreferenceHelper.setLATDAttributionWindow(). If no value has been saved, Branch
2415+ * defaults to a 30 day attribution window (SDK sends -1 to request the default from the server).
2416+ *
2417+ * @param callback An instance of {@link io.branch.referral.ServerRequestGetLATD.BranchLastAttributedTouchDataListener}
2418+ * to callback with last attributed touch data
2419+ *
2420+ */
2421+ public void getLastAttributedTouchData (@ NonNull BranchLastAttributedTouchDataListener callback ) {
2422+ if (context_ != null ) {
2423+ requestQueue_ .handleNewRequest (new ServerRequestGetLATD (context_ , Defines .RequestPath .GetLATD , callback ));
2424+ }
2425+ }
2426+
2427+ /**
2428+ * Gets the available last attributed touch data with a custom set attribution window.
2429+ *
2430+ * @param callback An instance of {@link io.branch.referral.ServerRequestGetLATD.BranchLastAttributedTouchDataListener}
2431+ * to callback with last attributed touch data
2432+ * @param attributionWindow An {@link int} to bound the the window of time in days during which
2433+ * the attribution data is considered valid. Note that, server side, the
2434+ * maximum value is 90.
2435+ *
2436+ */
2437+ public void getLastAttributedTouchData (BranchLastAttributedTouchDataListener callback , int attributionWindow ) {
2438+ if (context_ != null ) {
2439+ requestQueue_ .handleNewRequest (new ServerRequestGetLATD (context_ , Defines .RequestPath .GetLATD , callback , attributionWindow ));
2440+ }
2441+ }
2442+
2443+ /**
2444+ * Gets the link share listener callback.
2445+ *
2446+ * @return {@link Branch.BranchNativeLinkShareListener} the current link share listener callback, or null if not set.
2447+ */
2448+ public Branch .BranchNativeLinkShareListener getLinkShareListenerCallback () {
2449+ // This method was removed during modernization but is kept for backward compatibility
2450+ // The actual link sharing functionality has been moved to NativeShareLinkManager
2451+ return null ;
2452+ }
23102453}
0 commit comments