Skip to content

Commit

Permalink
Remove registerSource
Browse files Browse the repository at this point in the history
  • Loading branch information
nsingh-branch committed May 8, 2024
1 parent 21d7c92 commit d35cf60
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,43 +44,6 @@ object AttributionReportingManager {

fun isMeasurementApiEnabled(): Boolean = isMeasurementApiEnabled

fun registerSource(context: Context) {
val scope = CoroutineScope(Dispatchers.IO + Job())

scope.launch {
try {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
if (SdkExtensions.getExtensionVersion(SdkExtensions.AD_SERVICES) >= MIN_AD_SERVICES_VERSION) {
if (isMeasurementApiEnabled()) {
val latdParams = getLATDParams(context)
val manager = MeasurementManager.get(context)
val executor = Executors.newSingleThreadExecutor()
val params = getParams(context) + "&" + latdParams
val branchBaseURL = PrefHelper.getInstance(context).apiBaseUrl
val sourceUri = Uri.parse("${branchBaseURL}${Defines.RequestPath.RegisterSource}?$params")

manager.registerSource(sourceUri, null, executor, object : OutcomeReceiver<Any?, Exception> {
override fun onResult(result: Any?) {
BranchLogger.v("Source registered successfully with URI: $sourceUri")
executor.shutdown()
}

override fun onError(e: Exception) {
BranchLogger.w("Error while registering source: ${e.message}")
executor.shutdown()
}
})
}
}
}
} catch (e: Exception) {
BranchLogger.w("Error while registering source: ${e.message}")
} finally {
scope.cancel()
}
}
}

fun registerTrigger(context: Context, eventName: String) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
if (SdkExtensions.getExtensionVersion(SdkExtensions.AD_SERVICES) >= MIN_AD_SERVICES_VERSION) {
Expand Down
1 change: 0 additions & 1 deletion Branch-SDK/src/main/java/io/branch/referral/Defines.java
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,6 @@ public enum RequestPath {
TrackCustomEvent("v2/event/custom"),
GetLATD("v1/cpid/latd"),
QRCode("v1/qr-code"),
RegisterSource("v1/android-attribution-api/source"),
RegisterTrigger("v1/android-attribution-api/trigger");

private final String key;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,6 @@ public void onRequestSucceeded(ServerResponse resp, Branch branch) {

prefHelper_.setAppVersion(DeviceInfo.getInstance().getAppVersion());

AttributionReportingManager attributionManager = AttributionReportingManager.INSTANCE;
if (attributionManager.isMeasurementApiEnabled()) {
attributionManager.registerSource(branch.getApplicationContext());
}

} catch (Exception ex) {
BranchLogger.w("Caught Exception " + ex.getMessage());
}
Expand Down

0 comments on commit d35cf60

Please sign in to comment.