Skip to content

Commit b1a901a

Browse files
ravisasitilakJamesGeorg
authored andcommitted
added statusBarLight flag for android
1 parent 3175ee7 commit b1a901a

File tree

4 files changed

+24
-4
lines changed

4 files changed

+24
-4
lines changed

android/src/main/java/in/juspay/hypersdkreact/HyperSdkReactModule.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,8 @@ public void processWithActivity(String data) {
479479
}
480480

481481
Intent i = new Intent(activity, ProcessActivity.class);
482+
boolean statusBarLight = payload.optJSONObject("payload").optBoolean("statusBarLight", false);
483+
i.putExtra("statusBarLight", statusBarLight);
482484
ProcessActivity.setActivityCallback(new ActivityCallback() {
483485
@Override
484486
public void onCreated(@NonNull FragmentActivity fragmentActivity) {
@@ -542,6 +544,8 @@ public void openPaymentPage(String data) {
542544
}
543545

544546
Intent i = new Intent(activity, ProcessActivity.class);
547+
boolean statusBarLight = sdkPayload.optJSONObject("payload").optBoolean("statusBarLight", false);
548+
i.putExtra("statusBarLight", statusBarLight);
545549
ProcessActivity.setActivityCallback(new ActivityCallback() {
546550
@Override
547551
public void onCreated(@NonNull FragmentActivity processActivity) {

android/src/main/java/in/juspay/hypersdkreact/ProcessActivity.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,14 @@
88
package in.juspay.hypersdkreact;
99

1010
import android.os.Bundle;
11+
import android.view.View;
1112

1213
import androidx.annotation.Nullable;
1314
import androidx.appcompat.app.AppCompatActivity;
1415

16+
import org.json.JSONException;
17+
import org.json.JSONObject;
18+
1519
public class ProcessActivity extends AppCompatActivity {
1620

1721
@Nullable
@@ -25,7 +29,11 @@ static void setActivityCallback(@Nullable ActivityCallback activityCallback) {
2529
protected void onCreate(Bundle savedInstanceState) {
2630
super.onCreate(savedInstanceState);
2731
overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
28-
32+
boolean statusBarLight = getIntent().getBooleanExtra("statusBarLight", false);
33+
if (statusBarLight) {
34+
View decorView = getWindow().getDecorView();
35+
decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
36+
}
2937
if (activityCallback != null) {
3038
activityCallback.onCreated(this);
3139
}

example/src/ProcessScreen.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ class ProcessScreen extends React.Component {
8989
super(props, context);
9090
this.navigation = props.navigation;
9191
this.isPopupVisible = false;
92+
this.statusBarLight = false;
9293

9394
const params = props.route.params;
9495
this.merchantId = params.merchantId;
@@ -221,6 +222,7 @@ class ProcessScreen extends React.Component {
221222
JSON.stringify(orderDetailsNew),
222223
signNew,
223224
this.merchantKeyId
225+
this.statusBarLight
224226
);
225227
HyperSdkReact.process(JSON.stringify(payload));
226228
}}
@@ -835,6 +837,7 @@ class ProcessScreen extends React.Component {
835837
JSON.stringify(this.orderDetails),
836838
this.signature,
837839
this.merchantKeyId
840+
this.statusBarLight
838841
);
839842

840843
HyperSdkReact.process(JSON.stringify(payload));
@@ -850,6 +853,7 @@ class ProcessScreen extends React.Component {
850853
JSON.stringify(this.orderDetails),
851854
this.signature,
852855
this.merchantKeyId
856+
this.statusBarLight
853857
);
854858

855859
HyperSdkReact.processWithActivity(JSON.stringify(payload));
@@ -868,7 +872,8 @@ class ProcessScreen extends React.Component {
868872
this.merchantId,
869873
JSON.stringify(this.orderDetails),
870874
this.signature,
871-
this.merchantKeyId
875+
this.merchantKeyId,
876+
this.statusBarLight
872877
)
873878
),
874879
});

example/src/Utils.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,8 @@ const generateProcessPayloadPP = (
108108
merchantId: string,
109109
orderDetails: string,
110110
signature: string,
111-
merchantKeyId: string
111+
merchantKeyId: string,
112+
statusBarLight: boolean
112113
) => {
113114
return {
114115
requestId: uuidv4(),
@@ -120,6 +121,7 @@ const generateProcessPayloadPP = (
120121
orderDetails,
121122
signature,
122123
merchantKeyId,
124+
statusBarLight,
123125
},
124126
};
125127
};
@@ -445,7 +447,8 @@ type HyperUtils = {
445447
merchantId: string,
446448
orderDetails: string,
447449
signature: string,
448-
merchantKeyId: string
450+
merchantKeyId: string,
451+
statusBarLight: boolean
449452
): {};
450453
generatePreFetchPayload(clientId: string, service: string): {};
451454
generateOrderId(): string;

0 commit comments

Comments
 (0)