Skip to content

Commit

Permalink
First draft version of the Ubudu Cordova plugin with iOS platform sup…
Browse files Browse the repository at this point in the history
…port only.
  • Loading branch information
Woildan committed Jan 20, 2015
1 parent 7c83adb commit 75203f7
Show file tree
Hide file tree
Showing 15 changed files with 1,296 additions and 0 deletions.
23 changes: 23 additions & 0 deletions LICENSE
@@ -0,0 +1,23 @@
Copyright (c) 2011-2015, UBUDU SAS
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
57 changes: 57 additions & 0 deletions plugin.xml
@@ -0,0 +1,57 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2011-2015, UBUDU SAS
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->

<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
id="com.ubudu.cordova.sdk"
version="0.1-dev">
<name>UbuduSDK</name>
<description>Cordova Ubudu SDK Plugin</description>
<license>BSD License</license>
<keywords>cordova,ubudu,sdk,beacon,ibeacon</keywords>
<js-module src="www/UbuduSDK.js" name="UbuduSDK">
<clobbers target="UbuduSDK" />
</js-module>
<platform name="ios">
<config-file target="config.xml" parent="/*">
<feature name="UbuduSDKCordova">
<param name="ios-package" value="UbuduSDKCordova"/>
</feature>
</config-file>
<header-file src="src/ios/UbuduSDKCordova.h" />
<source-file src="src/ios/UbuduSDKCordova.m" />
<framework src="Foundation.framework" weak="true" />
<framework src="CoreGraphics.framework" weak="true" />
<framework src="UIKit.framework" weak="true" />
<framework src="SystemConfiguration.framework" weak="true" />
<framework src="MobileCoreServices.framework" weak="true" />
<framework src="CoreData.framework" weak="true" />
<framework src="CoreLocation.framework" weak="true" />
<framework src="CoreBluetooth.framework" weak="true" />
<framework src="PassKit.framework" weak="true" />
<framework src="src/ios/UbuduSDK.framework" custom="true" />
</platform>
</plugin>
1 change: 1 addition & 0 deletions src/ios/UbuduSDK.framework/Headers
1 change: 1 addition & 0 deletions src/ios/UbuduSDK.framework/UbuduSDK
@@ -0,0 +1,49 @@
//
// UbuduAuthorizationDelegate.h
// UbuduSDK
//
// Copyright (c) 2011-2014, UBUDU SAS
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//

#import <Foundation/Foundation.h>

@protocol UbuduAuthorizationDelegate <NSObject>

@optional

/*
* Methods used to inform you that the status of one of the feature of the UbuduSDK changed.
*/
- (void)ubuduBeaconsServiceStatusDidChange:(BOOL)isEnabled; // Beacons service is enabled if UbuduSDK.beaconsEnabled is YES and that UbuduSDK is currently running.
- (void)ubuduGeofencesServiceStatusDidChange:(BOOL)isEnabled; // Geofences service is enabled if UbuduSDK.geofencesEnabled is YES and that UbuduSDK is currently running.

/*
* Methods used to inform you that the status of a service used by the UbuduSDK has changed.
*/
- (void)locationServiceStatusDidChange:(BOOL)isEnabled; // Global or app-specific location service status changed.
- (void)bluetoothStatusDidChange:(BOOL)isEnabled;
- (void)backgroundRefreshStatusDidChange:(BOOL)isEnabled;

@end
@@ -0,0 +1,57 @@
//
// UbuduAuthorizationManager.h
// UbuduSDK
//
// Copyright (c) 2011-2014, UBUDU SAS
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//

#import <Foundation/Foundation.h>
#import <CoreBluetooth/CoreBluetooth.h>

#import "UbuduAuthorizationDelegate.h"

@interface UbuduAuthorizationManager : NSObject

@property (nonatomic, readonly, getter = isUbuduBeaconsServiceEnabled) BOOL ubuduBeaconsServiceEnabled; // YES if UbuduSDK.beaconsEnabled is set to YES and UbuduSDK is currently running.
@property (nonatomic, readonly, getter = isUbuduGeofencesServiceEnabled) BOOL ubuduGeofencesServiceEnabled; // YES if UbuduSDK.geofencesEnabled is set to YES and UbuduSDK is currently running.
@property (nonatomic, readonly, getter = isLocationServiceEnabled) BOOL locationServiceEnabled; // YES if both global and app-specific location services are enabled.
@property (nonatomic, readonly, getter = isBluetoothEnabled) BOOL bluetoothEnabled;
@property (nonatomic, readonly, getter = isBackgroundRefreshEnabled) BOOL backgroundRefreshEnabled;

/* Delegate to receive notifications when the value of one of the above properties changes. */
@property (nonatomic, weak) id<UbuduAuthorizationDelegate> authorizationDelegate;

/* Shows an alert with a button that redirects to Settings app, directly on Bluetooth view. */
- (void)showEnableBluetoothAlert;

/* Opens app settings on iOS 8, shows an alert with instructions to enable location service on iOS 7 and below.
*/
- (void)showEnableLocationServiceUI;

/* Opens app settings on iOS 8, shows an alert with instructions to enable background refresh on iOS 7 and below.
*/
- (void)showEnableBackgroundRefreshUI;

@end
78 changes: 78 additions & 0 deletions src/ios/UbuduSDK.framework/Versions/A/Headers/UbuduErrorCodes.h
@@ -0,0 +1,78 @@
//
// UbuduErrorCodes.h
// UbuduSDK
//
// Copyright (c) 2011-2014, UBUDU SAS
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//

#import <Foundation/Foundation.h>

// Error returned as the domain to NSError from Ubudu.
#define kUbuduErrorDomain @"UbuduErrorDomain"

typedef NS_ENUM(NSUInteger, UbuduErrorCodes) {
UbuduError_None = 0,
UbuduError_UnknownError = 1,
UbuduError_SDKNotStarted = 2,
UbuduError_SDKAlreadyStarted = 3,
UbuduError_DataInitializationError = 4,
UbuduError_DeviceDoesNotSupportRegionMonitoring = 5,
UbuduError_DeviceDoesNotSupportBeacons = 6,
UbuduError_NamespaceNotSet = 7,
UbuduError_GeofencesDisabled = 8,
UbuduError_BeaconsDisabled = 9,

UbuduError_Actions_Error = 200,
UbuduError_Actions_NoDataFoundForRegionEntered = 201, // Odd error. Happens when there is no data for a region which was registered which means that it was in the data storage before. Could've been removed in the meantime.
UbuduError_Actions_DataForRegionNotYetAvailableDueToStartDate = 202,
UbuduError_Actions_DataForRegionNotAvailableDueToEndDateExpiration = 203,
UbuduError_Actions_DataForRegionNotAvailableDueToSchedule = 204,

UbuduError_API_Error = 400,
UbuduError_API_ParamError = 401,
UbuduError_API_ResponseParsingError = 402,
UbuduError_API_SecondGeofencesRequestsLaunched = 403,
UbuduError_API_RegionsDownloadResponseCodeNot200 = 404,
UbuduError_API_RequestServerBadParam = 405, // Received invalid JSON from HTTP request for notify_server action

UbuduError_Data_Error = 600,
UbuduError_Data_NSPersistentStoreOldVersionMigrationError = 601,
UbuduError_Data_NSPersistentStoreOldVersionRemovalError = 602,
UbuduError_Data_NSPersistentStoreOpeningError = 603,
UbuduError_Data_NSPersistentStoreDirectoryCreationError = 604,
UbuduError_Data_NSPredicateParseError = 605,
UbuduError_Data_AttemptedToModifyDataWhileAnotherRequestIsPerformed = 606,
UbuduError_Data_UnableToAddNilRuleAndAction = 607,
UbuduError_Data_UnableToAddNilAction = 608,
UbuduError_Data_RemovingLocalDataFailed = 609,

UbuduError_Location_Error = 800,
UbuduError_Location_LocationUnavailable = 801,
UbuduError_Location_RegionMonitoringUnavailable = 802,

UbuduError_Beacon_Error = 1000,
UbuduError_Beacon_AlreadyStarted = 1001,
UbuduError_Beacon_NotStarted = 1002
};

0 comments on commit 75203f7

Please sign in to comment.