Commit 885b3a97 authored by 林生雨's avatar 林生雨

commit

parent ac5fbef3
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id="android" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="java-gradle" name="Java-Gradle">
<configuration>
<option name="BUILD_FOLDER_PATH" value="$MODULE_DIR$/../build" />
<option name="BUILDABLE" value="false" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
......
......@@ -26,29 +26,6 @@
</compilerArguments>
</configuration>
</facet>
<facet type="android-gradle" name="Android-Gradle">
<configuration>
<option name="GRADLE_PROJECT_PATH" value=":app" />
<option name="LAST_SUCCESSFUL_SYNC_AGP_VERSION" value="3.5.0" />
<option name="LAST_KNOWN_AGP_VERSION" value="3.5.0" />
</configuration>
</facet>
<facet type="android" name="Android">
<configuration>
<option name="SELECTED_BUILD_VARIANT" value="debug" />
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
<afterSyncTasks>
<task>generateDebugSources</task>
</afterSyncTasks>
<option name="ALLOW_USER_CONFIGURATION" value="false" />
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
<option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res" />
<option name="TEST_RES_FOLDERS_RELATIVE_PATH" value="" />
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/../../build/app/intermediates/javac/debug/classes" />
......@@ -192,6 +169,6 @@
<orderEntry type="module" module-name="flutter_boost-0.0.420-android-flutter_boost" />
<orderEntry type="module" module-name="sqflite" />
<orderEntry type="module" module-name="android-path_provider" />
<orderEntry type="module" module-name="flutter_plugin-11f928f7165e76994978f521a25e89d8d25824b7-android-gengmei_flutter_plugin" />
<orderEntry type="module" module-name="android-gengmei_flutter_plugin" />
</component>
</module>
\ No newline at end of file
sdk.dir=/Users/apple/Library/Android/sdk
flutter.sdk=/Users/apple/Downloads/flutter
flutter.buildMode=debug
flutter.buildMode=release
flutter.versionName=1.0.0
flutter.versionCode=1
\ No newline at end of file
......@@ -56,6 +56,8 @@ function android_apk(){
cd /Users/apple/lsy/gmalpha_flutter/build/app/outputs/apk/${suff}/
unzip /Users/apple/lsy/gmalpha_flutter/build/app/outputs/apk/${suff}/app-${suff}.zip
cp -r /Users/apple/lsy/gmalpha_flutter/build/app/outputs/apk/${suff}/lib/armeabi-v7a/libapp.so /Users/apple/lsy/gengmei_alpha/alpha/libs/armeabi-v7a
rm -rf /Users/apple/lsy/gengmei_alpha/alpha/src/main/assets/flutter_assets
cp -r /Users/apple/lsy/gmalpha_flutter/build/app/outputs/apk/${suff}/assets/flutter_assets /Users/apple/lsy/gengmei_alpha/alpha/src/main/assets/
}
......@@ -240,4 +242,5 @@ ios
#ios_publish
#notifyDingDing
exit
\ No newline at end of file
/Users/apple/Downloads/flutter/.pub-cache/git/flutter_plugin-25c02c805d4c3bcb2f90d63b21775a4aceb146aa
\ No newline at end of file
/Users/apple/Downloads/flutter/.pub-cache/git/flutter_plugin-17fcda9a246dbf2b8268ce5b963e96df2f54b4fa
\ No newline at end of file
This diff is collapsed.
......@@ -8,7 +8,68 @@
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
[GeneratedPluginRegistrant registerWithRegistry:self];
[self flutterMethod];
return [super application:application didFinishLaunchingWithOptions:launchOptions];
}
- (void)flutterMethod {
FlutterViewController* controller =
(FlutterViewController*)self.window.rootViewController;
FlutterMethodChannel* buryChannel = [FlutterMethodChannel
methodChannelWithName:@"flutter_bury_channel"
binaryMessenger:controller];
[buryChannel setMethodCallHandler:^(FlutterMethodCall* call,
FlutterResult result) {
NSLog(@" ME %@ argue %@",call.method,call.arguments);
if([call.method isEqualToString:@"FLUTTER_TO_H5"]){
NSLog(@"FLUTTER_TO_H5");
}else if([call.method isEqualToString:@"FLUTTER_TO_NATIVE"]){
NSLog(@"FLUTTER_TO_NATIVE");
}else if ([call.method isEqualToString:@"FLUTTER_BURIED"]){
NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
//APPInfo
[dict setObject:@"alpha" forKey:@"app_name"];
[dict setObject:@"app_version_name" forKey:@"app_version_name"];
[dict setObject:@"channel" forKey:@"channel"];
[dict setObject:@"" forKey:@"current_city_id"];
[dict setObject:[[NSMutableDictionary alloc] initWithCapacity:0] forKey:@"user_type"];
[dict setObject:@"" forKey:@"grey_type"];
//DeviceInfo
[dict setObject:@"device_id" forKey:@"device_id"];
[dict setObject:@"Apple" forKey:@"manufacturer"];
[dict setObject:@"lng" forKey:@"lng"];
[dict setObject:@"lat" forKey:@"lat"];
[dict setObject:@"is_WiFi" forKey:@"is_WiFi"];
[dict setObject:@"ip" forKey:@"ip"];
[dict setObject:@"model" forKey:@"model"];
[dict setObject:@"sys_version" forKey:@"sys_version"];
[dict setObject:@"Apple" forKey:@"lng"];
[dict setObject:@"idfa" forKey:@"idfa"];
[dict setObject:@"idfv" forKey:@"idfv"];
[dict setObject:@"user_id" forKey:@"user_id"];
[dict setObject:@"" forKey:@"app_session_id"];
[dict setObject:@"create_at" forKey:@"create_at"];
[dict setObject:@"110" forKey:@"version"];
result(dict);
}else if([call.method isEqualToString:@"GET_NET_TYPE"]){
result(@"wifi");
}else if([call.method isEqualToString:@"INIT_PARAMS"]){
NSMutableDictionary * map=[[NSMutableDictionary alloc] init];
NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
[dict setObject:@"sessionid=9odo0sov71x66ke9dlphibnq9i9gduxj;_gtid=3fbe9b78d2cb11e98bc1525400e82fab5270; _gm_token=db88861568285036" forKey:@"cookie"];
[dict setObject:@"debug" forKey:@"buildConfig"];
//HERE
[dict setObject:@"172.30.9.84:6666" forKey:@"proxy"];
result(dict);
}
}];
}
@end
......@@ -15,6 +15,7 @@ class BuriedImpl implements BuriedRouter {
String extra_param,
String referrer_tab_name,
String isPush}) {
print("lsy !! PAGE END ");
BuriedCenter.getInstance().onPageEnd(page_name, inPage, outPage,
fake: fake,
business_id: business_id,
......@@ -27,11 +28,13 @@ class BuriedImpl implements BuriedRouter {
@override
void onEvent(String type, Map<String, String> params) {
print("lsy !! ON EVENT ");
BuriedCenter.getInstance().onEvent(type, params);
}
@override
void onClick(String pageName, String buttonName) {
print("lsy !! ON CLICK ");
BuriedCenter.getInstance().onEvent(
"CLICK_EVENT", {"page_name": pageName, "button_name": buttonName});
}
......
......@@ -26,8 +26,6 @@ class BuriedCenter {
return _instance;
}
var normalRequest = BuryingRequest.create();
void onPageEnd(String page_name, String inPage, String outPage,
{String fake,
String business_id,
......@@ -39,7 +37,7 @@ class BuriedCenter {
if (page_name == null) {
print("$BURIED_TAG onPageStart page_name is null");
}
normalRequest.params.clear();
var normalRequest = BuryingRequest.create();
normalRequest.type = "page_view";
normalRequest.params["in"] = inPage ?? "";
normalRequest.params["out"] = outPage ?? "";
......@@ -54,7 +52,7 @@ class BuriedCenter {
}
void onEvent(String type, Map<String, String> params) {
normalRequest.params.clear();
var normalRequest = BuryingRequest.create();
normalRequest.type = type;
if (params != null) {
normalRequest.params.addAll(params);
......
......@@ -22,12 +22,21 @@ class SendTask {
}
void _sendBuriedData(BuryingRequest request) {
getNetType().listen((value) {
_deviceInfo.netType = value;
request.device = _deviceInfo;
print("FLUTTER 埋点 --> $request");
_client
.dataReport(Stream.fromFuture(Future.value(request)))
.listen((data) {
print("埋点响应 --> $data");
}).onError((error) {
print(error);
});
}).onError((error) {
print("FLUTTER 埋点ERROR --> $error");
_client.dataReport(Stream.fromFuture(Future.value(request)));
// .listen((data) {
// print("DATAWWWW $data");
// }).onError((error) {
// print(error);
// });
});
}
void sendBuried(BuryingRequest request) {
......@@ -49,7 +58,7 @@ class SendTask {
BuryingRequest assemRequset(BuryingRequest request) {
if (_deviceInfo == null) {
_deviceInfo = new DeviceInfo();
_deviceInfo = DeviceInfo.create();
_deviceInfo.deviceId =
CacheManager.getInstance().get(MEMORY_CACHE).get("device_id") ?? "";
_deviceInfo.manufacturer =
......@@ -75,7 +84,7 @@ class SendTask {
CacheManager.getInstance().get(MEMORY_CACHE).get("idfa") ?? "";
}
if (_appInfo == null) {
_appInfo = new AppInfo();
_appInfo = AppInfo.create();
_appInfo.name =
CacheManager.getInstance().get(MEMORY_CACHE).get("app_name") ?? "";
_appInfo.version = CacheManager.getInstance()
......@@ -99,9 +108,8 @@ class SendTask {
_appInfo.greyType =
CacheManager.getInstance().get(MEMORY_CACHE).get("grey_type") ?? "";
}
//TODO!!
_deviceInfo.netType =
CacheManager.getInstance().get(MEMORY_CACHE).get("net_type") ?? "";
// _deviceInfo.netType =
// CacheManager.getInstance().get(MEMORY_CACHE).get("net_type") ?? "";
request.userId =
CacheManager.getInstance().get(MEMORY_CACHE).get("user_id") ?? "";
request.appSessionId =
......
......@@ -19,17 +19,6 @@ abstract class BasePage<T extends StatefulWidget> extends State<T> {
void initState() {
super.initState();
startTime = DateTime.now().millisecondsSinceEpoch;
if (CacheManager.getInstance().get(MEMORY_CACHE).get("version") == null) {
getBuriedInfo().then((value) {
Map temp=new Map<String, dynamic>.from(value);
print("lsy $temp");
temp.forEach((k, v) {
CacheManager.getInstance().get(MEMORY_CACHE).save(k, v);
});
}).catchError((error) {
print(error);
});
}
}
void pageStop(){
......
......@@ -3,9 +3,14 @@
* @date 2019-09-24
**/
import 'package:flutter/services.dart';
import 'package:gmalpha_flutter/commonModel/cache/CacheManager.dart';
import 'package:gmalpha_flutter/commonModel/net/Api.dart';
import 'package:gmalpha_flutter/commonModel/net/DioUtil.dart';
import 'package:rxdart/rxdart.dart';
const BURIED_METHOD = "FLUTTER_BURIED";
const NET_TYPE = "GET_NET_TYPE";
const INIT_PARAMS = "INIT_PARAMS";
const platform = const MethodChannel('flutter_bury_channel');
void jumpToH5(String jumpToName, Map params) {
......@@ -28,6 +33,32 @@ Future getBuriedInfo() async {
return await platform.invokeMethod(BURIED_METHOD, null);
}
Observable getNetType() {
return Observable.fromFuture(platform.invokeMethod(NET_TYPE, null));
}
void initParams() {
platform.invokeMethod(INIT_PARAMS, null).then((value) {
print("lsy INITPARAMS !! $value");
Api.getInstance().initBuildConfig(value);
initBuried();
}).catchError((error) {
print(error);
});
}
void initBuried() {
getBuriedInfo().then((value) {
Map temp = new Map<String, dynamic>.from(value);
print("lsy INITBURIED !! $temp");
temp.forEach((k, v) {
CacheManager.getInstance().get(MEMORY_CACHE).save(k, v);
});
}).catchError((error) {
print(error);
});
}
String getNowTimeSecond() {
return "${DateTime.now().millisecondsSinceEpoch}";
// String year = "${DateTime.now().year}".length == 4
......
......@@ -32,11 +32,23 @@ class Api {
}
bool initBuildConfig(Map params) {
print("PARAMS!! ${params}");
String baseUrl = getBaseUrl(params["buildConfig"]) + "/";
if (params == null) {
return false;
}
String buildConfig = params["buildConfig"];
if (buildConfig == null) {
return false;
}
String baseUrl = getBaseUrl(buildConfig) + "/";
if (baseUrl == null) {
return false;
}
if (buildConfig == "debug" || buildConfig == "dev") {
String httpProxy = params["proxy"];
if (httpProxy != null && httpProxy.isNotEmpty) {
DioUtil().setProxy(httpProxy);
}
}
var cookie = params["cookie"] == null ? params["Cookie"] : params["cookie"];
Map cookieMap = {};
cookieMap.putIfAbsent("Cookie", () => cookie);
......
......@@ -195,6 +195,15 @@ class DioUtil {
}
}
void setProxy(String proxy) {
(_dio.httpClientAdapter as DefaultHttpClientAdapter).onHttpClientCreate =
(client) {
client.findProxy = (url) {
return 'PROXY $proxy';
};
};
}
/// set Config.
void setConfig(HttpConfig config) {
_statusKey = config.status ?? _statusKey;
......
......@@ -14,6 +14,7 @@ import 'comment_suggest.dart';
void main() async {
runApp(MyApp());
initParams();
}
class MyApp extends StatefulWidget {
......@@ -44,11 +45,10 @@ class _MyAppState extends State<MyApp> {
: params["selectedPath"] as List<String>);
},
"prestige": (pageName, params, _) {
print("ERROR , PRESTIGE");
print("PARAMS!! ${params}");
String fromPage = params["fromPage"];
if (params == null ||
fromPage == null ||
Api.getInstance().initBuildConfig(params) == null) {
fromPage == null) {
return ErrorPage("出错:需要传递的参数为空");
}
int userId = int.parse(params["userId"]);
......@@ -59,8 +59,7 @@ class _MyAppState extends State<MyApp> {
"activity_report": (pageName, params, _) {
String fromPage = params["fromPage"];
if (params == null ||
fromPage == null ||
Api.getInstance().initBuildConfig(params) == null) {
fromPage == null) {
return ErrorPage("出错:需要传递的参数为空");
}
return RouterCenterImpl()
......@@ -90,13 +89,13 @@ class _MyAppState extends State<MyApp> {
// '_gm_token=72ee1c1569466411; _gtid=58d3cc14df8711e99736525400e82fab81; sessionid=vhksn66854pejzjwi8ljhrmcew3domh2',
// "buildConfig": "debug"
// });
//// return RouterCenterImpl()
//// .findActivityReportRouter()
//// ?.getActivityReportPage(279, 1, '');
//// return RouterCenterImpl().findPrestigeRouter()?.getReputationsPage(1, "ww", "ww");
// return RouterCenterImpl()
// .findAlbumRouter()
// .getAlbumPage("com.example.gengmei_flutter_plugin_example",true, 2, null);
// .findActivityReportRouter()
// ?.getActivityReportPage(279, 1, '');
//// return RouterCenterImpl().findPrestigeRouter()?.getReputationsPage(1, "ww", "ww");
//// return RouterCenterImpl()
//// .findAlbumRouter()
//// .getAlbumPage("com.example.gengmei_flutter_plugin_example",true, 2, null);
// },
// },
builder: FlutterBoost.init(postPush: _onRoutePushed),
......
......@@ -218,8 +218,8 @@ packages:
dependency: "direct main"
description:
path: "."
ref: "25c02c805d4c3bcb2f90d63b21775a4aceb146aa"
resolved-ref: "25c02c805d4c3bcb2f90d63b21775a4aceb146aa"
ref: "17fcda9a246dbf2b8268ce5b963e96df2f54b4fa"
resolved-ref: "17fcda9a246dbf2b8268ce5b963e96df2f54b4fa"
url: "git@git.wanmeizhensuo.com:linshengyu/flutter_plugin.git"
source: git
version: "0.0.735"
......
......@@ -34,7 +34,7 @@ dependencies:
gengmei_flutter_plugin:
git:
url: 'git@git.wanmeizhensuo.com:linshengyu/flutter_plugin.git'
ref: "25c02c805d4c3bcb2f90d63b21775a4aceb146aa"
ref: "17fcda9a246dbf2b8268ce5b963e96df2f54b4fa"
protobuf: ^0.14.4
grpc: ^2.1.2
flutter_svg: ^0.14.1
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment