Skip to content
Merged
Show file tree
Hide file tree
Changes from 37 commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
6210292
add nanopb files for messaging
charlotteliang Jul 22, 2020
f8a096a
fix nanopb data encode/decode
charlotteliang Jul 23, 2020
10fde21
add extension to test app
charlotteliang Jul 27, 2020
806e046
update proto files
charlotteliang Jul 29, 2020
e5f744b
add a gdt proto for comparison
charlotteliang Jul 29, 2020
a715889
proto3 to proto2
charlotteliang Jul 31, 2020
a183392
resolve conflicts
charlotteliang Jul 31, 2020
1d33294
add test code for easy calling the problem function
charlotteliang Jul 31, 2020
58bd024
use the same proto as gdt as a debug example
charlotteliang Aug 3, 2020
8b3ca97
add nanopb files
charlotteliang Aug 3, 2020
e9e12f0
fix typo in podspec
charlotteliang Aug 4, 2020
021d957
figure out issue on encoding revert back logging logic
charlotteliang Aug 4, 2020
a77c872
adding data message testing on test app
charlotteliang Aug 6, 2020
7a72d75
define constant string for easy management;
charlotteliang Aug 6, 2020
a944ce3
add unit test
charlotteliang Aug 11, 2020
a35ca7d
merge conflict
charlotteliang Oct 8, 2020
ebc9ea1
update the nanopb version
charlotteliang Oct 8, 2020
d8fdaba
fix breakage
charlotteliang Oct 13, 2020
53f4c25
remove trailing whitespace
charlotteliang Oct 14, 2020
0dcafb0
fix copywrite
charlotteliang Oct 14, 2020
637bd0a
Merge branch 'master' of github.com:firebase/firebase-ios-sdk into fm…
charlotteliang Oct 14, 2020
8328bb3
update google data transporter header
charlotteliang Oct 15, 2020
ea0e001
update proto header
charlotteliang Oct 15, 2020
1c023f8
fix header source
charlotteliang Oct 19, 2020
e9f989f
fix test breakage
charlotteliang Oct 19, 2020
2302200
fix the header for SPM
charlotteliang Oct 20, 2020
ac1e206
cleanup format
charlotteliang Oct 20, 2020
682d90d
resolve conflicts from master
charlotteliang Feb 11, 2021
ceaac79
merge conflicts
charlotteliang Feb 12, 2021
7b77b8c
merge conflict
charlotteliang May 13, 2021
f033ca1
resolve conflict
charlotteliang May 27, 2021
5b07bc8
Merge branch 'master' of github.com:firebase/firebase-ios-sdk into fm…
charlotteliang Jun 2, 2021
f4b5d9d
fix test header
charlotteliang Jun 2, 2021
f742507
clang format
charlotteliang Jun 3, 2021
2e073ff
add missing dependency in SPM to fix breakage
charlotteliang Jun 3, 2021
de88f99
remove service extension target from regular sample app since advance…
charlotteliang Jun 3, 2021
55ebe19
fix a breakage in watchos test
charlotteliang Jun 4, 2021
fe7da0c
merge with master
charlotteliang Jul 13, 2021
f656526
fm-firelog
charlotteliang Jul 21, 2021
10753dd
merge conflicts
charlotteliang Jul 21, 2021
641dd67
merge conflict
charlotteliang Jul 21, 2021
8660466
update version number
charlotteliang Jul 21, 2021
adec968
remove unused header
charlotteliang Jul 21, 2021
9b022b2
fix tvOS breakage
charlotteliang Jul 21, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion FirebaseMessaging.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,22 @@ device, and it is completely free.

base_dir = "FirebaseMessaging/"
s.source_files = [
base_dir + 'Sources/**/*.[mh]',
base_dir + 'Sources/**/*',
base_dir + 'Sources/Protogen/nanopb/*.h',
'Interop/Analytics/Public/*.h',
'FirebaseCore/Sources/Private/*.h',
'FirebaseInstallations/Source/Library/Private/*.h',
'GoogleDataTransport/Public/*.h',
]
s.public_header_files = base_dir + 'Sources/Public/FirebaseMessaging/*.h'
s.library = 'sqlite3'
s.pod_target_xcconfig = {
'GCC_C_LANGUAGE_STANDARD' => 'c99',
'GCC_PREPROCESSOR_DEFINITIONS' =>
'GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS=1 ' +
'FIRMessaging_LIB_VERSION=' + String(s.version) +
# for nanopb:
' PB_FIELD_32BIT=1 PB_NO_PACKED_STRUCTS=1 PB_ENABLE_MALLOC=1',
# Unit tests do library imports using repo-root relative paths.
'HEADER_SEARCH_PATHS' => '"${PODS_TARGET_SRCROOT}"',
}
Expand All @@ -57,6 +64,8 @@ device, and it is completely free.
s.dependency 'GoogleUtilities/Reachability', '~> 7.4'
s.dependency 'GoogleUtilities/Environment', '~> 7.4'
s.dependency 'GoogleUtilities/UserDefaults', '~> 7.4'
s.dependency 'GoogleDataTransport', '~> 9.0'
s.dependency 'nanopb', '~> 2.30908.0'

s.test_spec 'unit' do |unit_tests|
unit_tests.scheme = { :code_coverage => true }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,14 @@
5194496E258AF2D000297021 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 5194496D258AF2D000297021 /* Preview Assets.xcassets */; };
51944B28258B091A00297021 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 51944B27258B091A00297021 /* GoogleService-Info.plist */; };
51944B9D258B136000297021 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 51944B9C258B136000297021 /* Assets.xcassets */; };
51944BE1258BE42F00297021 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 51944BE0258BE42F00297021 /* GoogleService-Info.plist */; };
51A1F3A525883DCF0025932B /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 51A1F3A425883DCF0025932B /* Preview Assets.xcassets */; };
51A1F3B125883E370025932B /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51A1F3B025883E370025932B /* AppDelegate.swift */; };
51A1F3B525883E630025932B /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51A1F3B425883E630025932B /* SceneDelegate.swift */; };
51A1F3B825883E810025932B /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51A1F3B725883E810025932B /* ContentView.swift */; };
51A1F3C625883EF60025932B /* Identity.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51A1F3C525883EF60025932B /* Identity.swift */; };
51A1F3CA25883EFF0025932B /* UserSettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51A1F3C825883EFF0025932B /* UserSettings.swift */; };
51A1F3CB25883EFF0025932B /* TopicView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51A1F3C925883EFF0025932B /* TopicView.swift */; };
51A1F3CE25883FAD0025932B /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 51A1F3CD25883FAD0025932B /* GoogleService-Info.plist */; };
51C21D212667FBCE0079AEEE /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 51C21D202667FBCE0079AEEE /* GoogleService-Info.plist */; };
51C24C622589603800236F25 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 51C24C602589603800236F25 /* LaunchScreen.storyboard */; };
51C24C652589606B00236F25 /* logo.png in Resources */ = {isa = PBXBuildFile; fileRef = 51C24C642589606B00236F25 /* logo.png */; };
/* End PBXBuildFile section */
Expand Down Expand Up @@ -149,7 +148,6 @@
51944A86258B012A00297021 /* SampleWatchWatchKitExtension.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = SampleWatchWatchKitExtension.entitlements; sourceTree = "<group>"; };
51944B27258B091A00297021 /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = "<group>"; };
51944B9C258B136000297021 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Assets.xcassets; path = ../../Shared/Assets.xcassets; sourceTree = "<group>"; };
51944BE0258BE42F00297021 /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = "<group>"; };
51A1F39825883DCE0025932B /* AdvancedSample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = AdvancedSample.app; sourceTree = BUILT_PRODUCTS_DIR; };
51A1F3A425883DCF0025932B /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = "<group>"; };
51A1F3A925883DCF0025932B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
Expand All @@ -159,7 +157,7 @@
51A1F3C525883EF60025932B /* Identity.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Identity.swift; path = ../../Shared/Identity.swift; sourceTree = "<group>"; };
51A1F3C825883EFF0025932B /* UserSettings.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = UserSettings.swift; path = ../../Shared/UserSettings.swift; sourceTree = "<group>"; };
51A1F3C925883EFF0025932B /* TopicView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = TopicView.swift; path = ../../Shared/TopicView.swift; sourceTree = "<group>"; };
51A1F3CD25883FAD0025932B /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "GoogleService-Info.plist"; path = "../../Shared/GoogleService-Info.plist"; sourceTree = "<group>"; };
51C21D202667FBCE0079AEEE /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "GoogleService-Info.plist"; path = "../../Shared/GoogleService-Info.plist"; sourceTree = "<group>"; };
51C24C612589603800236F25 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = ../../Shared/Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
51C24C642589606B00236F25 /* logo.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = logo.png; path = ../../Shared/logo.png; sourceTree = "<group>"; };
/* End PBXFileReference section */
Expand Down Expand Up @@ -253,7 +251,6 @@
51944961258AF2D000297021 /* SampleWatchWatchKitExtension */ = {
isa = PBXGroup;
children = (
51944BE0258BE42F00297021 /* GoogleService-Info.plist */,
51944A86258B012A00297021 /* SampleWatchWatchKitExtension.entitlements */,
51944962258AF2D000297021 /* HostingController.swift */,
51944964258AF2D000297021 /* ContentView.swift */,
Expand Down Expand Up @@ -303,10 +300,10 @@
51A1F39A25883DCE0025932B /* AdvancedSample */ = {
isa = PBXGroup;
children = (
51C21D202667FBCE0079AEEE /* GoogleService-Info.plist */,
519448DE2589900400297021 /* AdvancedSample.entitlements */,
51C24C642589606B00236F25 /* logo.png */,
51C24C602589603800236F25 /* LaunchScreen.storyboard */,
51A1F3CD25883FAD0025932B /* GoogleService-Info.plist */,
51A1F3C925883EFF0025932B /* TopicView.swift */,
51A1F3C825883EFF0025932B /* UserSettings.swift */,
51A1F3C525883EF60025932B /* Identity.swift */,
Expand Down Expand Up @@ -539,17 +536,16 @@
files = (
5194496E258AF2D000297021 /* Preview Assets.xcassets in Resources */,
5194496B258AF2D000297021 /* Assets.xcassets in Resources */,
51944BE1258BE42F00297021 /* GoogleService-Info.plist in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
51A1F39625883DCE0025932B /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
51A1F3CE25883FAD0025932B /* GoogleService-Info.plist in Resources */,
51C24C652589606B00236F25 /* logo.png in Resources */,
51C24C622589603800236F25 /* LaunchScreen.storyboard in Resources */,
51C21D212667FBCE0079AEEE /* GoogleService-Info.plist in Resources */,
51A1F3A525883DCF0025932B /* Preview Assets.xcassets in Resources */,
51944B9D258B136000297021 /* Assets.xcassets in Resources */,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ class NotificationService: UNNotificationServiceExtension {
// Modify the notification content here...
bestAttemptContent.title = "\(bestAttemptContent.title) 👩🏻‍💻"

// Log Delivery signals and export to BigQuery.
Messaging.serviceExtension()
.exportDeliveryMetricsToBigQuery(withMessageInfo: request.content.userInfo)

// Add image, call this last to finish with the content handler.
Messaging.serviceExtension()
.populateNotificationContent(bestAttemptContent, withContentHandler: contentHandler)
}
Expand Down
1 change: 1 addition & 0 deletions FirebaseMessaging/Apps/AdvancedSample/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ def shared_pods
pod 'FirebaseMessaging', :path => '../../../'
pod 'FirebaseCoreDiagnostics', :path => '../../../'
pod 'FirebaseInstallations', :path => '../../../'
pod 'GoogleDataTransport'
end

target 'AdvancedSample' do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 51;
objectVersion = 50;
objects = {

/* Begin PBXBuildFile section */
Expand All @@ -15,7 +15,6 @@
51A1F3DB2588405A0025932B /* TopicView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51A1F3D72588405A0025932B /* TopicView.swift */; };
51A1F3DC2588405A0025932B /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51A1F3D82588405A0025932B /* SceneDelegate.swift */; };
51A1F3E12588406A0025932B /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51A1F3DE2588406A0025932B /* AppDelegate.swift */; };
51A1F3E22588406A0025932B /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 51A1F3DF2588406A0025932B /* GoogleService-Info.plist */; };
51A1F3E32588406A0025932B /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51A1F3E02588406A0025932B /* ContentView.swift */; };
51C24C5225894EDB00236F25 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 51C24C5025894EDB00236F25 /* LaunchScreen.storyboard */; };
51C24C742589614800236F25 /* logo.png in Resources */ = {isa = PBXBuildFile; fileRef = 51C24C732589614800236F25 /* logo.png */; };
Expand All @@ -33,7 +32,6 @@
51A1F3D72588405A0025932B /* TopicView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = TopicView.swift; path = ../../Shared/TopicView.swift; sourceTree = "<group>"; };
51A1F3D82588405A0025932B /* SceneDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SceneDelegate.swift; path = ../../Shared/SceneDelegate.swift; sourceTree = "<group>"; };
51A1F3DE2588406A0025932B /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = AppDelegate.swift; path = ../../Shared/AppDelegate.swift; sourceTree = "<group>"; };
51A1F3DF2588406A0025932B /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "GoogleService-Info.plist"; path = "../../Shared/GoogleService-Info.plist"; sourceTree = "<group>"; };
51A1F3E02588406A0025932B /* ContentView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ContentView.swift; path = ../../Shared/ContentView.swift; sourceTree = "<group>"; };
51C24C5125894EDB00236F25 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = ../../Shared/Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
51C24C732589614800236F25 /* logo.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = logo.png; path = ../../Shared/logo.png; sourceTree = "<group>"; };
Expand Down Expand Up @@ -81,7 +79,6 @@
51C24C5025894EDB00236F25 /* LaunchScreen.storyboard */,
51A1F3DE2588406A0025932B /* AppDelegate.swift */,
51A1F3E02588406A0025932B /* ContentView.swift */,
51A1F3DF2588406A0025932B /* GoogleService-Info.plist */,
51A1F3D52588405A0025932B /* Identity.swift */,
51A1F3D82588405A0025932B /* SceneDelegate.swift */,
51A1F3D72588405A0025932B /* TopicView.swift */,
Expand Down Expand Up @@ -162,7 +159,6 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
51A1F3E22588406A0025932B /* GoogleService-Info.plist in Resources */,
51C24C742589614800236F25 /* logo.png in Resources */,
5125CCA92437F472006CA5D0 /* Preview Assets.xcassets in Resources */,
51C24C5225894EDB00236F25 /* LaunchScreen.storyboard in Resources */,
Expand Down
4 changes: 4 additions & 0 deletions FirebaseMessaging/Apps/Sample/Sample/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@
</array>
</dict>
</dict>
<key>UIBackgroundModes</key>
<array>
<string>remote-notification</string>
</array>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIRequiredDeviceCapabilities</key>
Expand Down
13 changes: 13 additions & 0 deletions FirebaseMessaging/Apps/Shared/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

import UIKit
import FirebaseCore
import FirebaseMessaging
import FirebaseAnalytics

@UIApplicationMain
Expand All @@ -22,6 +23,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
didFinishLaunchingWithOptions launchOptions: [UIApplication
.LaunchOptionsKey: Any]?) -> Bool {
FirebaseApp.configure()
application.delegate = self
FirebaseAnalytics.Analytics.logEvent("test", parameters: nil)

let center = UNUserNotificationCenter.current()
Expand All @@ -33,6 +35,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
}
}
application.registerForRemoteNotifications()

return true
}

Expand All @@ -49,4 +52,14 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
withCompletionHandler completionHandler: @escaping () -> Void) {
completionHandler()
}

func application(_ application: UIApplication,
didReceiveRemoteNotification userInfo: [AnyHashable: Any],
fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult)
-> Void) {
print("Hidden message arrived:\n" + userInfo.debugDescription)
// Log delivery signal for data/hidden/background messages
Messaging.serviceExtension().exportDeliveryMetricsToBigQuery(withMessageInfo: userInfo)
completionHandler(.newData)
}
}
3 changes: 3 additions & 0 deletions FirebaseMessaging/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# unreleased
- [added] Added new API `FIRMessagingExtensionHelper exportDeliveryMetricsToBigQuery` that allows developers to enable notification delivery metrics to BigQuery. (#6181)

# 2021-05 -- v8.1.0
- [fixed] Fixed an issue that notification open is not logged to Analytics correctly when app is completely shut off. (#7707, #8128).

Expand Down
22 changes: 22 additions & 0 deletions FirebaseMessaging/ProtoSupport/Protos/me.options
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Copyright 2020 Google
#
# 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.
#

# Options for mee.protos
fm.MessagingClientEvent.message_id type:FT_POINTER
fm.MessagingClientEvent.instance_id type:FT_POINTER
fm.MessagingClientEvent.package_name type:FT_POINTER
fm.MessagingClientEvent.analytics_label type:FT_POINTER
fm.MessagingClientEvent.composer_label type:FT_POINTER
fm.MessagingClientEventExtension.messaging_client_event type:FT_POINTER
66 changes: 66 additions & 0 deletions FirebaseMessaging/ProtoSupport/Protos/me.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
//
// Copyright 2020 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.
//

syntax = "proto3";

package fm;

message MessagingClientEvent {

int64 project_number = 1;

string message_id = 2;

string instance_id = 3;

enum MessageType {
UNKNOWN = 0;
DATA_MESSAGE = 1;
TOPIC = 2;
DISPLAY_NOTIFICATION = 3;
}

MessageType message_type = 4;

enum SDKPlatform {
UNKNOWN_OS = 0;
ANDROID = 1;
IOS = 2;
WEB = 3;
}

SDKPlatform sdk_platform = 5;

string package_name = 6;

enum Event {
UNKNOWN_EVENT = 0;
MESSAGE_DELIVERED = 1;
MESSAGE_OPEN = 2;
}

Event event = 12;

string analytics_label = 13;

int64 campaign_id = 14;

string composer_label = 15;
}

message MessagingClientEventExtension {
MessagingClientEvent messaging_client_event = 1;
}
56 changes: 56 additions & 0 deletions FirebaseMessaging/ProtoSupport/generate_protos.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!/bin/bash

# Copyright 2020 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.
#

# Example usage:
# ./generate_protos.sh <path to nanopb>

# Dependencies: git, protobuf, python-protobuf, pyinstaller

readonly DIR="$( git rev-parse --show-toplevel )"

# Current release of nanopb being used to build the CCT protos
readonly NANOPB_VERSION="0.3.9.5"
readonly NANOPB_TEMPDIR="${DIR}/FirebaseMessaging/nanopb_temp"

readonly LIBRARY_DIR="${DIR}/FirebaseMessaging/Sources/"
readonly PROTO_DIR="${DIR}/FirebaseMessaging/ProtoSupport/Protos/"
readonly PROTOGEN_DIR="${LIBRARY_DIR}/Protogen/"

rm -rf "${NANOPB_TEMPDIR}"

echo "Downloading nanopb..."
git clone --branch "${NANOPB_VERSION}" https://github.com/nanopb/nanopb.git "${NANOPB_TEMPDIR}"

echo "Building nanopb..."
pushd "${NANOPB_TEMPDIR}"
./tools/make_mac_package.sh
GIT_DESCRIPTION=`git describe --always`-macosx-x86
NANOPB_BIN_DIR="dist/${GIT_DESCRIPTION}"
popd

echo "Removing existing ME protos..."
rm -rf "${PROTOGEN_DIR}/*"

echo "Generating ME protos..."
python "${DIR}/FirebaseMessaging/ProtoSupport/proto_generator.py" \
--nanopb \
--protos_dir="${PROTO_DIR}" \
--pythonpath="${NANOPB_TEMPDIR}/${NANOPB_BIN_DIR}/generator" \
--output_dir="${PROTOGEN_DIR}" \
--include="${PROTO_DIR}"

rm -rf "${NANOPB_TEMPDIR}"
Loading