购买刷新.
This commit is contained in:
parent
3741c203b7
commit
82dc268344
|
|
@ -70,7 +70,7 @@ android {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
|
||||
// 支付宝 SDK AAR 包所需的配置
|
||||
api 'com.alipay.sdk:alipaysdk-android:15.8.17'
|
||||
api 'com.android.support:support-v4:28.0.0'
|
||||
|
|
@ -80,7 +80,9 @@ dependencies {
|
|||
api 'com.tencent.mm.opensdk:wechat-sdk-android:6.8.30'
|
||||
|
||||
|
||||
api 'org.greenrobot:eventbus:3.3.1'
|
||||
// api 'org.greenrobot:eventbus:3.3.1'
|
||||
//配置eventbus
|
||||
implementation 'org.simple:androideventbus:1.0.5.1'
|
||||
}
|
||||
|
||||
flutter {
|
||||
|
|
|
|||
|
|
@ -16,11 +16,10 @@ import com.tencent.mm.opensdk.modelpay.PayReq;
|
|||
import com.tencent.mm.opensdk.openapi.IWXAPI;
|
||||
import com.tencent.mm.opensdk.openapi.WXAPIFactory;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
import org.simple.eventbus.EventBus;
|
||||
import org.simple.eventbus.Subscriber;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
|
@ -50,7 +49,6 @@ public class MainActivity extends FlutterActivity {
|
|||
@Override
|
||||
protected void onNewIntent(@NonNull Intent intent) {
|
||||
super.onNewIntent(intent);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -59,21 +57,24 @@ public class MainActivity extends FlutterActivity {
|
|||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onMessageEvent(MessageEvent event) {
|
||||
@SuppressLint("NotifyDataSetChanged")
|
||||
@Subscriber(tag = EventBusParams.MAIN)
|
||||
public void Ev(HashMap<String, String> TagMap) {
|
||||
final String tag = TagMap.get("tag");
|
||||
if (!TextUtils.isEmpty(tag)) {
|
||||
switch (tag) {
|
||||
case "wxPaySuccess":
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("wxPaySuccess", "wxPaySuccess");
|
||||
nativeChannel.invokeMethod("wxPaySuccess", map);
|
||||
break;
|
||||
|
||||
switch (event.message) {
|
||||
case "wxPaySuccess":
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("wxPaySuccess", "wxPaySuccess");
|
||||
nativeChannel.invokeMethod("wxPaySuccess", map);
|
||||
break;
|
||||
|
||||
case "payError":
|
||||
Map<String, String> mapError = new HashMap<>();
|
||||
mapError.put("payError", "payError");
|
||||
nativeChannel.invokeMethod("payError", mapError);
|
||||
break;
|
||||
case "payError":
|
||||
Map<String, String> mapError = new HashMap<>();
|
||||
mapError.put("payError", "payError");
|
||||
nativeChannel.invokeMethod("payError", mapError);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,15 +7,17 @@ import android.util.Log;
|
|||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.huanmeng.talk.EventBusParams;
|
||||
import com.huanmeng.talk.MainActivity;
|
||||
import com.huanmeng.talk.MessageEvent;
|
||||
import com.tencent.mm.opensdk.modelbase.BaseReq;
|
||||
import com.tencent.mm.opensdk.modelbase.BaseResp;
|
||||
import com.tencent.mm.opensdk.openapi.IWXAPI;
|
||||
import com.tencent.mm.opensdk.openapi.IWXAPIEventHandler;
|
||||
import com.tencent.mm.opensdk.openapi.WXAPIFactory;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.simple.eventbus.EventBus;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
|
||||
public class WXPayEntryActivity extends Activity implements IWXAPIEventHandler {
|
||||
|
|
@ -51,7 +53,10 @@ public class WXPayEntryActivity extends Activity implements IWXAPIEventHandler {
|
|||
//发送成功
|
||||
// 该笔订单真实的支付结果,需要依赖服务端的异步通知。
|
||||
Log.d("TAG", "支付成功");
|
||||
EventBus.getDefault().post(new MessageEvent("wxPaySuccess"));
|
||||
|
||||
HashMap<String, String> TagMap = new HashMap<>();
|
||||
TagMap.put("tag", "wxPaySuccess");
|
||||
EventBus.getDefault().post(TagMap, EventBusParams.MAIN);
|
||||
|
||||
|
||||
Intent intent = new Intent(this, MainActivity.class);
|
||||
|
|
@ -62,19 +67,24 @@ public class WXPayEntryActivity extends Activity implements IWXAPIEventHandler {
|
|||
case BaseResp.ErrCode.ERR_USER_CANCEL:
|
||||
//发送取消
|
||||
Log.d("TAG", "取消支付");
|
||||
EventBus.getDefault().post(new MessageEvent("payError"));
|
||||
HashMap<String, String> Tag = new HashMap<>();
|
||||
Tag.put("tag", "payError");
|
||||
EventBus.getDefault().post(Tag, EventBusParams.MAIN);
|
||||
break;
|
||||
case BaseResp.ErrCode.ERR_AUTH_DENIED:
|
||||
//发送被拒绝
|
||||
|
||||
Log.d("TAG", "拒绝支付");
|
||||
EventBus.getDefault().post(new MessageEvent("payError"));
|
||||
|
||||
HashMap<String, String> tagDenied = new HashMap<>();
|
||||
tagDenied.put("tag", "payError");
|
||||
EventBus.getDefault().post(tagDenied, EventBusParams.MAIN);
|
||||
break;
|
||||
case BaseResp.ErrCode.ERR_UNSUPPORT:
|
||||
//不支持错误
|
||||
|
||||
Log.d("TAG", "不支持支付");
|
||||
EventBus.getDefault().post(new MessageEvent("payError"));
|
||||
HashMap<String, String> tagUnSupport = new HashMap<>();
|
||||
tagUnSupport.put("tag", "payError");
|
||||
EventBus.getDefault().post(tagUnSupport, EventBusParams.MAIN);
|
||||
break;
|
||||
default:
|
||||
//发送返回
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ allprojects {
|
|||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
maven { url 'https://maven.aliyun.com/repository/jcenter' }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
org.gradle.jvmargs=-Xmx4G -XX:+HeapDumpOnOutOfMemoryError
|
||||
android.useAndroidX=true
|
||||
android.enableJetifier=true
|
||||
android.suppressUnsupportedCompileSdk=34
|
||||
|
|
|
|||
|
|
@ -11,8 +11,9 @@ class MessageBean {
|
|||
String? iconImage;
|
||||
String? lastContactTime;
|
||||
String? lastMessage;
|
||||
bool? isMemoryCard;
|
||||
|
||||
MessageBean(this.id, this.name, this.biography, this.iconImage, this.lastContactTime, this.lastMessage);
|
||||
MessageBean(this.id, this.name, this.biography, this.iconImage, this.lastContactTime, this.lastMessage, this.isMemoryCard);
|
||||
|
||||
factory MessageBean.fromJson(Map<String, dynamic> json) => _$MessageBeanFromJson(json);
|
||||
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ MessageBean _$MessageBeanFromJson(Map<String, dynamic> json) => MessageBean(
|
|||
json['iconImage'] as String?,
|
||||
json['lastContactTime'] as String?,
|
||||
json['lastMessage'] as String?,
|
||||
json['isMemoryCard'] as bool?,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$MessageBeanToJson(MessageBean instance) =>
|
||||
|
|
@ -23,4 +24,5 @@ Map<String, dynamic> _$MessageBeanToJson(MessageBean instance) =>
|
|||
'iconImage': instance.iconImage,
|
||||
'lastContactTime': instance.lastContactTime,
|
||||
'lastMessage': instance.lastMessage,
|
||||
'isMemoryCard': instance.isMemoryCard,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:crypto/crypto.dart';
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:dio/io.dart';
|
||||
|
||||
import 'BaseEntity.dart';
|
||||
import 'DioLogInterceptor.dart';
|
||||
|
|
@ -82,6 +84,15 @@ class RequestCenter {
|
|||
contentType: Headers.jsonContentType,
|
||||
responseType: ResponseType.json));
|
||||
//_dioLog!.interceptors.add(DioLogInterceptor());
|
||||
|
||||
// (_dio?.httpClientAdapter as DefaultHttpClientAdapter).onHttpClientCreate = (client) {
|
||||
// client.findProxy = (uri) {
|
||||
// return "PROXY 192.168.1.11:8888";
|
||||
// };
|
||||
// //抓Https包设置
|
||||
// client.badCertificateCallback = (X509Certificate cert, String host, int port) => true;
|
||||
// };
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -769,7 +769,36 @@ class _ChatPageState extends State<ChatPage> {
|
|||
// }
|
||||
|
||||
if (chatList[index].role == 'pay') {
|
||||
return Container();
|
||||
// return Container();
|
||||
return Center(
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
if (NetworkConfig.userInfoBean!.currency! >= 60) {
|
||||
Navigator.pushNamed(context, '/ShopPage');
|
||||
} else {
|
||||
Navigator.pushNamed(context, '/AccountPage');
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
padding: const EdgeInsets.only(left: 9, right: 9, top: 6, bottom: 6),
|
||||
margin: EdgeInsets.only(bottom: b20),
|
||||
decoration: const BoxDecoration(
|
||||
color: Color(0xCC000000),
|
||||
borderRadius: BorderRadius.all(Radius.circular(15)),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text("聊天次数不足", style: const TextStyle(color: Color(0xFFB6B6B6), fontSize: 10)),
|
||||
Container(
|
||||
margin: const EdgeInsets.only(left: 10),
|
||||
child: const Text("立即增加", style: TextStyle(color: Color(0xFFFF9000), fontSize: 10)),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
///提示
|
||||
|
|
@ -778,7 +807,7 @@ class _ChatPageState extends State<ChatPage> {
|
|||
return Center(
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
Navigator.pushNamed(context, '/AccountPage');
|
||||
// Navigator.pushNamed(context, '/AccountPage');
|
||||
},
|
||||
child: Container(
|
||||
padding: const EdgeInsets.only(left: 9, right: 9, top: 6, bottom: 6),
|
||||
|
|
|
|||
|
|
@ -312,16 +312,17 @@ class _HomeChatPageState extends State<HomeChatPage> with AutomaticKeepAliveClie
|
|||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
SizedBox(
|
||||
width: h35,
|
||||
Container(
|
||||
width: 40,
|
||||
padding: EdgeInsets.only(right: 5),
|
||||
child: Text(
|
||||
"${characterInfoBean.characterName}",
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: const TextStyle(fontSize: 11, color: Colors.white),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: h35,
|
||||
Container(
|
||||
padding: EdgeInsets.only(right: 5),
|
||||
child: Text(
|
||||
'${characterInfoBean.lookCount} 聊过',
|
||||
style: const TextStyle(fontSize: 9, color: Color(0xFFBDBDBD)),
|
||||
|
|
@ -768,7 +769,36 @@ class _HomeChatPageState extends State<HomeChatPage> with AutomaticKeepAliveClie
|
|||
// }
|
||||
|
||||
if (chatList[index].role == 'pay') {
|
||||
return Container();
|
||||
// return Container();
|
||||
return Center(
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
if (NetworkConfig.userInfoBean!.currency! >= 60) {
|
||||
Navigator.pushNamed(context, '/ShopPage');
|
||||
} else {
|
||||
Navigator.pushNamed(context, '/AccountPage');
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
padding: const EdgeInsets.only(left: 9, right: 9, top: 6, bottom: 6),
|
||||
margin: EdgeInsets.only(bottom: b20),
|
||||
decoration: const BoxDecoration(
|
||||
color: Color(0xCC000000),
|
||||
borderRadius: BorderRadius.all(Radius.circular(15)),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text("聊天次数不足", style: const TextStyle(color: Color(0xFFB6B6B6), fontSize: 10)),
|
||||
Container(
|
||||
margin: const EdgeInsets.only(left: 10),
|
||||
child: const Text("立即增加", style: TextStyle(color: Color(0xFFFF9000), fontSize: 10)),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
///提示
|
||||
|
|
@ -777,7 +807,7 @@ class _HomeChatPageState extends State<HomeChatPage> with AutomaticKeepAliveClie
|
|||
return Center(
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
Navigator.pushNamed(context, '/AccountPage');
|
||||
// Navigator.pushNamed(context, '/AccountPage');
|
||||
},
|
||||
child: Container(
|
||||
padding: const EdgeInsets.only(left: 9, right: 9, top: 6, bottom: 6),
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ import 'dart:async';
|
|||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||
import 'package:talk/tools/home/my_home_page.dart';
|
||||
import 'package:talk/tools/me/me_page.dart';
|
||||
|
|
@ -184,6 +185,8 @@ class _HomePageState extends State<HomePage> with SingleTickerProviderStateMixin
|
|||
EasyLoading.showToast("再按一次退出");
|
||||
return Future.value(false);
|
||||
} else {
|
||||
// exit(0);
|
||||
SystemNavigator.pop();
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ class _LoginPageState extends State<LoginPage> {
|
|||
int _timeLeft = 60; // 倒计时时间,单位为秒
|
||||
bool _isCountingDown = false;
|
||||
|
||||
late Timer _timer;
|
||||
Timer? _timer;
|
||||
|
||||
///获取验证码
|
||||
void getCode() {
|
||||
|
|
@ -87,12 +87,16 @@ class _LoginPageState extends State<LoginPage> {
|
|||
break;
|
||||
case "login":
|
||||
EasyLoading.showToast(newData['data']);
|
||||
if(_timer!=null){
|
||||
_timer!.cancel();
|
||||
}
|
||||
Navigator.pushReplacementNamed(context, "/HomePage");
|
||||
break;
|
||||
|
||||
case "getUserInfo":
|
||||
EasyLoading.dismiss();
|
||||
_timer.cancel();
|
||||
Navigator.pushReplacementNamed(context, "/HomePage");
|
||||
// _timer.cancel();
|
||||
// Navigator.pushReplacementNamed(context, "/HomePage");
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
@ -109,6 +113,7 @@ class _LoginPageState extends State<LoginPage> {
|
|||
_phoneController.dispose();
|
||||
_codeController.dispose();
|
||||
subscription.cancel();
|
||||
_timer!.cancel();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -172,9 +172,33 @@ class _MessagePageState extends State<MessagePage> {
|
|||
Positioned(
|
||||
left: l68,
|
||||
top: 6,
|
||||
child: Text(
|
||||
data.name!,
|
||||
style: TextStyle(fontSize: 13, color: Color(0xFFE1E1E1)),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
data.name!,
|
||||
style: TextStyle(fontSize: 13, color: Color(0xFFE1E1E1)),
|
||||
),
|
||||
data.isMemoryCard!
|
||||
? Container(
|
||||
width: 45,
|
||||
height: 10,
|
||||
margin: EdgeInsets.only(left: 10),
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [Color(0xFF8F79F2), Color(0xFFE47BFD)], // 三色渐变数组
|
||||
begin: Alignment.centerLeft, // 渐变开始位置
|
||||
end: Alignment.centerRight, // 渐变结束位置
|
||||
),
|
||||
borderRadius: BorderRadius.all(Radius.circular(10))),
|
||||
child: Text(
|
||||
"记忆提升中",
|
||||
style: TextStyle(color: Colors.white, fontSize: 6),
|
||||
),
|
||||
)
|
||||
: Container(),
|
||||
],
|
||||
)),
|
||||
Positioned(
|
||||
left: l68,
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ import 'dart:async';
|
|||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:talk/network/NetworkConfig.dart';
|
||||
|
||||
|
|
@ -52,7 +53,7 @@ class _StartPageState extends State<StartPage> {
|
|||
// 获取token
|
||||
final SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
|
||||
final String? token = prefs.getString('token');
|
||||
final String token = prefs.getString('token') ?? "";
|
||||
|
||||
if (token != "") {
|
||||
_viewmodel.login("", "", 0, token);
|
||||
|
|
@ -74,6 +75,7 @@ class _StartPageState extends State<StartPage> {
|
|||
if (index == 0) {
|
||||
_loadData();
|
||||
} else {
|
||||
SystemNavigator.pop();
|
||||
exit(0);
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -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.4.1 <4.0.0'
|
||||
|
|
@ -27,7 +27,7 @@ dependencies:
|
|||
sdk: flutter
|
||||
|
||||
|
||||
dio: ^5.4.3+1
|
||||
dio: ^5.1.1
|
||||
intl: ^0.19.0
|
||||
cupertino_icons: ^1.0.6
|
||||
flutter_easyloading: ^3.0.5
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user