(defaults: UserDefaults(suiteName: "SettingViewModelTests")!, keyStore: .init())
19 | viewModel = SettingViewModel(userDefaults: mockUserDefaults)
20 | dateManager = DateManager(formatter: DateManager.Formatter.holidayJpformatter)
21 | }
22 |
23 | override func tearDown() {}
24 |
25 | func test_init() {
26 | let fromDate = dateManager.date(from: "2018-01-01")
27 | let toDate = dateManager.date(from: "2018-01-10")
28 | let nationalHolidaySegment = NationalHolidaySegment.containsNationalHoliday
29 | let sortCriteriaSegment = SortCriteriaSegment.numberOfHolidays
30 | let paidDaysCount = 4
31 | let minimumNumberOfHolidays = 5
32 |
33 | mockUserDefaults.fromDate = fromDate
34 | mockUserDefaults.toDate = toDate
35 | mockUserDefaults.nationalHolidaySegment = nationalHolidaySegment
36 | mockUserDefaults.sortCriteriaSegment = sortCriteriaSegment
37 | mockUserDefaults.paidDaysCount = paidDaysCount
38 | mockUserDefaults.minimumNumberOfHolidays = minimumNumberOfHolidays
39 |
40 | viewModel = SettingViewModel(userDefaults: mockUserDefaults)
41 |
42 | XCTAssertEqual(viewModel.fromDate, fromDate)
43 | XCTAssertEqual(viewModel.toDate, toDate)
44 | XCTAssertEqual(viewModel.nationalHolidaySegment, nationalHolidaySegment)
45 | XCTAssertEqual(viewModel.sortCriteriaSegment, sortCriteriaSegment)
46 | XCTAssertEqual(viewModel.minimumNumberOfHolidays, minimumNumberOfHolidays)
47 | }
48 |
49 | func test_save() {
50 | let fromDate = dateManager.date(from: "2018-01-01")
51 | let toDate = dateManager.date(from: "2018-01-10")
52 | let nationalHolidaySegment = NationalHolidaySegment.containsNationalHoliday
53 | let sortCriteriaSegment = SortCriteriaSegment.numberOfHolidays
54 | let paidDaysCount = 4
55 | let minimumNumberOfHolidays = 5
56 |
57 | viewModel.fromDate = fromDate
58 | viewModel.toDate = toDate
59 | viewModel.nationalHolidaySegment = nationalHolidaySegment
60 | viewModel.sortCriteriaSegment = sortCriteriaSegment
61 | viewModel.paidDaysCount = paidDaysCount
62 | viewModel.minimumNumberOfHolidays = minimumNumberOfHolidays
63 |
64 | viewModel.save()
65 |
66 | XCTAssertEqual(mockUserDefaults.fromDate, fromDate)
67 | XCTAssertEqual(mockUserDefaults.toDate, toDate)
68 | XCTAssertEqual(mockUserDefaults.nationalHolidaySegment, nationalHolidaySegment)
69 | XCTAssertEqual(mockUserDefaults.sortCriteriaSegment, sortCriteriaSegment)
70 | XCTAssertEqual(mockUserDefaults.minimumNumberOfHolidays, minimumNumberOfHolidays)
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/Makefile:
--------------------------------------------------------------------------------
1 | SDKROOT=macosx
2 | envFile="$(shell ls -a | grep .env)"
3 |
4 | ifeq ("$(shell echo ${envFile})" , "$(shell echo .env)")
5 | include .env
6 | export
7 | else
8 | AD_UNIT_ID=ca-app-pub-3940256099942544/2934735716
9 | endif
10 |
11 |
12 | bootstrap: install-gems set-pods-keys xcodegen
13 | execute-xcodegen-and-pod: xcodegen install-pod
14 |
15 | # cocoapods
16 | install-pod:
17 | bundle exec pod install --repo-update
18 |
19 | # gem
20 | install-gems:
21 | rm -rf vendor/
22 | gem install -N bundler
23 | bundle install
24 |
25 | swiftgen:
26 | swift run --package-path CLI/_swiftgen -c release swiftgen
27 |
28 | swiftlint:
29 | swift run --package-path CLI/_swiftlint -c release swiftlint
30 |
31 | license-plist:
32 | swift run --package-path CLI/_license_plist -c release license-plist --output-path LongWeekend/Resource/Settings.bundle --prefix com.funzin.longweekend
33 |
34 | xcodegen:
35 | swift run --package-path CLI/_xcodegen -c release xcodegen
36 |
37 | swiftformat:
38 | swift run --package-path CLI/_swiftformat -c release swiftformat ./
39 |
40 | set-pods-keys:
41 | bundle exec pod keys set "AdUnitID" ${AD_UNIT_ID} LongWeekend
42 |
--------------------------------------------------------------------------------
/Podfile:
--------------------------------------------------------------------------------
1 | # Uncomment the next line to define a global platform for your project
2 | platform :ios, '13.0'
3 |
4 | plugin 'cocoapods-keys', {
5 | :project => "LongWeekend",
6 | :keys => [
7 | 'AdUnitID',
8 | ]
9 | }
10 | target 'LongWeekend' do
11 | # Comment the next line if you don't want to use dynamic frameworks
12 | use_frameworks!
13 |
14 | # Pods for LongWeekend
15 | pod 'Google-Mobile-Ads-SDK', '8.5.0'
16 |
17 | target 'LongWeekendTests' do
18 | inherit! :search_paths
19 | # Pods for testing
20 | end
21 |
22 | end
23 |
24 | post_install do |installer|
25 | installer.pods_project.build_configurations.each do |config|
26 | config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
27 | end
28 | end
29 |
30 |
--------------------------------------------------------------------------------
/Podfile.lock:
--------------------------------------------------------------------------------
1 | PODS:
2 | - Google-Mobile-Ads-SDK (8.5.0):
3 | - GoogleAppMeasurement (< 9.0, >= 7.0)
4 | - GoogleUserMessagingPlatform (>= 1.1)
5 | - GoogleAppMeasurement (8.1.0):
6 | - GoogleAppMeasurement/AdIdSupport (= 8.1.0)
7 | - GoogleUtilities/AppDelegateSwizzler (~> 7.4)
8 | - GoogleUtilities/MethodSwizzler (~> 7.4)
9 | - GoogleUtilities/Network (~> 7.4)
10 | - "GoogleUtilities/NSData+zlib (~> 7.4)"
11 | - nanopb (~> 2.30908.0)
12 | - GoogleAppMeasurement/AdIdSupport (8.1.0):
13 | - GoogleUtilities/AppDelegateSwizzler (~> 7.4)
14 | - GoogleUtilities/MethodSwizzler (~> 7.4)
15 | - GoogleUtilities/Network (~> 7.4)
16 | - "GoogleUtilities/NSData+zlib (~> 7.4)"
17 | - nanopb (~> 2.30908.0)
18 | - GoogleUserMessagingPlatform (2.0.0)
19 | - GoogleUtilities/AppDelegateSwizzler (7.4.1):
20 | - GoogleUtilities/Environment
21 | - GoogleUtilities/Logger
22 | - GoogleUtilities/Network
23 | - GoogleUtilities/Environment (7.4.1):
24 | - PromisesObjC (~> 1.2)
25 | - GoogleUtilities/Logger (7.4.1):
26 | - GoogleUtilities/Environment
27 | - GoogleUtilities/MethodSwizzler (7.4.1):
28 | - GoogleUtilities/Logger
29 | - GoogleUtilities/Network (7.4.1):
30 | - GoogleUtilities/Logger
31 | - "GoogleUtilities/NSData+zlib"
32 | - GoogleUtilities/Reachability
33 | - "GoogleUtilities/NSData+zlib (7.4.1)"
34 | - GoogleUtilities/Reachability (7.4.1):
35 | - GoogleUtilities/Logger
36 | - Keys (1.0.1)
37 | - nanopb (2.30908.0):
38 | - nanopb/decode (= 2.30908.0)
39 | - nanopb/encode (= 2.30908.0)
40 | - nanopb/decode (2.30908.0)
41 | - nanopb/encode (2.30908.0)
42 | - PromisesObjC (1.2.12)
43 |
44 | DEPENDENCIES:
45 | - Google-Mobile-Ads-SDK (= 8.5.0)
46 | - Keys (from `Pods/CocoaPodsKeys`)
47 |
48 | SPEC REPOS:
49 | trunk:
50 | - Google-Mobile-Ads-SDK
51 | - GoogleAppMeasurement
52 | - GoogleUserMessagingPlatform
53 | - GoogleUtilities
54 | - nanopb
55 | - PromisesObjC
56 |
57 | EXTERNAL SOURCES:
58 | Keys:
59 | :path: Pods/CocoaPodsKeys
60 |
61 | SPEC CHECKSUMS:
62 | Google-Mobile-Ads-SDK: 6f5c41bf73db1656e5b203ba9c31e3d0899a128d
63 | GoogleAppMeasurement: 9ff7b9e23cced93a5a41736c09bdeb5b5b7fb111
64 | GoogleUserMessagingPlatform: ab890ce5f6620f293a21b6bdd82e416a2c73aeca
65 | GoogleUtilities: f8a43108b38a68eebe8b3540e1f4f2d28843ce20
66 | Keys: a576f4c9c1c641ca913a959a9c62ed3f215a8de9
67 | nanopb: a0ba3315591a9ae0a16a309ee504766e90db0c96
68 | PromisesObjC: 3113f7f76903778cf4a0586bd1ab89329a0b7b97
69 |
70 | PODFILE CHECKSUM: 7009013e8164cac21ecb439b4e6cac846f133a56
71 |
72 | COCOAPODS: 1.10.1
73 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # LongWeekend-iOS
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 | ## Overview
27 | 🏖 LongWeekend is iOS Application that supports checking long weekends when taking a vacation in Japan
28 | Developed using SwiftUI and Combine
29 |
30 | ## Download
31 |
32 |
33 |
34 |
35 | ## Requirements
36 | - Swift5 or greater
37 | - Xcode12.5 or greater
38 | - [XcodeGen](https://github.com/yonaskolb/XcodeGen) 2.23.1 or greater
39 |
40 | ## Getting Start
41 | 1. If you haven't installed xcodegen yet, please install [XcodeGen](https://github.com/yonaskolb/XcodeGen)
42 | 2. Run this command
43 | ```
44 | make bootstrap
45 | ```
46 | 3. Open `LongWeekend.xcworkspace`
47 |
48 | ## GIF
49 |
50 |
51 | ## Usage
52 | 1. Tap setting button
53 | 2. Set date, segment, etc.
54 | 3. Tap save button
55 | 4. Back list view
56 | 5. 🏖
57 |
58 |
59 | ## Screenshot
60 | ### JP
61 |
62 | Main|Setting
63 | :-:|:-:
64 |
|
65 |
66 | ### EN
67 |
68 | Main|Setting
69 | :-:|:-:
70 |
|
71 |
72 | ### Appearance
73 | Light|Dark
74 | :-:|:-:
75 |
|
76 |
77 | ## Contact
78 | If you discover problem or have opinions, please let me know through Github issues💁♂️
79 |
80 | ## Author
81 | funzin
82 | - mail: nakazawa.fumito@gmail.com
83 | - twitter: [@_funzin](https://twitter.com/_funzin)
84 |
85 | ## License
86 | LongWeekend is available under the MIT license. See the [LICENSE](LICENSE.md) file for more info.
87 |
--------------------------------------------------------------------------------
/Resource/Design/banner.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/funzin/LongWeekend-iOS/645d3955a82ae234a0449a542be1074672c4c777/Resource/Design/banner.png
--------------------------------------------------------------------------------
/Resource/Design/design.sketch:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/funzin/LongWeekend-iOS/645d3955a82ae234a0449a542be1074672c4c777/Resource/Design/design.sketch
--------------------------------------------------------------------------------
/Resource/Design/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/funzin/LongWeekend-iOS/645d3955a82ae234a0449a542be1074672c4c777/Resource/Design/icon.png
--------------------------------------------------------------------------------
/Resource/GIF/demo.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/funzin/LongWeekend-iOS/645d3955a82ae234a0449a542be1074672c4c777/Resource/GIF/demo.gif
--------------------------------------------------------------------------------
/Resource/Image/darkmode/en/main.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/funzin/LongWeekend-iOS/645d3955a82ae234a0449a542be1074672c4c777/Resource/Image/darkmode/en/main.png
--------------------------------------------------------------------------------
/Resource/Image/darkmode/en/setting.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/funzin/LongWeekend-iOS/645d3955a82ae234a0449a542be1074672c4c777/Resource/Image/darkmode/en/setting.png
--------------------------------------------------------------------------------
/Resource/Image/darkmode/jp/main.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/funzin/LongWeekend-iOS/645d3955a82ae234a0449a542be1074672c4c777/Resource/Image/darkmode/jp/main.png
--------------------------------------------------------------------------------
/Resource/Image/darkmode/jp/setting.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/funzin/LongWeekend-iOS/645d3955a82ae234a0449a542be1074672c4c777/Resource/Image/darkmode/jp/setting.png
--------------------------------------------------------------------------------
/Resource/Image/default/en/main.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/funzin/LongWeekend-iOS/645d3955a82ae234a0449a542be1074672c4c777/Resource/Image/default/en/main.png
--------------------------------------------------------------------------------
/Resource/Image/default/en/setting.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/funzin/LongWeekend-iOS/645d3955a82ae234a0449a542be1074672c4c777/Resource/Image/default/en/setting.png
--------------------------------------------------------------------------------
/Resource/Image/default/jp/main.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/funzin/LongWeekend-iOS/645d3955a82ae234a0449a542be1074672c4c777/Resource/Image/default/jp/main.png
--------------------------------------------------------------------------------
/Resource/Image/default/jp/setting.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/funzin/LongWeekend-iOS/645d3955a82ae234a0449a542be1074672c4c777/Resource/Image/default/jp/setting.png
--------------------------------------------------------------------------------
/codecov.yml:
--------------------------------------------------------------------------------
1 | comment:
2 | behavior: new
3 |
--------------------------------------------------------------------------------
/fastlane/Fastfile:
--------------------------------------------------------------------------------
1 | default_platform(:ios)
2 |
3 | platform :ios do
4 | desc "Upload appstore after test"
5 | lane :release_after_test do
6 | scan
7 | release
8 | end
9 |
10 | desc "Upload appstore"
11 | lane :release do
12 | increment_build_number
13 | build_app()
14 | upload_to_app_store(force: true)
15 | end
16 | end
17 |
18 |
--------------------------------------------------------------------------------
/project.yml:
--------------------------------------------------------------------------------
1 | name: LongWeekend
2 | options:
3 | bundleIdPrefix: com.funzin
4 | minimumXcodeGenVersion: 2.23.1
5 | postGenCommand: make install-pod
6 | deploymentTarget:
7 | iOS: 13.0
8 | packages:
9 | SwiftyUserDefaults:
10 | url: https://github.com/sunshinejr/SwiftyUserDefaults
11 | version: 5.3.0
12 | HolidayJp:
13 | url: https://github.com/funzin/holiday_jp-swift
14 | branch: remove-unused-date
15 | Firebase:
16 | url: https://github.com/firebase/firebase-ios-sdk
17 | version: 8.0.0
18 | targets:
19 | LongWeekend:
20 | type: application
21 | platform: iOS
22 | sources: [LongWeekend]
23 | dependencies:
24 | - sdk: AppTrackingTransparency.framework
25 | weak: true
26 | - package: HolidayJp
27 | - package: SwiftyUserDefaults
28 | - package: Firebase
29 | product: FirebaseAnalytics
30 | settings:
31 | base:
32 | PRODUCT_BUNDLE_IDENTIFIER: com.funzin.longweekend
33 | MARKETING_VERSION: 2.0.0
34 | EXCLUDED_ARCHS[sdk=iphonesimulator*]: arm64
35 | CURRENT_PROJECT_VERSION: 1
36 | VERSIONING_SYSTEM: apple-generic
37 | INFOPLIST_FILE: LongWeekend/Resource/Info.plist
38 | CODE_SIGN_STYLE: Manual
39 | INFOPLIST_PREPROCESS: YES
40 | prebuildScripts:
41 | - name: Run swiftformat
42 | script: make swiftformat
43 | - name: Run LicensPlist
44 | script: |
45 | if [ $CONFIGURATION = "Debug" ]; then
46 | make license-plist
47 | fi
48 | - name: Configure Admob
49 | script: |
50 | plistBuddy="/usr/libexec/PlistBuddy"
51 | Resource="${SRCROOT}/LongWeekend/Resource/"
52 | infoPlistFileDestination="${TEMP_DIR}/Preprocessed-Info.plist"
53 |
54 | envPath="${SRCROOT}/.env"
55 | if [ -e $envPath ]; then
56 | . $envPath
57 | identifier=${GAD_APPLICATION_ID}
58 | echo ${infoPlistFileDestination}
59 | echo ${identifier}
60 | $plistBuddy -c "Set :GADApplicationIdentifier ${identifier}" ${infoPlistFileDestination}
61 | fi
62 | postbuildScripts:
63 | - name: Run SwiftLint
64 | script: make swiftlint
65 | scheme:
66 | gatherCoverageData: true
67 | testTargets:
68 | - LongWeekendTests
69 | LongWeekendTests:
70 | type: bundle.unit-test
71 | platform: iOS
72 | sources: [LongWeekendTests]
73 | dependencies:
74 | - target: LongWeekend
75 |
--------------------------------------------------------------------------------
/renovate.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": [
3 | "config:base"
4 | ]
5 | }
6 |
--------------------------------------------------------------------------------
/swiftgen.yml:
--------------------------------------------------------------------------------
1 | strings:
2 | inputs:
3 | - LongWeekend/Resource/Localizable/en.lproj/Localizable.strings
4 | outputs:
5 | - templatePath: ./CLI/_swiftgen/.build/checkouts/SwiftGen/templates/strings/structured-swift5.stencil
6 | output: LongWeekend/Source/Generated/Strings.swift
7 |
--------------------------------------------------------------------------------