Updated 将Flutter调用Native方法的实现逻辑优化
Fixed 反馈页背景色不正确问题
This commit is contained in:
@ -3,6 +3,7 @@ apply plugin: 'kotlin-android' // kotlin
|
||||
apply plugin: 'kotlin-android-extensions'
|
||||
apply plugin: 'kotlin-kapt'
|
||||
apply plugin: 'me.ele.lancet'
|
||||
apply plugin: 'app-joint'
|
||||
//apply plugin: 'io.sentry.android.gradle'
|
||||
apply plugin: 'AndResGuard'
|
||||
|
||||
@ -349,6 +350,8 @@ dependencies {
|
||||
|
||||
implementation 'io.github.sinaweibosdk:core:11.6.0@aar'
|
||||
|
||||
implementation "io.github.prototypez:app-joint-core:1.7"// 面向接口编程
|
||||
|
||||
implementation project(':libraries:LGLibrary')
|
||||
// implementation project(':libraries:MTA')
|
||||
implementation project(':libraries:QQShare')
|
||||
@ -359,7 +362,7 @@ dependencies {
|
||||
implementation project(':libraries:Matisse')
|
||||
|
||||
// Flutter模块
|
||||
implementation project(':assistant_flutter_hook')
|
||||
implementation project(':assistant_flutter')
|
||||
}
|
||||
File propFile = file('sign.properties')
|
||||
if (propFile.exists()) {
|
||||
|
||||
@ -0,0 +1,39 @@
|
||||
package com.gh.flutter;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.gh.common.DefaultUrlHandler;
|
||||
import com.halo.assistant.flutter.service.FlutterBoostRouteService;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import io.github.prototypez.appjoint.core.ServiceProvider;
|
||||
|
||||
@ServiceProvider
|
||||
public class FlutterBoostRouteServiceImpl implements FlutterBoostRouteService {
|
||||
|
||||
@Override
|
||||
public void handleHelpDetail(Context context, Map<String, Object> params) {
|
||||
StringBuilder builder = new StringBuilder("ghzhushou://help_detail");
|
||||
String url = (String) params.get("url");
|
||||
if(url != null && !url.isEmpty()) {
|
||||
builder.append("?url=").append(params.get("url"));
|
||||
} else {
|
||||
builder.append("?id=").append(params.get("id"));
|
||||
builder.append("&name=").append(params.get("name"));
|
||||
builder.append("&collection_id=").append(params.get("collection_id"));
|
||||
}
|
||||
DefaultUrlHandler.interceptUrl(context, builder.toString(), "");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleHelpSuggestion(Context context, Map<String, Object> params) {
|
||||
String url = "ghzhushou://help_suggestion?type=" + params.get("type");
|
||||
DefaultUrlHandler.interceptUrl(context, url, "");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleQQGroup(Context context, Map<String, Object> params) {
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,70 @@
|
||||
package com.gh.flutter;
|
||||
|
||||
import com.gh.common.constant.Config;
|
||||
import com.gh.common.exposure.meta.MetaUtil;
|
||||
import com.gh.common.util.TimestampUtils;
|
||||
import com.gh.gamecenter.BuildConfig;
|
||||
import com.gh.gamecenter.entity.SettingsEntity;
|
||||
import com.gh.gamecenter.manager.UserManager;
|
||||
import com.halo.assistant.HaloApp;
|
||||
import com.halo.assistant.flutter.service.FlutterModuleService;
|
||||
|
||||
import io.github.prototypez.appjoint.core.ServiceProvider;
|
||||
|
||||
@ServiceProvider
|
||||
public class FlutterModuleServiceImpl implements FlutterModuleService {
|
||||
|
||||
@Override
|
||||
public String getToken() {
|
||||
return UserManager.getInstance().getToken();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUserAgent() {
|
||||
return HaloApp.getInstance().getUserAgent();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getChannel() {
|
||||
return HaloApp.getInstance().getChannel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String addTimeStamp(String url) {
|
||||
return TimestampUtils.addTimestamp(url);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOAID() {
|
||||
return HaloApp.getInstance().getOAID();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDeviceId() {
|
||||
return UserManager.getInstance().getDeviceId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHost() {
|
||||
return BuildConfig.API_HOST;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQQun() {
|
||||
SettingsEntity settings = Config.getSettings();
|
||||
if (settings != null) {
|
||||
// settings.?
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQQunKey() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBase64EncodedIMEI() {
|
||||
return MetaUtil.getBase64EncodedIMEI();
|
||||
}
|
||||
}
|
||||
@ -55,6 +55,7 @@ import com.squareup.picasso.Picasso;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import io.github.prototypez.appjoint.core.AppSpec;
|
||||
import io.reactivex.plugins.RxJavaPlugins;
|
||||
import tv.danmaku.ijk.media.exo2.Exo2PlayerManager;
|
||||
import tv.danmaku.ijk.media.exo2.ExoPlayerCacheManager;
|
||||
@ -196,10 +197,6 @@ public class HaloApp extends MultiDexApplication {
|
||||
}
|
||||
|
||||
registerActivityLifecycleCallbacks(new GlobalActivityLifecycleObserver());
|
||||
|
||||
// Flutter模块初始化
|
||||
initFlutterBoost();
|
||||
initFlutterDyncExtension();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -333,18 +330,6 @@ public class HaloApp extends MultiDexApplication {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* FlutterBoost初始化,通过Lancet注入代码
|
||||
* 请确保该方法名与{@link com.halo.assistant.flutter.hook.FlutterBoostHook}对应的方法名保持一致
|
||||
*/
|
||||
private void initFlutterBoost() { }
|
||||
|
||||
/**
|
||||
* 使用FlutterDynamicChannel接入Native方法,通过Lancet注入代码
|
||||
* 请确保该方法名与{@link com.halo.assistant.flutter.hook.FlutterDynamicChannelHook}对应的方法名保持一致
|
||||
*/
|
||||
private void initFlutterDyncExtension() { }
|
||||
|
||||
public boolean isPostInitialized() {
|
||||
return mIsPostInitialized;
|
||||
}
|
||||
|
||||
@ -24,6 +24,7 @@ buildscript {
|
||||
// 使用了 1.2.21 在蓝叠模拟器上无法进入首页? 但是不使用又会出现触发 V3 签名...
|
||||
classpath 'com.tencent.mm:AndResGuard-gradle-plugin:1.2.20'
|
||||
classpath 'com.github.axen1314.lancet:lancet-plugin:v1.0.6'
|
||||
classpath 'io.github.prototypez:app-joint:1.7'// 面向接口编程
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user