-
Notifications
You must be signed in to change notification settings - Fork 617
Initial Code structure for FIS Android SDK #648
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
Changes from 16 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
553bf70
Adding an interface library for Firebase Installations SDK
ankitaj224 2ec4aef
Adding Firebase Installations module
ankitaj224 dca81d0
Adding Firebase Installations module.
ankitaj224 7b4ebcf
Readding .idea files that were deleted in previous commit
ankitaj224 a7696e7
Revert "Adding Firebase Installations module"
ankitaj224 1c50283
Revert "Readding .idea files that were deleted in previous commit"
ankitaj224 c77acd2
Add firebase installations project path
ankitaj224 a32c394
Adding Firebase Installations module.
ankitaj224 73c9e39
Readding .idea files that were deleted in previous commit
ankitaj224 0e8b286
Revert "Adding Firebase Installations module"
ankitaj224 cf37dde
Revert "Readding .idea files that were deleted in previous commit"
ankitaj224 896c748
Add firebase installations project path
ankitaj224 e179da7
Merge branch 'ankita_fis' of github.com:firebase/firebase-android-sdk…
ankitaj224 370b862
Fixing formattinf issues.
ankitaj224 b7b90c5
Merge branch 'master' of github.com:firebase/firebase-android-sdk int…
ankitaj224 d0ce8fa
Revert "Adding Firebase Installations module" with hidden files
ankitaj224 095296b
Addressing review comments.
ankitaj224 ce22251
Making InstallationTokenResult an AutoValue class.
ankitaj224 83d7652
Merge branch 'master' of github.com:firebase/firebase-android-sdk int…
ankitaj224 47cba01
Merge branch 'master' of github.com:firebase/firebase-android-sdk int…
ankitaj224 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
43 changes: 43 additions & 0 deletions
43
firebase-installations-interop/firebase-installations-interop.gradle
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// Copyright 2018 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. | ||
|
||
|
||
plugins { | ||
id 'firebase-library' | ||
} | ||
|
||
firebaseLibrary.publishJavadoc = false | ||
|
||
android { | ||
compileSdkVersion project.targetSdkVersion | ||
defaultConfig { | ||
minSdkVersion project.minSdkVersion | ||
targetSdkVersion project.targetSdkVersion | ||
versionName version | ||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" | ||
} | ||
compileOptions { | ||
sourceCompatibility JavaVersion.VERSION_1_8 | ||
targetCompatibility JavaVersion.VERSION_1_8 | ||
} | ||
testOptions { | ||
unitTests { | ||
includeAndroidResources = true | ||
} | ||
} | ||
} | ||
|
||
dependencies { | ||
implementation 'com.google.android.gms:play-services-tasks:17.0.0' | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
version=17.1.1 |
17 changes: 17 additions & 0 deletions
17
firebase-installations-interop/src/main/AndroidManifest.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- Copyright 2019 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. --> | ||
|
||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.google.firebase.installations.interop" /> | ||
42 changes: 42 additions & 0 deletions
42
...ons-interop/src/main/java/com/google/firebase/installations/FirebaseInstallationsApi.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// Copyright 2019 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. | ||
|
||
package com.google.firebase.installations; | ||
|
||
import com.google.android.gms.tasks.Task; | ||
|
||
/** | ||
* This is an interface of {@code FirebaseInstallations} that is only exposed to 2p via component | ||
* injection. | ||
* | ||
* @hide | ||
*/ | ||
public interface FirebaseInstallationsApi { | ||
|
||
/** | ||
* Async function that returns a globally unique identifier of this Firebase app installation. | ||
* This is a url-safe base64 string of a 128-bit integer. | ||
*/ | ||
Task<String> getId(); | ||
|
||
/** Async function that returns a auth token(public key) of this Firebase app installation. */ | ||
Task<String> getAuthToken(); | ||
ankitaj224 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
/** | ||
* Async function that deletes this Firebase app installation from Firebase backend. This call | ||
* would possibly lead Firebase Notification, Firebase RemoteConfig, Firebase Predictions or | ||
* Firebase In-App Messaging not function properly. | ||
*/ | ||
Task<Void> delete(); | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
// Copyright 2018 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. | ||
|
||
|
||
plugins { | ||
id 'firebase-library' | ||
id 'com.google.protobuf' | ||
ankitaj224 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
protobuf { | ||
// Configure the protoc executable | ||
protoc { | ||
// Download from repositories | ||
artifact = 'com.google.protobuf:protoc:3.4.0' | ||
} | ||
plugins { | ||
grpc { | ||
artifact = 'io.grpc:protoc-gen-grpc-java:1.21.0' | ||
} | ||
javalite { | ||
// The codegen for lite comes as a separate artifact | ||
artifact = 'com.google.protobuf:protoc-gen-javalite:3.0.0' | ||
} | ||
} | ||
generateProtoTasks { | ||
all().each { task -> | ||
task.builtins { | ||
// In most cases you don't need the full Java output | ||
// if you use the lite output. | ||
remove java | ||
} | ||
task.plugins { | ||
grpc { | ||
option 'lite' | ||
} | ||
javalite {} | ||
} | ||
} | ||
} | ||
} | ||
ankitaj224 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
android { | ||
compileSdkVersion project.targetSdkVersion | ||
defaultConfig { | ||
minSdkVersion project.minSdkVersion | ||
targetSdkVersion project.targetSdkVersion | ||
multiDexEnabled true | ||
versionName version | ||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" | ||
} | ||
sourceSets { | ||
main { | ||
proto { | ||
srcDir 'src/main/proto' | ||
} | ||
} | ||
ankitaj224 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
compileOptions { | ||
sourceCompatibility JavaVersion.VERSION_1_8 | ||
targetCompatibility JavaVersion.VERSION_1_8 | ||
} | ||
testOptions { | ||
unitTests { | ||
includeAndroidResources = true | ||
} | ||
} | ||
} | ||
|
||
dependencies { | ||
implementation project(':firebase-common') | ||
implementation project(':firebase-installations-interop') | ||
implementation project(':protolite-well-known-types') | ||
|
||
implementation 'io.grpc:grpc-stub:1.21.0' | ||
implementation 'io.grpc:grpc-protobuf-lite:1.21.0' | ||
implementation 'androidx.appcompat:appcompat:1.0.2' | ||
implementation 'com.squareup.okhttp3:okhttp:3.12.1' | ||
implementation 'androidx.multidex:multidex:2.0.1' | ||
implementation 'com.google.android.gms:play-services-tasks:17.0.0' | ||
|
||
testImplementation 'androidx.test:core:1.2.0' | ||
ankitaj224 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
testImplementation 'junit:junit:4.12' | ||
testImplementation "org.robolectric:robolectric:$robolectricVersion" | ||
|
||
androidTestImplementation 'androidx.test:runner:1.2.0' | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
version=17.1.1 | ||
ankitaj224 marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<lint> | ||
<!--gRPC's DNS name resolver checks for javax.naming at runtime to determine if it can be used, but fails gracefullt without it. This lint error is safe to ignore.--> | ||
<!--See : https://github.com/grpc/grpc-java/blob/b0f423295b4674cb5247a6143fd211b050ef0065/core/src/main/java/io/grpc/internal/JndiResourceResolverFactory.java#L73--> | ||
<issue id="InvalidPackage"> | ||
<ignore path="*/io.grpc/grpc-core/*"/> | ||
</issue> | ||
|
||
<!-- Disable the given check in this project --> | ||
<issue id="GradleCompatible" severity="ignore" /> | ||
</lint> | ||
ankitaj224 marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Add project specific ProGuard rules here. | ||
# You can control the set of applied configuration files using the | ||
# proguardFiles setting in build.gradle. | ||
# | ||
# For more details, see | ||
# http://developer.android.com/guide/developing/tools/proguard.html | ||
|
||
# If your project uses WebView with JS, uncomment the following | ||
# and specify the fully qualified class name to the JavaScript interface | ||
# class: | ||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||
# public *; | ||
#} | ||
|
||
# Uncomment this to preserve the line number information for | ||
# debugging stack traces. | ||
#-keepattributes SourceFile,LineNumberTable | ||
|
||
# If you keep the line number information, uncomment this to | ||
# hide the original source file name. | ||
#-renamesourcefileattribute SourceFile | ||
ankitaj224 marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.google.firebase.installations"> | ||
|
||
<application> | ||
<service | ||
android:name="com.google.firebase.components.ComponentDiscoveryService" | ||
android:exported="false"> | ||
<meta-data | ||
android:name="com.google.firebase.components:com.google.firebase.installations.FirebaseInstallationsRegistrar" | ||
android:value="com.google.firebase.components.ComponentRegistrar" /> | ||
</service> | ||
</application> | ||
</manifest> | ||
ankitaj224 marked this conversation as resolved.
Show resolved
Hide resolved
|
110 changes: 110 additions & 0 deletions
110
...-installations/src/main/java/com/google/firebase/installations/FirebaseInstallations.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
// Copyright 2019 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. | ||
|
||
package com.google.firebase.installations; | ||
|
||
import androidx.annotation.NonNull; | ||
import com.google.android.gms.common.internal.Preconditions; | ||
import com.google.android.gms.tasks.Task; | ||
import com.google.android.gms.tasks.Tasks; | ||
import com.google.common.annotations.VisibleForTesting; | ||
import com.google.firebase.FirebaseApp; | ||
import okhttp3.OkHttpClient; | ||
|
||
/** | ||
* Entry point for Firebase Installations. | ||
* | ||
* <p>Firebase Installations does | ||
* | ||
* <ul> | ||
* <li>provide unique identifier for a Firebase installation | ||
* <li>provide auth token of a Firebase installation | ||
* <li>provide a API to GDPR-delete a Firebase installation | ||
* </ul> | ||
*/ | ||
public class FirebaseInstallations implements FirebaseInstallationsApi { | ||
|
||
ankitaj224 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
private final OkHttpClient httpClient; | ||
|
||
private final FirebaseApp firebaseApp; | ||
|
||
/** package private constructor. */ | ||
FirebaseInstallations(FirebaseApp firebaseApp) { | ||
this.firebaseApp = firebaseApp; | ||
httpClient = new OkHttpClient(); | ||
} | ||
|
||
/** | ||
* Returns the {@link FirebaseInstallationsApi} initialized with the default {@link FirebaseApp}. | ||
* | ||
* @return a {@link FirebaseInstallationsApi} instance | ||
*/ | ||
@NonNull | ||
public static FirebaseInstallations getInstance() { | ||
FirebaseApp defaultFirebaseApp = FirebaseApp.getInstance(); | ||
return getInstance(defaultFirebaseApp); | ||
} | ||
|
||
/** | ||
* Returns the {@link FirebaseInstallations} initialized with a custom {@link FirebaseApp}. | ||
* | ||
* @param app a custom {@link FirebaseApp} | ||
* @return a {@link FirebaseInstallations} instance | ||
*/ | ||
@NonNull | ||
public static FirebaseInstallations getInstance(@NonNull FirebaseApp app) { | ||
Preconditions.checkArgument(app != null, "Null is not a valid value of FirebaseApp."); | ||
return (FirebaseInstallations) app.get(FirebaseInstallationsApi.class); | ||
} | ||
|
||
/** | ||
* Returns a globally unique identifier of this Firebase app installation. This is a url-safe | ||
* base64 string of a 128-bit integer. | ||
*/ | ||
@NonNull | ||
@Override | ||
public Task<String> getId() { | ||
return Tasks.forResult("fid-is-better-than-iid"); | ||
} | ||
|
||
/** Returns a auth token(public key) of this Firebase app installation. */ | ||
@NonNull | ||
@Override | ||
public Task<String> getAuthToken() { | ||
return Tasks.forResult("dummy_auth_token"); | ||
} | ||
|
||
/** | ||
* Call to delete this Firebase app installation from Firebase backend. This call would possibly | ||
* lead Firebase Notification, Firebase RemoteConfig, Firebase Predictions or Firebase In-App | ||
* Messaging not function properly. | ||
*/ | ||
@NonNull | ||
@Override | ||
public Task<Void> delete() { | ||
return Tasks.forResult(null); | ||
} | ||
|
||
/** Returns the application id of the {@link FirebaseApp} of this {@link FirebaseInstallations} */ | ||
@VisibleForTesting | ||
String getApplicationId() { | ||
return firebaseApp.getOptions().getApplicationId(); | ||
} | ||
|
||
/** Returns the nick name of the {@link FirebaseApp} of this {@link FirebaseInstallations} */ | ||
@VisibleForTesting | ||
String getName() { | ||
return firebaseApp.getName(); | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.