Skip to content

Commit

Permalink
ref: Convert SentryFileContents to Swift (#4206)
Browse files Browse the repository at this point in the history
  • Loading branch information
philipphofmann authored Jul 30, 2024
1 parent f64f819 commit f3b9a21
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 45 deletions.
12 changes: 4 additions & 8 deletions Sentry.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
33EB2A922C341300004FED3D /* Sentry.h in Headers */ = {isa = PBXBuildFile; fileRef = 63AA76931EB9C1C200D153DE /* Sentry.h */; settings = {ATTRIBUTES = (Public, ); }; };
51B15F7E2BE88A7C0026A2F2 /* URLSessionTaskHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51B15F7D2BE88A7C0026A2F2 /* URLSessionTaskHelper.swift */; };
51B15F802BE88D510026A2F2 /* URLSessionTaskHelperTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51B15F7F2BE88D510026A2F2 /* URLSessionTaskHelperTests.swift */; };
620203B22C59025E0008317C /* SentryFileContents.swift in Sources */ = {isa = PBXBuildFile; fileRef = 620203B12C59025E0008317C /* SentryFileContents.swift */; };
620379DB2AFE1415005AC0C1 /* SentryBuildAppStartSpans.h in Headers */ = {isa = PBXBuildFile; fileRef = 620379DA2AFE1415005AC0C1 /* SentryBuildAppStartSpans.h */; };
620379DD2AFE1432005AC0C1 /* SentryBuildAppStartSpans.m in Sources */ = {isa = PBXBuildFile; fileRef = 620379DC2AFE1432005AC0C1 /* SentryBuildAppStartSpans.m */; };
621D9F2F2B9B0320003D94DE /* SentryCurrentDateProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 621D9F2E2B9B0320003D94DE /* SentryCurrentDateProvider.swift */; };
Expand Down Expand Up @@ -526,8 +527,6 @@
7BC6EC10255C3F560059822A /* SentryMechanismTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7BC6EC0F255C3F560059822A /* SentryMechanismTests.swift */; };
7BC6EC14255C415E0059822A /* SentryExceptionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7BC6EC13255C415E0059822A /* SentryExceptionTests.swift */; };
7BC6EC18255C44540059822A /* SentryDebugMetaTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7BC6EC17255C44540059822A /* SentryDebugMetaTests.swift */; };
7BC8522F24581096005A70F0 /* SentryFileContents.h in Headers */ = {isa = PBXBuildFile; fileRef = 7BC8522E24581096005A70F0 /* SentryFileContents.h */; };
7BC85231245812EC005A70F0 /* SentryFileContents.m in Sources */ = {isa = PBXBuildFile; fileRef = 7BC85230245812EC005A70F0 /* SentryFileContents.m */; };
7BC852332458802C005A70F0 /* SentryDataCategoryMapper.h in Headers */ = {isa = PBXBuildFile; fileRef = 7BC852322458802C005A70F0 /* SentryDataCategoryMapper.h */; };
7BC85235245880AE005A70F0 /* SentryDataCategoryMapper.m in Sources */ = {isa = PBXBuildFile; fileRef = 7BC85234245880AE005A70F0 /* SentryDataCategoryMapper.m */; };
7BC8523724588115005A70F0 /* SentryDataCategory.h in Headers */ = {isa = PBXBuildFile; fileRef = 7BC8523624588115005A70F0 /* SentryDataCategory.h */; };
Expand Down Expand Up @@ -1048,6 +1047,7 @@
33EB2A8F2C3411AE004FED3D /* SentryWithoutUIKit.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryWithoutUIKit.h; path = Public/SentryWithoutUIKit.h; sourceTree = "<group>"; };
51B15F7D2BE88A7C0026A2F2 /* URLSessionTaskHelper.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = URLSessionTaskHelper.swift; sourceTree = "<group>"; };
51B15F7F2BE88D510026A2F2 /* URLSessionTaskHelperTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = URLSessionTaskHelperTests.swift; sourceTree = "<group>"; };
620203B12C59025E0008317C /* SentryFileContents.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryFileContents.swift; sourceTree = "<group>"; };
620379DA2AFE1415005AC0C1 /* SentryBuildAppStartSpans.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryBuildAppStartSpans.h; path = include/SentryBuildAppStartSpans.h; sourceTree = "<group>"; };
620379DC2AFE1432005AC0C1 /* SentryBuildAppStartSpans.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentryBuildAppStartSpans.m; sourceTree = "<group>"; };
621D9F2E2B9B0320003D94DE /* SentryCurrentDateProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryCurrentDateProvider.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1538,8 +1538,6 @@
7BC6EC0F255C3F560059822A /* SentryMechanismTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryMechanismTests.swift; sourceTree = "<group>"; };
7BC6EC13255C415E0059822A /* SentryExceptionTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryExceptionTests.swift; sourceTree = "<group>"; };
7BC6EC17255C44540059822A /* SentryDebugMetaTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryDebugMetaTests.swift; sourceTree = "<group>"; };
7BC8522E24581096005A70F0 /* SentryFileContents.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryFileContents.h; path = include/SentryFileContents.h; sourceTree = "<group>"; };
7BC85230245812EC005A70F0 /* SentryFileContents.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentryFileContents.m; sourceTree = "<group>"; };
7BC852322458802C005A70F0 /* SentryDataCategoryMapper.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryDataCategoryMapper.h; path = include/SentryDataCategoryMapper.h; sourceTree = "<group>"; };
7BC85234245880AE005A70F0 /* SentryDataCategoryMapper.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentryDataCategoryMapper.m; sourceTree = "<group>"; };
7BC8523624588115005A70F0 /* SentryDataCategory.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryDataCategory.h; path = include/SentryDataCategory.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -2074,6 +2072,7 @@
621D9F2E2B9B0320003D94DE /* SentryCurrentDateProvider.swift */,
621F61F02BEA073A005E654F /* SentryEnabledFeaturesBuilder.swift */,
624688182C048EF10006179C /* SentryBaggageSerialization.swift */,
620203B12C59025E0008317C /* SentryFileContents.swift */,
);
path = Helper;
sourceTree = "<group>";
Expand Down Expand Up @@ -2401,8 +2400,6 @@
63AA769C1EB9C57A00D153DE /* SentryError.mm */,
7B42C47F27E08F33009B58C2 /* SentryDependencyContainer.h */,
7B42C48127E08F4B009B58C2 /* SentryDependencyContainer.m */,
7BC8522E24581096005A70F0 /* SentryFileContents.h */,
7BC85230245812EC005A70F0 /* SentryFileContents.m */,
636085111ED47BE600E8599E /* SentryFileManager.h */,
636085121ED47BE600E8599E /* SentryFileManager.m */,
7BC3936725B1AB3E004F03D3 /* SentryLevelMapper.h */,
Expand Down Expand Up @@ -4098,7 +4095,6 @@
D8370B6C273DF20F00F66E2D /* SentryNSURLSessionTaskSearch.h in Headers */,
7B96572026830C9100C66E25 /* SentryScopeSyncC.h in Headers */,
63FE70EB20DA4C1000CDBAE8 /* SentryCrashMonitor_MachException.h in Headers */,
7BC8522F24581096005A70F0 /* SentryFileContents.h in Headers */,
7B30B67C26527886006B2752 /* SentryDisplayLinkWrapper.h in Headers */,
7BD86ECF264A7C77005439DB /* SentryAppStartMeasurement.h in Headers */,
0354A22B2A134D9C003C3A04 /* SentryProfilerState.h in Headers */,
Expand Down Expand Up @@ -4474,6 +4470,7 @@
624688192C048EF10006179C /* SentryBaggageSerialization.swift in Sources */,
D81988C92BEC19200020E36C /* SentryRRWebBreadcrumbEvent.swift in Sources */,
0A2D8D9628997845008720F6 /* NSLocale+Sentry.m in Sources */,
620203B22C59025E0008317C /* SentryFileContents.swift in Sources */,
7B0DC730288698F70039995F /* NSMutableDictionary+Sentry.m in Sources */,
7BD4BD4527EB29F50071F4FF /* SentryClientReport.m in Sources */,
D87C89032BC43C9C0086C7DF /* SentryRedactOptions.swift in Sources */,
Expand Down Expand Up @@ -4681,7 +4678,6 @@
7BA61CBB247BC5D800C130A8 /* SentryCrashDefaultBinaryImageProvider.m in Sources */,
63FE713120DA4C1100CDBAE8 /* SentryCrashDynamicLinker.c in Sources */,
8E25C95325F836D000DC215B /* SentryRandom.m in Sources */,
7BC85231245812EC005A70F0 /* SentryFileContents.m in Sources */,
D80CD8D22B751447002F710B /* SentryMXManager.swift in Sources */,
03F84D3527DD4191008FE43F /* SentryThreadHandle.cpp in Sources */,
0A2D8DA9289BC905008720F6 /* SentryViewHierarchy.m in Sources */,
Expand Down
19 changes: 0 additions & 19 deletions Sources/Sentry/SentryFileContents.m

This file was deleted.

3 changes: 1 addition & 2 deletions Sources/Sentry/SentryFileManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#import "SentryEnvelopeItemHeader.h"
#import "SentryError.h"
#import "SentryEvent.h"
#import "SentryFileContents.h"
#import "SentryInternalDefines.h"
#import "SentryLog.h"
#import "SentryMigrateSessionInit.h"
Expand Down Expand Up @@ -199,7 +198,7 @@ - (SentryFileContents *_Nullable)getFileContents:(NSString *)folderPath
NSFileManager *fileManager = [NSFileManager defaultManager];
NSData *content = [fileManager contentsAtPath:finalPath];
if (nil != content) {
return [[SentryFileContents alloc] initWithPath:finalPath andContents:content];
return [[SentryFileContents alloc] initWithPath:finalPath contents:content];
} else {
return nil;
}
Expand Down
1 change: 0 additions & 1 deletion Sources/Sentry/SentryHttpTransport.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#import "SentryEnvelopeItemType.h"
#import "SentryEnvelopeRateLimit.h"
#import "SentryEvent.h"
#import "SentryFileContents.h"
#import "SentryFileManager.h"
#import "SentryLog.h"
#import "SentryNSURLRequest.h"
Expand Down
14 changes: 0 additions & 14 deletions Sources/Sentry/include/SentryFileContents.h

This file was deleted.

13 changes: 13 additions & 0 deletions Sources/Swift/Helper/SentryFileContents.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import Foundation

@objcMembers
class SentryFileContents: NSObject {

let path: String
let contents: Data

init(path: String, contents: Data) {
self.path = path
self.contents = contents
}
}
1 change: 0 additions & 1 deletion Tests/SentryTests/SentryTests-Bridging-Header.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@
#import "SentryEnvelopeRateLimit.h"
#import "SentryEvent+Private.h"
#import "SentryExtraContextProvider.h"
#import "SentryFileContents.h"
#import "SentryFileIOTrackingIntegration.h"
#import "SentryFileManager+Test.h"
#import "SentryFileManager.h"
Expand Down

0 comments on commit f3b9a21

Please sign in to comment.