diff --git a/firka/ios/Runner.xcodeproj/project.pbxproj b/firka/ios/Runner.xcodeproj/project.pbxproj index 2e9b5d3..90c453a 100644 --- a/firka/ios/Runner.xcodeproj/project.pbxproj +++ b/firka/ios/Runner.xcodeproj/project.pbxproj @@ -29,6 +29,16 @@ /* End PBXContainerItemProxy section */ /* Begin PBXCopyFilesBuildPhase section */ + 4F729CA12E679272007B3CAB /* Embed Foundation Extensions */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 13; + files = ( + ); + name = "Embed Foundation Extensions"; + runOnlyForDeploymentPostprocessing = 0; + }; 9705A1C41CF9048500538489 /* Embed Frameworks */ = { isa = PBXCopyFilesBuildPhase; buildActionMask = 2147483647; @@ -49,6 +59,8 @@ 331C8081294A63A400263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 35FC12231D1EB3D0C7953F84 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; + 4F729C902E679271007B3CAB /* WidgetKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WidgetKit.framework; path = System/Library/Frameworks/WidgetKit.framework; sourceTree = SDKROOT; }; + 4F729C922E679271007B3CAB /* SwiftUI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SwiftUI.framework; path = System/Library/Frameworks/SwiftUI.framework; sourceTree = SDKROOT; }; 5108E7049D0F6FBE9DD96E87 /* Pods-RunnerTests.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.profile.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.profile.xcconfig"; sourceTree = ""; }; 63807E9073E827462686DCBD /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; @@ -100,6 +112,8 @@ children = ( 63807E9073E827462686DCBD /* Pods_Runner.framework */, F71992E9D9AC80BD4E835DFC /* Pods_RunnerTests.framework */, + 4F729C902E679271007B3CAB /* WidgetKit.framework */, + 4F729C922E679271007B3CAB /* SwiftUI.framework */, ); name = Frameworks; sourceTree = ""; @@ -161,7 +175,6 @@ 32CF6A1D3F3C30CEA5BAB2A7 /* Pods-RunnerTests.release.xcconfig */, 5108E7049D0F6FBE9DD96E87 /* Pods-RunnerTests.profile.xcconfig */, ); - name = Pods; path = Pods; sourceTree = ""; }; @@ -197,9 +210,10 @@ 97C146EB1CF9000F007C117D /* Frameworks */, 97C146EC1CF9000F007C117D /* Resources */, 9705A1C41CF9048500538489 /* Embed Frameworks */, - 3B06AD1E1E4923F5004D2608 /* Thin Binary */, - F18DAB10D6EBA0BBEDA7E44C /* [CP] Embed Pods Frameworks */, 7008B6ED94E4D181FA580584 /* [CP] Copy Pods Resources */, + F18DAB10D6EBA0BBEDA7E44C /* [CP] Embed Pods Frameworks */, + 3B06AD1E1E4923F5004D2608 /* Thin Binary */, + 4F729CA12E679272007B3CAB /* Embed Foundation Extensions */, ); buildRules = ( ); @@ -217,6 +231,7 @@ isa = PBXProject; attributes = { BuildIndependentTargetsInParallel = YES; + LastSwiftUpdateCheck = 1640; LastUpgradeCheck = 1510; ORGANIZATIONNAME = ""; TargetAttributes = { @@ -317,10 +332,14 @@ inputFileListPaths = ( "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-input-files.xcfilelist", ); + inputPaths = ( + ); name = "[CP] Copy Pods Resources"; outputFileListPaths = ( "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-output-files.xcfilelist", ); + outputPaths = ( + ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n"; @@ -371,10 +390,14 @@ inputFileListPaths = ( "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", ); + inputPaths = ( + ); name = "[CP] Embed Pods Frameworks"; outputFileListPaths = ( "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", ); + outputPaths = ( + ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; @@ -494,6 +517,7 @@ INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_KEY_CFBundleDisplayName = Firka; INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.education"; + IPHONEOS_DEPLOYMENT_TARGET = 17.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -516,6 +540,7 @@ CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_TEAM = R9PZGUCNJ3; GENERATE_INFOPLIST_FILE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 17.0; MARKETING_VERSION = 1.0; PRODUCT_BUNDLE_IDENTIFIER = app.firka.firka.RunnerTests; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -535,6 +560,7 @@ CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_TEAM = R9PZGUCNJ3; GENERATE_INFOPLIST_FILE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 17.0; MARKETING_VERSION = 1.0; PRODUCT_BUNDLE_IDENTIFIER = app.firka.firka.RunnerTests; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -552,6 +578,7 @@ CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_TEAM = R9PZGUCNJ3; GENERATE_INFOPLIST_FILE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 17.0; MARKETING_VERSION = 1.0; PRODUCT_BUNDLE_IDENTIFIER = app.firka.firka.RunnerTests; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -683,6 +710,7 @@ INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_KEY_CFBundleDisplayName = Firka; INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.education"; + IPHONEOS_DEPLOYMENT_TARGET = 17.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -709,6 +737,7 @@ INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_KEY_CFBundleDisplayName = Firka; INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.education"; + IPHONEOS_DEPLOYMENT_TARGET = 17.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", diff --git a/firka/ios/Runner/LiveActivityManager.swift b/firka/ios/Runner/LiveActivityManager.swift new file mode 100644 index 0000000..96df573 --- /dev/null +++ b/firka/ios/Runner/LiveActivityManager.swift @@ -0,0 +1,48 @@ +import Foundation +import ActivityKit + +@available(iOS 16.1, *) +class LiveActivityManager { + static let shared = LiveActivityManager() + private init() {} + + func startActivity(id: String, title: String, progress: Int, emoji: String) -> String? { + let attributes = FirkaActivityAttributes(id: id) + let state = FirkaActivityAttributes.ContentState(title: title, progress: progress, emoji: emoji) + + do { + let activity = try Activity.request( + attributes: attributes, + contentState: state, + pushType: nil) + return activity.id + } catch (let error) { + print("Error starting activity: \(error.localizedDescription)") + return nil + } + } + + func updateActivity(id: String, title: String?, progress: Int?, emoji: String?) { + Task { + for activity in Activity.activities { + if activity.attributes.id == id { + var state = activity.contentState + if let title = title { state.title = title } + if let progress = progress { state.progress = progress } + if let emoji = emoji { state.emoji = emoji } + await activity.update(using: state) + } + } + } + } + + func endActivity(id: String) { + Task { + for activity in Activity.activities { + if activity.attributes.id == id { + await activity.end(dismissalPolicy: .immediate) + } + } + } + } +} \ No newline at end of file