diff --git a/GoogleMulticastAppDelegate.podspec b/GoogleMulticastAppDelegate.podspec new file mode 100644 index 00000000..e698a2e5 --- /dev/null +++ b/GoogleMulticastAppDelegate.podspec @@ -0,0 +1,72 @@ +Pod::Spec.new do |s| + # TODO: Is `GoogleMulticastAppDelegate` name fine? + s.name = 'GoogleMulticastAppDelegate' + s.version = '7.5.0' + s.summary = 'GoogleMulticastAppDelegate' + + s.description = <<-DESC + GoogleMulticastAppDelegate + DESC + + s.homepage = 'https://github.com/google/GoogleUtilities' + s.license = { :type => 'Apache', :file => 'LICENSE' } + s.authors = 'Google, Inc.' + + s.source = { + :git => 'https://github.com/google/GoogleUtilities.git', + :tag => 'MulticastAppDelegate-' + s.version.to_s + } + + ios_deployment_target = '9.0' + osx_deployment_target = '10.12' + tvos_deployment_target = '10.0' + watchos_deployment_target = '6.0' + + s.ios.deployment_target = ios_deployment_target + # s.osx.deployment_target = osx_deployment_target + # s.tvos.deployment_target = tvos_deployment_target + # s.watchos.deployment_target = watchos_deployment_target + + s.swift_versions = ['5.0', '5.2'] + + s.cocoapods_version = '>= 1.4.0' + s.prefix_header_file = false + + s.pod_target_xcconfig = { + 'GCC_C_LANGUAGE_STANDARD' => 'c99', + 'HEADER_SEARCH_PATHS' => '"${PODS_TARGET_SRCROOT}"', + } + + base_dir = "GoogleMulticastAppDelegate/" + s.source_files = [ + base_dir + 'Sources/**/*.swift', + ] + + # s.test_spec 'unit' do |unit_tests| + # unit_tests.scheme = { :code_coverage => true } + # unit_tests.platforms = { + # :ios => ios_deployment_target, + # :osx => osx_deployment_target, + # :tvos => tvos_deployment_target + # } + # unit_tests.source_files = [ + # base_dir + 'Tests/Unit/**/*.[mh]', + # ] + # unit_tests.requires_app_host = true + # unit_tests.dependency 'OCMock' + # end + + # s.test_spec 'unit-swift' do |unit_tests_swift| + # unit_tests_swift.scheme = { :code_coverage => true } + # unit_tests_swift.platforms = { + # :ios => ios_deployment_target, + # :osx => osx_deployment_target, + # :tvos => tvos_deployment_target + # } + # unit_tests_swift.source_files = [ + # base_dir + 'Tests/Unit/**/*.swift', + # ] + + # unit_tests_swift.requires_app_host = true + # end +end diff --git a/GoogleMulticastAppDelegate/Apps/AppDelegateSample/AppDelegateSample.xcodeproj/project.pbxproj b/GoogleMulticastAppDelegate/Apps/AppDelegateSample/AppDelegateSample.xcodeproj/project.pbxproj new file mode 100644 index 00000000..3ae76a2d --- /dev/null +++ b/GoogleMulticastAppDelegate/Apps/AppDelegateSample/AppDelegateSample.xcodeproj/project.pbxproj @@ -0,0 +1,594 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 51; + objects = { + +/* Begin PBXBuildFile section */ + 0E3536E73AC7531C0781E543 /* Pods_AppDelegateSample.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EBFC65FD063BF93267C9B957 /* Pods_AppDelegateSample.framework */; }; + 6E084AE3778AAE4EBF48930C /* Pods_SwiftUI_iOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F504297D39756043ED4C7A12 /* Pods_SwiftUI_iOS.framework */; }; + 9A2090D125E451B800A2E7D1 /* SwiftUI_iOSApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A2090D025E451B800A2E7D1 /* SwiftUI_iOSApp.swift */; }; + 9A2090D325E451B800A2E7D1 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A2090D225E451B800A2E7D1 /* ContentView.swift */; }; + 9A2090D525E451B900A2E7D1 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 9A2090D425E451B900A2E7D1 /* Assets.xcassets */; }; + 9A2090D825E451B900A2E7D1 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 9A2090D725E451B900A2E7D1 /* Preview Assets.xcassets */; }; + 9AF8E6C025C35F800084E9E2 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9AF8E6BF25C35F800084E9E2 /* AppDelegate.swift */; }; + 9AF8E6C225C35F800084E9E2 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9AF8E6C125C35F800084E9E2 /* SceneDelegate.swift */; }; + 9AF8E6C425C35F800084E9E2 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9AF8E6C325C35F800084E9E2 /* ViewController.swift */; }; + 9AF8E6C725C35F800084E9E2 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9AF8E6C525C35F800084E9E2 /* Main.storyboard */; }; + 9AF8E6C925C35F830084E9E2 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 9AF8E6C825C35F830084E9E2 /* Assets.xcassets */; }; + 9AF8E6CC25C35F830084E9E2 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9AF8E6CA25C35F830084E9E2 /* LaunchScreen.storyboard */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 9A2090CE25E451B800A2E7D1 /* SwiftUI-iOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "SwiftUI-iOS.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + 9A2090D025E451B800A2E7D1 /* SwiftUI_iOSApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwiftUI_iOSApp.swift; sourceTree = ""; }; + 9A2090D225E451B800A2E7D1 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; + 9A2090D425E451B900A2E7D1 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 9A2090D725E451B900A2E7D1 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; + 9A2090D925E451B900A2E7D1 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 9AF8E6BC25C35F800084E9E2 /* AppDelegateSample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = AppDelegateSample.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 9AF8E6BF25C35F800084E9E2 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 9AF8E6C125C35F800084E9E2 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; + 9AF8E6C325C35F800084E9E2 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; + 9AF8E6C625C35F800084E9E2 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 9AF8E6C825C35F830084E9E2 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 9AF8E6CB25C35F830084E9E2 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 9AF8E6CD25C35F830084E9E2 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + BA05767CBCFA6A35F8E3DD64 /* Pods-SwiftUI-iOS.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SwiftUI-iOS.release.xcconfig"; path = "Target Support Files/Pods-SwiftUI-iOS/Pods-SwiftUI-iOS.release.xcconfig"; sourceTree = ""; }; + CF546BA22ECF73FD9F04FB80 /* Pods-AppDelegateSample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AppDelegateSample.debug.xcconfig"; path = "Target Support Files/Pods-AppDelegateSample/Pods-AppDelegateSample.debug.xcconfig"; sourceTree = ""; }; + EA77D7A3FC6896C7A2A93B7A /* Pods-SwiftUI-iOS.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SwiftUI-iOS.debug.xcconfig"; path = "Target Support Files/Pods-SwiftUI-iOS/Pods-SwiftUI-iOS.debug.xcconfig"; sourceTree = ""; }; + EBFC65FD063BF93267C9B957 /* Pods_AppDelegateSample.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_AppDelegateSample.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + F504297D39756043ED4C7A12 /* Pods_SwiftUI_iOS.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_SwiftUI_iOS.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + FD1D158F357E0539EE8E7E7D /* Pods-AppDelegateSample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AppDelegateSample.release.xcconfig"; path = "Target Support Files/Pods-AppDelegateSample/Pods-AppDelegateSample.release.xcconfig"; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 9A2090CB25E451B800A2E7D1 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 6E084AE3778AAE4EBF48930C /* Pods_SwiftUI_iOS.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 9AF8E6B925C35F800084E9E2 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 0E3536E73AC7531C0781E543 /* Pods_AppDelegateSample.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 0D9480B88DAD8B72D5244C37 /* Frameworks */ = { + isa = PBXGroup; + children = ( + EBFC65FD063BF93267C9B957 /* Pods_AppDelegateSample.framework */, + F504297D39756043ED4C7A12 /* Pods_SwiftUI_iOS.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + 80858BFCE9E0B612173E6EDA /* Pods */ = { + isa = PBXGroup; + children = ( + CF546BA22ECF73FD9F04FB80 /* Pods-AppDelegateSample.debug.xcconfig */, + FD1D158F357E0539EE8E7E7D /* Pods-AppDelegateSample.release.xcconfig */, + EA77D7A3FC6896C7A2A93B7A /* Pods-SwiftUI-iOS.debug.xcconfig */, + BA05767CBCFA6A35F8E3DD64 /* Pods-SwiftUI-iOS.release.xcconfig */, + ); + path = Pods; + sourceTree = ""; + }; + 9A2090CF25E451B800A2E7D1 /* SwiftUI-iOS */ = { + isa = PBXGroup; + children = ( + 9A2090D025E451B800A2E7D1 /* SwiftUI_iOSApp.swift */, + 9A2090D225E451B800A2E7D1 /* ContentView.swift */, + 9A2090D425E451B900A2E7D1 /* Assets.xcassets */, + 9A2090D925E451B900A2E7D1 /* Info.plist */, + 9A2090D625E451B900A2E7D1 /* Preview Content */, + ); + path = "SwiftUI-iOS"; + sourceTree = ""; + }; + 9A2090D625E451B900A2E7D1 /* Preview Content */ = { + isa = PBXGroup; + children = ( + 9A2090D725E451B900A2E7D1 /* Preview Assets.xcassets */, + ); + path = "Preview Content"; + sourceTree = ""; + }; + 9AF8E6B325C35F800084E9E2 = { + isa = PBXGroup; + children = ( + 9AF8E6BE25C35F800084E9E2 /* AppDelegateSample */, + 9A2090CF25E451B800A2E7D1 /* SwiftUI-iOS */, + 9AF8E6BD25C35F800084E9E2 /* Products */, + 80858BFCE9E0B612173E6EDA /* Pods */, + 0D9480B88DAD8B72D5244C37 /* Frameworks */, + ); + sourceTree = ""; + }; + 9AF8E6BD25C35F800084E9E2 /* Products */ = { + isa = PBXGroup; + children = ( + 9AF8E6BC25C35F800084E9E2 /* AppDelegateSample.app */, + 9A2090CE25E451B800A2E7D1 /* SwiftUI-iOS.app */, + ); + name = Products; + sourceTree = ""; + }; + 9AF8E6BE25C35F800084E9E2 /* AppDelegateSample */ = { + isa = PBXGroup; + children = ( + 9AF8E6BF25C35F800084E9E2 /* AppDelegate.swift */, + 9AF8E6C125C35F800084E9E2 /* SceneDelegate.swift */, + 9AF8E6C325C35F800084E9E2 /* ViewController.swift */, + 9AF8E6C525C35F800084E9E2 /* Main.storyboard */, + 9AF8E6C825C35F830084E9E2 /* Assets.xcassets */, + 9AF8E6CA25C35F830084E9E2 /* LaunchScreen.storyboard */, + 9AF8E6CD25C35F830084E9E2 /* Info.plist */, + ); + path = AppDelegateSample; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 9A2090CD25E451B800A2E7D1 /* SwiftUI-iOS */ = { + isa = PBXNativeTarget; + buildConfigurationList = 9A2090DC25E451B900A2E7D1 /* Build configuration list for PBXNativeTarget "SwiftUI-iOS" */; + buildPhases = ( + F0F6E6CAE5DCF214722D804D /* [CP] Check Pods Manifest.lock */, + 9A2090CA25E451B800A2E7D1 /* Sources */, + 9A2090CB25E451B800A2E7D1 /* Frameworks */, + 9A2090CC25E451B800A2E7D1 /* Resources */, + A5641932CD7FB26C434EE9C7 /* [CP] Embed Pods Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "SwiftUI-iOS"; + productName = "SwiftUI-iOS"; + productReference = 9A2090CE25E451B800A2E7D1 /* SwiftUI-iOS.app */; + productType = "com.apple.product-type.application"; + }; + 9AF8E6BB25C35F800084E9E2 /* AppDelegateSample */ = { + isa = PBXNativeTarget; + buildConfigurationList = 9AF8E6D025C35F830084E9E2 /* Build configuration list for PBXNativeTarget "AppDelegateSample" */; + buildPhases = ( + 5077B86BDDE805542F9F4853 /* [CP] Check Pods Manifest.lock */, + 9AF8E6B825C35F800084E9E2 /* Sources */, + 9AF8E6B925C35F800084E9E2 /* Frameworks */, + 9AF8E6BA25C35F800084E9E2 /* Resources */, + E3791509D629949AE08392A8 /* [CP] Embed Pods Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = AppDelegateSample; + productName = AppDelegateSample; + productReference = 9AF8E6BC25C35F800084E9E2 /* AppDelegateSample.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 9AF8E6B425C35F800084E9E2 /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 1230; + LastUpgradeCheck = 1230; + TargetAttributes = { + 9A2090CD25E451B800A2E7D1 = { + CreatedOnToolsVersion = 12.3; + }; + 9AF8E6BB25C35F800084E9E2 = { + CreatedOnToolsVersion = 12.3; + }; + }; + }; + buildConfigurationList = 9AF8E6B725C35F800084E9E2 /* Build configuration list for PBXProject "AppDelegateSample" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 9AF8E6B325C35F800084E9E2; + productRefGroup = 9AF8E6BD25C35F800084E9E2 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 9AF8E6BB25C35F800084E9E2 /* AppDelegateSample */, + 9A2090CD25E451B800A2E7D1 /* SwiftUI-iOS */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 9A2090CC25E451B800A2E7D1 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 9A2090D825E451B900A2E7D1 /* Preview Assets.xcassets in Resources */, + 9A2090D525E451B900A2E7D1 /* Assets.xcassets in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 9AF8E6BA25C35F800084E9E2 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 9AF8E6CC25C35F830084E9E2 /* LaunchScreen.storyboard in Resources */, + 9AF8E6C925C35F830084E9E2 /* Assets.xcassets in Resources */, + 9AF8E6C725C35F800084E9E2 /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 5077B86BDDE805542F9F4853 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-AppDelegateSample-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; + A5641932CD7FB26C434EE9C7 /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-SwiftUI-iOS/Pods-SwiftUI-iOS-frameworks-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Embed Pods Frameworks"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-SwiftUI-iOS/Pods-SwiftUI-iOS-frameworks-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-SwiftUI-iOS/Pods-SwiftUI-iOS-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; + E3791509D629949AE08392A8 /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-AppDelegateSample/Pods-AppDelegateSample-frameworks-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Embed Pods Frameworks"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-AppDelegateSample/Pods-AppDelegateSample-frameworks-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-AppDelegateSample/Pods-AppDelegateSample-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; + F0F6E6CAE5DCF214722D804D /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-SwiftUI-iOS-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 9A2090CA25E451B800A2E7D1 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 9A2090D325E451B800A2E7D1 /* ContentView.swift in Sources */, + 9A2090D125E451B800A2E7D1 /* SwiftUI_iOSApp.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 9AF8E6B825C35F800084E9E2 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 9AF8E6C425C35F800084E9E2 /* ViewController.swift in Sources */, + 9AF8E6C025C35F800084E9E2 /* AppDelegate.swift in Sources */, + 9AF8E6C225C35F800084E9E2 /* SceneDelegate.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + 9AF8E6C525C35F800084E9E2 /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 9AF8E6C625C35F800084E9E2 /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + 9AF8E6CA25C35F830084E9E2 /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 9AF8E6CB25C35F830084E9E2 /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 9A2090DA25E451B900A2E7D1 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = EA77D7A3FC6896C7A2A93B7A /* Pods-SwiftUI-iOS.debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_ASSET_PATHS = "\"SwiftUI-iOS/Preview Content\""; + ENABLE_PREVIEWS = YES; + INFOPLIST_FILE = "SwiftUI-iOS/Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 14.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = "firebase.google.com.SwiftUI-iOS"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 9A2090DB25E451B900A2E7D1 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = BA05767CBCFA6A35F8E3DD64 /* Pods-SwiftUI-iOS.release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_ASSET_PATHS = "\"SwiftUI-iOS/Preview Content\""; + ENABLE_PREVIEWS = YES; + INFOPLIST_FILE = "SwiftUI-iOS/Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 14.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = "firebase.google.com.SwiftUI-iOS"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; + 9AF8E6CE25C35F830084E9E2 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 14.3; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 9AF8E6CF25C35F830084E9E2 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 14.3; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 9AF8E6D125C35F830084E9E2 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = CF546BA22ECF73FD9F04FB80 /* Pods-AppDelegateSample.debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_STYLE = Automatic; + INFOPLIST_FILE = AppDelegateSample/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = firebase.google.com.AppDelegateSample; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 9AF8E6D225C35F830084E9E2 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = FD1D158F357E0539EE8E7E7D /* Pods-AppDelegateSample.release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_STYLE = Automatic; + INFOPLIST_FILE = AppDelegateSample/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = firebase.google.com.AppDelegateSample; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 9A2090DC25E451B900A2E7D1 /* Build configuration list for PBXNativeTarget "SwiftUI-iOS" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 9A2090DA25E451B900A2E7D1 /* Debug */, + 9A2090DB25E451B900A2E7D1 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 9AF8E6B725C35F800084E9E2 /* Build configuration list for PBXProject "AppDelegateSample" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 9AF8E6CE25C35F830084E9E2 /* Debug */, + 9AF8E6CF25C35F830084E9E2 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 9AF8E6D025C35F830084E9E2 /* Build configuration list for PBXNativeTarget "AppDelegateSample" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 9AF8E6D125C35F830084E9E2 /* Debug */, + 9AF8E6D225C35F830084E9E2 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 9AF8E6B425C35F800084E9E2 /* Project object */; +} diff --git a/GoogleMulticastAppDelegate/Apps/AppDelegateSample/AppDelegateSample/AppDelegate.swift b/GoogleMulticastAppDelegate/Apps/AppDelegateSample/AppDelegateSample/AppDelegate.swift new file mode 100644 index 00000000..96b46a44 --- /dev/null +++ b/GoogleMulticastAppDelegate/Apps/AppDelegateSample/AppDelegateSample/AppDelegate.swift @@ -0,0 +1,44 @@ +// +// AppDelegate.swift +// AppDelegateSample +// +// Created by Maksym Malyhin on 2021-01-28. +// + +import UIKit + +import GoogleUtilities + +@UIApplicationMain +class MulticastAppDelegate: GoogleUtilities.MulticastAppDelegate { + override init() { + super.init() + self.addInterceptor(AppDelegate()) + } +} + + +class AppDelegate: UIResponder, UIApplicationDelegate { + + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { + // Override point for customization after application launch. + return true + } + + // MARK: UISceneSession Lifecycle + + func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration { + // Called when a new scene session is being created. + // Use this method to select a configuration to create the new scene with. + return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role) + } + + func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set) { + // Called when the user discards a scene session. + // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions. + // Use this method to release any resources that were specific to the discarded scenes, as they will not return. + } + + +} + diff --git a/GoogleMulticastAppDelegate/Apps/AppDelegateSample/AppDelegateSample/Assets.xcassets/AccentColor.colorset/Contents.json b/GoogleMulticastAppDelegate/Apps/AppDelegateSample/AppDelegateSample/Assets.xcassets/AccentColor.colorset/Contents.json new file mode 100644 index 00000000..eb878970 --- /dev/null +++ b/GoogleMulticastAppDelegate/Apps/AppDelegateSample/AppDelegateSample/Assets.xcassets/AccentColor.colorset/Contents.json @@ -0,0 +1,11 @@ +{ + "colors" : [ + { + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/GoogleMulticastAppDelegate/Apps/AppDelegateSample/AppDelegateSample/Assets.xcassets/AppIcon.appiconset/Contents.json b/GoogleMulticastAppDelegate/Apps/AppDelegateSample/AppDelegateSample/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 00000000..9221b9bb --- /dev/null +++ b/GoogleMulticastAppDelegate/Apps/AppDelegateSample/AppDelegateSample/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,98 @@ +{ + "images" : [ + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "20x20" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "20x20" + }, + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "29x29" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "29x29" + }, + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "40x40" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "40x40" + }, + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "60x60" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "60x60" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "size" : "20x20" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "20x20" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "size" : "29x29" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "29x29" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "size" : "40x40" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "40x40" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "size" : "76x76" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "76x76" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "83.5x83.5" + }, + { + "idiom" : "ios-marketing", + "scale" : "1x", + "size" : "1024x1024" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/GoogleMulticastAppDelegate/Apps/AppDelegateSample/AppDelegateSample/Assets.xcassets/Contents.json b/GoogleMulticastAppDelegate/Apps/AppDelegateSample/AppDelegateSample/Assets.xcassets/Contents.json new file mode 100644 index 00000000..73c00596 --- /dev/null +++ b/GoogleMulticastAppDelegate/Apps/AppDelegateSample/AppDelegateSample/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/GoogleMulticastAppDelegate/Apps/AppDelegateSample/AppDelegateSample/Base.lproj/LaunchScreen.storyboard b/GoogleMulticastAppDelegate/Apps/AppDelegateSample/AppDelegateSample/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 00000000..865e9329 --- /dev/null +++ b/GoogleMulticastAppDelegate/Apps/AppDelegateSample/AppDelegateSample/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/GoogleMulticastAppDelegate/Apps/AppDelegateSample/AppDelegateSample/Base.lproj/Main.storyboard b/GoogleMulticastAppDelegate/Apps/AppDelegateSample/AppDelegateSample/Base.lproj/Main.storyboard new file mode 100644 index 00000000..25a76385 --- /dev/null +++ b/GoogleMulticastAppDelegate/Apps/AppDelegateSample/AppDelegateSample/Base.lproj/Main.storyboard @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/GoogleMulticastAppDelegate/Apps/AppDelegateSample/AppDelegateSample/Info.plist b/GoogleMulticastAppDelegate/Apps/AppDelegateSample/AppDelegateSample/Info.plist new file mode 100644 index 00000000..5b531f7b --- /dev/null +++ b/GoogleMulticastAppDelegate/Apps/AppDelegateSample/AppDelegateSample/Info.plist @@ -0,0 +1,66 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + $(PRODUCT_BUNDLE_PACKAGE_TYPE) + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + LSRequiresIPhoneOS + + UIApplicationSceneManifest + + UIApplicationSupportsMultipleScenes + + UISceneConfigurations + + UIWindowSceneSessionRoleApplication + + + UISceneConfigurationName + Default Configuration + UISceneDelegateClassName + $(PRODUCT_MODULE_NAME).SceneDelegate + UISceneStoryboardFile + Main + + + + + UIApplicationSupportsIndirectInputEvents + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/GoogleMulticastAppDelegate/Apps/AppDelegateSample/AppDelegateSample/SceneDelegate.swift b/GoogleMulticastAppDelegate/Apps/AppDelegateSample/AppDelegateSample/SceneDelegate.swift new file mode 100644 index 00000000..19f3e7d2 --- /dev/null +++ b/GoogleMulticastAppDelegate/Apps/AppDelegateSample/AppDelegateSample/SceneDelegate.swift @@ -0,0 +1,52 @@ +// +// SceneDelegate.swift +// AppDelegateSample +// +// Created by Maksym Malyhin on 2021-01-28. +// + +import UIKit + +class SceneDelegate: UIResponder, UIWindowSceneDelegate { + + var window: UIWindow? + + + func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { + // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`. + // If using a storyboard, the `window` property will automatically be initialized and attached to the scene. + // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead). + guard let _ = (scene as? UIWindowScene) else { return } + } + + func sceneDidDisconnect(_ scene: UIScene) { + // Called as the scene is being released by the system. + // This occurs shortly after the scene enters the background, or when its session is discarded. + // Release any resources associated with this scene that can be re-created the next time the scene connects. + // The scene may re-connect later, as its session was not necessarily discarded (see `application:didDiscardSceneSessions` instead). + } + + func sceneDidBecomeActive(_ scene: UIScene) { + // Called when the scene has moved from an inactive state to an active state. + // Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive. + } + + func sceneWillResignActive(_ scene: UIScene) { + // Called when the scene will move from an active state to an inactive state. + // This may occur due to temporary interruptions (ex. an incoming phone call). + } + + func sceneWillEnterForeground(_ scene: UIScene) { + // Called as the scene transitions from the background to the foreground. + // Use this method to undo the changes made on entering the background. + } + + func sceneDidEnterBackground(_ scene: UIScene) { + // Called as the scene transitions from the foreground to the background. + // Use this method to save data, release shared resources, and store enough scene-specific state information + // to restore the scene back to its current state. + } + + +} + diff --git a/GoogleMulticastAppDelegate/Apps/AppDelegateSample/AppDelegateSample/ViewController.swift b/GoogleMulticastAppDelegate/Apps/AppDelegateSample/AppDelegateSample/ViewController.swift new file mode 100644 index 00000000..d09b77ac --- /dev/null +++ b/GoogleMulticastAppDelegate/Apps/AppDelegateSample/AppDelegateSample/ViewController.swift @@ -0,0 +1,19 @@ +// +// ViewController.swift +// AppDelegateSample +// +// Created by Maksym Malyhin on 2021-01-28. +// + +import UIKit + +class ViewController: UIViewController { + + override func viewDidLoad() { + super.viewDidLoad() + // Do any additional setup after loading the view. + } + + +} + diff --git a/GoogleMulticastAppDelegate/Apps/AppDelegateSample/AppDelegateSample/main.swift b/GoogleMulticastAppDelegate/Apps/AppDelegateSample/AppDelegateSample/main.swift new file mode 100644 index 00000000..f946c149 --- /dev/null +++ b/GoogleMulticastAppDelegate/Apps/AppDelegateSample/AppDelegateSample/main.swift @@ -0,0 +1,11 @@ +// +// main.swift +// AppDelegateSample +// +// Created by Maksym Malyhin on 2021-01-28. +// + +import UIKit +import GoogleUtilities + +//UIApplicationMain(CommandLine.argc, CommandLine.unsafeArgv, nil, NSStringFromClass(MulticastAppDelegate.self)) diff --git a/GoogleMulticastAppDelegate/Apps/AppDelegateSample/Podfile b/GoogleMulticastAppDelegate/Apps/AppDelegateSample/Podfile new file mode 100644 index 00000000..eea09c7b --- /dev/null +++ b/GoogleMulticastAppDelegate/Apps/AppDelegateSample/Podfile @@ -0,0 +1,10 @@ + +use_frameworks! + +pod 'GoogleMulticastAppDelegate', :path=>'../../../' + +target 'AppDelegateSample' do +end + +target 'SwiftUI-iOS' do +end \ No newline at end of file diff --git a/GoogleMulticastAppDelegate/Apps/AppDelegateSample/SwiftUI-iOS/Assets.xcassets/AccentColor.colorset/Contents.json b/GoogleMulticastAppDelegate/Apps/AppDelegateSample/SwiftUI-iOS/Assets.xcassets/AccentColor.colorset/Contents.json new file mode 100644 index 00000000..eb878970 --- /dev/null +++ b/GoogleMulticastAppDelegate/Apps/AppDelegateSample/SwiftUI-iOS/Assets.xcassets/AccentColor.colorset/Contents.json @@ -0,0 +1,11 @@ +{ + "colors" : [ + { + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/GoogleMulticastAppDelegate/Apps/AppDelegateSample/SwiftUI-iOS/Assets.xcassets/AppIcon.appiconset/Contents.json b/GoogleMulticastAppDelegate/Apps/AppDelegateSample/SwiftUI-iOS/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 00000000..9221b9bb --- /dev/null +++ b/GoogleMulticastAppDelegate/Apps/AppDelegateSample/SwiftUI-iOS/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,98 @@ +{ + "images" : [ + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "20x20" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "20x20" + }, + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "29x29" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "29x29" + }, + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "40x40" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "40x40" + }, + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "60x60" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "60x60" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "size" : "20x20" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "20x20" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "size" : "29x29" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "29x29" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "size" : "40x40" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "40x40" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "size" : "76x76" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "76x76" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "83.5x83.5" + }, + { + "idiom" : "ios-marketing", + "scale" : "1x", + "size" : "1024x1024" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/GoogleMulticastAppDelegate/Apps/AppDelegateSample/SwiftUI-iOS/Assets.xcassets/Contents.json b/GoogleMulticastAppDelegate/Apps/AppDelegateSample/SwiftUI-iOS/Assets.xcassets/Contents.json new file mode 100644 index 00000000..73c00596 --- /dev/null +++ b/GoogleMulticastAppDelegate/Apps/AppDelegateSample/SwiftUI-iOS/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/GoogleMulticastAppDelegate/Apps/AppDelegateSample/SwiftUI-iOS/ContentView.swift b/GoogleMulticastAppDelegate/Apps/AppDelegateSample/SwiftUI-iOS/ContentView.swift new file mode 100644 index 00000000..d2d08244 --- /dev/null +++ b/GoogleMulticastAppDelegate/Apps/AppDelegateSample/SwiftUI-iOS/ContentView.swift @@ -0,0 +1,21 @@ +// +// ContentView.swift +// SwiftUI-iOS +// +// Created by Maksym Malyhin on 2021-02-22. +// + +import SwiftUI + +struct ContentView: View { + var body: some View { + Text("Hello, world!") + .padding() + } +} + +struct ContentView_Previews: PreviewProvider { + static var previews: some View { + ContentView() + } +} diff --git a/GoogleMulticastAppDelegate/Apps/AppDelegateSample/SwiftUI-iOS/Info.plist b/GoogleMulticastAppDelegate/Apps/AppDelegateSample/SwiftUI-iOS/Info.plist new file mode 100644 index 00000000..efc211a0 --- /dev/null +++ b/GoogleMulticastAppDelegate/Apps/AppDelegateSample/SwiftUI-iOS/Info.plist @@ -0,0 +1,50 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + $(PRODUCT_BUNDLE_PACKAGE_TYPE) + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + LSRequiresIPhoneOS + + UIApplicationSceneManifest + + UIApplicationSupportsMultipleScenes + + + UIApplicationSupportsIndirectInputEvents + + UILaunchScreen + + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/GoogleMulticastAppDelegate/Apps/AppDelegateSample/SwiftUI-iOS/Preview Content/Preview Assets.xcassets/Contents.json b/GoogleMulticastAppDelegate/Apps/AppDelegateSample/SwiftUI-iOS/Preview Content/Preview Assets.xcassets/Contents.json new file mode 100644 index 00000000..73c00596 --- /dev/null +++ b/GoogleMulticastAppDelegate/Apps/AppDelegateSample/SwiftUI-iOS/Preview Content/Preview Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/GoogleMulticastAppDelegate/Apps/AppDelegateSample/SwiftUI-iOS/SwiftUI_iOSApp.swift b/GoogleMulticastAppDelegate/Apps/AppDelegateSample/SwiftUI-iOS/SwiftUI_iOSApp.swift new file mode 100644 index 00000000..a28cfe4c --- /dev/null +++ b/GoogleMulticastAppDelegate/Apps/AppDelegateSample/SwiftUI-iOS/SwiftUI_iOSApp.swift @@ -0,0 +1,35 @@ +// +// SwiftUI_iOSApp.swift +// SwiftUI-iOS +// +// Created by Maksym Malyhin on 2021-02-22. +// + +import SwiftUI +import GoogleMulticastAppDelegate + +@objc +class AppDelegate: NSObject, MulticastAppDelegateProtocol.Delegate { + func application(_ application: UIApplication, + didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool { + return true + } +} + +@main +struct SwiftUI_iOSApp: App { + // Set `MulticastAppDelegate` as an App Delegate. + @UIApplicationDelegateAdaptor(MulticastAppDelegate.self) var delegate + + init() { + // Register the app's own App Delegate as an interceptor. + self.delegate.appDelegate = AppDelegate() + } + + + var body: some Scene { + WindowGroup { + ContentView() + } + } +} diff --git a/GoogleMulticastAppDelegate/Sources/MulticastAppDelegate.swift b/GoogleMulticastAppDelegate/Sources/MulticastAppDelegate.swift new file mode 100644 index 00000000..d5e5c9fd --- /dev/null +++ b/GoogleMulticastAppDelegate/Sources/MulticastAppDelegate.swift @@ -0,0 +1,153 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import UIKit + +private typealias Application = UIApplication +private typealias ApplicationDelegate = UIApplicationDelegate + +@objc(GULMulticastAppDelegateProtocol) +public protocol MulticastAppDelegateProtocol: NSObjectProtocol { + typealias Delegate = UIApplicationDelegate + + func addInterceptor(_ interceptor: Delegate) + func removeInterceptor(_ interceptor: Delegate) +} + +@objc(GULMulticastAppDelegate) +open class MulticastAppDelegate: NSObject, MulticastAppDelegateProtocol { + public var appDelegate: MulticastAppDelegateProtocol.Delegate? + private var interceptors: [MulticastAppDelegateProtocol.Delegate] = [] + private var allInterceptors: [MulticastAppDelegateProtocol.Delegate] { + guard let appDelegate = appDelegate else { + return interceptors + } + + var allInterceptors = [appDelegate] + allInterceptors.append(contentsOf: interceptors) + return allInterceptors + } + + override public init() { + super.init() + } + + public init(appDelegate: MulticastAppDelegateProtocol.Delegate) { + super.init() + self.appDelegate = appDelegate + } + + @objc + public func addInterceptor(_ interceptor: Delegate) { + interceptors.append(interceptor) + } + + @objc + public func removeInterceptor(_ interceptor: Delegate) { + interceptors = interceptors.filter { $0 !== interceptor } + } + + // Forward all unknown messages to the original app delegate. + override public func responds(to aSelector: Selector!) -> Bool { + if type(of: self).instancesRespond(to: aSelector) { + return true + } + + return appDelegate?.responds(to: aSelector) ?? false + } + + override open func forwardingTarget(for aSelector: Selector) -> Any? { + return appDelegate + } +} + +// MARK: - Multicast App Delegate detection + +extension MulticastAppDelegate { + /// Returns an instance of app delegate if it conforms to `MulticastAppDelegateProtocol` + @objc + public class func installedMulticastDelegate() -> MulticastAppDelegateProtocol? { + guard let appDelegate = Application.shared.delegate else { + return nil + } + + if let multicastDelegate = appDelegate as? MulticastAppDelegateProtocol { + return multicastDelegate + } + + // SwiftUI `UIApplicationDelegateAdaptor` doesn't allow easily check if the actual app delegate confirms to a protocol. But any method call is eventually forwarded to the original app delegate instance, so it can be used as a type-safe workaround. + if appDelegate.responds(to: #selector(gulMulticastDelegate)) { + return appDelegate.perform(#selector(gulMulticastDelegate)) + .takeRetainedValue() as? MulticastAppDelegateProtocol + } + + return nil + } + + /// The method is used to test if calls to `Application.shared.delegate` are forwarded to a `MulticastAppDelegate` subclass. + @objc + public func gulMulticastDelegate() -> MulticastAppDelegateProtocol { + return self + } +} + +extension MulticastAppDelegate: MulticastAppDelegateProtocol.Delegate { + // MARK: - Open URL + + public func application(_ app: UIApplication, open url: URL, + options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool { + var result = false + + for interceptor in allInterceptors { + result = result || interceptor.application?(app, open: url, options: options) ?? false + } + + return result + } + + // MARK: - APNS methods + + public func application(_ application: UIApplication, + didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) { + for interceptor in allInterceptors { + interceptor.application?( + application, + didRegisterForRemoteNotificationsWithDeviceToken: deviceToken + ) + } + } + + public func application(_ application: UIApplication, + didFailToRegisterForRemoteNotificationsWithError error: Error) { + for interceptor in allInterceptors { + interceptor.application?(application, didFailToRegisterForRemoteNotificationsWithError: error) + } + } + + public func application(_ application: UIApplication, + didReceiveRemoteNotification notification: [AnyHashable: Any], + fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) + -> Void) { + for interceptor in allInterceptors { + // TODO: Make sure completionHandler is called once. + interceptor.application?( + application, + didReceiveRemoteNotification: notification, + fetchCompletionHandler: completionHandler + ) + } + } +} + +extension MulticastAppDelegate {} diff --git a/GoogleUtilities.podspec b/GoogleUtilities.podspec index de621db6..ae8f33d8 100644 --- a/GoogleUtilities.podspec +++ b/GoogleUtilities.podspec @@ -100,6 +100,10 @@ other Google CocoaPods. They're not intended for direct public usage. adss.dependency 'GoogleUtilities/Environment' end + s.subspec 'MulticastAppDelegate' do |mad| + mad.source_files = 'GoogleUtilities/MulticastAppDelegate/**/*.swift' + end + s.subspec 'ISASwizzler' do |iss| iss.source_files = 'GoogleUtilities/ISASwizzler/**/*.[mh]', 'GoogleUtilities/Common/*.h' iss.public_header_files = 'GoogleUtilities/ISASwizzler/Public/GoogleUtilities/*.h' diff --git a/Package.swift b/Package.swift index 3316c85f..2e117251 100644 --- a/Package.swift +++ b/Package.swift @@ -61,6 +61,10 @@ let package = Package( name: "GULUserDefaults", targets: ["GoogleUtilities_UserDefaults"] ), + .library( + name: "GULMulticastAppDelegate", + targets: ["GoogleUtilities_MulticastAppDelegate"] + ), ], dependencies: [ .package(name: "Promises", url: "https://github.com/google/promises.git", "1.2.8" ..< "3.0.0"), @@ -189,6 +193,14 @@ let package = Package( .headerSearchPath("../../"), ] ), + + // MARK: - Multicast App Delegate targets + .target( + name: "GoogleUtilities_MulticastAppDelegate", + path: "GoogleMulticastAppDelegate/Sources" + ), + + // MARK: - Tests .testTarget( name: "swift-test", dependencies: [