diff --git a/.DS_Store b/.DS_Store index 1913c97..0edc174 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/.DS_Store.orig b/.DS_Store.orig deleted file mode 100644 index e4b4857..0000000 Binary files a/.DS_Store.orig and /dev/null differ diff --git a/.github/workflows/cdBeta.yml b/.github/workflows/cdBeta.yml index 71dfd78..54d5462 100644 --- a/.github/workflows/cdBeta.yml +++ b/.github/workflows/cdBeta.yml @@ -51,6 +51,12 @@ jobs: path: SourcePackages key: ${{ runner.os }}-spm-${{ hashFiles('*.xcodeproj/project.xcworkspace/ xcshareddata/swiftpm/Package.resolved') }} restore-keys: ${{ runner.os }}-spm- + + # GoogleService-Info.plistの復元 + - name: Decode GoogleService-Info.plist + run: | + echo ${{ secrets.GOOGLE_SERVICE_INFO_PLIST_CONTENT }} | base64 -o ${{ env.GOOGLE_SERVICE_INFO_PLIST_PATH }} -D + # TestFlight用にデプロイ - name: deploy run: set -o pipefail && diff --git a/.github/workflows/cdRelease.yml b/.github/workflows/cdRelease.yml index aa8459f..32cdc3e 100644 --- a/.github/workflows/cdRelease.yml +++ b/.github/workflows/cdRelease.yml @@ -51,6 +51,12 @@ jobs: path: SourcePackages key: ${{ runner.os }}-spm-${{ hashFiles('*.xcodeproj/project.xcworkspace/ xcshareddata/swiftpm/Package.resolved') }} restore-keys: ${{ runner.os }}-spm- + + # GoogleService-Info.plistの復元 + - name: Decode GoogleService-Info.plist + run: | + echo ${{ secrets.GOOGLE_SERVICE_INFO_PLIST_CONTENT }} | base64 -o ${{ env.GOOGLE_SERVICE_INFO_PLIST_PATH }} -D + # TestFlight用にデプロイ - name: deploy run: set -o pipefail && diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2a82af6..7239900 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,8 +2,6 @@ name: CI_Time_Watcher on: pull_request: - branches: - - "*" workflow_dispatch: env: @@ -11,6 +9,7 @@ env: WORKSPACE_PATH: TimerWatcherWorkspace.xcworkspace TARGET_SCHEME_NAME: TimeWatcher TARGET_TEST_PLAN_NAME: TimeWatcher + GOOGLE_SERVICE_INFO_PLIST_PATH: TimeWatcherPrj/TimeWatcher/GoogleService-Info.plist jobs: build: @@ -25,6 +24,10 @@ jobs: - name: Show Xcode list run: ls /Applications | grep 'Xcode' + # Xcodeのバージョン指定 + - name: Select Xcode version + run: sudo xcode-select -s ${{ env.DEVELOPER_DIR }} + # Xcodeのバージョン出力 - name: Show Xcode version run: xcodebuild -version @@ -51,6 +54,12 @@ jobs: path: SourcePackages key: ${{ runner.os }}-spm-${{ hashFiles('*.xcodeproj/project.xcworkspace/ xcshareddata/swiftpm/Package.resolved') }} restore-keys: ${{ runner.os }}-spm- + + # GoogleService-Info.plistの復元 + - name: Decode GoogleService-Info.plist + run: | + echo ${{ secrets.GOOGLE_SERVICE_INFO_PLIST_CONTENT }} | base64 -o ${{ env.GOOGLE_SERVICE_INFO_PLIST_PATH }} -D + # ビルド - name: Xcode virify run: set -o pipefail && diff --git a/.gitignore b/.gitignore index 594d660..de2e9f1 100644 --- a/.gitignore +++ b/.gitignore @@ -62,8 +62,11 @@ fastlane/Preview.html fastlane/test_output fastlane/screenshots.html +# firebase +GoogleService-Info.plist + # secret files secret/* .env* !.env.skel -GoogleService-Info*.plist \ No newline at end of file + diff --git a/TimeWatcherPrj/.DS_Store b/TimeWatcherPrj/.DS_Store index ad17bb2..25f4b7d 100644 Binary files a/TimeWatcherPrj/.DS_Store and b/TimeWatcherPrj/.DS_Store differ diff --git a/TimeWatcherPrj/.DS_Store.orig b/TimeWatcherPrj/.DS_Store.orig deleted file mode 100644 index 2b0ff0b..0000000 Binary files a/TimeWatcherPrj/.DS_Store.orig and /dev/null differ diff --git a/TimeWatcherPrj/TimeWatcher.xcodeproj/project.pbxproj b/TimeWatcherPrj/TimeWatcher.xcodeproj/project.pbxproj index 7ea52dd..641a619 100644 --- a/TimeWatcherPrj/TimeWatcher.xcodeproj/project.pbxproj +++ b/TimeWatcherPrj/TimeWatcher.xcodeproj/project.pbxproj @@ -37,6 +37,10 @@ BC4B66312C955C40004C3EEF /* TimeWatcherWidgetLiveActivity.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC057EC32C94758F0030C275 /* TimeWatcherWidgetLiveActivity.swift */; }; BC4B66332C959A72004C3EEF /* TimeInterval+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC4B66322C959A72004C3EEF /* TimeInterval+Extension.swift */; }; BC4B66352C95AF0F004C3EEF /* Calendar+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC4B66342C95AF0E004C3EEF /* Calendar+Extension.swift */; }; + BC521DF02CB11D1A002B0D73 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = BC521DEF2CB11D1A002B0D73 /* GoogleService-Info.plist */; }; + BC521DF12CB11D1A002B0D73 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = BC521DEF2CB11D1A002B0D73 /* GoogleService-Info.plist */; }; + BC521DF22CB11D1A002B0D73 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = BC521DEF2CB11D1A002B0D73 /* GoogleService-Info.plist */; }; + BC521DF32CB11D1A002B0D73 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = BC521DEF2CB11D1A002B0D73 /* GoogleService-Info.plist */; }; BC57C0CE2C96A0E300786503 /* LiveActivityManagerMock.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC57C0C42C969AF300786503 /* LiveActivityManagerMock.swift */; }; BC57C0D02C96A16000786503 /* LiveActivityManaging.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC57C0CF2C96A16000786503 /* LiveActivityManaging.swift */; }; BC57C0D32C990DFE00786503 /* TimerStartIntent.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC57C0D22C990DFE00786503 /* TimerStartIntent.swift */; }; @@ -65,11 +69,12 @@ BC5D47072C947C8400C52820 /* TimerStatus.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC3FCD922C91429900F3AC29 /* TimerStatus.swift */; }; BC5D47082C947D8200C52820 /* TimerActionType.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC3FCD942C9142BF00F3AC29 /* TimerActionType.swift */; }; BC5D47092C947E4B00C52820 /* ResourceAdapt.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC3FCD9E2C914E2900F3AC29 /* ResourceAdapt.swift */; }; - BC6E15B52C9AF32F00D518AF /* (null) in Resources */ = {isa = PBXBuildFile; }; + BC6332F72C9BF8BC004FE8EC /* FirebaseAnalytics in Frameworks */ = {isa = PBXBuildFile; productRef = BC6332F62C9BF8BC004FE8EC /* FirebaseAnalytics */; }; BCB5B59E2C9529D700DB3D79 /* TimerClockAnimationView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BCB5B59D2C9529D700DB3D79 /* TimerClockAnimationView.swift */; }; BCB5B59F2C952A7200DB3D79 /* TimerClockAnimationView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BCB5B59D2C9529D700DB3D79 /* TimerClockAnimationView.swift */; }; BCCB029A2CA53D190064BA7F /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = BCCB02992CA53D190064BA7F /* PrivacyInfo.xcprivacy */; }; BCCB029B2CA53D190064BA7F /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = BCCB02992CA53D190064BA7F /* PrivacyInfo.xcprivacy */; }; + BCEB52472CB12FE100B74486 /* FirebaseCrashlytics in Frameworks */ = {isa = PBXBuildFile; productRef = BCEB52462CB12FE100B74486 /* FirebaseCrashlytics */; }; BCF46B812C9D6EDB006BAEAF /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = BCF46B802C9D6EDB006BAEAF /* LaunchScreen.storyboard */; }; /* End PBXBuildFile section */ @@ -142,6 +147,7 @@ BC4B662F2C955B1B004C3EEF /* LiveActivityManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LiveActivityManager.swift; sourceTree = ""; }; BC4B66322C959A72004C3EEF /* TimeInterval+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "TimeInterval+Extension.swift"; sourceTree = ""; }; BC4B66342C95AF0E004C3EEF /* Calendar+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Calendar+Extension.swift"; sourceTree = ""; }; + BC521DEF2CB11D1A002B0D73 /* GoogleService-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = ""; }; BC57C0C42C969AF300786503 /* LiveActivityManagerMock.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LiveActivityManagerMock.swift; sourceTree = ""; }; BC57C0CF2C96A16000786503 /* LiveActivityManaging.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LiveActivityManaging.swift; sourceTree = ""; }; BC57C0D22C990DFE00786503 /* TimerStartIntent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimerStartIntent.swift; sourceTree = ""; }; @@ -175,6 +181,8 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + BCEB52472CB12FE100B74486 /* FirebaseCrashlytics in Frameworks */, + BC6332F72C9BF8BC004FE8EC /* FirebaseAnalytics in Frameworks */, BC3FCD9C2C914D9000F3AC29 /* TimeWatcherExternalResouce in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -251,6 +259,7 @@ BC3FCD632C913E2900F3AC29 /* TimeWatcher */ = { isa = PBXGroup; children = ( + BC521DEF2CB11D1A002B0D73 /* GoogleService-Info.plist */, BCC86A8F2CA3DF9800878442 /* Info.plist */, BC057EB42C92EDFC0030C275 /* Dependency */, BC3FCD9D2C914E0300F3AC29 /* Utility */, @@ -503,6 +512,7 @@ BC3FCD5E2C913E2900F3AC29 /* Frameworks */, BC3FCD5F2C913E2900F3AC29 /* Resources */, BC057ECD2C9475930030C275 /* Embed Foundation Extensions */, + BC6332F82C9BF9DD004FE8EC /* Run Script */, ); buildRules = ( ); @@ -512,6 +522,8 @@ name = TimeWatcher; packageProductDependencies = ( BC3FCD9B2C914D9000F3AC29 /* TimeWatcherExternalResouce */, + BC6332F62C9BF8BC004FE8EC /* FirebaseAnalytics */, + BCEB52462CB12FE100B74486 /* FirebaseCrashlytics */, ); productName = TimeWatcher; productReference = BC3FCD612C913E2900F3AC29 /* TimeWatcher.app */; @@ -590,6 +602,7 @@ mainGroup = BC3FCD582C913E2900F3AC29; packageReferences = ( BC3FCD992C914C6F00F3AC29 /* XCLocalSwiftPackageReference "../TimeWatcherExternalResouce" */, + BC6332F52C9BF8BC004FE8EC /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */, ); productRefGroup = BC3FCD622C913E2900F3AC29 /* Products */; projectDirPath = ""; @@ -610,6 +623,7 @@ files = ( BCCB029B2CA53D190064BA7F /* PrivacyInfo.xcprivacy in Resources */, BC057EC82C9475930030C275 /* Assets.xcassets in Resources */, + BC521DF22CB11D1A002B0D73 /* GoogleService-Info.plist in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -617,9 +631,9 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - BC6E15B52C9AF32F00D518AF /* (null) in Resources */, BC3FCDA12C91507900F3AC29 /* Asset.xcassets in Resources */, BCF46B812C9D6EDB006BAEAF /* LaunchScreen.storyboard in Resources */, + BC521DF32CB11D1A002B0D73 /* GoogleService-Info.plist in Resources */, BCCB029A2CA53D190064BA7F /* PrivacyInfo.xcprivacy in Resources */, BC3FCD6C2C913E2B00F3AC29 /* Preview Assets.xcassets in Resources */, ); @@ -629,6 +643,7 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + BC521DF12CB11D1A002B0D73 /* GoogleService-Info.plist in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -636,11 +651,39 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + BC521DF02CB11D1A002B0D73 /* GoogleService-Info.plist in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXResourcesBuildPhase section */ +/* Begin PBXShellScriptBuildPhase section */ + BC6332F82C9BF9DD004FE8EC /* Run Script */ = { + isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}", + "${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}/Contents/Resources/DWARF/${PRODUCT_NAME}", + "${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}/Contents/Info.plist", + "$(TARGET_BUILD_DIR)/$(UNLOCALIZED_RESOURCES_FOLDER_PATH)/GoogleService-Info.plist", + "$(TARGET_BUILD_DIR)/$(EXECUTABLE_PATH)", + ); + name = "Run Script"; + outputFileListPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "# Type a script or drag a script file from your workspace to insert its path.\nif (\"$CONFIGURATION\" == \"Release\") then\n\"${BUILD_DIR%/Build/*}/SourcePackages/checkouts/firebase-ios-sdk/Crashlytics/run\"\nfi\n"; + }; +/* End PBXShellScriptBuildPhase section */ + /* Begin PBXSourcesBuildPhase section */ BC057EB72C94758F0030C275 /* Sources */ = { isa = PBXSourcesBuildPhase; @@ -751,6 +794,7 @@ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Manual; CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEVELOPMENT_TEAM = ""; "DEVELOPMENT_TEAM[sdk=iphoneos*]" = 56LYVN6DMF; GENERATE_INFOPLIST_FILE = YES; @@ -765,6 +809,7 @@ "@executable_path/../../Frameworks", ); MARKETING_VERSION = 1.0.0; + OTHER_LDFLAGS = "-ObjC"; PRODUCT_BUNDLE_IDENTIFIER = taichi.satou.TimeWatcher.TimeWatcherWidget; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -803,6 +848,7 @@ "@executable_path/../../Frameworks", ); MARKETING_VERSION = 1.0.0; + OTHER_LDFLAGS = "-ObjC"; PRODUCT_BUNDLE_IDENTIFIER = taichi.satou.TimeWatcher.TimeWatcherWidget; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -951,10 +997,12 @@ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Manual; CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEVELOPMENT_ASSET_PATHS = "\"TimeWatcher/Preview Content\""; DEVELOPMENT_TEAM = ""; "DEVELOPMENT_TEAM[sdk=iphoneos*]" = 56LYVN6DMF; ENABLE_PREVIEWS = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = TimeWatcher/Info.plist; INFOPLIST_KEY_CFBundleDisplayName = TimeWatcher; @@ -972,6 +1020,7 @@ "@executable_path/Frameworks", ); MARKETING_VERSION = 1.0.0; + OTHER_LDFLAGS = "-ObjC"; PRODUCT_BUNDLE_IDENTIFIER = taichi.satou.TimeWatcher; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -1000,6 +1049,7 @@ DEVELOPMENT_TEAM = ""; "DEVELOPMENT_TEAM[sdk=iphoneos*]" = 56LYVN6DMF; ENABLE_PREVIEWS = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = TimeWatcher/Info.plist; INFOPLIST_KEY_CFBundleDisplayName = TimeWatcher; @@ -1017,6 +1067,7 @@ "@executable_path/Frameworks", ); MARKETING_VERSION = 1.0.0; + OTHER_LDFLAGS = "-ObjC"; PRODUCT_BUNDLE_IDENTIFIER = taichi.satou.TimeWatcher; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -1163,6 +1214,17 @@ }; /* End XCLocalSwiftPackageReference section */ +/* Begin XCRemoteSwiftPackageReference section */ + BC6332F52C9BF8BC004FE8EC /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */ = { + isa = XCRemoteSwiftPackageReference; + repositoryURL = "https://github.com/firebase/firebase-ios-sdk.git"; + requirement = { + kind = exactVersion; + version = 11.2.0; + }; + }; +/* End XCRemoteSwiftPackageReference section */ + /* Begin XCSwiftPackageProductDependency section */ BC057ED12C9478AE0030C275 /* TimeWatcherExternalResouce */ = { isa = XCSwiftPackageProductDependency; @@ -1172,6 +1234,16 @@ isa = XCSwiftPackageProductDependency; productName = TimeWatcherExternalResouce; }; + BC6332F62C9BF8BC004FE8EC /* FirebaseAnalytics */ = { + isa = XCSwiftPackageProductDependency; + package = BC6332F52C9BF8BC004FE8EC /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */; + productName = FirebaseAnalytics; + }; + BCEB52462CB12FE100B74486 /* FirebaseCrashlytics */ = { + isa = XCSwiftPackageProductDependency; + package = BC6332F52C9BF8BC004FE8EC /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */; + productName = FirebaseCrashlytics; + }; /* End XCSwiftPackageProductDependency section */ }; rootObject = BC3FCD592C913E2900F3AC29 /* Project object */; diff --git a/TimeWatcherPrj/TimeWatcher/.DS_Store b/TimeWatcherPrj/TimeWatcher/.DS_Store index 0d6bceb..b9f7956 100644 Binary files a/TimeWatcherPrj/TimeWatcher/.DS_Store and b/TimeWatcherPrj/TimeWatcher/.DS_Store differ diff --git a/TimeWatcherPrj/TimeWatcher/View/RootView/TimeWatcherApp.swift b/TimeWatcherPrj/TimeWatcher/View/RootView/TimeWatcherApp.swift index c47b0b8..cb51013 100644 --- a/TimeWatcherPrj/TimeWatcher/View/RootView/TimeWatcherApp.swift +++ b/TimeWatcherPrj/TimeWatcher/View/RootView/TimeWatcherApp.swift @@ -6,9 +6,17 @@ // import SwiftUI +import FirebaseCore class AppDelegate: NSObject, UIApplicationDelegate { + func application(_ application: UIApplication, + didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool { + + FirebaseApp.configure() + return true + } + func applicationWillTerminate(_ application: UIApplication) { logger.info("[In]") diff --git a/TimeWatcherPrj/TimeWatcherWidget/Intent/TimerResetIntent.swift b/TimeWatcherPrj/TimeWatcherWidget/Intent/TimerResetIntent.swift new file mode 100644 index 0000000..e9060cc --- /dev/null +++ b/TimeWatcherPrj/TimeWatcherWidget/Intent/TimerResetIntent.swift @@ -0,0 +1,44 @@ +// +// TimerResetIntent.swift +// TimeWatcherWidgetExtension +// +// Created by 佐藤汰一 on 2024/09/17. +// + +import AppIntents + +struct TimerResetIntent: AppIntent { + + static var title: LocalizedStringResource = "Reset" + + private var token: String? + private(set) var timeWatch: TimeWatch + private let liveActivityManager: LiveActivityManaging + + @preconcurrency + @MainActor + init() { + + self.timeWatch = TimeWatch.shared + self.liveActivityManager = LiveActivityManager() + } + + @MainActor + init(token: String, + timeWatch: TimeWatch? = nil, + liveActivityManager: LiveActivityManaging = LiveActivityManager()) { + + self.token = token + self.timeWatch = timeWatch ?? TimeWatch.shared + self.liveActivityManager = liveActivityManager + } + + @MainActor + func perform() async throws -> some IntentResult { + + timeWatch.resetTimer() + try await liveActivityManager.stop() + return .result() + } +} +