Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Messaging Token API for review #6313

Merged
merged 17 commits into from
Sep 14, 2020
Merged

Messaging Token API for review #6313

merged 17 commits into from
Sep 14, 2020

Conversation

charlotteliang
Copy link
Contributor

@charlotteliang charlotteliang commented Aug 20, 2020

Adding new getToken and deleteToken API in Messaging so we can migrate users to start using them to handle FCM registration token instead of using InstanceID.
Also add a new deleteWithCompletion: method for GDPR delete to replace InstanceID.delete. This method deletes all the tokens and checkin data that FIS.deleteWithCompletion: doesn't do. Developers should call both to handle GDPR delete for messaging.

minor:

  • Fixed an issue that when passing a wildcard "*" sender ID in delete token request, we don't notify users that tokens are deleted.
  • Adjust the test app to have buttons control token handling from instanceID, Messaging and Installations for easy testing.
Copy link
Contributor

@maksymmalyhin maksymmalyhin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

FirebaseMessaging/Sources/FIRMessaging.m Show resolved Hide resolved
@charlotteliang
Copy link
Contributor Author

After running the script/style.sh, the swift interface changes from
NS_SWIFT_NAME(delete(completion:));
to
NS_SWIFT_NAME(delete (completion:));
with a warning in xcode 'swift_name' attribute has invalid identifier for base name"

If I rename something like deleteBlahBlah(completion:), clang format won't format it with a space after that, which has no warning in xcode.

However, I do prefer to use deleteWithCompletion: to be consistent with FIS: https://github.com/firebase/firebase-ios-sdk/blob/master/FirebaseInstallations/Source/Library/Public/FirebaseInstallations/FIRInstallations.h#L116

I can't ignore the format as it won't pass presubmit.

/**
* Asynchronously getting the default FCM registration token.
*
* This creates a Firebase Installations ID, if one does not exist, and sends information
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does the Installations ID relate to the FCM registration token?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually I just realize this call doesn't necessarily creates a FID, FID is always existed in the client. @gsakakihara
So I don't think we need to state here what FID's impact on user info collecting, but we should mention the registration token's impact on this.
@andirayo @egilmorez

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like FIS has changed to not auto generated anymore #5656 to keep consistent behavior between android and iOS. The installations ID is only created if some product or developers request it.

FirebaseMessaging/Sources/Public/FIRMessaging.h Outdated Show resolved Hide resolved
FirebaseMessaging/Sources/Public/FIRMessaging.h Outdated Show resolved Hide resolved
@paulb777
Copy link
Member

paulb777 commented Sep 1, 2020

See https://github.com/nicklockwood/SwiftFormat#:~:text=You%20can%20disable%20rules%20for,...%5D%5D for disabling swiftformat in local areas.

Interested in @ryanwilson's perspective on this.

Copy link

@egilmorez egilmorez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some style things for you, thanks!

FirebaseMessaging/Sources/Public/FIRMessaging.h Outdated Show resolved Hide resolved
FirebaseMessaging/Sources/Public/FIRMessaging.h Outdated Show resolved Hide resolved
FirebaseMessaging/Sources/Public/FIRMessaging.h Outdated Show resolved Hide resolved
FirebaseMessaging/Sources/Public/FIRMessaging.h Outdated Show resolved Hide resolved
FirebaseMessaging/Sources/Public/FIRMessaging.h Outdated Show resolved Hide resolved
FirebaseMessaging/Sources/Public/FIRMessaging.h Outdated Show resolved Hide resolved
FirebaseMessaging/Sources/Public/FIRMessaging.h Outdated Show resolved Hide resolved
FirebaseMessaging/Sources/Public/FIRMessaging.h Outdated Show resolved Hide resolved
FirebaseMessaging/Sources/Public/FIRMessaging.h Outdated Show resolved Hide resolved
FirebaseMessaging/Sources/Public/FIRMessaging.h Outdated Show resolved Hide resolved
Copy link

@egilmorez egilmorez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Chen!

@@ -221,7 +221,7 @@ struct ContentView: View {
}

func deleteFCM() {
Messaging.messaging().delete { error in
Messaging.messaging().deleteData { error in
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ryanwilson After renaming, the swift API calls it deleteData, does that look good to you? or I should rename swift API to deleteMessagingData as well?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me - thanks!

@charlotteliang charlotteliang changed the title [Draft] Messaging Token API for review Sep 14, 2020
@charlotteliang charlotteliang merged commit 15198dc into master Sep 14, 2020
@charlotteliang charlotteliang deleted the fm-token-api branch September 14, 2020 23:46
@firebase firebase locked and limited conversation to collaborators Oct 15, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.