Skip to content
This repository has been archived by the owner on Jul 31, 2019. It is now read-only.

Commit

Permalink
Libindy 1.6.1 cocoapod, Latest libvcx, Fix ErrorCode enum issue with …
Browse files Browse the repository at this point in the history
…Java wrapper
  • Loading branch information
khagesh committed Jul 30, 2018
1 parent 0f2bee9 commit e24487c
Show file tree
Hide file tree
Showing 9 changed files with 114 additions and 49 deletions.
44 changes: 44 additions & 0 deletions Specs/vcx/0.0.24/vcx.podspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#
# Be sure to run `pod lib lint vcx.podspec' to ensure this is a
# valid spec before submitting.
#
# Any lines starting with a # are optional, but their use is encouraged
# To learn more about a Podspec see https://guides.cocoapods.org/syntax/podspec.html
#

Pod::Spec.new do |s|
s.name = 'vcx'
s.version = '0.0.24'
s.summary = 'The Objective-C wrapper around the libvcx shared library.'

# This description is used to generate tags and improve search results.
# * Think: What does it do? Why did you write it? What is the focus?
# * Try to keep it short, snappy and to the point.
# * Write the description between the DESC delimiters below.
# * Finally, don't worry about the indent, CocoaPods strips it!

s.description = <<-DESC
The ConnectMe mobile app on the iOS platform will call into the libvcx shared library
from Objective-C. This pod is a very thin Objective-C wrapper that allows react native to call
through to the libvcx shared library.
DESC

s.homepage = 'https://www.evernym.com/'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.author = { 'evernym-ios-dev' => '[email protected]' }
s.source = { :http => 'https://repo.corp.evernym.com/filely/ios/vcx.framework_20180729.1548_universal.zip' }

s.ios.deployment_target = '8.0'

#s.source_files = '**/vcx/Classes/**/*','**/Example/Classes/**/*'

# s.resource_bundles = {
# 'vcx' => ['**/vcx/Assets/*.png']
# }
s.ios.vendored_frameworks="vcx/vcx.framework"
s.compiler_flags = '-ObjC'
s.public_header_files = 'vcx/vcx.framework/include/*.h'
s.ios.vendored_library = 'vcx/vcx.framework/lib/libvcx.a'
# s.frameworks = 'UIKit', 'MapKit'
# s.dependency 'AFNetworking', '~> 2.3'
end
8 changes: 4 additions & 4 deletions vcx/libvcx/build_scripts/android/mac/mac.03.libindy.build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export ANDROID_ZMQ_LIB=$WORK_DIR/libzmq-android/zmq/libzmq_armv7/lib; echo "ANDR
#export LIBZMQ_INCLUDE_DIR=$WORK_DIR/libzmq-android/zmq/libzmq_armv7/include; echo "LIBZMQ_INCLUDE_DIR: $LIBZMQ_INCLUDE_DIR"
export ANDROID_SQLITE_LIB=$WORK_DIR/libsqlite3-android/sqlite3-android/obj/local/armeabi-v7a; echo "ANDROID_SQLITE_LIB: $ANDROID_SQLITE_LIB"
sed -i .bak 's/\"\"\.as_ptr() as \*const i8/\"\"\.as_ptr() as \*const u8/' src/services/wallet/storage/plugged/mod.rs
cargo build --target armv7-linux-androideabi --release --verbose
cargo build --target armv7-linux-androideabi --release
echo "-----------------------------------------------------------------------------------------------"

# export PATH=$WORK_DIR/NDK/arm64/bin:$ORIGINAL_PATH; echo "PATH: $PATH"
Expand All @@ -133,7 +133,7 @@ export ANDROID_ZMQ_LIB=$WORK_DIR/libzmq-android/zmq/libzmq_x86/lib; echo "ANDROI
#export LIBZMQ_INCLUDE_DIR=$WORK_DIR/libzmq-android/zmq/libzmq_x86/include; echo "LIBZMQ_INCLUDE_DIR: $LIBZMQ_INCLUDE_DIR"
export ANDROID_SQLITE_LIB=$WORK_DIR/libsqlite3-android/sqlite3-android/obj/local/x86; echo "ANDROID_SQLITE_LIB: $ANDROID_SQLITE_LIB"
sed -i .bak 's/\"\"\.as_ptr() as \*const u8/\"\"\.as_ptr() as \*const i8/' src/services/wallet/storage/plugged/mod.rs
cargo build --target i686-linux-android --release --verbose
cargo build --target i686-linux-android --release
echo "-----------------------------------------------------------------------------------------------"

# export PATH=$WORK_DIR/NDK/x86_64/bin:$ORIGINAL_PATH; echo "PATH: $PATH"
Expand Down Expand Up @@ -194,7 +194,7 @@ export ANDROID_ZMQ_LIB=$WORK_DIR/libzmq-android/zmq/libzmq_armv7/lib; echo "ANDR
#export LIBZMQ_INCLUDE_DIR=$WORK_DIR/libzmq-android/zmq/libzmq_armv7/include; echo "LIBZMQ_INCLUDE_DIR: $LIBZMQ_INCLUDE_DIR"
export ANDROID_SQLITE_LIB=$WORK_DIR/libsqlite3-android/armeabi-v7a; echo "ANDROID_SQLITE_LIB: $ANDROID_SQLITE_LIB"
export LIBINDY_DIR=$WORK_DIR/vcx-indy-sdk/libindy/target/armv7-linux-androideabi/release; echo "LIBINDY_DIR: $LIBINDY_DIR"
cargo build --target armv7-linux-androideabi --release --verbose
cargo build --target armv7-linux-androideabi --release
echo "-----------------------------------------------------------------------------------------------"

# export PATH=$WORK_DIR/NDK/arm64/bin:$ORIGINAL_PATH; echo "PATH: $PATH"
Expand All @@ -218,7 +218,7 @@ export ANDROID_ZMQ_LIB=$WORK_DIR/libzmq-android/zmq/libzmq_x86/lib; echo "ANDROI
#export LIBZMQ_INCLUDE_DIR=$WORK_DIR/libzmq-android/zmq/libzmq_x86/include; echo "LIBZMQ_INCLUDE_DIR: $LIBZMQ_INCLUDE_DIR"
export ANDROID_SQLITE_LIB=$WORK_DIR/libsqlite3-android/x86; echo "ANDROID_SQLITE_LIB: $ANDROID_SQLITE_LIB"
export LIBINDY_DIR=$WORK_DIR/vcx-indy-sdk/libindy/target/i686-linux-android/release; echo "LIBINDY_DIR: $LIBINDY_DIR"
cargo build --target i686-linux-android --release --verbose
cargo build --target i686-linux-android --release
echo "-----------------------------------------------------------------------------------------------"

# export PATH=$WORK_DIR/NDK/x86_64/bin:$ORIGINAL_PATH; echo "PATH: $PATH"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,13 @@ VCX_SDK=$START_DIR/../../../../..
VCX_SDK=$(abspath "$VCX_SDK")

cd $VCX_SDK/vcx/wrappers/java/vcx/
# sed -i .bak 's/evernym/androidbuild1/g' local.properties

./gradlew clean assembleDebug

cd $VCX_SDK/vcx/wrappers/java/vcx/build/outputs/aar/
AAR_FILE=$(ls *-debug.aar)
AAR_VER=$(echo ${AAR_FILE} | cut -c 17-38)
# install generated .aar file
mvn install:install-file -Dfile=${AAR_FILE} -DgroupId=com.connectme \
-DartifactId=vcx -Dversion=${AAR_VER} -Dpackaging=aar

# rm -rf $WORK_DIR/aar
# mkdir -p $WORK_DIR/aar
# cd $WORK_DIR/aar
# unzip $START_DIR/vcx.aar.template.aar
# cp $VCX_SDK/vcx/wrappers/java/android/vcxtest/app/jni/arm/*.so ./jni/arm
# cp $VCX_SDK/vcx/wrappers/java/android/vcxtest/app/jni/armv7/*.so ./jni/armv7
# #cp $VCX_SDK/vcx/wrappers/java/android/vcxtest/app/jni/armeabi-v7a/*.so ./jni/armeabi-v7a
# cp $VCX_SDK/vcx/wrappers/java/android/vcxtest/app/jni/x86/*.so ./jni/x86
# cp $VCX_SDK/vcx/wrappers/java/android/vcxtest/app/jni/arm64/*.so ./jni/arm64
# cp $VCX_SDK/vcx/wrappers/java/android/vcxtest/app/jni/x86_64/*.so ./jni/x86_64
echo $AAR_VER | pbcopy
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/sh

source ./shared.functions.sh

START_DIR=$PWD
WORK_DIR=$START_DIR/../../../../../.macosbuild
mkdir -p $WORK_DIR
WORK_DIR=$(abspath "$WORK_DIR")
VCX_SDK=$START_DIR/../../../../..
VCX_SDK=$(abspath "$VCX_SDK")

cd $VCX_SDK/vcx/wrappers/java/vcx/

./gradlew clean assembleRelease

cd $VCX_SDK/vcx/wrappers/java/vcx/build/outputs/aar/
AAR_FILE=$(ls *-release.aar)
AAR_VER=$(echo ${AAR_FILE} | cut -c 17-38)
# install generated .aar file
mvn install:install-file -Dfile=${AAR_FILE} -DgroupId=com.connectme \
-DartifactId=vcx -Dversion=${AAR_VER} -Dpackaging=aar
echo $AAR_VER | pbcopy

# Upload to public cloud repo
mvn -e deploy:deploy-file \
-Durl="https://evernym.mycloudrepo.io/repositories/libvcx-android" \
-DrepositoryId="io.cloudrepo" \
-Dversion="${AAR_VER}" \
-Dfile=${AAR_FILE} \
-DartifactId="vcx" \
-Dpackaging="aar" \
-DgroupId="com.evernym"
8 changes: 4 additions & 4 deletions vcx/libvcx/build_scripts/ios/mac/mac.03.libindy.build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ fi
#cargo build
# To build for iOS
#echo "cargo lipo --release --verbose --targets=${IOS_TARGETS}"
cargo lipo --release --verbose --targets="${IOS_TARGETS}"
# cargo lipo --release --targets="${IOS_TARGETS}"
# cargo lipo --release --verbose --targets="${IOS_TARGETS}"
cargo lipo --release --targets="${IOS_TARGETS}"
#cargo lipo

#########################################################################################################################
Expand All @@ -99,6 +99,6 @@ fi
#cargo build
# To build for iOS
#echo "cargo lipo --release --verbose --targets=${IOS_TARGETS}"
cargo lipo --release --verbose --targets="${IOS_TARGETS}"
# cargo lipo --release --targets="${IOS_TARGETS}"
# cargo lipo --release --verbose --targets="${IOS_TARGETS}"
cargo lipo --release --targets="${IOS_TARGETS}"
#cargo lipo
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.evernym.sdk.vcx;


import android.util.Log;

import com.evernym.sdk.vcx.connection.ConnectionErrorException;
import com.evernym.sdk.vcx.connection.InvalidConnectionHandleException;
import com.evernym.sdk.vcx.connection.InvalidInviteDetailsException;
Expand Down Expand Up @@ -65,6 +67,7 @@
*/
public class VcxException extends Exception {

private static String TAG = "JAVA_WRAPPER::VCX_API ";
private static final long serialVersionUID = 2650355290834266234L;
private int sdkErrorCode;

Expand Down Expand Up @@ -93,8 +96,13 @@ public int getSdkErrorCode() {
* @param sdkErrorCode The SDK error code to construct the exception from.
*/
static VcxException fromSdkError(int sdkErrorCode) {

ErrorCode errorCode = ErrorCode.valueOf(sdkErrorCode);
ErrorCode errorCode = ErrorCode.UNKNOWN_ERROR;
try {
errorCode = ErrorCode.valueOf(sdkErrorCode);
if (errorCode == null) {
errorCode = ErrorCode.UNKNOWN_ERROR;
}
} catch(Exception e) {}

switch (errorCode) {
case UNKNOWN_ERROR:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,23 @@ protected static CompletableFuture<?> removeFuture(int xcommand_handle) {
*
* @param future The future.
* @param err The error value to check.
* @return true if the error code indeicated SUCCESS, otherwise false.
* @return true if the error code indicate SUCCESS, otherwise false.
*/
protected static boolean checkCallback(CompletableFuture<?> future, int err) {
ErrorCode errorCode = ErrorCode.UNKNOWN_ERROR;

ErrorCode errorCode = ErrorCode.valueOf(err);
if (! ErrorCode.SUCCESS.equals(errorCode)) { future.completeExceptionally(VcxException.fromSdkError(err)); return false; }
try {
errorCode = ErrorCode.valueOf(err);
if (errorCode == null) {
errorCode = ErrorCode.UNKNOWN_ERROR;
}
} catch(Exception e) {}

if (! ErrorCode.SUCCESS.equals(errorCode)) {
future.completeExceptionally(VcxException.fromSdkError(err));

return false;
}

return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,28 +81,4 @@ public static String vcxErrorCMessage(int errorCode) {

}

// public static CompletableFuture<Integer> vcxGenerateProof(
// String proofRequestId,
// String requestedAttrs,
// String requestedPredicates,
// String proofName
// ) throws VcxException {
// ParamGuard.notNull(proofRequestId, "proofRequestId");
// ParamGuard.notNullOrWhiteSpace(requestedAttrs, "requestedAttrs");
// ParamGuard.notNullOrWhiteSpace(requestedPredicates, "requestedPredicates");
// ParamGuard.notNullOrWhiteSpace(proofName, "proofName");
// CompletableFuture<Integer> future = new CompletableFuture<Integer>();
// int commandHandle = addFuture(future);
//
// int result = LibVcx.api.vcx_proof_create(
// proofRequestId,
// requestedAttrs,
// requestedPredicates,
// proofName,
// vcxGenerateProofCB
// );
// checkResult(result);
// return future;
// }

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.evernym.sdk.vcx.wallet;

import android.util.Log;

import com.evernym.sdk.vcx.LibVcx;
import com.evernym.sdk.vcx.ParamGuard;
import com.evernym.sdk.vcx.VcxException;
Expand All @@ -9,6 +11,7 @@
import java9.util.concurrent.CompletableFuture;

public class WalletApi extends VcxJava.API {
private static String TAG = "JAVA_WRAPPER::API_VCX::WALLET";

private WalletApi(){}

Expand Down

0 comments on commit e24487c

Please sign in to comment.