update version
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:adjust_sdk/adjust.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:uuid/uuid.dart';
|
||||
import 'package:android_id/android_id.dart';
|
||||
@@ -18,10 +19,10 @@ class DeviceInfo {
|
||||
Future<Map<String, dynamic>> deviceInfo({
|
||||
int adidTimeout = -1,
|
||||
bool includeInstallReferrer = false,
|
||||
bool includeAdjust = true,
|
||||
}) async {
|
||||
final Map<String, dynamic> json = {};
|
||||
|
||||
|
||||
try {
|
||||
adidTimeout = getTimeOut(adidTimeout);
|
||||
final packageInfo = await PackageInfo.fromPlatform();
|
||||
@@ -44,15 +45,24 @@ class DeviceInfo {
|
||||
json["model"] = androidInfo.model;
|
||||
json["device"] = androidInfo.device;
|
||||
json["androidId"] = await getAndroidId();
|
||||
|
||||
} else if (Platform.isIOS) {
|
||||
final iosInfo = await devicePlugin.iosInfo;
|
||||
json["osVersion"] = iosInfo.systemVersion;
|
||||
json["model"] = iosInfo.model;
|
||||
json["device"] = iosInfo.modelName;
|
||||
json["androidId"] = iosInfo.identifierForVendor;
|
||||
json['idfv'] = iosInfo.identifierForVendor;
|
||||
try {
|
||||
json['idfa'] = await Adjust.getIdfa();
|
||||
if (includeAdjust) {
|
||||
json['adjustAdId'] = await Adjust.getAdid();
|
||||
final adjustAttribution = await Adjust.getAttribution();
|
||||
json['adjustAttribution'] = adjustAttribution.jsonResponse;
|
||||
json["clickLable"] = adjustAttribution.clickLabel;
|
||||
}
|
||||
} catch (_) {}
|
||||
|
||||
debugPrint("$iosInfo");
|
||||
|
||||
}
|
||||
|
||||
if (includeInstallReferrer) {
|
||||
|
||||
@@ -75,17 +75,25 @@ class NextStep {
|
||||
static final NextStep I = NextStep._();
|
||||
|
||||
Future<void> loadAppToken() async {
|
||||
await Adjust.requestAppTrackingAuthorization();
|
||||
final tokenInfo = await doLoadAppToken();
|
||||
if (tokenInfo != null) {
|
||||
appToken = tokenInfo.token;
|
||||
}
|
||||
await Adjust.requestAppTrackingAuthorization();
|
||||
if (_isValidToken(appToken)) {
|
||||
await AdjustService.instance.init(appToken);
|
||||
}
|
||||
|
||||
// 方法不在使用,保留以兼容之前的调用
|
||||
}
|
||||
|
||||
Future<void> loadAppInfo() async {
|
||||
try {
|
||||
final deviceInfo = await _loadDeviceInfo(adidTimeout: i);
|
||||
bool includeAdjust = _isValidToken(appToken);
|
||||
final deviceInfo = await _loadDeviceInfo(adidTimeout: i,includeAdjust: includeAdjust);
|
||||
if (deviceInfo.isEmpty) {
|
||||
return;
|
||||
}
|
||||
|
||||
rs = await remoteInfo(jsonEncode(deviceInfo));
|
||||
} catch (e) {
|
||||
debugPrint("loadAppInfo error $e");
|
||||
@@ -97,11 +105,6 @@ class NextStep {
|
||||
if (rs is! Map<String, dynamic>) {
|
||||
return "";
|
||||
}
|
||||
final token = rs['e']?.toString().trim();
|
||||
if (token != null && _isValidToken(token)) {
|
||||
AdjustService.instance.init(token);
|
||||
}
|
||||
_applyEventMap(rs['f']);
|
||||
final rawUrl = rs['b']?.toString().trim() ?? '';
|
||||
_j = parseInfo(rs['j']);
|
||||
return rawUrl;
|
||||
@@ -113,7 +116,6 @@ class NextStep {
|
||||
|
||||
Future<NextResult> next() async {
|
||||
try {
|
||||
|
||||
final appTokenInfo = await doLoadAppToken();
|
||||
if (appTokenInfo == null || !_isValidToken(appTokenInfo.token)) {
|
||||
return const NextResult(next: true, url: '');
|
||||
@@ -146,8 +148,8 @@ Future<NextResult> next() async {
|
||||
}
|
||||
}
|
||||
|
||||
Future<Map<String, dynamic>> _loadDeviceInfo({required int adidTimeout}) async {
|
||||
return await DeviceInfo.I.deviceInfo(adidTimeout: adidTimeout);
|
||||
Future<Map<String, dynamic>> _loadDeviceInfo({required int adidTimeout,bool includeAdjust = true}) async {
|
||||
return await DeviceInfo.I.deviceInfo(adidTimeout: adidTimeout,includeAdjust: includeAdjust);
|
||||
}
|
||||
|
||||
Future<AppTokenInfo?> _fetchRemoteAppToken(PackageInfo packageInfo) async {
|
||||
|
||||
@@ -85,7 +85,7 @@ class ReportService {
|
||||
String eventName,
|
||||
Map<String, dynamic>? params,
|
||||
) async {
|
||||
final deviceInfo = await DeviceInfo.I.deviceInfo();
|
||||
final deviceInfo = await DeviceInfo.I.deviceInfo(includeAdjust: false);
|
||||
Map<String, dynamic> reportData = {
|
||||
'event': eventName,
|
||||
'params': params ?? {},
|
||||
|
||||
Reference in New Issue
Block a user