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 {
dimension "flavor-type"
applicationId "ltd.xhjcn.lock"
signingConfig signingConfigs.xhj_bundle
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'
}

View File

@ -4,14 +4,15 @@ import 'package:firebase_core/firebase_core.dart'
show Firebase, FirebaseOptions;
import 'package:flutter/foundation.dart'
show defaultTargetPlatform, kIsWeb, TargetPlatform;
import 'package:star_lock/flavors.dart';
class DefaultFirebaseOptions {
static FirebaseOptions get currentPlatform {
switch (defaultTargetPlatform) {
case TargetPlatform.android:
return android;
case TargetPlatform.iOS:
return ios;
switch (F.appFlavor) {
case Flavor.sky:
return sky_android;
case Flavor.xhj_bundle:
return xhj_android;
default:
throw UnsupportedError(
'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',
appId: '1:281500445726:android:ddf52ac7b7f83cf5c4d20f',
messagingSenderId: '281500445726',
projectId: 'skychip2023-ecdff',
projectId: 'smart-lock-12b8c',
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(
apiKey: 'AIzaSyACbp5aUKhLU1SMg8iIdm9WmNX7wxI7fVc',
appId: '1:281500445726:ios:b194ccffb92fb86cc4d20f',
@ -51,9 +60,14 @@ class FirebaseHelper {
}
Future<void> initApp() async {
await Firebase.initializeApp(
options: DefaultFirebaseOptions.currentPlatform,
);
const bool isProductVmMode = bool.fromEnvironment('dart.vm.product');
if (F.isProductionEnv &&
isProductVmMode &&
defaultTargetPlatform == TargetPlatform.android) {
await Firebase.initializeApp(
options: DefaultFirebaseOptions.currentPlatform,
);
}
}
Future<void> initSdk() async {

View File

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

View File

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

View File

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

View File

@ -15,9 +15,9 @@ class FlavorsImg extends StatelessWidget {
@override
Widget build(BuildContext context) {
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 ColorFiltered(