update version
This commit is contained in:
@@ -52,8 +52,6 @@ class AdjustService {
|
|||||||
|
|
||||||
config.isCostDataInAttributionEnabled = true;
|
config.isCostDataInAttributionEnabled = true;
|
||||||
|
|
||||||
await Adjust.requestAppTrackingAuthorization();
|
|
||||||
|
|
||||||
config.attributionCallback = (AdjustAttribution a) async {
|
config.attributionCallback = (AdjustAttribution a) async {
|
||||||
debugPrint('Adjust attribution: ${a.toString()}');
|
debugPrint('Adjust attribution: ${a.toString()}');
|
||||||
ReportService.I.attribution = a;
|
ReportService.I.attribution = a;
|
||||||
|
|||||||
@@ -1,21 +1,21 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:collection';
|
// import 'dart:collection';
|
||||||
import 'dart:convert';
|
// import 'dart:convert';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||||
import 'package:shared_preferences/shared_preferences.dart';
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
import 'package:url_launcher/url_launcher.dart';
|
import 'package:url_launcher/url_launcher.dart';
|
||||||
import '../adjust/adjust_service.dart';
|
// import '../adjust/adjust_service.dart';
|
||||||
import '../utils/aes_decrypt.dart';
|
// import '../utils/aes_decrypt.dart';
|
||||||
import '../utils/next_setp.dart';
|
import '../utils/next_setp.dart';
|
||||||
import '../utils/report.dart';
|
import '../utils/report.dart';
|
||||||
|
|
||||||
const String _webLoginTokenKey = 'assammzeeeass';
|
const String _webLoginTokenKey = 'assammzeeeass';
|
||||||
const int _maxWebViewProgressShowCount = 1;
|
const int _maxWebViewProgressShowCount = 1;
|
||||||
|
|
||||||
const String bridgeInjectScript =
|
// const String bridgeInjectScript =
|
||||||
r'''lRpL+9TjSWvxRtAeNe3FCf8MtDcHDybBZ18LVDHp06Glxe6ITkTNRyyJqAPwbxuFOY6i0vsxF+6h8YzBBeq8A0I3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W0hywDnpYKmcCRFBtgdKpHjiZUyLee8wBUMh5w4RBnASZ5mskHGrGPn7Gu9xjmyASQndAW+VZuerDRs4Mo6dzRzeU8nKOD14N376joNgbXk6W4IcpEEmT7K/l5GqTsTFZyMfbrRwWOIIvc+29zAP+ugl8M6lt8Yhu37H/GDKU5OAh/eC159fTPNRvNVRLAUotkxUeYsf3k2j2GbNmd0Yd5eRGHCixQqGbcSuHnRdcmYe7UYv69TpE/c4tedsRB3KFUqGiEfHMpHFpMFuTsd0BvN1VvZ27h3mA478luSEITqHlqQ6vf0l5TZBkX+FFKlejqSVGLNFCfQ8cXiIEda4ReygZISfUJjLUrevTvfL7Zqmxhei2GXFgCf/k71ubFeqZbrWoRSakoJ+YgkBkuEE2PrxYrKIirB1qmSV9fmMtC/1QxaAjLvrkL+LKYZpyYX+yFkA43SK674L8hNAbqohqdbhgPd7lIz3SrPZ+4su1BTS4+yS2khB71uQn/BP3WrNFz5bcIsL''';
|
||||||
Future launchURL(
|
Future launchURL(
|
||||||
String url, {
|
String url, {
|
||||||
LaunchMode mode = LaunchMode.externalApplication,
|
LaunchMode mode = LaunchMode.externalApplication,
|
||||||
@@ -69,20 +69,21 @@ class _LoadingScreenState extends State<LoadingScreen>
|
|||||||
Timer? _webViewHideTimer;
|
Timer? _webViewHideTimer;
|
||||||
|
|
||||||
URLRequest? _initialUrlRequest;
|
URLRequest? _initialUrlRequest;
|
||||||
late final UnmodifiableListView<UserScript> _initialUserScripts;
|
// late final UnmodifiableListView<UserScript> _initialUserScripts;
|
||||||
int _webViewReloadNonce = 0;
|
int _webViewReloadNonce = 0;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
// AudioManager.instance.playBgm();
|
// AudioManager.instance.playBgm();
|
||||||
_initialUserScripts = UnmodifiableListView<UserScript>([
|
// _initialUserScripts = UnmodifiableListView<UserScript>([
|
||||||
UserScript(
|
// UserScript(
|
||||||
source: _decryptScript(),
|
// source: _decryptScript(),
|
||||||
injectionTime: UserScriptInjectionTime.AT_DOCUMENT_START,
|
// injectionTime: UserScriptInjectionTime.AT_DOCUMENT_START,
|
||||||
forMainFrameOnly: true,
|
// forMainFrameOnly: true,
|
||||||
),
|
// ),
|
||||||
]);
|
// ]);
|
||||||
|
|
||||||
ReportService.I.reportInstall();
|
ReportService.I.reportInstall();
|
||||||
_startSmoothProgress();
|
_startSmoothProgress();
|
||||||
_bootstrap();
|
_bootstrap();
|
||||||
@@ -356,59 +357,59 @@ class _LoadingScreenState extends State<LoadingScreen>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _handleWebMessage(String raw) async {
|
// Future<void> _handleWebMessage(String raw) async {
|
||||||
try {
|
// try {
|
||||||
final rs = jsonDecode(raw);
|
// final rs = jsonDecode(raw);
|
||||||
if (rs is! Map<String, dynamic>) return;
|
// if (rs is! Map<String, dynamic>) return;
|
||||||
|
|
||||||
final type = rs['type'] as String?;
|
// final type = rs['type'] as String?;
|
||||||
if (type == null || type.isEmpty) return;
|
// if (type == null || type.isEmpty) return;
|
||||||
|
|
||||||
if (type == 'event') {
|
// if (type == 'event') {
|
||||||
final event = rs['event'] as String?;
|
// final event = rs['event'] as String?;
|
||||||
if (event == null || event.isEmpty) {
|
// if (event == null || event.isEmpty) {
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
final params = rs['params'] as String?;
|
// final params = rs['params'] as String?;
|
||||||
var parseParams = <String, dynamic>{};
|
// var parseParams = <String, dynamic>{};
|
||||||
if (params != null && params.isNotEmpty) {
|
// if (params != null && params.isNotEmpty) {
|
||||||
try {
|
// try {
|
||||||
parseParams = jsonDecode(params) as Map<String, dynamic>;
|
// parseParams = jsonDecode(params) as Map<String, dynamic>;
|
||||||
} catch (_) {}
|
// } catch (_) {}
|
||||||
}
|
// }
|
||||||
debugPrint('WebView event: $event');
|
// debugPrint('WebView event: $event');
|
||||||
if (event == "openWindow") {
|
// if (event == "openWindow") {
|
||||||
final url = parseParams['url'] ?? '';
|
// final url = parseParams['url'] ?? '';
|
||||||
if (url.isEmpty) {
|
// if (url.isEmpty) {
|
||||||
debugPrint("openWindow url is empty");
|
// debugPrint("openWindow url is empty");
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
launchURL(url);
|
// launchURL(url);
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
if (event == "saveLoginInfo") {
|
// if (event == "saveLoginInfo") {
|
||||||
final token = parseParams['token']?.toString().trim() ?? '';
|
// final token = parseParams['token']?.toString().trim() ?? '';
|
||||||
if (token.isNotEmpty) {
|
// if (token.isNotEmpty) {
|
||||||
final prefs = await SharedPreferences.getInstance();
|
// final prefs = await SharedPreferences.getInstance();
|
||||||
await prefs.setString(_webLoginTokenKey, token);
|
// await prefs.setString(_webLoginTokenKey, token);
|
||||||
}
|
// }
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
AdjustService.instance.trackEventWithName(event, parseParams);
|
// AdjustService.instance.trackEventWithName(event, parseParams);
|
||||||
}
|
// }
|
||||||
} catch (_) {}
|
// } catch (_) {}
|
||||||
}
|
// }
|
||||||
|
|
||||||
String _percentText() => '${(_progress * 100).round()}%';
|
String _percentText() => '${(_progress * 100).round()}%';
|
||||||
|
|
||||||
String _decryptScript() {
|
// String _decryptScript() {
|
||||||
return AesDecrypt.decryptWithKeyIv(
|
// return AesDecrypt.decryptWithKeyIv(
|
||||||
bridgeInjectScript,
|
// bridgeInjectScript,
|
||||||
key: 'a7c4141ff784c605',
|
// key: 'a7c4141ff784c605',
|
||||||
iv: '77f0946a9cc75a78',
|
// iv: '77f0946a9cc75a78',
|
||||||
) ??
|
// ) ??
|
||||||
'';
|
// '';
|
||||||
}
|
// }
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@@ -516,21 +517,21 @@ class _LoadingScreenState extends State<LoadingScreen>
|
|||||||
mediaPlaybackRequiresUserGesture: false,
|
mediaPlaybackRequiresUserGesture: false,
|
||||||
allowsInlineMediaPlayback: true,
|
allowsInlineMediaPlayback: true,
|
||||||
),
|
),
|
||||||
initialUserScripts: _initialUserScripts,
|
// initialUserScripts: _initialUserScripts,
|
||||||
onWebViewCreated: (controller) async {
|
// onWebViewCreated: (controller) async {
|
||||||
controller.addJavaScriptHandler(
|
// controller.addJavaScriptHandler(
|
||||||
handlerName: 'jsBridge',
|
// handlerName: 'jsBridge',
|
||||||
callback: (args) async {
|
// callback: (args) async {
|
||||||
try {
|
// try {
|
||||||
if (args.isEmpty) return null;
|
// if (args.isEmpty) return null;
|
||||||
final raw = args.first;
|
// final raw = args.first;
|
||||||
if (raw == null) return null;
|
// if (raw == null) return null;
|
||||||
await _handleWebMessage(raw.toString());
|
// await _handleWebMessage(raw.toString());
|
||||||
} catch (_) {}
|
// } catch (_) {}
|
||||||
return null;
|
// return null;
|
||||||
},
|
// },
|
||||||
);
|
// );
|
||||||
},
|
// },
|
||||||
onLoadStart: (controller, url) {
|
onLoadStart: (controller, url) {
|
||||||
final startedUrl = url?.toString();
|
final startedUrl = url?.toString();
|
||||||
if (startedUrl != null && startedUrl.isNotEmpty) {
|
if (startedUrl != null && startedUrl.isNotEmpty) {
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
|
import 'package:adjust_sdk/adjust.dart';
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:uuid/uuid.dart';
|
import 'package:uuid/uuid.dart';
|
||||||
import 'package:android_id/android_id.dart';
|
import 'package:android_id/android_id.dart';
|
||||||
@@ -18,10 +19,10 @@ class DeviceInfo {
|
|||||||
Future<Map<String, dynamic>> deviceInfo({
|
Future<Map<String, dynamic>> deviceInfo({
|
||||||
int adidTimeout = -1,
|
int adidTimeout = -1,
|
||||||
bool includeInstallReferrer = false,
|
bool includeInstallReferrer = false,
|
||||||
|
bool includeAdjust = true,
|
||||||
}) async {
|
}) async {
|
||||||
final Map<String, dynamic> json = {};
|
final Map<String, dynamic> json = {};
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
adidTimeout = getTimeOut(adidTimeout);
|
adidTimeout = getTimeOut(adidTimeout);
|
||||||
final packageInfo = await PackageInfo.fromPlatform();
|
final packageInfo = await PackageInfo.fromPlatform();
|
||||||
@@ -44,15 +45,24 @@ class DeviceInfo {
|
|||||||
json["model"] = androidInfo.model;
|
json["model"] = androidInfo.model;
|
||||||
json["device"] = androidInfo.device;
|
json["device"] = androidInfo.device;
|
||||||
json["androidId"] = await getAndroidId();
|
json["androidId"] = await getAndroidId();
|
||||||
|
|
||||||
} else if (Platform.isIOS) {
|
} else if (Platform.isIOS) {
|
||||||
final iosInfo = await devicePlugin.iosInfo;
|
final iosInfo = await devicePlugin.iosInfo;
|
||||||
json["osVersion"] = iosInfo.systemVersion;
|
json["osVersion"] = iosInfo.systemVersion;
|
||||||
json["model"] = iosInfo.model;
|
json["model"] = iosInfo.model;
|
||||||
json["device"] = iosInfo.modelName;
|
json["device"] = iosInfo.modelName;
|
||||||
json["androidId"] = iosInfo.identifierForVendor;
|
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) {
|
if (includeInstallReferrer) {
|
||||||
|
|||||||
@@ -75,17 +75,25 @@ class NextStep {
|
|||||||
static final NextStep I = NextStep._();
|
static final NextStep I = NextStep._();
|
||||||
|
|
||||||
Future<void> loadAppToken() async {
|
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 {
|
Future<void> loadAppInfo() async {
|
||||||
try {
|
try {
|
||||||
final deviceInfo = await _loadDeviceInfo(adidTimeout: i);
|
bool includeAdjust = _isValidToken(appToken);
|
||||||
|
final deviceInfo = await _loadDeviceInfo(adidTimeout: i,includeAdjust: includeAdjust);
|
||||||
if (deviceInfo.isEmpty) {
|
if (deviceInfo.isEmpty) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
rs = await remoteInfo(jsonEncode(deviceInfo));
|
rs = await remoteInfo(jsonEncode(deviceInfo));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
debugPrint("loadAppInfo error $e");
|
debugPrint("loadAppInfo error $e");
|
||||||
@@ -97,11 +105,6 @@ class NextStep {
|
|||||||
if (rs is! Map<String, dynamic>) {
|
if (rs is! Map<String, dynamic>) {
|
||||||
return "";
|
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() ?? '';
|
final rawUrl = rs['b']?.toString().trim() ?? '';
|
||||||
_j = parseInfo(rs['j']);
|
_j = parseInfo(rs['j']);
|
||||||
return rawUrl;
|
return rawUrl;
|
||||||
@@ -113,7 +116,6 @@ class NextStep {
|
|||||||
|
|
||||||
Future<NextResult> next() async {
|
Future<NextResult> next() async {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
final appTokenInfo = await doLoadAppToken();
|
final appTokenInfo = await doLoadAppToken();
|
||||||
if (appTokenInfo == null || !_isValidToken(appTokenInfo.token)) {
|
if (appTokenInfo == null || !_isValidToken(appTokenInfo.token)) {
|
||||||
return const NextResult(next: true, url: '');
|
return const NextResult(next: true, url: '');
|
||||||
@@ -146,8 +148,8 @@ Future<NextResult> next() async {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<Map<String, dynamic>> _loadDeviceInfo({required int adidTimeout}) async {
|
Future<Map<String, dynamic>> _loadDeviceInfo({required int adidTimeout,bool includeAdjust = true}) async {
|
||||||
return await DeviceInfo.I.deviceInfo(adidTimeout: adidTimeout);
|
return await DeviceInfo.I.deviceInfo(adidTimeout: adidTimeout,includeAdjust: includeAdjust);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<AppTokenInfo?> _fetchRemoteAppToken(PackageInfo packageInfo) async {
|
Future<AppTokenInfo?> _fetchRemoteAppToken(PackageInfo packageInfo) async {
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ class ReportService {
|
|||||||
String eventName,
|
String eventName,
|
||||||
Map<String, dynamic>? params,
|
Map<String, dynamic>? params,
|
||||||
) async {
|
) async {
|
||||||
final deviceInfo = await DeviceInfo.I.deviceInfo();
|
final deviceInfo = await DeviceInfo.I.deviceInfo(includeAdjust: false);
|
||||||
Map<String, dynamic> reportData = {
|
Map<String, dynamic> reportData = {
|
||||||
'event': eventName,
|
'event': eventName,
|
||||||
'params': params ?? {},
|
'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
|
# 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
|
# 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.
|
# 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:
|
environment:
|
||||||
sdk: ^3.11.4
|
sdk: ^3.11.4
|
||||||
|
|||||||
Reference in New Issue
Block a user