remove conflicted file

This commit is contained in:
zhl 2023-03-21 15:17:44 +08:00
parent bd63de2475
commit ea5f274f63
7 changed files with 67 additions and 5 deletions

View File

@ -1,7 +1,11 @@
import org.apache.tools.ant.taskdefs.condition.Os
apply plugin: 'com.android.application'
//apply plugin: 'com.android.application'
plugins {
id 'com.android.application'
// Add the Google services Gradle plugin
id 'com.google.gms.google-services'
}
android {
compileSdkVersion PROP_COMPILE_SDK_VERSION.toInteger()
buildToolsVersion PROP_BUILD_TOOLS_VERSION
@ -139,4 +143,8 @@ dependencies {
implementation 'com.google.android.play:core:1.10.0' //PAD资源分发
implementation 'com.facebook.android:facebook-login:latest.release'
implementation 'com.facebook.android:facebook-share:latest.release'
// begin of firebase
implementation platform('com.google.firebase:firebase-bom:31.2.2')
implementation 'com.google.firebase:firebase-analytics'
// end of firebase
}

View File

@ -7,7 +7,7 @@
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:977053300219:android:556f8ae1bb64b47041c75e",
"mobilesdk_app_id": "1:977053300219:android:921a89f1a9a058bd41c75e",
"android_client_info": {
"package_name": "com.cege.games.release"
}

View File

@ -39,10 +39,12 @@ import com.google.android.gms.common.Scopes;
import com.google.android.gms.common.api.ApiException;
import com.google.android.gms.common.api.Scope;
import com.google.android.gms.tasks.Task;
import com.google.firebase.analytics.FirebaseAnalytics;
import com.jc.jcfw.JcSDK;
import com.jc.jcfw.appauth.AuthStateManager;
import com.jc.jcfw.appauth.JConfiguration;
import com.jc.jcfw.util.FileUtils;
import com.jc.jcfw.util.JsonUtils;
import com.king.zxing.CameraScan;
import com.king.zxing.util.CodeUtils;
import com.king.zxing.util.LogUtils;
@ -67,9 +69,12 @@ import net.openid.appauth.browser.BrowserMatcher;
import org.cocos2dx.lib.Cocos2dxHelper;
import org.cocos2dx.lib.CocosJSHelper;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
@ -139,6 +144,8 @@ public class MainActivity extends UnityPlayerActivity
// facebook login
private CallbackManager mCallbackManager;
private FirebaseAnalytics mFirebaseAnalytics;
protected String updateUnityCommandLineArguments(String cmdLine) {
return cmdLine;
}
@ -148,6 +155,8 @@ public class MainActivity extends UnityPlayerActivity
requestWindowFeature(Window.FEATURE_NO_TITLE);
super.onCreate(savedInstanceState);
Log.i(TAG, "onCreate: " + getIntent().getDataString());
// Obtain the FirebaseAnalytics instance.
mFirebaseAnalytics = FirebaseAnalytics.getInstance(this);
String cmdLine = updateUnityCommandLineArguments(getIntent().getStringExtra("unity"));
getIntent().putExtra("unity", cmdLine);
@ -159,7 +168,7 @@ public class MainActivity extends UnityPlayerActivity
// begin of google sign
GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestIdToken(getString(R.string.default_web_client_id))
.requestIdToken(getString(R.string.default_web_client_id1))
.requestScopes(new Scope(Scopes.EMAIL))
// .requestScopes(new Scope("https://www.googleapis.com/auth/drive.appdata"))
.build();
@ -838,4 +847,13 @@ public class MainActivity extends UnityPlayerActivity
Log.i(TAG, "login with twitter: " + funId);
this.funId = funId;
}
public void logEvent(String content) {
try {
Bundle bundle = JsonUtils.convertJsonToBundle(content);
mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.SELECT_CONTENT, bundle);
} catch (JSONException e) {
Log.e(TAG, "log event JSONException: " + e.getMessage());
}
}
}

View File

@ -98,6 +98,10 @@ public class JcSDK {
MainActivity.app.signOutGoogle(funid);
}
public static void logEvent(String content) {
MainActivity.app.logEvent(content);
}
public static void oauthCb(String funId, String error, String idToken) {
JSONObject result = new JSONObject();
try {

View File

@ -0,0 +1,31 @@
package com.jc.jcfw.util;
import android.os.Bundle;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.Iterator;
public class JsonUtils {
public static Bundle convertJsonToBundle(String jsonString) throws JSONException {
Bundle bundle = new Bundle();
JSONObject jsonObject = new JSONObject(jsonString);
traverseJsonObject(jsonObject, bundle);
return bundle;
}
public static void traverseJsonObject(JSONObject jsonObject, Bundle bundle) throws JSONException {
Iterator<String> keys = jsonObject.keys();
while (keys.hasNext()) {
String key = keys.next();
Object value = jsonObject.get(key);
// if (value instanceof JSONObject) {
// traverseJsonObject((JSONObject) value, bundle);
// } else {
// bundle.putString(key, value.toString());
// }
bundle.putString(key, value.toString());
}
}
}

View File

@ -12,6 +12,7 @@ buildscript {
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:4.3.15'
}
}

View File

@ -3,7 +3,7 @@
<string name="game_view_content_description" translatable="false">Game view</string>
<string name="permission_camera" translatable="false">Scan QRCode need camera permission</string>
<string name="qr_code_title" translatable="false">QRCode</string>
<string name="default_web_client_id">53206975661-ih3r0ubph3rqejdq97b029difbrk2bqj.apps.googleusercontent.com</string>
<string name="default_web_client_id1">53206975661-ih3r0ubph3rqejdq97b029difbrk2bqj.apps.googleusercontent.com</string>
<string name="tips_scan_code" translatable="false"></string>
<string name="facebook_app_id" translatable="false">1204701000119770</string>