Skip to content

Commit 4262ae3

Browse files
committed
Extract string encoding / decoding to a new file
1 parent 0168358 commit 4262ae3

File tree

3 files changed

+14
-11
lines changed

3 files changed

+14
-11
lines changed

Sentry.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1027,6 +1027,7 @@
10271027
F452438A2DE65968003E8F50 /* ExceptionCatcher.h in Headers */ = {isa = PBXBuildFile; fileRef = F45243862DE65968003E8F50 /* ExceptionCatcher.h */; };
10281028
F452438C2DE65BC0003E8F50 /* SentryUseNSExceptionCallstackWrapper.h in Headers */ = {isa = PBXBuildFile; fileRef = F452438B2DE65BC0003E8F50 /* SentryUseNSExceptionCallstackWrapper.h */; };
10291029
F458D1132E180BB00028273E /* SentryFileManagerProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = F458D1122E180BB00028273E /* SentryFileManagerProtocol.swift */; };
1030+
F458D1152E1869AD0028273E /* SentryScopePersistentStore+String.swift in Sources */ = {isa = PBXBuildFile; fileRef = F458D1142E1869AD0028273E /* SentryScopePersistentStore+String.swift */; };
10301031
F49D41982DEA27AF00D9244E /* SentryUseNSExceptionCallstackWrapperTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F49D41972DEA27AF00D9244E /* SentryUseNSExceptionCallstackWrapperTests.swift */; };
10311032
F49D419A2DEA2FB000D9244E /* SentryCrashExceptionApplicationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F49D41992DEA2FB000D9244E /* SentryCrashExceptionApplicationTests.swift */; };
10321033
F49D419C2DEA30C300D9244E /* SentryCrashExceptionApplicationHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = F49D419B2DEA30B800D9244E /* SentryCrashExceptionApplicationHelper.h */; };
@@ -2290,6 +2291,7 @@
22902291
F45243872DE65968003E8F50 /* ExceptionCatcher.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ExceptionCatcher.m; sourceTree = "<group>"; };
22912292
F452438B2DE65BC0003E8F50 /* SentryUseNSExceptionCallstackWrapper.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryUseNSExceptionCallstackWrapper.h; path = include/SentryUseNSExceptionCallstackWrapper.h; sourceTree = "<group>"; };
22922293
F458D1122E180BB00028273E /* SentryFileManagerProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryFileManagerProtocol.swift; sourceTree = "<group>"; };
2294+
F458D1142E1869AD0028273E /* SentryScopePersistentStore+String.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "SentryScopePersistentStore+String.swift"; sourceTree = "<group>"; };
22932295
F49D41972DEA27AF00D9244E /* SentryUseNSExceptionCallstackWrapperTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryUseNSExceptionCallstackWrapperTests.swift; sourceTree = "<group>"; };
22942296
F49D41992DEA2FB000D9244E /* SentryCrashExceptionApplicationTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryCrashExceptionApplicationTests.swift; sourceTree = "<group>"; };
22952297
F49D419B2DEA30B800D9244E /* SentryCrashExceptionApplicationHelper.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryCrashExceptionApplicationHelper.h; path = include/SentryCrashExceptionApplicationHelper.h; sourceTree = "<group>"; };
@@ -4039,6 +4041,7 @@
40394041
isa = PBXGroup;
40404042
children = (
40414043
F4E3DCCA2E1579240093CB80 /* SentryScopePersistentStore.swift */,
4044+
F458D1142E1869AD0028273E /* SentryScopePersistentStore+String.swift */,
40424045
);
40434046
path = Persistence;
40444047
sourceTree = "<group>";
@@ -5374,6 +5377,7 @@
53745377
620078722D38F00D0022CB67 /* SentryGeoCodable.swift in Sources */,
53755378
D8CB741B2947286500A5F964 /* SentryEnvelopeItemHeader.m in Sources */,
53765379
92ECD73C2E05ACE00063EC10 /* SentryLog.swift in Sources */,
5380+
F458D1152E1869AD0028273E /* SentryScopePersistentStore+String.swift in Sources */,
53775381
D8CB7417294724CC00A5F964 /* SentryEnvelopeAttachmentHeader.m in Sources */,
53785382
D84793262788737D00BE8E99 /* SentryByteCountFormatter.m in Sources */,
53795383
63AA769E1EB9C57A00D153DE /* SentryError.mm in Sources */,
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// MARK: - Strings
2+
extension SentryScopePersistentStore {
3+
func encode(string: String) -> Data? {
4+
return string.data(using: .utf8)
5+
}
6+
7+
func decodeString(from data: Data) -> String? {
8+
return String(data: data, encoding: .utf8)
9+
}
10+
}

Sources/Swift/Persistence/SentryScopePersistentStore.swift

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -236,14 +236,3 @@ extension SentryScopePersistentStore {
236236
return decodeFromJSONData(jsonData: data)
237237
}
238238
}
239-
240-
// MARK: - Strings
241-
extension SentryScopePersistentStore {
242-
private func encode(string: String) -> Data? {
243-
return string.data(using: .utf8)
244-
}
245-
246-
private func decodeString(from data: Data) -> String? {
247-
return String(data: data, encoding: .utf8)
248-
}
249-
}

0 commit comments

Comments
 (0)