Skip to content

Adding Util class for FIrebaseInstallations APIs. #676

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

Merged
merged 47 commits into from
Aug 30, 2019
Merged

Conversation

ankitaj224
Copy link
Contributor

No description provided.

* Adding an interface library for Firebase Installations SDK

* Adding Firebase Installations module

* Adding Firebase Installations module.

* Readding .idea files that were deleted in previous commit

* Revert "Adding Firebase Installations module"

This reverts commit 2ec4aef.

* Revert "Readding .idea files that were deleted in previous commit"

This reverts commit 7b4ebcf.

* Add firebase installations project path

* Adding Firebase Installations module.

* Readding .idea files that were deleted in previous commit

* Revert "Adding Firebase Installations module"

This reverts commit 2ec4aef.

* Revert "Readding .idea files that were deleted in previous commit"

This reverts commit 7b4ebcf.

* Add firebase installations project path

* Fixing formattinf issues.

* Revert "Adding Firebase Installations module" with hidden files

This reverts commit 2ec4aef.

* Addressing review comments.

* Making InstallationTokenResult an AutoValue class.
Copy link
Member

@vkryachko vkryachko left a comment

Choose a reason for hiding this comment

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

Looks like this PR contains a lot of code, some of which I'd previously reviewed for @diwu-arete . Can you make a PR that only contains new changes? otherwise the PR is too big and I am not sure which parts to review and which to skip


public enum Status {
SDK_INTERNAL_ERROR,

Copy link
Contributor

Choose a reason for hiding this comment

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

I suggest to sync with mertcan@ or Rayo about what status we want to expose to dev

Copy link
Contributor Author

@ankitaj224 ankitaj224 Aug 7, 2019

Choose a reason for hiding this comment

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

@andirayo or @mmermerkaya Whats the high level exception code to be shown to developers in case FIS requests fail? Currently, I have SDK_INTERNAL_ERROR.

Copy link
Contributor

Choose a reason for hiding this comment

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

I would check with Mertcan's Web-SDK or Maksym's iOS-SDK, but as far as I remember (without checking) I think we are pretty explicit with our error messages.
There are some error messages we receive from the server that our SDK reacts to by resending the same request once. If we can not fix the error, we print a pretty descriptive error message for the developer to be able to understand and fix.

@ankitaj224 ankitaj224 changed the title Implement getId method in FIrebaseInstallation to interact with cache and backend. Adding util class for FIrebaseInstallation APIs. Aug 7, 2019
@ankitaj224 ankitaj224 changed the title Adding util class for FIrebaseInstallation APIs. Adding Util class for FIrebaseInstallation APIs. Aug 7, 2019
@@ -91,16 +91,16 @@ public InstallationResponse createFirebaseInstallation(
return readCreateResponse(httpsURLConnection);
case 401:
throw new FirebaseInstallationServiceException(
UNAUTHORIZED_ERROR_MESSAGE, FirebaseInstallationServiceException.Code.UNAUTHORIZED);
UNAUTHORIZED_ERROR_MESSAGE, FirebaseInstallationServiceException.Status.UNAUTHORIZED);
default:
Copy link
Contributor

Choose a reason for hiding this comment

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

Can this ever happen?
How is this a Server-Error?
Seems that this is a client error for not catching all possible error codes.
I think, we should give more information to the developer what is happening here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added a TODO in FirebaseInstallationsException class. I will send out another PR for exception handling changes.

@@ -19,39 +19,38 @@

/** The class for all Exceptions thrown by {@link FirebaseInstallationServiceClient}. */
public class FirebaseInstallationServiceException extends FirebaseException {

public enum Code {
public enum Status {
SERVER_ERROR,

NETWORK_ERROR,

UNAUTHORIZED
Copy link
Contributor

Choose a reason for hiding this comment

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

what about INVALID_ARGUMENT, FORBIDDEN, NOT_FOUND, TOO_MANY_REQUEST?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will handle this in another PR.

FirebaseApp.initializeApp(
ApplicationProvider.getApplicationContext(),
new FirebaseOptions.Builder().setApplicationId("1:987654321:android:abcdef").build(),
"firebase_app_1");
Copy link
Contributor

Choose a reason for hiding this comment

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

this seems to cover 2 tests in once:
i.e. getting a different instance for a different App-ID, but also getting a different instance for different (nick)name.
Maybe those can be distinguished into 2 separate tests, i.e getting a different instance for different App-ID, and one getting different instance for different (nick)name?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We are not able to create a diff firebase app with different App-ID without a nick-name. As a result, they cant be split in two. On a high level test the instance creation.

Copy link
Contributor

@andirayo andirayo left a comment

Choose a reason for hiding this comment

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

The title for this commit/PR is missing an "s"! haha

@ankitaj224 ankitaj224 changed the title Adding Util class for FIrebaseInstallation APIs. Adding Util class for FIrebaseInstallations APIs. Aug 14, 2019
@ankitaj224
Copy link
Contributor Author

The title for this commit/PR is missing an "s"! haha

Updated.

* getId() implementation with instrumented tests.

* Addressing rayo's comments.
- Detailed JavaDocs
- Renaming FiidCache as PersistedFid

* Addressing rayo's comments.
- Detailed JavaDocs
- Renaming FiidCache as PersistedFid

* Addresing comments to resoleve the following:
- Make registerAnsSaveFid non blocking call in getId()
- PersistedFidEntry builder with default values

* Addressing Ciaran and Rayo's comments.

* Addressing Ciaran's comments

* Addressing Ciaran's comments

* Adding param comments and checking if registration status is valid.

* Correcting lint warning: uses-permission should be declared before
application in AndroidManifest.xml

* Adding custom assertThat with more readable assertions

* Correcting instrumented tests to be reliable.
@google-oss-bot
Copy link
Contributor

@ankitaj224: The following test failed, say /retest to rerun them all:

Test name Commit Details Rerun command
api-information 429581e link /test api-information

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@ankitaj224 ankitaj224 merged commit 77b6d97 into fis_sdk Aug 30, 2019
@ankitaj224 ankitaj224 deleted the ankita_fis branch August 30, 2019 21:48
ankitaj224 added a commit that referenced this pull request Sep 5, 2019
* Adding Firebase Installations module

* Readding .idea files that were deleted in previous commit

* Revert "Adding Firebase Installations module"

This reverts commit 2ec4aef.

* Revert "Readding .idea files that were deleted in previous commit"

This reverts commit 7b4ebcf.

* Adding Firebase Installations module.

* Readding .idea files that were deleted in previous commit

* Revert "Readding .idea files that were deleted in previous commit"

This reverts commit 7b4ebcf.

* Revert "Adding Firebase Installations module" with hidden files

This reverts commit 2ec4aef.

* Addressing review comments.

* Http client to call FIS backend service.

* Http client to call FIS backend service.

* Http client to call FIS backend service.

* Adding Firebase Installations module

* Adding Firebase Installations module.

* Readding .idea files that were deleted in previous commit

* Readding .idea files that were deleted in previous commit

* Revert "Adding Firebase Installations module"

This reverts commit 2ec4aef.

* Revert "Readding .idea files that were deleted in previous commit"

This reverts commit 7b4ebcf.

* Revert "Readding .idea files that were deleted in previous commit"

This reverts commit 7b4ebcf.

* Revert "Adding Firebase Installations module" with hidden files

This reverts commit 2ec4aef.

* Addressing review comments.

* Http client to call FIS backend service.

* Http client to call FIS backend service.

* Initial Code structure for FIS Android SDK (#648)

* Adding an interface library for Firebase Installations SDK

* Adding Firebase Installations module

* Adding Firebase Installations module.

* Readding .idea files that were deleted in previous commit

* Revert "Adding Firebase Installations module"

This reverts commit 2ec4aef.

* Revert "Readding .idea files that were deleted in previous commit"

This reverts commit 7b4ebcf.

* Add firebase installations project path

* Adding Firebase Installations module.

* Readding .idea files that were deleted in previous commit

* Revert "Adding Firebase Installations module"

This reverts commit 2ec4aef.

* Revert "Readding .idea files that were deleted in previous commit"

This reverts commit 7b4ebcf.

* Add firebase installations project path

* Fixing formattinf issues.

* Revert "Adding Firebase Installations module" with hidden files

This reverts commit 2ec4aef.

* Addressing review comments.

* Making InstallationTokenResult an AutoValue class.

* Http client to call FIS backend service.

* Addresing comments and introducing new FirebaseInstallationService
Exception.

* Implementing getId method in FirebaseInstallation to call backend.

* 1. Adding instrumentation tests.
2. Introducing serviceClient level and main class exceptions.

* Addressing Di's comments.

* Addressing Rayo's comments

* Updating parameters order in ServiceClient.

* Updating createRandomFid as per Rayo's comments.

* getId() implementation with instrumented tests. (#703)

* getId() implementation with instrumented tests.

* Addressing rayo's comments.
- Detailed JavaDocs
- Renaming FiidCache as PersistedFid

* Addressing rayo's comments.
- Detailed JavaDocs
- Renaming FiidCache as PersistedFid

* Addresing comments to resoleve the following:
- Make registerAnsSaveFid non blocking call in getId()
- PersistedFidEntry builder with default values

* Addressing Ciaran and Rayo's comments.

* Addressing Ciaran's comments

* Addressing Ciaran's comments

* Adding param comments and checking if registration status is valid.

* Correcting lint warning: uses-permission should be declared before
application in AndroidManifest.xml

* Adding custom assertThat with more readable assertions

* Correcting instrumented tests to be reliable.
@firebase firebase locked and limited conversation to collaborators Oct 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants