Skip to content

Commit

Permalink
Merge pull request #151 from ostdotcom/develop
Browse files Browse the repository at this point in the history
Preparing for Release 2.3.6
  • Loading branch information
Rachin Kapoor authored Nov 25, 2019
2 parents a04ade1 + 5c8534a commit 157274e
Show file tree
Hide file tree
Showing 104 changed files with 1,470 additions and 134 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# OST Wallet SDK Changelog

## Version 2.3.6
### Changes:
* Added support for custom loader for OstWalletSDK UI workflows.
* OstWalletSDK now uses custom annotations to provide AndroidX compatibility.
### Bug Fix:
* Rectified OST_PLATFORM_ERROR error message.

## Version 2.3.5
### Security Enhancements:
* Use of FLAG_SECURE flag to protect show mnemonices view against screen recording and screen shotting.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ compileOptions {

```
dependencies {
implementation 'com.ost:ost-wallet-sdk-android:2.3.5'
implementation 'com.ost:ost-wallet-sdk-android:2.3.6'
...
...
...
Expand Down
50 changes: 50 additions & 0 deletions Samples/customloader/OstCustomLoader.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Custom Loader Useage

## Setup
1. Application project should have `ost-wallet-sdk-android` dependency.
2. Copy `customloader` directory in Application project `src` directory.
3. Define `customloader` resources and assets directory in application build.gradle.
```
android {
sourceSets {
main.java.srcDirs += 'src/customloader/src'
main.assets.srcDirs += 'src/customloader/assets'
main.res.srcDirs += 'src/customloader/res'
}
}
```
4. Add resource import statements in `GIFView.java` and `OstMockLoaderFragment.java`
```
import <Your application pacakge name>.R
```

4. Set LoaderManager of Custom loader in your application onCreate method
```java
public class App extends Application {
@Override
public void onCreate() {
super.onCreate();
/* Add below line in you application onCreate */
OstWalletUI.setLoaderManager(customloader.src.OstMockLoaderManager.getInstance());
}
}
```

After performing above steps, you are good to go with custom loader.

## Customize Loader

You can customize icons and text for custom loader as per application need.

### 1. Loader gif:
To modfiy loader, Add your `.gif` file and rename as `ost_progress_image.gif`. After that, replace it with `src/customloader/res/drawable/ost_progress_image.gif`<br/>

### 2. Success and Failure Icon:
To modify Icons, open `src/customloader/res/drawable/` and replace `ost_success_icon.png` and `ost_failure_icon` with your application icons.

### 3. Modify success message:
Developer can modify success message by modifying `SUCCESS_MESSAGE` value in `src/customloader/assets/OstSdkMessages.json` file

### 4. Modify loader text:
To modify loader text, update language for key `text` under `initial_loader`, `loader` and `acknowledge` in ost_content_config.json <br/>
ost_content_config is a file, which you set for `setContentConfig` function.
105 changes: 105 additions & 0 deletions Samples/customloader/assets/OstSdkMessages.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
{
"ACTIVATE_USER": {
"SUCCESS_MESSAGE": "User activated"
},
"ADD_SESSION": {
"SUCCESS_MESSAGE": "Session added"
},
"GET_DEVICE_MNEMONICS": {
},
"PERFORM_QR_ACTION": {
"SUCCESS_MESSAGE": "Workflow completed!"
},
"AUTHORIZE_DEVICE_WITH_QR_CODE": {
"SUCCESS_MESSAGE": "Device authorized"
},
"AUTHORIZE_DEVICE_WITH_MNEMONICS": {
"SUCCESS_MESSAGE": "Device authorized"
},
"INITIATE_DEVICE_RECOVERY": {
"SUCCESS_MESSAGE": "Recovery initiated"
},
"ABORT_DEVICE_RECOVERY": {
"SUCCESS_MESSAGE": "Aborted recovery"
},
"RESET_PIN": {
"SUCCESS_MESSAGE": "PIN has been successfully reset"
},
"LOGOUT_ALL_SESSIONS": {
"SUCCESS_MESSAGE": "User Activated Successfully"
},
"UPDATE_BIOMETRIC_PREFERENCE": {
"SUCCESS_MESSAGE": "Biometric updated"
},
"EXECUTE_TRANSACTION": {
"SUCCESS_MESSAGE": "Tranasction executed"
},
"__DEFAULT_CONTEXT": {
"USER_UNAUTHORIZED": "Device is not authorized. Please authorize device again.",
"DEVICE_OUT_OF_SYNC": "Device time is out of sync. Please check the time on your device reflects current date and time.",
"NETWORK_ERROR": "Request could not be executed due to cancellation, a connectivity problem or timeout.",
"INVALID_MNEMONICS": "The 12 word passphrase you provided is incorrect. ",
"INVALID_QR_TRANSACTION_DATA": "The QR code for executing a transaction is not well formed. To know the data definition for QR code based on type of operations please visit https://dev.ost.com/platform ",
"INVALID_USER_PASSPHRASE": "The 6 digit PIN you entered is not correct.",
"MAX_PASSPHRASE_VERIFICATION_LIMIT_REACHED": "The maximum number of 'authenticating with PIN' attempts has been reached. Please try again a bit later.",
"DEVICE_CAN_NOT_BE_AUTHORIZED": "Unable to authorize this device. Please ensure the device is 'Registered' for this user with OST platform. Only a registered device can be authorized.",
"SESSION_NOT_FOUND": "The device doesn't has any active session. Please authorize a session before doing any transaction. Workflow details provided at https://dev.ost.com/platform/docs/sdk/references ",
"INVALID_QR_CODE": "Incorrect QR code.",
"RECOVERY_KEY_GENERATION_FAILED": "Failed to generate Recovery key. Inspect if a correct input values required are being sent and re-submit the request. ",
"OUT_OF_MEMORY_ERROR": "Device is running low on memory. Reduce the number of App running on your device and re-enter the pin",
"WORKFLOW_FAILED": "Something went wrong, please try again",
"WORKFLOW_VIEW_DESTROYED": "The application interrupted the workflow. The view got terminated while performing the workflow",
"DEVICE_UNAUTHORIZED": "Unable to perform the operation as the device not authorized. For details on how to authorize a device please visit https://dev.ost.com/platform/docs/sdk/references ",
"DEVICE_CAN_NOT_BE_REVOKED": "Cannot complete the revoke device operation. Only an authorized device can be revoked. Please ensure you are trying to revoke a valid device and re-submit the request.",
"WORKFLOW_CANCELED": "WORKFLOW_CANCELLED",
"WORKFLOW_CANCELLED": "WORKFLOW_CANCELLED"
},
"__DEVELOPER_ERROR_MSG": {
"SDK_ERROR": "An internal SDK error has occurred.",
"INVALID_CERTIFICATE": "Certificate provided by Ost platform is invalid Or it has been compromised. Please re-try in some other network and if the problem persists contact support@ost.com .",
"INVALID_USER_ID": "Unable to recognize the user id. Please inspect for what is being sent, rectify and re-submit.",
"INVALID_API_END_POINT": "Invalid OST server url",
"INVALID_NETWORK_SECURITY_CONFIG": "Invalid network_security_config file",
"INVALID_WORKFLOW_CALLBACK": "Callback is essential for a workflow to continue running, it cannot be null.",
"API_RESPONSE_ERROR": "OST Platform Api ed error.",
"CONFIG_READ_FAILED": "Failed to read config file. Please place the ost-sdk config file in main/assets folder.",
"INVALID_BLOCK_GENERATION_TIME": "Invalid configuration 'BLOCK_GENERATION_TIME'. It must be an Integer greater than zero",
"INVALID_PIN_MAX_RETRY_COUNT": "Invalid configuration 'PIN_MAX_RETRY_COUNT'. It must be an Integer greater than zero",
"INVALID_SESSION_BUFFER_TIME": "Invalid configuration 'SESSION_BUFFER_TIME'. It must be long greater than or equal to zero",
"INVALID_PRICE_POINT_CURRENCY_SYMBOL": "Unable to recognize 'PRICE_POINT_CURRENCY_SYMBOL'. For details on how supported currencies please vist https://dev.ost.com/platform/docs/api ",
"INVALID_REQUEST_TIMEOUT_DURATION": "Invalid configuration 'REQUEST_TIMEOUT_DURATION'. It must be Integer greater than zero.",
"INVALID_NO_OF_SESSIONS_ON_ACTIVATE_USER": "Invalid configuration 'NO_OF_SESSIONS_ON_ACTIVATE_USER'. It must be an Integer greater than zero and less than 6",
"INVALID_API_RESPONSE": "Unable to recognize the API response object sent and so cannot be executed.",
"INVALID_JSON_STRING": "The provided json string is invalid.",
"INVALID_JSON_ARRAY": "The provided json array string is invalid.",
"INVALID_REVOKE_DEVICE_ADDRESS": "Unable to recognise revoke device address. Please ensure you are sending a null value and re-submit the request.",
"NO_PENDING_RECOVERY": "Could not find any pending device recovery request. For details on how to check the status of the recovery please vist https://dev.ost.com/platform/docs/sdk ",
"EIP712_FAILED": "Unable to sign parameters using EIP 712 and verify the signature.",
"RULES_NOT_FOUND": "Unable to recognize the Rule. Please inspect a valid rule name that exists in your economy is passed and its not null.",
"DEVICE_NOT_SETUP": "Unable to recognize the device. Please setup this device for the user using workflow provided at https://dev.ost.com/platform/docs/sdk/references",
"DEVICE_NOT_REGISTERED": "Device is not registered. To make any api to OST server device need to be registered",
"POLLING_TIMEOUT": "Polling timeout. This can be intermittent event with a request failing followed by successful one.",
"INVALID_TOKEN_ID": "The token id sent in Transaction QR code is not matching with the current user's token id. Rectify the value is being sent in token Id field and re-submit the request.",
"INVALID_RECOVER_DEVICE_ADDRESS": "Invalid device address. This address can not be recovered.",
"INVALID_SESSION_EXPIRY_TIME": "The expiry time provided is invalid",
"INVALID_SESSION_SPENDING_LIMIT": "The spending limit provided is invalid should be more than 0",
"RECOVERY_OWNER_ADDRESS_NOT_FOUND": "Recovery owner is not set for this user. This address is set during user activation. Please verify the user has been successfully activated.",
"INSUFFICIENT_DATA": "The device does not have sufficient data to perform this action.",
"INVALID_SESSION_ADDRESS": "Unable to recognize the session address. Inspect if a correct value is being sent and its not null. ",
"FAILED_TO_SIGN_DATA": "Unable to sign data. Visit https://dev.ost.com/platform/docs/sdk for detailed SDK references. Please ensure the input is well formed and re-submit the request.",
"INVALID_DEVICE_ADDRESS": "Incorrect device address. Please inspect the value being sent is correct and not null, rectify and re-submit.",
"GENERATE_PRIVATE_KEY_FAIL": "This is a generic error that occurs when sdk fails to generate any one of Api Key, Device Key or Session Key. This can be intermittent issue, please re-start the workflow. If Problem persists contact support@ost.com .",
"INVALID_PASSPHRASE_PREFIX": "Unable to recognize the Passphrase prefix. Please ensure Passphrase prefix is not null or it's string length is not less than 30. ",
"USER_NOT_ACTIVATED": "The user is not activated yet. Please setup user's wallet to enable their participation in your economy. ",
"USER_ALREADY_ACTIVATED": "The User is already activated",
"USER_ACTIVATING": "User activation flow is already in progress. Please check the status a bit later",
"WORKFLOW_CANCELLED": "Workflow got cancelled, possibly because one or more input parameters require a different type of information.",
"INVALID_NEW_USER_PASSPHRASE": "The new 6 digit PIN you entered is not correct.",
"INVALID_ADDRESS_TO_TRANSFER": "INVALID_ADDRESS_TO_TRANSFER",
"INVALID_AMOUNT": "INVALID_AMOUNT",
"INVALID_WORKFLOW": "INVALID_WORKFLOW",
"INVALID_RECOVERY_ADDRESS": "INVALID_RECOVERY_ADDRESS",
"USER_PASSPHRASE_VALIDATION_LOCKED": "Can not validate user passphrase because of too many wrong attempts.",
"UNKNOWN": "Unknown error"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
53 changes: 53 additions & 0 deletions Samples/customloader/res/layout/mock_loader_fragment.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/transparent"
android:orientation="vertical">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginStart="70dp"
android:layout_marginEnd="70dp"
android:layout_centerInParent="true">

<ImageView
android:id="@+id/statusImageView"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_gravity="center_horizontal"
android:background="@drawable/ost_success_icon" />

<customloader.src.GIFView
android:id="@+id/progressGif"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" />

<TextView
android:id="@+id/loaderText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="25dp"
android:textColor="@android:color/white"
android:textAlignment="center"
android:textStyle="bold"
android:textSize="18sp"
android:text="Loading..."/>

<Button
android:id="@+id/statusButton"
android:layout_marginTop="25dp"
android:layout_gravity="center_horizontal"
android:text="Success"
android:textSize="18sp"
android:textAlignment="center"
android:background="@android:color/holo_red_light"
android:layout_width="match_parent"
android:layout_height="wrap_content" />

</LinearLayout>
</RelativeLayout>
13 changes: 13 additions & 0 deletions Samples/customloader/res/values/colors.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?><!--
~ Copyright 2019 OST.com Inc
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
-->

<resources>
<color name="trans_gray">#33000000</color>
</resources>
25 changes: 25 additions & 0 deletions Samples/customloader/res/values/styles.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!--
~ Copyright 2019 OST.com Inc
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
-->

<resources>
<style name="OstFullScreenDialogStyle" parent="Theme.AppCompat.Dialog">
<item name="android:windowNoTitle">true</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorPrimary">@color/colorPrimary</item>

<!-- Set this to true if you want Full Screen without status bar -->
<item name="android:windowFullscreen">false</item>

<item name="android:windowIsFloating">false</item>

<!-- This is important! Don't forget to set window background -->
<item name="android:windowBackground">@color/trans_gray</item>
</style>
</resources>
89 changes: 89 additions & 0 deletions Samples/customloader/src/GIFView.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
package customloader.src;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Movie;
import android.util.AttributeSet;
import android.view.View;

import com.ost.ostwallet.R;

import java.io.InputStream;

public class GIFView extends View {

private InputStream gifInputStream;
private Movie gifMovie;
private int movieWidth, movieHeight;
private long movieDuration;
private long mMovieStart;

public GIFView(Context context) {
super(context);
init(context);
}

public GIFView(Context context, AttributeSet attrs) {
super(context, attrs);
init(context);
}

public GIFView(Context context, AttributeSet attrs,
int defStyleAttr) {
super(context, attrs, defStyleAttr);
init(context);
}

private void init(Context context){
setFocusable(true);
gifInputStream = context.getResources()
.openRawResource(R.drawable.ost_progress_image);

gifMovie = Movie.decodeStream(gifInputStream);
movieWidth = gifMovie.width();
movieHeight = gifMovie.height();
movieDuration = gifMovie.duration();
}

@Override
protected void onMeasure(int widthMeasureSpec,
int heightMeasureSpec) {
setMeasuredDimension(movieWidth, movieHeight);
}

public int getMovieWidth(){
return movieWidth;
}

public int getMovieHeight(){
return movieHeight;
}

public long getMovieDuration(){
return movieDuration;
}

@Override
protected void onDraw(Canvas canvas) {

long now = android.os.SystemClock.uptimeMillis();
if (mMovieStart == 0) { // first time
mMovieStart = now;
}

if (gifMovie != null) {

int dur = gifMovie.duration();
if (dur == 0) {
dur = 1000;
}

int relTime = (int)((now - mMovieStart) % dur);

gifMovie.setTime(relTime);

gifMovie.draw(canvas, 0, 0);
invalidate();
}
}
}
Loading

0 comments on commit 157274e

Please sign in to comment.