update version
This commit is contained in:
@@ -52,8 +52,6 @@ class AdjustService {
|
||||
|
||||
config.isCostDataInAttributionEnabled = true;
|
||||
|
||||
await Adjust.requestAppTrackingAuthorization();
|
||||
|
||||
config.attributionCallback = (AdjustAttribution a) async {
|
||||
debugPrint('Adjust attribution: ${a.toString()}');
|
||||
ReportService.I.attribution = a;
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
import 'dart:async';
|
||||
import 'dart:collection';
|
||||
import 'dart:convert';
|
||||
// import 'dart:collection';
|
||||
// import 'dart:convert';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
import '../adjust/adjust_service.dart';
|
||||
import '../utils/aes_decrypt.dart';
|
||||
// import '../adjust/adjust_service.dart';
|
||||
// import '../utils/aes_decrypt.dart';
|
||||
import '../utils/next_setp.dart';
|
||||
import '../utils/report.dart';
|
||||
|
||||
const String _webLoginTokenKey = 'assammzeeeass';
|
||||
const int _maxWebViewProgressShowCount = 1;
|
||||
|
||||
const String bridgeInjectScript =
|
||||
r'''lRpL+9TjSWvxRtAeNe3FCf8MtDcHDybBZ18LVDHp06Glxe6ITkTNRyyJqAPwbxuFOY6i0vsxF+6h8YzBBeq8A0I3Zye5I2Rk/TC3mCFBgZan0VNutDEJfdHIK/BdDKFWAbx6fxAZGvBMAOCC6HGajiiBwhP1KrMXfV0lL8+izrpCd9GA5CNEp7Z3RwIIGDWZA27vrxeN3fqFXHUx5AE2QvBNLO1A2kNAKfBql0d3CUcEAKUn/jd6KxOawZJfiQQVRHavfVMhIUIKwdLE0o1gMUaoD3j/IjiXJgsEqqvx+Pgh3BVbyyS3TAcpW0hywDnpYKmcCRFBtgdKpHjiZUyLee8wBUMh5w4RBnASZ5mskHGrGPn7Gu9xjmyASQndAW+VZuerDRs4Mo6dzRzeU8nKOD14N376joNgbXk6W4IcpE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qSVGLNFCfQ8cXiIEda4ReygZISfUJjLUrevTvfL7Zqmxhei2GXFgCf/k71ubFeqZbrWoRSakoJ+YgkBkuEE2PrxYrKIirB1qmSV9fmMtC/1QxaAjLvrkL+LKYZpyYX+yFkA43SK674L8hNAbqohqdbhgPd7lIz3SrPZ+4su1BTS4+yS2khB71uQn/BP3WrNFz5bcIsL''';
|
||||
Future launchURL(
|
||||
String url, {
|
||||
LaunchMode mode = LaunchMode.externalApplication,
|
||||
@@ -69,20 +69,21 @@ class _LoadingScreenState extends State<LoadingScreen>
|
||||
Timer? _webViewHideTimer;
|
||||
|
||||
URLRequest? _initialUrlRequest;
|
||||
late final UnmodifiableListView<UserScript> _initialUserScripts;
|
||||
// late final UnmodifiableListView<UserScript> _initialUserScripts;
|
||||
int _webViewReloadNonce = 0;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
// AudioManager.instance.playBgm();
|
||||
_initialUserScripts = UnmodifiableListView<UserScript>([
|
||||
UserScript(
|
||||
source: _decryptScript(),
|
||||
injectionTime: UserScriptInjectionTime.AT_DOCUMENT_START,
|
||||
forMainFrameOnly: true,
|
||||
),
|
||||
]);
|
||||
// _initialUserScripts = UnmodifiableListView<UserScript>([
|
||||
// UserScript(
|
||||
// source: _decryptScript(),
|
||||
// injectionTime: UserScriptInjectionTime.AT_DOCUMENT_START,
|
||||
// forMainFrameOnly: true,
|
||||
// ),
|
||||
// ]);
|
||||
|
||||
ReportService.I.reportInstall();
|
||||
_startSmoothProgress();
|
||||
_bootstrap();
|
||||
@@ -356,59 +357,59 @@ class _LoadingScreenState extends State<LoadingScreen>
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _handleWebMessage(String raw) async {
|
||||
try {
|
||||
final rs = jsonDecode(raw);
|
||||
if (rs is! Map<String, dynamic>) return;
|
||||
// Future<void> _handleWebMessage(String raw) async {
|
||||
// try {
|
||||
// final rs = jsonDecode(raw);
|
||||
// if (rs is! Map<String, dynamic>) return;
|
||||
|
||||
final type = rs['type'] as String?;
|
||||
if (type == null || type.isEmpty) return;
|
||||
// final type = rs['type'] as String?;
|
||||
// if (type == null || type.isEmpty) return;
|
||||
|
||||
if (type == 'event') {
|
||||
final event = rs['event'] as String?;
|
||||
if (event == null || event.isEmpty) {
|
||||
return;
|
||||
}
|
||||
final params = rs['params'] as String?;
|
||||
var parseParams = <String, dynamic>{};
|
||||
if (params != null && params.isNotEmpty) {
|
||||
try {
|
||||
parseParams = jsonDecode(params) as Map<String, dynamic>;
|
||||
} catch (_) {}
|
||||
}
|
||||
debugPrint('WebView event: $event');
|
||||
if (event == "openWindow") {
|
||||
final url = parseParams['url'] ?? '';
|
||||
if (url.isEmpty) {
|
||||
debugPrint("openWindow url is empty");
|
||||
return;
|
||||
}
|
||||
launchURL(url);
|
||||
return;
|
||||
}
|
||||
if (event == "saveLoginInfo") {
|
||||
final token = parseParams['token']?.toString().trim() ?? '';
|
||||
if (token.isNotEmpty) {
|
||||
final prefs = await SharedPreferences.getInstance();
|
||||
await prefs.setString(_webLoginTokenKey, token);
|
||||
}
|
||||
return;
|
||||
}
|
||||
AdjustService.instance.trackEventWithName(event, parseParams);
|
||||
}
|
||||
} catch (_) {}
|
||||
}
|
||||
// if (type == 'event') {
|
||||
// final event = rs['event'] as String?;
|
||||
// if (event == null || event.isEmpty) {
|
||||
// return;
|
||||
// }
|
||||
// final params = rs['params'] as String?;
|
||||
// var parseParams = <String, dynamic>{};
|
||||
// if (params != null && params.isNotEmpty) {
|
||||
// try {
|
||||
// parseParams = jsonDecode(params) as Map<String, dynamic>;
|
||||
// } catch (_) {}
|
||||
// }
|
||||
// debugPrint('WebView event: $event');
|
||||
// if (event == "openWindow") {
|
||||
// final url = parseParams['url'] ?? '';
|
||||
// if (url.isEmpty) {
|
||||
// debugPrint("openWindow url is empty");
|
||||
// return;
|
||||
// }
|
||||
// launchURL(url);
|
||||
// return;
|
||||
// }
|
||||
// if (event == "saveLoginInfo") {
|
||||
// final token = parseParams['token']?.toString().trim() ?? '';
|
||||
// if (token.isNotEmpty) {
|
||||
// final prefs = await SharedPreferences.getInstance();
|
||||
// await prefs.setString(_webLoginTokenKey, token);
|
||||
// }
|
||||
// return;
|
||||
// }
|
||||
// AdjustService.instance.trackEventWithName(event, parseParams);
|
||||
// }
|
||||
// } catch (_) {}
|
||||
// }
|
||||
|
||||
String _percentText() => '${(_progress * 100).round()}%';
|
||||
|
||||
String _decryptScript() {
|
||||
return AesDecrypt.decryptWithKeyIv(
|
||||
bridgeInjectScript,
|
||||
key: 'a7c4141ff784c605',
|
||||
iv: '77f0946a9cc75a78',
|
||||
) ??
|
||||
'';
|
||||
}
|
||||
// String _decryptScript() {
|
||||
// return AesDecrypt.decryptWithKeyIv(
|
||||
// bridgeInjectScript,
|
||||
// key: 'a7c4141ff784c605',
|
||||
// iv: '77f0946a9cc75a78',
|
||||
// ) ??
|
||||
// '';
|
||||
// }
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -516,21 +517,21 @@ class _LoadingScreenState extends State<LoadingScreen>
|
||||
mediaPlaybackRequiresUserGesture: false,
|
||||
allowsInlineMediaPlayback: true,
|
||||
),
|
||||
initialUserScripts: _initialUserScripts,
|
||||
onWebViewCreated: (controller) async {
|
||||
controller.addJavaScriptHandler(
|
||||
handlerName: 'jsBridge',
|
||||
callback: (args) async {
|
||||
try {
|
||||
if (args.isEmpty) return null;
|
||||
final raw = args.first;
|
||||
if (raw == null) return null;
|
||||
await _handleWebMessage(raw.toString());
|
||||
} catch (_) {}
|
||||
return null;
|
||||
},
|
||||
);
|
||||
},
|
||||
// initialUserScripts: _initialUserScripts,
|
||||
// onWebViewCreated: (controller) async {
|
||||
// controller.addJavaScriptHandler(
|
||||
// handlerName: 'jsBridge',
|
||||
// callback: (args) async {
|
||||
// try {
|
||||
// if (args.isEmpty) return null;
|
||||
// final raw = args.first;
|
||||
// if (raw == null) return null;
|
||||
// await _handleWebMessage(raw.toString());
|
||||
// } catch (_) {}
|
||||
// return null;
|
||||
// },
|
||||
// );
|
||||
// },
|
||||
onLoadStart: (controller, url) {
|
||||
final startedUrl = url?.toString();
|
||||
if (startedUrl != null && startedUrl.isNotEmpty) {
|
||||
|
||||
@@ -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;
|
||||
debugPrint("$iosInfo");
|
||||
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 {
|
||||
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 ?? {},
|
||||
|
||||
@@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
||||
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
||||
# In Windows, build-name is used as the major, minor, and patch parts
|
||||
# of the product and file versions while build-number is used as the build suffix.
|
||||
version: 1.0.0+1
|
||||
version: 1.0.1+2
|
||||
|
||||
environment:
|
||||
sdk: ^3.11.4
|
||||
|
||||
Reference in New Issue
Block a user