Skip to content

Commit 2935c40

Browse files
authored
Remove dead code, fix tests (#528)
* delete dead code * Fix test to not do unnecessary requests * Remove LPExceptionHandler * No longer user nor correct * Fix stubs to return
1 parent 104c139 commit 2935c40

File tree

13 files changed

+152
-331
lines changed

13 files changed

+152
-331
lines changed

LeanplumSDK/LeanplumSDK.xcodeproj/project.pbxproj

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,6 @@
157157
075AAED526847EC4007CA1BD /* LPInternalState.h in Headers */ = {isa = PBXBuildFile; fileRef = 075AADE126847EC4007CA1BD /* LPInternalState.h */; settings = {ATTRIBUTES = (Public, ); }; };
158158
075AAED626847EC4007CA1BD /* Leanplum.m in Sources */ = {isa = PBXBuildFile; fileRef = 075AADE226847EC4007CA1BD /* Leanplum.m */; };
159159
075AAED826847EC4007CA1BD /* LPContextualValues.m in Sources */ = {isa = PBXBuildFile; fileRef = 075AADE326847EC4007CA1BD /* LPContextualValues.m */; };
160-
075AAEDA26847EC4007CA1BD /* LPExceptionHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = 075AADE526847EC4007CA1BD /* LPExceptionHandler.m */; };
161-
075AAEDC26847EC4007CA1BD /* LPExceptionHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = 075AADE626847EC4007CA1BD /* LPExceptionHandler.h */; settings = {ATTRIBUTES = (Public, ); }; };
162160
075AAEDD26847EC4007CA1BD /* LPEnumConstants.h in Headers */ = {isa = PBXBuildFile; fileRef = 075AADE726847EC4007CA1BD /* LPEnumConstants.h */; settings = {ATTRIBUTES = (Public, ); }; };
163161
075AAEDE26847EC4007CA1BD /* LPConstants.m in Sources */ = {isa = PBXBuildFile; fileRef = 075AADE826847EC4007CA1BD /* LPConstants.m */; };
164162
075AAEF226847FEA007CA1BD /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 075AAEE026847EE0007CA1BD /* Assets.xcassets */; };
@@ -233,7 +231,6 @@
233231
6A714AF526F8B317004A34A9 /* LPWebInterstitialViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 075AAD7426847EC3007CA1BD /* LPWebInterstitialViewController.h */; settings = {ATTRIBUTES = (Public, ); }; };
234232
6A714AF626F8B317004A34A9 /* LPRequestFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = 075AAD4726847EC3007CA1BD /* LPRequestFactory.h */; settings = {ATTRIBUTES = (Public, ); }; };
235233
6A714AF826F8B317004A34A9 /* LPMessageTemplateConstants.h in Headers */ = {isa = PBXBuildFile; fileRef = 075AAD6326847EC3007CA1BD /* LPMessageTemplateConstants.h */; settings = {ATTRIBUTES = (Public, ); }; };
236-
6A714AF926F8B317004A34A9 /* LPExceptionHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = 075AADE626847EC4007CA1BD /* LPExceptionHandler.h */; settings = {ATTRIBUTES = (Public, ); }; };
237234
6A714AFA26F8B317004A34A9 /* LPActionContext-Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 075AADCC26847EC3007CA1BD /* LPActionContext-Internal.h */; settings = {ATTRIBUTES = (Public, ); }; };
238235
6A714AFB26F8B317004A34A9 /* NSString+MD5Addition.h in Headers */ = {isa = PBXBuildFile; fileRef = 075AADB926847EC3007CA1BD /* NSString+MD5Addition.h */; settings = {ATTRIBUTES = (Public, ); }; };
239236
6A714AFC26F8B317004A34A9 /* LPRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = 075AAD3726847EC3007CA1BD /* LPRequest.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -376,7 +373,6 @@
376373
6A714B9726F8B317004A34A9 /* LPMessageTemplates.m in Sources */ = {isa = PBXBuildFile; fileRef = 075AAD2726847EC2007CA1BD /* LPMessageTemplates.m */; };
377374
6A714B9826F8B317004A34A9 /* Leanplum_SocketIO.m in Sources */ = {isa = PBXBuildFile; fileRef = 075AADAF26847EC3007CA1BD /* Leanplum_SocketIO.m */; };
378375
6A714B9926F8B317004A34A9 /* LPEnumConstants.m in Sources */ = {isa = PBXBuildFile; fileRef = 075AADDF26847EC4007CA1BD /* LPEnumConstants.m */; };
379-
6A714B9A26F8B317004A34A9 /* LPExceptionHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = 075AADE526847EC4007CA1BD /* LPExceptionHandler.m */; };
380376
6A714B9B26F8B317004A34A9 /* LPJSON.m in Sources */ = {isa = PBXBuildFile; fileRef = 075AAD9D26847EC3007CA1BD /* LPJSON.m */; };
381377
6A714B9E26F8B317004A34A9 /* Leanplum-iOS-SDK.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 075AAEEC26847FE1007CA1BD /* Leanplum-iOS-SDK.bundle */; };
382378
6A714BA626F8B504004A34A9 /* Leanplum.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 075AAD2B26847EC3007CA1BD /* Leanplum.h */; };
@@ -402,7 +398,6 @@
402398
6A714BBB26F8B504004A34A9 /* LPInternalState.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 075AADE126847EC4007CA1BD /* LPInternalState.h */; };
403399
6A714BBC26F8B504004A34A9 /* LPFeatureFlagManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 075AADDC26847EC4007CA1BD /* LPFeatureFlagManager.h */; };
404400
6A714BBD26F8B504004A34A9 /* LPFeatureFlags.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 075AADDD26847EC4007CA1BD /* LPFeatureFlags.h */; };
405-
6A714BBE26F8B504004A34A9 /* LPExceptionHandler.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 075AADE626847EC4007CA1BD /* LPExceptionHandler.h */; };
406401
6A714BBF26F8B504004A34A9 /* LPAppIconManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 075AAD2D26847EC3007CA1BD /* LPAppIconManager.h */; };
407402
6A714BC026F8B504004A34A9 /* LPCountAggregator.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 075AAD5126847EC3007CA1BD /* LPCountAggregator.h */; };
408403
6A714BC226F8B504004A34A9 /* LPFileManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 075AAD5226847EC3007CA1BD /* LPFileManager.h */; };
@@ -566,7 +561,6 @@
566561
6A714BBB26F8B504004A34A9 /* LPInternalState.h in Copy Headers */,
567562
6A714BBC26F8B504004A34A9 /* LPFeatureFlagManager.h in Copy Headers */,
568563
6A714BBD26F8B504004A34A9 /* LPFeatureFlags.h in Copy Headers */,
569-
6A714BBE26F8B504004A34A9 /* LPExceptionHandler.h in Copy Headers */,
570564
6A714BBF26F8B504004A34A9 /* LPAppIconManager.h in Copy Headers */,
571565
6A714BC026F8B504004A34A9 /* LPCountAggregator.h in Copy Headers */,
572566
6A714BC226F8B504004A34A9 /* LPFileManager.h in Copy Headers */,
@@ -780,8 +774,6 @@
780774
075AADE126847EC4007CA1BD /* LPInternalState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LPInternalState.h; sourceTree = "<group>"; };
781775
075AADE226847EC4007CA1BD /* Leanplum.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Leanplum.m; sourceTree = "<group>"; };
782776
075AADE326847EC4007CA1BD /* LPContextualValues.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LPContextualValues.m; sourceTree = "<group>"; };
783-
075AADE526847EC4007CA1BD /* LPExceptionHandler.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LPExceptionHandler.m; sourceTree = "<group>"; };
784-
075AADE626847EC4007CA1BD /* LPExceptionHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LPExceptionHandler.h; sourceTree = "<group>"; };
785777
075AADE726847EC4007CA1BD /* LPEnumConstants.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LPEnumConstants.h; sourceTree = "<group>"; };
786778
075AADE826847EC4007CA1BD /* LPConstants.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LPConstants.m; sourceTree = "<group>"; };
787779
075AAEE026847EE0007CA1BD /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
@@ -1246,7 +1238,6 @@
12461238
075AADDF26847EC4007CA1BD /* LPEnumConstants.m */,
12471239
075AADD826847EC4007CA1BD /* LPInternalState.m */,
12481240
075AADDB26847EC4007CA1BD /* FeatureFlag */,
1249-
075AADE426847EC4007CA1BD /* Monitoring */,
12501241
);
12511242
path = Internal;
12521243
sourceTree = "<group>";
@@ -1261,15 +1252,6 @@
12611252
path = FeatureFlag;
12621253
sourceTree = "<group>";
12631254
};
1264-
075AADE426847EC4007CA1BD /* Monitoring */ = {
1265-
isa = PBXGroup;
1266-
children = (
1267-
075AADE526847EC4007CA1BD /* LPExceptionHandler.m */,
1268-
075AADE626847EC4007CA1BD /* LPExceptionHandler.h */,
1269-
);
1270-
path = Monitoring;
1271-
sourceTree = "<group>";
1272-
};
12731255
075AAEED26847FE1007CA1BD /* LeanplumSDKBundle */ = {
12741256
isa = PBXGroup;
12751257
children = (
@@ -1466,7 +1448,6 @@
14661448
075AAE5226847EC4007CA1BD /* LPWebInterstitialViewController.h in Headers */,
14671449
075AAE1426847EC4007CA1BD /* LPRequestFactory.h in Headers */,
14681450
075AAE3C26847EC4007CA1BD /* LPMessageTemplateConstants.h in Headers */,
1469-
075AAEDC26847EC4007CA1BD /* LPExceptionHandler.h in Headers */,
14701451
075AAEBB26847EC4007CA1BD /* LPActionContext-Internal.h in Headers */,
14711452
075AAEA426847EC4007CA1BD /* NSString+MD5Addition.h in Headers */,
14721453
075AADFA26847EC4007CA1BD /* LPRequest.h in Headers */,
@@ -1554,7 +1535,6 @@
15541535
6A714AF526F8B317004A34A9 /* LPWebInterstitialViewController.h in Headers */,
15551536
6A714AF626F8B317004A34A9 /* LPRequestFactory.h in Headers */,
15561537
6A714AF826F8B317004A34A9 /* LPMessageTemplateConstants.h in Headers */,
1557-
6A714AF926F8B317004A34A9 /* LPExceptionHandler.h in Headers */,
15581538
6A714AFA26F8B317004A34A9 /* LPActionContext-Internal.h in Headers */,
15591539
6A714AFB26F8B317004A34A9 /* NSString+MD5Addition.h in Headers */,
15601540
6A714AFC26F8B317004A34A9 /* LPRequest.h in Headers */,
@@ -1972,7 +1952,6 @@
19721952
075AAE9826847EC4007CA1BD /* Leanplum_SocketIO.m in Sources */,
19731953
075AAED126847EC4007CA1BD /* LPEnumConstants.m in Sources */,
19741954
6A15EB3D28F6A5DB00878D6C /* LPCTNotificationsManager.swift in Sources */,
1975-
075AAEDA26847EC4007CA1BD /* LPExceptionHandler.m in Sources */,
19761955
075AAE8526847EC4007CA1BD /* LPJSON.m in Sources */,
19771956
);
19781957
runOnlyForDeploymentPostprocessing = 0;
@@ -2101,7 +2080,6 @@
21012080
6A714B9826F8B317004A34A9 /* Leanplum_SocketIO.m in Sources */,
21022081
6A714B9926F8B317004A34A9 /* LPEnumConstants.m in Sources */,
21032082
6A15EB3E28F6A5DB00878D6C /* LPCTNotificationsManager.swift in Sources */,
2104-
6A714B9A26F8B317004A34A9 /* LPExceptionHandler.m in Sources */,
21052083
6A714B9B26F8B317004A34A9 /* LPJSON.m in Sources */,
21062084
);
21072085
runOnlyForDeploymentPostprocessing = 0;

LeanplumSDK/LeanplumSDK/Classes/Internal/Leanplum.m

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -152,13 +152,6 @@ + (void)throwError:(NSString *)reason
152152
}
153153
}
154154

155-
// _initPush is a hidden method so that Unity can do swizzling early enough
156-
157-
+ (void)_initPush
158-
{
159-
[LPActionTriggerManager sharedManager];
160-
}
161-
162155
+ (void)setApiHostName:(NSString *)hostName
163156
withPath:(NSString *)apiPath
164157
usingSsl:(BOOL)ssl
@@ -772,12 +765,8 @@ + (void)startWithUserId:(NSString *)userId
772765
[state.userAttributeChanges addObject:attributes];
773766
}
774767
}
775-
state.calledStart = YES;
776768

777-
// TODO: delete dead code
778-
dispatch_async(dispatch_get_main_queue(), ^{
779-
[Leanplum trackCrashes];
780-
});
769+
state.calledStart = YES;
781770

782771
state.actionManager = [LPActionTriggerManager sharedManager];
783772

@@ -946,11 +935,6 @@ + (void)startWithUserId:(NSString *)userId
946935

947936
[self maybeRegisterForNotifications];
948937
LP_END_TRY
949-
950-
LP_TRY
951-
// TODO: delete dead code
952-
[LPUtils initExceptionHandling];
953-
LP_END_TRY
954938
}
955939

956940
+ (void)handleStartNOOP
@@ -1217,23 +1201,6 @@ + (void)resume
12171201
[[LPRequestSender sharedInstance] send:request];
12181202
}
12191203

1220-
// TODO: delete dead code
1221-
+ (void)trackCrashes
1222-
{
1223-
LP_TRY
1224-
Class crittercism = NSClassFromString(@"Crittercism");
1225-
SEL selector = NSSelectorFromString(@"didCrashOnLastLoad:");
1226-
if (crittercism && [crittercism respondsToSelector:selector]) {
1227-
IMP imp = [crittercism methodForSelector:selector];
1228-
BOOL (*func)(id, SEL) = (void *)imp;
1229-
BOOL didCrash = func(crittercism, selector);
1230-
if (didCrash) {
1231-
[Leanplum track:@"Crash"];
1232-
}
1233-
}
1234-
LP_END_TRY
1235-
}
1236-
12371204
+ (BOOL)hasStarted
12381205
{
12391206
LP_TRY

LeanplumSDK/LeanplumSDK/Classes/Internal/Monitoring/LPExceptionHandler.h

Lines changed: 0 additions & 35 deletions
This file was deleted.

LeanplumSDK/LeanplumSDK/Classes/Internal/Monitoring/LPExceptionHandler.m

Lines changed: 0 additions & 74 deletions
This file was deleted.

LeanplumSDK/LeanplumSDK/Classes/Leanplum.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@
5454
#import "FileMD5Hash.h"
5555
#import "LPJSON.h"
5656
#import "LPNetworkProtocol.h"
57-
#import "LPExceptionHandler.h"
5857
#import "LPMessageTemplates.h"
5958
#import "LPFeatureFlags.h"
6059
#import "UIDevice+IdentifierAddition.h"

LeanplumSDK/LeanplumSDK/Classes/LeanplumSDK.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ FOUNDATION_EXPORT const unsigned char LeanplumSDKVersionString[];
4646
#import "LPContextualValues.h"
4747
#import "LPEnumConstants.h"
4848
#import "LPInternalState.h"
49-
#import "LPExceptionHandler.h"
5049
#import "Leanplum.h"
5150
#import "LeanplumCompatibility.h"
5251
#import "LPActionArg.h"

LeanplumSDK/LeanplumSDK/Classes/Managers/LPLogManager.m

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ + (void)maybeSendLog:(NSString *)message {
6363

6464
+ (void)logInternalError:(NSException *)e
6565
{
66-
[LPUtils handleException:e];
6766
if ([e.name isEqualToString:@"Leanplum Error"]) {
6867
@throw e;
6968
}

LeanplumSDK/LeanplumSDK/Classes/Utilities/LPUtils.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,6 @@
4747
*/
4848
+ (NSString * _Nonnull)base64EncodedStringFromData:(NSData * _Nonnull)data;
4949

50-
/**
51-
* Initialize exception handling
52-
*/
53-
+ (void)initExceptionHandling;
54-
55-
/**
56-
* Report an exception
57-
*/
58-
+ (void)handleException:(NSException * _Nonnull)exception;
59-
6050
/**
6151
* Whether swizzling flag is setup in plist file
6252
*/

LeanplumSDK/LeanplumSDK/Classes/Utilities/LPUtils.m

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424

2525
#import "LPUtils.h"
2626
#import <CommonCrypto/CommonDigest.h>
27-
#import "LPExceptionHandler.h"
2827
#import "LPConstants.h"
2928
#import "Leanplum.h"
3029
#import <Leanplum/Leanplum-Swift.h>
@@ -75,16 +74,6 @@ + (NSString *)base64EncodedStringFromData:(NSData *)data
7574

7675
}
7776

78-
+ (void)initExceptionHandling
79-
{
80-
[LPExceptionHandler sharedExceptionHandler];
81-
}
82-
83-
+ (void)handleException:(NSException *)exception
84-
{
85-
[[LPExceptionHandler sharedExceptionHandler] reportException:exception];
86-
}
87-
8877
+(BOOL)isSwizzlingEnabled
8978
{
9079
BOOL swizzlingEnabled = YES;

0 commit comments

Comments
 (0)