Commit 5b5ca491268f1ce8db9cb84b4687e773587b567e

Authored by 刘宏哲
1 parent 37deec52

feat(app): bug fixed

Showing 35 changed files with 284 additions and 92 deletions
import 'package:doublefeel_flutter/app/routes/app_pages.dart';
import 'package:doublefeel_flutter/app/utils/platform_compact.dart';
import 'package:doublefeel_flutter/core/theme/app_colors.dart';
import 'package:doublefeel_flutter/core/theme/app_theme.dart';
import 'package:doublefeel_flutter/l10n/l10n_extensions.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
... ... @@ -69,10 +69,33 @@ class HelpView extends GetView<HelpController> {
}
List<({String title, List<String> body})> _buildFaqItems(
BuildContext context,
) {
BuildContext context) {
final l10n = context.l10n;
if (isOhos()) {
return [
(
title: "APP没有数据怎么办",
body: [
"1、 确定手表系统在 5.1.0.32SP3 及以上,手表型号需为 WATCH GT 5 系列(含 Pro)/ WATCH 4 系列以上,手环从华为手环 10 及以上。",
"2、确认设备是否处于省电模式、低电量状态或手表佩戴未贴紧,以上情况会影响手表数据采集。",
l10n.helpNoDataReasonFooter,
],
),
(
title: l10n.todayFaqLinkHrvRealtimeUpdate,
body: [
"在智能手表的默认设置下,HRV 每1小时更新一次。",
"为了解决 HRV 更新间隔较长的问题,DoubleFeel 设计了实时压力功能:",
"实时压力每6分钟更新一次(好友状态更新依赖 华为健康 同步,受系统机制影响可能存在短暂延迟。若好友经常使用DoubleFeel,健康状态会更新得更加及时)",
l10n.todayRealtimeStressScenarioTimely,
l10n.todayRealtimeStressScenarioConsistentTrend,
l10n.todayRealtimeStressScenarioSummary,
],
)
];
}
return [
(
title: l10n.todayFaqLinkNoData,
... ... @@ -141,7 +164,7 @@ class _FaqCard extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container(
height: 257,
height: 149,
padding: EdgeInsets.fromLTRB(20, 20, 20, 9),
decoration: BoxDecoration(
color: Colors.white,
... ...
... ... @@ -305,26 +305,26 @@ class TodayController extends GetxController with WidgetsBindingObserver {
}
}
Future<void> _checkHealthAuthStatus(
Future<bool> _checkHealthAuthStatus(
{bool isPullToRefresh = false,
bool shouldCaculateAndUpload = false}) async {
final result = await _hostApi.checkHealthAppAuthorization();
_currentStatus = result.status;
_refreshHealthDataAuthCardStatus(status: _currentStatus);
if (_currentStatus != 1) {
return;
return false;
}
if (!shouldCaculateAndUpload) {
return;
return false;
}
_performCaculateAndUpload(isPullToRefresh: isPullToRefresh);
return _performCaculateAndUpload(isPullToRefresh: isPullToRefresh);
}
_performCaculateAndUpload({
Future<bool> _performCaculateAndUpload({
bool isPullToRefresh = false,
}) {
_performHealthDataUpload();
_calculateHealthDataWithoutLoading(
return _calculateHealthDataWithoutLoading(
uploaded: () async {
_refreshHealthDataAuthCardStatus(status: 1);
},
... ... @@ -520,13 +520,21 @@ class TodayController extends GetxController with WidgetsBindingObserver {
firstSelectableDay.value = firstTime;
} else {
try {
await _checkHealthAuthStatus(
final didCalculateAndReload = await _checkHealthAuthStatus(
isPullToRefresh: isPullToRefresh,
shouldCaculateAndUpload: shouldCaculateAndUpload);
ta.setSuperProperties(
{'health_data_permission': _currentStatus.clamp(0, 1)});
unawaited(loadDataForDate(selectedDate.value,
isPullToRefresh: isPullToRefresh));
// When a pull-to-refresh asks OHOS to recalculate health data,
// _calculateHealthDataWithoutLoading already reloads the page after
// the calculation. Starting another load here caused a second visible
// refresh shortly after the first one completed.
if (!didCalculateAndReload) {
await loadDataForDate(
selectedDate.value,
isPullToRefresh: isPullToRefresh,
);
}
} catch (error, stackTrace) {
AppLogger.e(
'TodayController.checkHealthDataAuthCardVisible failed',
... ... @@ -556,25 +564,25 @@ class TodayController extends GetxController with WidgetsBindingObserver {
_refreshHealthDataAuthCardStatus(status: result.status);
}
void _calculateHealthDataWithoutLoading(
Future<bool> _calculateHealthDataWithoutLoading(
{Future<void> Function()? uploaded,
bool isPullToRefresh = false,
bool refreshAfterComplete = false}) {
unawaited(
(() async {
try {
await _healthRawDataCoreService.startCoreCaculate();
await loadDataForDate(selectedDate.value,
isPullToRefresh: isPullToRefresh);
await uploaded?.call();
if (refreshAfterComplete) {
await loadDataForDate(selectedDate.value);
}
} catch (error, stackTrace) {
AppLogger.e('Apple Health calculate failed', error, stackTrace);
}
})(),
);
bool refreshAfterComplete = false}) async {
try {
await _healthRawDataCoreService.startCoreCaculate();
await loadDataForDate(
selectedDate.value,
isPullToRefresh: isPullToRefresh,
);
await uploaded?.call();
if (refreshAfterComplete) {
await loadDataForDate(selectedDate.value);
}
return true;
} catch (error, stackTrace) {
AppLogger.e('Apple Health calculate failed', error, stackTrace);
return false;
}
}
void _performHealthDataUpload() {
... ... @@ -925,7 +933,7 @@ class TodayController extends GetxController with WidgetsBindingObserver {
DateUtils.dateOnly(selectedDate.value),
DateUtils.dateOnly(DateTime.now()),
);
checkHealthDataAuthCardVisible(
await checkHealthDataAuthCardVisible(
isPullToRefresh: isPullToRefresh,
shouldCaculateAndUpload: isOhos() && isSelectedToday,
);
... ...
... ... @@ -3,20 +3,17 @@ import 'package:doublefeel_flutter/app/models/dialog_meta_data.dart';
import 'package:doublefeel_flutter/app/modules/home/controllers/my_controller.dart';
import 'package:doublefeel_flutter/app/routes/app_pages.dart';
import 'package:doublefeel_flutter/app/utils/dialog_utils.dart';
import 'package:doublefeel_flutter/app/widget/marquee_text.dart';
import 'package:doublefeel_flutter/app/utils/platform_compact.dart';
import 'package:doublefeel_flutter/core/network/api/user_api.dart';
import 'package:doublefeel_flutter/core/result/app_result.dart';
import 'package:doublefeel_flutter/core/services/loading_service.dart';
import 'package:doublefeel_flutter/core/services/user_state_service.dart';
import 'package:doublefeel_flutter/core/theme/app_theme.dart';
import 'package:doublefeel_flutter/core/util/app_toast.dart';
import 'package:doublefeel_flutter/data/local/user_preferences_storage.dart';
import 'package:doublefeel_flutter/data/models/user/user_models.dart';
import 'package:doublefeel_flutter/l10n/l10n_extensions.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
class AccountSettingView extends GetView<MyController> {
... ... @@ -496,7 +493,7 @@ class _DeleteAccountBottomSheet extends StatelessWidget {
height: 12,
),
Text(
context.l10n.deleteAccountWarningNote1,
_getWarningNote1(context),
style: TextStyle(
color: context.colors.textSecondary,
fontSize: 12,
... ... @@ -507,7 +504,7 @@ class _DeleteAccountBottomSheet extends StatelessWidget {
height: 12,
),
Text(
context.l10n.deleteAccountWarningNote2,
_getWarningNote2(context),
style: TextStyle(
color: context.colors.textSecondary,
fontSize: 12,
... ... @@ -570,4 +567,18 @@ class _DeleteAccountBottomSheet extends StatelessWidget {
),
);
}
String _getWarningNote1(BuildContext context) {
if (isOhos()) {
return "注1:你的健康数据会保存在华为健康,我们不会删除华为健康中的数据。";
}
return context.l10n.deleteAccountWarningNote1;
}
String _getWarningNote2(BuildContext context) {
if (isOhos()) {
return "注2:删除账号不会影响你在支付宝的自动续费状态,如果需要取消自动续费,请在支付宝中手动取消。";
}
return context.l10n.deleteAccountWarningNote2;
}
}
... ...
... ... @@ -150,7 +150,7 @@ class StressStatusExplanationBottomSheet extends StatelessWidget {
const SizedBox(height: 12),
isOhos()
? _InfoCard(
title: '手机 App 与智能表显示的压力状态有什么区别?',
title: '手机 App 与智能表显示的压力状态有什么区别?',
children: [
_InfoText(
'手机 App 首页显示的是当天的综合压力状态,会综合分析 HRV、静息心率与整日身体趋势。'),
... ...
... ... @@ -46,7 +46,9 @@ class TodayHealthDataAuthCard extends StatelessWidget {
),
const SizedBox(height: 5),
Text(
l10n.todayHealthDataAuthDescription,
isOhos()
? 'DoubleFeel 需要访问你的华为健康数据,以提供压力提醒、实时压力统计和健康建议。\n如果尚未授权,请点击下方完成授权;如果已经授权,首次同步大量健康数据可能需要等待几分钟,请稍后再试。'
: l10n.todayHealthDataAuthDescription,
style: TextStyle(
color: colors.textSecondary,
fontSize: 13,
... ...
import 'dart:async';
import 'package:doublefeel_flutter/app/utils/platform_compact.dart';
import 'package:doublefeel_flutter/core/config/app_environment_config.dart';
import 'package:doublefeel_flutter/core/theme/app_theme.dart';
import 'package:doublefeel_flutter/data/local/user_preferences_storage.dart';
... ... @@ -9,7 +10,6 @@ import 'package:fl_chart/fl_chart.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:intl/intl.dart';
import 'package:lottie/lottie.dart';
import '../../controllers/today_controller.dart';
import 'hrv_principle_explanation_bottom_sheet.dart';
... ... @@ -399,6 +399,7 @@ class TodayHrvChartCard extends StatelessWidget {
List<TextSpan>? _getTooltip(
BarChartRodData rod, int x, int? state, bool? isWorkout) {
final useOhosIcon = isOhos();
return [
TextSpan(
text: isWorkout == true ? '◉ ' : '○ ',
... ... @@ -432,14 +433,16 @@ class TodayHrvChartCard extends StatelessWidget {
),
),
TextSpan(
text: '♥ ',
style: const TextStyle(
color: Color(0xFFB0B0B6),
fontSize: 14,
fontWeight: FontWeight.bold,
text:
useOhosIcon ? String.fromCharCode(Icons.favorite.codePoint) : '♥ ',
style: TextStyle(
inherit: false,
fontFamilyFallback: null,
fontFamily: '',
fontFamily: useOhosIcon ? Icons.favorite.fontFamily : '',
package: useOhosIcon ? Icons.favorite.fontPackage : null,
color: const Color(0xFFB0B0B6),
fontSize: 14,
fontWeight: FontWeight.bold,
),
),
TextSpan(
... ... @@ -454,6 +457,7 @@ class TodayHrvChartCard extends StatelessWidget {
}
List<TextSpan>? _getTooltipChildren(LineBarSpot flSpot, int? state) {
final useOhosIcon = isOhos();
return [
TextSpan(
text: '○ ',
... ... @@ -482,12 +486,14 @@ class TodayHrvChartCard extends StatelessWidget {
),
),
TextSpan(
text: '♥ ',
style: const TextStyle(
text:
useOhosIcon ? String.fromCharCode(Icons.favorite.codePoint) : '♥ ',
style: TextStyle(
inherit: false,
fontFamilyFallback: null,
fontFamily: '',
color: Color(0xFFB0B0B6),
fontFamily: useOhosIcon ? Icons.favorite.fontFamily : '',
package: useOhosIcon ? Icons.favorite.fontPackage : null,
color: const Color(0xFFB0B0B6),
fontSize: 14,
fontWeight: FontWeight.bold,
),
... ... @@ -962,10 +968,13 @@ class _StressBarChartState extends State<_StressBarChart> {
final centerOfBar =
_stressTouchedGroupIndex! * stepWidth + (barWidth / 2);
customIndicator = Positioned(
left: centerOfBar - 1.0, // 2px 宽度,居中
left: centerOfBar - 1.0,
// 2px 宽度,居中
width: 2.0,
top: 12.0, // 向上延展以连接 tooltip 底部
bottom: chartHeight - gridBottom, // 修正:bottom 指的是距离 Stack 底部的像素值
top: 12.0,
// 向上延展以连接 tooltip 底部
bottom: chartHeight - gridBottom,
// 修正:bottom 指的是距离 Stack 底部的像素值
child: IgnorePointer(
child: ColoredBox(
color: context.colors.textTertiary,
... ... @@ -1144,9 +1153,10 @@ class _StressBarChartState extends State<_StressBarChart> {
tooltipBorder: BorderSide.none,
maxContentWidth: 400,
fitInsideHorizontally: true,
fitInsideVertically:
false, // 允许 tooltip 超出 BarChart 顶边界(绘制在 18px 的 top margin 区域内)
tooltipMargin: 6, // 调整为和折线图一样的 6 像素空隙
fitInsideVertically: false,
// 允许 tooltip 超出 BarChart 顶边界(绘制在 18px 的 top margin 区域内)
tooltipMargin: 6,
// 调整为和折线图一样的 6 像素空隙
getTooltipColor: (touchedSpot) => const Color(0xFFF3F3F3),
tooltipPadding: const EdgeInsets.only(
left: 12,
... ...
import 'package:cached_network_image/cached_network_image.dart';
import 'package:doublefeel_flutter/core/theme/app_theme.dart';
import 'package:doublefeel_flutter/data/local/user_preferences_storage.dart';
import 'package:doublefeel_flutter/data/models/friend/friend_models.dart';
... ... @@ -40,7 +39,7 @@ class TrendFriendSelectBottomSheet extends StatelessWidget {
children: [
Center(
child: Text(
'Choose a Loved One',
context.l10n.friendsSelect,
style: TextStyle(
color: context.colors.textPrimary,
fontSize: 16,
... ...
import 'dart:async';
import 'dart:convert';
import 'package:crypto/crypto.dart';
import 'package:flutter_timezone/flutter_timezone.dart';
import 'package:doublefeel_flutter/app/modules/login/views/email_login_new_password_view.dart';
import 'package:doublefeel_flutter/app/modules/login/views/email_login_view.dart';
import 'package:doublefeel_flutter/app/routes/app_pages.dart';
import 'package:doublefeel_flutter/core/config/app_environment_config.dart';
import 'package:doublefeel_flutter/core/constants/app_const.dart';
import 'package:doublefeel_flutter/core/logging/app_logger.dart';
import 'package:doublefeel_flutter/core/services/app_config_service.dart';
import 'package:doublefeel_flutter/core/services/thinking_data_service.dart';
import 'package:doublefeel_flutter/data/models/local/user_preferences.dart';
import 'package:doublefeel_flutter/l10n/gen/app_localizations.dart';
import 'package:doublefeel_flutter/l10n/l10n_extensions.dart';
import 'package:doublefeel_flutter/core/platform/pigeon_api_facade.dart';
import 'package:flutter/services.dart';
import 'package:flutter/widgets.dart';
import 'package:get/get.dart';
import 'package:doublefeel_flutter/core/util/app_toast.dart';
import 'package:doublefeel_flutter/core/network/api/user_api.dart';
import 'package:doublefeel_flutter/core/network/api/vip_api.dart';
import 'package:doublefeel_flutter/core/platform/pigeon_api_facade.dart';
import 'package:doublefeel_flutter/core/result/app_result.dart';
import 'package:doublefeel_flutter/core/services/app_config_service.dart';
import 'package:doublefeel_flutter/core/services/loading_service.dart';
import 'package:doublefeel_flutter/core/services/thinking_data_service.dart';
import 'package:doublefeel_flutter/core/services/user_state_service.dart';
import 'package:doublefeel_flutter/core/util/app_toast.dart';
import 'package:doublefeel_flutter/data/local/local_storage.dart';
import 'package:doublefeel_flutter/data/local/user_account_storage.dart';
import 'package:doublefeel_flutter/data/local/user_preferences_storage.dart';
import 'package:doublefeel_flutter/data/models/local/user_preferences.dart';
import 'package:doublefeel_flutter/data/models/user/user_models.dart';
import 'package:doublefeel_flutter/data/models/vip/vip_info.dart';
import 'package:doublefeel_flutter/core/result/app_result.dart';
import 'package:doublefeel_flutter/app/routes/app_pages.dart';
import 'package:doublefeel_flutter/core/services/loading_service.dart';
import 'package:doublefeel_flutter/l10n/l10n_extensions.dart';
import 'package:doublefeel_flutter/pigeon/wechat_api.g.dart';
import 'package:flutter/services.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_timezone/flutter_timezone.dart';
import 'package:get/get.dart';
class LoginController extends GetxController {
final UserApi _userApi = Get.find<UserApi>();
... ... @@ -81,6 +81,7 @@ class LoginController extends GetxController {
bool get isEmailValid =>
_emailRegex.hasMatch(emailInput.value.trim()) &&
emailInput.value.isNotEmpty;
bool get isPasswordValid =>
_passwordRegex.hasMatch(passwordInput.value) &&
passwordInput.value.isNotEmpty;
... ... @@ -205,7 +206,16 @@ class LoginController extends GetxController {
if (code.isEmpty) return;
await _loginWithWechat(code);
} catch (e) {
AppToast.show(e.toString());
if (e is PlatformException) {
var msg = e.message ?? "";
if (msg.isNotEmpty) {
AppToast.show(msg);
} else {
AppToast.show("微信登录失败");
}
} else {
AppToast.show(e.toString());
}
}
}
... ... @@ -556,7 +566,7 @@ class LoginController extends GetxController {
} else if (isWechat) {
registerData = {
'login_type': 'wechat',
'code': wechatCode,
'wechat_code': wechatCode,
};
} else {
registerData = {
... ...
... ... @@ -2,6 +2,7 @@ import 'package:doublefeel_flutter/app/modules/home/views/tabs/my_tab.dart';
import 'package:doublefeel_flutter/app/modules/membership_offer/controllers/membership_detail_controller.dart';
import 'package:doublefeel_flutter/app/modules/purchase/widgets/purchase_colors.dart';
import 'package:doublefeel_flutter/app/modules/purchase/widgets/refund_explanation_bottom_sheet.dart';
import 'package:doublefeel_flutter/app/utils/platform_compact.dart';
import 'package:doublefeel_flutter/app/widget/premium_benefit_list_view.dart';
import 'package:doublefeel_flutter/core/theme/app_theme.dart';
import 'package:doublefeel_flutter/data/local/user_preferences_storage.dart';
... ... @@ -249,10 +250,11 @@ class MembershipDetailView extends GetView<MembershipDetailController> {
],
),
),
if (vipInfo?.vipType == 1 ||
vipInfo?.vipType == 2 ||
vipInfo?.vipType == 3 ||
vipInfo?.vipType == 4)
if (!isOhos() &&
(vipInfo?.vipType == 1 ||
vipInfo?.vipType == 2 ||
vipInfo?.vipType == 3 ||
vipInfo?.vipType == 4))
GestureDetector(
onTap: () {
controller.manageSubscription();
... ... @@ -365,6 +367,49 @@ class _LegalNotes extends StatelessWidget {
@override
Widget build(BuildContext context) {
if (isOhos()) {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
context.l10n.purchaseNotesTitle,
style: const TextStyle(
color: Colors.black,
fontSize: 18,
fontWeight: FontWeight.w600,
height: 1.2,
),
),
const SizedBox(height: 24),
const _LegalText(
prefix: '1. ',
text: '确认支付成功后,会员权益将立即生效。',
),
const SizedBox(height: 12),
const _LegalText(
prefix: '2. ',
text: 'DoubleFeel Pro 会员属于虚拟服务商品,购买后除法律法规另有规定外,通常不支持退款。',
),
const SizedBox(height: 12),
const _LegalText(
prefix: '3. ',
text: '如支付成功后会员未生效,请尝试重新登录账号。',
),
const SizedBox(height: 12),
_LegalText(
prefix: '4. ',
text: '如果有更多其它问题请',
linkText: context.l10n.purchaseLinkContactUs,
linkSuffix: '。',
onLinkTap: controller.openContactUs,
),
],
),
);
}
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: Column(
... ...
import 'package:doublefeel_flutter/app/utils/assets_helper.dart';
import 'package:doublefeel_flutter/app/utils/platform_compact.dart';
import 'package:doublefeel_flutter/app/widget/payment_confirmation_bottom_sheet.dart';
import 'package:doublefeel_flutter/app/widget/premium_benefit_list_view.dart';
import 'package:doublefeel_flutter/core/util/size_extensions.dart';
... ... @@ -265,6 +266,48 @@ class _LegalNotes extends StatelessWidget {
@override
Widget build(BuildContext context) {
if (isOhos()) {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
context.l10n.purchaseNotesTitle,
style: const TextStyle(
color: Colors.black,
fontSize: 18,
fontWeight: FontWeight.w600,
height: 1.2,
),
),
const SizedBox(height: 24),
const _LegalText(
prefix: '1. ',
text: '确认支付成功后,会员权益将立即生效。',
),
const SizedBox(height: 12),
const _LegalText(
prefix: '2. ',
text: 'DoubleFeel Pro 会员属于虚拟服务商品,购买后除法律法规另有规定外,通常不支持退款。',
),
const SizedBox(height: 12),
const _LegalText(
prefix: '3. ',
text: '如支付成功后会员未生效,请尝试重新登录账号。',
),
const SizedBox(height: 12),
_LegalText(
prefix: '4. ',
text: '如果有更多其它问题请',
linkText: context.l10n.purchaseLinkContactUs,
linkSuffix: '。',
onLinkTap: controller.openContactUs,
),
],
),
);
}
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: Column(
... ...
... ... @@ -2,10 +2,8 @@ import 'dart:io';
bool isOhos() {
return Platform.isOhos;
// return true;
}
bool isIOS() {
return Platform.isIOS;
// return false;
}
... ...
... ... @@ -3,6 +3,8 @@
"analyzerMode":"BEFORE_RELEASE_CHECK_MODE",
"autoCompile":true,
"autoTest":true,
"cardCode":"auto_before_release_check",
"cardEnName":"Auto Release Experience Compliance Check",
"cardId":200,
"cardName":"自动上架体验规范体检",
"coldStartCount":0,
... ...
... ... @@ -3,6 +3,8 @@
"analyzerMode":"BEFORE_RELEASE_CHECK_MODE",
"autoCompile":true,
"autoTest":true,
"cardCode":"auto_before_release_check",
"cardEnName":"Auto Release Experience Compliance Check",
"cardId":300,
"cardName":"自动上架体验规范体检",
"coldStartCount":0,
... ...
2026031201
\ No newline at end of file
2026051801
\ No newline at end of file
... ...
... ... @@ -4,7 +4,7 @@
"vendor": "DiDi",
"versionCode": 100,
"versionName": "2.7.0",
"icon": "$media:app_icon",
"icon": "$media:layered_image",
"label": "$string:app_name"
}
}
... ...
{
"layered-image":
{
"background" : "$media:background",
"foreground" : "$media:foreground"
}
}
\ No newline at end of file
... ...
... ... @@ -93,6 +93,9 @@ export default class EntryAbility extends FlutterAbility implements MethodCallHa
onForeground(): void {
super.onForeground()
NativePigeonRegistrar.setAppForeground(true)
// A normal return from WeChat has no SendAuthResp callback. Release the
// pending authorization request so Flutter can remove its loading overlay.
this.weChatLoginBridge?.cancelPendingAuthorization()
}
onBackground(): void {
... ...
... ... @@ -34,24 +34,24 @@ export class WeChatLoginBridge extends WeChatHostApi implements WXApiEventHandle
if (WECHAT_APP_ID.length === 0) {
result.error(new FlutterError(
'wechat_app_id_missing',
'WeChatError',
'Set WECHAT_APP_ID in WeChatLoginBridge.ets first.',
'WeChatError',
));
return;
}
if (this.pendingResult !== null) {
result.error(new FlutterError(
'wechat_authorization_in_progress',
'WeChatError',
'WeChat authorization is already in progress.',
'WeChatError',
));
return;
}
if (!this.wxApi.isWXAppInstalled()) {
result.error(new FlutterError(
'wechat_not_installed',
'WeChatError',
'WeChat is not installed.',
'WeChatError',
));
return;
}
... ... @@ -80,6 +80,21 @@ export class WeChatLoginBridge extends WeChatHostApi implements WXApiEventHandle
this.wxApi.handleWant(want, this);
}
/**
* WeChat does not send an authorization response when the user simply
* returns to our app. Complete the pending Pigeon call in that case, so the
* Flutter loading overlay is always dismissed.
*/
cancelPendingAuthorization(): void {
if (this.pendingResult === null) {
return;
}
this.finishWithError(
'wechat_authorization_cancelled',
'WeChat authorization was cancelled.',
);
}
onReq(_request: BaseReq): void {}
onResp(response: BaseResp): void {
... ... @@ -114,7 +129,7 @@ export class WeChatLoginBridge extends WeChatHostApi implements WXApiEventHandle
const result = this.pendingResult;
this.pendingResult = null;
if (result !== null) {
result.error(new FlutterError(code, 'WeChatError', message));
result.error(new FlutterError(code, message, 'WeChatError'));
}
}
}
... ...
... ... @@ -22,9 +22,9 @@
"name": "EntryAbility",
"srcEntry": "./ets/entryability/EntryAbility.ets",
"description": "$string:EntryAbility_desc",
"icon": "$media:icon",
"icon": "$media:layered_image",
"label": "$string:EntryAbility_label",
"startWindowIcon": "$media:icon",
"startWindowIcon": "$media:startIcon",
"startWindowBackground": "$color:start_window_background",
"exported": true,
"skills": [
... ...
... ... @@ -2,7 +2,7 @@
"color": [
{
"name": "start_window_background",
"value": "#FFFFFF"
"value": "#EDE5FF"
}
]
}
\ No newline at end of file
... ...
{
"layered-image":
{
"background" : "$media:background",
"foreground" : "$media:foreground"
}
}
\ No newline at end of file
... ...
... ... @@ -16,10 +16,10 @@
"name": "TestAbility",
"srcEntry": "./ets/testability/TestAbility.ets",
"description": "$string:TestAbility_desc",
"icon": "$media:icon",
"icon": "$media:layered_image",
"label": "$string:TestAbility_label",
"exported": true,
"startWindowIcon": "$media:icon",
"startWindowIcon": "$media:startIcon",
"startWindowBackground": "$color:start_window_background",
"skills": [
{
... ...
... ... @@ -2,7 +2,7 @@
"color": [
{
"name": "start_window_background",
"value": "#FFFFFF"
"value": "#EDE5FF"
}
]
}
\ No newline at end of file
... ...
{
"layered-image":
{
"background" : "$media:background",
"foreground" : "$media:foreground"
}
}
\ No newline at end of file
... ...