Skip to content

Commit 01dded1

Browse files
committed
notify payment updates on main thread instead of caller thread
1 parent 260e259 commit 01dded1

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
# Changelog
22
All notable changes to this project will be documented in this file.
33

4+
## [0.16.9]
5+
6+
### Fixed
7+
- Notify payment updates on main thread instead of caller thread
8+
49
## [0.16.8]
510

611
### Added

core/src/main/java/io/snabble/sdk/payment/PaymentCredentialsStore.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
import android.content.Context;
66
import android.content.SharedPreferences;
77
import android.os.Build;
8+
import android.os.Handler;
9+
import android.os.Looper;
810

911
import com.google.gson.Gson;
1012

@@ -188,9 +190,15 @@ private void validate() {
188190
}
189191

190192
private void notifyChanged() {
191-
for (Callback cb : callbacks) {
192-
cb.onChanged();
193-
}
193+
Handler handler = new Handler(Looper.getMainLooper());
194+
handler.post(new Runnable() {
195+
@Override
196+
public void run() {
197+
for (Callback cb : callbacks) {
198+
cb.onChanged();
199+
}
200+
}
201+
});
194202
}
195203

196204
public void addCallback(Callback cb) {

0 commit comments

Comments
 (0)