Skip to content

Commit

Permalink
antora docs setup step #2
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinfs510 committed Mar 12, 2020
2 parents 4201754 + 5c11143 commit e8d180e
Show file tree
Hide file tree
Showing 49 changed files with 2,518 additions and 79 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# OST Wallet SDK Changelog

## Version 2.4.1
* User can authorize external session by scanning QR-Code. To use `Authorize session by scanning QR code`, please update downstream sdk.<br/>
iOS: v2.4.1<br/>
Android: v2.4.1
* User can pass QR-Code payload to perform QR-Code actions without opening Scanner in OstWalletUI.
This functionality is available for `scanQRCodeToAuthorizeSession`, `scanQRCodeToExecuteTransaction`, `scanQRCodeToAuthorizeDevice`,

## Version 2.4.0
* OstRedemption UI component is now available in SDK. To use `OstRedemption`, please update downstream sdk.<br/>
iOS:`v2.4.0`<br/>
Android:`v2.4.0`
* `getRedeemableSkus` and `getRedeemableSkuDetails` apis added in `OstJsonApi`.


## Version 2.3.14
* ReadMe updates<br/>
* Removed unused imports<br/>
Expand Down
17 changes: 16 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ Ost React Native Wallet SDK...
- [Implementation](#implementation-1)
+ [Wallet Settings UI Component](#wallet-settings-ui-component)
- [Implementation](#implementation-2)
+ [Redemption flow UI Component](#redemption-flow-ui-component)
- [Implementation](#implementation-3)
+ [OstTransactionHelper - Transaction and Session Integrated Workflow](#osttransactionhelper---transaction-and-session-integrated-workflow)
- [Implementation](#implementation-3)
* [Intermediate Usage - Ost Wallet SDK UI](#intermediate-usage---ost-wallet-sdk-ui)
Expand Down Expand Up @@ -240,6 +242,8 @@ Activate User workflow deploys user's wallet on the blockchain and whitelists th
#### Implementation
Please refer to [Activate User UI Workflow Documentation](./documentation/OstWalletUI.md#activate-user) for implementation details.

<a id="wallet-settings-ui-component" />

### 3. Wallet Settings UI Component
---
OstWallet Settings is a pre-built UI component available exclusively available in `ost-wallet-sdk-react-native` SDK.
Expand All @@ -249,7 +253,18 @@ It is a wallet settings page that can be used by end-users to perfrom 12 differe
#### Implementation
Please refer to [OstWallet Settings Documentation](./documentation/OstWalletSettings.md) for implementation details.

### 4. OstvTransaction Helper - Transaction and Add Session Integrated Workflow
<a id="redemption-flow-ui-component" />

### 4. Redemption Flow UI Component
---
OstRedemption component is a pre-built UI component available exclusively in `ost-wallet-sdk-react-native` SDK.
It consist two pages - one displaying redeemable product list and another displaying product details and redemption options. It can be used by end-users to integrate redemption flow into their app.
> <b>IMPORTANT:</b> This feature requires application to use [React Navigation](https://reactnavigation.org/docs/en/getting-started.html) package.
#### Implementation
Please reder to [OstRedemption flow Documentation](./documentation/OstRedemptionFlow.md) for implementation details.

### 5. OstTransaction Helper - Transaction and Add Session Integrated Workflow
---
`OstTransactionHelper` is a transaction helper provided by the SDK that creates session keys before performing a transaction if needed. App developers can configure the session creation parameters (session buckets) as per application's need.

Expand Down
3 changes: 1 addition & 2 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ allprojects {
}

apply plugin: 'com.android.library'

android {
compileSdkVersion 28
buildToolsVersion '28.0.3'
Expand All @@ -45,5 +44,5 @@ repositories {

dependencies {
implementation 'com.facebook.react:react-native:+'
api 'com.ost:ost-wallet-sdk-android:2.3.8'
api 'com.ost:ost-wallet-sdk-android:2.4.1'
}
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,46 @@ public void getCurrentDeviceForUserId(
}
}

@ReactMethod
public void getRedeemableSkus(
String userId,
ReadableMap requestMap,
Callback successCallback,
Callback errorCallback
) {
try {
Map<String,Object> requestPayload = new HashMap<>();
if (null != requestMap) {
requestPayload = requestMap.toHashMap();
}
OstJsonApi.getRedeemableSkus(userId ,requestPayload, new OstJsonApiCallbackImpl(successCallback, errorCallback));
} catch (Throwable e) {
errorCallback.invoke(Utils.getError(e, "rn_orsjam_grs_1"));
return;
}
}


@ReactMethod
public void getRedeemableSkuDetails(
String userId,
String skuId,
ReadableMap requestMap,
Callback successCallback,
Callback errorCallback
) {
try {
Map<String,Object> requestPayload = new HashMap<>();
if (null != requestMap) {
requestPayload = requestMap.toHashMap();
}
OstJsonApi.getRedeemableSkuDetails(userId , skuId ,requestPayload, new OstJsonApiCallbackImpl(successCallback, errorCallback));
} catch (Throwable e) {
errorCallback.invoke(Utils.getError(e, "rn_orsjam_grsd_1"));
return;
}
}


private static class OstJsonApiCallbackImpl implements OstJsonApiCallback {

Expand Down
4 changes: 4 additions & 0 deletions android/src/main/java/com/ostwalletrnsdk/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ public static WritableMap convertJsonToMap(JSONObject jsonObject) throws JSONExc
map.putDouble(key, (Double) value);
} else if (value instanceof String) {
map.putString(key, (String) value);
} else if (null == value || "null".equalsIgnoreCase(value.toString())){
map.putNull(key);
} else {
map.putString(key, value.toString());
}
Expand All @@ -119,6 +121,8 @@ public static WritableArray convertJsonToArray(JSONArray jsonArray) throws JSONE
array.pushDouble((Double) value);
} else if (value instanceof String) {
array.pushString((String) value);
} else if (null == value || "null".equalsIgnoreCase(value.toString())) {
array.pushNull();
} else {
array.pushString(value.toString());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,20 +165,31 @@ public void getAddDeviceQRCode(String userId, String uuid) {
}

@ReactMethod
public void scanQRCodeToAuthorizeDevice(String userId, String uuid) {
public void scanQRCodeToAuthorizeDevice(String userId, String qrPayload, String uuid) {
Activity currentActivity = getCurrentActivity();
OstUICallbackImpl ostUICallback = new OstUICallbackImpl( uuid, this.reactContext,
new OstWorkflowContext(OstWorkflowContext.WORKFLOW_TYPE.AUTHORIZE_DEVICE_WITH_QR_CODE));
String workflowId = OstWalletUI.scanQRCodeToAuthorizeDevice(currentActivity, userId, ostUICallback);
String workflowId = OstWalletUI.scanQRCodeToAuthorizeDevice(currentActivity, qrPayload, userId, ostUICallback);
SdkInteract.getInstance().subscribe(workflowId, ostUICallback);
}


@ReactMethod
public void scanQRCodeToAuthorizeSession(String userId, String qrPayload, String uuid) {
Activity currentActivity = getCurrentActivity();
OstUICallbackImpl ostUICallback = new OstUICallbackImpl( uuid, this.reactContext,
new OstWorkflowContext(OstWorkflowContext.WORKFLOW_TYPE.AUTHORIZE_DEVICE_WITH_QR_CODE));
String workflowId = OstWalletUI.scanQRCodeToAuthorizeSession(currentActivity, qrPayload, userId, ostUICallback);
SdkInteract.getInstance().subscribe(workflowId, ostUICallback);
}


@ReactMethod
public void scanQRCodeToExecuteTransaction(String userId, String uuid) {
public void scanQRCodeToExecuteTransaction(String userId, String qrPayload, String uuid) {
Activity currentActivity = getCurrentActivity();
OstUICallbackImpl ostUICallback = new OstUICallbackImpl( uuid, this.reactContext,
new OstWorkflowContext(OstWorkflowContext.WORKFLOW_TYPE.EXECUTE_TRANSACTION));
String workflowId = OstWalletUI.scanQRCodeToExecuteTransaction(currentActivity, userId, ostUICallback);
String workflowId = OstWalletUI.scanQRCodeToExecuteTransaction(currentActivity, qrPayload, userId, ostUICallback);
SdkInteract.getInstance().subscribe(workflowId, ostUICallback);
}

Expand Down
Binary file added assets/down-arrow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/msg-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit e8d180e

Please sign in to comment.