Skip to content

Commit

Permalink
Updating to 22.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Shchvova committed Sep 11, 2021
1 parent 56d27a1 commit cb4b7f3
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
Binary file modified plugins/2020.3569/android/plugin.notifications.v2.jar
Binary file not shown.
5 changes: 5 additions & 0 deletions src/android/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,11 @@ if (configureCoronaPlugins == "YES") {
//</editor-fold>

android {
compileOptions {
sourceCompatibility = org.gradle.api.JavaVersion.VERSION_1_8
targetCompatibility = org.gradle.api.JavaVersion.VERSION_1_8
}

compileSdkVersion(29)
defaultConfig {
applicationId = coronaAppPackage
Expand Down
6 changes: 5 additions & 1 deletion src/android/plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ apply plugin: 'com.android.library'

android {
compileSdkVersion 29
compileOptions {
sourceCompatibility 1.8
targetCompatibility 1.8
}

defaultConfig {
minSdkVersion 15
Expand All @@ -12,7 +16,7 @@ android {
}

dependencies {
implementation 'com.google.firebase:firebase-messaging:' + '20.2.3'
implementation 'com.google.firebase:firebase-messaging:22.0.0'
implementation ':Corona@aar'
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import com.ansca.corona.CoronaRuntimeListener;
import com.ansca.corona.Bridge;

import com.google.android.gms.tasks.Task;
import com.naef.jnlua.LuaState;
import com.naef.jnlua.JavaFunction;
import com.naef.jnlua.LuaType;
Expand All @@ -24,7 +25,6 @@
import android.util.Log;

import com.google.firebase.messaging.FirebaseMessaging;
import com.google.firebase.iid.FirebaseInstanceId;

/**
* Implements the Lua interface for the plugin.
Expand Down Expand Up @@ -194,7 +194,7 @@ public int invoke(LuaState L) {
}

// [Lua] registerForPushNotifications( {options} )
private class RegisterForPushNotifications implements NamedJavaFunction {
private static class RegisterForPushNotifications implements NamedJavaFunction {
/**
* Gets the name of the Lua function as it would appear in the Lua script.
*
Expand Down Expand Up @@ -263,8 +263,12 @@ public int invoke(final LuaState luaState) {
logMsg(ERROR_MSG, "Expected no arguments, got " + nargs);
return 0;
}

String deviceToken = FirebaseInstanceId.getInstance().getToken();
Task<String> tokenTask = FirebaseMessaging.getInstance().getToken();
try {
tokenTask.wait(1000);
} catch (InterruptedException ignore) {
}
String deviceToken = tokenTask.getResult();

if (deviceToken == null) {
deviceToken = "unknown";
Expand Down

0 comments on commit cb4b7f3

Please sign in to comment.