Skip to content

Commit

Permalink
v9.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
boehlerlukas committed Feb 23, 2023
1 parent 2a81883 commit 25914df
Show file tree
Hide file tree
Showing 8 changed files with 159 additions and 31 deletions.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,8 @@
filePath = "../Sources/ObjCSources/GleapSessionHelper.m"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "315"
endingLineNumber = "315"
startingLineNumber = "342"
endingLineNumber = "342"
landmarkName = "-clearSession"
landmarkType = "7">
</BreakpointContent>
Expand Down Expand Up @@ -382,8 +382,8 @@
filePath = "../Sources/ObjCSources/GleapSessionHelper.m"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "200"
endingLineNumber = "200"
startingLineNumber = "217"
endingLineNumber = "217"
landmarkName = "-processOpenIdentityAction"
landmarkType = "7">
</BreakpointContent>
Expand All @@ -398,8 +398,8 @@
filePath = "../Sources/ObjCSources/GleapSessionHelper.m"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "201"
endingLineNumber = "201"
startingLineNumber = "218"
endingLineNumber = "218"
landmarkName = "-processOpenIdentityAction"
landmarkType = "7">
</BreakpointContent>
Expand All @@ -414,8 +414,8 @@
filePath = "../Sources/ObjCSources/GleapSessionHelper.m"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "191"
endingLineNumber = "191"
startingLineNumber = "208"
endingLineNumber = "208"
landmarkName = "-processOpenIdentityAction"
landmarkType = "7">
</BreakpointContent>
Expand All @@ -430,8 +430,8 @@
filePath = "../Sources/ObjCSources/GleapSessionHelper.m"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "234"
endingLineNumber = "234"
startingLineNumber = "251"
endingLineNumber = "251"
landmarkName = "-sessionUpgradeWithDataNeeded:"
landmarkType = "7">
</BreakpointContent>
Expand All @@ -446,8 +446,8 @@
filePath = "../Sources/ObjCSources/GleapSessionHelper.m"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "254"
endingLineNumber = "254"
startingLineNumber = "271"
endingLineNumber = "271"
landmarkName = "-sessionUpgradeWithDataNeeded:"
landmarkType = "7">
</BreakpointContent>
Expand All @@ -462,8 +462,8 @@
filePath = "../Sources/ObjCSources/GleapSessionHelper.m"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "255"
endingLineNumber = "255"
startingLineNumber = "272"
endingLineNumber = "272"
landmarkName = "-sessionUpgradeWithDataNeeded:"
landmarkType = "7">
</BreakpointContent>
Expand Down Expand Up @@ -494,8 +494,8 @@
filePath = "../Sources/ObjCSources/GleapSessionHelper.m"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "209"
endingLineNumber = "209"
startingLineNumber = "226"
endingLineNumber = "226"
landmarkName = "-processOpenIdentityAction"
landmarkType = "7">
</BreakpointContent>
Expand All @@ -510,8 +510,8 @@
filePath = "../Sources/ObjCSources/GleapSessionHelper.m"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "215"
endingLineNumber = "215"
startingLineNumber = "232"
endingLineNumber = "232"
landmarkName = "-processOpenIdentityAction"
landmarkType = "7">
</BreakpointContent>
Expand Down Expand Up @@ -798,8 +798,8 @@
filePath = "../Sources/ObjCSources/GleapSessionHelper.m"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "178"
endingLineNumber = "178"
startingLineNumber = "195"
endingLineNumber = "195"
landmarkName = "-processOpenIdentityAction"
landmarkType = "7">
</BreakpointContent>
Expand All @@ -814,11 +814,91 @@
filePath = "../Sources/ObjCSources/GleapSessionHelper.m"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "356"
endingLineNumber = "356"
startingLineNumber = "401"
endingLineNumber = "401"
landmarkName = "-sessionDataNumberItemNeedsUpgrade:compareTo:"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "BF494B49-CF68-468D-BBE1-F2E96F25FCED"
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "../Sources/ObjCSources/GleapSessionHelper.m"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "275"
endingLineNumber = "275"
landmarkName = "-sessionUpgradeWithDataNeeded:"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "C3518BCF-B92C-4D43-9E8A-A9C5C94F2ECF"
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "../Sources/ObjCSources/GleapSessionHelper.m"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "279"
endingLineNumber = "279"
landmarkName = "-sessionUpgradeWithDataNeeded:"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "FB57E132-A9BD-4B62-BC58-A5DDF63A5766"
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "../Sources/ObjCSources/GleapSessionHelper.m"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "172"
endingLineNumber = "172"
landmarkName = "-processOpenIdentityAction"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "295EF922-C043-4AA7-8C29-DCB2A826C8C2"
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "../Sources/ObjCSources/GleapSessionHelper.m"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "166"
endingLineNumber = "166"
landmarkName = "-processOpenIdentityAction"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "CC509A03-F6B9-4BD7-BCB1-D690ABE16838"
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "../Sources/ObjCSources/GleapSessionHelper.m"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "355"
endingLineNumber = "355"
landmarkName = "-sessionCustomDataItemNeedsUpgrade:compareTo:"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
</Bucket>
4 changes: 2 additions & 2 deletions Example/Example/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate, GleapDelegate {

Gleap.setDisableInAppNotifications(false);

//Gleap.setApiUrl("http://localhost:9000")
//Gleap.setFrameUrl("http://localhost:3001/appnew.html")
Gleap.setApiUrl("http://localhost:9000")
Gleap.setFrameUrl("http://localhost:3001/appnew.html")
Gleap.initialize(withToken: "DUPaIr7s689BBblcFI4pc5aBgYJTm7Sc")

Gleap.showFeedbackButton(true)
Expand Down
5 changes: 3 additions & 2 deletions Example/Example/DemoViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,11 @@ - (IBAction)sendData:(id)sender {
user.name = @"Luko";
user.email = @"[email protected]";
user.customData = @{
@"test": @"gggg"
@"testaaa3": @"gg222gg",
@"test": @"gggg",
};

[Gleap identifyUserWith: @"23939234" andData: user];
[Gleap identifyUserWith: @"23939233334" andData: user];
}

@end
2 changes: 1 addition & 1 deletion Gleap.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

Pod::Spec.new do |s|
s.name = "Gleap"
s.version = "9.0.2"
s.version = "9.0.3"
s.summary = "In-App Bug Reporting and Testing for Apps. Learn more at https://gleap.io"
s.homepage = "https://gleap.io"
s.license = { :type => 'Commercial', :file => 'LICENSE.md' }
Expand Down
1 change: 1 addition & 0 deletions Sources/ObjCSources/GleapSession.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, retain, nullable) NSString* name;
@property (nonatomic, retain, nullable) NSString* email;
@property (nonatomic, retain, nullable) NSString* phone;
@property (nonatomic, retain, nullable) NSDictionary* customData;
@property (nonatomic, retain, nullable) NSNumber* value;

@end
Expand Down
3 changes: 2 additions & 1 deletion Sources/ObjCSources/GleapSession.m
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ - (NSDictionary *)toDictionary {
@"name": ObjectOrNull(self.name),
@"email": ObjectOrNull(self.email),
@"value": ObjectOrNull(self.value),
@"phone": ObjectOrNull(self.phone)
@"phone": ObjectOrNull(self.phone),
@"customData": ObjectOrNull(self.customData)
};
}

Expand Down
51 changes: 48 additions & 3 deletions Sources/ObjCSources/GleapSessionHelper.m
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ - (void)processOpenIdentityAction {
if (data != nil && data.phone != nil) {
[sessionRequestData setValue: data.phone forKey: @"phone"];
}

if (data != nil && data.value != nil) {
[sessionRequestData setValue: data.value forKey: @"value"];
}
Expand All @@ -161,12 +162,28 @@ - (void)processOpenIdentityAction {
}
} @catch (id exp) {}

bool needsUpdate = [self sessionUpgradeWithDataNeeded: sessionRequestData];
bool hasCustomData = data.customData != nil;
if (!needsUpdate && !hasCustomData) {
// Used to check for update.
NSMutableDictionary *sessionDataToCheckForUpdate = [sessionRequestData mutableCopy];
if (data != nil && data.customData != nil) {
[sessionDataToCheckForUpdate setValue: data.customData forKey: @"customData"];
}

bool needsUpdate = [self sessionUpgradeWithDataNeeded: sessionDataToCheckForUpdate];
if (!needsUpdate) {
return;
}

// If update is needed, also append all the custom data fields.
@try {
if (data != nil && data.customData != nil) {
NSArray *keys = data.customData.allKeys;
for (int i = 0; i < keys.count; i++) {
NSString *key = [keys objectAtIndex: i];
[sessionRequestData setValue: [data.customData objectForKey: key] forKey: key];
}
}
} @catch (id exp) {}

NSError *error;
NSData *jsonBodyData = [NSJSONSerialization dataWithJSONObject: sessionRequestData options:kNilOptions error: &error];

Expand Down Expand Up @@ -255,6 +272,10 @@ - (BOOL)sessionUpgradeWithDataNeeded:(NSDictionary *)newData {
return YES;
}

if ([self sessionCustomDataItemNeedsUpgrade: self.currentSession.customData compareTo: [newData objectForKey: @"customData"]]) {
return YES;
}

return NO;
}

Expand Down Expand Up @@ -287,6 +308,12 @@ - (void)updateLocalSessionWith:(NSDictionary *)data andCompletion:(void (^)(bool

}

@try {
gleapSession.customData = [data objectForKey: @"customData"];
} @catch (id exp) {

}

self.currentSession = gleapSession;

// Process any open identity actions.
Expand Down Expand Up @@ -325,6 +352,24 @@ - (void)clearSession {
[self startSessionWith:^(bool success) {}];
}

- (BOOL)sessionCustomDataItemNeedsUpgrade:(NSDictionary *)data compareTo:(NSDictionary *)newData {
if ([data isKindOfClass:[NSNull class]] || [newData isKindOfClass:[NSNull class]]) {
return YES;
}

// Both values are nil, no upgrade needed.
if (data == nil && newData == nil) {
return NO;
}

// One value is nil, upgrade needed.
if (data == nil || newData == nil) {
return YES;
}

return ![data isEqualToDictionary: newData];
}

- (BOOL)sessionDataItemNeedsUpgrade:(NSString *)data compareTo:(NSString *)newData {
if ([data isKindOfClass:[NSNull class]] || [newData isKindOfClass:[NSNull class]]) {
return YES;
Expand Down

0 comments on commit 25914df

Please sign in to comment.