diff --git a/.github/workflows/functions.yml b/.github/workflows/functions.yml index 1b262af43..b0bcfff50 100644 --- a/.github/workflows/functions.yml +++ b/.github/workflows/functions.yml @@ -28,7 +28,7 @@ jobs: runs-on: macOS-latest env: SPM: false - LEGACY: false + LEGACY: true OS: iOS DEVICE: iPhone 11 TEST: true @@ -37,11 +37,12 @@ jobs: uses: actions/checkout@master - name: Setup run: | - cd functions + cd functions/LegacyFunctionsQuickstart gem install bundler bundle install gem install xcpretty bundle exec pod install --repo-update + cd .. ../scripts/install_prereqs/functions.sh - name: Build ObjC run: ./scripts/test.sh @@ -51,3 +52,34 @@ jobs: run: ./scripts/test.sh env: SWIFT_SUFFIX: Swift + + spm: + name: spm + runs-on: macOS-latest + strategy: + matrix: + xcode: ["13.0"] + os: [iOS] + include: + - os: iOS + device: iPhone 11 + test: false + env: + SETUP: functions + SPM: true + DIR: functions/FunctionsExample/ + OS: ${{ matrix.os }} + DEVICE: ${{ matrix.device }} + TEST: ${{ matrix.test }} + XCODE_VERSION: ${{ matrix.xcode }} + steps: + - name: Checkout + uses: actions/checkout@master + - name: Setup + run: | + sudo xcode-select -s "/Applications/Xcode_${XCODE_VERSION}.app/Contents/Developer" + gem install xcpretty + cd $SETUP + ../scripts/install_prereqs/${SETUP}.sh + - name: Build and Test SwiftUI (${{ matrix.os }}) + run: ./scripts/test.sh diff --git a/functions/FunctionsExample/FunctionsExample.xcodeproj/project.pbxproj b/functions/FunctionsExample/FunctionsExample.xcodeproj/project.pbxproj new file mode 100644 index 000000000..c5c2e98b1 --- /dev/null +++ b/functions/FunctionsExample/FunctionsExample.xcodeproj/project.pbxproj @@ -0,0 +1,417 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 55; + objects = { + +/* Begin PBXBuildFile section */ + B9260233278F8F08006F123B /* FunctionsExampleApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = B9260232278F8F08006F123B /* FunctionsExampleApp.swift */; }; + B9260235278F8F08006F123B /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B9260234278F8F08006F123B /* ContentView.swift */; }; + B9260237278F8F0A006F123B /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = B9260236278F8F0A006F123B /* Assets.xcassets */; }; + B926023A278F8F0A006F123B /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = B9260239278F8F0A006F123B /* Preview Assets.xcassets */; }; + B9260244278F94D1006F123B /* FirebaseAnalytics in Frameworks */ = {isa = PBXBuildFile; productRef = B9260243278F94D1006F123B /* FirebaseAnalytics */; }; + B9260246278F94D1006F123B /* FirebaseFunctions in Frameworks */ = {isa = PBXBuildFile; productRef = B9260245278F94D1006F123B /* FirebaseFunctions */; }; + B926024B278F963C006F123B /* CapitalizeMessageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B926024A278F963C006F123B /* CapitalizeMessageView.swift */; }; + B926024D278F96B3006F123B /* AddNumbersView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B926024C278F96B3006F123B /* AddNumbersView.swift */; }; + B926024F278F9756006F123B /* BackgroundFrame.swift in Sources */ = {isa = PBXBuildFile; fileRef = B926024E278F9756006F123B /* BackgroundFrame.swift */; }; + B9F406362798F3B700B84D2B /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = B9F406352798F3B700B84D2B /* GoogleService-Info.plist */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + B926022F278F8F08006F123B /* FunctionsExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = FunctionsExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; + B9260232278F8F08006F123B /* FunctionsExampleApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FunctionsExampleApp.swift; sourceTree = ""; }; + B9260234278F8F08006F123B /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; + B9260236278F8F0A006F123B /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + B9260239278F8F0A006F123B /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; + B926024A278F963C006F123B /* CapitalizeMessageView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CapitalizeMessageView.swift; sourceTree = ""; }; + B926024C278F96B3006F123B /* AddNumbersView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddNumbersView.swift; sourceTree = ""; }; + B926024E278F9756006F123B /* BackgroundFrame.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BackgroundFrame.swift; sourceTree = ""; }; + B9F406352798F3B700B84D2B /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "GoogleService-Info.plist"; path = "../GoogleService-Info.plist"; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + B926022C278F8F08006F123B /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + B9260244278F94D1006F123B /* FirebaseAnalytics in Frameworks */, + B9260246278F94D1006F123B /* FirebaseFunctions in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + B9260226278F8F08006F123B = { + isa = PBXGroup; + children = ( + B9F406352798F3B700B84D2B /* GoogleService-Info.plist */, + B9260231278F8F08006F123B /* FunctionsExample */, + B9260230278F8F08006F123B /* Products */, + ); + sourceTree = ""; + }; + B9260230278F8F08006F123B /* Products */ = { + isa = PBXGroup; + children = ( + B926022F278F8F08006F123B /* FunctionsExample.app */, + ); + name = Products; + sourceTree = ""; + }; + B9260231278F8F08006F123B /* FunctionsExample */ = { + isa = PBXGroup; + children = ( + B9260232278F8F08006F123B /* FunctionsExampleApp.swift */, + B9260241278F9002006F123B /* Screen */, + B9260240278F8FC8006F123B /* View */, + B9260236278F8F0A006F123B /* Assets.xcassets */, + B9260238278F8F0A006F123B /* Preview Content */, + ); + path = FunctionsExample; + sourceTree = ""; + }; + B9260238278F8F0A006F123B /* Preview Content */ = { + isa = PBXGroup; + children = ( + B9260239278F8F0A006F123B /* Preview Assets.xcassets */, + ); + path = "Preview Content"; + sourceTree = ""; + }; + B9260240278F8FC8006F123B /* View */ = { + isa = PBXGroup; + children = ( + B926024A278F963C006F123B /* CapitalizeMessageView.swift */, + B926024C278F96B3006F123B /* AddNumbersView.swift */, + B926024E278F9756006F123B /* BackgroundFrame.swift */, + ); + path = View; + sourceTree = ""; + }; + B9260241278F9002006F123B /* Screen */ = { + isa = PBXGroup; + children = ( + B9260234278F8F08006F123B /* ContentView.swift */, + ); + path = Screen; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + B926022E278F8F08006F123B /* FunctionsExample */ = { + isa = PBXNativeTarget; + buildConfigurationList = B926023D278F8F0A006F123B /* Build configuration list for PBXNativeTarget "FunctionsExample" */; + buildPhases = ( + B926022B278F8F08006F123B /* Sources */, + B926022C278F8F08006F123B /* Frameworks */, + B926022D278F8F08006F123B /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = FunctionsExample; + packageProductDependencies = ( + B9260243278F94D1006F123B /* FirebaseAnalytics */, + B9260245278F94D1006F123B /* FirebaseFunctions */, + ); + productName = FunctionsExample; + productReference = B926022F278F8F08006F123B /* FunctionsExample.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + B9260227278F8F08006F123B /* Project object */ = { + isa = PBXProject; + attributes = { + BuildIndependentTargetsInParallel = 1; + LastSwiftUpdateCheck = 1310; + LastUpgradeCheck = 1310; + TargetAttributes = { + B926022E278F8F08006F123B = { + CreatedOnToolsVersion = 13.1; + }; + }; + }; + buildConfigurationList = B926022A278F8F08006F123B /* Build configuration list for PBXProject "FunctionsExample" */; + compatibilityVersion = "Xcode 13.0"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = B9260226278F8F08006F123B; + packageReferences = ( + B9260242278F94D1006F123B /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */, + ); + productRefGroup = B9260230278F8F08006F123B /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + B926022E278F8F08006F123B /* FunctionsExample */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + B926022D278F8F08006F123B /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + B926023A278F8F0A006F123B /* Preview Assets.xcassets in Resources */, + B9F406362798F3B700B84D2B /* GoogleService-Info.plist in Resources */, + B9260237278F8F0A006F123B /* Assets.xcassets in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + B926022B278F8F08006F123B /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + B926024D278F96B3006F123B /* AddNumbersView.swift in Sources */, + B926024B278F963C006F123B /* CapitalizeMessageView.swift in Sources */, + B926024F278F9756006F123B /* BackgroundFrame.swift in Sources */, + B9260235278F8F08006F123B /* ContentView.swift in Sources */, + B9260233278F8F08006F123B /* FunctionsExampleApp.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + B926023B278F8F0A006F123B /* 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++17"; + 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 = 15.0; + 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; + }; + B926023C278F8F0A006F123B /* 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++17"; + 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 = 15.0; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + B926023E278F8F0A006F123B /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = NO; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_ASSET_PATHS = "\"FunctionsExample/Preview Content\""; + DEVELOPMENT_TEAM = UBV32XXYKC; + ENABLE_PREVIEWS = YES; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; + INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; + INFOPLIST_KEY_UILaunchScreen_Generation = YES; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + MARKETING_VERSION = 1.0; + OTHER_SWIFT_FLAGS = ""; + PRODUCT_BUNDLE_IDENTIFIER = com.google.firebase.quickstart.FunctionsExample; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + B926023F278F8F0A006F123B /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = NO; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_ASSET_PATHS = "\"FunctionsExample/Preview Content\""; + DEVELOPMENT_TEAM = UBV32XXYKC; + ENABLE_PREVIEWS = YES; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; + INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; + INFOPLIST_KEY_UILaunchScreen_Generation = YES; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + MARKETING_VERSION = 1.0; + OTHER_SWIFT_FLAGS = ""; + PRODUCT_BUNDLE_IDENTIFIER = com.google.firebase.quickstart.FunctionsExample; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + B926022A278F8F08006F123B /* Build configuration list for PBXProject "FunctionsExample" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + B926023B278F8F0A006F123B /* Debug */, + B926023C278F8F0A006F123B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + B926023D278F8F0A006F123B /* Build configuration list for PBXNativeTarget "FunctionsExample" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + B926023E278F8F0A006F123B /* Debug */, + B926023F278F8F0A006F123B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + +/* Begin XCRemoteSwiftPackageReference section */ + B9260242278F94D1006F123B /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */ = { + isa = XCRemoteSwiftPackageReference; + repositoryURL = "https://github.com/firebase/firebase-ios-sdk"; + requirement = { + branch = master; + kind = branch; + }; + }; +/* End XCRemoteSwiftPackageReference section */ + +/* Begin XCSwiftPackageProductDependency section */ + B9260243278F94D1006F123B /* FirebaseAnalytics */ = { + isa = XCSwiftPackageProductDependency; + package = B9260242278F94D1006F123B /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */; + productName = FirebaseAnalytics; + }; + B9260245278F94D1006F123B /* FirebaseFunctions */ = { + isa = XCSwiftPackageProductDependency; + package = B9260242278F94D1006F123B /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */; + productName = FirebaseFunctions; + }; +/* End XCSwiftPackageProductDependency section */ + }; + rootObject = B9260227278F8F08006F123B /* Project object */; +} diff --git a/functions/FunctionsExample/FunctionsExample.xcodeproj/xcshareddata/xcschemes/FunctionsExample (iOS).xcscheme b/functions/FunctionsExample/FunctionsExample.xcodeproj/xcshareddata/xcschemes/FunctionsExample (iOS).xcscheme new file mode 100644 index 000000000..212df2eb4 --- /dev/null +++ b/functions/FunctionsExample/FunctionsExample.xcodeproj/xcshareddata/xcschemes/FunctionsExample (iOS).xcscheme @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/functions/FunctionsExample/FunctionsExample.xcodeproj/xcshareddata/xcschemes/FunctionsExample.xcscheme b/functions/FunctionsExample/FunctionsExample.xcodeproj/xcshareddata/xcschemes/FunctionsExample.xcscheme new file mode 100644 index 000000000..212df2eb4 --- /dev/null +++ b/functions/FunctionsExample/FunctionsExample.xcodeproj/xcshareddata/xcschemes/FunctionsExample.xcscheme @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/functions/FunctionsExample/FunctionsExample/Assets.xcassets/AccentColor.colorset/Contents.json b/functions/FunctionsExample/FunctionsExample/Assets.xcassets/AccentColor.colorset/Contents.json new file mode 100644 index 000000000..eb8789700 --- /dev/null +++ b/functions/FunctionsExample/FunctionsExample/Assets.xcassets/AccentColor.colorset/Contents.json @@ -0,0 +1,11 @@ +{ + "colors" : [ + { + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/functions/FunctionsExample/FunctionsExample/Assets.xcassets/AppIcon.appiconset/Contents.json b/functions/FunctionsExample/FunctionsExample/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 000000000..9221b9bb1 --- /dev/null +++ b/functions/FunctionsExample/FunctionsExample/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/functions/FunctionsExample/FunctionsExample/Assets.xcassets/Contents.json b/functions/FunctionsExample/FunctionsExample/Assets.xcassets/Contents.json new file mode 100644 index 000000000..73c00596a --- /dev/null +++ b/functions/FunctionsExample/FunctionsExample/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/functions/FunctionsExample/FunctionsExample/FunctionsExampleApp.swift b/functions/FunctionsExample/FunctionsExample/FunctionsExampleApp.swift new file mode 100644 index 000000000..af788a22a --- /dev/null +++ b/functions/FunctionsExample/FunctionsExample/FunctionsExampleApp.swift @@ -0,0 +1,37 @@ +// +// Copyright 2022 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 SwiftUI +import Firebase + +@main +struct FunctionsExampleApp: App { + init() { + FirebaseApp.configure() + // Add `-D EMULATOR` to the `Other Swift Flags` under the `Build Settings` + // to run on an emulator. Learn more from the README.md under the + // `functions` dir of the Quickstart repo. + #if EMULATOR + Functions.functions().useEmulator(withHost: "localhost", port: 5001) + #endif + } + + var body: some Scene { + WindowGroup { + ContentView() + } + } +} diff --git a/functions/FunctionsExample/FunctionsExample/Info.plist b/functions/FunctionsExample/FunctionsExample/Info.plist new file mode 100644 index 000000000..0427f524a --- /dev/null +++ b/functions/FunctionsExample/FunctionsExample/Info.plist @@ -0,0 +1,11 @@ + + + + + UILaunchScreen + + UIImageName + LaunchScreen + + + diff --git a/functions/FunctionsExample/FunctionsExample/Preview Content/Preview Assets.xcassets/Contents.json b/functions/FunctionsExample/FunctionsExample/Preview Content/Preview Assets.xcassets/Contents.json new file mode 100644 index 000000000..73c00596a --- /dev/null +++ b/functions/FunctionsExample/FunctionsExample/Preview Content/Preview Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/functions/FunctionsExample/FunctionsExample/Screen/ContentView.swift b/functions/FunctionsExample/FunctionsExample/Screen/ContentView.swift new file mode 100644 index 000000000..af8966964 --- /dev/null +++ b/functions/FunctionsExample/FunctionsExample/Screen/ContentView.swift @@ -0,0 +1,49 @@ +// +// Copyright 2022 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 SwiftUI +import Firebase + +struct ContentView: View { + var body: some View { + NavigationView { + ScrollView { + VStack { + AddNumbersView() + CapitalizeMessageView() + Spacer() + } + } + .navigationTitle("Firebase Functions") + .navigationBarBackButtonHidden(true) + .navigationBarTitleDisplayMode(.large) + } + .navigationViewStyle(StackNavigationViewStyle()) + } +} + +struct ContentView_Previews: PreviewProvider { + static var previews: some View { + ForEach( + ["iPhone SE (2nd generation)", "iPhone 13 Pro Max", "iPad Pro (12.9-inch) (5th generation)"], + id: \.self + ) { deviceName in + ContentView() + .previewDevice(PreviewDevice(rawValue: deviceName)) + .previewDisplayName(deviceName) + } + } +} diff --git a/functions/FunctionsExample/FunctionsExample/View/AddNumbersView.swift b/functions/FunctionsExample/FunctionsExample/View/AddNumbersView.swift new file mode 100644 index 000000000..9262fbb5b --- /dev/null +++ b/functions/FunctionsExample/FunctionsExample/View/AddNumbersView.swift @@ -0,0 +1,76 @@ +// +// Copyright 2022 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 SwiftUI +import Firebase + +struct AddNumbersView: View { + @State private var num1: String = "" + @State private var num2: String = "" + @State private var outcome: String = "" + private var functions = Functions.functions() + var body: some View { + BackgroundFrame( + title: "AddNumbers", + description: "Add two integers and output the sum.", + buttonAction: didTapCalculate + ) { + VStack { + HStack { + Spacer() + TextField("", text: $num1, prompt: Text("Num1")) + .multilineTextAlignment(.center) + .background(RoundedRectangle(cornerRadius: 16).fill(Color(.systemGray5))) + .padding() + .keyboardType(.numberPad) + Image(systemName: "plus") + TextField("", text: $num2, prompt: Text("Num2")) + .multilineTextAlignment(.center) + .background(RoundedRectangle(cornerRadius: 16).fill(Color(.systemGray5))) + .padding() + .keyboardType(.numberPad) + Spacer() + } + VStack { + Text("\(outcome)") + } + } + } + } + + func didTapCalculate() { + Task { + do { + let result = try await functions.httpsCallable("addNumbers") + .call(["firstNumber": $num1.wrappedValue, + "secondNumber": $num2.wrappedValue]) + if let operationResult = (result.data as? [String: Any])?["operationResult"] as? Int { + self.outcome = String(operationResult) + } else { + self.outcome = "The return result is invalid." + } + } catch { + print(error) + } + } + } +} + +struct AddNumbers_Previews: PreviewProvider { + static var previews: some View { + AddNumbersView() + } +} diff --git a/functions/FunctionsExample/FunctionsExample/View/BackgroundFrame.swift b/functions/FunctionsExample/FunctionsExample/View/BackgroundFrame.swift new file mode 100644 index 000000000..5c92fc5cf --- /dev/null +++ b/functions/FunctionsExample/FunctionsExample/View/BackgroundFrame.swift @@ -0,0 +1,82 @@ +// +// Copyright 2022 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 SwiftUI + +struct BackgroundFrame: View { + var title: String + var description: String + let content: Content + let buttonAction: () -> Void + init(title: String, description: String, buttonAction: @escaping () -> Void, + @ViewBuilder content: () -> Content) { + self.title = title + self.description = description + self.content = content() + self.buttonAction = buttonAction + } + + var body: some View { + VStack(alignment: .leading) { + Text(title) + .fontWeight(.bold) + .font(.title3) + Text(description) + .font(.subheadline) + .foregroundColor(Color(UIColor.secondaryLabel)) + ZStack { + RoundedRectangle(cornerRadius: 16) + .fill(Color(.secondarySystemBackground)) + .frame(height: 150) + content + } + CustomStyledButton(title: "Run", action: buttonAction) + } + .padding() + } +} + +struct BackgroundFrame_Previews: PreviewProvider { + static var previews: some View { + BackgroundFrame( + title: "Function", + description: "Function description", + buttonAction: { print("button") } + ) { + Text("Testing View") + } + } +} + +struct CustomStyledButton: View { + let title: String + let action: () -> Void + + var body: some View { + Button(action: action) { + /// Embed in an HStack to display a wide button with centered text. + HStack { + Spacer() + Text(title) + .padding() + .accentColor(.white) + Spacer() + } + } + .background(Color.orange) + .cornerRadius(16.0) + } +} diff --git a/functions/FunctionsExample/FunctionsExample/View/CapitalizeMessageView.swift b/functions/FunctionsExample/FunctionsExample/View/CapitalizeMessageView.swift new file mode 100644 index 000000000..b561b1cbf --- /dev/null +++ b/functions/FunctionsExample/FunctionsExample/View/CapitalizeMessageView.swift @@ -0,0 +1,59 @@ +// +// Copyright 2022 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 SwiftUI +import Firebase + +struct CapitalizeMessageView: View { + @State private var comment: String = "" + @State private var outcome: String = "" + private var functions = Functions.functions() + var body: some View { + BackgroundFrame( + title: "CapitalizeMessage", + description: "Capitalize the input message and return it.", + buttonAction: didTapAddMessage + ) { + VStack { + TextField("", text: $comment, prompt: Text("Type message")) + .background(RoundedRectangle(cornerRadius: 16).fill(Color(.systemGray5))) + .padding() + Text(outcome) + } + .padding() + } + } + + func didTapAddMessage() { + Task { + do { + let result = try await functions.httpsCallable("capitalizeMessage") + .call(["text": $comment.wrappedValue]) + if let data = result.data as? [String: Any], let text = data["text"] as? String { + self.outcome = text + } + } catch { + print(error) + } + } + } +} + +struct AddMessage_Previews: PreviewProvider { + static var previews: some View { + CapitalizeMessageView() + } +} diff --git a/functions/FunctionsExample.xcodeproj/project.pbxproj b/functions/LegacyFunctionsQuickstart/FunctionsExample.xcodeproj/project.pbxproj similarity index 99% rename from functions/FunctionsExample.xcodeproj/project.pbxproj rename to functions/LegacyFunctionsQuickstart/FunctionsExample.xcodeproj/project.pbxproj index 43d73ba5b..02486cc19 100644 --- a/functions/FunctionsExample.xcodeproj/project.pbxproj +++ b/functions/LegacyFunctionsQuickstart/FunctionsExample.xcodeproj/project.pbxproj @@ -84,7 +84,7 @@ 10B1CCBE205C51F90067EDB4 /* SignInViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SignInViewController.swift; sourceTree = ""; }; 10B1CCC0205C60890067EDB4 /* CloudAddCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CloudAddCell.swift; sourceTree = ""; }; 10B1CCC2205C63370067EDB4 /* CommentCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CommentCell.swift; sourceTree = ""; }; - 43ED466C2F109A2272796CB6 /* GoogleService-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = ""; }; + 43ED466C2F109A2272796CB6 /* GoogleService-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; name = "GoogleService-Info.plist"; path = "../GoogleService-Info.plist"; sourceTree = ""; }; 5F5A534C1ADE670C00F81DF0 /* FunctionsExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = FunctionsExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 5F5A53501ADE670C00F81DF0 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 5F5A53511ADE670C00F81DF0 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; @@ -253,7 +253,7 @@ 5F9961071AE0CF4F0034F503 /* LaunchScreen.xib */, ); name = Shared; - path = ../shared; + path = ../../shared; sourceTree = ""; }; DE43B5CB23AEC6980056B15F /* TestUtils */ = { @@ -266,7 +266,7 @@ DED65CF723E9DE6400461312 /* FIREGSignInInfo.h */, ); name = TestUtils; - path = ../TestUtils; + path = ../../TestUtils; sourceTree = ""; }; /* End PBXGroup section */ diff --git a/functions/FunctionsExample.xcodeproj/xcshareddata/xcschemes/FunctionsExample.xcscheme b/functions/LegacyFunctionsQuickstart/FunctionsExample.xcodeproj/xcshareddata/xcschemes/FunctionsExample.xcscheme similarity index 100% rename from functions/FunctionsExample.xcodeproj/xcshareddata/xcschemes/FunctionsExample.xcscheme rename to functions/LegacyFunctionsQuickstart/FunctionsExample.xcodeproj/xcshareddata/xcschemes/FunctionsExample.xcscheme diff --git a/functions/FunctionsExample.xcodeproj/xcshareddata/xcschemes/FunctionsExampleSwift.xcscheme b/functions/LegacyFunctionsQuickstart/FunctionsExample.xcodeproj/xcshareddata/xcschemes/FunctionsExampleSwift.xcscheme similarity index 100% rename from functions/FunctionsExample.xcodeproj/xcshareddata/xcschemes/FunctionsExampleSwift.xcscheme rename to functions/LegacyFunctionsQuickstart/FunctionsExample.xcodeproj/xcshareddata/xcschemes/FunctionsExampleSwift.xcscheme diff --git a/functions/FunctionsExample/.clang-format b/functions/LegacyFunctionsQuickstart/FunctionsExample/.clang-format similarity index 100% rename from functions/FunctionsExample/.clang-format rename to functions/LegacyFunctionsQuickstart/FunctionsExample/.clang-format diff --git a/functions/FunctionsExample/AppDelegate.h b/functions/LegacyFunctionsQuickstart/FunctionsExample/AppDelegate.h similarity index 100% rename from functions/FunctionsExample/AppDelegate.h rename to functions/LegacyFunctionsQuickstart/FunctionsExample/AppDelegate.h diff --git a/functions/FunctionsExample/AppDelegate.m b/functions/LegacyFunctionsQuickstart/FunctionsExample/AppDelegate.m similarity index 100% rename from functions/FunctionsExample/AppDelegate.m rename to functions/LegacyFunctionsQuickstart/FunctionsExample/AppDelegate.m diff --git a/functions/FunctionsExample/Base.lproj/Main.storyboard b/functions/LegacyFunctionsQuickstart/FunctionsExample/Base.lproj/Main.storyboard similarity index 100% rename from functions/FunctionsExample/Base.lproj/Main.storyboard rename to functions/LegacyFunctionsQuickstart/FunctionsExample/Base.lproj/Main.storyboard diff --git a/functions/FunctionsExample/CloudAddCell.h b/functions/LegacyFunctionsQuickstart/FunctionsExample/CloudAddCell.h similarity index 100% rename from functions/FunctionsExample/CloudAddCell.h rename to functions/LegacyFunctionsQuickstart/FunctionsExample/CloudAddCell.h diff --git a/functions/FunctionsExample/CloudAddCell.m b/functions/LegacyFunctionsQuickstart/FunctionsExample/CloudAddCell.m similarity index 100% rename from functions/FunctionsExample/CloudAddCell.m rename to functions/LegacyFunctionsQuickstart/FunctionsExample/CloudAddCell.m diff --git a/functions/FunctionsExample/CommentCell.h b/functions/LegacyFunctionsQuickstart/FunctionsExample/CommentCell.h similarity index 100% rename from functions/FunctionsExample/CommentCell.h rename to functions/LegacyFunctionsQuickstart/FunctionsExample/CommentCell.h diff --git a/functions/FunctionsExample/CommentCell.m b/functions/LegacyFunctionsQuickstart/FunctionsExample/CommentCell.m similarity index 100% rename from functions/FunctionsExample/CommentCell.m rename to functions/LegacyFunctionsQuickstart/FunctionsExample/CommentCell.m diff --git a/functions/FunctionsExample/FAuthPickerViewController.h b/functions/LegacyFunctionsQuickstart/FunctionsExample/FAuthPickerViewController.h similarity index 100% rename from functions/FunctionsExample/FAuthPickerViewController.h rename to functions/LegacyFunctionsQuickstart/FunctionsExample/FAuthPickerViewController.h diff --git a/functions/FunctionsExample/FAuthPickerViewController.m b/functions/LegacyFunctionsQuickstart/FunctionsExample/FAuthPickerViewController.m similarity index 100% rename from functions/FunctionsExample/FAuthPickerViewController.m rename to functions/LegacyFunctionsQuickstart/FunctionsExample/FAuthPickerViewController.m diff --git a/functions/FunctionsExample/FAuthPickerViewController.xib b/functions/LegacyFunctionsQuickstart/FunctionsExample/FAuthPickerViewController.xib similarity index 100% rename from functions/FunctionsExample/FAuthPickerViewController.xib rename to functions/LegacyFunctionsQuickstart/FunctionsExample/FAuthPickerViewController.xib diff --git a/functions/FunctionsExample/Info.plist b/functions/LegacyFunctionsQuickstart/FunctionsExample/Info.plist similarity index 100% rename from functions/FunctionsExample/Info.plist rename to functions/LegacyFunctionsQuickstart/FunctionsExample/Info.plist diff --git a/functions/FunctionsExample/MainViewController.h b/functions/LegacyFunctionsQuickstart/FunctionsExample/MainViewController.h similarity index 100% rename from functions/FunctionsExample/MainViewController.h rename to functions/LegacyFunctionsQuickstart/FunctionsExample/MainViewController.h diff --git a/functions/FunctionsExample/MainViewController.m b/functions/LegacyFunctionsQuickstart/FunctionsExample/MainViewController.m similarity index 100% rename from functions/FunctionsExample/MainViewController.m rename to functions/LegacyFunctionsQuickstart/FunctionsExample/MainViewController.m diff --git a/functions/FunctionsExample/SignInViewController.h b/functions/LegacyFunctionsQuickstart/FunctionsExample/SignInViewController.h similarity index 100% rename from functions/FunctionsExample/SignInViewController.h rename to functions/LegacyFunctionsQuickstart/FunctionsExample/SignInViewController.h diff --git a/functions/FunctionsExample/SignInViewController.m b/functions/LegacyFunctionsQuickstart/FunctionsExample/SignInViewController.m similarity index 100% rename from functions/FunctionsExample/SignInViewController.m rename to functions/LegacyFunctionsQuickstart/FunctionsExample/SignInViewController.m diff --git a/functions/FunctionsExample/main.m b/functions/LegacyFunctionsQuickstart/FunctionsExample/main.m similarity index 100% rename from functions/FunctionsExample/main.m rename to functions/LegacyFunctionsQuickstart/FunctionsExample/main.m diff --git a/functions/FunctionsExampleSwift/AppDelegate.swift b/functions/LegacyFunctionsQuickstart/FunctionsExampleSwift/AppDelegate.swift similarity index 100% rename from functions/FunctionsExampleSwift/AppDelegate.swift rename to functions/LegacyFunctionsQuickstart/FunctionsExampleSwift/AppDelegate.swift diff --git a/functions/FunctionsExampleSwift/CloudAddCell.swift b/functions/LegacyFunctionsQuickstart/FunctionsExampleSwift/CloudAddCell.swift similarity index 100% rename from functions/FunctionsExampleSwift/CloudAddCell.swift rename to functions/LegacyFunctionsQuickstart/FunctionsExampleSwift/CloudAddCell.swift diff --git a/functions/FunctionsExampleSwift/CommentCell.swift b/functions/LegacyFunctionsQuickstart/FunctionsExampleSwift/CommentCell.swift similarity index 100% rename from functions/FunctionsExampleSwift/CommentCell.swift rename to functions/LegacyFunctionsQuickstart/FunctionsExampleSwift/CommentCell.swift diff --git a/functions/FunctionsExampleSwift/FAuthPickerViewController.swift b/functions/LegacyFunctionsQuickstart/FunctionsExampleSwift/FAuthPickerViewController.swift similarity index 100% rename from functions/FunctionsExampleSwift/FAuthPickerViewController.swift rename to functions/LegacyFunctionsQuickstart/FunctionsExampleSwift/FAuthPickerViewController.swift diff --git a/functions/FunctionsExampleSwift/MainViewController.swift b/functions/LegacyFunctionsQuickstart/FunctionsExampleSwift/MainViewController.swift similarity index 100% rename from functions/FunctionsExampleSwift/MainViewController.swift rename to functions/LegacyFunctionsQuickstart/FunctionsExampleSwift/MainViewController.swift diff --git a/functions/FunctionsExampleSwift/SignInViewController.swift b/functions/LegacyFunctionsQuickstart/FunctionsExampleSwift/SignInViewController.swift similarity index 100% rename from functions/FunctionsExampleSwift/SignInViewController.swift rename to functions/LegacyFunctionsQuickstart/FunctionsExampleSwift/SignInViewController.swift diff --git a/functions/FunctionsExampleSwiftUITests/FunctionsExampleSwiftUITests.swift b/functions/LegacyFunctionsQuickstart/FunctionsExampleSwiftUITests/FunctionsExampleSwiftUITests.swift similarity index 100% rename from functions/FunctionsExampleSwiftUITests/FunctionsExampleSwiftUITests.swift rename to functions/LegacyFunctionsQuickstart/FunctionsExampleSwiftUITests/FunctionsExampleSwiftUITests.swift diff --git a/functions/FunctionsExampleSwiftUITests/Info.plist b/functions/LegacyFunctionsQuickstart/FunctionsExampleSwiftUITests/Info.plist similarity index 100% rename from functions/FunctionsExampleSwiftUITests/Info.plist rename to functions/LegacyFunctionsQuickstart/FunctionsExampleSwiftUITests/Info.plist diff --git a/functions/FunctionsExampleTests/FunctionsExampleTests.m b/functions/LegacyFunctionsQuickstart/FunctionsExampleTests/FunctionsExampleTests.m similarity index 100% rename from functions/FunctionsExampleTests/FunctionsExampleTests.m rename to functions/LegacyFunctionsQuickstart/FunctionsExampleTests/FunctionsExampleTests.m diff --git a/functions/FunctionsExampleTests/Info.plist b/functions/LegacyFunctionsQuickstart/FunctionsExampleTests/Info.plist similarity index 100% rename from functions/FunctionsExampleTests/Info.plist rename to functions/LegacyFunctionsQuickstart/FunctionsExampleTests/Info.plist diff --git a/functions/FunctionsExampleUITests/FunctionsExampleUITests.m b/functions/LegacyFunctionsQuickstart/FunctionsExampleUITests/FunctionsExampleUITests.m similarity index 100% rename from functions/FunctionsExampleUITests/FunctionsExampleUITests.m rename to functions/LegacyFunctionsQuickstart/FunctionsExampleUITests/FunctionsExampleUITests.m diff --git a/functions/FunctionsExampleUITests/Info.plist b/functions/LegacyFunctionsQuickstart/FunctionsExampleUITests/Info.plist similarity index 100% rename from functions/FunctionsExampleUITests/Info.plist rename to functions/LegacyFunctionsQuickstart/FunctionsExampleUITests/Info.plist diff --git a/functions/Podfile b/functions/LegacyFunctionsQuickstart/Podfile similarity index 100% rename from functions/Podfile rename to functions/LegacyFunctionsQuickstart/Podfile diff --git a/functions/Podfile.lock b/functions/LegacyFunctionsQuickstart/Podfile.lock similarity index 100% rename from functions/Podfile.lock rename to functions/LegacyFunctionsQuickstart/Podfile.lock diff --git a/functions/LegacyFunctionsQuickstart/README.md b/functions/LegacyFunctionsQuickstart/README.md new file mode 100644 index 000000000..b2f33f89d --- /dev/null +++ b/functions/LegacyFunctionsQuickstart/README.md @@ -0,0 +1,45 @@ +Firebase Functions Quickstart +============================= + +Introduction +------------ + +This quickstart demonstrates **Callable Functions** which are HTTPS Cloud Functions +that can be invoked directly from your mobile application. + +- [Read more about callable functions](https://firebase.google.com/docs/functions/callable) + +Getting Started +--------------- + +- [Add Firebase to your iOS Project](https://firebase.google.com/docs/ios/setup). + +### Google Sign In Setup +- In Xcode, [add a custom URL scheme for your reversed client ID](https://developers.google.com/identity/sign-in/ios/start-integrating). +- You can find this in the `GoogleService-Info.plist` + +Support +------- + +- [Stack Overflow](https://stackoverflow.com/questions/tagged/google-cloud-functions) +- [Firebase Support](https://firebase.google.com/support/) + +License +------- + +Copyright 2018 Google, Inc. + +Licensed to the Apache Software Foundation (ASF) under one or more contributor +license agreements. See the NOTICE file distributed with this work for +additional information regarding copyright ownership. The ASF licenses this +file to you 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. diff --git a/functions/README.md b/functions/README.md index b2f33f89d..8f7120274 100644 --- a/functions/README.md +++ b/functions/README.md @@ -13,10 +13,35 @@ Getting Started --------------- - [Add Firebase to your iOS Project](https://firebase.google.com/docs/ios/setup). +- [Set up Firebase Functions](https://firebase.google.com/docs/functions/get-started) +Functions in the docs should be updated, since the functions applied in the +Quickstart might not be the same as the ones in the example from the doc above. -### Google Sign In Setup -- In Xcode, [add a custom URL scheme for your reversed client ID](https://developers.google.com/identity/sign-in/ios/start-integrating). -- You can find this in the `GoogleService-Info.plist` +To get aligned with the Quickstart, the `index.js` could be updated to +``` +const functions = require('firebase-functions'); + +exports.addNumbers = functions.https.onRequest((request, response) => { + var first = Number(request.body.data.firstNumber); + var second = Number(request.body.data.secondNumber); + response.json({ data: {operationResult: first + second} }); +}); + +exports.capitalizeMessage = functions.https.onRequest((request, response) => { + var upText = request.body.data.text; + response.json({ data: {text: upText.toUpperCase()} }); +}); +``` +- Run on a local machine +To let the Quickstart run on a local machine, you can [Emulate execution of your functions](https://firebase.google.com/docs/functions/get-started#emulate-execution-of-your-functions) +locally by adding a flag `-D EMULATOR` to the `Other Swift Flags` under the +`Build Settings`. + +- Run in production +Once functions are [deployed to a production environment](https://firebase.google.com/docs/functions/get-started#deploy-functions-to-a-production-environment), +the Functions Quickstart can just build and run without additional settings to +connect to a Firebase project. Remember to remove the `-D EMULATOR` flag if you +run the Quickstart through an emulator before. Support ------- @@ -27,7 +52,7 @@ Support License ------- -Copyright 2018 Google, Inc. +Copyright 2022 Google, Inc. Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for diff --git a/scripts/install_prereqs/functions.sh b/scripts/install_prereqs/functions.sh index 4336a2098..ced5e903b 100755 --- a/scripts/install_prereqs/functions.sh +++ b/scripts/install_prereqs/functions.sh @@ -16,4 +16,4 @@ DIRECTORY=functions \ PROJECT=Functions \ . ../scripts/prereq_core.sh -sed -i '' 's/REVERSED_CLIENT_ID/com.googleusercontent.apps.1025801074639-6p6ebi8amuklcjrto20gvpe295smm8u6/' FunctionsExample/Info.plist +sed -i '' 's/REVERSED_CLIENT_ID/com.googleusercontent.apps.1025801074639-6p6ebi8amuklcjrto20gvpe295smm8u6/' LegacyFunctionsQuickstart/FunctionsExample/Info.plist diff --git a/shared/Amber400.colorset/Contents.json b/shared/Amber400.colorset/Contents.json new file mode 100644 index 000000000..9cf9b41a8 --- /dev/null +++ b/shared/Amber400.colorset/Contents.json @@ -0,0 +1,38 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0.157", + "green" : "0.792", + "red" : "1.000" + } + }, + "idiom" : "universal" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0.157", + "green" : "0.792", + "red" : "1.000" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +}