diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 551a3f5..0000000 --- a/.gitignore +++ /dev/null @@ -1,70 +0,0 @@ -### macOS ### -# General -.DS_Store -.AppleDouble -.LSOverride - -# Icon must end with two -Icon - -# Thumbnails -._* - -# Files that might appear in the root of a volume -.DocumentRevisions-V100 -.fseventsd -.Spotlight-V100 -.TemporaryItems -.Trashes -.VolumeIcon.icns -.com.apple.timemachine.donotpresent - -# Directories potentially created on remote AFP share -.AppleDB -.AppleDesktop -Network Trash Folder -Temporary Items -.apdisk - -### Xcode ### -# Xcode -# -# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore - -## User settings -xcuserdata/ - -## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9) -*.xcscmblueprint -*.xccheckout - -## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4) -build/ -DerivedData/ -*.moved-aside -*.pbxuser -!default.pbxuser -*.mode1v3 -!default.mode1v3 -*.mode2v3 -!default.mode2v3 -*.perspectivev3 -!default.perspectivev3 - -### Xcode Patch ### -*.xcodeproj/* -!*.xcodeproj/project.pbxproj -!*.xcodeproj/xcshareddata/ -!*.xcworkspace/contents.xcworkspacedata -/*.gcno - -### Projects ### -*.xcodeproj -*.xcworkspace - -### Tuist derived files ### -graph.dot -Derived/ - -### Tuist managed dependencies ### -Tuist/Dependencies diff --git a/CMC/Resources/Assets.xcassets/AppIcon.appiconset/1024.png b/CMC/Resources/Assets.xcassets/AppIcon.appiconset/1024.png deleted file mode 100644 index e239f14..0000000 Binary files a/CMC/Resources/Assets.xcassets/AppIcon.appiconset/1024.png and /dev/null differ diff --git a/CMC/Resources/Assets.xcassets/AppIcon.appiconset/Contents.json b/CMC/Resources/Assets.xcassets/AppIcon.appiconset/Contents.json deleted file mode 100644 index cff1680..0000000 --- a/CMC/Resources/Assets.xcassets/AppIcon.appiconset/Contents.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "images" : [ - { - "filename" : "1024.png", - "idiom" : "universal", - "platform" : "ios", - "size" : "1024x1024" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/CMC/Resources/Assets.xcassets/Colors/Background/Contents.json b/CMC/Resources/Assets.xcassets/Colors/Background/Contents.json deleted file mode 100644 index 73c0059..0000000 --- a/CMC/Resources/Assets.xcassets/Colors/Background/Contents.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/CMC/Resources/Assets.xcassets/Colors/Background/background.colorset/Contents.json b/CMC/Resources/Assets.xcassets/Colors/Background/background.colorset/Contents.json deleted file mode 100644 index 77ed054..0000000 --- a/CMC/Resources/Assets.xcassets/Colors/Background/background.colorset/Contents.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "colors" : [ - { - "color" : { - "color-space" : "srgb", - "components" : { - "alpha" : "1.000", - "blue" : "0x30", - "green" : "0x1B", - "red" : "0x1D" - } - }, - "idiom" : "iphone" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/CMC/Resources/Assets.xcassets/Colors/Contents.json b/CMC/Resources/Assets.xcassets/Colors/Contents.json deleted file mode 100644 index 73c0059..0000000 --- a/CMC/Resources/Assets.xcassets/Colors/Contents.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/CMC/Resources/Assets.xcassets/Colors/Gray/Contents.json b/CMC/Resources/Assets.xcassets/Colors/Gray/Contents.json deleted file mode 100644 index 73c0059..0000000 --- a/CMC/Resources/Assets.xcassets/Colors/Gray/Contents.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/CMC/Resources/Assets.xcassets/Colors/Gray/black_1.colorset/Contents.json b/CMC/Resources/Assets.xcassets/Colors/Gray/black_1.colorset/Contents.json deleted file mode 100644 index e4ab099..0000000 --- a/CMC/Resources/Assets.xcassets/Colors/Gray/black_1.colorset/Contents.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "colors" : [ - { - "color" : { - "color-space" : "srgb", - "components" : { - "alpha" : "1.000", - "blue" : "0x12", - "green" : "0x12", - "red" : "0x12" - } - }, - "idiom" : "iphone" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/CMC/Resources/Assets.xcassets/Colors/Gray/gray_100.colorset/Contents.json b/CMC/Resources/Assets.xcassets/Colors/Gray/gray_100.colorset/Contents.json deleted file mode 100644 index 6b98285..0000000 --- a/CMC/Resources/Assets.xcassets/Colors/Gray/gray_100.colorset/Contents.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "colors" : [ - { - "color" : { - "color-space" : "srgb", - "components" : { - "alpha" : "1.000", - "blue" : "0xFA", - "green" : "0xFA", - "red" : "0xFA" - } - }, - "idiom" : "iphone" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/CMC/Resources/Assets.xcassets/Colors/Gray/gray_200.colorset/Contents.json b/CMC/Resources/Assets.xcassets/Colors/Gray/gray_200.colorset/Contents.json deleted file mode 100644 index 413e8ad..0000000 --- a/CMC/Resources/Assets.xcassets/Colors/Gray/gray_200.colorset/Contents.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "colors" : [ - { - "color" : { - "color-space" : "srgb", - "components" : { - "alpha" : "1.000", - "blue" : "0xF8", - "green" : "0xF8", - "red" : "0xF8" - } - }, - "idiom" : "iphone" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/CMC/Resources/Assets.xcassets/Colors/Gray/gray_300.colorset/Contents.json b/CMC/Resources/Assets.xcassets/Colors/Gray/gray_300.colorset/Contents.json deleted file mode 100644 index 7aad962..0000000 --- a/CMC/Resources/Assets.xcassets/Colors/Gray/gray_300.colorset/Contents.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "colors" : [ - { - "color" : { - "color-space" : "srgb", - "components" : { - "alpha" : "1.000", - "blue" : "0xF0", - "green" : "0xF0", - "red" : "0xF0" - } - }, - "idiom" : "iphone" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/CMC/Resources/Assets.xcassets/Colors/Gray/gray_400.colorset/Contents.json b/CMC/Resources/Assets.xcassets/Colors/Gray/gray_400.colorset/Contents.json deleted file mode 100644 index 66f1d01..0000000 --- a/CMC/Resources/Assets.xcassets/Colors/Gray/gray_400.colorset/Contents.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "colors" : [ - { - "color" : { - "color-space" : "srgb", - "components" : { - "alpha" : "1.000", - "blue" : "0xDE", - "green" : "0xDE", - "red" : "0xDE" - } - }, - "idiom" : "iphone" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/CMC/Resources/Assets.xcassets/Colors/Gray/gray_50.colorset/Contents.json b/CMC/Resources/Assets.xcassets/Colors/Gray/gray_50.colorset/Contents.json deleted file mode 100644 index 56b2a2c..0000000 --- a/CMC/Resources/Assets.xcassets/Colors/Gray/gray_50.colorset/Contents.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "colors" : [ - { - "color" : { - "color-space" : "srgb", - "components" : { - "alpha" : "1.000", - "blue" : "0xFF", - "green" : "0xFF", - "red" : "0xFF" - } - }, - "idiom" : "iphone" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/CMC/Resources/Assets.xcassets/Colors/Gray/gray_500.colorset/Contents.json b/CMC/Resources/Assets.xcassets/Colors/Gray/gray_500.colorset/Contents.json deleted file mode 100644 index 924e907..0000000 --- a/CMC/Resources/Assets.xcassets/Colors/Gray/gray_500.colorset/Contents.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "colors" : [ - { - "color" : { - "color-space" : "srgb", - "components" : { - "alpha" : "1.000", - "blue" : "0xC1", - "green" : "0xBF", - "red" : "0xBD" - } - }, - "idiom" : "iphone" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/CMC/Resources/Assets.xcassets/Colors/Gray/gray_600.colorset/Contents.json b/CMC/Resources/Assets.xcassets/Colors/Gray/gray_600.colorset/Contents.json deleted file mode 100644 index 94f32fa..0000000 --- a/CMC/Resources/Assets.xcassets/Colors/Gray/gray_600.colorset/Contents.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "colors" : [ - { - "color" : { - "color-space" : "srgb", - "components" : { - "alpha" : "1.000", - "blue" : "0x97", - "green" : "0x93", - "red" : "0x90" - } - }, - "idiom" : "iphone" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/CMC/Resources/Assets.xcassets/Colors/Gray/gray_700.colorset/Contents.json b/CMC/Resources/Assets.xcassets/Colors/Gray/gray_700.colorset/Contents.json deleted file mode 100644 index 8ed215b..0000000 --- a/CMC/Resources/Assets.xcassets/Colors/Gray/gray_700.colorset/Contents.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "colors" : [ - { - "color" : { - "color-space" : "srgb", - "components" : { - "alpha" : "1.000", - "blue" : "0x83", - "green" : "0x7F", - "red" : "0x7B" - } - }, - "idiom" : "iphone" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/CMC/Resources/Assets.xcassets/Colors/Gray/gray_800.colorset/Contents.json b/CMC/Resources/Assets.xcassets/Colors/Gray/gray_800.colorset/Contents.json deleted file mode 100644 index 0af6d48..0000000 --- a/CMC/Resources/Assets.xcassets/Colors/Gray/gray_800.colorset/Contents.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "colors" : [ - { - "color" : { - "color-space" : "srgb", - "components" : { - "alpha" : "1.000", - "blue" : "0x4A", - "green" : "0x2A", - "red" : "0x2C" - } - }, - "idiom" : "iphone" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/CMC/Resources/Assets.xcassets/Colors/Gray/gray_900.colorset/Contents.json b/CMC/Resources/Assets.xcassets/Colors/Gray/gray_900.colorset/Contents.json deleted file mode 100644 index c26ac05..0000000 --- a/CMC/Resources/Assets.xcassets/Colors/Gray/gray_900.colorset/Contents.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "colors" : [ - { - "color" : { - "color-space" : "srgb", - "components" : { - "alpha" : "1.000", - "blue" : "0x39", - "green" : "0x23", - "red" : "0x24" - } - }, - "idiom" : "iphone" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/CMC/Resources/Assets.xcassets/Colors/Main/Contents.json b/CMC/Resources/Assets.xcassets/Colors/Main/Contents.json deleted file mode 100644 index 73c0059..0000000 --- a/CMC/Resources/Assets.xcassets/Colors/Main/Contents.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/CMC/Resources/Assets.xcassets/Colors/Main/main_1.colorset/Contents.json b/CMC/Resources/Assets.xcassets/Colors/Main/main_1.colorset/Contents.json deleted file mode 100644 index c8ed478..0000000 --- a/CMC/Resources/Assets.xcassets/Colors/Main/main_1.colorset/Contents.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "colors" : [ - { - "color" : { - "color-space" : "srgb", - "components" : { - "alpha" : "1.000", - "blue" : "0xFF", - "green" : "0x5D", - "red" : "0x61" - } - }, - "idiom" : "iphone" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/CMC/Resources/Assets.xcassets/Colors/Symantic/Contents.json b/CMC/Resources/Assets.xcassets/Colors/Symantic/Contents.json deleted file mode 100644 index 73c0059..0000000 --- a/CMC/Resources/Assets.xcassets/Colors/Symantic/Contents.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/CMC/Resources/Assets.xcassets/Colors/Symantic/error.colorset/Contents.json b/CMC/Resources/Assets.xcassets/Colors/Symantic/error.colorset/Contents.json deleted file mode 100644 index b6e425e..0000000 --- a/CMC/Resources/Assets.xcassets/Colors/Symantic/error.colorset/Contents.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "colors" : [ - { - "color" : { - "color-space" : "srgb", - "components" : { - "alpha" : "1.000", - "blue" : "0x33", - "green" : "0x26", - "red" : "0xFF" - } - }, - "idiom" : "iphone" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/CMC/Resources/Assets.xcassets/Components/16x16/16x16arrowLeft.imageset/Contents.json b/CMC/Resources/Assets.xcassets/Components/16x16/16x16arrowLeft.imageset/Contents.json deleted file mode 100644 index 73c66d3..0000000 --- a/CMC/Resources/Assets.xcassets/Components/16x16/16x16arrowLeft.imageset/Contents.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "images" : [ - { - "filename" : "ic_arrow_left (1).png", - "idiom" : "universal", - "scale" : "1x" - }, - { - "filename" : "ic_arrow_left (1)@2x.png", - "idiom" : "universal", - "scale" : "2x" - }, - { - "filename" : "ic_arrow_left (1)@3x.png", - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/CMC/Resources/Assets.xcassets/Components/16x16/16x16arrowLeft.imageset/ic_arrow_left (1).png b/CMC/Resources/Assets.xcassets/Components/16x16/16x16arrowLeft.imageset/ic_arrow_left (1).png deleted file mode 100644 index fba27c2..0000000 Binary files a/CMC/Resources/Assets.xcassets/Components/16x16/16x16arrowLeft.imageset/ic_arrow_left (1).png and /dev/null differ diff --git a/CMC/Resources/Assets.xcassets/Components/16x16/16x16arrowLeft.imageset/ic_arrow_left (1)@2x.png b/CMC/Resources/Assets.xcassets/Components/16x16/16x16arrowLeft.imageset/ic_arrow_left (1)@2x.png deleted file mode 100644 index d070ded..0000000 Binary files a/CMC/Resources/Assets.xcassets/Components/16x16/16x16arrowLeft.imageset/ic_arrow_left (1)@2x.png and /dev/null differ diff --git a/CMC/Resources/Assets.xcassets/Components/16x16/16x16arrowLeft.imageset/ic_arrow_left (1)@3x.png b/CMC/Resources/Assets.xcassets/Components/16x16/16x16arrowLeft.imageset/ic_arrow_left (1)@3x.png deleted file mode 100644 index b7149f8..0000000 Binary files a/CMC/Resources/Assets.xcassets/Components/16x16/16x16arrowLeft.imageset/ic_arrow_left (1)@3x.png and /dev/null differ diff --git a/CMC/Resources/Assets.xcassets/Components/16x16/Contents.json b/CMC/Resources/Assets.xcassets/Components/16x16/Contents.json deleted file mode 100644 index 73c0059..0000000 --- a/CMC/Resources/Assets.xcassets/Components/16x16/Contents.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/CMC/Resources/Assets.xcassets/Components/18x18/18x18check.imageset/Contents.json b/CMC/Resources/Assets.xcassets/Components/18x18/18x18check.imageset/Contents.json deleted file mode 100644 index a973a54..0000000 --- a/CMC/Resources/Assets.xcassets/Components/18x18/18x18check.imageset/Contents.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "images" : [ - { - "filename" : "Frame 2608252.png", - "idiom" : "universal", - "scale" : "1x" - }, - { - "filename" : "Frame 2608252@2x.png", - "idiom" : "universal", - "scale" : "2x" - }, - { - "filename" : "Frame 2608252@3x.png", - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/CMC/Resources/Assets.xcassets/Components/18x18/18x18check.imageset/Frame 2608252.png b/CMC/Resources/Assets.xcassets/Components/18x18/18x18check.imageset/Frame 2608252.png deleted file mode 100644 index 38c2e12..0000000 Binary files a/CMC/Resources/Assets.xcassets/Components/18x18/18x18check.imageset/Frame 2608252.png and /dev/null differ diff --git a/CMC/Resources/Assets.xcassets/Components/18x18/18x18check.imageset/Frame 2608252@2x.png b/CMC/Resources/Assets.xcassets/Components/18x18/18x18check.imageset/Frame 2608252@2x.png deleted file mode 100644 index 10b058a..0000000 Binary files a/CMC/Resources/Assets.xcassets/Components/18x18/18x18check.imageset/Frame 2608252@2x.png and /dev/null differ diff --git a/CMC/Resources/Assets.xcassets/Components/18x18/18x18check.imageset/Frame 2608252@3x.png b/CMC/Resources/Assets.xcassets/Components/18x18/18x18check.imageset/Frame 2608252@3x.png deleted file mode 100644 index 8c498b0..0000000 Binary files a/CMC/Resources/Assets.xcassets/Components/18x18/18x18check.imageset/Frame 2608252@3x.png and /dev/null differ diff --git a/CMC/Resources/Assets.xcassets/Components/18x18/18x18checkDisabled.imageset/Contents.json b/CMC/Resources/Assets.xcassets/Components/18x18/18x18checkDisabled.imageset/Contents.json deleted file mode 100644 index c920e9c..0000000 --- a/CMC/Resources/Assets.xcassets/Components/18x18/18x18checkDisabled.imageset/Contents.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "images" : [ - { - "filename" : "Frame 2608252 (1).png", - "idiom" : "universal", - "scale" : "1x" - }, - { - "filename" : "Frame 2608252 (1)@2x.png", - "idiom" : "universal", - "scale" : "2x" - }, - { - "filename" : "Frame 2608252 (1)@3x.png", - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/CMC/Resources/Assets.xcassets/Components/18x18/18x18checkDisabled.imageset/Frame 2608252 (1).png b/CMC/Resources/Assets.xcassets/Components/18x18/18x18checkDisabled.imageset/Frame 2608252 (1).png deleted file mode 100644 index b2e6e14..0000000 Binary files a/CMC/Resources/Assets.xcassets/Components/18x18/18x18checkDisabled.imageset/Frame 2608252 (1).png and /dev/null differ diff --git a/CMC/Resources/Assets.xcassets/Components/18x18/18x18checkDisabled.imageset/Frame 2608252 (1)@2x.png b/CMC/Resources/Assets.xcassets/Components/18x18/18x18checkDisabled.imageset/Frame 2608252 (1)@2x.png deleted file mode 100644 index e6e9f88..0000000 Binary files a/CMC/Resources/Assets.xcassets/Components/18x18/18x18checkDisabled.imageset/Frame 2608252 (1)@2x.png and /dev/null differ diff --git a/CMC/Resources/Assets.xcassets/Components/18x18/18x18checkDisabled.imageset/Frame 2608252 (1)@3x.png b/CMC/Resources/Assets.xcassets/Components/18x18/18x18checkDisabled.imageset/Frame 2608252 (1)@3x.png deleted file mode 100644 index 15499d8..0000000 Binary files a/CMC/Resources/Assets.xcassets/Components/18x18/18x18checkDisabled.imageset/Frame 2608252 (1)@3x.png and /dev/null differ diff --git a/CMC/Resources/Assets.xcassets/Components/18x18/Contents.json b/CMC/Resources/Assets.xcassets/Components/18x18/Contents.json deleted file mode 100644 index 73c0059..0000000 --- a/CMC/Resources/Assets.xcassets/Components/18x18/Contents.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/CMC/Resources/Assets.xcassets/Components/24x24/24x24abled.imageset/Contents.json b/CMC/Resources/Assets.xcassets/Components/24x24/24x24abled.imageset/Contents.json deleted file mode 100644 index c2c9322..0000000 --- a/CMC/Resources/Assets.xcassets/Components/24x24/24x24abled.imageset/Contents.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "images" : [ - { - "filename" : "ic_abled.png", - "idiom" : "universal", - "scale" : "1x" - }, - { - "filename" : "ic_abled@2x.png", - "idiom" : "universal", - "scale" : "2x" - }, - { - "filename" : "ic_abled@3x.png", - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/CMC/Resources/Assets.xcassets/Components/24x24/24x24abled.imageset/ic_abled.png b/CMC/Resources/Assets.xcassets/Components/24x24/24x24abled.imageset/ic_abled.png deleted file mode 100644 index bc33126..0000000 Binary files a/CMC/Resources/Assets.xcassets/Components/24x24/24x24abled.imageset/ic_abled.png and /dev/null differ diff --git a/CMC/Resources/Assets.xcassets/Components/24x24/24x24abled.imageset/ic_abled@2x.png b/CMC/Resources/Assets.xcassets/Components/24x24/24x24abled.imageset/ic_abled@2x.png deleted file mode 100644 index 6b587bc..0000000 Binary files a/CMC/Resources/Assets.xcassets/Components/24x24/24x24abled.imageset/ic_abled@2x.png and /dev/null differ diff --git a/CMC/Resources/Assets.xcassets/Components/24x24/24x24abled.imageset/ic_abled@3x.png b/CMC/Resources/Assets.xcassets/Components/24x24/24x24abled.imageset/ic_abled@3x.png deleted file mode 100644 index 4ebeeb3..0000000 Binary files a/CMC/Resources/Assets.xcassets/Components/24x24/24x24abled.imageset/ic_abled@3x.png and /dev/null differ diff --git a/CMC/Resources/Assets.xcassets/Components/24x24/24x24arrowLeft.imageset/24x24arrowLeft@1x.png b/CMC/Resources/Assets.xcassets/Components/24x24/24x24arrowLeft.imageset/24x24arrowLeft@1x.png deleted file mode 100644 index 546b16c..0000000 Binary files a/CMC/Resources/Assets.xcassets/Components/24x24/24x24arrowLeft.imageset/24x24arrowLeft@1x.png and /dev/null differ diff --git a/CMC/Resources/Assets.xcassets/Components/24x24/24x24arrowLeft.imageset/24x24arrowLeft@2x.png b/CMC/Resources/Assets.xcassets/Components/24x24/24x24arrowLeft.imageset/24x24arrowLeft@2x.png deleted file mode 100644 index f5bf9ff..0000000 Binary files a/CMC/Resources/Assets.xcassets/Components/24x24/24x24arrowLeft.imageset/24x24arrowLeft@2x.png and /dev/null differ diff --git a/CMC/Resources/Assets.xcassets/Components/24x24/24x24arrowLeft.imageset/24x24arrowLeft@3x.png b/CMC/Resources/Assets.xcassets/Components/24x24/24x24arrowLeft.imageset/24x24arrowLeft@3x.png deleted file mode 100644 index f95e27c..0000000 Binary files a/CMC/Resources/Assets.xcassets/Components/24x24/24x24arrowLeft.imageset/24x24arrowLeft@3x.png and /dev/null differ diff --git a/CMC/Resources/Assets.xcassets/Components/24x24/24x24arrowLeft.imageset/Contents.json b/CMC/Resources/Assets.xcassets/Components/24x24/24x24arrowLeft.imageset/Contents.json deleted file mode 100644 index d93184c..0000000 --- a/CMC/Resources/Assets.xcassets/Components/24x24/24x24arrowLeft.imageset/Contents.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "images" : [ - { - "filename" : "24x24arrowLeft@1x.png", - "idiom" : "universal", - "scale" : "1x" - }, - { - "filename" : "24x24arrowLeft@2x.png", - "idiom" : "universal", - "scale" : "2x" - }, - { - "filename" : "24x24arrowLeft@3x.png", - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/CMC/Resources/Assets.xcassets/Components/24x24/24x24disabled.imageset/Contents.json b/CMC/Resources/Assets.xcassets/Components/24x24/24x24disabled.imageset/Contents.json deleted file mode 100644 index 4f46994..0000000 --- a/CMC/Resources/Assets.xcassets/Components/24x24/24x24disabled.imageset/Contents.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "images" : [ - { - "filename" : "ic_disabled.png", - "idiom" : "universal", - "scale" : "1x" - }, - { - "filename" : "ic_disabled@2x.png", - "idiom" : "universal", - "scale" : "2x" - }, - { - "filename" : "ic_disabled@3x.png", - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/CMC/Resources/Assets.xcassets/Components/24x24/24x24disabled.imageset/ic_disabled.png b/CMC/Resources/Assets.xcassets/Components/24x24/24x24disabled.imageset/ic_disabled.png deleted file mode 100644 index e131f70..0000000 Binary files a/CMC/Resources/Assets.xcassets/Components/24x24/24x24disabled.imageset/ic_disabled.png and /dev/null differ diff --git a/CMC/Resources/Assets.xcassets/Components/24x24/24x24disabled.imageset/ic_disabled@2x.png b/CMC/Resources/Assets.xcassets/Components/24x24/24x24disabled.imageset/ic_disabled@2x.png deleted file mode 100644 index 3819769..0000000 Binary files a/CMC/Resources/Assets.xcassets/Components/24x24/24x24disabled.imageset/ic_disabled@2x.png and /dev/null differ diff --git a/CMC/Resources/Assets.xcassets/Components/24x24/24x24disabled.imageset/ic_disabled@3x.png b/CMC/Resources/Assets.xcassets/Components/24x24/24x24disabled.imageset/ic_disabled@3x.png deleted file mode 100644 index 8b3bb32..0000000 Binary files a/CMC/Resources/Assets.xcassets/Components/24x24/24x24disabled.imageset/ic_disabled@3x.png and /dev/null differ diff --git a/CMC/Resources/Assets.xcassets/Components/24x24/24x24dropDown.imageset/24x24dropDown.png b/CMC/Resources/Assets.xcassets/Components/24x24/24x24dropDown.imageset/24x24dropDown.png deleted file mode 100644 index 6967ce2..0000000 Binary files a/CMC/Resources/Assets.xcassets/Components/24x24/24x24dropDown.imageset/24x24dropDown.png and /dev/null differ diff --git a/CMC/Resources/Assets.xcassets/Components/24x24/24x24dropDown.imageset/24x24dropDown@2x.png b/CMC/Resources/Assets.xcassets/Components/24x24/24x24dropDown.imageset/24x24dropDown@2x.png deleted file mode 100644 index c2e07a4..0000000 Binary files a/CMC/Resources/Assets.xcassets/Components/24x24/24x24dropDown.imageset/24x24dropDown@2x.png and /dev/null differ diff --git a/CMC/Resources/Assets.xcassets/Components/24x24/24x24dropDown.imageset/24x24dropDown@3x.png b/CMC/Resources/Assets.xcassets/Components/24x24/24x24dropDown.imageset/24x24dropDown@3x.png deleted file mode 100644 index ffae7e5..0000000 Binary files a/CMC/Resources/Assets.xcassets/Components/24x24/24x24dropDown.imageset/24x24dropDown@3x.png and /dev/null differ diff --git a/CMC/Resources/Assets.xcassets/Components/24x24/24x24dropDown.imageset/Contents 2.json b/CMC/Resources/Assets.xcassets/Components/24x24/24x24dropDown.imageset/Contents 2.json deleted file mode 100644 index 02bf8c9..0000000 --- a/CMC/Resources/Assets.xcassets/Components/24x24/24x24dropDown.imageset/Contents 2.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "images" : [ - { - "filename" : "24x24dropDown.png", - "idiom" : "universal", - "scale" : "1x" - }, - { - "filename" : "24x24dropDown@2x.png", - "idiom" : "universal", - "scale" : "2x" - }, - { - "filename" : "24x24dropDown@3x.png", - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/CMC/Resources/Assets.xcassets/Components/24x24/24x24dropDown.imageset/Contents.json b/CMC/Resources/Assets.xcassets/Components/24x24/24x24dropDown.imageset/Contents.json deleted file mode 100644 index 02bf8c9..0000000 --- a/CMC/Resources/Assets.xcassets/Components/24x24/24x24dropDown.imageset/Contents.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "images" : [ - { - "filename" : "24x24dropDown.png", - "idiom" : "universal", - "scale" : "1x" - }, - { - "filename" : "24x24dropDown@2x.png", - "idiom" : "universal", - "scale" : "2x" - }, - { - "filename" : "24x24dropDown@3x.png", - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/CMC/Resources/Assets.xcassets/Components/24x24/24x24hide.imageset/Contents.json b/CMC/Resources/Assets.xcassets/Components/24x24/24x24hide.imageset/Contents.json deleted file mode 100644 index 630ba64..0000000 --- a/CMC/Resources/Assets.xcassets/Components/24x24/24x24hide.imageset/Contents.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "images" : [ - { - "filename" : "ic_hide.png", - "idiom" : "universal", - "scale" : "1x" - }, - { - "filename" : "ic_hide@2x.png", - "idiom" : "universal", - "scale" : "2x" - }, - { - "filename" : "ic_hide@3x.png", - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/CMC/Resources/Assets.xcassets/Components/24x24/24x24hide.imageset/ic_hide.png b/CMC/Resources/Assets.xcassets/Components/24x24/24x24hide.imageset/ic_hide.png deleted file mode 100644 index 3eb2816..0000000 Binary files a/CMC/Resources/Assets.xcassets/Components/24x24/24x24hide.imageset/ic_hide.png and /dev/null differ diff --git a/CMC/Resources/Assets.xcassets/Components/24x24/24x24hide.imageset/ic_hide@2x.png b/CMC/Resources/Assets.xcassets/Components/24x24/24x24hide.imageset/ic_hide@2x.png deleted file mode 100644 index 16e235b..0000000 Binary files a/CMC/Resources/Assets.xcassets/Components/24x24/24x24hide.imageset/ic_hide@2x.png and /dev/null differ diff --git a/CMC/Resources/Assets.xcassets/Components/24x24/24x24hide.imageset/ic_hide@3x.png b/CMC/Resources/Assets.xcassets/Components/24x24/24x24hide.imageset/ic_hide@3x.png deleted file mode 100644 index e5adb61..0000000 Binary files a/CMC/Resources/Assets.xcassets/Components/24x24/24x24hide.imageset/ic_hide@3x.png and /dev/null differ diff --git a/CMC/Resources/Assets.xcassets/Components/24x24/24x24show.imageset/Contents.json b/CMC/Resources/Assets.xcassets/Components/24x24/24x24show.imageset/Contents.json deleted file mode 100644 index 7039a32..0000000 --- a/CMC/Resources/Assets.xcassets/Components/24x24/24x24show.imageset/Contents.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "images" : [ - { - "filename" : "ic_show.png", - "idiom" : "universal", - "scale" : "1x" - }, - { - "filename" : "ic_show@2x.png", - "idiom" : "universal", - "scale" : "2x" - }, - { - "filename" : "ic_show@3x.png", - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/CMC/Resources/Assets.xcassets/Components/24x24/24x24show.imageset/ic_show.png b/CMC/Resources/Assets.xcassets/Components/24x24/24x24show.imageset/ic_show.png deleted file mode 100644 index bb99a75..0000000 Binary files a/CMC/Resources/Assets.xcassets/Components/24x24/24x24show.imageset/ic_show.png and /dev/null differ diff --git a/CMC/Resources/Assets.xcassets/Components/24x24/24x24show.imageset/ic_show@2x.png b/CMC/Resources/Assets.xcassets/Components/24x24/24x24show.imageset/ic_show@2x.png deleted file mode 100644 index f73005c..0000000 Binary files a/CMC/Resources/Assets.xcassets/Components/24x24/24x24show.imageset/ic_show@2x.png and /dev/null differ diff --git a/CMC/Resources/Assets.xcassets/Components/24x24/24x24show.imageset/ic_show@3x.png b/CMC/Resources/Assets.xcassets/Components/24x24/24x24show.imageset/ic_show@3x.png deleted file mode 100644 index 518937e..0000000 Binary files a/CMC/Resources/Assets.xcassets/Components/24x24/24x24show.imageset/ic_show@3x.png and /dev/null differ diff --git a/CMC/Resources/Assets.xcassets/Components/24x24/Contents.json b/CMC/Resources/Assets.xcassets/Components/24x24/Contents.json deleted file mode 100644 index 73c0059..0000000 --- a/CMC/Resources/Assets.xcassets/Components/24x24/Contents.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/CMC/Resources/Assets.xcassets/Components/Contents.json b/CMC/Resources/Assets.xcassets/Components/Contents.json deleted file mode 100644 index 73c0059..0000000 --- a/CMC/Resources/Assets.xcassets/Components/Contents.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/CMC/Resources/Assets.xcassets/Contents.json b/CMC/Resources/Assets.xcassets/Contents.json deleted file mode 100644 index 73c0059..0000000 --- a/CMC/Resources/Assets.xcassets/Contents.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/CMC/Resources/Assets.xcassets/SignUpCompleted.imageset/Contents.json b/CMC/Resources/Assets.xcassets/SignUpCompleted.imageset/Contents.json deleted file mode 100644 index a5b4375..0000000 --- a/CMC/Resources/Assets.xcassets/SignUpCompleted.imageset/Contents.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "images" : [ - { - "filename" : "Group 1171275642.png", - "idiom" : "universal", - "scale" : "1x" - }, - { - "filename" : "Group 1171275642@2x.png", - "idiom" : "universal", - "scale" : "2x" - }, - { - "filename" : "Group 1171275642@3x.png", - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/CMC/Resources/Assets.xcassets/SignUpCompleted.imageset/Group 1171275642.png b/CMC/Resources/Assets.xcassets/SignUpCompleted.imageset/Group 1171275642.png deleted file mode 100644 index e1a789d..0000000 Binary files a/CMC/Resources/Assets.xcassets/SignUpCompleted.imageset/Group 1171275642.png and /dev/null differ diff --git a/CMC/Resources/Assets.xcassets/SignUpCompleted.imageset/Group 1171275642@2x.png b/CMC/Resources/Assets.xcassets/SignUpCompleted.imageset/Group 1171275642@2x.png deleted file mode 100644 index 61b9235..0000000 Binary files a/CMC/Resources/Assets.xcassets/SignUpCompleted.imageset/Group 1171275642@2x.png and /dev/null differ diff --git a/CMC/Resources/Assets.xcassets/SignUpCompleted.imageset/Group 1171275642@3x.png b/CMC/Resources/Assets.xcassets/SignUpCompleted.imageset/Group 1171275642@3x.png deleted file mode 100644 index 55377ad..0000000 Binary files a/CMC/Resources/Assets.xcassets/SignUpCompleted.imageset/Group 1171275642@3x.png and /dev/null differ diff --git a/CMC/Resources/Assets.xcassets/Splash.imageset/Contents.json b/CMC/Resources/Assets.xcassets/Splash.imageset/Contents.json deleted file mode 100644 index e6cbcd5..0000000 --- a/CMC/Resources/Assets.xcassets/Splash.imageset/Contents.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "images" : [ - { - "filename" : "Splash.png", - "idiom" : "universal", - "scale" : "1x" - }, - { - "filename" : "Splash@2x.png", - "idiom" : "universal", - "scale" : "2x" - }, - { - "filename" : "Splash@3x.png", - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/CMC/Resources/Assets.xcassets/Splash.imageset/Splash.png b/CMC/Resources/Assets.xcassets/Splash.imageset/Splash.png deleted file mode 100644 index cbc2f7c..0000000 Binary files a/CMC/Resources/Assets.xcassets/Splash.imageset/Splash.png and /dev/null differ diff --git a/CMC/Resources/Assets.xcassets/Splash.imageset/Splash@2x.png b/CMC/Resources/Assets.xcassets/Splash.imageset/Splash@2x.png deleted file mode 100644 index ce81524..0000000 Binary files a/CMC/Resources/Assets.xcassets/Splash.imageset/Splash@2x.png and /dev/null differ diff --git a/CMC/Resources/Assets.xcassets/Splash.imageset/Splash@3x.png b/CMC/Resources/Assets.xcassets/Splash.imageset/Splash@3x.png deleted file mode 100644 index 3013182..0000000 Binary files a/CMC/Resources/Assets.xcassets/Splash.imageset/Splash@3x.png and /dev/null differ diff --git a/CMC/Resources/Assets.xcassets/SplashLogo.imageset/Contents.json b/CMC/Resources/Assets.xcassets/SplashLogo.imageset/Contents.json deleted file mode 100644 index e5f0893..0000000 --- a/CMC/Resources/Assets.xcassets/SplashLogo.imageset/Contents.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "images" : [ - { - "filename" : "Group 38564.png", - "idiom" : "universal", - "scale" : "1x" - }, - { - "filename" : "Group 38564@2x.png", - "idiom" : "universal", - "scale" : "2x" - }, - { - "filename" : "Group 38564@3x.png", - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/CMC/Resources/Assets.xcassets/SplashLogo.imageset/Group 38564.png b/CMC/Resources/Assets.xcassets/SplashLogo.imageset/Group 38564.png deleted file mode 100644 index dadac00..0000000 Binary files a/CMC/Resources/Assets.xcassets/SplashLogo.imageset/Group 38564.png and /dev/null differ diff --git a/CMC/Resources/Assets.xcassets/SplashLogo.imageset/Group 38564@2x.png b/CMC/Resources/Assets.xcassets/SplashLogo.imageset/Group 38564@2x.png deleted file mode 100644 index 7ba05a9..0000000 Binary files a/CMC/Resources/Assets.xcassets/SplashLogo.imageset/Group 38564@2x.png and /dev/null differ diff --git a/CMC/Resources/Assets.xcassets/SplashLogo.imageset/Group 38564@3x.png b/CMC/Resources/Assets.xcassets/SplashLogo.imageset/Group 38564@3x.png deleted file mode 100644 index 3347bcc..0000000 Binary files a/CMC/Resources/Assets.xcassets/SplashLogo.imageset/Group 38564@3x.png and /dev/null differ diff --git a/CMC/Resources/Assets.xcassets/SplashTitle.imageset/Contents.json b/CMC/Resources/Assets.xcassets/SplashTitle.imageset/Contents.json deleted file mode 100644 index b4fefb5..0000000 --- a/CMC/Resources/Assets.xcassets/SplashTitle.imageset/Contents.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "images" : [ - { - "filename" : "SplashTitle.png", - "idiom" : "universal", - "scale" : "1x" - }, - { - "filename" : "SplashTitle@2x.png", - "idiom" : "universal", - "scale" : "2x" - }, - { - "filename" : "SplashTitle@3x.png", - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/CMC/Resources/Assets.xcassets/SplashTitle.imageset/SplashTitle.png b/CMC/Resources/Assets.xcassets/SplashTitle.imageset/SplashTitle.png deleted file mode 100644 index bea802f..0000000 Binary files a/CMC/Resources/Assets.xcassets/SplashTitle.imageset/SplashTitle.png and /dev/null differ diff --git a/CMC/Resources/Assets.xcassets/SplashTitle.imageset/SplashTitle@2x.png b/CMC/Resources/Assets.xcassets/SplashTitle.imageset/SplashTitle@2x.png deleted file mode 100644 index e9305c9..0000000 Binary files a/CMC/Resources/Assets.xcassets/SplashTitle.imageset/SplashTitle@2x.png and /dev/null differ diff --git a/CMC/Resources/Assets.xcassets/SplashTitle.imageset/SplashTitle@3x.png b/CMC/Resources/Assets.xcassets/SplashTitle.imageset/SplashTitle@3x.png deleted file mode 100644 index f524eac..0000000 Binary files a/CMC/Resources/Assets.xcassets/SplashTitle.imageset/SplashTitle@3x.png and /dev/null differ diff --git a/CMC/Resources/Configure/Dev.xcconfig b/CMC/Resources/Configure/Dev.xcconfig deleted file mode 100644 index fe5f130..0000000 --- a/CMC/Resources/Configure/Dev.xcconfig +++ /dev/null @@ -1,12 +0,0 @@ -// -// Dev.xcconfig -// CMC -// -// Created by Siri on 2023/10/22. -// Copyright © 2023 com.centralMakeusChallenge. All rights reserved. -// - -// Configuration settings file format documentation can be found at: -// https://help.apple.com/xcode/#/dev745c5c974 - -BASE_URL = http:/$()/cmcapiserverdev-env.eba-au6k5x3x.ap-northeast-2.elasticbeanstalk.com diff --git a/CMC/Resources/Configure/Release.xcconfig b/CMC/Resources/Configure/Release.xcconfig deleted file mode 100644 index 5677e80..0000000 --- a/CMC/Resources/Configure/Release.xcconfig +++ /dev/null @@ -1,10 +0,0 @@ -// -// Release.xcconfig -// CMC -// -// Created by Siri on 2023/10/22. -// Copyright © 2023 com.centralMakeusChallenge. All rights reserved. -// - -// Configuration settings file format documentation can be found at: -// https://help.apple.com/xcode/#/dev745c5c974 diff --git a/CMC/Resources/Font/Pretendard-Bold.otf b/CMC/Resources/Font/Pretendard-Bold.otf deleted file mode 100644 index a52ef39..0000000 Binary files a/CMC/Resources/Font/Pretendard-Bold.otf and /dev/null differ diff --git a/CMC/Resources/Font/Pretendard-Medium.otf b/CMC/Resources/Font/Pretendard-Medium.otf deleted file mode 100644 index a2dc009..0000000 Binary files a/CMC/Resources/Font/Pretendard-Medium.otf and /dev/null differ diff --git a/CMC/Resources/Font/Pretendard-Regular.otf b/CMC/Resources/Font/Pretendard-Regular.otf deleted file mode 100644 index c940185..0000000 Binary files a/CMC/Resources/Font/Pretendard-Regular.otf and /dev/null differ diff --git a/CMC/Resources/Font/Pretendard-SemiBold.otf b/CMC/Resources/Font/Pretendard-SemiBold.otf deleted file mode 100644 index c375b54..0000000 Binary files a/CMC/Resources/Font/Pretendard-SemiBold.otf and /dev/null differ diff --git a/CMC/Resources/Launch Screen.storyboard b/CMC/Resources/Launch Screen.storyboard deleted file mode 100644 index df57297..0000000 --- a/CMC/Resources/Launch Screen.storyboard +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/CMC/Sources/App/AppCoordinator.swift b/CMC/Sources/App/AppCoordinator.swift deleted file mode 100644 index f8bde88..0000000 --- a/CMC/Sources/App/AppCoordinator.swift +++ /dev/null @@ -1,80 +0,0 @@ -// -// AppCoordinator.swift -// CMC -// -// Created by Siri on 2023/10/24. -// Copyright © 2023 com.centralMakeusChallenge. All rights reserved. -// - -import RxCocoa -import RxSwift - -import UIKit - -class AppCoordinator: CoordinatorType { - - // MARK: - Navigation DEPTH 0 - - enum AppCoordinatorChild{ - case auth - case tabBar - } - - // MARK: - Need To Initializing - var disposeBag: DisposeBag - var userActionState: PublishRelay = PublishRelay() - /// init에서만 호출하고, stream을 유지하기위해 BehaviorSubject 사용 - var navigationController: UINavigationController - - // MARK: - Don't Need To Initializing - var childCoordinators: [CoordinatorType] = [] - var delegate: CoordinatorDelegate? - - init( - navigationController: UINavigationController - ) { - self.navigationController = navigationController - self.disposeBag = DisposeBag() - self.setState() - } - - func setState(){ - self.userActionState - .withUnretained(self) - .subscribe(onNext: { owner, state in - switch state{ - case .auth: - let authCoordinator = AuthCoordinator( - navigationController: owner.navigationController - ) - authCoordinator.delegate = owner - authCoordinator.start() - owner.childCoordinators.append(authCoordinator) - case .tabBar: - print("🍎 여기 들어가면, 메인 탭 화면으로~ 🍎") - } - }).disposed(by: disposeBag) - } - - func start() { - let splashViewController = SplashViewController( - viewModel: SplashViewModel( - coordinator: self, - launchUsecase: DefaultLaunchUsecase( - launchRepository: DefaultLaunchRepository() - ) - ) - ) - self.pushViewController(viewController: splashViewController) - } -} - -extension AppCoordinator: CoordinatorDelegate{ - func didFinish(childCoordinator: CoordinatorType) { - self.navigationController.popViewController(animated: true) - if childCoordinator is AuthCoordinator { - self.userActionState.accept(.tabBar) - } else { - self.userActionState.accept(.auth) - } - } -} diff --git a/CMC/Sources/App/AppDelegate.swift b/CMC/Sources/App/AppDelegate.swift deleted file mode 100644 index 20e95a1..0000000 --- a/CMC/Sources/App/AppDelegate.swift +++ /dev/null @@ -1,23 +0,0 @@ -// -// AppDelegate.swift -// CMC -// -// Created by Siri on 2023/10/22. -// Copyright © 2023 com.centralMakeusChallenge. All rights reserved. -// - -import Foundation -import UIKit - -@main -class AppDelegate: UIResponder, UIApplicationDelegate{ - var window: UIWindow? - - func application( - _ application: UIApplication, - didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? - ) -> Bool { - - return true - } -} diff --git a/CMC/Sources/App/SceneDelegate.swift b/CMC/Sources/App/SceneDelegate.swift deleted file mode 100644 index b211672..0000000 --- a/CMC/Sources/App/SceneDelegate.swift +++ /dev/null @@ -1,35 +0,0 @@ -// -// SceneDelegate.swift -// CMC -// -// Created by Siri on 2023/10/22. -// Copyright © 2023 com.centralMakeusChallenge. All rights reserved. -// - -import Foundation -import UIKit - -class SceneDelegate: UIResponder, UIWindowSceneDelegate { - - var window: UIWindow? - var appCoordinator: AppCoordinator? - - func scene( - _ scene: UIScene, - willConnectTo session: UISceneSession, - options connectionOptions: UIScene.ConnectionOptions - ) { - - guard let windowScene = (scene as? UIWindowScene) else { return } - window = UIWindow(windowScene: windowScene) - - let navigationController = UINavigationController() - - appCoordinator = AppCoordinator(navigationController: navigationController) - - window?.rootViewController = navigationController - window?.makeKeyAndVisible() - - appCoordinator?.start() - } -} diff --git a/CMC/Sources/App/Splash/SplashViewController.swift b/CMC/Sources/App/Splash/SplashViewController.swift deleted file mode 100644 index 38f6f8b..0000000 --- a/CMC/Sources/App/Splash/SplashViewController.swift +++ /dev/null @@ -1,58 +0,0 @@ -// -// SplashViewController.swift -// CMC -// -// Created by Siri on 2023/10/24. -// Copyright © 2023 com.centralMakeusChallenge. All rights reserved. -// - -import SnapKit - -import UIKit - -class SplashViewController: BaseViewController { - - private lazy var splashImageView: UIImageView = { - let imageView = UIImageView() - imageView.image = CMCAsset.splash.image - imageView.contentMode = .scaleAspectFill - return imageView - }() - - private lazy var splashLogoImageView: UIImageView = { - let imageView = UIImageView() - imageView.image = CMCAsset.splashLogo.image - imageView.contentMode = .scaleAspectFill - return imageView - }() - - private let viewModel: SplashViewModel - - init( - viewModel: SplashViewModel - ) { - self.viewModel = viewModel - super.init() - } - - override func setAddSubView() { - view.addSubview(splashImageView) - view.addSubview(splashLogoImageView) - } - - override func setConstraint() { - splashImageView.snp.makeConstraints { make in - make.edges.equalToSuperview() - } - - splashLogoImageView.snp.makeConstraints { make in - make.centerX.centerY.equalToSuperview() - make.width.height.equalTo(108) - } - } - - override func bind() { - let input = SplashViewModel.Input() - let output = viewModel.transform(input: input) - } -} diff --git a/CMC/Sources/App/Splash/SplashViewModel.swift b/CMC/Sources/App/Splash/SplashViewModel.swift deleted file mode 100644 index d279b0b..0000000 --- a/CMC/Sources/App/Splash/SplashViewModel.swift +++ /dev/null @@ -1,55 +0,0 @@ -// -// SplashViewModel.swift -// CMC -// -// Created by Siri on 2023/10/24. -// Copyright © 2023 com.centralMakeusChallenge. All rights reserved. -// - -import RxCocoa -import RxSwift -import UIKit - -class SplashViewModel: ViewModelType{ - - struct Input {} - - struct Output {} - - var disposeBag: DisposeBag = DisposeBag() - weak var coordinator: AppCoordinator? - - private let launchUsecase: LaunchUsecase - - init( - coordinator: AppCoordinator, - launchUsecase: LaunchUsecase - ) { - self.coordinator = coordinator - self.launchUsecase = launchUsecase - } - - - func transform(input: Input) -> Output { - - launchUsecase.health() - .observe(on: MainScheduler.instance) - .subscribe( - onSuccess: { [weak self] message in - self?.checkAutoSignIn() - }, onFailure: { [weak self] error in - self?.coordinator?.userActionState.accept(.auth) - CMCToastManager.shared.addToast(message: error.localizedDescription) - }).disposed(by: disposeBag) - - return Output() - } - - private func checkAutoSignIn(){ - if let _: String = UserDefaultManager.shared.load(for: .accessToken) { - self.coordinator?.userActionState.accept(.tabBar) - } else { - self.coordinator?.userActionState.accept(.auth) - } - } -} diff --git a/CMC/Sources/Data/DTO/Auth/ConfirmCertifyCodeDTO.swift b/CMC/Sources/Data/DTO/Auth/ConfirmCertifyCodeDTO.swift deleted file mode 100644 index 8f4766c..0000000 --- a/CMC/Sources/Data/DTO/Auth/ConfirmCertifyCodeDTO.swift +++ /dev/null @@ -1,21 +0,0 @@ -// -// ConfirmCertifyCodeDTO.swift -// CMC -// -// Created by Siri on 11/25/23. -// Copyright © 2023 com.softsquared.cmc. All rights reserved. -// - -// MARK: - ConfirmCertifyCodeDTO -struct ConfirmCertifyCodeDTO: Codable { - let isSuccess: Bool - let code: String - let message: String - let result: String - - func toDomain() -> ConfirmCertifyCodeModel { - return ConfirmCertifyCodeModel( - message: result - ) - } -} diff --git a/CMC/Sources/Data/DTO/Auth/EmailDupDTO.swift b/CMC/Sources/Data/DTO/Auth/EmailDupDTO.swift deleted file mode 100644 index b1c50f2..0000000 --- a/CMC/Sources/Data/DTO/Auth/EmailDupDTO.swift +++ /dev/null @@ -1,22 +0,0 @@ -// -// EmailDupDTO.swift -// CMC -// -// Created by Siri on 11/7/23. -// Copyright © 2023 com.softsquared.cmc. All rights reserved. -// - -import Foundation - -// MARK: - EmailDupDTO -struct EmailDupDTO: Codable { - let isSuccess: Bool - let code, message: String - let result: String - - func toDomain() -> EmailDupModel { - return EmailDupModel( - message: result - ) - } -} diff --git a/CMC/Sources/Data/DTO/Auth/ResettingPasswordDTO.swift b/CMC/Sources/Data/DTO/Auth/ResettingPasswordDTO.swift deleted file mode 100644 index 6a644ac..0000000 --- a/CMC/Sources/Data/DTO/Auth/ResettingPasswordDTO.swift +++ /dev/null @@ -1,21 +0,0 @@ -// -// ResettingPasswordDTO.swift -// CMC -// -// Created by Siri on 11/25/23. -// Copyright © 2023 com.softsquared.cmc. All rights reserved. -// - -// MARK: - RessetingPasswordDTO -struct ResettingPasswordDTO: Codable { - let isSuccess: Bool - let code: String - let message: String - let result: String - - func toDomain() -> ResettingPasswordModel { - return ResettingPasswordModel( - message: result - ) - } -} diff --git a/CMC/Sources/Data/DTO/Auth/SendCertifyCodeDTO.swift b/CMC/Sources/Data/DTO/Auth/SendCertifyCodeDTO.swift deleted file mode 100644 index f8cc5e9..0000000 --- a/CMC/Sources/Data/DTO/Auth/SendCertifyCodeDTO.swift +++ /dev/null @@ -1,23 +0,0 @@ -// -// SendCertifyCodeDTO.swift -// CMC -// -// Created by Siri on 11/25/23. -// Copyright © 2023 com.softsquared.cmc. All rights reserved. -// - -import Foundation - -// MARK: - SendCertifyCodeDTO -struct SendCertifyCodeDTO: Codable { - let isSuccess: Bool - let code: String - let message: String - let result: String - - func toDomain() -> SendCertifyCodeModel { - return SendCertifyCodeModel( - message: result - ) - } -} diff --git a/CMC/Sources/Data/DTO/Auth/SignInDTO.swift b/CMC/Sources/Data/DTO/Auth/SignInDTO.swift deleted file mode 100644 index 77bcf16..0000000 --- a/CMC/Sources/Data/DTO/Auth/SignInDTO.swift +++ /dev/null @@ -1,30 +0,0 @@ -// -// SignInDTO.swift -// CMC -// -// Created by Siri on 10/27/23. -// Copyright © 2023 com.centralMakeusChallenge. All rights reserved. -// - -import Foundation - -// MARK: - SignInDTO -struct SignInDTO: Codable { - let isSuccess: Bool - let code, message: String - let result: SignInResponse - - struct SignInResponse: Codable { - let userId: Int - let accessToken: String - let refreshToken: String - } - - func toDomain() -> SignInModel { - return SignInModel( - userId: result.userId, - accessToken: result.accessToken, - refreshToken: result.refreshToken - ) - } -} diff --git a/CMC/Sources/Data/DTO/Auth/SignUpDTO.swift b/CMC/Sources/Data/DTO/Auth/SignUpDTO.swift deleted file mode 100644 index f549f83..0000000 --- a/CMC/Sources/Data/DTO/Auth/SignUpDTO.swift +++ /dev/null @@ -1,30 +0,0 @@ -// -// SignUpDTO.swift -// CMC -// -// Created by Siri on 10/27/23. -// Copyright © 2023 com.centralMakeusChallenge. All rights reserved. -// - -import Foundation - -// MARK: - SignUpDTO -struct SignUpDTO: Codable { - let isSuccess: Bool - let code, message: String - let result: SignUpResponse - - struct SignUpResponse: Codable { - let userId: Int - let accessToken: String - let refreshToken: String - } - - func toDomain() -> SignUpModel { - return SignUpModel( - userId: result.userId, - accessToken: result.accessToken, - refreshToken: result.refreshToken - ) - } -} diff --git a/CMC/Sources/Data/DTO/Splash/LaunchDTO.swift b/CMC/Sources/Data/DTO/Splash/LaunchDTO.swift deleted file mode 100644 index 72f85ae..0000000 --- a/CMC/Sources/Data/DTO/Splash/LaunchDTO.swift +++ /dev/null @@ -1,20 +0,0 @@ -// -// LaunchDTO.swift -// CMC -// -// Created by Siri on 2023/10/24. -// Copyright © 2023 com.centralMakeusChallenge. All rights reserved. -// - -import Foundation - - -struct LaunchDTO: Codable { - let message: String - - func toDomain() -> LaunchModel { - return LaunchModel( - message: message - ) - } -} diff --git a/CMC/Sources/Data/Endpoint/AuthEndpoint.swift b/CMC/Sources/Data/Endpoint/AuthEndpoint.swift deleted file mode 100644 index 16fdf19..0000000 --- a/CMC/Sources/Data/Endpoint/AuthEndpoint.swift +++ /dev/null @@ -1,77 +0,0 @@ -// -// AuthEndpoint.swift -// CMC -// -// Created by Siri on 10/27/23. -// Copyright © 2023 com.centralMakeusChallenge. All rights reserved. -// - -import Foundation - -enum AuthEndpoint: Endpoint { - - case signIn(body: SignInBody) - case signUp(body: SignUpBody) - case emailDup(query: EmailDupQuery) - case sendCertifyCode(query: SendCertifyCodeQuery) - case confirmCertifyCode(body: ConfirmCertifyCodeBody) - case resettingPassword(body: ResettingPasswordBody) - - var baseURL: URL? { - return URL(string: Xcconfig.BASE_URL + "/auth") - } - - var method: HTTPMethod { - switch self { - case .signUp, .signIn, .confirmCertifyCode: - return .POST - case .emailDup, .sendCertifyCode: - return .GET - case .resettingPassword: - return .PATCH - } - } - - var headers: HTTPHeaders { - return [ - "Content-Type": "application/json;charset=UTF-8", - "accept": "application/json;charset=UTF-8" - ] - } - - var path: String { - switch self { - case .signUp: - return "/sign-up" - case .signIn: - return "/log-in" - case .emailDup: - return "/email" - case .sendCertifyCode, .confirmCertifyCode, .resettingPassword: - return "/password" - } - - } - - var parameters: HTTPRequestParameterType? { - switch self { - case .signUp(let body): - return .body(body) - case .signIn(let body): - return .body(body) - case .emailDup(let query): - return .query([ - "email": query.email - ]) - case .sendCertifyCode(let query): - return .query([ - "email": query.email - ]) - case .confirmCertifyCode(let body): - return .body(body) - case .resettingPassword(let body): - return .body(body) - } - } - -} diff --git a/CMC/Sources/Data/Endpoint/LaunchEndpoint.swift b/CMC/Sources/Data/Endpoint/LaunchEndpoint.swift deleted file mode 100644 index 28fe57c..0000000 --- a/CMC/Sources/Data/Endpoint/LaunchEndpoint.swift +++ /dev/null @@ -1,50 +0,0 @@ -// -// LaunchEndpoint.swift -// CMC -// -// Created by Siri on 2023/10/24. -// Copyright © 2023 com.centralMakeusChallenge. All rights reserved. -// - -import Foundation - -enum LaunchEndpoint: Endpoint { - - case health - - var baseURL: URL? { - return URL(string: Xcconfig.BASE_URL) - } - - var method: HTTPMethod { - switch self { - case .health: - return .GET - - } - } - - var headers: HTTPHeaders { - return [ - "Content-Type": "application/json", - "accept": "application/json" - ] - } - - var path: String { - switch self { - case .health: - return "/health" - } - - } - - var parameters: HTTPRequestParameterType? { - switch self { - case .health: - return nil - } - } - - -} diff --git a/CMC/Sources/Data/NetworkService/Body/Auth/ConfirmCertifyCodeBody.swift b/CMC/Sources/Data/NetworkService/Body/Auth/ConfirmCertifyCodeBody.swift deleted file mode 100644 index 72b44f5..0000000 --- a/CMC/Sources/Data/NetworkService/Body/Auth/ConfirmCertifyCodeBody.swift +++ /dev/null @@ -1,15 +0,0 @@ -// -// ConfirmCertifyCodeBody.swift -// CMC -// -// Created by Siri on 11/25/23. -// Copyright © 2023 com.softsquared.cmc. All rights reserved. -// - -import Foundation - -// MARK: - ConfirmCertifyCodeBody -struct ConfirmCertifyCodeBody: Codable { - let email: String - let code: String -} diff --git a/CMC/Sources/Data/NetworkService/Body/Auth/EmailDupQuery.swift b/CMC/Sources/Data/NetworkService/Body/Auth/EmailDupQuery.swift deleted file mode 100644 index 6346e5e..0000000 --- a/CMC/Sources/Data/NetworkService/Body/Auth/EmailDupQuery.swift +++ /dev/null @@ -1,14 +0,0 @@ -// -// EmailDupQuery.swift -// CMC -// -// Created by Siri on 11/7/23. -// Copyright © 2023 com.softsquared.cmc. All rights reserved. -// - -import Foundation - -// MARK: - EmailDupQuery -struct EmailDupQuery: Codable { - let email: String -} diff --git a/CMC/Sources/Data/NetworkService/Body/Auth/ResettingPasswordBody.swift b/CMC/Sources/Data/NetworkService/Body/Auth/ResettingPasswordBody.swift deleted file mode 100644 index 7563047..0000000 --- a/CMC/Sources/Data/NetworkService/Body/Auth/ResettingPasswordBody.swift +++ /dev/null @@ -1,15 +0,0 @@ -// -// ResettingPasswordBody.swift -// CMC -// -// Created by Siri on 11/25/23. -// Copyright © 2023 com.softsquared.cmc. All rights reserved. -// - -import Foundation - -// MARK: - ResettingPasswordBody -struct ResettingPasswordBody: Codable { - let email: String - let password: String -} diff --git a/CMC/Sources/Data/NetworkService/Body/Auth/SendCertifyCodeQuery.swift b/CMC/Sources/Data/NetworkService/Body/Auth/SendCertifyCodeQuery.swift deleted file mode 100644 index 38e3ec6..0000000 --- a/CMC/Sources/Data/NetworkService/Body/Auth/SendCertifyCodeQuery.swift +++ /dev/null @@ -1,14 +0,0 @@ -// -// SendCertifyCodeQuery.swift -// CMC -// -// Created by Siri on 11/25/23. -// Copyright © 2023 com.softsquared.cmc. All rights reserved. -// - -import Foundation - -// MARK: - SendCertifyCodeQuery -struct SendCertifyCodeQuery: Codable { - let email: String -} diff --git a/CMC/Sources/Data/NetworkService/Body/Auth/SignInBody.swift b/CMC/Sources/Data/NetworkService/Body/Auth/SignInBody.swift deleted file mode 100644 index a7d5b2a..0000000 --- a/CMC/Sources/Data/NetworkService/Body/Auth/SignInBody.swift +++ /dev/null @@ -1,15 +0,0 @@ -// -// SignInBody.swift -// CMC -// -// Created by Siri on 10/27/23. -// Copyright © 2023 com.centralMakeusChallenge. All rights reserved. -// - -import Foundation - -// MARK: - SignInBody -struct SignInBody: Codable { - let email: String - let password: String -} diff --git a/CMC/Sources/Data/NetworkService/Body/Auth/SignUpBody.swift b/CMC/Sources/Data/NetworkService/Body/Auth/SignUpBody.swift deleted file mode 100644 index 2389733..0000000 --- a/CMC/Sources/Data/NetworkService/Body/Auth/SignUpBody.swift +++ /dev/null @@ -1,50 +0,0 @@ -// -// SignUpBody.swift -// CMC -// -// Created by Siri on 10/27/23. -// Copyright © 2023 com.centralMakeusChallenge. All rights reserved. -// - -import Foundation - -// MARK: - SignUpBody -struct SignUpBody: Codable { - let email: String - let password: String - let nickname: String - let name: String - let generation: Int - let part: String - -} - -enum Part: String, Codable { - case none = "포지션을 선택해주세요" - case BACK_END = "Server" - case WEB = "Web" - case IOS = "iOS" - case AOS = "Android" - case PLANNER = "Planner" - case DESIGNER = "Designer" - - func revertPart() -> String { - switch self { - case .BACK_END: - return "BACK_END" - case .WEB: - return "WEB" - case .IOS: - return "IOS" - case .AOS: - return "AOS" - case .PLANNER: - return "PLANNER" - case .DESIGNER: - return "DESIGNER" - case .none: - return "none" - } - } - -} diff --git a/CMC/Sources/Data/NetworkService/DefaultNetworkService.swift b/CMC/Sources/Data/NetworkService/DefaultNetworkService.swift deleted file mode 100644 index 486fa2e..0000000 --- a/CMC/Sources/Data/NetworkService/DefaultNetworkService.swift +++ /dev/null @@ -1,48 +0,0 @@ -// -// DefaultNetworkService.swift -// CMC -// -// Created by Siri on 2023/10/24. -// Copyright © 2023 com.centralMakeusChallenge. All rights reserved. -// - -import Foundation - -import RxSwift - -final class DefaultNetworkService: NetworkService { - - // MARK: - Properties - private let session: URLSession = .shared - - - // MARK: - Methods - - func request(_ endpoint: Endpoint) -> Observable<(HTTPURLResponse, Data)> { - guard let urlRequest = endpoint.toURLRequest() else { - return .error(NetworkError.invalidURL) - } - return session.rx - .response(request: urlRequest) - .map { ($0.response, $0.data) } - } - - func request(_ endpoint: Endpoint) -> Single { - return self.request(endpoint) - .do(onSubscribe: { - CMCIndecatorManager.shared.show() - }, onDispose: { - CMCIndecatorManager.shared.hide() - }) - .flatMap { response, data -> Observable in - if response.statusCode == 200 { - return .just(data) - } else { - let errorData = Utility.decodeError(from: data) - return .error(NetworkError.customError(code: errorData.code, message: errorData.message)) - } - } - .asSingle() - } - -} diff --git a/CMC/Sources/Data/NetworkService/Endpoint.swift b/CMC/Sources/Data/NetworkService/Endpoint.swift deleted file mode 100644 index d59f448..0000000 --- a/CMC/Sources/Data/NetworkService/Endpoint.swift +++ /dev/null @@ -1,101 +0,0 @@ -// -// Endpoint.swift -// CMC -// -// Created by Siri on 2023/10/24. -// Copyright © 2023 com.centralMakeusChallenge. All rights reserved. -// - -import Foundation - -enum HTTPMethod: String { - case GET, POST, DELETE, PATCH -} - -typealias HTTPHeaders = [String: String] - -/// HTTPRequestParameter타입이 쿼리인지 바디인지에 따라서 setBody에 값을 넣을건지 appendingQueries에 값을 넣을건지 판별하기 위함 -public enum HTTPRequestParameterType { - - case query([String: String]) - case body(Encodable) -} - -// MARK: - Endpoint -protocol Endpoint { - - var baseURL: URL? { get } - var method: HTTPMethod { get } - var headers: HTTPHeaders { get } - var path: String { get } - var parameters: HTTPRequestParameterType? { get } - - func toURLRequest() -> URLRequest? -} - -extension Endpoint { - - /// 최종 완성된 URLSession.shared.request() - func toURLRequest() -> URLRequest? { - guard let url = configureURL() else { return nil } - - return URLRequest(url: url) - .setMethod(method) - .appendingHeaders(headers) - .setBody(at: parameters) - } - - /// BaseURL을 기반으로 추가 도메인을 세팅해줌. 또한, 이후에 .body인지 .query인지에 따라서 추가 쿼리문이 붙어온다. - private func configureURL() -> URL? { - return baseURL? - .appendingPath(path) - .appendingQueries(at: parameters) - } -} - -extension URL { - - /// BaseURL이후의 추가 도메인을 이어붙여줌 - func appendingPath(_ path: String) -> URL { - return self.appendingPathComponent(path) - } - - /// setBody와 마찬가지로, HTTPRequestParameter가 쿼리타입일 경우 URL에 쿼리값을 추가해줌. - func appendingQueries(at parameter: HTTPRequestParameterType?) -> URL? { - var components = URLComponents(string: self.absoluteString) - if case .query(let queries) = parameter { - components?.queryItems = queries.map { URLQueryItem(name: $0, value: $1) } - } - - return components?.url - } -} - -extension URLRequest { - - /// URLSession 통신 타입 설정 (get, post, delete, fetch) - func setMethod(_ method: HTTPMethod) -> URLRequest { - var urlRequest = self - - urlRequest.httpMethod = method.rawValue - return urlRequest - } - - /// URLSession 헤더 추가 (Dict타입으로 $0이 필드명, $1이 타이틀) - func appendingHeaders(_ headers: HTTPHeaders) -> URLRequest { - var urlRequest = self - - headers.forEach { urlRequest.addValue($1, forHTTPHeaderField: $0) } - return urlRequest - } - - /// URLSession 바디 추가 (파라미터로 보내야하는 값들. 단, HTTPRequestParameter가 쿼리타입인지 바디타입인지에 따라서 다름. 쿼리타입이면 바디 세팅 안함) - func setBody(at parameter: HTTPRequestParameterType?) -> URLRequest { - var urlRequest = self - - if case .body(let body) = parameter { - urlRequest.httpBody = try? JSONEncoder().encode(body) - } - return urlRequest - } -} diff --git a/CMC/Sources/Data/NetworkService/NetworkError.swift b/CMC/Sources/Data/NetworkService/NetworkError.swift deleted file mode 100644 index b77ad35..0000000 --- a/CMC/Sources/Data/NetworkService/NetworkError.swift +++ /dev/null @@ -1,58 +0,0 @@ -// -// NetworkError.swift -// CMC -// -// Created by Siri on 2023/10/24. -// Copyright © 2023 com.centralMakeusChallenge. All rights reserved. -// - -import Foundation - -struct ServerError: Codable { - let isSuccess: Bool - let code: String - let message: String -} - - -public enum NetworkError: LocalizedError { - case invalidURL - case invalidResponse - case decodingFailed - case badNetwork - case customError(code: String?, message: String?) - - public var errorDescription: String { - switch self { - case .invalidURL: - return "The URL is invalid." - case .invalidResponse: - return "The response is invalid." - case .decodingFailed: - return "Failed to decode the object." - case .badNetwork: - return "The network is unstable." - case .customError(_, let message): - return "\(message ?? "Unknown Error")" - } - } - - static func error(from code: Int, serverMessage: String?) -> NetworkError { - let defaultMessage: String - switch code { - case 400: - defaultMessage = "Bad Request" - case 401: - defaultMessage = "Unauthorized" - case 403: - defaultMessage = "Forbidden" - case 404: - defaultMessage = "Not Found" - default: - defaultMessage = "Unknown Error" - } - - let message = serverMessage ?? defaultMessage - return .customError(code: "\(code)", message: message) - } -} diff --git a/CMC/Sources/Data/NetworkService/NetworkService.swift b/CMC/Sources/Data/NetworkService/NetworkService.swift deleted file mode 100644 index 58e7117..0000000 --- a/CMC/Sources/Data/NetworkService/NetworkService.swift +++ /dev/null @@ -1,18 +0,0 @@ -// -// NetworkService.swift -// CMC -// -// Created by Siri on 2023/10/22. -// Copyright © 2023 com.centralMakeusChallenge. All rights reserved. -// - -import Foundation - -import RxSwift - -protocol NetworkService { - - // MARK: - Methods - func request(_ endpoint: Endpoint) -> Observable<(HTTPURLResponse, Data)> - func request(_ endpoint: Endpoint) -> Single -} diff --git a/CMC/Sources/Data/Repositories/Auth/DefaultAuthRepository.swift b/CMC/Sources/Data/Repositories/Auth/DefaultAuthRepository.swift deleted file mode 100644 index fe9ab2c..0000000 --- a/CMC/Sources/Data/Repositories/Auth/DefaultAuthRepository.swift +++ /dev/null @@ -1,87 +0,0 @@ -// -// DefaultAuthRepository.swift -// CMC -// -// Created by Siri on 10/27/23. -// Copyright © 2023 com.centralMakeusChallenge. All rights reserved. -// - -import Foundation -import RxSwift - -final class DefaultAuthRepository: AuthRepository { - - private let networkService: NetworkService - - init() { - self.networkService = DefaultNetworkService() - } - - func signUp(body: SignUpBody) -> Single { - let endpoint = AuthEndpoint.signUp(body: body) - return networkService.request(endpoint) - .flatMap { data in - guard let dto = Utility.decode(SignUpDTO.self, from: data) else { - return Single.error(NetworkError.decodingFailed) - } - return Single.just(dto) - } - } - - func signIn(body: SignInBody) -> Single { - let endpoint = AuthEndpoint.signIn(body: body) - return networkService.request(endpoint) - .flatMap { data in - guard let dto = Utility.decode(SignInDTO.self, from: data) else { - return Single.error(NetworkError.decodingFailed) - } - return Single.just(dto) - } - } - - func emailDup(query: EmailDupQuery) -> Single { - let endpoint = AuthEndpoint.emailDup(query: query) - return networkService.request(endpoint) - .flatMap { data in - guard let dto = Utility.decode(EmailDupDTO.self, from: data) else { - return Single.error(NetworkError.decodingFailed) - } - return Single.just(dto) - } - } - - func sendCertifyCode(query: SendCertifyCodeQuery) -> Single { - let endpoint = AuthEndpoint.sendCertifyCode(query: query) - return networkService.request(endpoint) - .flatMap { data in - guard let dto = Utility.decode(SendCertifyCodeDTO.self, from: data) else { - return Single.error(NetworkError.decodingFailed) - } - return Single.just(dto) - } - } - - func confirmCertifyCode(body: ConfirmCertifyCodeBody) -> Single { - let endpoint = AuthEndpoint.confirmCertifyCode(body: body) - return networkService.request(endpoint) - .flatMap { data in - guard let dto = Utility.decode(ConfirmCertifyCodeDTO.self, from: data) else { - return Single.error(NetworkError.decodingFailed) - } - return Single.just(dto) - } - } - - func reSettingPassword(body: ResettingPasswordBody) -> Single { - let endpoint = AuthEndpoint.resettingPassword(body: body) - return networkService.request(endpoint) - .flatMap { data in - guard let dto = Utility.decode(ResettingPasswordDTO.self, from: data) else { - return Single.error(NetworkError.decodingFailed) - } - return Single.just(dto) - } - } - - -} diff --git a/CMC/Sources/Data/Repositories/Auth/FakeAuthRepository.swift b/CMC/Sources/Data/Repositories/Auth/FakeAuthRepository.swift deleted file mode 100644 index c79d51c..0000000 --- a/CMC/Sources/Data/Repositories/Auth/FakeAuthRepository.swift +++ /dev/null @@ -1,81 +0,0 @@ -// -// FakeAuthRepository.swift -// CMC -// -// Created by Siri on 11/7/23. -// Copyright © 2023 com.softsquared.cmc. All rights reserved. -// - -import Foundation -import RxSwift - -final class FakeAuthRepository: AuthRepository { - - func signUp(body: SignUpBody) -> Single { - let fakeSignUpDTO = SignUpDTO( - isSuccess: true, - code: "200", - message: "성공", - result: .init( - userId: 14, - accessToken: "eyJ0eXBlIjoiand0IiwiYWxnIjoiSFMzODQifQ.eyJ1c2VySWQiOjEsImlhdCI6MTY5OTM1NTk2MiwiZXhwIjozMzIzNTM1NTk2Mn0.Ss8FNWSD1kVbETnFD4C6d9jQYt2c_vdhUwRL84uQA1aW06csWw6Je7bcge22KY_B", - refreshToken: "eyJ0eXBlIjoiand0IiwiYWxnIjoiSFMzODQifQ.eyJ1c2VySWQiOjEsImlhdCI6MTY5OTM1NTk2MiwiZXhwIjozMzIzNTM1NTk2Mn0.Ss8FNWSD1kVbETnFD4C6d9jQYt2c_vdhUwRL84uQA1aW06csWw6Je7bcge22KY_B" - ) - ) - return Single.just(fakeSignUpDTO) - } - - func signIn(body: SignInBody) -> Single { - let fakeSignInDTO = SignInDTO( - isSuccess: true, - code: "200", - message: "성공", - result: .init( - userId: 14, - accessToken: "eyJ0eXBlIjoiand0IiwiYWxnIjoiSFMzODQifQ.eyJ1c2VySWQiOjEsImlhdCI6MTY5OTM1NTk2MiwiZXhwIjozMzIzNTM1NTk2Mn0.Ss8FNWSD1kVbETnFD4C6d9jQYt2c_vdhUwRL84uQA1aW06csWw6Je7bcge22KY_B", - refreshToken: "eyJ0eXBlIjoiand0IiwiYWxnIjoiSFMzODQifQ.eyJ1c2VySWQiOjEsImlhdCI6MTY5OTM1NTk2MiwiZXhwIjozMzIzNTM1NTk2Mn0.Ss8FNWSD1kVbETnFD4C6d9jQYt2c_vdhUwRL84uQA1aW06csWw6Je7bcge22KY_B" - ) - ) - return Single.just(fakeSignInDTO) - } - - func emailDup(query: EmailDupQuery) -> Single { - let fakeEmailDupDTO = EmailDupDTO( - isSuccess: true, - code: "200", - message: "성공", - result: "사용 가능한 이메일입니다." - ) - return Single.just(fakeEmailDupDTO) - } - - func sendCertifyCode(query: SendCertifyCodeQuery) -> Single { - let fakeSendCertifyCodeDTO = SendCertifyCodeDTO( - isSuccess: true, - code: "200", - message: "성공", - result: "인증번호가 발송되었습니다." - ) - return Single.just(fakeSendCertifyCodeDTO) - } - - func confirmCertifyCode(body: ConfirmCertifyCodeBody) -> Single { - let fakeConfirmCertifyCodeDTO = ConfirmCertifyCodeDTO( - isSuccess: true, - code: "200", - message: "성공", - result: "인증번호가 발송되었습니다." - ) - return Single.just(fakeConfirmCertifyCodeDTO) - } - - func reSettingPassword(body: ResettingPasswordBody) -> Single { - let fakeResettingPasswordDTO = ResettingPasswordDTO( - isSuccess: true, - code: "200", - message: "성공", - result: "인증번호가 발송되었습니다." - ) - return Single.just(fakeResettingPasswordDTO) - } -} diff --git a/CMC/Sources/Data/Repositories/Splash/DefaultLaunchRepository.swift b/CMC/Sources/Data/Repositories/Splash/DefaultLaunchRepository.swift deleted file mode 100644 index 0bf61cd..0000000 --- a/CMC/Sources/Data/Repositories/Splash/DefaultLaunchRepository.swift +++ /dev/null @@ -1,31 +0,0 @@ -// -// DefaultLaunchRepository.swift -// CMC -// -// Created by Siri on 2023/10/24. -// Copyright © 2023 com.centralMakeusChallenge. All rights reserved. -// - -import Foundation -import RxSwift - -final class DefaultLaunchRepository: LaunchRepository { - - private let networkService: NetworkService - - init() { - self.networkService = DefaultNetworkService() - } - - func health() -> Single { - let endpoint = LaunchEndpoint.health - return networkService.request(endpoint) - .flatMap { data in - guard let dto = Utility.decode(LaunchDTO.self, from: data) else { - return Single.error(NetworkError.decodingFailed) - } - return Single.just(dto) - } - } - -} diff --git a/CMC/Sources/Domain/Models/Auth/ConfirmCertifyCodeModel.swift b/CMC/Sources/Domain/Models/Auth/ConfirmCertifyCodeModel.swift deleted file mode 100644 index 4031fa1..0000000 --- a/CMC/Sources/Domain/Models/Auth/ConfirmCertifyCodeModel.swift +++ /dev/null @@ -1,14 +0,0 @@ -// -// ConfirmCertifyCodeModel.swift -// CMC -// -// Created by Siri on 11/25/23. -// Copyright © 2023 com.softsquared.cmc. All rights reserved. -// - -import Foundation - -// MARK: - ConfirmCertifyCodeModel -struct ConfirmCertifyCodeModel: Codable { - let message: String -} diff --git a/CMC/Sources/Domain/Models/Auth/EmailDupModel.swift b/CMC/Sources/Domain/Models/Auth/EmailDupModel.swift deleted file mode 100644 index 5f2cd84..0000000 --- a/CMC/Sources/Domain/Models/Auth/EmailDupModel.swift +++ /dev/null @@ -1,14 +0,0 @@ -// -// EmailDupModel.swift -// CMC -// -// Created by Siri on 11/7/23. -// Copyright © 2023 com.softsquared.cmc. All rights reserved. -// - -import Foundation - -// MARK: - EmailDupModel -struct EmailDupModel: Codable { - let message: String -} diff --git a/CMC/Sources/Domain/Models/Auth/ResettingPasswordModel.swift b/CMC/Sources/Domain/Models/Auth/ResettingPasswordModel.swift deleted file mode 100644 index 307ce50..0000000 --- a/CMC/Sources/Domain/Models/Auth/ResettingPasswordModel.swift +++ /dev/null @@ -1,14 +0,0 @@ -// -// ResettingPasswordModel.swift -// CMC -// -// Created by Siri on 11/25/23. -// Copyright © 2023 com.softsquared.cmc. All rights reserved. -// - -import Foundation - -// MARK: - ResettingPasswordModel -struct ResettingPasswordModel: Codable { - let message: String -} diff --git a/CMC/Sources/Domain/Models/Auth/SendCertifyCodeModel.swift b/CMC/Sources/Domain/Models/Auth/SendCertifyCodeModel.swift deleted file mode 100644 index fb1d474..0000000 --- a/CMC/Sources/Domain/Models/Auth/SendCertifyCodeModel.swift +++ /dev/null @@ -1,14 +0,0 @@ -// -// SendCertifyCodeModel.swift -// CMC -// -// Created by Siri on 11/25/23. -// Copyright © 2023 com.softsquared.cmc. All rights reserved. -// - -import Foundation - -// MARK: - SendCertifyCodeModel -struct SendCertifyCodeModel: Codable { - let message: String -} diff --git a/CMC/Sources/Domain/Models/Auth/SignInModel.swift b/CMC/Sources/Domain/Models/Auth/SignInModel.swift deleted file mode 100644 index 9a88982..0000000 --- a/CMC/Sources/Domain/Models/Auth/SignInModel.swift +++ /dev/null @@ -1,17 +0,0 @@ -// -// SignInModel.swift -// CMC -// -// Created by Siri on 10/27/23. -// Copyright © 2023 com.centralMakeusChallenge. All rights reserved. -// - -import Foundation - -// MARK: - SignInModel -struct SignInModel: Codable { - let userId: Int - let accessToken: String - let refreshToken: String -} - diff --git a/CMC/Sources/Domain/Models/Auth/SignUpModel.swift b/CMC/Sources/Domain/Models/Auth/SignUpModel.swift deleted file mode 100644 index 8888cb8..0000000 --- a/CMC/Sources/Domain/Models/Auth/SignUpModel.swift +++ /dev/null @@ -1,17 +0,0 @@ -// -// SignUpModel.swift -// CMC -// -// Created by Siri on 10/27/23. -// Copyright © 2023 com.centralMakeusChallenge. All rights reserved. -// - -import Foundation - -// MARK: - SignUpModel -struct SignUpModel: Codable { - let userId: Int - let accessToken: String - let refreshToken: String -} - diff --git a/CMC/Sources/Domain/Models/Splash/LaunchModel.swift b/CMC/Sources/Domain/Models/Splash/LaunchModel.swift deleted file mode 100644 index 265b4e5..0000000 --- a/CMC/Sources/Domain/Models/Splash/LaunchModel.swift +++ /dev/null @@ -1,13 +0,0 @@ -// -// LaunchModel.swift -// CMC -// -// Created by Siri on 2023/10/24. -// Copyright © 2023 com.centralMakeusChallenge. All rights reserved. -// - -import Foundation - -struct LaunchModel: Codable { - let message: String -} diff --git a/CMC/Sources/Domain/Repositories/Auth/AuthRepository.swift b/CMC/Sources/Domain/Repositories/Auth/AuthRepository.swift deleted file mode 100644 index 43054fc..0000000 --- a/CMC/Sources/Domain/Repositories/Auth/AuthRepository.swift +++ /dev/null @@ -1,19 +0,0 @@ -// -// AuthRepository.swift -// CMC -// -// Created by Siri on 10/27/23. -// Copyright © 2023 com.centralMakeusChallenge. All rights reserved. -// - -import Foundation -import RxSwift - -protocol AuthRepository { - func signUp(body: SignUpBody) -> Single - func signIn(body: SignInBody) -> Single - func emailDup(query: EmailDupQuery) -> Single - func sendCertifyCode(query: SendCertifyCodeQuery) -> Single - func confirmCertifyCode(body: ConfirmCertifyCodeBody) -> Single - func reSettingPassword(body: ResettingPasswordBody) -> Single -} diff --git a/CMC/Sources/Domain/Repositories/Splash/LaunchRepository.swift b/CMC/Sources/Domain/Repositories/Splash/LaunchRepository.swift deleted file mode 100644 index d7289de..0000000 --- a/CMC/Sources/Domain/Repositories/Splash/LaunchRepository.swift +++ /dev/null @@ -1,14 +0,0 @@ -// -// LaunchRepository.swift -// CMC -// -// Created by Siri on 2023/10/24. -// Copyright © 2023 com.centralMakeusChallenge. All rights reserved. -// - -import Foundation -import RxSwift - -protocol LaunchRepository { - func health() -> Single -} diff --git a/CMC/Sources/Domain/Usecases/Auth/AuthUsecase.swift b/CMC/Sources/Domain/Usecases/Auth/AuthUsecase.swift deleted file mode 100644 index 67f5c19..0000000 --- a/CMC/Sources/Domain/Usecases/Auth/AuthUsecase.swift +++ /dev/null @@ -1,19 +0,0 @@ -// -// AuthUsecase.swift -// CMC -// -// Created by Siri on 10/27/23. -// Copyright © 2023 com.centralMakeusChallenge. All rights reserved. -// - -import Foundation -import RxSwift - -protocol AuthUsecase { - func signUp(body: SignUpBody) -> Single - func signIn(body: SignInBody) -> Single - func emailDup(query: EmailDupQuery) -> Single - func sendCertifyCode(query: SendCertifyCodeQuery) -> Single - func confirmCertifyCode(body: ConfirmCertifyCodeBody) -> Single - func reSettingPassword(body: ResettingPasswordBody) -> Single -} diff --git a/CMC/Sources/Domain/Usecases/Auth/DefaultAuthUsecase.swift b/CMC/Sources/Domain/Usecases/Auth/DefaultAuthUsecase.swift deleted file mode 100644 index 4de7150..0000000 --- a/CMC/Sources/Domain/Usecases/Auth/DefaultAuthUsecase.swift +++ /dev/null @@ -1,61 +0,0 @@ -// -// DefaultAuthUsecase.swift -// CMC -// -// Created by Siri on 10/27/23. -// Copyright © 2023 com.centralMakeusChallenge. All rights reserved. -// - -import Foundation -import RxSwift - -final class DefaultAuthUsecase: AuthUsecase { - - private let authRepository: AuthRepository - - init(authRepository: AuthRepository) { - self.authRepository = authRepository - } - - func signUp(body: SignUpBody) -> Single { - return authRepository.signUp(body: body) - .map { dto in - return dto.toDomain() - } - } - - func signIn(body: SignInBody) -> Single { - return authRepository.signIn(body: body) - .map { dto in - return dto.toDomain() - } - } - - func emailDup(query: EmailDupQuery) -> Single { - return authRepository.emailDup(query: query) - .map { dto in - return dto.toDomain() - } - } - - func sendCertifyCode(query: SendCertifyCodeQuery) -> Single { - return authRepository.sendCertifyCode(query: query) - .map { dto in - return dto.toDomain() - } - } - - func confirmCertifyCode(body: ConfirmCertifyCodeBody) -> Single { - return authRepository.confirmCertifyCode(body: body) - .map { dto in - return dto.toDomain() - } - } - - func reSettingPassword(body: ResettingPasswordBody) -> Single { - return authRepository.reSettingPassword(body: body) - .map { dto in - return dto.toDomain() - } - } -} diff --git a/CMC/Sources/Domain/Usecases/Splash/DefaultLaunchUsecase.swift b/CMC/Sources/Domain/Usecases/Splash/DefaultLaunchUsecase.swift deleted file mode 100644 index fd0b1f6..0000000 --- a/CMC/Sources/Domain/Usecases/Splash/DefaultLaunchUsecase.swift +++ /dev/null @@ -1,27 +0,0 @@ -// -// DefaultLaunchUsecase.swift -// CMC -// -// Created by Siri on 2023/10/24. -// Copyright © 2023 com.centralMakeusChallenge. All rights reserved. -// - -import Foundation -import RxSwift - - -class DefaultLaunchUsecase: LaunchUsecase { - - private let launchRepository: LaunchRepository - - init(launchRepository: LaunchRepository) { - self.launchRepository = launchRepository - } - - func health() -> Single { - return launchRepository.health() - .map { dto in - return dto.toDomain() - } - } -} diff --git a/CMC/Sources/Domain/Usecases/Splash/LaunchUsecase.swift b/CMC/Sources/Domain/Usecases/Splash/LaunchUsecase.swift deleted file mode 100644 index 52eed8b..0000000 --- a/CMC/Sources/Domain/Usecases/Splash/LaunchUsecase.swift +++ /dev/null @@ -1,14 +0,0 @@ -// -// LaunchUsecase.swift -// CMC -// -// Created by Siri on 2023/10/24. -// Copyright © 2023 com.centralMakeusChallenge. All rights reserved. -// - -import Foundation -import RxSwift - -protocol LaunchUsecase { - func health() -> Single -} diff --git a/CMC/Sources/Extensions/Extensions.swift b/CMC/Sources/Extensions/Extensions.swift deleted file mode 100644 index e924106..0000000 --- a/CMC/Sources/Extensions/Extensions.swift +++ /dev/null @@ -1,9 +0,0 @@ -// -// Extensions.swift -// CMC -// -// Created by Siri on 2023/10/22. -// Copyright © 2023 com.centralMakeusChallenge. All rights reserved. -// - -import Foundation diff --git a/CMC/Sources/Presenter/Auth/Coordinators/AuthCoordinator.swift b/CMC/Sources/Presenter/Auth/Coordinators/AuthCoordinator.swift deleted file mode 100644 index da221f3..0000000 --- a/CMC/Sources/Presenter/Auth/Coordinators/AuthCoordinator.swift +++ /dev/null @@ -1,94 +0,0 @@ -// -// AuthCoordinator.swift -// CMC -// -// Created by Siri on 10/25/23. -// Copyright © 2023 com.centralMakeusChallenge. All rights reserved. -// - -import RxCocoa -import RxSwift -import UIKit - -class AuthCoordinator: CoordinatorType { - // MARK: - Navigation DEPTH 1 - - enum AuthCoordinatorChild{ - case main - case signUp - case signIn - /// SignIn이 AuthHome의 역할 - } - - // MARK: - Need To Initializing - var disposeBag: DisposeBag - var navigationController: UINavigationController - - // MARK: - Don't Need To Initializing - var childCoordinators: [CoordinatorType] = [] - var delegate: CoordinatorDelegate? - var userActionState: PublishRelay = PublishRelay() - /// init에서만 호출하고, stream을 유지하기위해 BehaviorSubject 사용 - - init( - navigationController: UINavigationController - ){ - self.navigationController = navigationController - self.disposeBag = DisposeBag() - self.setState() - } - - func setState() { - self.userActionState - .observe(on: MainScheduler.instance) - .subscribe(onNext: { [weak self] state in - guard let self = self else {return} - CMCIndecatorManager.shared.show() - switch state{ - case .main: - let mainAuthViewController = MainAuthViewController( - viewModel: MainAuthViewModel( - coordinator: self - ) - ) - if self.navigationController.viewControllers.contains(where: {$0 is MainAuthViewController}) { - self.navigationController.popViewController(animated: true) - }else { - self.pushViewController(viewController: mainAuthViewController) - CMCIndecatorManager.shared.hide() - } - case .signUp: - let signUpViewController = SignUpViewController( - viewModel: SignUpViewModel( - coordinator: self, - authUsecase: DefaultAuthUsecase( - authRepository: DefaultAuthRepository() - ) - ) - ) - if self.navigationController.viewControllers.contains(where: {$0 is SignInViewController}) { - self.navigationController.popViewController(animated: true) - } - self.pushViewController(viewController: signUpViewController) - case .signIn: - let signInViewController = SignInViewController( - viewModel: SignInViewModel( - coordinator: self, - authUsecase: DefaultAuthUsecase( - authRepository: DefaultAuthRepository() - ) - ) - ) - if self.navigationController.viewControllers.contains(where: {$0 is SignUpViewController}) { - self.navigationController.popViewController(animated: true) - } - self.pushViewController(viewController: signInViewController) - CMCIndecatorManager.shared.hide() - } - }).disposed(by: disposeBag) - } - - func start() { - self.userActionState.accept(.main) - } - -} diff --git a/CMC/Sources/Presenter/Auth/MainAuthViewController.swift b/CMC/Sources/Presenter/Auth/MainAuthViewController.swift deleted file mode 100644 index 91e9744..0000000 --- a/CMC/Sources/Presenter/Auth/MainAuthViewController.swift +++ /dev/null @@ -1,127 +0,0 @@ -// -// MainAuthViewController.swift -// CMC -// -// Created by Siri on 10/25/23. -// Copyright © 2023 com.centralMakeusChallenge. All rights reserved. -// - -import Foundation - -import RxCocoa -import RxSwift - -import DesignSystem -import SnapKit - -import UIKit - -class MainAuthViewController: BaseViewController { - - // MARK: - UI - - private lazy var backgroundImageView: UIImageView = { - let imageView = UIImageView() - imageView.image = CMCAsset.splash.image - return imageView - }() - - private lazy var mainTitle: UIImageView = { - let label = UIImageView() - label.image = CMCAsset.splashTitle.image - return label - }() - - private lazy var mainLogo: UIImageView = { - let imageView = UIImageView() - imageView.image = CMCAsset.splashLogo.image - return imageView - }() - - private lazy var signInButton: CMCButton = { - let button = CMCButton( - isRound: false, - type: .login(.inactive), - title: "로그인" - ) - return button - }() - - private lazy var signUpButton: CMCButton = { - let button = CMCButton( - isRound: false, - type: .login(.clear), - title: "회원가입" - ) - return button - }() - - // MARK: - Properties - private let viewModel: MainAuthViewModel - - // MARK: - Initializers - init( - viewModel: MainAuthViewModel - ) { - self.viewModel = viewModel - super.init() - } - - // MARK: - LifeCycle - override func viewDidLoad() { - super.viewDidLoad() - } - - // MARK: - Methods - - override func setAddSubView() { - self.view.addSubview(backgroundImageView) - self.view.addSubview(mainTitle) - self.view.addSubview(mainLogo) - self.view.addSubview(signInButton) - self.view.addSubview(signUpButton) - } - - override func setConstraint() { - backgroundImageView.snp.makeConstraints { make in - make.edges.equalToSuperview() - } - - mainTitle.snp.makeConstraints { make in - make.leading.equalToSuperview().offset(44) - make.trailing.equalToSuperview().offset(-44) - make.top.equalToSuperview().offset(180) - } - - mainLogo.snp.makeConstraints { make in - make.centerX.equalToSuperview() - make.top.equalTo(mainTitle.snp.bottom).offset(60) - make.width.height.equalTo(108) - } - - signInButton.snp.makeConstraints { make in - make.centerX.equalToSuperview() - make.height.equalTo(56) - make.width.equalTo(self.view.frame.width - 48) - make.top.equalTo(mainLogo.snp.bottom).offset(84) - } - - signUpButton.snp.makeConstraints { make in - make.centerX.equalToSuperview() - make.height.equalTo(56) - make.width.equalTo(self.view.frame.width - 48) - make.top.equalTo(signInButton.snp.bottom).offset(28) - } - - } - - override func bind() { - let input = MainAuthViewModel.Input( - signInBtnTapped: signInButton.rx.tap.asObservable(), - signUpBtnTapped: signUpButton.rx.tap.asObservable() - ) - - let _ = viewModel.transform(input: input) - - } -} diff --git a/CMC/Sources/Presenter/Auth/MainAuthViewModel.swift b/CMC/Sources/Presenter/Auth/MainAuthViewModel.swift deleted file mode 100644 index c72a1d0..0000000 --- a/CMC/Sources/Presenter/Auth/MainAuthViewModel.swift +++ /dev/null @@ -1,50 +0,0 @@ -// -// MainAuthViewModel.swift -// CMC -// -// Created by Siri on 10/25/23. -// Copyright © 2023 com.centralMakeusChallenge. All rights reserved. -// - -import Foundation - -import RxCocoa -import RxSwift - -class MainAuthViewModel: ViewModelType{ - - struct Input { - let signInBtnTapped: Observable - let signUpBtnTapped: Observable - } - - struct Output {} - - var disposeBag: DisposeBag = DisposeBag() - - weak var coordinator: AuthCoordinator? - - init( - coordinator: AuthCoordinator - ) { - self.coordinator = coordinator - } - - - func transform(input: Input) -> Output { - input.signInBtnTapped - .withUnretained(self) - .subscribe(onNext: { owner, _ in - owner.coordinator?.userActionState.accept(.signIn) - }).disposed(by: disposeBag) - - input.signUpBtnTapped - .withUnretained(self) - .subscribe(onNext: { owner, _ in - owner.coordinator?.userActionState.accept(.signUp) - }).disposed(by: disposeBag) - - return Output() - } - -} diff --git a/CMC/Sources/Presenter/Auth/SignIn/FindPassword/FindPasswordScrollPages/ConfirmCertifyCode/ConfirmCertifyCodeView.swift b/CMC/Sources/Presenter/Auth/SignIn/FindPassword/FindPasswordScrollPages/ConfirmCertifyCode/ConfirmCertifyCodeView.swift deleted file mode 100644 index c10966a..0000000 --- a/CMC/Sources/Presenter/Auth/SignIn/FindPassword/FindPasswordScrollPages/ConfirmCertifyCode/ConfirmCertifyCodeView.swift +++ /dev/null @@ -1,203 +0,0 @@ -// -// ConfirmCertifyCodeView.swift -// CMC -// -// Created by Siri on 11/15/23. -// Copyright © 2023 com.softsquared.cmc. All rights reserved. -// - -import Foundation - -import RxCocoa -import RxGesture -import RxSwift - -import DesignSystem -import SnapKit - -import UIKit - -final class ConfirmCertifyCodeView: BaseView { - - // MARK: - UI - - private lazy var titleLabel: UILabel = { - let label = UILabel() - label.text = "비밀번호 재설정" - label.font = DesignSystemFontFamily.Pretendard.bold.font(size: 26) - label.textColor = DesignSystemAsset.gray50.color - label.translatesAutoresizingMaskIntoConstraints = false - return label - }() - - private lazy var subTitle: UILabel = { - let label = UILabel() - label.text = "이메일로 인증번호를 전송했어요\n인증번호를 입력해주세요!" - label.font = DesignSystemFontFamily.Pretendard.medium.font(size: 14) - label.numberOfLines = 2 - label.textColor = DesignSystemAsset.gray500.color - label.translatesAutoresizingMaskIntoConstraints = false - return label - }() - - private lazy var certifyCodeTextField: CMCTextField_Timer = { - let textField = CMCTextField_Timer( - placeHolder: "인증번호를 입력해주세요", - textFieldSubTitle: "인증번호", - buttonTitle: "재요청", - keyboardType: .numberPad - ) - textField.translatesAutoresizingMaskIntoConstraints = false - return textField - }() - - private lazy var confirmCertifyCodeButton: CMCButton = { - let button = CMCButton( - isRound: false, - iconTitle: nil, - type: .login(.disabled), - title: "인증번호 확인" - ) - button.translatesAutoresizingMaskIntoConstraints = false - return button - }() - - // MARK: - Properties - private var viewModel: ConfirmCertifyCodeViewModel - private var parentViewModel: FindPasswordViewModel - - // MARK: - Initializers - init( - viewModel: ConfirmCertifyCodeViewModel, - parentViewModel: FindPasswordViewModel - ) { - self.viewModel = viewModel - self.parentViewModel = parentViewModel - super.init(frame: .zero) - self.backgroundColor = CMCAsset.background.color - } - - - required init?(coder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } - - // MARK: - LifeCycle - // MARK: - Methods - - override func setAddSubView() { - addSubview(titleLabel) - addSubview(subTitle) - addSubview(certifyCodeTextField) - addSubview(confirmCertifyCodeButton) - } - - override func setConstraint() { - - titleLabel.snp.makeConstraints{ titleLabel in - titleLabel.top.equalToSuperview().offset(30) - titleLabel.leading.equalToSuperview().offset(24) - } - - subTitle.snp.makeConstraints { - $0.top.equalTo(titleLabel.snp.bottom).offset(24) - $0.leading.equalToSuperview().offset(24) - } - - certifyCodeTextField.snp.makeConstraints { - $0.top.equalTo(subTitle.snp.bottom).offset(30) - $0.leading.equalToSuperview().offset(24) - $0.trailing.equalToSuperview().offset(-24) - $0.height.equalTo(74) - } - - confirmCertifyCodeButton.snp.makeConstraints{ confirmCertifyCodeButton in - confirmCertifyCodeButton.leading.trailing.equalToSuperview().inset(20) - confirmCertifyCodeButton.bottom.equalTo(self.keyboardLayoutGuide.snp.top).offset(-20) - confirmCertifyCodeButton.height.equalTo(56) - } - } - - override func bind() { - - self.rx.tapGesture() - .when(.recognized) - .withUnretained(self) - .subscribe(onNext: { owner, gesture in - owner.endEditing(true) - }) - .disposed(by: disposeBag) - - parentViewModel.timerStart - .withUnretained(self) - .subscribe(onNext: { owner, _ in - owner.certifyCodeTextField.resetTimer() - }) - .disposed(by: disposeBag) - - let input = ConfirmCertifyCodeViewModel.Input( - email: parentViewModel.email.asObservable(), - certifiedCode: certifyCodeTextField.rx.text.orEmpty.asObservable(), - reSendButtonTapped: certifyCodeTextField.accessoryCMCButton.rx.tap.asObservable(), - certifyCodeTapped: confirmCertifyCodeButton.rx.tap.asObservable() - ) - - let output = viewModel.transform(input: input) - - output.certifyCodeResult - .observe(on: MainScheduler.instance) - .subscribe(onNext: { [weak self] isSuccessed in - guard let ss = self else { return } - if isSuccessed { - ss.parentViewModel.nowPage.accept(3) - } else { - CMCBottomSheetManager.shared.showBottomSheet( - title: "올바르지 않은 인증번호에요", - body: "인증번호를 확인해주세요 :(", - buttonTitle: "확인" - ) - } - }) - .disposed(by: disposeBag) - - output.resendCertifyCode - .observe(on: MainScheduler.instance) - .subscribe(onNext: { [weak self] isSuccessed in - guard let ss = self else { return } - if isSuccessed { - ss.parentViewModel.timerStart.accept(()) - CMCBottomSheetManager.shared.showBottomSheet( - title: "인증번호를 전송했어요", - body: "3분 내 인증번호를 입력해주세요 :)", - buttonTitle: "확인" - ) - } else { - CMCBottomSheetManager.shared.showBottomSheet( - title: "존재하지 않는 계정이에요", - body: "아이디 찾기는 운영진에게 문의해주세요 :)", - buttonTitle: "확인" - ) - } - }) - .disposed(by: disposeBag) - - output.codeValidation - .observe(on: MainScheduler.instance) - .subscribe(onNext: { [weak self] isValid in - guard let ss = self else { return } - isValid - ? ss.confirmCertifyCodeButton.rxType.accept(.login(.inactive)) - : ss.confirmCertifyCodeButton.rxType.accept(.login(.disabled)) - }) - .disposed(by: disposeBag) - - } -} - -extension ConfirmCertifyCodeView { - fileprivate func isPointInsideTextField(_ point: CGPoint) -> Bool { - // 모든 텍스트 필드를 순회하면서 탭된 위치가 텍스트 필드 내부인지 확인합니다. - let textFields = [certifyCodeTextField] - return textFields.contains(where: { $0.frame.contains(point) }) - } -} diff --git a/CMC/Sources/Presenter/Auth/SignIn/FindPassword/FindPasswordScrollPages/ConfirmCertifyCode/ConfirmCertifyCodeViewModel.swift b/CMC/Sources/Presenter/Auth/SignIn/FindPassword/FindPasswordScrollPages/ConfirmCertifyCode/ConfirmCertifyCodeViewModel.swift deleted file mode 100644 index 9284d06..0000000 --- a/CMC/Sources/Presenter/Auth/SignIn/FindPassword/FindPasswordScrollPages/ConfirmCertifyCode/ConfirmCertifyCodeViewModel.swift +++ /dev/null @@ -1,87 +0,0 @@ -// -// ConfirmCertifyCodeViewModel.swift -// CMC -// -// Created by Siri on 11/15/23. -// Copyright © 2023 com.softsquared.cmc. All rights reserved. -// - -import Foundation -import UIKit - -import RxCocoa -import RxSwift - - -final class ConfirmCertifyCodeViewModel: ViewModelType { - - struct Input { - let email: Observable - let certifiedCode: Observable - let reSendButtonTapped: Observable - let certifyCodeTapped: Observable - } - - struct Output { - let resendCertifyCode: Observable - let certifyCodeResult: Observable - let codeValidation: Observable - } - - var disposeBag: DisposeBag = DisposeBag() - private let usecase: AuthUsecase - - init( - usecase: AuthUsecase - ) { - self.usecase = usecase - } - - - func transform(input: Input) -> Output { - - let resendCertifyCode = input.reSendButtonTapped - .withLatestFrom(input.email) - .withUnretained(self) - .flatMapLatest { owner, email -> Observable in - let query = SendCertifyCodeQuery(email: email) - return owner.usecase.sendCertifyCode(query: query) - .asObservable() - .map { _ in true} - .catch { _ in - return .just(false) - } - } - .share() - - let certifyCodeResult = input.certifyCodeTapped - .withLatestFrom(Observable.combineLatest(input.certifiedCode, input.email)) - .withUnretained(self) - .flatMapLatest { owner, result -> Observable in - let (code, email) = result - let body = ConfirmCertifyCodeBody(email: email, code: code) - return owner.usecase.confirmCertifyCode(body: body) - .asObservable() - .map { _ in true} - .catch { _ in - return .just(false) - } - } - .share() - - let codeValidation = input.certifiedCode - .map { code -> Bool in - return code.count >= 6 - } - .asObservable() - - return Output( - resendCertifyCode: resendCertifyCode, - certifyCodeResult: certifyCodeResult, - codeValidation: codeValidation - ) - - } - - -} diff --git a/CMC/Sources/Presenter/Auth/SignIn/FindPassword/FindPasswordScrollPages/ResettingPassword/ResettingPasswordView.swift b/CMC/Sources/Presenter/Auth/SignIn/FindPassword/FindPasswordScrollPages/ResettingPassword/ResettingPasswordView.swift deleted file mode 100644 index d42d92f..0000000 --- a/CMC/Sources/Presenter/Auth/SignIn/FindPassword/FindPasswordScrollPages/ResettingPassword/ResettingPasswordView.swift +++ /dev/null @@ -1,238 +0,0 @@ -// -// ResettingPasswordView.swift -// CMC -// -// Created by Siri on 11/15/23. -// Copyright © 2023 com.softsquared.cmc. All rights reserved. -// - -import Foundation - -import RxCocoa -import RxGesture -import RxSwift - -import DesignSystem -import SnapKit - -import UIKit - -final class ResettingPasswordView: BaseView { - // MARK: - UI - - private lazy var scrollView: UIScrollView = { - let scrollView = UIScrollView() - scrollView.isScrollEnabled = true - return scrollView - }() - - private lazy var mainContentView: UIView = { - let view = UIView() - return view - }() - - private lazy var titleLabel: UILabel = { - let label = UILabel() - label.text = "비밀번호 재설정" - label.font = DesignSystemFontFamily.Pretendard.bold.font(size: 26) - label.textColor = DesignSystemAsset.gray50.color - label.translatesAutoresizingMaskIntoConstraints = false - return label - }() - - private lazy var passwordTextField: CMCTextField = { - let textField = CMCTextField( - placeHolder: "비밀번호를 입력해주세요", - textFieldSubTitle: "비밀번호", - accessoryType: .image(image: CMCAsset._24x24hide.image), - keyboardType: .default - ) - textField.accessoryButton.setImage(CMCAsset._24x24show.image, for: .selected) - return textField - }() - - private lazy var passwordErrorCells: [CMCErrorMessage] = { - let errorCell: [CMCErrorMessage] = [ - CMCErrorMessage(title: "영문", type: .disabled), - CMCErrorMessage(title: "숫자", type: .disabled), - CMCErrorMessage(title: "8자~16자", type: .disabled) - ] - return errorCell - }() - - private lazy var passwordErrorStackView: UIStackView = { - let stackView = UIStackView( - arrangedSubviews: - [ passwordErrorCells[0], - passwordErrorCells[1], - passwordErrorCells[2] ] - ) - stackView.axis = .horizontal - stackView.spacing = 8 - return stackView - }() - - private lazy var confirmPasswordTextField: CMCTextField = { - let textField = CMCTextField( - placeHolder: "비밀번호를 입력해주세요", - textFieldSubTitle: "비밀번호 확인", - accessoryType: .image(image: CMCAsset._24x24hide.image), - keyboardType: .default - ) - textField.accessoryButton.setImage(CMCAsset._24x24show.image, for: .selected) - return textField - }() - - - private lazy var passwordCheckErrorCell: CMCErrorMessage = { - let errorCell = CMCErrorMessage(title: "비밀번호 일치", type: .disabled) - return errorCell - }() - - // MARK: - Properties - private var viewModel: ResettingPasswordViewModel - private var parentViewModel: FindPasswordViewModel - - - // MARK: - Initializers - init( - viewModel: ResettingPasswordViewModel, - parentViewModel: FindPasswordViewModel - ) { - self.viewModel = viewModel - self.parentViewModel = parentViewModel - super.init(frame: .zero) - self.backgroundColor = CMCAsset.background.color - } - - - required init?(coder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } - - // MARK: - LifeCycle - - // MARK: - Methods - - override func setAddSubView() { - self.addSubview(scrollView) - scrollView.addSubview(mainContentView) - - mainContentView.addSubview(titleLabel) - mainContentView.addSubview(passwordTextField) - mainContentView.addSubview(passwordErrorStackView) - mainContentView.addSubview(confirmPasswordTextField) - mainContentView.addSubview(passwordCheckErrorCell) - } - - override func setConstraint() { - - scrollView.snp.makeConstraints { make in - make.top.leading.trailing.bottom.equalToSuperview() - } - - mainContentView.snp.makeConstraints { make in - make.edges.equalTo(scrollView.contentLayoutGuide) - make.width.equalTo(scrollView.frameLayoutGuide.snp.width) - } - - titleLabel.snp.makeConstraints{ titleLabel in - titleLabel.top.equalToSuperview().offset(30) - titleLabel.leading.equalToSuperview().offset(24) - } - - passwordTextField.snp.makeConstraints{ make in - make.top.equalTo(titleLabel.snp.bottom).offset(24) - make.leading.equalToSuperview().offset(24) - make.trailing.equalToSuperview().offset(-24) - make.height.equalTo(74) - } - - passwordErrorStackView.snp.makeConstraints{ make in - make.top.equalTo(passwordTextField.snp.bottom).offset(9) - make.leading.equalTo(passwordTextField).offset(5) - } - - confirmPasswordTextField.snp.makeConstraints{ make in - make.top.equalTo(passwordErrorStackView.snp.bottom).offset(30) - make.leading.equalToSuperview().offset(24) - make.trailing.equalToSuperview().offset(-24) - make.height.equalTo(74) - } - - passwordCheckErrorCell.snp.makeConstraints{ make in - make.top.equalTo(confirmPasswordTextField.snp.bottom).offset(9) - make.leading.equalTo(confirmPasswordTextField).offset(5) - make.bottom.equalToSuperview().offset(-24) - } - - } - - override func bind() { - - self.rx.tapGesture() - .when(.recognized) - .withUnretained(self) - .subscribe(onNext: { owner, gesture in - let location = gesture.location(in: owner.scrollView) - if !owner.isPointInsideTextField(location) { - owner.endEditing(true) - } - }) - .disposed(by: disposeBag) - - - passwordTextField.accessoryState - .observe(on: MainScheduler.instance) - .withUnretained(self) - .subscribe(onNext: { owner, state in - owner.passwordTextField.isSecureTextEntry = !state - }) - .disposed(by: disposeBag) - - confirmPasswordTextField.accessoryState - .observe(on: MainScheduler.instance) - .withUnretained(self) - .subscribe(onNext: { owner, state in - owner.confirmPasswordTextField.isSecureTextEntry = !state - }) - .disposed(by: disposeBag) - - let input = ResettingPasswordViewModel.Input( - password: passwordTextField.rx.text.orEmpty.asObservable(), - rePassword: confirmPasswordTextField.rx.text.orEmpty.asObservable() - ) - - let output = viewModel.transform(input: input) - - output.passwordValidations.enumerated() - .map { idx, observable in - observable - .withUnretained(self) - .subscribe(onNext: { owner, active in - let type: CMCErrorMessage.CMCErrorMessageType = active ? .success : .disabled - owner.passwordErrorCells[idx].rxType.accept(type) - }) - } - .forEach { $0.disposed(by: disposeBag) } - - output.passwordConfirmRegex - .withUnretained(self) - .subscribe(onNext: { owner, active in - let type: CMCErrorMessage.CMCErrorMessageType = active ? .success : .disabled - owner.passwordCheckErrorCell.rxType.accept(type) - }) - .disposed(by: disposeBag) - - } - -} - - -extension ResettingPasswordView { - fileprivate func isPointInsideTextField(_ point: CGPoint) -> Bool { - // 모든 텍스트 필드를 순회하면서 탭된 위치가 텍스트 필드 내부인지 확인합니다. - let textFields = [passwordTextField, confirmPasswordTextField] - return textFields.contains(where: { $0.frame.contains(point) }) - } -} diff --git a/CMC/Sources/Presenter/Auth/SignIn/FindPassword/FindPasswordScrollPages/ResettingPassword/ResettingPasswordViewModel.swift b/CMC/Sources/Presenter/Auth/SignIn/FindPassword/FindPasswordScrollPages/ResettingPassword/ResettingPasswordViewModel.swift deleted file mode 100644 index 22ea516..0000000 --- a/CMC/Sources/Presenter/Auth/SignIn/FindPassword/FindPasswordScrollPages/ResettingPassword/ResettingPasswordViewModel.swift +++ /dev/null @@ -1,65 +0,0 @@ -// -// ResettingPasswordViewModel.swift -// CMC -// -// Created by Siri on 11/15/23. -// Copyright © 2023 com.softsquared.cmc. All rights reserved. -// - -import Foundation - -import RxCocoa -import RxSwift - -import UIKit - -final class ResettingPasswordViewModel: ViewModelType { - - struct Input { - let password: Observable - let rePassword: Observable - } - - struct Output { - let passwordValidations: [Observable] - let passwordConfirmRegex: Observable - let nextAvailable: Observable - } - - var disposeBag: DisposeBag = DisposeBag() - - // MARK: - Initializers - init() { - - } - - func transform(input: Input) -> Output { - - let passwordValidations: [Observable] = [ - .englishRegex, - .numberRegex, - .lengthRegex - ].map({validate in - Utility.checkPasswordValidation(password: input.password, validate: validate) - }) - - let passwordRegex = Observable.combineLatest(passwordValidations) - .map { $0.allSatisfy { $0 } } - - let passwordConfirmRegex = Observable.combineLatest(input.password, input.rePassword) - .map { $0 == $1 && !$0.isEmpty} - - let nextAvailable = Observable.combineLatest( - passwordRegex, - passwordConfirmRegex - ) - .map { $0 && $1 } - - return Output( - passwordValidations: passwordValidations, - passwordConfirmRegex: passwordConfirmRegex, - nextAvailable: nextAvailable - ) - } - -} diff --git a/CMC/Sources/Presenter/Auth/SignIn/FindPassword/FindPasswordScrollPages/SendCertifyCode/SendCertifyCodeView.swift b/CMC/Sources/Presenter/Auth/SignIn/FindPassword/FindPasswordScrollPages/SendCertifyCode/SendCertifyCodeView.swift deleted file mode 100644 index 2b6fae1..0000000 --- a/CMC/Sources/Presenter/Auth/SignIn/FindPassword/FindPasswordScrollPages/SendCertifyCode/SendCertifyCodeView.swift +++ /dev/null @@ -1,185 +0,0 @@ -// -// SendCertifyCodeView.swift -// CMC -// -// Created by Siri on 11/15/23. -// Copyright © 2023 com.softsquared.cmc. All rights reserved. -// - -import Foundation - -import RxCocoa -import RxGesture -import RxSwift - -import DesignSystem -import SnapKit - -import UIKit - -final class SendCertifyCodeView: BaseView { - - // MARK: - UI - - private lazy var titleLabel: UILabel = { - let label = UILabel() - label.text = "비밀번호 재설정" - label.font = DesignSystemFontFamily.Pretendard.bold.font(size: 26) - label.textColor = DesignSystemAsset.gray50.color - label.translatesAutoresizingMaskIntoConstraints = false - return label - }() - - private lazy var subTitle: UILabel = { - let label = UILabel() - label.text = "가입하신 이메일을 인증해주시면\n비밀번호 재설정이 가능해요!" - label.font = DesignSystemFontFamily.Pretendard.medium.font(size: 14) - label.numberOfLines = 2 - label.textColor = DesignSystemAsset.gray500.color - label.translatesAutoresizingMaskIntoConstraints = false - return label - }() - - private lazy var emailTextField: CMCTextField = { - let textField = CMCTextField( - placeHolder: "이메일을 입력해주세요", - textFieldSubTitle: "이메일", - accessoryType: .none, - keyboardType: .emailAddress - ) - textField.translatesAutoresizingMaskIntoConstraints = false - return textField - }() - - private lazy var receiveCertiftyButton: CMCButton = { - let button = CMCButton( - isRound: false, - iconTitle: nil, - type: .login(.disabled), - title: "인증번호 받기" - ) - button.translatesAutoresizingMaskIntoConstraints = false - return button - }() - - // MARK: - Properties - private var viewModel: SendCertifyCodeViewModel - private var parentViewModel: FindPasswordViewModel - - // MARK: - Initializers - init( - viewModel: SendCertifyCodeViewModel, - parentViewModel: FindPasswordViewModel - ) { - self.viewModel = viewModel - self.parentViewModel = parentViewModel - super.init(frame: .zero) - self.backgroundColor = CMCAsset.background.color - } - - - required init?(coder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } - - // MARK: - LifeCycle - // MARK: - Methods - - override func setAddSubView() { - addSubview(titleLabel) - addSubview(subTitle) - addSubview(emailTextField) - addSubview(receiveCertiftyButton) - } - - override func setConstraint() { - - titleLabel.snp.makeConstraints{ titleLabel in - titleLabel.top.equalToSuperview().offset(30) - titleLabel.leading.equalToSuperview().offset(24) - } - - subTitle.snp.makeConstraints { - $0.top.equalTo(titleLabel.snp.bottom).offset(14) - $0.leading.equalToSuperview().offset(24) - } - - emailTextField.snp.makeConstraints { - $0.top.equalTo(subTitle.snp.bottom).offset(30) - $0.leading.equalToSuperview().offset(24) - $0.trailing.equalToSuperview().offset(-24) - $0.height.equalTo(74) - } - - receiveCertiftyButton.snp.makeConstraints{ receiveCertiftyButton in - receiveCertiftyButton.leading.trailing.equalToSuperview().inset(20) - receiveCertiftyButton.bottom.equalTo(self.keyboardLayoutGuide.snp.top).offset(-20) - receiveCertiftyButton.height.equalTo(56) - } - } - - override func bind() { - - self.rx.tapGesture() - .when(.recognized) - .withUnretained(self) - .subscribe(onNext: { owner, gesture in - let location = gesture.location(in: owner) - if !owner.isPointInsideTextField(location) { - owner.endEditing(true) - } - }) - .disposed(by: disposeBag) - - self.emailTextField.rx.text.orEmpty - .bind(to: parentViewModel.email) - .disposed(by: disposeBag) - - let input = SendCertifyCodeViewModel.Input( - email: emailTextField.rx.text.orEmpty.asObservable(), - receiveCertifyTapped: receiveCertiftyButton.rx.tap.asObservable() - ) - - let output = viewModel.transform(input: input) - - output.emailValidation - .withUnretained(self) - .subscribe(onNext: { owner, isEnable in - isEnable == true - ? owner.receiveCertiftyButton.rxType.accept(.login(.inactive)) - : owner.receiveCertiftyButton.rxType.accept(.login(.disabled)) - }) - .disposed(by: disposeBag) - - output.sendCertifyResult - .observe(on: MainScheduler.instance) - .subscribe(onNext: { [weak self] isSuccessed in - guard let ss = self else { return } - if isSuccessed { - ss.parentViewModel.nowPage.accept(2) - ss.parentViewModel.timerStart.accept(()) - CMCBottomSheetManager.shared.showBottomSheet( - title: "인증번호를 전송했어요", - body: "3분 내 인증번호를 입력해주세요 :)", - buttonTitle: "확인" - ) - } else { - CMCBottomSheetManager.shared.showBottomSheet( - title: "존재하지 않는 계정이에요", - body: "아이디 찾기는 운영진에게 문의해주세요 :)", - buttonTitle: "확인" - ) - } - }) - .disposed(by: disposeBag) - - } -} - -extension SendCertifyCodeView { - fileprivate func isPointInsideTextField(_ point: CGPoint) -> Bool { - // 모든 텍스트 필드를 순회하면서 탭된 위치가 텍스트 필드 내부인지 확인합니다. - let textFields = [emailTextField] - return textFields.contains(where: { $0.frame.contains(point) }) - } -} diff --git a/CMC/Sources/Presenter/Auth/SignIn/FindPassword/FindPasswordScrollPages/SendCertifyCode/SendCertifyCodeViewModel.swift b/CMC/Sources/Presenter/Auth/SignIn/FindPassword/FindPasswordScrollPages/SendCertifyCode/SendCertifyCodeViewModel.swift deleted file mode 100644 index d00544a..0000000 --- a/CMC/Sources/Presenter/Auth/SignIn/FindPassword/FindPasswordScrollPages/SendCertifyCode/SendCertifyCodeViewModel.swift +++ /dev/null @@ -1,65 +0,0 @@ -// -// SendCertifyCodeViewModel.swift -// CMC -// -// Created by Siri on 11/15/23. -// Copyright © 2023 com.softsquared.cmc. All rights reserved. -// - -import Foundation - -import RxCocoa -import RxSwift - -import UIKit - -final class SendCertifyCodeViewModel: ViewModelType { - - struct Input { - let email: Observable - let receiveCertifyTapped: Observable - } - - struct Output { - let sendCertifyResult: Observable - let emailValidation: Observable - } - - // MARK: - Properties - var disposeBag: DisposeBag = DisposeBag() - private let usecase: AuthUsecase - - // MARK: - Initializers - init( - usecase: AuthUsecase - ) { - self.usecase = usecase - } - - private var allcertifyEmailRelay = BehaviorRelay(value: false) - - func transform(input: Input) -> Output { - let emailValidation: Observable = Utility.checkEmailValidation(email: input.email, validate: .emailRegex) - - let sendCertifyResult = input.receiveCertifyTapped - .withLatestFrom(input.email) - .withUnretained(self) - .flatMapLatest { owner, email -> Observable in - let query = SendCertifyCodeQuery(email: email) - return owner.usecase.sendCertifyCode(query: query) - .asObservable() - .map { _ in true} - .catch { _ in - return .just(false) - } - } - .share() - - return Output( - sendCertifyResult: sendCertifyResult, - emailValidation: emailValidation - ) - } - -} - diff --git a/CMC/Sources/Presenter/Auth/SignIn/FindPassword/FindPasswordViewController.swift b/CMC/Sources/Presenter/Auth/SignIn/FindPassword/FindPasswordViewController.swift deleted file mode 100644 index 063fbf2..0000000 --- a/CMC/Sources/Presenter/Auth/SignIn/FindPassword/FindPasswordViewController.swift +++ /dev/null @@ -1,155 +0,0 @@ -// -// FindPasswordViewController.swift -// CMC -// -// Created by Siri on 11/15/23. -// Copyright © 2023 com.softsquared.cmc. All rights reserved. -// - -import Foundation - -import RxCocoa -import RxSwift - -import DesignSystem -import SnapKit - -import UIKit - -class FindPasswordViewController: BaseViewController { - - // MARK: - UI - - private lazy var navigationBar: CMCNavigationBar = { - let navigationBar = CMCNavigationBar( - accessoryLabelHidden: false - ) - navigationBar.accessoryLabel.text = "" - navigationBar.translatesAutoresizingMaskIntoConstraints = false - return navigationBar - }() - - private lazy var emailView: SendCertifyCodeView = { - let view = SendCertifyCodeView( - viewModel: SendCertifyCodeViewModel( - usecase: DefaultAuthUsecase( - authRepository: DefaultAuthRepository() - ) - ), - parentViewModel: viewModel - ) - view.translatesAutoresizingMaskIntoConstraints = false - return view - }() - - private lazy var certifyNumberView: ConfirmCertifyCodeView = { - let view = ConfirmCertifyCodeView( - viewModel: ConfirmCertifyCodeViewModel( - usecase: DefaultAuthUsecase( - authRepository: DefaultAuthRepository() - ) - ), - parentViewModel: viewModel - ) - view.translatesAutoresizingMaskIntoConstraints = false - return view - }() - - private lazy var resettingPasswordView: ResettingPasswordView = { - let view = ResettingPasswordView( - viewModel: ResettingPasswordViewModel(), - parentViewModel: viewModel - ) - view.translatesAutoresizingMaskIntoConstraints = false - return view - }() - - private lazy var reSettingPasswordPager: UIScrollView = { - let scrollView = UIScrollView() - scrollView.isPagingEnabled = true - scrollView.showsHorizontalScrollIndicator = false - scrollView.showsVerticalScrollIndicator = false - scrollView.bounces = false - scrollView.isScrollEnabled = false - scrollView.translatesAutoresizingMaskIntoConstraints = false - return scrollView - }() - - // MARK: - Properties - private let viewModel: FindPasswordViewModel - private let nowPage = BehaviorRelay(value: 1) - - private var contentOffset: Double = 0 - // MARK: - Initializers - init( - viewModel: FindPasswordViewModel - ) { - self.viewModel = viewModel - super.init() - } - - // MARK: - LifeCycle - override func viewDidLayoutSubviews() { - super.viewDidLayoutSubviews() - - for (index, page) in [emailView, certifyNumberView, resettingPasswordView].enumerated() { - reSettingPasswordPager.addSubview(page) - page.snp.makeConstraints { make in - make.top.equalTo(navigationBar.snp.bottom) - make.bottom.equalTo(self.view.safeAreaLayoutGuide.snp.bottom) - make.width.equalTo(self.view.frame.size.width) - make.leading.equalToSuperview().offset(CGFloat(index) * self.view.frame.size.width) - } - } - reSettingPasswordPager.contentSize = CGSize( - width: self.view.frame.size.width * CGFloat(3), - height: reSettingPasswordPager.frame.size.height - ) - } - // MARK: - Methods - - - override func setAddSubView() { - self.view.addSubview(navigationBar) - self.view.addSubview(reSettingPasswordPager) - - } - - override func setConstraint() { - navigationBar.snp.makeConstraints{ navigationBar in - navigationBar.top.equalTo(self.view.safeAreaLayoutGuide) - navigationBar.leading.trailing.equalToSuperview() - navigationBar.height.equalTo(68) - } - - reSettingPasswordPager.snp.makeConstraints{ cmcPager in - cmcPager.top.equalTo(navigationBar.snp.bottom) - cmcPager.leading.trailing.equalToSuperview() - cmcPager.bottom.equalTo(self.view.safeAreaLayoutGuide.snp.bottom) - } - - } - - override func bind() { - - - let input = FindPasswordViewModel.Input( - backButtonTapped: navigationBar.backButton.rx.tapped().asObservable() - ) - - let output = viewModel.transform(input: input) - - - output.afterPage - .subscribe(onNext: { [weak self] page in - guard let self = self else { return } - let xOffset = CGFloat(page - 1) * CGFloat(self.view.frame.width) - self.reSettingPasswordPager.setContentOffset( - CGPoint(x: xOffset, y: 0), animated: true - ) - }) - .disposed(by: disposeBag) - - } - -} diff --git a/CMC/Sources/Presenter/Auth/SignIn/FindPassword/FindPasswordViewModel.swift b/CMC/Sources/Presenter/Auth/SignIn/FindPassword/FindPasswordViewModel.swift deleted file mode 100644 index 665955e..0000000 --- a/CMC/Sources/Presenter/Auth/SignIn/FindPassword/FindPasswordViewModel.swift +++ /dev/null @@ -1,63 +0,0 @@ -// -// FindPasswordViewModel.swift -// CMC -// -// Created by Siri on 11/15/23. -// Copyright © 2023 com.softsquared.cmc. All rights reserved. -// - -import Foundation - -import RxCocoa -import RxSwift - -import DesignSystem -import SnapKit - -import UIKit - -class FindPasswordViewModel: ViewModelType{ - - struct Input { - let backButtonTapped: Observable - } - - struct Output { - let afterPage: Observable - } - - // MARK: - Properties - private var authUsecase: AuthUsecase - - var disposeBag: DisposeBag = DisposeBag() - weak var coordinator: AuthCoordinator? - - let email = BehaviorRelay(value: "") - let nowPage = BehaviorRelay(value: 1) - let timerStart = PublishRelay() - - // MARK: - Initializers - init( - coordinator: AuthCoordinator?, - authUsecase: AuthUsecase - ) { - self.coordinator = coordinator - self.authUsecase = authUsecase - } - - // MARK: - Methods - func transform(input: Input) -> Output { - - input.backButtonTapped - .withUnretained(self) - .observe(on: MainScheduler.instance) - .subscribe(onNext: { owner, _ in - owner.coordinator?.popViewController() - }) - .disposed(by: disposeBag) - - return Output( - afterPage: nowPage.asObservable() - ) - } -} diff --git a/CMC/Sources/Presenter/Auth/SignIn/SignInViewController.swift b/CMC/Sources/Presenter/Auth/SignIn/SignInViewController.swift deleted file mode 100644 index 30f2487..0000000 --- a/CMC/Sources/Presenter/Auth/SignIn/SignInViewController.swift +++ /dev/null @@ -1,265 +0,0 @@ -// -// SignInViewController.swift -// CMC -// -// Created by Siri on 10/26/23. -// Copyright © 2023 com.centralMakeusChallenge. All rights reserved. -// - -import Foundation - -import RxCocoa -import RxSwift - -import DesignSystem -import SnapKit - -import UIKit - -final class SignInViewController: BaseViewController { - - // MARK: - UI - private lazy var navigationBar: CMCNavigationBar = { - let navigationBar = CMCNavigationBar( - accessoryLabelHidden: true - ) - return navigationBar - }() - - private lazy var titleLabel: UILabel = { - let label = UILabel() - label.text = "로그인" - label.numberOfLines = 2 - label.font = CMCFontFamily.Pretendard.bold.font(size: 26) - label.textColor = DesignSystemAsset.gray50.color - return label - }() - - private lazy var emailTextField: CMCTextField = { - let textField = CMCTextField( - placeHolder: "이메일을 입력해주세요", - textFieldSubTitle: "이메일", - accessoryType: .none, - keyboardType: .default - ) - return textField - }() - - private lazy var passwordTextField: CMCTextField = { - let textField = CMCTextField( - placeHolder: "비밀번호를 입력해주세요", - textFieldSubTitle: "비밀번호", - accessoryType: .image(image: CMCAsset._24x24hide.image), - keyboardType: .emailAddress - ) - textField.accessoryButton.setImage(CMCAsset._24x24show.image, for: .selected) - return textField - }() - - private lazy var forgetEmailLabel: UILabel = { - let label = UILabel() - let text = "아이디를 잊으셨나요?" - let attributedString = NSMutableAttributedString(string: text) - - let underLineAttributes: [NSAttributedString.Key: Any] = [ - .underlineStyle: NSUnderlineStyle.single.rawValue, - .baselineOffset : NSNumber(value: 4) - ] - attributedString.addAttributes(underLineAttributes, range: NSRange(location: 0, length: text.count)) - label.attributedText = attributedString - label.font = CMCFontFamily.Pretendard.bold.font(size: 13) - label.textColor = CMCAsset.gray500.color - return label - }() - - private lazy var forgetPasswordLabel: UILabel = { - let label = UILabel() - let text = "비밀번호를 잊으셨나요?" - let attributedString = NSMutableAttributedString(string: text) - - let underLineAttributes: [NSAttributedString.Key: Any] = [ - .underlineStyle: NSUnderlineStyle.single.rawValue, - .baselineOffset : NSNumber(value: 4) - ] - attributedString.addAttributes(underLineAttributes, range: NSRange(location: 0, length: text.count)) - label.attributedText = attributedString - label.font = CMCFontFamily.Pretendard.bold.font(size: 13) - label.textColor = CMCAsset.gray500.color - return label - }() - - private lazy var forgetStackView: UIStackView = { - let stackView = UIStackView(arrangedSubviews: [forgetEmailLabel, forgetPasswordLabel]) - stackView.axis = .horizontal - stackView.alignment = .center - stackView.spacing = 26 - return stackView - }() - - - private lazy var askSignUpLabel: UILabel = { - let label = UILabel() - label.text = "계정이 없으신가요?" - label.font = CMCFontFamily.Pretendard.medium.font(size: 15) - label.textColor = CMCAsset.gray700.color - return label - }() - - private lazy var goSignUpLabel: UILabel = { - let label = UILabel() - let text = "회원가입 하기" - let attributedString = NSMutableAttributedString(string: text) - - let underLineAttributes: [NSAttributedString.Key: Any] = [ - .underlineStyle: NSUnderlineStyle.single.rawValue, - .baselineOffset : NSNumber(value: 4) - ] - attributedString.addAttributes(underLineAttributes, range: NSRange(location: 0, length: text.count)) - label.attributedText = attributedString - label.font = CMCFontFamily.Pretendard.bold.font(size: 13) - label.textColor = CMCAsset.gray500.color - return label - }() - - private lazy var goSignUpStackView: UIStackView = { - let stackView = UIStackView(arrangedSubviews: [askSignUpLabel, goSignUpLabel]) - stackView.axis = .vertical - stackView.alignment = .center - stackView.spacing = 7 - return stackView - }() - - private lazy var signInButton: CMCButton = { - let button = CMCButton( - isRound: false, - iconTitle: nil, - type: .login(.disabled), - title: "로그인") - return button - }() - - // MARK: - Properties - private let viewModel: SignInViewModel - - // MARK: - Initializers - init( - viewModel: SignInViewModel - ) { - self.viewModel = viewModel - super.init() - } - - // MARK: - LifeCycle - - // MARK: - Methods - override func setAddSubView() { - view.addSubview(navigationBar) - view.addSubview(titleLabel) - view.addSubview(emailTextField) - view.addSubview(passwordTextField) - view.addSubview(forgetStackView) - view.addSubview(goSignUpStackView) - view.addSubview(signInButton) - } - - override func setConstraint() { - navigationBar.snp.makeConstraints { make in - make.top.equalTo(view.safeAreaLayoutGuide.snp.top) - make.leading.trailing.equalToSuperview() - make.height.equalTo(68) - } - - titleLabel.snp.makeConstraints { make in - make.top.equalTo(navigationBar.snp.bottom).offset(20) - make.leading.equalToSuperview().offset(24) - } - - emailTextField.snp.makeConstraints { make in - make.top.equalTo(titleLabel.snp.bottom).offset(30) - make.leading.equalToSuperview().offset(20) - make.trailing.equalToSuperview().offset(-28) - make.height.equalTo(74) - } - - passwordTextField.snp.makeConstraints { make in - make.top.equalTo(emailTextField.snp.bottom).offset(20) - make.leading.equalToSuperview().offset(20) - make.trailing.equalToSuperview().offset(-28) - make.height.equalTo(74) - } - - forgetStackView.snp.makeConstraints { make in - make.top.equalTo(passwordTextField.snp.bottom).offset(32) - make.centerX.equalToSuperview() - } - - goSignUpStackView.snp.makeConstraints { make in - make.bottom.equalTo(view.safeAreaLayoutGuide.snp.bottom).offset(-30 - 56 - 20) - make.centerX.equalToSuperview() - } - - signInButton.snp.makeConstraints { make in - make.bottom.equalTo(view.keyboardLayoutGuide.snp.top).offset(-20) - make.leading.equalToSuperview().offset(24) - make.trailing.equalToSuperview().offset(-24) - make.height.equalTo(56) - } - } - - override func bind() { - -// NotificationManager.shared.keyboardHeightSubject -// .withUnretained(self) -// .subscribe(onNext: { owner, keyboardHeight in -// let realHeight = keyboardHeight > 0 ? keyboardHeight - 30 : 0 -// owner.signInButton.snp.updateConstraints { make in -// make.bottom.equalTo(owner.view.safeAreaLayoutGuide.snp.bottom).offset(-20 - realHeight) -// } -// UIView.animate(withDuration: 0.3) { -// owner.view.layoutIfNeeded() -// } -// }) -// .disposed(by: disposeBag) - - self.view.rx.tapGesture() - .debug() - .when(.recognized) - .withUnretained(self) - .subscribe(onNext: { owner, _ in - owner.view.endEditing(true) - }) - .disposed(by: disposeBag) - - - passwordTextField.accessoryState - .observe(on: MainScheduler.instance) - .withUnretained(self) - .subscribe(onNext: { owner, state in - owner.passwordTextField.isSecureTextEntry = !state - }) - .disposed(by: disposeBag) - - let input = SignInViewModel.Input( - email: emailTextField.rx.text.orEmpty.asObservable(), - password: passwordTextField.rx.text.orEmpty.asObservable(), - backBtnTapped: navigationBar.backButton.rx.tapped().asObservable(), - forgetIDBtnTapped: forgetEmailLabel.rx.tapGesture().when(.recognized).map{_ in }.asObservable(), - forgetPasswordBtnTapped: forgetPasswordLabel.rx.tapGesture().when(.recognized).map{_ in }.asObservable(), - goSignUpButtonTapped: goSignUpLabel.rx.tapGesture().when(.recognized).map{_ in }.asObservable(), - goSignInButtonTapped: signInButton.rx.tap.asObservable() - ) - - let output = viewModel.transform(input: input) - - output.signInBtnEnable - .withUnretained(self) - .subscribe(onNext: { owner, enable in - enable == true - ? owner.signInButton.rxType.accept(.login(.inactive)) - : owner.signInButton.rxType.accept(.login(.disabled)) - }) - .disposed(by: disposeBag) - - } - -} diff --git a/CMC/Sources/Presenter/Auth/SignIn/SignInViewModel.swift b/CMC/Sources/Presenter/Auth/SignIn/SignInViewModel.swift deleted file mode 100644 index ebd10d9..0000000 --- a/CMC/Sources/Presenter/Auth/SignIn/SignInViewModel.swift +++ /dev/null @@ -1,122 +0,0 @@ -// -// SignInViewModel.swift -// CMC -// -// Created by Siri on 10/26/23. -// Copyright © 2023 com.centralMakeusChallenge. All rights reserved. -// - -import Foundation - -import RxCocoa -import RxSwift - -class SignInViewModel: ViewModelType{ - - struct Input { - let email: Observable - let password: Observable - let backBtnTapped: Observable - let forgetIDBtnTapped: Observable - let forgetPasswordBtnTapped: Observable - let goSignUpButtonTapped: Observable - let goSignInButtonTapped: Observable - } - - struct Output { - let signInBtnEnable: Observable - } - - var disposeBag: DisposeBag = DisposeBag() - weak var coordinator: AuthCoordinator? - private let authUsecase: AuthUsecase - - init( - coordinator: AuthCoordinator, - authUsecase: AuthUsecase - ) { - self.coordinator = coordinator - self.authUsecase = authUsecase - } - - func transform(input: Input) -> Output { - let signInBtnEnable = Observable.combineLatest(input.email, input.password) - .map { email, password in - return !email.isEmpty && !password.isEmpty - } - - input.goSignInButtonTapped - .withLatestFrom(Observable.combineLatest(input.email, input.password)) - .flatMapLatest { [weak self] email, password -> Observable> in - guard let self = self else { return .empty() } - let body = SignInBody(email: email, password: password) - return self.authUsecase.signIn(body: body) - .map { Result.success($0) } - .catch { error in - return .just(Result.failure(error)) - } - .asObservable() - } - .observe(on: MainScheduler.instance) - .subscribe(onNext: { [weak self] result in - switch result { - case .success(let model): - UserDefaultManager.shared.save(model.accessToken, for: .accessToken) - UserDefaultManager.shared.save(model.refreshToken, for: .refreshToken) - self?.coordinator?.finish() - case .failure(_): - CMCBottomSheetManager.shared.showBottomSheet( - title: "존재하지 않는 계정이에요", - body: "아이디 또는 비밀번호를 확인해주세요!", - buttonTitle: "확인" - ) - } - }) - .disposed(by: disposeBag) - - input.goSignUpButtonTapped - .withUnretained(self) - .subscribe(onNext: { owner, _ in - owner.coordinator?.userActionState.accept(.signUp) - }) - .disposed(by: disposeBag) - - input.forgetIDBtnTapped - .withUnretained(self) - .subscribe(onNext: { owner, _ in - CMCBottomSheetManager.shared.showBottomSheet( - title: "아이디 찾기는\n운영진에게 문의해주세요 :)", - body: nil, - buttonTitle: "확인" - ) - }) - .disposed(by: disposeBag) - - input.backBtnTapped - .withUnretained(self) - .observe(on: MainScheduler.instance) - .subscribe(onNext: { owner, _ in - owner.coordinator?.popViewController() - }) - .disposed(by: disposeBag) - - input.forgetPasswordBtnTapped - .withUnretained(self) - .subscribe(onNext: { owner, _ in - let findPasswordViewController = FindPasswordViewController( - viewModel: FindPasswordViewModel( - coordinator: owner.coordinator, - authUsecase: owner.authUsecase - ) - ) - owner.coordinator?.pushViewController(viewController: findPasswordViewController) - }) - .disposed(by: disposeBag) - - return Output( - signInBtnEnable: signInBtnEnable - ) - } - - -} diff --git a/CMC/Sources/Presenter/Auth/SignUp/ScrollPages/CompletedSignUp/CompletedSignUpView.swift b/CMC/Sources/Presenter/Auth/SignUp/ScrollPages/CompletedSignUp/CompletedSignUpView.swift deleted file mode 100644 index db9575f..0000000 --- a/CMC/Sources/Presenter/Auth/SignUp/ScrollPages/CompletedSignUp/CompletedSignUpView.swift +++ /dev/null @@ -1,274 +0,0 @@ -// -// CompletedSignUpView.swift -// CMC -// -// Created by Siri on 10/28/23. -// Copyright © 2023 com.centralMakeusChallenge. All rights reserved. -// - -import Foundation - -import RxCocoa -import RxGesture -import RxSwift - -import DesignSystem -import SnapKit - -import UIKit - -final class CompletedSignUpView: BaseView { - - // MARK: - UI - private lazy var nicknameTextField: CMCTextField = { - let textField = CMCTextField( - placeHolder: "닉네임을 입력해주세요", - textFieldSubTitle: "닉네임", - accessoryType: .none, - keyboardType: .emailAddress - ) - return textField - }() - - private lazy var generationDropDownView: UIView = { - let view = UIView() - view.backgroundColor = .clear - return view - }() - - private lazy var generationTitleLabel: UILabel = { - let label = UILabel() - label.textColor = CMCAsset.gray50.color - label.font = CMCFontFamily.Pretendard.bold.font(size: 14) - label.text = "기수를 선택해주세요" - return label - }() - - private lazy var generationDropDownButton: CMCTouchArea = { - let touchArea = CMCTouchArea(image: CMCAsset._24x24dropDown.image) - return touchArea - }() - - private lazy var generationUnderLine: UIView = { - let view = UIView() - view.backgroundColor = CMCAsset.gray100.color - return view - }() - - private lazy var positionDropDownView: UIView = { - let view = UIView() - view.backgroundColor = .clear - return view - }() - - private lazy var positionTitleLabel: UILabel = { - let label = UILabel() - label.textColor = CMCAsset.gray50.color - label.font = CMCFontFamily.Pretendard.bold.font(size: 14) - label.text = "포지션을 선택해주세요" - return label - }() - - private lazy var positionDropDownButton: CMCTouchArea = { - let touchArea = CMCTouchArea(image: CMCAsset._24x24dropDown.image) - return touchArea - }() - - private lazy var positionUnderLine: UIView = { - let view = UIView() - view.backgroundColor = CMCAsset.gray100.color - return view - }() - - // MARK: - Properties - private var viewModel: CompletedSignUpViewModel - private var parentViewModel: SignUpViewModel - - private var generationRelay = BehaviorRelay(value: "기수를 선택해주세요") - private var positionRelay = BehaviorRelay(value: .none) - - // MARK: - Initializers - init( - viewModel: CompletedSignUpViewModel, - parentViewModel: SignUpViewModel - ) { - self.viewModel = viewModel - self.parentViewModel = parentViewModel - super.init(frame: .zero) - self.backgroundColor = CMCAsset.background.color - } - - - required init?(coder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } - - // MARK: - LifeCycle - - // MARK: - Methods - - override func setAddSubView() { - self.addSubview(nicknameTextField) - - self.addSubview(generationDropDownView) - self.addSubview(positionDropDownView) - - generationDropDownView.addSubview(generationTitleLabel) - generationDropDownView.addSubview(generationDropDownButton) - generationDropDownView.addSubview(generationUnderLine) - - positionDropDownView.addSubview(positionTitleLabel) - positionDropDownView.addSubview(positionDropDownButton) - positionDropDownView.addSubview(positionUnderLine) - } - - override func setConstraint() { - - nicknameTextField.snp.makeConstraints{ make in - make.top.equalToSuperview().offset(24) - make.leading.equalToSuperview().offset(24) - make.trailing.equalToSuperview().offset(-24) - make.height.equalTo(74) - } - - generationDropDownView.snp.makeConstraints { make in - make.top.equalTo(nicknameTextField.snp.bottom).offset(10) - make.leading.equalToSuperview().offset(24) - make.trailing.equalToSuperview().offset(-24) - make.height.equalTo(74) - } - - generationDropDownButton.snp.makeConstraints { make in - make.top.equalToSuperview().offset(22) - make.trailing.equalToSuperview() - make.width.equalTo(48) - make.height.equalTo(48) - } - - generationTitleLabel.snp.makeConstraints { make in - make.centerY.equalTo(generationDropDownButton) - make.leading.equalToSuperview().offset(5) - } - - generationUnderLine.snp.makeConstraints { make in - make.height.equalTo(2) - make.bottom.equalToSuperview().offset(-4) - make.leading.trailing.equalToSuperview() - } - - positionDropDownView.snp.makeConstraints { make in - make.top.equalTo(generationDropDownView.snp.bottom).offset(30) - make.leading.equalToSuperview().offset(24) - make.trailing.equalToSuperview().offset(-24) - make.height.equalTo(74) - } - - positionDropDownButton.snp.makeConstraints { make in - make.top.equalToSuperview().offset(22) - make.trailing.equalToSuperview() - make.width.equalTo(48) - make.height.equalTo(48) - } - - positionTitleLabel.snp.makeConstraints { make in - make.centerY.equalTo(positionDropDownButton) - make.leading.equalToSuperview().offset(5) - } - - positionUnderLine.snp.makeConstraints { make in - make.height.equalTo(2) - make.bottom.equalToSuperview().offset(-4) - make.leading.trailing.equalToSuperview() - } - } - - override func bind() { - - self.rx.tapGesture() - .when(.recognized) - .withUnretained(self) - .subscribe(onNext: { owner, _ in - owner.endEditing(true) - }) - .disposed(by: disposeBag) - - generationDropDownButton.rx.tapped() - .flatMapLatest { _ -> Observable in - let dropDownManager = CMCBottomDropDownSheetManager.shared - return dropDownManager.bottomDropDownSheetResponse( - title: "기수를 선택해주세요", - dataSource: [ - "14기", - "13기", - "12기", - "11기" - ], - buttonTitle: "닫기" - ) - } - .bind(to: generationRelay) - .disposed(by: disposeBag) - - positionDropDownButton.rx.tapped() - .flatMapLatest { _ -> Observable in - let dropDownManager = CMCBottomDropDownSheetManager.shared - return dropDownManager.bottomDropDownSheetResponse( - title: "기수를 선택해주세요", - dataSource: [ - Part.PLANNER.rawValue, - Part.DESIGNER.rawValue, - Part.WEB.rawValue, - Part.IOS.rawValue, - Part.AOS.rawValue, - Part.BACK_END.rawValue - ], - buttonTitle: "닫기" - ) - } - .map { Part(rawValue: $0) ?? .none } - .bind(to: positionRelay) - .disposed(by: disposeBag) - - generationRelay - .bind(to: generationTitleLabel.rx.text) - .disposed(by: disposeBag) - - positionRelay - .map { $0.rawValue } - .bind(to: positionTitleLabel.rx.text) - .disposed(by: disposeBag) - - Observable.combineLatest( - nicknameTextField.rx.text.orEmpty, - generationRelay, - positionRelay - ) - .withUnretained(self) - .subscribe(onNext: { owner, body in - let (nickname, generation, position) = body - let gen = generation.components(separatedBy: CharacterSet.decimalDigits.inverted).joined() - - guard let genNum = Int(gen) else { return } - owner.parentViewModel.nicknameRelay.accept(nickname) - owner.parentViewModel.generationRelay.accept(genNum) - owner.parentViewModel.positionRelay.accept(position.revertPart()) - }) - .disposed(by: disposeBag) - - let input = CompletedSignUpViewModel.Input( - nickname: nicknameTextField.rx.text.orEmpty.asObservable(), - generation: generationRelay.asObservable(), - position: positionRelay.asObservable() - ) - - let output = viewModel.transform(input: input) - output.nextAvailable - .withUnretained(self) - .subscribe(onNext: { owner, moveNext in - owner.parentViewModel.readyForNextButton.accept(moveNext) - }) - .disposed(by: disposeBag) - - } - -} diff --git a/CMC/Sources/Presenter/Auth/SignUp/ScrollPages/CompletedSignUp/CompletedSignUpViewModel.swift b/CMC/Sources/Presenter/Auth/SignUp/ScrollPages/CompletedSignUp/CompletedSignUpViewModel.swift deleted file mode 100644 index f41c82a..0000000 --- a/CMC/Sources/Presenter/Auth/SignUp/ScrollPages/CompletedSignUp/CompletedSignUpViewModel.swift +++ /dev/null @@ -1,61 +0,0 @@ -// -// CompletedSignUpViewModel.swift -// CMC -// -// Created by Siri on 10/28/23. -// Copyright © 2023 com.centralMakeusChallenge. All rights reserved. -// - -import Foundation - -import RxCocoa -import RxSwift - -import UIKit - -final class CompletedSignUpViewModel: ViewModelType { - - struct Input { - let nickname: Observable - let generation: Observable - let position: Observable - } - - struct Output { - let nextAvailable: Observable - } - - var disposeBag: DisposeBag = DisposeBag() - - private let defaultGeneration = "기수를 선택해주세요" - private let defaultPosition = "포지션을 선택해주세요" - - - // MARK: - Initializers - init() { - - } - - func transform(input: Input) -> Output { - let nicknameValid = input.nickname - .map { !$0.isEmpty } - - let generationValid = input.generation - .map { $0 != self.defaultGeneration } - - let positionValid = input.position - .map { $0.rawValue != self.defaultPosition } - - let nextAvailable = Observable.combineLatest( - nicknameValid, - generationValid, - positionValid - ) - .map { $0 && $1 && $2 } - - return Output( - nextAvailable: nextAvailable - ) - } - -} diff --git a/CMC/Sources/Presenter/Auth/SignUp/ScrollPages/MainSignUp/MainSignUpView.swift b/CMC/Sources/Presenter/Auth/SignUp/ScrollPages/MainSignUp/MainSignUpView.swift deleted file mode 100644 index 68908e3..0000000 --- a/CMC/Sources/Presenter/Auth/SignUp/ScrollPages/MainSignUp/MainSignUpView.swift +++ /dev/null @@ -1,323 +0,0 @@ -// -// MainSignUpView.swift -// CMC -// -// Created by Siri on 10/28/23. -// Copyright © 2023 com.centralMakeusChallenge. All rights reserved. -// - -import Foundation - -import RxCocoa -import RxGesture -import RxSwift - -import DesignSystem -import SnapKit - -import UIKit - -final class MainSignUpView: BaseView { - // MARK: - UI - - private lazy var scrollView: UIScrollView = { - let scrollView = UIScrollView() - scrollView.isScrollEnabled = true - return scrollView - }() - - private lazy var mainContentView: UIView = { - let view = UIView() - return view - }() - - private lazy var emailTextField: CMCTextField = { - let textField = CMCTextField( - placeHolder: "이메일을 입력해주세요", - textFieldSubTitle: "이메일", - accessoryType: .button(title: "중복확인"), - keyboardType: .emailAddress - ) - return textField - }() - - private lazy var emailErrorCell: CMCErrorMessage = { - let errorCell = CMCErrorMessage(title: "", type: .none) - return errorCell - }() - - private lazy var passwordTextField: CMCTextField = { - let textField = CMCTextField( - placeHolder: "비밀번호를 입력해주세요", - textFieldSubTitle: "비밀번호", - accessoryType: .image(image: CMCAsset._24x24hide.image), - keyboardType: .default - ) - textField.accessoryButton.setImage(CMCAsset._24x24show.image, for: .selected) - return textField - }() - - private lazy var passwordErrorCells: [CMCErrorMessage] = { - let errorCell: [CMCErrorMessage] = [ - CMCErrorMessage(title: "영문", type: .disabled), - CMCErrorMessage(title: "숫자", type: .disabled), - CMCErrorMessage(title: "8자~16자", type: .disabled) - ] - return errorCell - }() - - private lazy var passwordErrorStackView: UIStackView = { - let stackView = UIStackView( - arrangedSubviews: - [ passwordErrorCells[0], - passwordErrorCells[1], - passwordErrorCells[2] ] - ) - stackView.axis = .horizontal - stackView.spacing = 8 - return stackView - }() - - private lazy var confirmPasswordTextField: CMCTextField = { - let textField = CMCTextField( - placeHolder: "비밀번호를 입력해주세요", - textFieldSubTitle: "비밀번호 확인", - accessoryType: .image(image: CMCAsset._24x24hide.image), - keyboardType: .default - ) - textField.accessoryButton.setImage(CMCAsset._24x24show.image, for: .selected) - return textField - }() - - - private lazy var passwordCheckErrorCell: CMCErrorMessage = { - let errorCell = CMCErrorMessage(title: "비밀번호 일치", type: .disabled) - return errorCell - }() - - private lazy var nameTextField: CMCTextField = { - let textField = CMCTextField( - placeHolder: "이름을 입력해주세요", - textFieldSubTitle: "이름", - accessoryType: .none, - keyboardType: .default - ) - return textField - }() - - // MARK: - Properties - private var viewModel: MainSignUpViewModel - private var parentViewModel: SignUpViewModel - - - // MARK: - Initializers - init( - viewModel: MainSignUpViewModel, - parentViewModel: SignUpViewModel - ) { - self.viewModel = viewModel - self.parentViewModel = parentViewModel - super.init(frame: .zero) - self.backgroundColor = CMCAsset.background.color - } - - - required init?(coder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } - - // MARK: - LifeCycle - - // MARK: - Methods - - override func setAddSubView() { - self.addSubview(scrollView) - scrollView.addSubview(mainContentView) - - mainContentView.addSubview(emailTextField) - mainContentView.addSubview(emailErrorCell) - mainContentView.addSubview(passwordTextField) - mainContentView.addSubview(passwordErrorStackView) - mainContentView.addSubview(confirmPasswordTextField) - mainContentView.addSubview(passwordCheckErrorCell) - mainContentView.addSubview(nameTextField) - } - - override func setConstraint() { - - scrollView.snp.makeConstraints { make in - make.top.leading.trailing.bottom.equalToSuperview() - } - - mainContentView.snp.makeConstraints { make in - make.edges.equalTo(scrollView.contentLayoutGuide) - make.width.equalTo(scrollView.frameLayoutGuide.snp.width) - } - - emailTextField.snp.makeConstraints{ make in - make.top.equalToSuperview() - make.leading.equalToSuperview().offset(24) - make.trailing.equalToSuperview().offset(-24) - make.height.equalTo(74) - } - - emailErrorCell.snp.makeConstraints{ make in - make.top.equalTo(emailTextField.snp.bottom).offset(9) - make.leading.equalTo(emailTextField).offset(5) - } - - passwordTextField.snp.makeConstraints{ make in - make.top.equalTo(emailTextField.snp.bottom).offset(30) - make.leading.equalToSuperview().offset(24) - make.trailing.equalToSuperview().offset(-24) - make.height.equalTo(74) - } - - passwordErrorStackView.snp.makeConstraints{ make in - make.top.equalTo(passwordTextField.snp.bottom).offset(9) - make.leading.equalTo(passwordTextField).offset(5) - } - - confirmPasswordTextField.snp.makeConstraints{ make in - make.top.equalTo(passwordErrorStackView.snp.bottom).offset(30) - make.leading.equalToSuperview().offset(24) - make.trailing.equalToSuperview().offset(-24) - make.height.equalTo(74) - } - - passwordCheckErrorCell.snp.makeConstraints{ make in - make.top.equalTo(confirmPasswordTextField.snp.bottom).offset(9) - make.leading.equalTo(confirmPasswordTextField).offset(5) - } - - nameTextField.snp.makeConstraints{ make in - make.top.equalTo(passwordCheckErrorCell.snp.bottom).offset(30) - make.leading.equalToSuperview().offset(24) - make.trailing.equalToSuperview().offset(-24) - make.height.equalTo(74) - make.bottom.equalToSuperview().offset(-24) - } - - } - - override func bind() { - - emailTextField.rxType - .withUnretained(self) - .subscribe(onNext: { owner, type in - if type == .focus { - owner.emailErrorCell.reset() - } - }) - .disposed(by: disposeBag) - - passwordTextField.accessoryState - .observe(on: MainScheduler.instance) - .withUnretained(self) - .subscribe(onNext: { owner, state in - owner.passwordTextField.isSecureTextEntry = !state - }) - .disposed(by: disposeBag) - - confirmPasswordTextField.accessoryState - .observe(on: MainScheduler.instance) - .withUnretained(self) - .subscribe(onNext: { owner, state in - owner.confirmPasswordTextField.isSecureTextEntry = !state - }) - .disposed(by: disposeBag) - - Observable.combineLatest( - emailTextField.rx.text.orEmpty, - passwordTextField.rx.text.orEmpty, - nameTextField.rx.text.orEmpty - ) - .withUnretained(self) - .subscribe(onNext: { owner, body in - let (email, password, name) = body - owner.parentViewModel.emailRelay.accept(email) - owner.parentViewModel.passwordRelay.accept(password) - owner.parentViewModel.nameRelay.accept(name) - }) - .disposed(by: disposeBag) - - self.rx.tapGesture() - .when(.recognized) - .withUnretained(self) - .subscribe(onNext: { owner, gesture in - let location = gesture.location(in: owner.scrollView) - if !owner.isPointInsideTextField(location) { - owner.endEditing(true) - } - }) - .disposed(by: disposeBag) - - let input = MainSignUpViewModel.Input( - email: emailTextField.rx.text.orEmpty.asObservable(), - password: passwordTextField.rx.text.orEmpty.asObservable(), - rePassword: confirmPasswordTextField.rx.text.orEmpty.asObservable(), - name: nameTextField.rx.text.orEmpty.asObservable(), - emailDupTapped: emailTextField.accessoryCMCButton.rx.tap.asObservable() - ) - - let output = viewModel.transform(input: input) - - output.emailValidation - .withUnretained(self) - .subscribe(onNext: { owner, active in - let buttonType: CMCButton.CMCButtonType = active ? .login(.inactive) : .login(.disabled) - owner.emailTextField.accessoryCMCButton.rxType.accept(buttonType) - }) - .disposed(by: disposeBag) - - output.emailDuplicate - .withUnretained(self) - .subscribe(onNext: { owner, result in - let (notDuplicate, message) = result - let type: CMCErrorMessage.CMCErrorMessageType = notDuplicate ? .none : .error - let emailType: CMCTextField.TextFieldType = notDuplicate ? .disabled : .error - let errorMessage: String = notDuplicate ? "" : message - owner.emailErrorCell.rxType.accept(type) - owner.emailTextField.rxType.accept(emailType) - owner.emailErrorCell.setErrorMessage(message: errorMessage) - }) - .disposed(by: disposeBag) - - output.passwordValidations.enumerated() - .map { idx, observable in - observable - .withUnretained(self) - .subscribe(onNext: { owner, active in - let type: CMCErrorMessage.CMCErrorMessageType = active ? .success : .disabled - owner.passwordErrorCells[idx].rxType.accept(type) - }) - } - .forEach { $0.disposed(by: disposeBag) } - - output.passwordConfirmRegex - .withUnretained(self) - .subscribe(onNext: { owner, active in - let type: CMCErrorMessage.CMCErrorMessageType = active ? .success : .disabled - owner.passwordCheckErrorCell.rxType.accept(type) - }) - .disposed(by: disposeBag) - - output.nextAvailable - .withUnretained(self) - .subscribe(onNext: { owner, moveNext in - owner.parentViewModel.readyForNextButton.accept(moveNext) - }) - .disposed(by: disposeBag) - } - -} - - -// MARK: - Extension -extension MainSignUpView { - fileprivate func isPointInsideTextField(_ point: CGPoint) -> Bool { - // 모든 텍스트 필드를 순회하면서 탭된 위치가 텍스트 필드 내부인지 확인합니다. - let textFields = [emailTextField, passwordTextField, confirmPasswordTextField, nameTextField] - return textFields.contains(where: { $0.frame.contains(point) }) - } -} diff --git a/CMC/Sources/Presenter/Auth/SignUp/ScrollPages/MainSignUp/MainSignUpViewModel.swift b/CMC/Sources/Presenter/Auth/SignUp/ScrollPages/MainSignUp/MainSignUpViewModel.swift deleted file mode 100644 index 7c22eb1..0000000 --- a/CMC/Sources/Presenter/Auth/SignUp/ScrollPages/MainSignUp/MainSignUpViewModel.swift +++ /dev/null @@ -1,101 +0,0 @@ -// -// MainSignUpViewModel.swift -// CMC -// -// Created by Siri on 10/28/23. -// Copyright © 2023 com.centralMakeusChallenge. All rights reserved. -// - -import Foundation - -import RxCocoa -import RxSwift - -import UIKit - -final class MainSignUpViewModel: ViewModelType { - - struct Input { - let email: Observable - let password: Observable - let rePassword: Observable - let name: Observable - let emailDupTapped: Observable - } - - struct Output { - let emailValidation: Observable - let emailDuplicate: Observable<(Bool, String)> - let passwordValidations: [Observable] - let passwordConfirmRegex: Observable - let nextAvailable: Observable - } - - var disposeBag: DisposeBag = DisposeBag() - private var authUsecase: AuthUsecase - - private var emailDupResult = PublishRelay<(Bool, String)>() - - // MARK: - Initializers - init( - authUsecase: AuthUsecase - ) { - self.authUsecase = authUsecase - } - - func transform(input: Input) -> Output { - - let emailValidation: Observable = Utility.checkEmailValidation(email: input.email, validate: .emailRegex) - - let passwordValidations: [Observable] = [ - .englishRegex, - .numberRegex, - .lengthRegex - ].map({validate in - Utility.checkPasswordValidation(password: input.password, validate: validate) - }) - - let passwordRegex = Observable.combineLatest(passwordValidations) - .map { $0.allSatisfy { $0 } } - - let passwordConfirmRegex = Observable.combineLatest(input.password, input.rePassword) - .map { $0 == $1 && !$0.isEmpty} - - let nameRegex = input.name - .map { !$0.isEmpty } - - let nextAvailable = Observable.combineLatest( - emailDupResult.asObservable(), - passwordRegex, - passwordConfirmRegex, - nameRegex - ) - .map { $0.0 && $1 && $2 && $3 } - - input.emailDupTapped - .withLatestFrom(input.email) - .withUnretained(self) - .flatMap { owner, email -> Observable<(Bool, String)> in - let query = EmailDupQuery(email: email) - return owner.authUsecase.emailDup(query: query) - .asObservable() - .map { (true, $0.message) } - .catch { error -> Observable<(Bool, String)> in - let customError = (error as! NetworkError).errorDescription - return .just((false, customError)) - } - } - .bind(to: emailDupResult) - .disposed(by: disposeBag) - - - return Output( - emailValidation: emailValidation, - emailDuplicate: emailDupResult.asObservable(), - passwordValidations: passwordValidations, - passwordConfirmRegex: passwordConfirmRegex, - nextAvailable: nextAvailable - ) - } - -} diff --git a/CMC/Sources/Presenter/Auth/SignUp/ScrollPages/TermsAndConditions/TermsAndConditionsView.swift b/CMC/Sources/Presenter/Auth/SignUp/ScrollPages/TermsAndConditions/TermsAndConditionsView.swift deleted file mode 100644 index 381075a..0000000 --- a/CMC/Sources/Presenter/Auth/SignUp/ScrollPages/TermsAndConditions/TermsAndConditionsView.swift +++ /dev/null @@ -1,240 +0,0 @@ -// -// TermsAndConditionsView.swift -// CMC -// -// Created by Siri on 10/28/23. -// Copyright © 2023 com.centralMakeusChallenge. All rights reserved. -// -import Foundation - -import RxCocoa -import RxGesture -import RxSwift - -import DesignSystem -import SnapKit - -import UIKit - -final class TermsAndConditionsView: BaseView { - // MARK: - UI - - private lazy var buttonStackViews: [UIStackView] = { - var stackViews: [UIStackView] = [] - buttons.enumerated().forEach { index, button in - let stackView = UIStackView() - stackView.axis = .horizontal - stackView.alignment = .center - stackView.addArrangedSubview(button) - stackView.addArrangedSubview(buttonLabels[index]) - stackViews.append(stackView) - } - return stackViews - }() - - private lazy var buttons: [CMCTouchArea] = { - let selectedImage = CMCAsset._24x24abled.image - let normalImage = CMCAsset._24x24disabled.image - let buttons = [ - CMCTouchArea(image: normalImage), - CMCTouchArea(image: normalImage), - CMCTouchArea(image: normalImage), - CMCTouchArea(image: normalImage), - CMCTouchArea(image: normalImage) - ] - buttons.forEach{ $0.setImage(selectedImage, for: .selected)} - return buttons - }() - - private lazy var accessoryDetailButton : [CMCTouchArea] = { - let image = CMCAsset._16x16arrowLeft.image - let buttons = [ - CMCTouchArea(image: image), - CMCTouchArea(image: image), - CMCTouchArea(image: image), - CMCTouchArea(image: image) - ] - return buttons - }() - - private lazy var buttonLabels: [UILabel] = { - var labels: [UILabel] = [] - let texts = [ - "전체 동의", - "서비스 이용약관(필수)", - "개인정보 수집/이용 (필수)", - "위치정보 이용 동의(선택)", - "마케팅 정보 수신 동의(선택)" - ] - texts.enumerated().forEach { index, text in - let label = UILabel() - if index == 0 { - label.font = CMCFontFamily.Pretendard.bold.font(size: 18) - } else { - label.font = CMCFontFamily.Pretendard.bold.font(size: 14) - } - label.textColor = CMCAsset.gray50.color - label.text = text - labels.append(label) - } - return labels - }() - - private lazy var separeteBar: UIView = { - let view = UIView() - view.backgroundColor = DesignSystemAsset.gray800.color - return view - }() - - private lazy var rowStackViews: [UIStackView] = { - var stackViews: [UIStackView] = [] - accessoryDetailButton.enumerated().forEach { index, button in - let stackView = UIStackView() - stackView.addArrangedSubview(buttonStackViews[index+1]) - stackView.addArrangedSubview(button) - stackView.axis = .horizontal - stackViews.append(stackView) - } - return stackViews - }() - - // MARK: - Properties - private var viewModel: TermsAndConditionsViewModel - private var parentViewModel: SignUpViewModel - - // MARK: - Initializers - init( - viewModel: TermsAndConditionsViewModel, - parentViewModel: SignUpViewModel - ) { - self.viewModel = viewModel - self.parentViewModel = parentViewModel - super.init(frame: .zero) - self.backgroundColor = CMCAsset.background.color - } - - - required init?(coder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } - - // MARK: - LifeCycle - // MARK: - Methods - - override func setAddSubView() { - self.addSubview(buttonStackViews[0]) - self.addSubview(separeteBar) - self.addSubview(rowStackViews[0]) - self.addSubview(rowStackViews[1]) - self.addSubview(rowStackViews[2]) - self.addSubview(rowStackViews[3]) - } - - override func setConstraint() { - buttons.forEach { button in - button.snp.makeConstraints { make in - make.width.height.equalTo(44) - } - } - - accessoryDetailButton.forEach { button in - button.snp.makeConstraints { make in - make.width.height.equalTo(44) - } - } - - buttonStackViews[0].snp.makeConstraints{ make in - make.top.equalToSuperview() - make.leading.equalToSuperview().offset(14) - } - - separeteBar.snp.makeConstraints{ make in - make.top.equalTo(buttonStackViews[0].snp.bottom).offset(10) - make.leading.trailing.equalToSuperview() - make.height.equalTo(1) - } - - rowStackViews[0].snp.makeConstraints { make in - make.top.equalTo(separeteBar.snp.bottom).offset(10) - make.leading.equalToSuperview().offset(14) - make.trailing.equalToSuperview().offset(-5) - } - - rowStackViews[1].snp.makeConstraints { make in - make.top.equalTo(rowStackViews[0].snp.bottom).offset(2) - make.leading.trailing.equalTo(rowStackViews[0]) - } - - rowStackViews[2].snp.makeConstraints { make in - make.top.equalTo(rowStackViews[1].snp.bottom).offset(2) - make.leading.trailing.equalTo(rowStackViews[0]) - } - - rowStackViews[3].snp.makeConstraints { make in - make.top.equalTo(rowStackViews[2].snp.bottom).offset(2) - make.leading.trailing.equalTo(rowStackViews[0]) - } - - } - - override func bind() { - - let input = TermsAndConditionsViewModel.Input( - allAgreeBtnTapped: buttons[0].rx.tapped().asObservable(), - termsBtnTapped: buttons[1].rx.tapped().asObservable(), - conditionBtnTapped: buttons[2].rx.tapped().asObservable(), - locateBtnTapped: buttons[3].rx.tapped().asObservable(), - eventBtnTapped: buttons[4].rx.tapped().asObservable() - ) - - let output = viewModel.transform(input: input) - - output.allAgreeBtnState - .observe(on: MainScheduler.instance) - .withUnretained(self) - .subscribe(onNext: { owner, state in - owner.buttons[0].makeCustomState(type: state ? .selected : .normal) - }) - .disposed(by: disposeBag) - - output.termsBtnState - .observe(on: MainScheduler.instance) - .withUnretained(self) - .subscribe(onNext: { owner, state in - owner.buttons[1].makeCustomState(type: state ? .selected : .normal) - }) - .disposed(by: disposeBag) - - output.conditionBtnState - .observe(on: MainScheduler.instance) - .withUnretained(self) - .subscribe(onNext: { owner, state in - owner.buttons[2].makeCustomState(type: state ? .selected : .normal) - }) - .disposed(by: disposeBag) - - output.locateBtnState - .observe(on: MainScheduler.instance) - .withUnretained(self) - .subscribe(onNext: { owner, state in - owner.buttons[3].makeCustomState(type: state ? .selected : .normal) - }) - .disposed(by: disposeBag) - - output.eventBtnState - .observe(on: MainScheduler.instance) - .withUnretained(self) - .subscribe(onNext: { owner, state in - owner.buttons[4].makeCustomState(type: state ? .selected : .normal) - }) - .disposed(by: disposeBag) - - output.moveToNext - .withUnretained(self) - .bind(onNext: { owner, state in - owner.parentViewModel.readyForNextButton.accept(state) - }) - .disposed(by: disposeBag) - - } -} diff --git a/CMC/Sources/Presenter/Auth/SignUp/ScrollPages/TermsAndConditions/TermsAndConditionsViewModel.swift b/CMC/Sources/Presenter/Auth/SignUp/ScrollPages/TermsAndConditions/TermsAndConditionsViewModel.swift deleted file mode 100644 index b82b3cd..0000000 --- a/CMC/Sources/Presenter/Auth/SignUp/ScrollPages/TermsAndConditions/TermsAndConditionsViewModel.swift +++ /dev/null @@ -1,96 +0,0 @@ -// -// TermsAndConditionsViewModel.swift -// CMC -// -// Created by Siri on 10/28/23. -// Copyright © 2023 com.centralMakeusChallenge. All rights reserved. -// - -import Foundation - -import RxCocoa -import RxSwift - -import UIKit - -final class TermsAndConditionsViewModel: ViewModelType { - - struct Input { - let allAgreeBtnTapped: Observable - let termsBtnTapped: Observable - let conditionBtnTapped: Observable - let locateBtnTapped: Observable - let eventBtnTapped: Observable - } - - struct Output { - let allAgreeBtnState: Observable - let termsBtnState: Observable - let conditionBtnState: Observable - let locateBtnState: Observable - let eventBtnState: Observable - - let moveToNext: Observable - } - - var disposeBag: DisposeBag = DisposeBag() - - private var allAgreeBtnRelay = BehaviorRelay(value: false) - private var termsBtnRelay = BehaviorRelay(value: false) - private var conditionBtnRelay = BehaviorRelay(value: false) - private var locateBtnRelay = BehaviorRelay(value: false) - private var eventBtnRelay = BehaviorRelay(value: false) - - func transform(input: Input) -> Output { - input.termsBtnTapped.bind { [unowned self] in - termsBtnRelay.accept(!termsBtnRelay.value) - updateAllAgreeState() - }.disposed(by: disposeBag) - - input.conditionBtnTapped.bind { [unowned self] in - conditionBtnRelay.accept(!conditionBtnRelay.value) - updateAllAgreeState() - }.disposed(by: disposeBag) - - input.locateBtnTapped.bind { [unowned self] in - locateBtnRelay.accept(!locateBtnRelay.value) - updateAllAgreeState() - }.disposed(by: disposeBag) - - input.eventBtnTapped.bind { [unowned self] in - eventBtnRelay.accept(!eventBtnRelay.value) - updateAllAgreeState() - }.disposed(by: disposeBag) - - input.allAgreeBtnTapped.bind { [unowned self] in - let newState = !allAgreeBtnRelay.value - allAgreeBtnRelay.accept(newState) - termsBtnRelay.accept(newState) - conditionBtnRelay.accept(newState) - locateBtnRelay.accept(newState) - eventBtnRelay.accept(newState) - }.disposed(by: disposeBag) - - let moveToNext = Observable.combineLatest(termsBtnRelay, conditionBtnRelay) - .map { $0 && $1 } - - return Output( - allAgreeBtnState: allAgreeBtnRelay.asObservable(), - termsBtnState: termsBtnRelay.asObservable(), - conditionBtnState: conditionBtnRelay.asObservable(), - locateBtnState: locateBtnRelay.asObservable(), - eventBtnState: eventBtnRelay.asObservable(), - moveToNext: moveToNext - ) - } - -} - -// MARK: - Private Methods -extension TermsAndConditionsViewModel { - - private func updateAllAgreeState() { - let allSelected = termsBtnRelay.value && conditionBtnRelay.value && locateBtnRelay.value && eventBtnRelay.value - allAgreeBtnRelay.accept(allSelected) - } -} diff --git a/CMC/Sources/Presenter/Auth/SignUp/SignUpCompletedViewController.swift b/CMC/Sources/Presenter/Auth/SignUp/SignUpCompletedViewController.swift deleted file mode 100644 index 8b5fbeb..0000000 --- a/CMC/Sources/Presenter/Auth/SignUp/SignUpCompletedViewController.swift +++ /dev/null @@ -1,108 +0,0 @@ -// -// SignUpCompletedViewController.swift -// CMC -// -// Created by Siri on 11/15/23. -// Copyright © 2023 com.softsquared.cmc. All rights reserved. -// - -import Foundation - -import RxCocoa -import RxSwift - -import DesignSystem -import SnapKit - -import UIKit - -class SignUpCompletedViewController: BaseViewController { - - // MARK: - UI - private lazy var signUpCompletedLabel: UILabel = { - let label = UILabel() - label.text = "회원가입 신청이\n완료되었어요!" - label.font = CMCFontFamily.Pretendard.bold.font(size: 26) - label.textColor = CMCAsset.gray50.color - label.numberOfLines = 2 - return label - }() - - private lazy var signUpCompletedSubLabel: UILabel = { - let label = UILabel() - label.text = "신청이 수락될 때까지 조금만 기다려주세요 :)" - label.font = CMCFontFamily.Pretendard.medium.font(size: 14) - label.textColor = CMCAsset.gray700.color - return label - }() - - private lazy var signUpCompletedImageView: UIImageView = { - let imageView = UIImageView() - imageView.image = CMCAsset.signUpCompleted.image - imageView.contentMode = .scaleAspectFit - return imageView - }() - - private lazy var completedButton: CMCButton = { - let button = CMCButton( - isRound: false, - type: .login(.inactive), - title: "확인" - ) - return button - }() - - // MARK: - Properties - private let viewModel: SignUpCompletedViewModel - - // MARK: - Initializers - init( - viewModel: SignUpCompletedViewModel - ) { - self.viewModel = viewModel - super.init() - } - - // MARK: - LifeCycle - - // MARK: - Methods - - - override func setAddSubView() { - self.view.addSubview(self.signUpCompletedLabel) - self.view.addSubview(self.signUpCompletedSubLabel) - self.view.addSubview(self.signUpCompletedImageView) - self.view.addSubview(self.completedButton) - } - - override func setConstraint() { - self.signUpCompletedLabel.snp.makeConstraints { make in - make.top.equalTo(self.view.safeAreaLayoutGuide.snp.top).offset(100) - make.leading.equalToSuperview().offset(24) - } - - self.signUpCompletedSubLabel.snp.makeConstraints { make in - make.top.equalTo(self.signUpCompletedLabel.snp.bottom).offset(15) - make.leading.equalTo(self.signUpCompletedLabel.snp.leading) - } - - self.signUpCompletedImageView.snp.makeConstraints { make in - make.centerX.centerY.equalToSuperview() - make.width.equalTo(435) - make.height.equalTo(435) - } - - self.completedButton.snp.makeConstraints { make in - make.bottom.equalTo(self.view.safeAreaLayoutGuide.snp.bottom).offset(-20) - make.leading.equalToSuperview().offset(20) - make.trailing.equalToSuperview().offset(-20) - make.height.equalTo(56) - } - } - - override func bind() { - let input = SignUpCompletedViewModel.Input(completedBtnTapped: completedButton.rx.tap.asObservable()) - let _ = viewModel.transform(input: input) - } - -} diff --git a/CMC/Sources/Presenter/Auth/SignUp/SignUpCompletedViewModel.swift b/CMC/Sources/Presenter/Auth/SignUp/SignUpCompletedViewModel.swift deleted file mode 100644 index 117b8b2..0000000 --- a/CMC/Sources/Presenter/Auth/SignUp/SignUpCompletedViewModel.swift +++ /dev/null @@ -1,49 +0,0 @@ -// -// SignUpCompletedViewModel.swift -// CMC -// -// Created by Siri on 11/15/23. -// Copyright © 2023 com.softsquared.cmc. All rights reserved. -// - -import Foundation - -import RxCocoa -import RxSwift - -import UIKit - -final class SignUpCompletedViewModel: ViewModelType { - - struct Input { - let completedBtnTapped: Observable - } - - struct Output { - - } - - var disposeBag: DisposeBag = DisposeBag() - weak var coordinator: AuthCoordinator? - - // MARK: - Initializers - init( - coordinator: AuthCoordinator? - ) { - self.coordinator = coordinator - } - - func transform(input: Input) -> Output { - input.completedBtnTapped - .withUnretained(self) - .subscribe(onNext: { owner, _ in - owner.coordinator?.dismissViewController { - owner.coordinator?.popViewController() - } - }) - .disposed(by: disposeBag) - - return Output() - } - -} diff --git a/CMC/Sources/Presenter/Auth/SignUp/SignUpViewController.swift b/CMC/Sources/Presenter/Auth/SignUp/SignUpViewController.swift deleted file mode 100644 index 20d75a8..0000000 --- a/CMC/Sources/Presenter/Auth/SignUp/SignUpViewController.swift +++ /dev/null @@ -1,198 +0,0 @@ -// -// SignUpViewController.swift -// CMC -// -// Created by Siri on 10/26/23. -// Copyright © 2023 com.centralMakeusChallenge. All rights reserved. -// - -import Foundation - -import RxCocoa -import RxSwift - -import DesignSystem -import SnapKit - -import UIKit - -class SignUpViewController: BaseViewController { - - // MARK: - UI - - private lazy var navigationBar: CMCNavigationBar = { - let navigationBar = CMCNavigationBar( - accessoryLabelHidden: false - ) - navigationBar.accessoryLabel.text = "" - return navigationBar - }() - - private lazy var termsAndConditionsView: TermsAndConditionsView = { - let view = TermsAndConditionsView( - viewModel: TermsAndConditionsViewModel(), - parentViewModel: viewModel - ) - return view - }() - - private lazy var mainSignUpView: MainSignUpView = { - let view = MainSignUpView( - viewModel: MainSignUpViewModel( - authUsecase: DefaultAuthUsecase( - authRepository: DefaultAuthRepository() - ) - ), - parentViewModel: viewModel - ) - return view - }() - - private lazy var completeSignUpView: UIView = { - let view = CompletedSignUpView( - viewModel: CompletedSignUpViewModel(), - parentViewModel: viewModel - ) - return view - }() - - private lazy var cmcPager: CMCProgressPager = { - let progressPager = CMCProgressPager( - pages: [ - termsAndConditionsView, - mainSignUpView, - completeSignUpView - ], - titles: [ - "약관동의", - "가입 정보를 입력해주세요", - "CMC 정보를 입력해주세요" - ] - ) - return progressPager - }() - - private lazy var nextButton: CMCButton = { - let button = CMCButton( - isRound: false, - iconTitle: nil, - type: .login(.disabled), - title: "다음" - ) - return button - }() - - // MARK: - Properties - private let viewModel: SignUpViewModel - - // MARK: - Initializers - init( - viewModel: SignUpViewModel - ) { - self.viewModel = viewModel - super.init() - } - - // MARK: - LifeCycle - - // MARK: - Methods - - - override func setAddSubView() { - self.view.addSubview(navigationBar) - self.view.addSubview(cmcPager) - self.view.addSubview(nextButton) - } - - override func setConstraint() { - navigationBar.snp.makeConstraints{ navigationBar in - navigationBar.top.equalTo(self.view.safeAreaLayoutGuide) - navigationBar.leading.trailing.equalToSuperview() - navigationBar.height.equalTo(68) - } - - nextButton.snp.makeConstraints{ nextButton in - nextButton.leading.trailing.equalToSuperview().inset(20) - nextButton.bottom.equalTo(self.view.keyboardLayoutGuide.snp.top).offset(-20) - nextButton.height.equalTo(56) - } - - cmcPager.snp.makeConstraints{ cmcPager in - cmcPager.top.equalTo(navigationBar.snp.bottom) - cmcPager.leading.trailing.equalToSuperview() - cmcPager.bottom.equalTo(nextButton.snp.top).offset(-12) - } - - } - - override func bind() { - -// NotificationManager.shared.keyboardHeightSubject -// .withUnretained(self) -// .subscribe(onNext: { owner, keyboardHeight in -// let realHeight = keyboardHeight > 0 ? keyboardHeight : 20 -// owner.nextButton.snp.updateConstraints { make in -// make.bottom.equalTo(self.view.safeAreaLayoutGuide).offset(-realHeight) -// } -// UIView.animate(withDuration: 0.3) { -// owner.view.layoutIfNeeded() -// } -// }) -// .disposed(by: disposeBag) - - nextButton.rx.tap - .withLatestFrom(cmcPager.getCurrentPage()) - .withUnretained(self) - .subscribe(onNext: { owner, nowPage in - if nowPage != owner.cmcPager.totalPages() { - owner.cmcPager.nextPage() - } - owner.view.endEditing(true) - }) - .disposed(by: disposeBag) - -// self.view.rx.tapGesture() -// .when(.recognized) -// .withUnretained(self) -// .subscribe(onNext: { owner, _ in -// owner.view.endEditing(true) -// }) -// .disposed(by: disposeBag) - - let input = SignUpViewModel.Input( - backButtonTapped: navigationBar.backButton.rx.tapped().asObservable(), - nextButtonTapped: nextButton.rx.tap.asObservable(), - nowPage: cmcPager.getCurrentPage(), - totalPage: cmcPager.totalPages() - ) - - let output = viewModel.transform(input: input) - - output.readyForNextButton - .withUnretained(self) - .subscribe(onNext: { owner, isActive in - isActive - ? owner.nextButton.makeCustomState(type: .login(.inactive)) - : owner.nextButton.makeCustomState(type: .login(.disabled)) - }) - .disposed(by: disposeBag) - - output.navigationAccessoryText - .observe(on: MainScheduler.instance) - .withUnretained(self) - .subscribe(onNext: { owner, text in - owner.navigationBar.accessoryLabel.text = text - }) - .disposed(by: disposeBag) - - output.nextButtonTitle - .observe(on: MainScheduler.instance) - .withUnretained(self) - .subscribe(onNext: { owner, title in - owner.nextButton.setTitle(title: title) - owner.view.endEditing(true) - }) - .disposed(by: disposeBag) - } - -} diff --git a/CMC/Sources/Presenter/Auth/SignUp/SignUpViewModel.swift b/CMC/Sources/Presenter/Auth/SignUp/SignUpViewModel.swift deleted file mode 100644 index d64f8a9..0000000 --- a/CMC/Sources/Presenter/Auth/SignUp/SignUpViewModel.swift +++ /dev/null @@ -1,138 +0,0 @@ -// -// SignUpViewModel.swift -// CMC -// -// Created by Siri on 10/26/23. -// Copyright © 2023 com.centralMakeusChallenge. All rights reserved. -// - -import Foundation - -import RxCocoa -import RxSwift - -import DesignSystem -import SnapKit - -import UIKit - -class SignUpViewModel: ViewModelType{ - - struct Input { - let backButtonTapped: Observable - let nextButtonTapped: Observable - let nowPage: Observable - let totalPage: Int - } - - struct Output { - let readyForNextButton: Observable - let navigationAccessoryText: Observable - let nextButtonTitle: Observable - } - - // MARK: - Properties - private var authUsecase: AuthUsecase - - var disposeBag: DisposeBag = DisposeBag() - weak var coordinator: AuthCoordinator? - - let readyForNextButton = BehaviorRelay(value: false) - - let emailRelay = PublishRelay() - let passwordRelay = PublishRelay() - let nicknameRelay = PublishRelay() - let nameRelay = PublishRelay() - let generationRelay = PublishRelay() - let positionRelay = PublishRelay() - - // MARK: - Initializers - init( - coordinator: AuthCoordinator, - authUsecase: AuthUsecase - ) { - self.coordinator = coordinator - self.authUsecase = authUsecase - } - - // MARK: - Methods - func transform(input: Input) -> Output { - - input.nextButtonTapped - .withUnretained(self) - .subscribe(onNext: { owner, _ in - owner.readyForNextButton.accept(false) - }) - .disposed(by: disposeBag) - - input.backButtonTapped - .withUnretained(self) - .subscribe(onNext: { owner, _ in - owner.coordinator?.popViewController() - }) - .disposed(by: disposeBag) - - let navigationAccessoryText = input.nowPage - .map { page in - return "\(page)/\(input.totalPage)" - } - - let nextbuttonTitle = input.nowPage - .map { page in - return page == input.totalPage ? "가입 신청하기" : "다음" - } - - input.nextButtonTapped - .withLatestFrom(Observable.combineLatest( - input.nowPage, - Observable.combineLatest( - emailRelay, - passwordRelay, - nicknameRelay, - nameRelay, - generationRelay, - positionRelay - ) - )) - .flatMapLatest { [weak self] (nowPage, data) -> Observable> in - let (email, password, nickname, name, generation, part) = data - guard let self = self, nowPage == input.totalPage else { return .empty() } - - let body = SignUpBody(email: email, password: password, nickname: nickname, name: name, generation: generation, part: part) - return self.authUsecase.signUp(body: body) - .map { Result.success($0) } - .catch { error in - return .just(Result.failure(error)) - } - .asObservable() - } - .observe(on: MainScheduler.instance) - .withUnretained(self) - .subscribe(onNext: { owner, result in - switch result { - case .success(let model): - //MARK: - 흠,,, 회원 수락을 직접 해주는거면, 이 친구들 저장 할 필요가 없지않나,,,? - /* - UserDefaultManager.shared.save(model.accessToken, for: .accessToken) - UserDefaultManager.shared.save(model.refreshToken, for: .refreshToken) - */ - let signUpCompletedViewController = SignUpCompletedViewController( - viewModel: SignUpCompletedViewModel( - coordinator: owner.coordinator - ) - ) - owner.coordinator?.presentViewController(viewController: signUpCompletedViewController, style: .overFullScreen) - case .failure(let error): - CMCToastManager.shared.addToast(message: "회원가입에 실패했습니다: \(error.localizedDescription)") - } - }) - .disposed(by: disposeBag) - - - return Output( - readyForNextButton: readyForNextButton.asObservable(), - navigationAccessoryText: navigationAccessoryText, - nextButtonTitle: nextbuttonTitle - ) - } -} diff --git a/CMC/Sources/Presenter/Commons/Base/BaseView.swift b/CMC/Sources/Presenter/Commons/Base/BaseView.swift deleted file mode 100644 index e4190da..0000000 --- a/CMC/Sources/Presenter/Commons/Base/BaseView.swift +++ /dev/null @@ -1,37 +0,0 @@ -// -// BaseView.swift -// CMC -// -// Created by Siri on 2023/10/24. -// Copyright © 2023 com.centralMakeusChallenge. All rights reserved. -// - -import RxSwift -import UIKit - -public class BaseView: UIView { - - // MARK: - Properties - var disposeBag = DisposeBag() - - // MARK: - Methods - override init(frame: CGRect) { - super.init(frame: frame) - - self.backgroundColor = CMCAsset.gray50.color - setAddSubView() - setAttribute() - setConstraint() - bind() - } - - func setAddSubView() {} - func setConstraint() {} - func setAttribute() {} - func bind() {} - - @available(*, unavailable) - required init?(coder: NSCoder) { - fatalError("init(coder:) is called.") - } -} diff --git a/CMC/Sources/Presenter/Commons/Base/BaseViewController.swift b/CMC/Sources/Presenter/Commons/Base/BaseViewController.swift deleted file mode 100644 index 5fcc42b..0000000 --- a/CMC/Sources/Presenter/Commons/Base/BaseViewController.swift +++ /dev/null @@ -1,47 +0,0 @@ -// -// BaseViewController.swift -// CMC -// -// Created by Siri on 2023/10/24. -// Copyright © 2023 com.centralMakeusChallenge. All rights reserved. -// - -import Foundation - -import UIKit - -import RxSwift -import SnapKit - - -class BaseViewController: UIViewController { - - // MARK: - Properties - var disposeBag = DisposeBag() - - // MARK: - Methods - override func viewDidLoad() { - super.viewDidLoad() - self.view.backgroundColor = CMCAsset.background.color - - setAddSubView() - setAttribute() - setConstraint() - bind() - CMCIndecatorManager.shared.hide() - } - - func setAddSubView() {} - func setConstraint() {} - func setAttribute() {} - func bind() {} - - @available(*, unavailable) - required init(coder: NSCoder) { - fatalError("init(coder:) is called.") - } - - init() { - super.init(nibName: nil, bundle: nil) - } -} diff --git a/CMC/Sources/Presenter/Commons/Protocol/CoordinatorType.swift b/CMC/Sources/Presenter/Commons/Protocol/CoordinatorType.swift deleted file mode 100644 index 685190e..0000000 --- a/CMC/Sources/Presenter/Commons/Protocol/CoordinatorType.swift +++ /dev/null @@ -1,65 +0,0 @@ -// -// CoordinatorType.swift -// CMC -// -// Created by Siri on 2023/10/24. -// Copyright © 2023 com.centralMakeusChallenge. All rights reserved. -// - -import RxCocoa -import RxSwift -import UIKit - -protocol CoordinatorDelegate: AnyObject { - /// navigator가 back될 때, childCoordinator들을 모두 지워주기 위함이다. - func didFinish(childCoordinator: CoordinatorType) -} - -protocol CoordinatorType: AnyObject{ - var disposeBag: DisposeBag { get } - var navigationController: UINavigationController {get set} - - var childCoordinators: [CoordinatorType] {get set} - var delegate: CoordinatorDelegate? {get set} - - func setState() - func start() - func finish() - - // MARK: Navigation 동작 - func pushViewController(viewController vc: UIViewController ) - func popViewController() - - // MARK: Modal 동작 - func presentViewController(viewController vc: UIViewController, style: UIModalPresentationStyle ) - func dismissViewController(completion: (() -> Void)?) - -} - -extension CoordinatorType{ - - /// finish가 호출되면 -> delegate를 self로 할당하면서 didFinish를 정의한놈의 child를 모두 지워줌 - func finish() { - childCoordinators.removeAll() - delegate?.didFinish(childCoordinator: self) - } - - func pushViewController(viewController vc: UIViewController ){ - self.navigationController.setNavigationBarHidden(true, animated: false) - self.navigationController.pushViewController(vc, animated: true) - } - - func popViewController() { - self.navigationController.popViewController(animated: true) - } - - func presentViewController(viewController vc: UIViewController, style: UIModalPresentationStyle){ - vc.modalPresentationStyle = style - self.navigationController.present(vc, animated: true) - } - - func dismissViewController(completion: (() -> Void)?) { - navigationController.dismiss(animated: true, completion: completion) - } - -} diff --git a/CMC/Sources/Presenter/Commons/Protocol/ViewModelType.swift b/CMC/Sources/Presenter/Commons/Protocol/ViewModelType.swift deleted file mode 100644 index 87d62f1..0000000 --- a/CMC/Sources/Presenter/Commons/Protocol/ViewModelType.swift +++ /dev/null @@ -1,22 +0,0 @@ -// -// ViewModelType.swift -// CMC -// -// Created by Siri on 2023/10/24. -// Copyright © 2023 com.centralMakeusChallenge. All rights reserved. -// - -import RxSwift - -protocol ViewModelType: AnyObject{ - associatedtype Input - associatedtype Output - - - // MARK: - Properties - var disposeBag: DisposeBag { get } - - // MARK: - Methods - func transform(input: Input) -> Output -} - diff --git a/CMC/Sources/Utils/Commons/CMCBottomDropDownSheetManager.swift b/CMC/Sources/Utils/Commons/CMCBottomDropDownSheetManager.swift deleted file mode 100644 index 80e4804..0000000 --- a/CMC/Sources/Utils/Commons/CMCBottomDropDownSheetManager.swift +++ /dev/null @@ -1,137 +0,0 @@ -// -// CMCBottomDropDownSheetManager.swift -// CMC -// -// Created by Siri on 11/10/23. -// Copyright © 2023 com.softsquared.cmc. All rights reserved. -// - -import RxSwift - -import DesignSystem -import UIKit - -class CMCBottomDropDownSheetManager { - - static let shared = CMCBottomDropDownSheetManager() - - private let disposeBag: DisposeBag = DisposeBag() - - private init() { - - } - - func bottomDropDownSheetResponse(title: String, dataSource: [String], buttonTitle: String) -> Observable { - return Observable.create { observer in - let dropDownActionObservable = self.showBottomDropDownSheet( - title: title, - dataSource: dataSource, - buttonTitle: buttonTitle - ) - let subscription = dropDownActionObservable - .subscribe { selectedTitle in - observer.onNext(selectedTitle) - observer.onCompleted() - } - return Disposables.create { - subscription.dispose() - } - } - } - - func showBottomDropDownSheet(title: String, dataSource: [String], buttonTitle: String) -> PublishSubject { - - let dropDownActionSubject = PublishSubject() - - let backgroundView: UIView = { - let view = UIView() - view.backgroundColor = CMCAsset.black1.color.withAlphaComponent(0.7) - return view - }() - - let newBottomDropDownSheet = CMCBottomDropDownSheet( - title: title, - dropDownDataSource: dataSource, - buttonTitle: buttonTitle - ) - - if let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene { - if let window = windowScene.windows.first { - window.addSubview(backgroundView) - backgroundView.addSubview(newBottomDropDownSheet) - - backgroundView.snp.makeConstraints { make in - make.edges.equalToSuperview() - } - - newBottomDropDownSheet.snp.makeConstraints { make in - make.bottom.equalToSuperview() - make.leading.trailing.equalToSuperview() - make.height.equalTo(600) - } - - } - } - - backgroundView.alpha = 0.0 - newBottomDropDownSheet.isHidden = true - - backgroundView.fadeIn(completion: { _ in - newBottomDropDownSheet.bottomToUp() - }) - - - newBottomDropDownSheet.cancelButton.rx.tap - .subscribe(onNext: { _ in - newBottomDropDownSheet.topToDown(completion: { _ in - backgroundView.fadeOut(completion: { _ in backgroundView.removeFromSuperview() }) - }) - }) - .disposed(by: disposeBag) - - newBottomDropDownSheet.itemSelected - .subscribe(onNext: { selectedTitle in - newBottomDropDownSheet.topToDown(completion: { _ in - dropDownActionSubject.onNext(selectedTitle) - dropDownActionSubject.onCompleted() - backgroundView.fadeOut(completion: { _ in - backgroundView.removeFromSuperview() - }) - }) - }) - .disposed(by: disposeBag) - return dropDownActionSubject - } - - -} - -extension UIView { - fileprivate func fadeIn(duration: TimeInterval = 0.3, completion: ((Bool) -> Void)? = nil) { - UIView.animate(withDuration: duration, animations: { - self.alpha = 1.0 - }, completion: completion) - } - - fileprivate func fadeOut(duration: TimeInterval = 0.3, completion: ((Bool) -> Void)? = nil) { - UIView.animate(withDuration: duration, animations: { - self.alpha = 0.0 - }, completion: completion) - } -} - -extension UIView { - fileprivate func bottomToUp(duration: TimeInterval = 0.3) { - self.isHidden = false - self.transform = CGAffineTransform(translationX: 0, y: self.frame.height) - UIView.animate(withDuration: duration) { - self.transform = CGAffineTransform.identity - } - } - - fileprivate func topToDown(duration: TimeInterval = 0.3, completion: ((Bool) -> Void)? = nil) { - UIView.animate(withDuration: duration, animations: { - self.transform = CGAffineTransform(translationX: 0, y: self.frame.height) - }, completion: completion) - } -} diff --git a/CMC/Sources/Utils/Commons/CMCBottomSheetManager.swift b/CMC/Sources/Utils/Commons/CMCBottomSheetManager.swift deleted file mode 100644 index 47ea240..0000000 --- a/CMC/Sources/Utils/Commons/CMCBottomSheetManager.swift +++ /dev/null @@ -1,105 +0,0 @@ -// -// CMCBottomSheetManager.swift -// DesignSystem -// -// Created by Siri on 11/10/23. -// Copyright © 2023 com.softsquared.cmc. All rights reserved. -// - -import RxSwift - -import DesignSystem -import UIKit - -class CMCBottomSheetManager { - - static let shared = CMCBottomSheetManager() - - private let disposeBag: DisposeBag = DisposeBag() - - private init() { - - } - - func showBottomSheet(title: String, body: String?, buttonTitle: String) { - - let backgroundView: UIView = { - let view = UIView() - view.backgroundColor = CMCAsset.black1.color.withAlphaComponent(0.7) - return view - }() - - let newBottomSheet = CMCBottomSheet( - title: title, - body: body, - buttonTitle: buttonTitle - ) - - if let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene { - if let window = windowScene.windows.first { - window.addSubview(backgroundView) - backgroundView.addSubview(newBottomSheet) - - backgroundView.snp.makeConstraints { make in - make.edges.equalToSuperview() - } - - newBottomSheet.snp.makeConstraints { make in - make.bottom.equalToSuperview() - make.leading.trailing.equalToSuperview() - make.height.equalTo(288) - } - - } - } - - backgroundView.alpha = 0.0 - newBottomSheet.isHidden = true - - backgroundView.fadeIn(completion: { _ in - newBottomSheet.bottomToUp() - }) - - - newBottomSheet.cancelButton.rx.tap - .subscribe(onNext: { _ in - newBottomSheet.topToDown(completion: { _ in - backgroundView.fadeOut(completion: { _ in backgroundView.removeFromSuperview() }) - }) - }) - .disposed(by: disposeBag) - - } - - -} - -extension UIView { - fileprivate func fadeIn(duration: TimeInterval = 0.3, completion: ((Bool) -> Void)? = nil) { - UIView.animate(withDuration: duration, animations: { - self.alpha = 1.0 - }, completion: completion) - } - - fileprivate func fadeOut(duration: TimeInterval = 0.3, completion: ((Bool) -> Void)? = nil) { - UIView.animate(withDuration: duration, animations: { - self.alpha = 0.0 - }, completion: completion) - } -} - -extension UIView { - fileprivate func bottomToUp(duration: TimeInterval = 0.3) { - self.isHidden = false - self.transform = CGAffineTransform(translationX: 0, y: self.frame.height) - UIView.animate(withDuration: duration) { - self.transform = CGAffineTransform.identity - } - } - - fileprivate func topToDown(duration: TimeInterval = 0.3, completion: ((Bool) -> Void)? = nil) { - UIView.animate(withDuration: duration, animations: { - self.transform = CGAffineTransform(translationX: 0, y: self.frame.height) - }, completion: completion) - } -} diff --git a/CMC/Sources/Utils/Commons/CMCIndecatorManager.swift b/CMC/Sources/Utils/Commons/CMCIndecatorManager.swift deleted file mode 100644 index b45f248..0000000 --- a/CMC/Sources/Utils/Commons/CMCIndecatorManager.swift +++ /dev/null @@ -1,89 +0,0 @@ -// -// CMCIndecatorManager.swift -// CMC -// -// Created by Siri on 2023/10/24. -// Copyright © 2023 com.centralMakeusChallenge. All rights reserved. -// - -import RxCocoa -import RxSwift - -import UIKit - -class CMCIndecatorManager { - - // MARK: - UI Components - private var backgroundView: UIView? - - // MARK: - Properties - - static let shared = CMCIndecatorManager() - - private let disposeBag = DisposeBag() - private let visibilityRelay = PublishRelay() - private weak var window: UIWindow? - - // MARK: - Initializer - - private init() { - setup() - } - - // MARK: - Methods - private func setup() { - - let scenes = UIApplication.shared.connectedScenes - let windowScene = scenes.first as? UIWindowScene - let window = windowScene?.windows.first - - self.window = window - - visibilityRelay - .observe(on: MainScheduler.instance) - .withUnretained(self) - .subscribe(onNext: { owner, isVisible in - if isVisible { - owner.createAndShowIndicator() - } else { - owner.removeAndHideIndicator() - } - }) - .disposed(by: disposeBag) - } - - - private func createAndShowIndicator() { - if backgroundView == nil { - backgroundView = UIView() - backgroundView?.backgroundColor = CMCAsset.gray900.color.withAlphaComponent(0.4) - } - - let indicatorView: UIActivityIndicatorView = { - let indicator = UIActivityIndicatorView(style: .large) - indicator.color = .gray - return indicator - }() - - backgroundView?.frame = UIScreen.main.bounds - indicatorView.center = backgroundView!.center - backgroundView?.addSubview(indicatorView) - window?.addSubview(backgroundView!) - - indicatorView.startAnimating() - } - - private func removeAndHideIndicator() { - backgroundView?.removeFromSuperview() - backgroundView = nil - } - - func show() { - visibilityRelay.accept(true) - } - - func hide() { - visibilityRelay.accept(false) - } - -} diff --git a/CMC/Sources/Utils/Commons/CMCToastManager.swift b/CMC/Sources/Utils/Commons/CMCToastManager.swift deleted file mode 100644 index 4543778..0000000 --- a/CMC/Sources/Utils/Commons/CMCToastManager.swift +++ /dev/null @@ -1,131 +0,0 @@ -// -// CMCToastManager.swift -// CMC -// -// Created by Siri on 2023/10/24. -// Copyright © 2023 com.centralMakeusChallenge. All rights reserved. -// - -import SnapKit - -import UIKit - -final class CMCToastManager { - - // MARK: - Properties - static let shared = CMCToastManager() - private var currentToastView: ToastView? - - // MARK: - Initializers - private init() { - NotificationCenter.default.addObserver( - self, - selector: #selector(keyboardWillShow(_:)), - name: UIResponder.keyboardWillShowNotification, - object: nil - ) - } - - // MARK: - Functions - func addToast(message: String) { - self.showToast(message: message) - } - - private func showToast(message: String) { - let scenes = UIApplication.shared.connectedScenes - let windowScene = scenes.first as? UIWindowScene - guard let window = windowScene?.windows.first else { return } - - let toastView = ToastView(frame: window.bounds, message: message) - window.addSubview(toastView) - currentToastView = toastView - - setupToastConstraints(toastView, in: window) - - UIView.animate(withDuration: 0.5, delay: 1.5, options: .curveEaseInOut, animations: { - self.currentToastView?.alpha = 0 - }, completion: { _ in - self.currentToastView?.removeFromSuperview() - self.currentToastView = nil - }) - } - - private func setupToastConstraints(_ toastView: ToastView, in window: UIWindow) { - toastView.snp.makeConstraints { make in - make.centerX.equalTo(window.snp.centerX) - make.width.equalTo(284) - make.bottom.equalTo(window.snp.bottom).offset(-122) - } - } - - @objc private func keyboardWillShow(_ notification: Notification) { - if let keyboardFrame = notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? CGRect { - adjustToastForKeyboard(show: true, keyboardFrame: keyboardFrame) - } - } - - - private func adjustToastForKeyboard(show: Bool, keyboardFrame: CGRect) { - guard let toastView = currentToastView else { return } - - var newOffset = -122 - if show { - newOffset -= Int(keyboardFrame.height) - } - - toastView.snp.updateConstraints { make in - make.bottom.equalToSuperview().offset(newOffset) - } - - UIView.animate(withDuration: 0.25) { - toastView.superview?.layoutIfNeeded() - } - } -} - - -private class ToastView: UIView { - let toastLabel = UILabel() - - init( - frame: CGRect, - message: String - ) { - super.init(frame: frame) - - self.backgroundColor = CMCAsset.gray500.color - self.alpha = 0.8 - self.clipsToBounds = true - - toastLabel.textColor = CMCAsset.gray50.color - toastLabel.font = CMCFontFamily.Pretendard.bold.font(size: 14) - toastLabel.textAlignment = .center - toastLabel.text = message - toastLabel.numberOfLines = 0 - toastLabel.sizeToFit() - toastLabel.clipsToBounds = true - - self.addSubview(toastLabel) - - self.setupConstraints() - } - - required init?(coder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } - - private func setupConstraints() { - toastLabel.snp.makeConstraints { make in - make.top.equalToSuperview().offset(14) - make.bottom.equalToSuperview().offset(-14) - make.leading.equalToSuperview().offset(40) - make.trailing.equalToSuperview().offset(-40) - } - } - - override func layoutSubviews() { - super.layoutSubviews() - self.layer.cornerRadius = self.frame.height / 2 - } - -} diff --git a/CMC/Sources/Utils/Commons/CustomAsyncQueue.swift b/CMC/Sources/Utils/Commons/CustomAsyncQueue.swift deleted file mode 100644 index 9268b4f..0000000 --- a/CMC/Sources/Utils/Commons/CustomAsyncQueue.swift +++ /dev/null @@ -1,46 +0,0 @@ -// -// CustomAsyncQueue.swift -// CMC -// -// Created by Siri on 2023/10/24. -// Copyright © 2023 com.centralMakeusChallenge. All rights reserved. -// - -import Foundation - -typealias ClosureToWork = (CustomAsyncQueue) -> Void - -/// 로딩되는 동작 처리 할 큐 -class CustomAsyncQueue { - static var shared = CustomAsyncQueue() - - var queue: [ClosureToWork] = [] - - var dispatchQueue: DispatchQueue? = nil // = OS_dispatch_queue_serial(label: "CustomAsyncQueue") - - /// 인자가 없으면 메인 큐. - private init(dispatchQueue: DispatchQueue? = nil) { - self.dispatchQueue = dispatchQueue// ?? OS_dispatch_queue_main(label: "CustomAsyncQueueMain") - } - - func append(toWork: @escaping ClosureToWork) { - queue.append(toWork) - } - - func next() { - if let toWork = self.queue.first { - self.queue.removeFirst() - - if dispatchQueue == nil { - OperationQueue.main.addOperation { - toWork(self) // 진행 시켜! - } - } - else { - dispatchQueue?.async { - toWork(self) // 비동기로 진행시켜~ - } - } - } - } -} diff --git a/CMC/Sources/Utils/Commons/NetworkStateManager.swift b/CMC/Sources/Utils/Commons/NetworkStateManager.swift deleted file mode 100644 index e412459..0000000 --- a/CMC/Sources/Utils/Commons/NetworkStateManager.swift +++ /dev/null @@ -1,50 +0,0 @@ -// -// NetworkStateManager.swift -// CMC -// -// Created by Siri on 2023/10/24. -// Copyright © 2023 com.centralMakeusChallenge. All rights reserved. -// - -import Foundation - -import UIKit - -import Network - -import RxSwift - -final class NetworkMonitor{ - static let shared = NetworkMonitor() - - private let monitor: NWPathMonitor /// 현재 인터넷 연결상태 확인 모니터 - private let disposeBag = DisposeBag() - - init() { - monitor = NWPathMonitor() - } - - func checkNetworkStatus() -> Single { - return Single.create { [weak self] single in - guard let self = self else { return Disposables.create() } - - self.monitor.pathUpdateHandler = { path in - if path.status == .satisfied { - single(.success(true)) - } else { - single(.failure(NetworkError.badNetwork)) - } - self.stopMonitoring() - } - self.monitor.start(queue: .global()) - - return Disposables.create { - self.stopMonitoring() - } - } - } - - private func stopMonitoring() { - monitor.cancel() - } -} diff --git a/CMC/Sources/Utils/Commons/NotificationManager.swift b/CMC/Sources/Utils/Commons/NotificationManager.swift deleted file mode 100644 index 9f5bc16..0000000 --- a/CMC/Sources/Utils/Commons/NotificationManager.swift +++ /dev/null @@ -1,34 +0,0 @@ -// -// NotificationManager.swift -// CMC -// -// Created by Siri on 10/28/23. -// Copyright © 2023 com.centralMakeusChallenge. All rights reserved. -// - -import RxSwift -import UIKit - -class NotificationManager { - static let shared = NotificationManager() - - // 키보드 높이를 전달할 Subject - let keyboardHeightSubject = PublishSubject() - - private init() { - NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillShow), name: UIResponder.keyboardWillShowNotification, object: nil) - NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillHide), name: UIResponder.keyboardWillHideNotification, object: nil) - } - - @objc private func keyboardWillShow(_ notification: Notification) { - if let keyboardFrame: NSValue = notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue { - let keyboardRectangle = keyboardFrame.cgRectValue - let keyboardHeight = keyboardRectangle.height - keyboardHeightSubject.onNext(keyboardHeight) - } - } - - @objc private func keyboardWillHide(_ notification: Notification) { - keyboardHeightSubject.onNext(0) - } -} diff --git a/CMC/Sources/Utils/Commons/Unitility.swift b/CMC/Sources/Utils/Commons/Unitility.swift deleted file mode 100644 index 0abda97..0000000 --- a/CMC/Sources/Utils/Commons/Unitility.swift +++ /dev/null @@ -1,61 +0,0 @@ -// -// Unitility.swift -// CMC -// -// Created by Siri on 2023/10/24. -// Copyright © 2023 com.centralMakeusChallenge. All rights reserved. -// - -import Foundation -import UIKit - -import RxSwift - -class Utility { - - /// - `data`를 `T` 타입으로 디코딩하자~ - static func decode(_ type: T.Type, from data: Data) -> T? { - do { - let decodedObject = try JSONDecoder().decode(T.self, from: data) - return decodedObject - } catch { - print("Failed to decode \(T.self) from data: \(error)") - return nil - } - } - - static func decodeError(from data: Data) -> ServerError { - do { - let decodedObject = try JSONDecoder().decode(ServerError.self, from: data) - return decodedObject - } catch { - return ServerError( - isSuccess: false, - code: "USER9999", - message: "Failed to decode ServerError from data: \(error)" - ) - } - } - - static func checkEmailValidation(email: Observable, validate: EmailValidate) -> Observable { - let emailTest = NSPredicate(format: "SELF MATCHES %@", validate.validate) - return email.map { email in - return emailTest.evaluate(with: email) - } - } - - static func checkPasswordValidation(password: Observable, validate: PasswordValidate) -> Observable { - let passwordTest = NSPredicate(format: "SELF MATCHES %@", validate.validate) - return password.map { password in - return passwordTest.evaluate(with: password) - } - } - - static func checkNicknameValidation(nickname: Observable, validate: NicknameValidate) -> Observable { - let nicknameTest = NSPredicate(format: "SELF MATCHES %@", validate.validate) - return nickname.map { nickname in - return nicknameTest.evaluate(with: nickname) - } - } - -} diff --git a/CMC/Sources/Utils/Commons/UserDefaultManager.swift b/CMC/Sources/Utils/Commons/UserDefaultManager.swift deleted file mode 100644 index 0ff6e75..0000000 --- a/CMC/Sources/Utils/Commons/UserDefaultManager.swift +++ /dev/null @@ -1,33 +0,0 @@ -// -// UserDefaultManager.swift -// CMC -// -// Created by Siri on 2023/10/24. -// Copyright © 2023 com.centralMakeusChallenge. All rights reserved. -// - -import Foundation - -class UserDefaultManager { - - static let shared = UserDefaultManager() - private let userDefaults = UserDefaults.standard - - /// 요기에는 내 맘대로 추가 해야징~ - enum Key: String { - case accessToken - case refreshToken - } - - func save(_ value: T, for key: Key) { - userDefaults.set(value, forKey: key.rawValue) - } - - func load(for key: Key) -> T? { - return userDefaults.object(forKey: key.rawValue) as? T - } - - func delete(for key: Key) { - userDefaults.removeObject(forKey: key.rawValue) - } -} diff --git a/CMC/Sources/Utils/Commons/ValidationType.swift b/CMC/Sources/Utils/Commons/ValidationType.swift deleted file mode 100644 index 5d6aa05..0000000 --- a/CMC/Sources/Utils/Commons/ValidationType.swift +++ /dev/null @@ -1,53 +0,0 @@ -// -// ValidationType.swift -// CMC -// -// Created by Siri on 2023/10/24. -// Copyright © 2023 com.centralMakeusChallenge. All rights reserved. -// - -import Foundation - -enum EmailValidate { - - case emailRegex - - var validate: String { - switch self { - case .emailRegex: - return "[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}" - } - } -} - -enum PasswordValidate { - - case englishRegex - case numberRegex - case specialCharRegex - case lengthRegex - - var validate: String { - switch self { - case .englishRegex: - return ".*[A-Za-z]+.*" - case .numberRegex: - return ".*[0-9]+.*" - case .specialCharRegex: - return ".*[!@#$%^&*()_+{}:<>?]+.*" - case .lengthRegex: - return "^.{8,16}$" - } - } -} - -enum NicknameValidate { - case lengthRegex - - var validate: String { - switch self { - case .lengthRegex: - return "^.{2,6}$" - } - } -} diff --git a/CMC/Sources/Utils/Commons/Xcconfigs.swift b/CMC/Sources/Utils/Commons/Xcconfigs.swift deleted file mode 100644 index 5491191..0000000 --- a/CMC/Sources/Utils/Commons/Xcconfigs.swift +++ /dev/null @@ -1,13 +0,0 @@ -// -// Xcconfigs.swift -// CMC -// -// Created by Siri on 2023/10/24. -// Copyright © 2023 com.centralMakeusChallenge. All rights reserved. -// - -import Foundation - -struct Xcconfig { - static let BASE_URL = Bundle.main.infoDictionary?["Base_Url"] as! String -} diff --git a/DesignSystem/Resources/Project.swift b/DesignSystem/Resources/Project.swift deleted file mode 100644 index 48876fc..0000000 --- a/DesignSystem/Resources/Project.swift +++ /dev/null @@ -1,150 +0,0 @@ -import ProjectDescription -import Foundation -import ProjectDescriptionHelpers -import MyPlugin - -/* - +-------------+ - | | - | App | Contains CMC App target and CMC unit-test target - | | - +------+-------------+-------+ - | depends on | - | | - +----v-----+ +-----v-----+ - | | | | - | Kit | | UI | Two independent frameworks to share code and start modularising your app - | | | | - +----------+ +-----------+ - - */ - -// MARK: - Project - - -enum TargetType { - case DesignSystem - case App -} - -protocol ProjectProfile { - var projectName: String { get } - - func generateDependencies(targetName target: TargetType) -> [TargetDependency] - func generateTarget() -> [Target] -// func generateAppConfigurations() -> Settings -} - -class BaseProjectProfile: ProjectProfile{ - - let projectName: String = "CMC" - - let infoPlist: [String: Plist.Value] = [ - "Base_Url" : "$(BASE_URL)", - "ITSAppUsesNonExemptEncryption": false, - "CFBundleShortVersionString": "1.0", - "CFBundleVersion": "1", - "CFBundleDevelopmentRegion": "ko_KR", - "UILaunchStoryboardName": "LaunchScreen", - "UIUserInterfaceStyle": "Light", - "UIApplicationSceneManifest": [ - "UIApplicationSupportsMultipleScenes": false, - "UISceneConfigurations": [ - "UIWindowSceneSessionRoleApplication": [ - [ - "UISceneConfigurationName": "Default Configuration", - "UISceneDelegateClassName": "$(PRODUCT_MODULE_NAME).SceneDelegate" - ], - ] - ] - ], - "CFBundleIconName": "AppIcon", - "UIAppFonts": [ - "Item 0": "Pretendard-Medium.otf", - "Item 1": "Pretendard-Regular.otf", - "Item 2": "Pretendard-SemiBold.otf", - "Item 3": "Pretendard-Bold.otf" - ], - "CFBundleURLTypes": [ - [ - "CFBundleURLName": "com.softsquared.cmc.ios" - ] - ], - "NSAppTransportSecurity": [ - "NSAllowsArbitraryLoads": true - ] - ] - - func generateDependencies(targetName target: TargetType) -> [TargetDependency] { - switch target{ - case .App: - return commonDependencies() + [ - .target(name: "DesignSystem") - ] - case .DesignSystem: - return commonDependencies() - } - } - -// func generateAppConfigurations() -> Settings { -// return Settings.settings( -// configurations: [ -// .debug(name: "DEV", xcconfig: .relativeToCurrentFile("CMC/Resources/Configure/DEV.xcconfig")), -// .release(name: "Release", xcconfig: .relativeToCurrentFile("CMC/Resources/Configure/Release.xcconfig")), -// ]) -// } - - func generateTarget() -> [Target] { - [ - Target( - name: projectName, - platform: .iOS, - product: .app, - bundleId: "com.softsquared.cmc.ios", - deploymentTarget: .iOS(targetVersion: "15.0", devices: [.iphone]), - infoPlist: .extendingDefault(with: infoPlist), - sources: ["\(projectName)/Sources/**"], - resources: "\(projectName)/Resources/**", - dependencies: generateDependencies(targetName: .App) -// settings: generateAppConfigurations() - ), - Target( - name: "DesignSystem", - platform: .iOS, - product: .framework, - bundleId: "com.softsquared.cmc.ios.DesignSystem", - deploymentTarget: .iOS(targetVersion: "15.0", devices: [.iphone]), - infoPlist: .default, - sources: ["DesignSystem/Sources/**"], - resources: "\(projectName)/Resources/**", - dependencies: generateDependencies(targetName: .DesignSystem) - ) - ] - } - -} - -let profile = BaseProjectProfile() - -let project: Project = .init( - name: profile.projectName, - organizationName: "com.softsquared.cmc", -// settings: .settings(configurations: [ -// .debug(name: "DEV"), -// .release(name: "Release") -// ]), - targets: profile.generateTarget() -) - - -extension BaseProjectProfile { - fileprivate func commonDependencies() -> [TargetDependency] { - return [ - .external(name: "RxSwift"), - .external(name: "RxCocoa"), - .external(name: "RxRelay"), - .external(name: "RxGesture"), - .external(name: "SnapKit") - ] - } -} diff --git a/DesignSystem/Sources/CMCBottomDropDownSheet.swift b/DesignSystem/Sources/CMCBottomDropDownSheet.swift deleted file mode 100644 index a325d80..0000000 --- a/DesignSystem/Sources/CMCBottomDropDownSheet.swift +++ /dev/null @@ -1,241 +0,0 @@ -// -// CMCBottomDropDownSheet.swift -// DesignSystem -// -// Created by Siri on 11/10/23. -// Copyright © 2023 com.softsquared.cmc. All rights reserved. -// - -import RxCocoa -import RxGesture -import RxSwift - -import SnapKit - -import UIKit - -public final class CMCBottomDropDownSheet: UIView{ - - // MARK: - UI - private lazy var mainTitle: UILabel = { - let label = UILabel() - label.font = DesignSystemFontFamily.Pretendard.bold.font(size: 18) - label.textColor = DesignSystemAsset.gray50.color - label.text = title - label.numberOfLines = 0 - label.textAlignment = .center - return label - }() - - private lazy var tableView: UITableView = { - let tableView = UITableView() - tableView.register(DropDownCell.self, forCellReuseIdentifier: DropDownCell.identifier) - tableView.backgroundColor = .clear - tableView.separatorStyle = .none - return tableView - }() - - public lazy var cancelButton: CMCButton = { - let button = CMCButton( - isRound: false, - iconTitle: nil, - type: .login(.inactive), - title: buttonTitle - ) - return button - }() - - // MARK: - Properties - - var disposeBag = DisposeBag() - - public var itemSelected = PublishRelay() - - private var title: String - private var dropDownDataSource: [String] - private var buttonTitle: String - - // public var dismiss = PublishRelay() - - // MARK: - Initializers - - /// 버튼의 `title`, `body`, `cancelTitle`을 설정합니다. - /// - Parameters: - /// - title : DropDown의 메인 타이틀을 결정합니다. - /// - dropDownDataSource : DropDown의 dataSource입니다. - /// - buttonTitle : BottomSheet의 버튼의 타이틀을 결정합니다. - public init(title: String, dropDownDataSource: [String], buttonTitle: String) { - self.title = title - self.dropDownDataSource = dropDownDataSource - self.buttonTitle = buttonTitle - super.init(frame: .zero) - - self.backgroundColor = DesignSystemAsset.gray900.color - self.layer.cornerRadius = 10 - - self.setAddSubView() - self.setConstraint() - self.setDelegate() - // self.bind() - - } - - required init?(coder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } - // MARK: - LifeCycle - - // MARK: - Methods - - private func setAddSubView() { - self.addSubview(mainTitle) - self.addSubview(tableView) - self.addSubview(cancelButton) - } - - private func setConstraint() { - - mainTitle.snp.makeConstraints { make in - make.top.equalToSuperview().offset(30) - make.centerX.equalToSuperview() - } - - cancelButton.snp.makeConstraints { make in - make.height.equalTo(56) - make.leading.equalToSuperview().offset(24) - make.trailing.equalToSuperview().offset(-24) - make.bottom.equalToSuperview().offset(-54) - } - - tableView.snp.makeConstraints { make in - make.top.equalTo(mainTitle.snp.bottom).offset(30) - make.leading.equalToSuperview().offset(24) - make.trailing.equalToSuperview().offset(-24) - make.bottom.equalTo(cancelButton.snp.top).offset(-48) - } - - } - - private func setDelegate() { - self.tableView.dataSource = self - self.tableView.delegate = self - } -} - -extension CMCBottomDropDownSheet: UITableViewDelegate, UITableViewDataSource { - public func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { - return dropDownDataSource.count - } - - public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { - let cell = tableView.dequeueReusableCell(withIdentifier: DropDownCell.identifier, for: indexPath) as! DropDownCell - cell.centerLabel.text = dropDownDataSource[indexPath.row] - return cell - } - - public func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { - let selectedItem = dropDownDataSource[indexPath.row] - itemSelected.accept(selectedItem) - } - - public func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { - return 76 - } - -} - -public final class DropDownCell: UITableViewCell { - - public lazy var centerLabel: UILabel = { - let label = UILabel() - label.textAlignment = .center - label.font = DesignSystemFontFamily.Pretendard.bold.font(size: 18) - label.textColor = DesignSystemAsset.gray50.color - return label - }() - - public lazy var seperator: UIView = { - let view = UIView() - view.backgroundColor = DesignSystemAsset.gray800.color - return view - }() - - static let identifier = "DropDownCell" - - override init( - style: UITableViewCell.CellStyle, - reuseIdentifier: String? - ) { - super.init( - style: style, - reuseIdentifier: reuseIdentifier - ) - setupViews() - - let backgroundView = UIView() - backgroundView.backgroundColor = DesignSystemAsset.gray900.color // 배경색 설정 - self.backgroundView = backgroundView - - let selectedBackgroundView = UIView() - selectedBackgroundView.backgroundColor = DesignSystemAsset.gray900.color // 선택됐을 때의 배경색 설정 - self.selectedBackgroundView = selectedBackgroundView - } - - required init?(coder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } - - private func setupViews() { - addSubview(centerLabel) - centerLabel.snp.makeConstraints { make in - make.edges.equalToSuperview() - } - - addSubview(seperator) - seperator.snp.makeConstraints { make in - make.leading.trailing.equalToSuperview() - make.bottom.equalToSuperview() - make.height.equalTo(2) - } - } - - override public func setSelected(_ selected: Bool, animated: Bool) { - super.setSelected(selected, animated: animated) - - } - - public override func setHighlighted(_ highlighted: Bool, animated: Bool) { - super.setHighlighted(highlighted, animated: animated) - - } -} - -/// 아래는 테스트 코드임 -/* - - override func bind() { - - signInButton.rx.tap - .flatMapLatest { _ -> Observable in - let dropDownManager = CMCBottomDropDownSheetManager.shared - return dropDownManager.bottomDropDownSheetResponse( - title: "드랍다운 타이틀임", - dataSource: ["1","2","3","4","5","6"], - buttonTitle: "취소" - ) - } - .bind(to: dropDownRelay) - .disposed(by: disposeBag) - - dropDownRelay - .withUnretained(self) - .subscribe(onNext: { owner, selectedTitle in - print("이 곳에서 드랍다운의 상태 처리: \(selectedTitle)") - owner.signInButton.setTitle(title: selectedTitle) - }) - .disposed(by: disposeBag) - - } - - private let dropDownRelay = PublishRelay() - */ diff --git a/DesignSystem/Sources/CMCBottomSheet.swift b/DesignSystem/Sources/CMCBottomSheet.swift deleted file mode 100644 index 09cbc7a..0000000 --- a/DesignSystem/Sources/CMCBottomSheet.swift +++ /dev/null @@ -1,138 +0,0 @@ -// -// CMCBottomSheet.swift -// DesignSystem -// -// Created by Siri on 11/10/23. -// Copyright © 2023 com.softsquared.cmc. All rights reserved. -// - -import RxCocoa -import RxGesture -import RxSwift - -import SnapKit - -import UIKit - -public final class CMCBottomSheet: UIView{ - - // MARK: - UI - - private lazy var mainTitle: UILabel = { - let label = UILabel() - label.font = DesignSystemFontFamily.Pretendard.bold.font(size: 18) - label.textColor = DesignSystemAsset.gray50.color - label.numberOfLines = 0 - let paragraphStyle = NSMutableParagraphStyle() - paragraphStyle.lineSpacing = 10 - let attributedString = NSAttributedString( - string: title, - attributes: [ - .paragraphStyle: paragraphStyle, - ] - ) - label.attributedText = attributedString - label.textAlignment = .center - return label - }() - - private lazy var bodyLabel: UILabel = { - let label = UILabel() - label.font = DesignSystemFontFamily.Pretendard.medium.font(size: 13) - label.textColor = DesignSystemAsset.gray600.color - label.text = body - label.numberOfLines = 0 - label.textAlignment = .center - return label - }() - - public lazy var cancelButton: CMCButton = { - let button = CMCButton( - isRound: false, - iconTitle: nil, - type: .login(.inactive), - title: buttonTitle - ) - return button - }() - - // MARK: - Properties - - var disposeBag = DisposeBag() - - private var title: String - private var body: String? - private var buttonTitle: String - -// public var dismiss = PublishRelay() - - // MARK: - Initializers - - /// 버튼의 `title`, `body`, `cancelTitle`을 설정합니다. - /// - Parameters: - /// - title : BottomSheet의 메인 타이틀을 결정합니다. - /// - body : BottomSheet의 본문을 결정합니다. - /// - buttonTitle : BottomSheet의 버튼의 타이틀을 결정합니다. - public init(title: String, body: String?, buttonTitle: String) { - self.title = title - self.body = body - self.buttonTitle = buttonTitle - super.init(frame: .zero) - - self.backgroundColor = DesignSystemAsset.gray900.color - self.layer.cornerRadius = 10 - - self.setAddSubView() - self.setConstraint() - -// self.bind() - - } - - required init?(coder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } - // MARK: - LifeCycle - - // MARK: - Methods - - private func setAddSubView() { - self.addSubview(mainTitle) - self.addSubview(bodyLabel) - self.addSubview(cancelButton) - } - - private func setConstraint() { - - mainTitle.snp.makeConstraints { make in - make.top.equalToSuperview().offset(68) - make.leading.equalToSuperview().offset(20) - make.trailing.equalToSuperview().offset(-20) - make.centerX.equalToSuperview() - } - - bodyLabel.snp.makeConstraints { make in - make.top.equalTo(mainTitle.snp.bottom).offset(15) - make.leading.equalToSuperview().offset(20) - make.trailing.equalToSuperview().offset(-20) - } - - cancelButton.snp.makeConstraints { make in - make.height.equalTo(56) - make.leading.equalToSuperview().offset(24) - make.trailing.equalToSuperview().offset(-24) - make.bottom.equalToSuperview().offset(-54) - } - - } - -// private func bind() { -// cancelButton.rx.tap -// .withUnretained(self) -// .subscribe(onNext: { owner, _ in -// owner.dismiss.accept(false) -// }) -// .disposed(by: disposeBag) -// } - -} diff --git a/DesignSystem/Sources/CMCButton.swift b/DesignSystem/Sources/CMCButton.swift deleted file mode 100644 index 84d7a4b..0000000 --- a/DesignSystem/Sources/CMCButton.swift +++ /dev/null @@ -1,213 +0,0 @@ -// -// CMCButton.swift -// CMC -// -// Created by Siri on 2023/10/22. -// Copyright © 2023 com.centralMakeusChallenge. All rights reserved. -// -import Foundation - -import RxCocoa -import RxGesture -import RxSwift - -import SnapKit - -import UIKit - -public final class CMCButton: UIView{ - - // MARK: - UI - private lazy var buttonLabel: UILabel = { - var label = UILabel() - label.font = DesignSystemFontFamily.Pretendard.semiBold.font(size: 16) - return label - }() - - private lazy var buttonIcon: UIImageView = { - var imageView = UIImageView() - imageView.contentMode = .scaleAspectFit - return imageView - }() - - private lazy var buttonStackView: UIStackView = { - var stackView = UIStackView(arrangedSubviews: [buttonLabel, buttonIcon]) - stackView.axis = .horizontal - stackView.alignment = .center - stackView.spacing = 4 - return stackView - }() - - - // MARK: - Properties - typealias CMCButtonUISet = (boarderColor: UIColor, mainColor: UIColor, backgroundColor: UIColor) - - var disposeBag = DisposeBag() - - private var isRound: Bool - private var iconTitle: String? - private var title: String - private var type: CMCButtonType - - public var rxType = BehaviorRelay(value: .login(.inactive)) - - // MARK: - Initializers - - /// 버튼의 `isRound`, `iconTitle`, `buttonType`, `title`을 설정합니다. - /// - Parameters: - /// - isRound : 버튼의 layer를 둥글게 할지 결정합니다. - /// - iconTitle : 버튼의 이미지를 설정합니다. (nil이면 icon을 사용 안한다는 의미) - /// - buttonType : 버튼의 타입을 결정함 ( ex: fill, outline, boldOutline ) - /// - title: 버튼의 타이틀을 설정합니다. - public init(isRound: Bool, iconTitle: String? = nil, type: CMCButtonType, title: String) { - self.isRound = isRound - self.iconTitle = iconTitle - self.type = type - self.title = title - super.init(frame: .zero) - - self.setAddSubView() - self.setConstraint() - self.setAttribute() - - self.bind() - - } - - required init?(coder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } - // MARK: - LifeCycle - - // MARK: - Methods - - private func setAddSubView() { - self.addSubview(buttonStackView) - } - - private func setConstraint() { - buttonIcon.snp.makeConstraints { - $0.width.height.equalTo(24) - } - - buttonStackView.snp.makeConstraints { - $0.center.equalToSuperview() - } - } - - private func setAttribute() { - self.layer.cornerRadius = isRound ? self.frame.height / 2 : 8 - self.layer.borderWidth = 1 - self.buttonLabel.text = title - if let title = self.iconTitle { - self.buttonIcon.image = UIImage(named: title) - } else { - buttonIcon.isHidden = true - } - self.rxType.accept(type) - } - - private func bind() { - - rxType - .withUnretained(self) - .observe(on: MainScheduler.instance) - .subscribe(onNext: { owner, type in - owner.configureUISet(type: type) - }) - .disposed(by: disposeBag) - } - - private func configureUISet(type: CMCButtonType) { - // TODO: 여기서 색깔놀이 하자 - let UISet = type.UISet - self.layer.borderColor = UISet.boarderColor.cgColor - self.buttonLabel.textColor = UISet.mainColor - self.buttonIcon.tintColor = UISet.mainColor - self.backgroundColor = UISet.backgroundColor - self.isUserInteractionEnabled = type.isEnable - } - - public func makeCustomState(type: CMCButtonType) { - rxType.accept(type) - } - - public func setTitle(title: String) { - self.buttonLabel.text = title - } - -} - -// MARK: - CMCButton.ButtonType -extension CMCButton{ - - /// 버튼의 상태에 따라서 - /// `boarderColor`, `mainColor`, `backgroundColor` 를 선택한다. - /// - Parameters: - /// - boarderColor : 버튼의 boarderColor - /// - mainColor : 버튼의 accessoryFillColor, textColor - /// - backgroundColor : 버튼의 backgroundColor - - public enum CMCButtonType { - case login(LoginStyle) - - public enum LoginStyle { - case inactive - case clear - case disabled - } - - var isEnable: Bool { - switch self { - case .login(let style): - switch style { - case .inactive, .clear: - return true - case .disabled: - return false - } - } - - } - - var UISet: CMCButtonUISet { - switch self { - - case .login(let style): - switch style { - case .disabled: - return CMCButtonUISet( - boarderColor: DesignSystemAsset.gray900.color, - mainColor: DesignSystemAsset.gray700.color, - backgroundColor: DesignSystemAsset.gray900.color - ) - case .clear: - return CMCButtonUISet( - boarderColor: DesignSystemAsset.main1.color, - mainColor: DesignSystemAsset.gray400.color, - backgroundColor: .clear - ) - case .inactive: - return CMCButtonUISet( - boarderColor: DesignSystemAsset.main1.color, - mainColor: DesignSystemAsset.gray50.color, - backgroundColor: DesignSystemAsset.main1.color - ) - - } - } - } - } - - -} - -extension Reactive where Base: CMCButton { - public var tap: ControlEvent { - let source: Observable = self.base.rx.tapGesture() - .when(.recognized) - .map { _ in () } - return ControlEvent(events: source) - } - -} diff --git a/DesignSystem/Sources/CMCErrorMessage.swift b/DesignSystem/Sources/CMCErrorMessage.swift deleted file mode 100644 index e29e79b..0000000 --- a/DesignSystem/Sources/CMCErrorMessage.swift +++ /dev/null @@ -1,166 +0,0 @@ -// -// CMCErrorMessage.swift -// DesignSystem -// -// Created by Siri on 11/6/23. -// Copyright © 2023 com.centralMakeusChallenge. All rights reserved. -// - -import Foundation - -import RxCocoa -import RxSwift - -import SnapKit - -import UIKit - -public final class CMCErrorMessage: UIView { - - // MARK: - UI - private lazy var errorAccessory: UIImageView = { - let view = UIImageView() - return view - }() - - private lazy var errorLabel: UILabel = { - let label = UILabel() - label.font = DesignSystemFontFamily.Pretendard.medium.font(size: 14) - label.textColor = DesignSystemAsset.error.color - return label - }() - - private lazy var stackView: UIStackView = { - let stackView = UIStackView(arrangedSubviews: [errorAccessory, errorLabel]) - stackView.axis = .horizontal - stackView.spacing = 8 - return stackView - }() - - // MARK: - Properties - typealias CMCErrorMessageUISet = (errorMessageColor: UIColor, accessoryImage: UIImage?) - - var disposeBag = DisposeBag() - private var title = BehaviorRelay(value: "") - private var resetState: (String, CMCErrorMessageType) - - public var rxType = BehaviorRelay(value: .none) - - // MARK: - Initialize - - /// ErrorMessage의 `title`을 설정합니다. - /// - Parameters: - /// - title : Error의 타이틀을 설정합니다. - /// - type: 초기 타입을 설정합니다. - public init(title: String, type: CMCErrorMessageType) { - self.title.accept(title) - self.rxType.accept(type) - self.resetState = (title, type) - super.init(frame: .zero) - - setAddSubView() - setConstraint() - - bind() - } - - required init?(coder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } - - // MARK: - Set UI - - private func setAddSubView() { - addSubview(stackView) - } - - private func setConstraint() { - stackView.snp.makeConstraints { - $0.top.bottom.equalToSuperview() - $0.leading.trailing.equalToSuperview() - } - - errorAccessory.snp.makeConstraints { - $0.width.height.equalTo(18) - } - } - - private func bind() { - rxType - .asDriver(onErrorJustReturn: .none) - .drive(onNext: { [weak self] type in - guard let self = self else { return } - self.configureUISet(type: type) - }) - .disposed(by: disposeBag) - - title - .asDriver(onErrorJustReturn: "") - .drive(onNext: { [weak self] title in - guard let self = self else { return } - self.errorLabel.text = title - }) - .disposed(by: disposeBag) - } - - private func configureUISet(type: CMCErrorMessageType) { - // TODO: 여기서 색깔놀이 하자 - let UISet = type.UISet - errorLabel.textColor = UISet.errorMessageColor - errorAccessory.image = UISet.accessoryImage - errorAccessory.isHidden = type == .error ? true : false - } - - public func setErrorMessage(message: String) { - title.accept(message) - } - - public func reset() { - title.accept(resetState.0) - rxType.accept(resetState.1) - } - -} - -// MARK: - CMCErrorMessage.Type -extension CMCErrorMessage { - - /// 에러의 상태에 따라서 - /// `errorMessageColor`, `accessoryImage` 를 선택한다. - /// - Parameters: - /// - errorMessageColor : 에러 라벨의 색상 - /// - accessoryImage : 악세서리 이미지 - - public enum CMCErrorMessageType { - case error - case success - case disabled - case none - - var UISet: CMCErrorMessageUISet { - switch self { - case .error: - return ( - errorMessageColor: DesignSystemAsset.error.color, - accessoryImage: nil - ) - case .success: - return ( - errorMessageColor: DesignSystemAsset.main1.color, - accessoryImage: DesignSystemAsset._18x18check.image - ) - case .none: - return ( - errorMessageColor: .clear, - accessoryImage: nil - ) - case .disabled: - return ( - errorMessageColor: DesignSystemAsset.gray700.color, - accessoryImage: DesignSystemAsset._18x18checkDisabled.image - ) - } - } - } - -} diff --git a/DesignSystem/Sources/CMCNavigationBar.swift b/DesignSystem/Sources/CMCNavigationBar.swift deleted file mode 100644 index 6fa7a1e..0000000 --- a/DesignSystem/Sources/CMCNavigationBar.swift +++ /dev/null @@ -1,80 +0,0 @@ -// -// CMCNavigationBar.swift -// DesignSystem -// -// Created by Siri on 10/27/23. -// Copyright © 2023 com.centralMakeusChallenge. All rights reserved. -// - -import Foundation - -import RxCocoa -import RxGesture -import RxSwift - -import SnapKit - -import UIKit - - -public final class CMCNavigationBar: UIView { - - // MARK: - UI - public lazy var backButton: CMCTouchArea = { - let backButton = CMCTouchArea( - image: DesignSystemAsset._24x24arrowLeft.image - ) - return backButton - }() - - public lazy var accessoryLabel: UILabel = { - let label = UILabel() - label.font = DesignSystemFontFamily.Pretendard.bold.font(size: 14) - label.textColor = DesignSystemAsset.gray700.color - return label - }() - - // MARK: - Properties - private var accessoryLabelHidden: Bool - - // MARK: - Initializers - public init(accessoryLabelHidden: Bool) { - self.accessoryLabelHidden = accessoryLabelHidden - - super.init(frame: .zero) - - self.backgroundColor = DesignSystemAsset.background.color - - self.addSubviews() - self.addConstraints() - self.addUIConfigure() - } - - required init?(coder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } - - // MARK: - Methods - - private func addSubviews() { - self.addSubview(backButton) - self.addSubview(accessoryLabel) - } - - private func addConstraints() { - backButton.snp.makeConstraints { - $0.leading.equalToSuperview().offset(5) - $0.centerY.equalToSuperview() - $0.width.height.equalTo(44) - } - - accessoryLabel.snp.makeConstraints { - $0.trailing.equalToSuperview().offset(-24) - $0.centerY.equalToSuperview() - } - } - - private func addUIConfigure() { - accessoryLabel.isHidden = accessoryLabelHidden - } -} diff --git a/DesignSystem/Sources/CMCProgressPager.swift b/DesignSystem/Sources/CMCProgressPager.swift deleted file mode 100644 index 0ea404f..0000000 --- a/DesignSystem/Sources/CMCProgressPager.swift +++ /dev/null @@ -1,161 +0,0 @@ -// -// CMCProgressPager.swift -// DesignSystem -// -// Created by Siri on 10/28/23. -// Copyright © 2023 com.centralMakeusChallenge. All rights reserved. -// - -import Foundation - -import RxCocoa -import RxSwift - -import SnapKit - -import UIKit - -public final class CMCProgressPager: UIView { - // MARK: - UI - - private lazy var progressView: UIProgressView = { - let progressView = UIProgressView() - progressView.progressTintColor = DesignSystemAsset.main1.color - progressView.trackTintColor = DesignSystemAsset.background.color - progressView.progress = 0.00 - return progressView - }() - - private lazy var titleLabel: UILabel = { - let label = UILabel() - label.text = "default" - label.font = DesignSystemFontFamily.Pretendard.bold.font(size: 26) - label.textColor = DesignSystemAsset.gray50.color - return label - }() - - private lazy var pagerScrollView: UIScrollView = { - let scrollView = UIScrollView() - scrollView.isPagingEnabled = true - scrollView.isScrollEnabled = false - scrollView.showsHorizontalScrollIndicator = false - - return scrollView - }() - - // MARK: - Properties - - private let disposeBag = DisposeBag() - private let currentPage = BehaviorRelay(value: 1) - - private var pages: [UIView] - private let titles: [String] - private var pagesCount: Int - - // MARK: - Initializers - public init( - pages: [UIView], - titles: [String] - ) { - self.pages = pages - self.titles = titles - self.pagesCount = pages.count - - super.init(frame: .zero) - setAddSubView() - setConstraint() - bind() - } - - required init?(coder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } - // MARK: - LifeCycle - - // MARK: - Methods - public override func layoutSubviews() { - super.layoutSubviews() - - for (index, page) in pages.enumerated() { - pagerScrollView.addSubview(page) - page.snp.makeConstraints { make in - make.top.equalTo(titleLabel.snp.bottom).offset(24) - make.bottom.equalTo(self.snp.bottom) - make.width.equalTo(self.frame.size.width) - make.leading.equalToSuperview().offset(CGFloat(index) * self.frame.size.width) - } - } - pagerScrollView.contentSize = CGSize( - width: self.frame.size.width * CGFloat(pages.count), - height: self.frame.size.height - ) - } - - private func setAddSubView() { - self.addSubview(progressView) - self.addSubview(titleLabel) - self.addSubview(pagerScrollView) - } - - private func setConstraint() { - - self.progressView.snp.makeConstraints{ progressView in - progressView.top.equalTo(self) - progressView.height.equalTo(2) - progressView.leading.trailing.equalTo(self) - } - - self.titleLabel.snp.makeConstraints { titleLabel in - titleLabel.top.equalTo(progressView.snp.bottom).offset(30) - titleLabel.leading.equalToSuperview().offset(24) - titleLabel.height.lessThanOrEqualTo(32) - } - - self.pagerScrollView.snp.makeConstraints { scrollView in - scrollView.top.equalTo(titleLabel.snp.bottom).offset(24) - scrollView.leading.trailing.bottom.equalTo(self) - } - } - - private func bind() { - currentPage.asObservable() - .map { Float($0) / Float(self.pagesCount) } - .withUnretained(self) - .subscribe(onNext: { owner, progress in - owner.progressView.setProgress(progress, animated: true) - }) - .disposed(by: disposeBag) - - currentPage.asObservable() - .subscribe(onNext: { [weak self] page in - guard let self = self else { return } - let xOffset = CGFloat(page - 1) * self.frame.size.width - self.pagerScrollView.setContentOffset(CGPoint(x: xOffset, y: 0), animated: true) - }) - .disposed(by: disposeBag) - - currentPage.asObservable() - .withUnretained(self) - .subscribe(onNext: { owner, page in - owner.titleLabel.text = owner.titles[page - 1] - }) - .disposed(by: disposeBag) - - } - - public func nextPage() { - currentPage.accept(currentPage.value + 1) - } - - public func previousPage() { - currentPage.accept(currentPage.value - 1) - } - - public func getCurrentPage() -> Observable { - return currentPage.asObservable() - } - - public func totalPages() -> Int { - return pagesCount - } -} diff --git a/DesignSystem/Sources/CMCTextField+Timer.swift b/DesignSystem/Sources/CMCTextField+Timer.swift deleted file mode 100644 index c4f2079..0000000 --- a/DesignSystem/Sources/CMCTextField+Timer.swift +++ /dev/null @@ -1,339 +0,0 @@ -// -// CMCTextField+Timer.swift -// DesignSystem -// -// Created by Siri on 11/15/23. -// Copyright © 2023 com.softsquared.cmc. All rights reserved. -// - -import Foundation - -import RxCocoa -import RxSwift - -import SnapKit - -import UIKit - -public final class CMCTextField_Timer: UIView { - - // MARK: - UI - fileprivate lazy var textField: CustomTextField = { - let textField = CustomTextField() - let leftPadding = UIView(frame: CGRect(x: 0, y: 0, width: 5, height: textField.frame.height)) - textField.leftView = leftPadding - textField.leftViewMode = .always - textField.keyboardType = keyboardType - textField.font = DesignSystemFontFamily.Pretendard.medium.font(size: 15) - textField.textColor = DesignSystemAsset.gray50.color - let attributes = [ - NSAttributedString.Key.foregroundColor: DesignSystemAsset.gray700.color, - NSAttributedString.Key.font: DesignSystemFontFamily.Pretendard.medium.font(size: 15) - ] - textField.attributedPlaceholder = NSAttributedString(string: placeHolder, attributes: attributes) - return textField - }() - - private lazy var textFieldTitle: UILabel = { - let label = UILabel() - label.font = DesignSystemFontFamily.Pretendard.bold.font(size: 14) - label.textColor = DesignSystemAsset.gray500.color - label.text = textFieldSubTitle - return label - }() - - public lazy var accessoryCMCButton: CMCButton = { - let button = CMCButton( - isRound: false, - iconTitle: nil, - type: .login(.inactive), - title: buttonTitle - ) - return button - }() - - private lazy var bottomBoarder: UIView = { - let view = UIView() - view.backgroundColor = DesignSystemAsset.gray700.color - return view - }() - - private lazy var timerLabel: UILabel = { - let label = UILabel() - label.textColor = DesignSystemAsset.error.color - label.font = DesignSystemFontFamily.Pretendard.medium.font(size: 13) - return label - }() - - // MARK: - Properties - - typealias TextField_TimerColorSet = ( - borderColor: UIColor, - textFieldBackgroundColor: UIColor, - textFieldTextColor: UIColor, - bottomBoarderColor: UIColor, - isUserInteractive: Bool - ) - - private var disposeBag = DisposeBag() - private var timerDisposeBag = DisposeBag() - - private var placeHolder: String - private var textFieldSubTitle: String - private var buttonTitle: String - private var keyboardType: UIKeyboardType - - private var timerCountRelay = BehaviorRelay(value: 180) - public var rxType = BehaviorRelay(value: .def) - - /// - Parameters: - /// - placeHolder : placeHolder로 들어갈 텍스트 - /// - textFieldSubTitle: 텍스트필드의 이름을 나타냄 - /// - buttonTitle: 우측 버튼의 이름 - /// - keyboardType: 키보드 타입 - /// - Parameters (Optional): - /// - Parameters (Accessable): - /// - rxType: CMCTextField_Timer의 타입변환 조종값 - // MARK: - Initializers - public init( - placeHolder: String, - textFieldSubTitle: String, - buttonTitle: String, - keyboardType: UIKeyboardType - ) { - self.placeHolder = placeHolder - self.textFieldSubTitle = textFieldSubTitle - self.buttonTitle = buttonTitle - self.keyboardType = keyboardType - - super.init(frame: .zero) - - textField.delegate = self - - setAddSubView() - setConstraint() - bind() - } - - required init?(coder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } - // MARK: - LifeCycle - - // MARK: - Methods - - private func setAddSubView() { - self.addSubview(textField) - self.addSubview(textFieldTitle) - self.addSubview(accessoryCMCButton) - self.addSubview(bottomBoarder) - self.addSubview(timerLabel) - } - - private func setConstraint() { - - bottomBoarder.snp.makeConstraints { - $0.height.equalTo(1) - $0.leading.bottom.equalToSuperview() - $0.trailing.equalTo(accessoryCMCButton.snp.leading).offset(-16) - } - - textField.snp.makeConstraints { - $0.top.leading.equalToSuperview() - $0.height.equalTo(74) - $0.trailing.equalTo(accessoryCMCButton.snp.leading).offset(-8) - } - - textFieldTitle.snp.makeConstraints { - $0.top.equalToSuperview().offset(12) - $0.leading.equalToSuperview().offset(5) - } - - accessoryCMCButton.snp.makeConstraints { - $0.height.equalTo(34) - $0.width.equalTo(76) - $0.trailing.equalToSuperview().offset(-18) - $0.bottom.equalTo(bottomBoarder.snp.top).offset(-10) - } - - timerLabel.snp.makeConstraints { - $0.centerY.equalTo(textField).offset(15) - $0.trailing.equalTo(accessoryCMCButton.snp.leading).offset(-16) - $0.height.equalTo(18) - } - - } - - private func bind() { - - timerCountRelay - .withUnretained(self) - .subscribe(onNext: { owner, second in - if second == 0 { - owner.timerDisposeBag = DisposeBag() // 타이머 구독 해제 - } - }) - .disposed(by: disposeBag) - - rxType - .distinctUntilChanged() - .asDriver(onErrorJustReturn: .def) - .drive(onNext: { [weak self] type in - guard let self = self else { return } - self.configureColorSet(colorSet: type.colorSet) - }) - .disposed(by: disposeBag) - - } - - private func configureColorSet(colorSet: TextField_TimerColorSet) { - // TODO: 여기서 색깔놀이 하자 - textField.layer.borderColor = UIColor.clear.cgColor - textField.backgroundColor = .clear - textField.textColor = colorSet.textFieldTextColor - bottomBoarder.backgroundColor = colorSet.bottomBoarderColor - self.isUserInteractionEnabled = colorSet.isUserInteractive - } - - func makeCustomState(textFieldWithTimerState: TextFieldWithTimerType) { - rxType.accept(textFieldWithTimerState) - } - - private func startTimer() { - Observable - .timer(.seconds(0), period: .seconds(1), scheduler: MainScheduler.instance) - .withLatestFrom(timerCountRelay.asObservable()) { _, count in count } - .map { $0 - 1 } - .do(onNext: { [weak self] newCount in - self?.timerCountRelay.accept(newCount) - }) - .take(while: { $0 >= 0 }) - .map { timeInSeconds -> String in - let minutes = timeInSeconds / 60 - let seconds = timeInSeconds % 60 - return String(format: "%02d:%02d", minutes, seconds) - } - .asDriver(onErrorJustReturn: "Error") - .drive(timerLabel.rx.text) - .disposed(by: timerDisposeBag) - } - - public func resetTimer() { - timerDisposeBag = DisposeBag() // 타이머 구독 해제 - timerCountRelay.accept(180) // 초기 시간을 180초로 설정 - startTimer() // 타이머 다시 시작 - } - -} - - -extension CMCTextField_Timer{ - - /// TextField의 상태에 따라서 - /// `Boarder color`, `textField background color`, `textField text color`, - /// `errorMessage Hidden`, `isUserInteractive` 를 선택한다. - /// - Parameters: - /// - BorderColor : TextField의 border color 색상 - /// - textFieldBackgroundColor : TextField의 background color 색상 - /// - textFieldTextColor : TextField의 text color 색상 - /// - isUserInteractive : TextField의 isUserInteractive - - - public enum TextFieldWithTimerType { - case def /// 초기 상태 - case focus /// 입력 중 - case filed /// 입력 완료 - case disabled /// 불가영역 - case error /// 에러 - - var colorSet: TextField_TimerColorSet { - switch self { - case .def: - return TextField_TimerColorSet( - borderColor: DesignSystemAsset.gray800.color, - textFieldBackgroundColor: DesignSystemAsset.gray800.color, - textFieldTextColor: DesignSystemAsset.gray50.color, - bottomBoarderColor: DesignSystemAsset.gray700.color, - isUserInteractive: true - ) - case .focus: - return TextField_TimerColorSet( - borderColor: DesignSystemAsset.gray800.color, - textFieldBackgroundColor: DesignSystemAsset.gray800.color, - textFieldTextColor: DesignSystemAsset.gray50.color, - bottomBoarderColor: DesignSystemAsset.gray100.color, - isUserInteractive: true - ) - case .filed: - return TextField_TimerColorSet( - borderColor: DesignSystemAsset.gray800.color, - textFieldBackgroundColor: DesignSystemAsset.gray800.color, - textFieldTextColor: DesignSystemAsset.gray50.color, - bottomBoarderColor: DesignSystemAsset.gray100.color, - isUserInteractive: true - ) - case .disabled: - return TextField_TimerColorSet( - borderColor: DesignSystemAsset.gray800.color, - textFieldBackgroundColor: DesignSystemAsset.gray800.color, - textFieldTextColor: DesignSystemAsset.gray50.color, - bottomBoarderColor: DesignSystemAsset.gray700.color, - isUserInteractive: false - ) - case .error: - return TextField_TimerColorSet( - borderColor: DesignSystemAsset.gray800.color, - textFieldBackgroundColor: DesignSystemAsset.gray800.color, - textFieldTextColor: DesignSystemAsset.gray50.color, - bottomBoarderColor: DesignSystemAsset.error.color, - isUserInteractive: true - ) - - } - } - } - -} - - -extension CMCTextField_Timer: UITextFieldDelegate { - - public func textFieldShouldBeginEditing(_ textField: UITextField) -> Bool { - self.rxType.accept(.focus) - return true - } - - public func textFieldShouldEndEditing(_ textField: UITextField) -> Bool { - self.rxType.accept(.filed) - return true - } - - public func textFieldShouldReturn(_ textField: UITextField) -> Bool { - self.rxType.accept(.filed) - return true - } -} - - -// MARK: - CMCTextField_Timer+RxSwift -extension Reactive where Base: CMCTextField_Timer { - - public func controlEvent(_ events: UIControl.Event) -> ControlEvent { - let source = self.base.textField.rx.controlEvent(events).map { _ in } - return ControlEvent(events: source) - } - - public var text: ControlProperty { - return self.base.textField.rx.text - } - - public var becomeFirstResponder: Binder { - return Binder(self.base) { textField, _ in - textField.textField.becomeFirstResponder() - } - } - - public var confirmBtnTapped: ControlEvent { - return self.base.accessoryCMCButton.rx.tap - } -} diff --git a/DesignSystem/Sources/CMCTextField.swift b/DesignSystem/Sources/CMCTextField.swift deleted file mode 100644 index e1e0179..0000000 --- a/DesignSystem/Sources/CMCTextField.swift +++ /dev/null @@ -1,408 +0,0 @@ -// -// CMCTextField.swift -// DesignSystem -// -// Created by Siri on 2023/10/24. -// Copyright © 2023 com.centralMakeusChallenge. All rights reserved. -// -import Foundation - -import RxCocoa -import RxSwift - -import SnapKit - -import UIKit - -public final class CMCTextField: UIView{ - - public enum AccessoryType { - case image(image: UIImage) - case button(title: String) - case none - } - - // MARK: - UI - fileprivate lazy var textField: CustomTextField = { - let textField = CustomTextField() - let leftPadding = UIView(frame: CGRect(x: 0, y: 0, width: 5, height: textField.frame.height)) - textField.leftView = leftPadding - textField.leftViewMode = .always - textField.keyboardType = keyboardType - textField.font = DesignSystemFontFamily.Pretendard.medium.font(size: 15) - textField.textColor = DesignSystemAsset.gray50.color - let attributes = [ - NSAttributedString.Key.foregroundColor: DesignSystemAsset.gray700.color, - NSAttributedString.Key.font: DesignSystemFontFamily.Pretendard.medium.font(size: 15) - ] - textField.attributedPlaceholder = NSAttributedString(string: placeHolder, attributes: attributes) - return textField - }() - - private lazy var textFieldTitle: UILabel = { - let label = UILabel() - label.font = DesignSystemFontFamily.Pretendard.bold.font(size: 14) - label.textColor = DesignSystemAsset.gray500.color - label.text = textFieldSubTitle - return label - }() - - - /// 우측 악세서리 이미지는, 외부에서 접근 가능해야함. - public lazy var accessoryButton: CMCTouchArea = { - let button = CMCTouchArea(image: accessoryImage) - return button - }() - - /// 우측 악세서리 버튼은, 외부에서 접근 가능해야함. - public lazy var accessoryCMCButton: CMCButton = { - let button = CMCButton( - isRound: false, - iconTitle: nil, - type: .login(.disabled), - title: accessoryTitle - ) - return button - }() - - private lazy var bottomBoarder: UIView = { - let view = UIView() - view.backgroundColor = DesignSystemAsset.gray700.color - return view - }() - - // MARK: - Properties - typealias TextFieldColorSet = ( - borderColor: UIColor, - textFieldBackgroundColor: UIColor, - textFieldTextColor: UIColor, - bottomBoarderColor: UIColor, - isUserInteractive: Bool, - accessoryHidden: Bool - ) - - private var disposeBag = DisposeBag() - - private var placeHolder: String - private var textFieldSubTitle: String - private var accessoryImage: UIImage = UIImage() - private var accessoryTitle: String = "" - private var accessoryType: AccessoryType - private var keyboardType: UIKeyboardType - - public var rxType = BehaviorRelay(value: .def) - public var accessoryState = BehaviorRelay(value: false) - public var isSecureTextEntry: Bool { - get { - return textField.isSecureTextEntry - } - set { - textField.isSecureTextEntry = newValue - } - } - - /// - Parameters: - /// - placeHolder : placeHolder로 들어갈 텍스트 - /// - accessoryType: 우측 악세서리에 들어가는 타입 (.none 이면 없음) - /// - textFieldSubTitle: 텍스트필드의 이름을 나타냄 - /// - keyboardType: 키보드 타입 - /// - Parameters (Optional): - /// - Parameters (Accessable): - /// - rxType: CMCTextField의 타입변환 조종값 - /// - accessoryState: 우측 악세서리 버튼의 상태 (이미지 일 경우만) - /// - isSecureTextEntry: 텍스트필드의 secureTextEntry 상태 - // MARK: - Initializers - public init( - placeHolder: String, - textFieldSubTitle: String, - accessoryType: AccessoryType, - keyboardType: UIKeyboardType - ) { - self.placeHolder = placeHolder - self.textFieldSubTitle = textFieldSubTitle - self.keyboardType = keyboardType - self.accessoryType = accessoryType - - - switch accessoryType { - case .button(let title): - self.accessoryTitle = title - case .image(let image): - self.accessoryImage = image - case .none: - self.accessoryImage = UIImage() - self.accessoryTitle = "" - } - - super.init(frame: .zero) - - textField.delegate = self - - setAddSubView() - setConstraint() - bind() - } - - required init?(coder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } - // MARK: - LifeCycle - - // MARK: - Methods - - private func setAddSubView() { - self.addSubview(textField) - self.addSubview(textFieldTitle) - self.addSubview(accessoryButton) - self.addSubview(accessoryCMCButton) - self.addSubview(bottomBoarder) - } - - private func setConstraint() { - - - switch accessoryType { - - case .button: - bottomBoarder.snp.makeConstraints { - $0.height.equalTo(1) - $0.leading.bottom.equalToSuperview() - $0.trailing.equalTo(accessoryCMCButton.snp.leading).offset(-8) - } - - textField.snp.makeConstraints { - $0.top.leading.equalToSuperview() - $0.height.equalTo(74) - $0.trailing.equalTo(accessoryCMCButton.snp.leading).offset(-8) - } - default: - bottomBoarder.snp.makeConstraints { - $0.height.equalTo(1) - $0.leading.trailing.bottom.equalToSuperview() - } - - textField.snp.makeConstraints { - $0.top.leading.trailing.equalToSuperview() - $0.height.equalTo(74) - } - } - - - - textFieldTitle.snp.makeConstraints { - $0.top.equalToSuperview().offset(12) - $0.leading.equalToSuperview().offset(5) - } - - accessoryButton.snp.makeConstraints { - $0.height.width.equalTo(48) - $0.trailing.equalToSuperview().offset(-6) - $0.bottom.equalToSuperview() - } - - accessoryCMCButton.snp.makeConstraints { - $0.height.equalTo(34) - $0.width.equalTo(76) - $0.trailing.equalToSuperview().offset(-18) - $0.centerY.equalToSuperview() - } - - - } - - private func bind() { - - rxType - .distinctUntilChanged() - .asDriver(onErrorJustReturn: .def) - .drive(onNext: { [weak self] colorSet in - guard let self = self else { return } - self.configureColorSet(colorSet: colorSet.colorSet) - if rxType.value == .disabled || rxType.value == .def { - accessoryCMCButton.rxType.accept(.login(.disabled)) - } else { - accessoryCMCButton.rxType.accept(.login(.inactive)) - } - }) - .disposed(by: disposeBag) - - accessoryButton.rx.tapped() - .withUnretained(self) - .subscribe(onNext: { owner, _ in - owner.accessoryState.accept(!owner.accessoryState.value) - }) - .disposed(by: disposeBag) - - } - - private func configureColorSet(colorSet: TextFieldColorSet) { - // TODO: 여기서 색깔놀이 하자 - textField.layer.borderColor = UIColor.clear.cgColor - textField.backgroundColor = .clear - textField.textColor = colorSet.textFieldTextColor - bottomBoarder.backgroundColor = colorSet.bottomBoarderColor - self.isUserInteractionEnabled = colorSet.isUserInteractive - - switch accessoryType { - case .button: - accessoryButton.removeFromSuperview() - case .image: - accessoryCMCButton.removeFromSuperview() - case .none: - accessoryButton.removeFromSuperview() - accessoryCMCButton.removeFromSuperview() - } - } - - func makeCustomState(textFieldState: TextFieldType) { - rxType.accept(textFieldState) - } -} - -extension CMCTextField{ - - /// TextField의 상태에 따라서 - /// `Boarder color`, `textField background color`, `textField text color`, `isUserInteractive`, `accessoryHidden`를 선택한다. - /// - Parameters: - /// - BorderColor : TextField의 border color 색상 // 우선 살리자 - /// - textFieldBackgroundColor : TextField의 background color 색상 // 우선 살리자 - /// - textFieldTextColor : TextField의 text color 색상 // 우선 살리자 - /// - isUserInteractive : TextField의 isUserInteractive // 우선 살리자 - /// - accessoryHidden : 우측 악세서리의 hidden 상태 처리 // 우선 살리자 - public enum TextFieldType { - case def /// 초기 상태 - case focus /// 입력 중 - case filed /// 입력 완료 - case disabled /// 불가영역 - case error /// 에러 - - var colorSet: TextFieldColorSet { - switch self { - case .def: - return TextFieldColorSet( - borderColor: DesignSystemAsset.gray800.color, - textFieldBackgroundColor: DesignSystemAsset.gray800.color, - textFieldTextColor: DesignSystemAsset.gray50.color, - bottomBoarderColor: DesignSystemAsset.gray700.color, - isUserInteractive: true, - accessoryHidden: true - ) - case .focus: - return TextFieldColorSet( - borderColor: DesignSystemAsset.gray800.color, - textFieldBackgroundColor: DesignSystemAsset.gray800.color, - textFieldTextColor: DesignSystemAsset.gray50.color, - bottomBoarderColor: DesignSystemAsset.gray100.color, - isUserInteractive: true, - accessoryHidden: false - ) - case .filed: - return TextFieldColorSet( - borderColor: DesignSystemAsset.gray800.color, - textFieldBackgroundColor: DesignSystemAsset.gray800.color, - textFieldTextColor: DesignSystemAsset.gray50.color, - bottomBoarderColor: DesignSystemAsset.gray100.color, - isUserInteractive: true, - accessoryHidden: false - ) - case .disabled: - return TextFieldColorSet( - borderColor: DesignSystemAsset.gray800.color, - textFieldBackgroundColor: DesignSystemAsset.gray800.color, - textFieldTextColor: DesignSystemAsset.gray50.color, - bottomBoarderColor: DesignSystemAsset.gray700.color, - isUserInteractive: false, - accessoryHidden: false - ) - case .error: - return TextFieldColorSet( - borderColor: DesignSystemAsset.gray800.color, - textFieldBackgroundColor: DesignSystemAsset.gray800.color, - textFieldTextColor: DesignSystemAsset.gray50.color, - bottomBoarderColor: DesignSystemAsset.error.color, - isUserInteractive: true, - accessoryHidden: false - ) - } - } - } - -} - -class CustomTextField: UITextField { - override func placeholderRect(forBounds bounds: CGRect) -> CGRect { - return CGRect( - x: bounds.origin.x + 5, - y: bounds.origin.y + 15, - width: bounds.width, - height: bounds.height - ) - } - - override func textRect(forBounds bounds: CGRect) -> CGRect { - return CGRect( - x: bounds.origin.x + 5, - y: bounds.origin.y + 15, - width: bounds.width, - height: bounds.height - ) - } - - override func editingRect(forBounds bounds: CGRect) -> CGRect { - return CGRect( - x: bounds.origin.x + 5, - y: bounds.origin.y + 15, - width: bounds.width, - height: bounds.height - ) - } -} - -extension CMCTextField: UITextFieldDelegate { - - public func textFieldShouldClear(_ textField: UITextField) -> Bool { - self.rxType.accept(.focus) - return true - } - - public func textFieldShouldBeginEditing(_ textField: UITextField) -> Bool { - self.rxType.accept(.focus) - return true - } - - public func textFieldShouldEndEditing(_ textField: UITextField) -> Bool { - guard let text = textField.text else { return false } - if text.isEmpty { - self.rxType.accept(.def) - } else { - self.rxType.accept(.filed) - } - return true - } - - public func textFieldShouldReturn(_ textField: UITextField) -> Bool { - guard let text = textField.text else { return false } - if text.isEmpty { - self.rxType.accept(.def) - } else { - self.rxType.accept(.filed) - } - return true - } - -} - - -// MARK: - CMCTextField+RxSwift -extension Reactive where Base: CMCTextField { - - public func controlEvent(_ events: UIControl.Event) -> ControlEvent { - let source = self.base.textField.rx.controlEvent(events).map { _ in } - return ControlEvent(events: source) - } - - public var text: ControlProperty { - return self.base.textField.rx.text - } - -} diff --git a/DesignSystem/Sources/CMCTouchArea.swift b/DesignSystem/Sources/CMCTouchArea.swift deleted file mode 100644 index 7e41155..0000000 --- a/DesignSystem/Sources/CMCTouchArea.swift +++ /dev/null @@ -1,107 +0,0 @@ -// -// CMCTouchArea.swift -// DesignSystem -// -// Created by Siri on 2023/10/24. -// Copyright © 2023 com.centralMakeusChallenge. All rights reserved. -// -import Foundation - -import RxCocoa -import RxSwift - -import SnapKit - -import UIKit - -public final class CMCTouchArea: UIView{ - - public enum TouchAreaStyle: Int { - case normal = 0 - case selected = 1 - } - - // MARK: - UI - private lazy var imageView: UIImageView = { - let imageView = UIImageView() - imageView.image = image[style.value.rawValue] - return imageView - }() - - // MARK: - Properties - private var disposeBag = DisposeBag() - - private var style = BehaviorRelay(value: .normal) - private var image: [Int:UIImage] = [:] - - /// 터치 영역의 `image`를 설정합니다. - /// - Parameters: - /// - image: 터치 영역의 `image` - /// - Parameters (Optional): - /// - Parameters (Accessable): - // MARK: - Initializers - public init( - image: UIImage? = nil - ) { - super.init(frame: .zero) - - self.setImage(image, for: .normal) - self.setImage(image, for: .selected) - - setAddSubView() - setConstraint() - bind() - } - - required init?(coder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } - - // MARK: - Methods - - private func setAddSubView() { - self.addSubview(imageView) - } - - private func setConstraint() { - imageView.snp.makeConstraints { - $0.centerX.centerY.equalToSuperview() - } - } - - private func bind() { - - self.style - .withUnretained(self) - .subscribe(onNext: { owner, style in - owner.imageView.image = owner.image[style.rawValue] - }) - .disposed(by: disposeBag) - - self.rx.tapped() - .withUnretained(self) - .subscribe(onNext: { owner, _ in - owner.style.accept(owner.style.value == .normal ? .selected : .normal) - }) - .disposed(by: disposeBag) - } - - public func setImage(_ image: UIImage?, for style: TouchAreaStyle) { - if let image = image { - self.image.updateValue(image, forKey: style.rawValue) - } - } - - public func makeCustomState(type: TouchAreaStyle) { - style.accept(type) - } - -} - -// MARK: - CMCTouchArea+RxSwift -extension Reactive where Base: CMCTouchArea { - public func tapped() -> ControlEvent { - let source = self.base.rx.tapGesture().when(.recognized).map { _ in } - return ControlEvent(events: source) - } -} diff --git a/LICENSE b/LICENSE deleted file mode 100644 index f9b2c84..0000000 --- a/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2023 Central MakeUs Challenge - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/Plugins/CMCIOS/Package.swift b/Plugins/CMCIOS/Package.swift deleted file mode 100644 index c532f25..0000000 --- a/Plugins/CMCIOS/Package.swift +++ /dev/null @@ -1,15 +0,0 @@ -// swift-tools-version: 5.8 - -import PackageDescription - -let package = Package( - name: "MyPlugin", - products: [ - .executable(name: "tuist-my-cli", targets: ["tuist-my-cli"]), - ], - targets: [ - .executableTarget( - name: "tuist-my-cli" - ), - ] -) diff --git a/Plugins/CMCIOS/Plugin.swift b/Plugins/CMCIOS/Plugin.swift deleted file mode 100644 index 86a1e55..0000000 --- a/Plugins/CMCIOS/Plugin.swift +++ /dev/null @@ -1,3 +0,0 @@ -import ProjectDescription - -let plugin = Plugin(name: "MyPlugin") \ No newline at end of file diff --git a/Plugins/CMCIOS/ProjectDescriptionHelpers/LocalHelper.swift b/Plugins/CMCIOS/ProjectDescriptionHelpers/LocalHelper.swift deleted file mode 100644 index 6f49a44..0000000 --- a/Plugins/CMCIOS/ProjectDescriptionHelpers/LocalHelper.swift +++ /dev/null @@ -1,9 +0,0 @@ -import Foundation - -public struct LocalHelper { - let name: String - - public init(name: String) { - self.name = name - } -} diff --git a/Plugins/CMCIOS/Sources/tuist-my-cli/main.swift b/Plugins/CMCIOS/Sources/tuist-my-cli/main.swift deleted file mode 100644 index 6f05969..0000000 --- a/Plugins/CMCIOS/Sources/tuist-my-cli/main.swift +++ /dev/null @@ -1 +0,0 @@ -print("Hello, from your Tuist Task") \ No newline at end of file diff --git a/Project.swift b/Project.swift deleted file mode 100644 index 445437d..0000000 --- a/Project.swift +++ /dev/null @@ -1,150 +0,0 @@ -import ProjectDescription -import Foundation -import ProjectDescriptionHelpers -import MyPlugin - -/* - +-------------+ - | | - | App | Contains CMC App target and CMC unit-test target - | | - +------+-------------+-------+ - | depends on | - | | - +----v-----+ +-----v-----+ - | | | | - | Kit | | UI | Two independent frameworks to share code and start modularising your app - | | | | - +----------+ +-----------+ - - */ - -// MARK: - Project - - -enum TargetType { - case DesignSystem - case App -} - -protocol ProjectProfile { - var projectName: String { get } - - func generateDependencies(targetName target: TargetType) -> [TargetDependency] - func generateTarget() -> [Target] - func generateAppConfigurations() -> Settings -} - -class BaseProjectProfile: ProjectProfile{ - - let projectName: String = "CMC" - - let infoPlist: [String: Plist.Value] = [ - "Base_Url" : "$(BASE_URL)", - "ITSAppUsesNonExemptEncryption": false, - "CFBundleShortVersionString": "1.0", - "CFBundleVersion": "1", - "CFBundleDevelopmentRegion": "ko_KR", - "UILaunchStoryboardName": "LaunchScreen", - "UIUserInterfaceStyle": "Light", - "UIApplicationSceneManifest": [ - "UIApplicationSupportsMultipleScenes": false, - "UISceneConfigurations": [ - "UIWindowSceneSessionRoleApplication": [ - [ - "UISceneConfigurationName": "Default Configuration", - "UISceneDelegateClassName": "$(PRODUCT_MODULE_NAME).SceneDelegate" - ], - ] - ] - ], - "CFBundleIconName": "AppIcon", - "UIAppFonts": [ - "Item 0": "Pretendard-Medium.otf", - "Item 1": "Pretendard-Regular.otf", - "Item 2": "Pretendard-SemiBold.otf", - "Item 3": "Pretendard-Bold.otf" - ], - "CFBundleURLTypes": [ - [ - "CFBundleURLName": "com.softsquared.cmc.ios" - ] - ], - "NSAppTransportSecurity": [ - "NSAllowsArbitraryLoads": true - ] - ] - - func generateDependencies(targetName target: TargetType) -> [TargetDependency] { - switch target{ - case .App: - return commonDependencies() + [ - .target(name: "DesignSystem") - ] - case .DesignSystem: - return commonDependencies() - } - } - - func generateAppConfigurations() -> Settings { - return Settings.settings( - configurations: [ - .debug(name: "Dev", xcconfig: .relativeToCurrentFile("CMC/Resources/Configure/Dev.xcconfig")), - .release(name: "Release", xcconfig: .relativeToCurrentFile("CMC/Resources/Configure/Release.xcconfig")), - ]) - } - - func generateTarget() -> [Target] { - [ - Target( - name: projectName, - platform: .iOS, - product: .app, - bundleId: "com.softsquared.cmc.ios", - deploymentTarget: .iOS(targetVersion: "15.0", devices: [.iphone]), - infoPlist: .extendingDefault(with: infoPlist), - sources: ["\(projectName)/Sources/**"], - resources: "\(projectName)/Resources/**", - dependencies: generateDependencies(targetName: .App), - settings: generateAppConfigurations() - ), - Target( - name: "DesignSystem", - platform: .iOS, - product: .framework, - bundleId: "com.softsquared.cmc.ios.DesignSystem", - deploymentTarget: .iOS(targetVersion: "15.0", devices: [.iphone]), - infoPlist: .default, - sources: ["DesignSystem/Sources/**"], - resources: "\(projectName)/Resources/**", - dependencies: generateDependencies(targetName: .DesignSystem) - ) - ] - } - -} - -let profile = BaseProjectProfile() - -let project: Project = .init( - name: profile.projectName, - organizationName: "com.softsquared.cmc", - settings: .settings(configurations: [ - .debug(name: "Dev"), - .release(name: "Release") - ]), - targets: profile.generateTarget() -) - - -extension BaseProjectProfile { - fileprivate func commonDependencies() -> [TargetDependency] { - return [ - .external(name: "RxSwift"), - .external(name: "RxCocoa"), - .external(name: "RxRelay"), - .external(name: "RxGesture"), - .external(name: "SnapKit") - ] - } -} diff --git a/README.md b/README.md deleted file mode 100644 index 6e3f5b4..0000000 --- a/README.md +++ /dev/null @@ -1 +0,0 @@ -# 공사 중 🚜 diff --git a/Targets/CMCIOS/Resources/LaunchScreen.storyboard b/Targets/CMCIOS/Resources/LaunchScreen.storyboard deleted file mode 100644 index 865e932..0000000 --- a/Targets/CMCIOS/Resources/LaunchScreen.storyboard +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Targets/CMCIOS/Sources/AppDelegate.swift b/Targets/CMCIOS/Sources/AppDelegate.swift deleted file mode 100644 index ac0c1ac..0000000 --- a/Targets/CMCIOS/Sources/AppDelegate.swift +++ /dev/null @@ -1,26 +0,0 @@ -import UIKit -import CMCIOSKit -import CMCIOSUI - -@main -class AppDelegate: UIResponder, UIApplicationDelegate { - - var window: UIWindow? - - func application( - _ application: UIApplication, - didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil - ) -> Bool { - window = UIWindow(frame: UIScreen.main.bounds) - let viewController = UIViewController() - viewController.view.backgroundColor = .white - window?.rootViewController = viewController - window?.makeKeyAndVisible() - - CMCIOSKit.hello() - CMCIOSUI.hello() - - return true - } - -} \ No newline at end of file diff --git a/Targets/CMCIOS/Tests/AppTests.swift b/Targets/CMCIOS/Tests/AppTests.swift deleted file mode 100644 index 6d09108..0000000 --- a/Targets/CMCIOS/Tests/AppTests.swift +++ /dev/null @@ -1,8 +0,0 @@ -import Foundation -import XCTest - -final class CMCIOSTests: XCTestCase { - func test_twoPlusTwo_isFour() { - XCTAssertEqual(2+2, 4) - } -} \ No newline at end of file diff --git a/Targets/CMCIOSKit/Sources/CMCIOSKit.swift b/Targets/CMCIOSKit/Sources/CMCIOSKit.swift deleted file mode 100644 index a8edee3..0000000 --- a/Targets/CMCIOSKit/Sources/CMCIOSKit.swift +++ /dev/null @@ -1,7 +0,0 @@ -import Foundation - -public final class CMCIOSKit { - public static func hello() { - print("Hello, from your Kit framework") - } -} diff --git a/Targets/CMCIOSKit/Tests/CMCIOSKitTests.swift b/Targets/CMCIOSKit/Tests/CMCIOSKitTests.swift deleted file mode 100644 index 0cb47a0..0000000 --- a/Targets/CMCIOSKit/Tests/CMCIOSKitTests.swift +++ /dev/null @@ -1,8 +0,0 @@ -import Foundation -import XCTest - -final class CMCIOSKitTests: XCTestCase { - func test_example() { - XCTAssertEqual("CMCIOSKit", "CMCIOSKit") - } -} \ No newline at end of file diff --git a/Targets/CMCIOSUI/Sources/CMCIOSUI.swift b/Targets/CMCIOSUI/Sources/CMCIOSUI.swift deleted file mode 100644 index 3deff88..0000000 --- a/Targets/CMCIOSUI/Sources/CMCIOSUI.swift +++ /dev/null @@ -1,7 +0,0 @@ -import Foundation - -public final class CMCIOSUI { - public static func hello() { - print("Hello, from your UI framework") - } -} diff --git a/Targets/CMCIOSUI/Tests/CMCIOSUITests.swift b/Targets/CMCIOSUI/Tests/CMCIOSUITests.swift deleted file mode 100644 index 1f8c43a..0000000 --- a/Targets/CMCIOSUI/Tests/CMCIOSUITests.swift +++ /dev/null @@ -1,8 +0,0 @@ -import Foundation -import XCTest - -final class CMCIOSUITests: XCTestCase { - func test_example() { - XCTAssertEqual("CMCIOSUI", "CMCIOSUI") - } -} \ No newline at end of file diff --git a/Tuist/Config.swift b/Tuist/Config.swift deleted file mode 100644 index b8b94db..0000000 --- a/Tuist/Config.swift +++ /dev/null @@ -1,7 +0,0 @@ -import ProjectDescription - -let config = Config( - plugins: [ - .local(path: .relativeToManifest("../../Plugins/CMCIOS")), - ] -) diff --git a/Tuist/Dependencies.swift b/Tuist/Dependencies.swift deleted file mode 100644 index db2bc6b..0000000 --- a/Tuist/Dependencies.swift +++ /dev/null @@ -1,24 +0,0 @@ -// -// Dependencies.swift -// Config -// -// Created by Siri on 2023/10/22. -// - -import ProjectDescription - -let spm = SwiftPackageManagerDependencies([ - .remote(url: "https://github.com/ReactiveX/RxSwift", requirement: .upToNextMajor(from: "6.6.0")), - .remote(url: "https://github.com/RxSwiftCommunity/RxGesture", requirement: .upToNextMinor(from: "4.0.0")), - .remote(url: "https://github.com/SnapKit/SnapKit", requirement: .upToNextMajor(from: "5.6.0")) - ], - baseSettings: .settings(configurations: [ - .debug(name: "Dev"), - .release(name: "Release") -])) - -let dependencies = Dependencies( - swiftPackageManager: spm, - platforms: [.iOS] -) - diff --git a/Tuist/ProjectDescriptionHelpers/Project+Templates.swift b/Tuist/ProjectDescriptionHelpers/Project+Templates.swift deleted file mode 100644 index c11cb2e..0000000 --- a/Tuist/ProjectDescriptionHelpers/Project+Templates.swift +++ /dev/null @@ -1,76 +0,0 @@ -import ProjectDescription - -/// Project helpers are functions that simplify the way you define your project. -/// Share code to create targets, settings, dependencies, -/// Create your own conventions, e.g: a func that makes sure all shared targets are "static frameworks" -/// See https://docs.tuist.io/guides/helpers/ - -extension Project { - /// Helper function to create the Project for this ExampleApp - public static func app(name: String, platform: Platform, additionalTargets: [String]) -> Project { - var targets = makeAppTargets(name: name, - platform: platform, - dependencies: additionalTargets.map { TargetDependency.target(name: $0) }) - targets += additionalTargets.flatMap({ makeFrameworkTargets(name: $0, platform: platform) }) - return Project(name: name, - organizationName: "com.softsquared.cmc", - targets: targets) - } - - // MARK: - Private - - /// Helper function to create a framework target and an associated unit test target - private static func makeFrameworkTargets(name: String, platform: Platform) -> [Target] { - let sources = Target(name: name, - platform: platform, - product: .framework, - bundleId: "com.softsquared.cmc.ios", - infoPlist: .default, - sources: ["\(name)/Sources/**"], - resources: [], - dependencies: []) -// let tests = Target(name: "\(name)Tests", -// platform: platform, -// product: .unitTests, -// bundleId: "io.tuist.\(name)Tests", -// infoPlist: .default, -// sources: ["Targets/\(name)/Tests/**"], -// resources: [], -// dependencies: [.target(name: name)]) - return [sources] - } - - /// Helper function to create the application target and the unit test target. - private static func makeAppTargets(name: String, platform: Platform, dependencies: [TargetDependency]) -> [Target] { - let platform: Platform = platform - let infoPlist: [String: Plist.Value] = [ - "CFBundleShortVersionString": "1.0", - "CFBundleVersion": "1", - "UIMainStoryboardFile": "", - "UILaunchStoryboardName": "LaunchScreen" - ] - - let mainTarget = Target( - name: name, - platform: platform, - product: .app, - bundleId: "com.softsquared.cmc.ios", - infoPlist: .extendingDefault(with: infoPlist), - sources: ["\(name)/Sources/**"], - resources: ["\(name)/Resources/**"], - dependencies: dependencies - ) - -// let testTarget = Target( -// name: "\(name)Tests", -// platform: platform, -// product: .unitTests, -// bundleId: "io.tuist.\(name)Tests", -// infoPlist: .default, -// sources: ["Targets/\(name)/Tests/**"], -// dependencies: [ -// .target(name: "\(name)") -// ]) - return [mainTarget] - } -}