Commit 6c98be4e authored by rockypzhang's avatar rockypzhang

update readme

parent 4d2ea01a
...@@ -7,3 +7,7 @@ this plugin is developed base on bugly native crash sdk. ...@@ -7,3 +7,7 @@ this plugin is developed base on bugly native crash sdk.
Android Native Sdk Doc: https://bugly.qq.com/docs/user-guide/instruction-manual-android/?v=20181014122344 Android Native Sdk Doc: https://bugly.qq.com/docs/user-guide/instruction-manual-android/?v=20181014122344
iOS Crash Native Sdk Doc: https://bugly.qq.com/docs/user-guide/instruction-manual-ios/?v=20181014122344 iOS Crash Native Sdk Doc: https://bugly.qq.com/docs/user-guide/instruction-manual-ios/?v=20181014122344
pub dev : https://pub.dev/packages/bugly_crash/
...@@ -2,196 +2,163 @@ import 'dart:async'; ...@@ -2,196 +2,163 @@ import 'dart:async';
import 'dart:io'; import 'dart:io';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
/**
* Description:bugly futter plugin . /// Description:bugly futter plugin .
* @author rockypzhang /// @author rockypzhang
* @since 2019/5/28 /// @since 2019/5/28
*/
class Bugly { class Bugly {
static const MethodChannel _channel = static const MethodChannel _channel = const MethodChannel('bugly');
const MethodChannel('bugly');
static Future<String> get platformVersion async { static Future<String> get platformVersion async {
final String version = await _channel.invokeMethod('getPlatformVersion'); final String version = await _channel.invokeMethod('getPlatformVersion');
return version; return version;
} }
/** /// 初始化接口.
* 初始化接口. /// @param appId appId
* @param appId appId /// @param isDebug 是否打开debug开关
* @param isDebug 是否打开debug开关
*/
static Future<void> initAndroidCrashReport({ static Future<void> initAndroidCrashReport({
String? appId, String? appId,
bool? isDebug, bool? isDebug,
}) async{ }) async {
Map<String, Object?> map = { Map<String, Object?> map = {
"appId": appId, "appId": appId,
"isDebug":isDebug, "isDebug": isDebug,
}; };
_channel.invokeMethod("initCrashReport",map); _channel.invokeMethod("initCrashReport", map);
} }
/** /// 自定义上报域名.
* 自定义上报域名. /// @param url 自定义域名
* @param url 自定义域名
*/
static Future<void> setAndroidServerUrl({ static Future<void> setAndroidServerUrl({
String? url, String? url,
}) async{ }) async {
if(Platform.isAndroid){ if (Platform.isAndroid) {
Map<String, Object?> map = { Map<String, Object?> map = {
"url": url, "url": url,
}; };
_channel.invokeMethod("setServerUrl",map); _channel.invokeMethod("setServerUrl", map);
} }
} }
/** /// 设置App渠道.
* 设置App渠道. /// @param appChannel App渠道
*
* @param appChannel App渠道
*/
static Future<void> setAndroidAppChannel({ static Future<void> setAndroidAppChannel({
String? appChannel, String? appChannel,
}) async{ }) async {
if(Platform.isAndroid){ if (Platform.isAndroid) {
Map<String, Object?> map = { Map<String, Object?> map = {
"appChannel":appChannel, "appChannel": appChannel,
}; };
_channel.invokeMethod("setAppChannel",map); _channel.invokeMethod("setAppChannel", map);
} }
} }
/** /// 设置App包名
* 设置App包名 /// @param appPackage App包名
*
* @param appPackage App包名
*/
static Future<void> setAndroidAppPackage({ static Future<void> setAndroidAppPackage({
String? appPackage, String? appPackage,
}) async{ }) async {
if(Platform.isAndroid){ if (Platform.isAndroid) {
Map<String, Object?> map = { Map<String, Object?> map = {
"appPackage":appPackage, "appPackage": appPackage,
}; };
_channel.invokeMethod("setAppPackage",map); _channel.invokeMethod("setAppPackage", map);
} }
} }
/** /// 设置App 设备 id
* 设置App 设备 id /// @param appPackage App包名
*
* @param appPackage App包名
*/
static Future<void> setAndroidDeviceId({ static Future<void> setAndroidDeviceId({
String? deviceId, String? deviceId,
}) async{ }) async {
if(Platform.isAndroid){ if (Platform.isAndroid) {
Map<String, Object?> map = { Map<String, Object?> map = {
"deviceId":deviceId, "deviceId": deviceId,
}; };
_channel.invokeMethod("setDeviceId",map); _channel.invokeMethod("setDeviceId", map);
} }
} }
/** /// 初始化接口.
* 初始化接口. /// @param appId appId
* @param appId appId
*/
static Future<void> initIosCrashReport({ static Future<void> initIosCrashReport({
String? appId, String? appId,
bool? debugMode, bool? debugMode,
String? serverUrl, String? serverUrl,
}) async{ }) async {
Map<String, Object?> map = { Map<String, Object?> map = {
"appId": appId, "appId": appId,
"debugMode": debugMode, "debugMode": debugMode,
"serverUrl": serverUrl "serverUrl": serverUrl
}; };
_channel.invokeMethod("initCrashReport",map); _channel.invokeMethod("initCrashReport", map);
} }
/** /// 上报自定义异常.
* 上报自定义异常. /// @param type 错误类型
* /// @param error 错误信息
* @param type 错误类型 /// @param stackTrace 出错堆栈
* @param error 错误信息 /// @param extraInfo 额外信息
* @param stackTrace 出错堆栈
* @param extraInfo 额外信息
*/
static Future<void> postException({ static Future<void> postException({
String? type, String? type,
String? error, String? error,
String? stackTrace, String? stackTrace,
Map<String,String>? extraInfo, Map<String, String>? extraInfo,
}) async{ }) async {
Map<String, Object?> map = { Map<String, Object?> map = {
"type":type, "type": type,
"error":error, "error": error,
"stackTrace":stackTrace, "stackTrace": stackTrace,
"extraInfo":extraInfo, "extraInfo": extraInfo,
}; };
_channel.invokeMethod("postException",map); _channel.invokeMethod("postException", map);
} }
/** /// 设置App版本
* 设置App版本 /// @param appVersion App版本
*
* @param appVersion App版本
*/
static Future<void> setAppVersion({ static Future<void> setAppVersion({
String? appVersion, String? appVersion,
}) async{ }) async {
Map<String, Object?> map = { Map<String, Object?> map = {
"appVersion":appVersion, "appVersion": appVersion,
}; };
_channel.invokeMethod("setAppVersion",map); _channel.invokeMethod("setAppVersion", map);
} }
/** /// 设置用户场景 ,可以在初始化前执行.
* 设置用户场景 ,可以在初始化前执行. /// @param userSceneTag 唯一标识一种场景,必须大于0
*
* @param userSceneTag 唯一标识一种场景,必须大于0
*/
static Future<void> setUserSceneTag({ static Future<void> setUserSceneTag({
int? userSceneTag, int? userSceneTag,
}) async{ }) async {
Map<String, Object?> map = { Map<String, Object?> map = {
"userSceneTag":userSceneTag, "userSceneTag": userSceneTag,
}; };
_channel.invokeMethod("setUserSceneTag",map); _channel.invokeMethod("setUserSceneTag", map);
} }
/** /// 设置用户id
* 设置用户id /// @param userSceneTag 唯一标识一种场景,必须大于0
*
* @param userSceneTag 唯一标识一种场景,必须大于0
*/
static Future<void> setUserId({ static Future<void> setUserId({
String? userId, String? userId,
}) async{ }) async {
Map<String, Object?> map = { Map<String, Object?> map = {
"userId":userId, "userId": userId,
}; };
_channel.invokeMethod("setUserId",map); _channel.invokeMethod("setUserId", map);
} }
/** /// 添加用户数据Key,Value.
* 添加用户数据Key,Value. /// @param userKey 用户数据key
* /// @param userValue 用户数据value
* @param userKey 用户数据key
* @param userValue 用户数据value
*/
static Future<void> putUserData({ static Future<void> putUserData({
String? userKey, String? userKey,
String? userValue, String? userValue,
}) async{ }) async {
Map<String, Object?> map = { Map<String, Object?> map = {
"userKey":userKey, "userKey": userKey,
"userValue":userValue, "userValue": userValue,
}; };
_channel.invokeMethod("putUserData",map); _channel.invokeMethod("putUserData", map);
} }
} }
import 'dart:async'; import 'dart:async';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
class BuglyLog { class BuglyLog {
static const MethodChannel _channel = static const MethodChannel _channel = const MethodChannel('bugly');
const MethodChannel('bugly');
static Future<void> d({ static Future<void> d({
String? tag, String? tag,
String? content, String? content,
}) async{ }) async {
Map<String, Object?> map = { Map<String, Object?> map = {
"tag":tag, "tag": tag,
"content":content, "content": content,
}; };
_channel.invokeMethod("logd",map); _channel.invokeMethod("logd", map);
} }
static Future<void> i({ static Future<void> i({
String? tag, String? tag,
String? content, String? content,
}) async{ }) async {
Map<String, Object?> map = { Map<String, Object?> map = {
"tag":tag, "tag": tag,
"content":content, "content": content,
}; };
_channel.invokeMethod("logi",map); _channel.invokeMethod("logi", map);
} }
static Future<void> v({ static Future<void> v({
String? tag, String? tag,
String? content, String? content,
}) async{ }) async {
Map<String, Object?> map = { Map<String, Object?> map = {
"tag":tag, "tag": tag,
"content":content, "content": content,
}; };
_channel.invokeMethod("logv",map); _channel.invokeMethod("logv", map);
} }
static Future<void> w({ static Future<void> w({
String? tag, String? tag,
String? content, String? content,
}) async{ }) async {
Map<String, Object?> map = { Map<String, Object?> map = {
"tag":tag, "tag": tag,
"content":content, "content": content,
}; };
_channel.invokeMethod("logw",map); _channel.invokeMethod("logw", map);
} }
static Future<void> e({ static Future<void> e({
String? tag, String? tag,
String? content, String? content,
}) async{ }) async {
Map<String, Object?> map = { Map<String, Object?> map = {
"tag":tag, "tag": tag,
"content":content, "content": content,
}; };
_channel.invokeMethod("loge",map); _channel.invokeMethod("loge", map);
} }
} }
name: bugly_crash name: bugly_crash
description: Flutter app can use this plugin to monitor exception happened and upload error or crash to bugly server. description: Flutter app can use this plugin to monitor exception happened and upload error or crash to bugly server.
version: 0.0.3 version: 0.0.4
homepage: https://bugly.qq.com homepage: https://bugly.qq.com
environment: environment:
......
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