Skip to content

Commit

Permalink
[v6] Implement ML-Kit Natural Language (invertase#2117)
Browse files Browse the repository at this point in the history
 - Implement ML-Kit Natural Language (invertase#2117)
 - Includes additional refactor changes across other modules for internals api reworking
  • Loading branch information
Salakar authored Jun 2, 2019
1 parent cf6cd85 commit f5e441c
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 26 deletions.
10 changes: 10 additions & 0 deletions android/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# editorconfig
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ project.ext {
],

firebase : [
auth: "16.2.1"
auth: "17.0.0"
],
],
])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -439,12 +439,12 @@ public void sendPasswordResetEmail(
if (actionCodeSettings == null) {
firebaseAuth
.sendPasswordResetEmail(email)
.addOnCompleteListener(listener);
.addOnCompleteListener(getExecutor(), listener);
} else {
ActionCodeSettings settings = buildActionCodeSettings(actionCodeSettings);
firebaseAuth
.sendPasswordResetEmail(email, settings)
.addOnCompleteListener(listener);
.addOnCompleteListener(getExecutor(), listener);
}
}

Expand Down Expand Up @@ -480,7 +480,7 @@ public void sendSignInLinkToEmail(
ActionCodeSettings settings = buildActionCodeSettings(actionCodeSettings);
firebaseAuth
.sendSignInLinkToEmail(email, settings)
.addOnCompleteListener(listener);
.addOnCompleteListener(getExecutor(), listener);
}


Expand All @@ -504,7 +504,7 @@ public void delete(String appName, final Promise promise) {
if (user != null) {
user
.delete()
.addOnCompleteListener(task -> {
.addOnCompleteListener(getExecutor(), task -> {
if (task.isSuccessful()) {
Log.d(TAG, "delete:onComplete:success");
promiseNoUser(promise, false);
Expand Down Expand Up @@ -539,7 +539,7 @@ public void reload(String appName, final Promise promise) {
} else {
user
.reload()
.addOnCompleteListener(task -> {
.addOnCompleteListener(getExecutor(), task -> {
if (task.isSuccessful()) {
Log.d(TAG, "reload:onComplete:success");
promiseWithUser(firebaseAuth.getCurrentUser(), promise);
Expand Down Expand Up @@ -587,12 +587,12 @@ public void sendEmailVerification(
if (actionCodeSettings == null) {
user
.sendEmailVerification()
.addOnCompleteListener(listener);
.addOnCompleteListener(getExecutor(), listener);
} else {
ActionCodeSettings settings = buildActionCodeSettings(actionCodeSettings);
user
.sendEmailVerification(settings)
.addOnCompleteListener(listener);
.addOnCompleteListener(getExecutor(), listener);
}
}
}
Expand All @@ -617,7 +617,7 @@ public void updateEmail(String appName, final String email, final Promise promis
} else {
user
.updateEmail(email)
.addOnCompleteListener(task -> {
.addOnCompleteListener(getExecutor(), task -> {
if (task.isSuccessful()) {
Log.d(TAG, "updateEmail:onComplete:success");
promiseWithUser(firebaseAuth.getCurrentUser(), promise);
Expand Down Expand Up @@ -650,7 +650,7 @@ public void updatePassword(String appName, final String password, final Promise
} else {
user
.updatePassword(password)
.addOnCompleteListener(task -> {
.addOnCompleteListener(getExecutor(), task -> {
if (task.isSuccessful()) {
Log.d(TAG, "updatePassword:onComplete:success");
promiseWithUser(firebaseAuth.getCurrentUser(), promise);
Expand Down Expand Up @@ -706,7 +706,7 @@ private void updatePhoneNumber(
Log.d(TAG, "updatePhoneNumber");
user
.updatePhoneNumber(credential)
.addOnCompleteListener(task -> {
.addOnCompleteListener(getExecutor(), task -> {
if (task.isSuccessful()) {
Log.d(TAG, "updatePhoneNumber:onComplete:success");
promiseWithUser(firebaseAuth.getCurrentUser(), promise);
Expand Down Expand Up @@ -753,7 +753,7 @@ public void updateProfile(String appName, ReadableMap props, final Promise promi

user
.updateProfile(profileUpdates)
.addOnCompleteListener(task -> {
.addOnCompleteListener(getExecutor(), task -> {
if (task.isSuccessful()) {
Log.d(TAG, "updateProfile:onComplete:success");
promiseWithUser(firebaseAuth.getCurrentUser(), promise);
Expand Down Expand Up @@ -789,7 +789,7 @@ private void signInWithCredential(
Log.d(TAG, "signInWithCredential");
firebaseAuth
.signInWithCredential(credential)
.addOnCompleteListener(task -> {
.addOnCompleteListener(getExecutor(), task -> {
if (task.isSuccessful()) {
Log.d(TAG, "signInWithCredential:onComplete:success");
promiseWithAuthResult(task.getResult(), promise);
Expand Down Expand Up @@ -837,7 +837,7 @@ public void onVerificationCompleted(final PhoneAuthCredential phoneAuthCredentia
// User has been automatically verified, log them in
firebaseAuth
.signInWithCredential(phoneAuthCredential)
.addOnCompleteListener(task -> {
.addOnCompleteListener(getExecutor(), task -> {
if (task.isSuccessful()) {
// onAuthStateChanged will pick up the user change
Log.d(
Expand Down Expand Up @@ -947,7 +947,7 @@ public void confirmationResultConfirm(
verificationCode
);

firebaseAuth.signInWithCredential(credential).addOnCompleteListener(task -> {
firebaseAuth.signInWithCredential(credential).addOnCompleteListener(getExecutor(), task -> {
if (task.isSuccessful()) {
Log.d(
TAG,
Expand Down Expand Up @@ -1118,7 +1118,7 @@ public void confirmPasswordReset(

firebaseAuth
.confirmPasswordReset(code, newPassword)
.addOnCompleteListener(task -> {
.addOnCompleteListener(getExecutor(), task -> {
if (task.isSuccessful()) {
Log.d(TAG, "confirmPasswordReset:onComplete:success");
promiseNoUser(promise, false);
Expand All @@ -1145,7 +1145,7 @@ public void applyActionCode(String appName, String code, final Promise promise)

firebaseAuth
.applyActionCode(code)
.addOnCompleteListener(task -> {
.addOnCompleteListener(getExecutor(), task -> {
if (task.isSuccessful()) {
Log.d(TAG, "applyActionCode:onComplete:success");
promiseWithUser(firebaseAuth.getCurrentUser(), promise);
Expand All @@ -1170,7 +1170,7 @@ public void checkActionCode(String appName, String code, final Promise promise)

firebaseAuth
.checkActionCode(code)
.addOnCompleteListener(task -> {
.addOnCompleteListener(getExecutor(), task -> {
if (task.isSuccessful()) {
Log.d(TAG, "checkActionCode:onComplete:success");
ActionCodeResult result = Objects.requireNonNull(task.getResult());
Expand Down Expand Up @@ -1248,7 +1248,7 @@ private void linkWithCredential(
if (user != null) {
user
.linkWithCredential(credential)
.addOnCompleteListener(task -> {
.addOnCompleteListener(getExecutor(), task -> {
if (task.isSuccessful()) {
Log.d(TAG, "link:onComplete:success");
promiseWithAuthResult(task.getResult(), promise);
Expand All @@ -1274,7 +1274,7 @@ public void unlink(final String appName, final String providerId, final Promise
if (user != null) {
user
.unlink(providerId)
.addOnCompleteListener(task -> {
.addOnCompleteListener(getExecutor(), task -> {
if (task.isSuccessful()) {
Log.d(TAG, "unlink:onComplete:success");
promiseWithUser(Objects.requireNonNull(task.getResult()).getUser(), promise);
Expand Down Expand Up @@ -1315,7 +1315,7 @@ private void reauthenticateWithCredential(
if (user != null) {
user
.reauthenticateAndRetrieveData(credential)
.addOnCompleteListener(task -> {
.addOnCompleteListener(getExecutor(), task -> {
if (task.isSuccessful()) {
Log.d(TAG, "reauthenticate:onComplete:success");
promiseWithAuthResult(task.getResult(), promise);
Expand Down Expand Up @@ -1411,7 +1411,7 @@ public void getIdToken(String appName, Boolean forceRefresh, final Promise promi

user
.getIdToken(forceRefresh)
.addOnCompleteListener(task -> {
.addOnCompleteListener(getExecutor(), task -> {
if (task.isSuccessful()) {
Log.d(TAG, "getIdToken:onComplete:success");
GetTokenResult tokenResult = task.getResult();
Expand Down Expand Up @@ -1446,7 +1446,7 @@ public void getIdTokenResult(String appName, Boolean forceRefresh, final Promise

user
.getIdToken(forceRefresh)
.addOnCompleteListener(task -> {
.addOnCompleteListener(getExecutor(), task -> {
if (task.isSuccessful()) {
Log.d(TAG, "getIdTokenResult:onComplete:success");
GetTokenResult tokenResult = task.getResult();
Expand Down Expand Up @@ -1514,7 +1514,7 @@ public void fetchSignInMethodsForEmail(String appName, String email, final Promi

firebaseAuth
.fetchSignInMethodsForEmail(email)
.addOnCompleteListener(task -> {
.addOnCompleteListener(getExecutor(), task -> {
if (task.isSuccessful()) {
Log.d(TAG, "fetchProvidersForEmail:onComplete:success");
List<String> providers = Objects.requireNonNull(task.getResult()).getSignInMethods();
Expand Down Expand Up @@ -1571,7 +1571,7 @@ public void verifyPasswordResetCode(String appName, String code, final Promise p

firebaseAuth
.verifyPasswordResetCode(code)
.addOnCompleteListener(task -> {
.addOnCompleteListener(getExecutor(), task -> {
if (task.isSuccessful()) {
Log.d(TAG, "verifyPasswordResetCode:onComplete:success");
promise.resolve(task.getResult());
Expand Down
6 changes: 5 additions & 1 deletion e2e/user.e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,11 @@ describe('auth().currentUser', () => {
await firebase.auth().currentUser.delete();
} catch (error) {
// Reject
await firebase.auth().currentUser.delete();
try {
await firebase.auth().currentUser.delete();
} catch (_) {
/* do nothing */
}
return Promise.reject(new Error('sendEmailVerification() caused an error', error));
}

Expand Down
23 changes: 23 additions & 0 deletions ios/RNFBAuth.podspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
require 'json'
package = JSON.parse(File.read(File.join(__dir__, '..', 'package.json')))

Pod::Spec.new do |s|
s.name = "RNFBAuth"
s.version = package["version"]
s.description = package["description"]
s.summary = <<-DESC
A well tested feature rich Firebase implementation for React Native, supporting iOS & Android.
DESC
s.homepage = "http://invertase.io/oss/react-native-firebase"
s.license = package['license']
s.authors = "Invertase Limited"
s.source = { :git => "https://github.com/invertase/react-native-firebase.git", :tag => "v#{s.version}" }
s.social_media_url = 'http://twitter.com/invertaseio'
s.platform = :ios, "10.0"
s.source_files = '**/*.{h,m}'
s.dependency 'React'
s.dependency 'Firebase/Core', '~> 5.20.2'
s.dependency 'Firebase/Auth', '~> 5.20.2'
s.dependency 'RNFBApp'
s.static_framework = true
end

0 comments on commit f5e441c

Please sign in to comment.