Skip to content

Commit e0ec648

Browse files
authored
[#363] 푸시 알람과 웹페이지 데이터의 hard deletion을 제거한다 (#364)
* test: Firebase 에뮬레이터를 사용하여 로컬에서 테스트하는 방향으로 테스트 코드 작성 * refactor: 테스트 코드를 바탕으로 Todo의 soft deletion와 동일한 형태로 undo 로직 개선 * refactor: Date.formatted()로 개선 * refactor: 불필요 대기 시간 제거 * refactor: 테스트명 수정 및 기존 코드를 위한 6초 딜레이 추가
1 parent 5d95643 commit e0ec648

File tree

16 files changed

+1097
-195
lines changed

16 files changed

+1097
-195
lines changed

DevLog.xcodeproj/project.pbxproj

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,18 @@
2020
DFF2DACE2EDC02AD00778738 /* OrderedCollections in Frameworks */ = {isa = PBXBuildFile; productRef = DFF2DACD2EDC02AD00778738 /* OrderedCollections */; };
2121
/* End PBXBuildFile section */
2222

23+
/* Begin PBXContainerItemProxy section */
24+
DF34164B2E45F67C00F9312B /* PBXContainerItemProxy */ = {
25+
isa = PBXContainerItemProxy;
26+
containerPortal = DFD48AF82DC4D6E2005905C5 /* Project object */;
27+
proxyType = 1;
28+
remoteGlobalIDString = DFD48AFF2DC4D6E2005905C5;
29+
remoteInfo = DevLog;
30+
};
31+
/* End PBXContainerItemProxy section */
32+
2333
/* Begin PBXFileReference section */
34+
DF3416492E45F67C00F9312B /* DevLog_Unit.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = DevLog_Unit.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
2435
DFD48B002DC4D6E2005905C5 /* DevLog.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DevLog.app; sourceTree = BUILT_PRODUCTS_DIR; };
2536
DFD6453F2EC827A10073E133 /* .gitignore */ = {isa = PBXFileReference; lastKnownFileType = text; path = .gitignore; sourceTree = "<group>"; };
2637
DFD74E2E2E423EA700613803 /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
@@ -38,6 +49,11 @@
3849
/* End PBXFileSystemSynchronizedBuildFileExceptionSet section */
3950

4051
/* Begin PBXFileSystemSynchronizedRootGroup section */
52+
DF34164A2E45F67C00F9312B /* DevLog_Unit */ = {
53+
isa = PBXFileSystemSynchronizedRootGroup;
54+
path = DevLog_Unit;
55+
sourceTree = "<group>";
56+
};
4157
DF8AB7982E938B0B00E50BBF /* DevLog */ = {
4258
isa = PBXFileSystemSynchronizedRootGroup;
4359
exceptions = (
@@ -49,6 +65,13 @@
4965
/* End PBXFileSystemSynchronizedRootGroup section */
5066

5167
/* Begin PBXFrameworksBuildPhase section */
68+
DF3416472E45F67C00F9312B /* Frameworks */ = {
69+
isa = PBXFrameworksBuildPhase;
70+
buildActionMask = 2147483647;
71+
files = (
72+
);
73+
runOnlyForDeploymentPostprocessing = 0;
74+
};
5275
DFD48AFD2DC4D6E2005905C5 /* Frameworks */ = {
5376
isa = PBXFrameworksBuildPhase;
5477
buildActionMask = 2147483647;
@@ -73,6 +96,7 @@
7396
children = (
7497
DFD6453F2EC827A10073E133 /* .gitignore */,
7598
DF8AB7982E938B0B00E50BBF /* DevLog */,
99+
DF34164A2E45F67C00F9312B /* DevLog_Unit */,
76100
DFD74E2E2E423EA700613803 /* README.md */,
77101
DFE28EB62DCCF26300B28FE5 /* Frameworks */,
78102
DFD48B012DC4D6E2005905C5 /* Products */,
@@ -82,6 +106,7 @@
82106
DFD48B012DC4D6E2005905C5 /* Products */ = {
83107
isa = PBXGroup;
84108
children = (
109+
DF3416492E45F67C00F9312B /* DevLog_Unit.xctest */,
85110
DFD48B002DC4D6E2005905C5 /* DevLog.app */,
86111
);
87112
name = Products;
@@ -97,6 +122,29 @@
97122
/* End PBXGroup section */
98123

99124
/* Begin PBXNativeTarget section */
125+
DF3416442E45F67C00F9312B /* DevLog_Unit */ = {
126+
isa = PBXNativeTarget;
127+
buildConfigurationList = DF3416452E45F67C00F9312B /* Build configuration list for PBXNativeTarget "DevLog_Unit" */;
128+
buildPhases = (
129+
DF3416462E45F67C00F9312B /* Sources */,
130+
DF3416472E45F67C00F9312B /* Frameworks */,
131+
DF3416482E45F67C00F9312B /* Resources */,
132+
);
133+
buildRules = (
134+
);
135+
dependencies = (
136+
DF34164C2E45F67C00F9312B /* PBXTargetDependency */,
137+
);
138+
fileSystemSynchronizedGroups = (
139+
DF34164A2E45F67C00F9312B /* DevLog_Unit */,
140+
);
141+
name = DevLog_Unit;
142+
packageProductDependencies = (
143+
);
144+
productName = DevLog_Unit;
145+
productReference = DF3416492E45F67C00F9312B /* DevLog_Unit.xctest */;
146+
productType = "com.apple.product-type.bundle.unit-test";
147+
};
100148
DFD48AFF2DC4D6E2005905C5 /* DevLog */ = {
101149
isa = PBXNativeTarget;
102150
buildConfigurationList = DFD48B112DC4D6E4005905C5 /* Build configuration list for PBXNativeTarget "DevLog" */;
@@ -139,6 +187,10 @@
139187
LastSwiftUpdateCheck = 1640;
140188
LastUpgradeCheck = 2600;
141189
TargetAttributes = {
190+
DF3416442E45F67C00F9312B = {
191+
CreatedOnToolsVersion = 16.3;
192+
TestTargetID = DFD48AFF2DC4D6E2005905C5;
193+
};
142194
DFD48AFF2DC4D6E2005905C5 = {
143195
CreatedOnToolsVersion = 16.3;
144196
};
@@ -165,12 +217,20 @@
165217
projectDirPath = "";
166218
projectRoot = "";
167219
targets = (
220+
DF3416442E45F67C00F9312B /* DevLog_Unit */,
168221
DFD48AFF2DC4D6E2005905C5 /* DevLog */,
169222
);
170223
};
171224
/* End PBXProject section */
172225

173226
/* Begin PBXResourcesBuildPhase section */
227+
DF3416482E45F67C00F9312B /* Resources */ = {
228+
isa = PBXResourcesBuildPhase;
229+
buildActionMask = 2147483647;
230+
files = (
231+
);
232+
runOnlyForDeploymentPostprocessing = 0;
233+
};
174234
DFD48AFE2DC4D6E2005905C5 /* Resources */ = {
175235
isa = PBXResourcesBuildPhase;
176236
buildActionMask = 2147483647;
@@ -183,6 +243,13 @@
183243
/* End PBXResourcesBuildPhase section */
184244

185245
/* Begin PBXSourcesBuildPhase section */
246+
DF3416462E45F67C00F9312B /* Sources */ = {
247+
isa = PBXSourcesBuildPhase;
248+
buildActionMask = 2147483647;
249+
files = (
250+
);
251+
runOnlyForDeploymentPostprocessing = 0;
252+
};
186253
DFD48AFC2DC4D6E2005905C5 /* Sources */ = {
187254
isa = PBXSourcesBuildPhase;
188255
buildActionMask = 2147483647;
@@ -193,13 +260,68 @@
193260
/* End PBXSourcesBuildPhase section */
194261

195262
/* Begin PBXTargetDependency section */
263+
DF34164C2E45F67C00F9312B /* PBXTargetDependency */ = {
264+
isa = PBXTargetDependency;
265+
target = DFD48AFF2DC4D6E2005905C5 /* DevLog */;
266+
targetProxy = DF34164B2E45F67C00F9312B /* PBXContainerItemProxy */;
267+
};
196268
DF66A07D2EA52E9F0098E643 /* PBXTargetDependency */ = {
197269
isa = PBXTargetDependency;
198270
productRef = DF66A07C2EA52E9F0098E643 /* SwiftLintBuildToolPlugin */;
199271
};
200272
/* End PBXTargetDependency section */
201273

202274
/* Begin XCBuildConfiguration section */
275+
DF34164D2E45F67C00F9312B /* Debug */ = {
276+
isa = XCBuildConfiguration;
277+
buildSettings = {
278+
BUNDLE_LOADER = "$(TEST_HOST)";
279+
CODE_SIGN_STYLE = Automatic;
280+
CURRENT_PROJECT_VERSION = 1;
281+
DEVELOPMENT_TEAM = 4CPC6N38WA;
282+
GENERATE_INFOPLIST_FILE = YES;
283+
IPHONEOS_DEPLOYMENT_TARGET = 17;
284+
MARKETING_VERSION = 1.0;
285+
PRODUCT_BUNDLE_IDENTIFIER = opfic.DevLog_Unit;
286+
PRODUCT_NAME = "$(TARGET_NAME)";
287+
STRING_CATALOG_GENERATE_SYMBOLS = NO;
288+
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
289+
SUPPORTS_MACCATALYST = NO;
290+
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
291+
SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO;
292+
SWIFT_EMIT_LOC_STRINGS = NO;
293+
SWIFT_VERSION = 5.0;
294+
TARGETED_DEVICE_FAMILY = 1;
295+
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/DevLog.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/DevLog";
296+
TEST_TARGET_NAME = DevLog;
297+
};
298+
name = Debug;
299+
};
300+
DF34164E2E45F67C00F9312B /* Release */ = {
301+
isa = XCBuildConfiguration;
302+
buildSettings = {
303+
BUNDLE_LOADER = "$(TEST_HOST)";
304+
CODE_SIGN_STYLE = Automatic;
305+
CURRENT_PROJECT_VERSION = 1;
306+
DEVELOPMENT_TEAM = 4CPC6N38WA;
307+
GENERATE_INFOPLIST_FILE = YES;
308+
IPHONEOS_DEPLOYMENT_TARGET = 17;
309+
MARKETING_VERSION = 1.0;
310+
PRODUCT_BUNDLE_IDENTIFIER = opfic.DevLog_Unit;
311+
PRODUCT_NAME = "$(TARGET_NAME)";
312+
STRING_CATALOG_GENERATE_SYMBOLS = NO;
313+
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
314+
SUPPORTS_MACCATALYST = NO;
315+
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
316+
SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO;
317+
SWIFT_EMIT_LOC_STRINGS = NO;
318+
SWIFT_VERSION = 5.0;
319+
TARGETED_DEVICE_FAMILY = 1;
320+
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/DevLog.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/DevLog";
321+
TEST_TARGET_NAME = DevLog;
322+
};
323+
name = Release;
324+
};
203325
DFD48B122DC4D6E4005905C5 /* Debug */ = {
204326
isa = XCBuildConfiguration;
205327
baseConfigurationReferenceAnchor = DF8AB7982E938B0B00E50BBF /* DevLog */;
@@ -426,6 +548,15 @@
426548
/* End XCBuildConfiguration section */
427549

428550
/* Begin XCConfigurationList section */
551+
DF3416452E45F67C00F9312B /* Build configuration list for PBXNativeTarget "DevLog_Unit" */ = {
552+
isa = XCConfigurationList;
553+
buildConfigurations = (
554+
DF34164D2E45F67C00F9312B /* Debug */,
555+
DF34164E2E45F67C00F9312B /* Release */,
556+
);
557+
defaultConfigurationIsVisible = 0;
558+
defaultConfigurationName = Release;
559+
};
429560
DFD48AFB2DC4D6E2005905C5 /* Build configuration list for PBXProject "DevLog" */ = {
430561
isa = XCConfigurationList;
431562
buildConfigurations = (

DevLog.xcodeproj/xcshareddata/xcschemes/DevLog.xcscheme

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,19 @@
2929
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
3030
shouldUseLaunchSchemeArgsEnv = "YES"
3131
shouldAutocreateTestPlan = "YES">
32+
<Testables>
33+
<TestableReference
34+
skipped = "NO"
35+
parallelizable = "YES">
36+
<BuildableReference
37+
BuildableIdentifier = "primary"
38+
BlueprintIdentifier = "DF3416442E45F67C00F9312B"
39+
BuildableName = "DevLog_Unit.xctest"
40+
BlueprintName = "DevLog_Unit"
41+
ReferencedContainer = "container:DevLog.xcodeproj">
42+
</BuildableReference>
43+
</TestableReference>
44+
</Testables>
3245
</TestAction>
3346
<LaunchAction
3447
buildConfiguration = "Debug"

DevLog.xcodeproj/xcshareddata/xcschemes/DevLog_Unit.xcscheme

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,32 @@
3737
debugDocumentVersioning = "YES"
3838
debugServiceExtension = "internal"
3939
allowLocationSimulation = "YES">
40+
<BuildableProductRunnable
41+
runnableDebuggingMode = "0">
42+
<BuildableReference
43+
BuildableIdentifier = "primary"
44+
BlueprintIdentifier = "DFD48AFF2DC4D6E2005905C5"
45+
BuildableName = "DevLog.app"
46+
BlueprintName = "DevLog"
47+
ReferencedContainer = "container:DevLog.xcodeproj">
48+
</BuildableReference>
49+
</BuildableProductRunnable>
4050
</LaunchAction>
4151
<ProfileAction
4252
buildConfiguration = "Release"
4353
shouldUseLaunchSchemeArgsEnv = "YES"
4454
savedToolIdentifier = ""
4555
useCustomWorkingDirectory = "NO"
4656
debugDocumentVersioning = "YES">
57+
<MacroExpansion>
58+
<BuildableReference
59+
BuildableIdentifier = "primary"
60+
BlueprintIdentifier = "DFD48AFF2DC4D6E2005905C5"
61+
BuildableName = "DevLog.app"
62+
BlueprintName = "DevLog"
63+
ReferencedContainer = "container:DevLog.xcodeproj">
64+
</BuildableReference>
65+
</MacroExpansion>
4766
</ProfileAction>
4867
<AnalyzeAction
4968
buildConfiguration = "Debug">

DevLog/Infra/Service/PushNotificationService.swift

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -193,9 +193,7 @@ final class PushNotificationService {
193193
}
194194

195195
guard let snapshot else { return }
196-
let unreadPushCount = snapshot.documents.filter { document in
197-
!(document.data()[PushNotificationFieldKey.deletingAt.rawValue] is Timestamp)
198-
}.count
196+
let unreadPushCount = snapshot.documents.count
199197
subject.send(unreadPushCount)
200198
}
201199

@@ -304,8 +302,7 @@ private extension PushNotificationService {
304302

305303
func makeResponse(from snapshot: QueryDocumentSnapshot) -> PushNotificationResponse? {
306304
let data = snapshot.data()
307-
if data[PushNotificationFieldKey.deletingAt.rawValue] is Timestamp ||
308-
(data[PushNotificationFieldKey.isDeleted.rawValue] as? Bool) == true {
305+
if (data[PushNotificationFieldKey.isDeleted.rawValue] as? Bool) == true {
309306
return nil
310307
}
311308
guard
@@ -336,7 +333,6 @@ private extension PushNotificationService {
336333
case isRead
337334
case todoId
338335
case todoCategory
339-
case deletingAt // 삭제 요청으로 앱의 로컬 데이터에서 deletion이 된 상태
340336
case isDeleted // 삭제 요청으로 서버에서 soft deletion이 된 상태
341337
}
342338
}

DevLog/Infra/Service/WebPageService.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,6 @@ final class WebPageService {
125125
private extension WebPageService {
126126
func makeResponse(from snapshot: QueryDocumentSnapshot) -> WebPageResponse? {
127127
let data = snapshot.data()
128-
if data[WebPageFieldKey.deletingAt.rawValue] is Timestamp {
129-
return nil
130-
}
131128
guard
132129
(data[WebPageFieldKey.isDeleted.rawValue] as? Bool) != true,
133130
let title = data[WebPageFieldKey.title.rawValue] as? String,
@@ -151,7 +148,6 @@ private extension WebPageService {
151148
case url
152149
case displayURL
153150
case imageURL
154-
case deletingAt // 삭제 요청으로 앱의 로컬 데이터에서 deletion이 된 상태
155151
case isDeleted // 삭제 요청으로 서버에서 soft deletion이 된 상태
156152
}
157153
}

0 commit comments

Comments
 (0)