Skip to content

Commit

Permalink
Fixing the build
Browse files Browse the repository at this point in the history
  • Loading branch information
Shchvova committed Sep 11, 2021
1 parent cb4b7f3 commit 56f98df
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 16 deletions.
Binary file modified plugins/2020.3569/android/plugin.notifications.v2.jar
Binary file not shown.
2 changes: 2 additions & 0 deletions src/android/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import org.apache.tools.ant.filters.StringInputStream

plugins {
id("com.android.application")
id("com.google.gms.google-services")
}

//<editor-fold desc="Utility Variables Setup" defaultstate="collapsed">
Expand Down Expand Up @@ -1059,6 +1060,7 @@ tasks.register<Zip>("createExpansionFile") {
//</editor-fold>

dependencies {

if (coronaBuiltFromSource) {
implementation(project(":Corona"))
implementation(files("$rootDir/../../plugins/build/licensing-google/android/bin/classes.jar"))
Expand Down
42 changes: 42 additions & 0 deletions src/android/app/google-services.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"project_info": {
"project_number": "532108303969",
"firebase_url": "https://fir-cloud-messaging-16d9a.firebaseio.com",
"project_id": "fir-cloud-messaging-16d9a",
"storage_bucket": "fir-cloud-messaging-16d9a.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:532108303969:android:a7f606ca19b0b13b",
"android_client_info": {
"package_name": "com.coronalabs.firebase.messaging"
}
},
"oauth_client": [
{
"client_id": "532108303969-6hgarnooc5dclgmb7q9lu4f2k5l6qs9p.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyAdBEHHph7nxPlcAtpAkMXhIS5cSpOhcK8"
}
],
"services": {
"analytics_service": {
"status": 1
},
"appinvite_service": {
"status": 1,
"other_platform_oauth_client": []
},
"ads_service": {
"status": 2
}
}
}
],
"configuration_version": "1"
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//

package com.mycompany.app;
package com.coronalabs.firebase.messaging;

/**
* Extends the Application class to receive Corona runtime events and to extend the Lua API.
Expand Down
1 change: 1 addition & 0 deletions src/android/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ buildscript {
classpath(kotlin("gradle-plugin", version = "1.3.70"))
classpath("com.android.tools.build:gradle:3.5.4")
classpath("com.beust:klaxon:5.0.1")
classpath("com.google.gms:google-services:4.3.10")
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,22 @@

package plugin.notifications.v2;

import android.content.Context;
import android.content.SharedPreferences;
import android.util.Log;

import com.ansca.corona.Bridge;
import com.ansca.corona.CoronaActivity;
import com.ansca.corona.CoronaRuntimeTaskDispatcher;
import com.ansca.corona.CoronaEnvironment;
import com.ansca.corona.CoronaRuntime;
import com.ansca.corona.CoronaRuntimeListener;
import com.ansca.corona.Bridge;

import com.google.android.gms.tasks.Task;
import com.naef.jnlua.LuaState;
import com.ansca.corona.CoronaRuntimeTaskDispatcher;
import com.google.firebase.messaging.FirebaseMessaging;
import com.naef.jnlua.JavaFunction;
import com.naef.jnlua.LuaState;
import com.naef.jnlua.LuaType;
import com.naef.jnlua.NamedJavaFunction;

import android.content.Context;
import android.content.SharedPreferences;
import android.util.Log;

import com.google.firebase.messaging.FirebaseMessaging;

/**
* Implements the Lua interface for the plugin.
* <p>
Expand Down Expand Up @@ -263,12 +260,12 @@ public int invoke(final LuaState luaState) {
logMsg(ERROR_MSG, "Expected no arguments, got " + nargs);
return 0;
}
Task<String> tokenTask = FirebaseMessaging.getInstance().getToken();
String deviceToken = null;
try {
tokenTask.wait(1000);
} catch (InterruptedException ignore) {
deviceToken = FirebaseMessaging.getInstance().getToken().getResult();
} catch (Throwable ex) {
ex.printStackTrace();
}
String deviceToken = tokenTask.getResult();

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

0 comments on commit 56f98df

Please sign in to comment.