Skip to content

Commit

Permalink
Merge branch 'master' into TIMOB-27248
Browse files Browse the repository at this point in the history
  • Loading branch information
garymathews committed Jul 26, 2019
2 parents d9810fa + 1be0bed commit 8bac471
Show file tree
Hide file tree
Showing 8 changed files with 1,041 additions and 459 deletions.
2 changes: 1 addition & 1 deletion android/cli/commands/_build.js
Original file line number Diff line number Diff line change
Expand Up @@ -3901,7 +3901,7 @@ AndroidBuilder.prototype.generateAndroidManifest = function generateAndroidManif
// Must be done last so app developer can override manifest settings such as <activity/>, <receiver/>, etc.
finalAndroidManifest.merge(tiappAndroidManifest);

if (this.realTargetSDK >= 24 && !finalAndroidManifest.application.hasOwnProperty('resizeableActivity')) {
if (this.realTargetSDK >= 24 && !Object.prototype.hasOwnProperty.call(finalAndroidManifest.application, 'resizeableActivity')) {
finalAndroidManifest.application.resizeableActivity = true;
}

Expand Down
Binary file modified android/titanium/lib/aps-analytics.jar
Binary file not shown.
5 changes: 4 additions & 1 deletion iphone/Classes/CalendarModule.m
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,10 @@ - (void)requestAuthorization:(JSValue *)callback forEntityType:(EKEntityType)ent
} else {
propertiesDict = [TiUtils dictionaryWithCode:[error code] message:[TiUtils messageFromError:error]];
}
[callback callWithArguments:@[ propertiesDict ]];
TiThreadPerformOnMainThread(^{
[callback callWithArguments:@[ propertiesDict ]];
},
[NSThread isMainThread]);
}];
},
NO);
Expand Down
112 changes: 58 additions & 54 deletions iphone/TitaniumKit/TitaniumKit/Libraries/APSAnalytics/APSAnalytics.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
@import CoreLocation;

/** Constant indicating development deployment */
extern NSString * const APSDeployTypeDevelopment;
extern NSString *const APSDeployTypeDevelopment;

/** Constant indicating production deployment */
extern NSString * const APSDeployTypeProduction;
extern NSString *const APSDeployTypeProduction;

/**
* The APSAnalytics class configures the application to use the APS analytic services
Expand All @@ -25,62 +25,62 @@ extern NSString * const APSDeployTypeProduction;
/**
* Return the singleton instance to the real-time analytics service.
*/
+ (instancetype) sharedInstance;
+ (instancetype)sharedInstance;

/**
* Retrieves the current session identifier.
*
* @return {NSString*} session identifier.
*/
-(NSString *)getCurrentSessionId;
- (NSString *)getCurrentSessionId;

/**
* Retrieves the last event sent.
*
* @return {NSDictionary *} the last event stored, otherwise null if none have been stored.
*/
-(NSDictionary *)getLastEvent;
- (NSDictionary *)getLastEvent;

/**
* Retrieves the derived machine identifier.
*
* @return {NSString *} machine identifier.
*/
-(NSString*)getMachineId;
- (NSString *)getMachineId;

/**
* Obtains machine identifier.
*/
-(void)setMachineId;
- (void)setMachineId;

/**
* Checks whether the user has opted out from sending analytics data.
*
* @return {BOOL} with the decision
*/
-(BOOL)isOptedOut;
- (BOOL)isOptedOut;

/**
* Writes the optedOut property in the SharedPreferences instance.
*
* @param {BOOL} value with the decision to opt out.
*/
-(void)setOptedOut:(BOOL)optedOut;
- (void)setOptedOut:(BOOL)optedOut;

/**
* Sends an application enroll event to indicate first launch.
*
* @deprecated use sendAppInstallEvent() instead.
*/
-(void)sendAppEnrollEvent;
- (void)sendAppEnrollEvent;

/**
* Sends an application enroll event to indicate first launch.
*
* If this is called multiple times, all executions after the first will
* be ignored and do nothing.
*/
-(void)sendAppInstallEvent;
- (void)sendAppInstallEvent;

/**
* Sends an application foreground event to indicate a new session.
Expand All @@ -92,12 +92,12 @@ extern NSString * const APSDeployTypeProduction;
*
* In both of these cases, the same session identifier will be kept.
*/
-(void)sendSessionStartEvent;
- (void)sendSessionStartEvent;

/**
* Sends an application background event to indicate an ended session.
*/
-(void)sendSessionEndEvent;
- (void)sendSessionEndEvent;

/**
* Sends an application navigation event which describes moving between views.
Expand All @@ -106,47 +106,51 @@ extern NSString * const APSDeployTypeProduction;
* @param toView the name of the view the user navigated to.
* @param data arbitrary data to be sent alongside the nav event.
*/
-(void)sendAppNavEvent:(NSString * _Nonnull)fromView
toView:(NSString * _Nonnull)toView
event:(NSString * _Nullable)event
data:(NSDictionary * _Nullable)data;
- (void)sendAppNavEvent:(NSString *_Nonnull)fromView
toView:(NSString *_Nonnull)toView
event:(NSString *_Nullable)event
data:(NSDictionary *_Nullable)data;


-(void)sendAppNavEventFromView:(NSString * _Nonnull)fromView
toView:(NSString * _Nonnull)toView
withName:(NSString * _Nullable)event
payload:(NSDictionary * _Nullable)data;
- (void)sendAppNavEventFromView:(NSString *_Nonnull)fromView
toView:(NSString *_Nonnull)toView
withName:(NSString *_Nullable)event
payload:(NSDictionary *_Nullable)data;

/**
* Sends an application feature event to allow sending custom data.
*
* @deprecated use sendCustomEvent(String, JSONObject) instead.
*/
-(void)sendAppFeatureEvent:(NSString * _Nonnull)event
payload:(NSDictionary * _Nullable)data;
- (void)sendAppFeatureEvent:(NSString *_Nonnull)event
payload:(NSDictionary *_Nullable)data;

/**
* Sends an application feature event to allow sending custom data.
*
* @param name the name of the event being sent.
* @param data the data to send alongside the event.
*/
-(void)sendCustomEvent:(NSString * _Nonnull)name
data:(NSDictionary * _Nullable)data;
- (void)sendCustomEvent:(NSString *_Nonnull)name
data:(NSDictionary *_Nullable)data;

/**
* Sends a crash report as a custom event.
*
* @deprecated use sendCrashReport(JSONObject) instead.
*/
-(void)sendAppCrashEvent:(NSDictionary * _Nonnull)data;
- (void)sendAppCrashEvent:(NSDictionary *_Nonnull)data;

/**
* Sends a crash report as a custom event.
*
* @param crash the crash data to be included with the payload.
*/
-(void)sendCrashReport:(NSDictionary * _Nonnull)crash;
- (void)sendCrashReport:(NSDictionary *_Nonnull)crash;

/**
* Flush event queue.
*/
- (void)flush;

/**
* Set sdk version to send in analytics.
Expand All @@ -155,133 +159,133 @@ extern NSString * const APSDeployTypeProduction;
*
* @deprecated use setSdkVersion() instead.
*/
-(void)setSDKVersion:(NSString *)version;
- (void)setSDKVersion:(NSString *)version;

/**
* @deprecated NOT USED, only defined for backwards compatibility.
*/
-(void)setBuildType:(NSString *) type;
- (void)setBuildType:(NSString *)type;

/**
* Enables Analytics with a given app-key and deploy-type.
* @param appKey The APSAnalytics app-key.
* @param deployTime The deploy-type of the application.
*/
-(void)enableWithAppKey:(NSString *)appKey andDeployType:(NSString *)deployType;
- (void)enableWithAppKey:(NSString *)appKey andDeployType:(NSString *)deployType;

/**
* Get analytics endpoint url
*/
-(NSString *)getAnalyticsUrl;
- (NSString *)getAnalyticsUrl;

/**
* Get device architecture
*/
-(NSString *)getArchitecture;
- (NSString *)getArchitecture;

/**
* Get application id
*/
-(NSString *)getAppId;
- (NSString *)getAppId;

/**
* Get application name
*/
-(NSString *)getAppName;
- (NSString *)getAppName;

/**
* Get application version
*/
-(NSString *)getAppVersion;
- (NSString *)getAppVersion;

/**
* Get application deployment type (production, development)
*/
-(NSString *)getDeployType;
- (NSString *)getDeployType;

/**
* Get analytics flush interval
*/
-(NSInteger)getFlushInterval;
- (NSInteger)getFlushInterval;

/**
* Get analytics flush requeue interval
*/
-(NSInteger)getFlushRequeue;
- (NSInteger)getFlushRequeue;

/**
* Get device model
*/
-(NSString *)getModel;
- (NSString *)getModel;

/**
* Get network type
*/
-(NSString *)getNetworkType;
- (NSString *)getNetworkType;

/**
* Get OS type (32bit, 64bit)
*/
-(NSString *)getOsType;
- (NSString *)getOsType;

/**
* Get OS version
*/
-(NSString *)getOsVersion;
- (NSString *)getOsVersion;

/**
* Get current platform
*/
-(NSString *)getPlatform;
- (NSString *)getPlatform;

/**
* Get device processor count
*/
-(NSInteger)getProcessorCount;
- (NSInteger)getProcessorCount;

/**
* Get SDK version
*/
-(NSString *)getSdkVersion;
- (NSString *)getSdkVersion;

/**
* Set analytics endpoint url
*/
-(void)setAnalyticsUrl:(NSString *)url;
- (void)setAnalyticsUrl:(NSString *)url;

/**
* Set application id
*/
-(void)setAppId:(NSString *)appId;
- (void)setAppId:(NSString *)appId;

/**
* Set application name
*/
-(void)setAppName:(NSString *)appName;
- (void)setAppName:(NSString *)appName;

/**
* Set application version
*/
-(void)setAppVersion:(NSString *)appVersion;
- (void)setAppVersion:(NSString *)appVersion;

/**
* Set application deployment type
*/
-(void)setDeployType:(NSString *)deployType;
- (void)setDeployType:(NSString *)deployType;

/**
* Set SDK version
*/
-(void)setSdkVersion:(NSString *)sdkVersion;
- (void)setSdkVersion:(NSString *)sdkVersion;

/**
* Set analytics flush interval
*/
-(void)setFlushInterval:(NSInteger)timeout;
- (void)setFlushInterval:(NSInteger)timeout;

/**
* Set analytics flush requeue interval
*/
-(void)setFlushRequeue:(NSInteger)timeout;
- (void)setFlushRequeue:(NSInteger)timeout;

@end
Binary file not shown.
19 changes: 19 additions & 0 deletions iphone/TitaniumKit/TitaniumKit/Sources/API/TiExceptionHandler.m
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,15 @@
*/

#import "TiExceptionHandler.h"
#import "APSAnalytics.h"
#import "TiApp.h"
#import "TiBase.h"

#include <execinfo.h>
#include <signal.h>

static void TiUncaughtExceptionHandler(NSException *exception);
static void TiSignalHandler(int signal);

static NSUncaughtExceptionHandler *prevUncaughtExceptionHandler = NULL;

Expand All @@ -26,6 +30,13 @@ + (TiExceptionHandler *)defaultExceptionHandler
defaultExceptionHandler = [[self alloc] init];
prevUncaughtExceptionHandler = NSGetUncaughtExceptionHandler();
NSSetUncaughtExceptionHandler(&TiUncaughtExceptionHandler);

signal(SIGABRT, TiSignalHandler);
signal(SIGILL, TiSignalHandler);
signal(SIGSEGV, TiSignalHandler);
signal(SIGFPE, TiSignalHandler);
signal(SIGBUS, TiSignalHandler);
signal(SIGPIPE, TiSignalHandler);
});
return defaultExceptionHandler;
}
Expand Down Expand Up @@ -218,3 +229,11 @@ static void TiUncaughtExceptionHandler(NSException *exception)
[NSThread exit];
}
}

static void TiSignalHandler(int code)
{
NSException *exception = [NSException exceptionWithName:@"SIGNAL_ERROR" reason:[NSString stringWithFormat:@"signal error code: %d", code] userInfo:nil];
[[TiExceptionHandler defaultExceptionHandler] reportException:exception];
[[APSAnalytics sharedInstance] flush];
signal(code, SIG_DFL);
}

0 comments on commit 8bac471

Please sign in to comment.