Skip to content

Commit

Permalink
Updates Cordova plugin to use Wikitude SDK 9.2
Browse files Browse the repository at this point in the history
  • Loading branch information
pnagele committed Jul 9, 2020
1 parent a715c7b commit d8336fe
Show file tree
Hide file tree
Showing 63 changed files with 182 additions and 490 deletions.
4 changes: 2 additions & 2 deletions package.json
@@ -1,6 +1,6 @@
{
"name": "com.wikitude.phonegap.wikitudeplugin",
"version": "9.1.0",
"version": "9.2.0",
"description": "Augmented Reality Wikitude SDK Plugin \n The Wikitude Cordova Plugin enables developers to embed an augmented reality view into their Cordova project. You can create a fully featured app with advanced augmented reality features, including image recognition, object recognition purely using HTML, CSS and JavaScript.\n ",
"cordova": {
"id": "",
Expand Down Expand Up @@ -32,7 +32,7 @@
}
],
"author": "Wikitude GmbH",
"license": "(c) 2016 - 2019 Wikitude GmbH - see License.md for details of the license",
"license": "(c) 2016 - 2020 Wikitude GmbH - see License.md for details of the license",
"bugs": {
"url": "https://github.com/Wikitude/wikitude-phonegap/issues"
},
Expand Down
2 changes: 1 addition & 1 deletion plugin.xml
Expand Up @@ -2,7 +2,7 @@
<plugin xmlns="http://www.phonegap.com/ns/plugins/1.0"
xmlns:android="http://schemas.android.com/apk/res/android"
id="com.wikitude.phonegap.wikitudeplugin"
version="9.1.0">
version="9.2.0">

<name>Augmented Reality - Wikitude SDK Plugin</name>

Expand Down
22 changes: 22 additions & 0 deletions src/android/WikitudePlugin.java
Expand Up @@ -17,8 +17,10 @@
import org.json.JSONObject;

import android.Manifest;
import android.app.AlertDialog;
import android.content.ContentValues;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
Expand Down Expand Up @@ -136,6 +138,8 @@ public class WikitudePlugin extends CordovaPlugin implements ArchitectJavaScript

private static final String ACTION_OPEN_APP_SETTINGS = "openAppSettings";

private static final String ACTION_SHOW_ALERT = "showAlert";

/**
* check if view is on view-stack (no matter if visible or not)
*/
Expand Down Expand Up @@ -555,6 +559,24 @@ public void run() {
return true;
}

if ( WikitudePlugin.ACTION_SHOW_ALERT.equals( action ) ) {
try {
final String alertString = args.getString( 0 );
AlertDialog.Builder builder = new AlertDialog.Builder(cordova.getActivity());
builder.setMessage(alertString)
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
}
});
AlertDialog alertDialog = builder.create();
alertDialog.show();
} catch (JSONException e) {
callContext.error( action + ": exception thrown, " + e != null ? e.getMessage() : "(exception is NULL)" );
return true;
}
return true;
}

/* fall-back return value */
callContext.sendPluginResult( new PluginResult( PluginResult.Status.ERROR, "no such action: " + action ) );
return false;
Expand Down
Binary file modified src/android/wikitudesdk.aar
Binary file not shown.
18 changes: 18 additions & 0 deletions src/ios/WTWikitudePlugin.m
Expand Up @@ -769,6 +769,24 @@ - (void)onJSONObjectReceived:(CDVInvokedUrlCommand *)command
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}

- (void)showAlert:(CDVInvokedUrlCommand *)command
{
CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_NO_RESULT];

NSString* message = [NSString stringWithFormat:@"%@", command.arguments.firstObject];
UIAlertController * alert = [UIAlertController alertControllerWithTitle:nil
message:message
preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction* okButton = [UIAlertAction actionWithTitle:@"OK"
style:UIAlertActionStyleDefault
handler:nil];
[alert addAction:okButton];

[self.arViewController presentViewController:alert animated:YES completion:nil];

[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}

#pragma mark Device sensor calibration
- (void)setDeviceSensorsNeedCalibrationHandler:(CDVInvokedUrlCommand *)command
{
Expand Down
9 changes: 2 additions & 7 deletions src/ios/WikitudeSDK.framework/Headers/ArchitectPlugin.hpp
Expand Up @@ -16,10 +16,7 @@
#include "JavaScriptPluginModule.hpp"


namespace wikitude { namespace sdk {

namespace impl {

namespace wikitude::sdk {

class WT_EXPORT_API ArchitectPlugin : public Plugin {
public:
Expand All @@ -36,9 +33,7 @@ namespace wikitude { namespace sdk {
private:
std::unique_ptr<JavaScriptPluginModule> _javaScriptPluginModule;
};
}
using impl::ArchitectPlugin;
}}
}

#endif /* __cplusplus */

Expand Down
8 changes: 2 additions & 6 deletions src/ios/WikitudeSDK.framework/Headers/CameraFocusMode.hpp
Expand Up @@ -14,9 +14,7 @@
#include "CompilerAttributes.hpp"


namespace wikitude { namespace sdk {

namespace impl {
namespace wikitude::sdk {

/**
* @brief Use this enum to determine the focus mode of the camera.
Expand All @@ -29,9 +27,7 @@ namespace wikitude { namespace sdk {
/** Off: The device has its focus locked */
Off
};
}
using impl::CameraFocusMode;
}}
}

#endif /* __cplusplus */

Expand Down
14 changes: 3 additions & 11 deletions src/ios/WikitudeSDK.framework/Headers/CameraFrame.hpp
Expand Up @@ -24,9 +24,7 @@
#include "CompilerAttributes.hpp"


namespace wikitude { namespace sdk {

namespace impl {
namespace wikitude::sdk {

/** @class DepthCameraFrameMetadata
* @brief A class that encapsulates additional information about depth camera frames.
Expand Down Expand Up @@ -147,6 +145,7 @@ namespace wikitude { namespace sdk {
CameraFrame(long id_, std::int64_t colorTimestamp_, ColorCameraFrameMetadata colorMetadata_, const std::vector<CameraFramePlane>& colorData_);
CameraFrame(long id_, std::int64_t colorTimestamp_, ColorCameraFrameMetadata colorMetadata_, const std::vector<CameraFramePlane>& colorData_, const Matrix4& pose_);
CameraFrame(long id_, std::int64_t colorTimestamp_, ColorCameraFrameMetadata colorMetadata_, const std::vector<CameraFramePlane>& colorData_, std::int64_t depthTimestamp_, DepthCameraFrameMetadata depthMetadata_, const void* depthData_);
CameraFrame(long id_, std::int64_t colorTimestamp_, ColorCameraFrameMetadata colorMetadata_, const std::vector<CameraFramePlane>& colorData_, std::int64_t depthTimestamp_, DepthCameraFrameMetadata depthMetadata_, const void* depthData_, const Matrix4& pose_);

/** @brief Returns unique id used to identify individual frames.
*/
Expand Down Expand Up @@ -199,14 +198,7 @@ namespace wikitude { namespace sdk {
bool _hasPose;
};
/** @}*/
}
using impl::DepthDataFormat;
using impl::DepthCameraFrameMetadata;
using impl::ColorCameraFrameMetadata;
using impl::DistortionMode;
using impl::IntrinsicsCalibration;
using impl::CameraFrame;
}}
}

#endif /* __cplusplus */

Expand Down
Expand Up @@ -23,11 +23,8 @@
#include "PluginModule.hpp"


namespace wikitude { namespace sdk {
namespace wikitude::sdk {

namespace impl {


class WT_EXPORT_API CameraFrameInputPluginModule : public PluginModule {
public:
CameraFrameInputPluginModule() noexcept = default;
Expand Down Expand Up @@ -92,9 +89,7 @@ namespace wikitude { namespace sdk {
std::function<void(float)> _cameraToSurfaceAngleChangedHandler;
std::function<void(const sdk::Error&)> _onPluginCameraErrorHandler;
};
}
using impl::CameraFrameInputPluginModule;
}}
}

#endif /* __cplusplus */

Expand Down
8 changes: 2 additions & 6 deletions src/ios/WikitudeSDK.framework/Headers/CameraFramePlane.hpp
Expand Up @@ -13,9 +13,7 @@

#include "CompilerAttributes.hpp"

namespace wikitude { namespace sdk {

namespace impl {
namespace wikitude::sdk {

/** @class CameraFramePlane
* @brief A single plane of image data.
Expand Down Expand Up @@ -48,9 +46,7 @@ namespace wikitude { namespace sdk {
int _pixelStride;
int _rowStride;
};
}
using impl::CameraFramePlane;
}}
}

#endif /* __cplusplus */

Expand Down
18 changes: 4 additions & 14 deletions src/ios/WikitudeSDK.framework/Headers/CameraParameters.hpp
Expand Up @@ -18,19 +18,11 @@
#include "PlatformCameraHandler.hpp"


namespace wikitude {
namespace universal_sdk {
namespace impl {
class CameraParametersInternal;
}
using impl::CameraParametersInternal;
}
namespace wikitude::universal_sdk {
class CameraParametersInternal;
}

namespace wikitude { namespace sdk {

namespace impl {

namespace wikitude::sdk {

/**
* @brief CameraParameters provide access to camera specific information.
Expand Down Expand Up @@ -73,9 +65,7 @@ namespace wikitude { namespace sdk {
protected:
universal_sdk::CameraParametersInternal* _internalCameraParameters = nullptr;
};
}
using impl::CameraParameters;
}}
}

#endif /* __cplusplus */

Expand Down
8 changes: 2 additions & 6 deletions src/ios/WikitudeSDK.framework/Headers/CameraPosition.hpp
Expand Up @@ -14,9 +14,7 @@
#include "CompilerAttributes.hpp"


namespace wikitude { namespace sdk {

namespace impl {
namespace wikitude::sdk {

/** @enum CameraPosition
* @brief An enum indicating the physical position of the camera used to capture frames.
Expand All @@ -32,9 +30,7 @@ namespace wikitude { namespace sdk {
*/
Front
};
}
using impl::CameraPosition;
}}
}

#endif /* __cplusplus */

Expand Down
9 changes: 2 additions & 7 deletions src/ios/WikitudeSDK.framework/Headers/ColorSpace.hpp
Expand Up @@ -14,10 +14,7 @@
#include "CompilerAttributes.hpp"


namespace wikitude { namespace sdk {

namespace impl {

namespace wikitude::sdk {

enum WT_EXPORT_API ColorSpace {
/**
Expand Down Expand Up @@ -83,9 +80,7 @@ namespace wikitude { namespace sdk {
*/
UNKNOWN
};
}
using impl::ColorSpace;
}}
}

#endif /* __cplusplus */

Expand Down
9 changes: 2 additions & 7 deletions src/ios/WikitudeSDK.framework/Headers/DepthDataFormat.hpp
Expand Up @@ -14,10 +14,7 @@
#include "CompilerAttributes.hpp"


namespace wikitude { namespace sdk {

namespace impl {

namespace wikitude::sdk {

enum class WT_EXPORT_API DepthDataFormat {
FLOAT_32,
Expand All @@ -26,9 +23,7 @@ namespace wikitude { namespace sdk {
INTEGER_16,
INTEGER_32
};
}
using impl::DepthDataFormat;
}}
}

#endif /* __cplusplus */

Expand Down
Expand Up @@ -18,10 +18,7 @@
#include "SensorEvent.hpp"


namespace wikitude { namespace sdk {

namespace impl {

namespace wikitude::sdk {

class WT_EXPORT_API DeviceMotionInputPluginModule : public PluginModule {
public:
Expand All @@ -46,9 +43,7 @@ namespace wikitude { namespace sdk {
std::function<void(sdk::DeviceRotationEvent)> _notifyNewDeviceRotationEventHandler;
std::function<void(sdk::DeviceOrientationEvent)> _notifyNewDeviceOrientationEventHandler;
};
}
using impl::DeviceMotionInputPluginModule;
}}
}

#endif /* __cplusplus */

Expand Down
9 changes: 2 additions & 7 deletions src/ios/WikitudeSDK.framework/Headers/Error.hpp
Expand Up @@ -18,10 +18,7 @@
#include "CompilerAttributes.hpp"


namespace wikitude { namespace sdk {

namespace impl {

namespace wikitude::sdk {

/**
* A simple data type to represent an error. Domains help to reduce the amount of unique codes by introducing an additional layer of separation.
Expand Down Expand Up @@ -87,9 +84,7 @@ namespace wikitude { namespace sdk {

std::unique_ptr<Error> _underlyingError;
};
}
using impl::Error;
}}
}

#endif /* __cplusplus */

Expand Down
10 changes: 2 additions & 8 deletions src/ios/WikitudeSDK.framework/Headers/ErrorHandling.hpp
Expand Up @@ -15,10 +15,7 @@
#include "Error.hpp"


namespace wikitude { namespace sdk {

namespace impl {

namespace wikitude::sdk {

struct WT_EXPORT_API CallStatus {
public:
Expand Down Expand Up @@ -65,10 +62,7 @@ namespace wikitude { namespace sdk {
T _value;
CallStatus _status;
};
}
using impl::CallStatus;
using impl::CallValue;
}}
}

#endif /* __cplusplus */

Expand Down

0 comments on commit d8336fe

Please sign in to comment.