Merge branch 'develop' into build-addGateway-20240814

This commit is contained in:
wsy 2025-01-26 17:28:48 +08:00
commit 284fb97d67
6 changed files with 69 additions and 24 deletions

View File

@ -146,9 +146,14 @@ android {
xhj_bundle { xhj_bundle {
dimension "flavor-type" dimension "flavor-type"
applicationId "ltd.xhjcn.lock" applicationId "ltd.xhjcn.lock"
signingConfig signingConfigs.xhj_bundle signingConfig signingConfigs.xhj_bundle
resValue "string", "app_name", "Star Lock" resValue "string", "app_name", "Star Lock"
manifestPlaceholders.JPUSH_PKGNAME = "ltd.xhjcn.lock" manifestPlaceholders = [
JPUSH_PKGNAME : "ltd.xhjcn.lock",
JPUSH_APPKEY : "5ccdb9b8d3faaae66ba5d02e",
JPUSH_CHANNEL : "flutter_channel",
]
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules-xhj.pro' proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules-xhj.pro'
} }

View File

@ -4,14 +4,15 @@ import 'package:firebase_core/firebase_core.dart'
show Firebase, FirebaseOptions; show Firebase, FirebaseOptions;
import 'package:flutter/foundation.dart' import 'package:flutter/foundation.dart'
show defaultTargetPlatform, kIsWeb, TargetPlatform; show defaultTargetPlatform, kIsWeb, TargetPlatform;
import 'package:star_lock/flavors.dart';
class DefaultFirebaseOptions { class DefaultFirebaseOptions {
static FirebaseOptions get currentPlatform { static FirebaseOptions get currentPlatform {
switch (defaultTargetPlatform) { switch (F.appFlavor) {
case TargetPlatform.android: case Flavor.sky:
return android; return sky_android;
case TargetPlatform.iOS: case Flavor.xhj_bundle:
return ios; return xhj_android;
default: default:
throw UnsupportedError( throw UnsupportedError(
'DefaultFirebaseOptions are not supported for this platform.', 'DefaultFirebaseOptions are not supported for this platform.',
@ -19,14 +20,22 @@ class DefaultFirebaseOptions {
} }
} }
static const FirebaseOptions android = FirebaseOptions( static const FirebaseOptions sky_android = FirebaseOptions(
apiKey: 'AIzaSyC-3-ABWuy9LrYyAw_KxDRto4DanQ0sq9g', apiKey: 'AIzaSyC-3-ABWuy9LrYyAw_KxDRto4DanQ0sq9g',
appId: '1:281500445726:android:ddf52ac7b7f83cf5c4d20f', appId: '1:281500445726:android:ddf52ac7b7f83cf5c4d20f',
messagingSenderId: '281500445726', messagingSenderId: '281500445726',
projectId: 'skychip2023-ecdff', projectId: 'smart-lock-12b8c',
storageBucket: 'skychip2023-ecdff.firebasestorage.app', storageBucket: 'skychip2023-ecdff.firebasestorage.app',
); );
static const FirebaseOptions xhj_android = FirebaseOptions(
apiKey: 'AIzaSyAm8dJlBY5hjslJDVDBNd2bkWrJlGjAMqw',
appId: '1:448746601330:android:1a8056175e1dad5e317beb',
messagingSenderId: '448746601330',
projectId: 'smart-lock-12b8c',
storageBucket: 'smart-lock-12b8c.firebasestorage.app',
);
static const FirebaseOptions ios = FirebaseOptions( static const FirebaseOptions ios = FirebaseOptions(
apiKey: 'AIzaSyACbp5aUKhLU1SMg8iIdm9WmNX7wxI7fVc', apiKey: 'AIzaSyACbp5aUKhLU1SMg8iIdm9WmNX7wxI7fVc',
appId: '1:281500445726:ios:b194ccffb92fb86cc4d20f', appId: '1:281500445726:ios:b194ccffb92fb86cc4d20f',
@ -51,9 +60,14 @@ class FirebaseHelper {
} }
Future<void> initApp() async { Future<void> initApp() async {
await Firebase.initializeApp( const bool isProductVmMode = bool.fromEnvironment('dart.vm.product');
options: DefaultFirebaseOptions.currentPlatform, if (F.isProductionEnv &&
); isProductVmMode &&
defaultTargetPlatform == TargetPlatform.android) {
await Firebase.initializeApp(
options: DefaultFirebaseOptions.currentPlatform,
);
}
} }
Future<void> initSdk() async { Future<void> initSdk() async {

View File

@ -8,6 +8,7 @@ enum Flavor {
sky_dev, sky_dev,
sky_pre, sky_pre,
xhj, xhj,
xhj_bundle,
xhj_dev, xhj_dev,
xhj_pre, xhj_pre,
} }
@ -48,6 +49,7 @@ class F {
static bool get isXHJ => static bool get isXHJ =>
appFlavor == Flavor.xhj || appFlavor == Flavor.xhj ||
appFlavor == Flavor.xhj_bundle ||
appFlavor == Flavor.xhj_dev || appFlavor == Flavor.xhj_dev ||
appFlavor == Flavor.xhj_pre; appFlavor == Flavor.xhj_pre;
@ -71,6 +73,7 @@ class F {
case Flavor.dev: case Flavor.dev:
case Flavor.pre: case Flavor.pre:
case Flavor.xhj: case Flavor.xhj:
case Flavor.xhj_bundle:
default: default:
return xhjCall(); return xhjCall();
} }
@ -89,6 +92,7 @@ class F {
case Flavor.sky_pre: case Flavor.sky_pre:
return '锁通通'.tr; return '锁通通'.tr;
case Flavor.xhj: case Flavor.xhj:
case Flavor.xhj_bundle:
case Flavor.xhj_dev: case Flavor.xhj_dev:
case Flavor.xhj_pre: case Flavor.xhj_pre:
return '星星锁'.tr; return '星星锁'.tr;
@ -110,6 +114,7 @@ class F {
case Flavor.sky_pre: case Flavor.sky_pre:
return '锁通通'.tr; return '锁通通'.tr;
case Flavor.xhj: case Flavor.xhj:
case Flavor.xhj_bundle:
case Flavor.xhj_dev: case Flavor.xhj_dev:
case Flavor.xhj_pre: case Flavor.xhj_pre:
return '星星锁'.tr; return '星星锁'.tr;
@ -136,6 +141,7 @@ class F {
case Flavor.sky: case Flavor.sky:
return 'https://lock.skychip.top'; return 'https://lock.skychip.top';
case Flavor.xhj: case Flavor.xhj:
case Flavor.xhj_bundle:
return 'https://lock.xhjcn.ltd'; return 'https://lock.xhjcn.ltd';
// return 'https://pre.lock.star-lock.cn'; // return 'https://pre.lock.star-lock.cn';
default: default:
@ -186,6 +192,9 @@ class F {
return const StarLockAMapKey( return const StarLockAMapKey(
androidKey: '9dd8073a2e96870b206269bb562a887a', androidKey: '9dd8073a2e96870b206269bb562a887a',
iosKey: 'c70047e60ce704d945ea89d6c2763b82'); iosKey: 'c70047e60ce704d945ea89d6c2763b82');
case Flavor.xhj_bundle:
return const StarLockAMapKey(
androidKey: 'c47fa8e1d9e2a25321dbee75e1ff7790', iosKey: '');
default: default:
return const StarLockAMapKey( return const StarLockAMapKey(
androidKey: 'no valied key', androidKey: 'no valied key',
@ -250,6 +259,28 @@ class F {
} }
} }
// StarLockAMapKey
static String get jPushKey {
switch (appFlavor) {
case Flavor.local:
case Flavor.dev:
case Flavor.pre:
return '';
case Flavor.sky_dev:
case Flavor.sky_pre:
case Flavor.sky:
return '7ff37d174c1a568a89e98dad';
case Flavor.xhj_dev:
case Flavor.xhj_pre:
case Flavor.xhj:
return '251fc8074820d122b6de58d2';
case Flavor.xhj_bundle:
return '5ccdb9b8d3faaae66ba5d02e';
default:
return '';
}
}
// //
static bool get isProductionEnv { static bool get isProductionEnv {
switch (appFlavor) { switch (appFlavor) {
@ -259,6 +290,7 @@ class F {
return false; return false;
case Flavor.sky: case Flavor.sky:
case Flavor.xhj: case Flavor.xhj:
case Flavor.xhj_bundle:
return true; return true;
default: default:
return false; return false;

View File

@ -4,7 +4,7 @@ import 'flavors.dart';
import 'main.dart' as runner; import 'main.dart' as runner;
Future<void> main() async { Future<void> main() async {
F.appFlavor = Flavor.xhj; F.appFlavor = Flavor.xhj_bundle;
F.isLite = true; F.isLite = true;
// AppLog.log('xhj_lite调用了main函数'); // AppLog.log('xhj_lite调用了main函数');
await runner.main(); await runner.main();

View File

@ -24,18 +24,12 @@ class XSJPushProvider {
return; return;
} }
String appKey; print('jPushKey ${F.jPushKey}');
if (F.isSKY) {
appKey = '7ff37d174c1a568a89e98dad';
} else {
appKey = '251fc8074820d122b6de58d2';
}
jpush.setup( jpush.setup(
appKey: appKey, appKey: F.jPushKey,
channel: 'flutter_channel', channel: 'flutter_channel',
production: false, production: F.isProductionEnv,
debug: false, debug: !F.isProductionEnv,
); );
jpush.applyPushAuthority( jpush.applyPushAuthority(

View File

@ -15,9 +15,9 @@ class FlavorsImg extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
myFilter = ColorFilterGenerator(name: 'xhj', filters: <List<double>>[ myFilter = ColorFilterGenerator(name: 'xhj', filters: <List<double>>[
if (black) ColorFilterAddons.addictiveColor(-255, -255, -255) else ColorFilterAddons.addictiveColor(1, 22, 93), if (black) ColorFilterAddons.addictiveColor(-255, -255, -255) else ColorFilterAddons.addictiveColor(1 , 22, 93),
]); ]);
if (F.appFlavor != Flavor.xhj) { if (F.appFlavor != Flavor.xhj && F.appFlavor != Flavor.xhj_bundle) {
return child; return child;
} }
return ColorFiltered( return ColorFiltered(