Skip to content

Commit a310248

Browse files
Make Firebase Storage compile and work in independent watch app (#4955)
1 parent 1cca0bc commit a310248

File tree

13 files changed

+58
-56
lines changed

13 files changed

+58
-56
lines changed

.github/workflows/storage.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929

3030
strategy:
3131
matrix:
32-
target: [ios, tvos, macos]
32+
target: [ios, tvos, macos, watchos]
3333
steps:
3434
- uses: actions/checkout@v2
3535
- name: Setup Bundler
@@ -42,7 +42,7 @@ jobs:
4242
if: github.event_name == 'schedule'
4343
strategy:
4444
matrix:
45-
target: [ios, tvos, macos]
45+
target: [ios, tvos, macos, watchos]
4646
flags: [
4747
'--skip-tests --use-modular-headers',
4848
'--skip-tests --use-libraries'

Example/Messaging/App/watchOS/SampleWatchApp/Podfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ target 'SampleWatchAppWatchKitExtension' do
44
platform :watchos, '6.0'
55

66
pod 'FirebaseAnalyticsInterop', :path => '../../../../../'
7+
pod 'FirebaseAuthInterop', :path => '../../../../../'
78
pod 'FirebaseCore', :path => '../../../../../'
89
pod 'GoogleUtilities', :path => '../../../../../'
910
pod 'FirebaseMessaging', :path => '../../../../../'
@@ -13,6 +14,7 @@ target 'SampleWatchAppWatchKitExtension' do
1314
pod 'GoogleDataTransport', :path => '../../../../../'
1415
pod 'GoogleDataTransportCCTSupport', :path => '../../../../../'
1516
pod 'FirebaseInstallations', :path => '../../../../../'
17+
pod 'FirebaseStorage', :path => '../../../../../'
1618

1719
end
1820

Example/Messaging/App/watchOS/SampleWatchApp/SampleWatchApp.xcodeproj/project.pbxproj

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
5156949523F4965200E7C350 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 5156949423F4965200E7C350 /* Assets.xcassets */; };
1919
515694AF23F4A3D200E7C350 /* NotificationService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 515694AE23F4A3D200E7C350 /* NotificationService.swift */; };
2020
515694B323F4A3D200E7C350 /* ServiceExtension.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = 515694AC23F4A3D200E7C350 /* ServiceExtension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
21-
515694B923F4A6E100E7C350 /* RootView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 515694B823F4A6E100E7C350 /* RootView.swift */; };
2221
/* End PBXBuildFile section */
2322

2423
/* Begin PBXContainerItemProxy section */
@@ -99,7 +98,6 @@
9998
515694AC23F4A3D200E7C350 /* ServiceExtension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = ServiceExtension.appex; sourceTree = BUILT_PRODUCTS_DIR; };
10099
515694AE23F4A3D200E7C350 /* NotificationService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationService.swift; sourceTree = "<group>"; };
101100
515694B023F4A3D200E7C350 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
102-
515694B823F4A6E100E7C350 /* RootView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RootView.swift; sourceTree = "<group>"; };
103101
/* End PBXFileReference section */
104102

105103
/* Begin PBXFrameworksBuildPhase section */
@@ -176,7 +174,6 @@
176174
5156949423F4965200E7C350 /* Assets.xcassets */,
177175
5156949623F4965200E7C350 /* Info.plist */,
178176
5156949723F4965200E7C350 /* PushNotificationPayload.apns */,
179-
515694B823F4A6E100E7C350 /* RootView.swift */,
180177
);
181178
path = SampleWatchAppWatchKitExtension;
182179
sourceTree = "<group>";
@@ -353,7 +350,6 @@
353350
5156949323F4965100E7C350 /* ComplicationController.swift in Sources */,
354351
5156948F23F4965100E7C350 /* ExtensionDelegate.swift in Sources */,
355352
5156948D23F4965100E7C350 /* InterfaceController.swift in Sources */,
356-
515694B923F4A6E100E7C350 /* RootView.swift in Sources */,
357353
);
358354
runOnlyForDeploymentPostprocessing = 0;
359355
};

Example/Messaging/App/watchOS/SampleWatchApp/SampleWatchAppWatchKitApp/Base.lproj/Interface.storyboard

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,22 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<document type="com.apple.InterfaceBuilder.WatchKit.Storyboard" version="3.0" toolsVersion="14256" targetRuntime="watchKit" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="AgC-eL-Hgc">
2+
<document type="com.apple.InterfaceBuilder.WatchKit.Storyboard" version="3.0" toolsVersion="15505" targetRuntime="watchKit" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="AgC-eL-Hgc">
3+
<device id="watch38"/>
34
<dependencies>
4-
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14243"/>
5-
<plugIn identifier="com.apple.InterfaceBuilder.IBWatchKitPlugin" version="14219"/>
5+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15510"/>
6+
<plugIn identifier="com.apple.InterfaceBuilder.IBWatchKitPlugin" version="15501"/>
67
</dependencies>
78
<scenes>
89
<!--Interface Controller-->
910
<scene sceneID="aou-V4-d1y">
1011
<objects>
11-
<controller id="AgC-eL-Hgc" customClass="InterfaceController" customModuleProvider="target"/>
12+
<controller id="AgC-eL-Hgc" customClass="InterfaceController" customModule="SampleWatchAppWatchKitApp" customModuleProvider="target">
13+
<items>
14+
<imageView width="64" height="60" alignment="left" id="Rhr-bM-Kmk"/>
15+
</items>
16+
<connections>
17+
<outlet property="imageView" destination="Rhr-bM-Kmk" id="4OY-nE-HIh"/>
18+
</connections>
19+
</controller>
1220
</objects>
1321
<point key="canvasLocation" x="220" y="345"/>
1422
</scene>
@@ -32,14 +40,14 @@
3240
<!--Notification Controller-->
3341
<scene sceneID="ZPc-GJ-vnh">
3442
<objects>
35-
<controller id="4sK-HA-Art" customClass="NotificationController" customModuleProvider="target"/>
43+
<controller id="4sK-HA-Art" customClass="NotificationController" customModule="SampleWatchAppWatchKitApp" customModuleProvider="target"/>
3644
</objects>
3745
<point key="canvasLocation" x="468" y="643"/>
3846
</scene>
3947
<!--Notification Controller-->
4048
<scene sceneID="Niz-AI-uX2">
4149
<objects>
42-
<controller id="eXb-UN-Cd0" customClass="NotificationController" customModuleProvider="target"/>
50+
<controller id="eXb-UN-Cd0" customClass="NotificationController" customModule="SampleWatchAppWatchKitApp" customModuleProvider="target"/>
4351
</objects>
4452
<point key="canvasLocation" x="468" y="345"/>
4553
</scene>

Example/Messaging/App/watchOS/SampleWatchApp/SampleWatchAppWatchKitExtension/InterfaceController.swift

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,16 @@
1313
// limitations under the License.
1414

1515
import SwiftUI
16+
import FirebaseStorage
1617

17-
class InterfaceController: WKHostingController<RootView> {
18-
override var body: RootView {
19-
// Return the view structure that the hosting controller displays.
20-
RootView()
18+
class InterfaceController: WKInterfaceController {
19+
@IBOutlet var imageView: WKInterfaceImage!
20+
21+
override func willActivate() {
22+
let storage = Storage.storage()
23+
let storageRef = storage.reference().child("sparky.png")
24+
storageRef.getData(maxSize: 20 * 1024 * 1024) { (data: Data?, error: Error?) in
25+
self.imageView.setImageData(data)
26+
}
2127
}
2228
}

Example/Messaging/App/watchOS/SampleWatchApp/SampleWatchAppWatchKitExtension/RootView.swift

Lines changed: 0 additions & 23 deletions
This file was deleted.

Firebase.podspec

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,11 @@ Simplify your iOS development, grow your user base, and monetize more effectivel
134134
s.subspec 'Storage' do |ss|
135135
ss.dependency 'Firebase/CoreOnly'
136136
ss.dependency 'FirebaseStorage', '~> 3.5.0'
137+
# Standard platforms PLUS watchOS.
138+
ss.ios.deployment_target = '8.0'
139+
ss.osx.deployment_target = '10.11'
140+
ss.tvos.deployment_target = '10.0'
141+
ss.watchos.deployment_target = '6.0'
137142
end
138143

139144
s.subspec 'MLCommon' do |ss|

FirebaseAuthInterop.podspec

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = 'FirebaseAuthInterop'
3-
s.version = '1.0.0'
3+
s.version = '1.1.0'
44
s.summary = 'Interfaces that allow other Firebase SDKs to use Auth functionality.'
55

66
s.description = <<-DESC
@@ -24,6 +24,8 @@ Pod::Spec.new do |s|
2424
s.ios.deployment_target = '8.0'
2525
s.osx.deployment_target = '10.11'
2626
s.tvos.deployment_target = '10.0'
27+
s.watchos.deployment_target = '6.0'
28+
2729
s.source_files = 'Interop/Auth/**/*.h'
2830
s.public_header_files = 'Interop/Auth/Public/*.h'
2931
end

FirebaseStorage.podspec

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = 'FirebaseStorage'
3-
s.version = '3.5.0'
3+
s.version = '3.6.0'
44
s.summary = 'Firebase Storage for iOS (plus community support for macOS and tvOS)'
55

66
s.description = <<-DESC
@@ -19,6 +19,7 @@ Firebase Storage provides robust, secure file uploads and downloads from Firebas
1919
s.ios.deployment_target = '8.0'
2020
s.osx.deployment_target = '10.11'
2121
s.tvos.deployment_target = '10.0'
22+
s.watchos.deployment_target = '6.0'
2223

2324
s.cocoapods_version = '>= 1.4.0'
2425
s.static_framework = true
@@ -29,7 +30,7 @@ Firebase Storage provides robust, secure file uploads and downloads from Firebas
2930
s.ios.framework = 'MobileCoreServices'
3031
s.osx.framework = 'CoreServices'
3132

32-
s.dependency 'FirebaseAuthInterop', '~> 1.0'
33+
s.dependency 'FirebaseAuthInterop', '~> 1.1'
3334
s.dependency 'FirebaseCore', '~> 6.0'
3435
s.dependency 'GTMSessionFetcher/Core', '~> 1.1'
3536
s.pod_target_xcconfig = {

FirebaseStorage/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# unreleased
2+
- [added] Added watchOS support for Firebase Storage. (#4955)
3+
14
# 3.5.0
25
- [changed] Reorganized directory structure (#4573).
36

0 commit comments

Comments
 (0)