Skip to content

Commit

Permalink
Merge pull request #122 from xendit/fix/finish_not_correctly_called
Browse files Browse the repository at this point in the history
Fix: Potential race conditions when closing activities with pending operations
  • Loading branch information
ahmadAlfhajri authored Nov 20, 2024
2 parents 2ec0578 + 166d44c commit dea6a88
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 8 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# CHANGELOG

## 4.2.1 (2024-11-20)
- Enhance: Moved finish() call to Handler to ensure proper UI thread execution and prevent memory leaks
- Fix: Potential race conditions when closing activities with pending operations

## 4.2.0 (2024-08-06)
- Feat: Added card holder information in create token and create authentication

Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,24 +31,24 @@ Maven:
<dependency>
<groupId>com.xendit</groupId>
<artifactId>xendit-android</artifactId>
<version>4.2.0</version>
<version>4.2.1</version>
<type>pom</type>
</dependency>
```

Gradle:
```
compile 'com.xendit:xendit-android:4.2.0'
compile 'com.xendit:xendit-android:4.2.1'
```

Ivy:
```
<dependency org='com.xendit' name='xendit-android' rev='4.2.0'>
<dependency org='com.xendit' name='xendit-android' rev='4.2.1'>
<artifact name='xendit-android' ext='pom' ></artifact>
</dependency>
```

For more information, visit https://central.sonatype.com/artifact/com.xendit/xendit-android/4.2.0/versions
For more information, visit https://central.sonatype.com/artifact/com.xendit/xendit-android/4.2.1/versions

**Note**:

Expand Down
4 changes: 2 additions & 2 deletions xendit-android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apply plugin: 'maven-publish'
apply plugin: 'signing'

group 'com.xendit'
version '4.2.0'
version '4.2.1'

ext {
bintrayOrg = 'xendit'
Expand Down Expand Up @@ -37,7 +37,7 @@ android {
minSdkVersion 21
targetSdkVersion 34
versionCode 1
versionName '4.2.0'
versionName '4.2.1'
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
}
buildTypes {
Expand Down
12 changes: 10 additions & 2 deletions xendit-android/src/main/java/com/xendit/XenditActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import android.content.Intent;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import android.webkit.CookieManager;
import android.webkit.WebChromeClient;
Expand Down Expand Up @@ -94,8 +95,15 @@ private class WebViewJavaScriptInterface {

@android.webkit.JavascriptInterface
public void postMessage(String message) {
sendBroadcastReceiver(message);
finish();
Handler handler = new Handler();
handler.post(new Runnable() {
@Override
public void run() {
sendBroadcastReceiver(message);

finish();
}
});
}
}

Expand Down

0 comments on commit dea6a88

Please sign in to comment.