修改相册权限判断弹窗

This commit is contained in:
CYH 2024-01-08 09:39:35 +08:00
parent 7454e89d1b
commit 2f2c34ed1e
15 changed files with 123 additions and 14 deletions

View File

@ -1,4 +1,6 @@
PODS: PODS:
- "app_settings (3.0.0+1)":
- Flutter
- audioplayers_darwin (0.0.1): - audioplayers_darwin (0.0.1):
- Flutter - Flutter
- Bugly (2.5.93) - Bugly (2.5.93)
@ -166,6 +168,7 @@ PODS:
- WechatOpenSDK-XCFramework (2.0.2) - WechatOpenSDK-XCFramework (2.0.2)
DEPENDENCIES: DEPENDENCIES:
- app_settings (from `.symlinks/plugins/app_settings/ios`)
- audioplayers_darwin (from `.symlinks/plugins/audioplayers_darwin/ios`) - audioplayers_darwin (from `.symlinks/plugins/audioplayers_darwin/ios`)
- camera_avfoundation (from `.symlinks/plugins/camera_avfoundation/ios`) - camera_avfoundation (from `.symlinks/plugins/camera_avfoundation/ios`)
- connectivity (from `.symlinks/plugins/connectivity/ios`) - connectivity (from `.symlinks/plugins/connectivity/ios`)
@ -224,6 +227,8 @@ SPEC REPOS:
- WechatOpenSDK-XCFramework - WechatOpenSDK-XCFramework
EXTERNAL SOURCES: EXTERNAL SOURCES:
app_settings:
:path: ".symlinks/plugins/app_settings/ios"
audioplayers_darwin: audioplayers_darwin:
:path: ".symlinks/plugins/audioplayers_darwin/ios" :path: ".symlinks/plugins/audioplayers_darwin/ios"
camera_avfoundation: camera_avfoundation:
@ -302,6 +307,7 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/webview_flutter_wkwebview/ios" :path: ".symlinks/plugins/webview_flutter_wkwebview/ios"
SPEC CHECKSUMS: SPEC CHECKSUMS:
app_settings: 54b8813f690b34f757c0bf97a46637bed5acc76c
audioplayers_darwin: 877d9a4d06331c5c374595e46e16453ac7eafa40 audioplayers_darwin: 877d9a4d06331c5c374595e46e16453ac7eafa40
Bugly: b8715e6ec4004b7f7fbffab0643ba80545aee3da Bugly: b8715e6ec4004b7f7fbffab0643ba80545aee3da
camera_avfoundation: 3125e8cd1a4387f6f31c6c63abb8a55892a9eeeb camera_avfoundation: 3125e8cd1a4387f6f31c6c63abb8a55892a9eeeb

View File

@ -381,7 +381,7 @@
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
MARKETING_VERSION = 1.4.2; MARKETING_VERSION = 1.4.1;
PRODUCT_BUNDLE_IDENTIFIER = com.example.circleapp; PRODUCT_BUNDLE_IDENTIFIER = com.example.circleapp;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
@ -530,7 +530,7 @@
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
MARKETING_VERSION = 1.4.2; MARKETING_VERSION = 1.4.1;
PRODUCT_BUNDLE_IDENTIFIER = com.example.circleapp; PRODUCT_BUNDLE_IDENTIFIER = com.example.circleapp;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
@ -573,7 +573,7 @@
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
MARKETING_VERSION = 1.4.2; MARKETING_VERSION = 1.4.1;
PRODUCT_BUNDLE_IDENTIFIER = com.example.circleapp; PRODUCT_BUNDLE_IDENTIFIER = com.example.circleapp;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";

View File

@ -325,6 +325,7 @@ class Call_outLogic extends GetxController {
return; return;
} }
checkPhotosStatus();
try { try {
final XFile? pickedFile = await _picker.pickVideo( final XFile? pickedFile = await _picker.pickVideo(
source: ImageSource.gallery, source: ImageSource.gallery,

View File

@ -1220,6 +1220,7 @@ class _TIMTextFieldLayoutNarrowState
if (!isOK) { if (!isOK) {
return; return;
} }
checkPhotosStatus();
try { try {
final XFile? pickedFile = await _picker.pickImage( final XFile? pickedFile = await _picker.pickImage(
source: ImageSource.gallery, source: ImageSource.gallery,
@ -1252,6 +1253,7 @@ class _TIMTextFieldLayoutNarrowState
return; return;
} }
await requestStoragePermission(); await requestStoragePermission();
checkPhotosStatus();
try { try {
final XFile? pickedFile = await _picker.pickImage( final XFile? pickedFile = await _picker.pickImage(
source: ImageSource.camera, source: ImageSource.camera,

View File

@ -358,9 +358,7 @@ class _DiscoverState extends State<Discover>
child: Container( child: Container(
// padding: EdgeInsets.all(2.sp), // padding: EdgeInsets.all(2.sp),
child: Swiper( child: Swiper(
autoplay: user.images!.length == 1 autoplay: false,
? false
: true,
loop: user.images!.length == 1 loop: user.images!.length == 1
? false ? false
: true, : true,

View File

@ -47,6 +47,7 @@ class ExternalshareLogic extends GetxController {
} }
Future getImageFile() async { Future getImageFile() async {
checkPhotosStatus();
try { try {
final XFile? pickedFile = await _picker.pickImage( final XFile? pickedFile = await _picker.pickImage(
source: ImageSource.gallery, source: ImageSource.gallery,

View File

@ -33,6 +33,7 @@ class FeedbackLogic extends GetxController {
} }
Future getImageFile() async { Future getImageFile() async {
checkPhotosStatus();
try { try {
final XFile? pickedFile = await _picker.pickImage( final XFile? pickedFile = await _picker.pickImage(
source: ImageSource.gallery, source: ImageSource.gallery,

View File

@ -474,7 +474,7 @@ class InvitePage extends StatelessWidget {
children: [ children: [
Container( Container(
child: Text( child: Text(
'${logic.directProfit! ?? 0}', '${logic.directProfit! ?? 0}',
style: TextStyle( style: TextStyle(
color: AppColor.mainColor, color: AppColor.mainColor,
fontSize: 14.sp), fontSize: 14.sp),
@ -505,7 +505,7 @@ class InvitePage extends StatelessWidget {
children: [ children: [
Container( Container(
child: Text( child: Text(
'${logic.rebate! ?? 0}', '${logic.rebate! ?? 0}',
style: TextStyle( style: TextStyle(
color: AppColor.mainColor, color: AppColor.mainColor,
fontSize: 14.sp), fontSize: 14.sp),
@ -535,7 +535,7 @@ class InvitePage extends StatelessWidget {
Expanded( Expanded(
child: Container( child: Container(
margin: EdgeInsets.only( margin: EdgeInsets.only(
top: 15.sp, left: 20.sp, right: 20.sp), top: 15.sp, left: 20.sp, right: 20.sp,bottom: 10.sp),
// height: 135.sp, // height: 135.sp,
decoration: BoxDecoration( decoration: BoxDecoration(
color: Color(0x99363542), color: Color(0x99363542),
@ -623,7 +623,7 @@ class InvitePage extends StatelessWidget {
}, },
child: Container( child: Container(
margin: EdgeInsets.only( margin: EdgeInsets.only(
top: 15.sp, bottom: 15.sp), top: 15.sp,),
child: Text( child: Text(
'查看更多邀请记录>', '查看更多邀请记录>',
style: TextStyle( style: TextStyle(
@ -711,7 +711,7 @@ class InvitePage extends StatelessWidget {
child: Text( child: Text(
'联系客服结算', '联系客服结算',
style: TextStyle( style: TextStyle(
color: Colors.white, color: Colors.black,
fontSize: 16, fontSize: 16,
fontWeight: FontWeight.w600), fontWeight: FontWeight.w600),
), ),

View File

@ -1,15 +1,18 @@
import 'dart:convert'; import 'dart:convert';
import 'package:app_settings/app_settings.dart';
import 'package:circle_app/network/dio_manager.dart'; import 'package:circle_app/network/dio_manager.dart';
import 'package:circle_app/router/app_routers.dart'; import 'package:circle_app/router/app_routers.dart';
import 'package:circle_app/util/util.dart'; import 'package:circle_app/util/util.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_native_splash/flutter_native_splash.dart'; import 'package:flutter_native_splash/flutter_native_splash.dart';
import 'package:flutter_pickers/time_picker/model/pduration.dart'; import 'package:flutter_pickers/time_picker/model/pduration.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:image_picker/image_picker.dart'; import 'package:image_picker/image_picker.dart';
import 'package:permission_handler/permission_handler.dart';
import '../../../common/Widgets/base_tip_widget.dart'; import '../../../common/Widgets/base_tip_widget.dart';
import '../../../common/config.dart'; import '../../../common/config.dart';
@ -183,6 +186,9 @@ class Complete_materialLogic extends GetxController {
} }
Future getImageFile() async { Future getImageFile() async {
checkPhotosStatus();
try { try {
final XFile? pickedFile = await _picker.pickImage( final XFile? pickedFile = await _picker.pickImage(
source: ImageSource.gallery, source: ImageSource.gallery,

View File

@ -357,8 +357,9 @@ class _TIMConversationState extends TIMUIKitState<TIMConversation> {
Future<List<V2TimUserFullInfo>> getUserListInfo( Future<List<V2TimUserFullInfo>> getUserListInfo(
List<String> userIdList) async { List<String> userIdList) async {
V2TimValueCallback<String> getLoginUserRes = V2TimValueCallback<String> getLoginUserRes =
await TencentImSDKPlugin.v2TIMManager.getLoginUser(); await TencentImSDKPlugin.v2TIMManager.getLoginUser();
if (getLoginUserRes.code == 0) { if (getLoginUserRes.code == 0) {
// //
if (getLoginUserRes.data != null) { if (getLoginUserRes.data != null) {
@ -366,10 +367,56 @@ class _TIMConversationState extends TIMUIKitState<TIMConversation> {
0, getLoginUserRes.data!); // getLoginUserRes.data为查询到的登录用户的UserID 0, getLoginUserRes.data!); // getLoginUserRes.data为查询到的登录用户的UserID
} }
} }
if (userIdList.length > 100) {
List<V2TimUserFullInfo> list = [];
double count = userIdList.length / 100;
int size = count.toInt();
if (count > size) {
for (int i = 0; i <= size; i++) {
List<V2TimUserFullInfo> dataList = await getUserListData(userIdList.sublist(i + i * 100, i == size ? userIdList.length : (i + 1) * 100));
list.addAll(dataList);
}
} else {
for (int i = 0; i < size; i++) {
List<V2TimUserFullInfo> dataList = await getUserListData(userIdList.sublist(i + i * 100,(i + 1) * 100 ));
list.addAll(dataList);
}
}
return list;
} else {
//
V2TimValueCallback<List<V2TimUserFullInfo>> getUsersInfoRes =
await TencentImSDKPlugin.v2TIMManager
.getUsersInfo(userIDList: userIdList); //id列表
if (getUsersInfoRes.code == 0) {
//
getUsersInfoRes.data?.forEach((element) {
element.allowType; // 0: 1: 2:
element.birthday; //
element.customInfo; //
element.faceUrl; // url
element.gender; // 1: 2:
element.level; //
element.nickName; //
element.role; //
element.selfSignature; //
element.userID; // ID
});
return getUsersInfoRes.data ?? [];
}
}
return [];
}
getUserListData(List<String> userIdList) async {
// //
V2TimValueCallback<List<V2TimUserFullInfo>> getUsersInfoRes = V2TimValueCallback<List<V2TimUserFullInfo>> getUsersInfoRes =
await TencentImSDKPlugin.v2TIMManager await TencentImSDKPlugin.v2TIMManager
.getUsersInfo(userIDList: userIdList); //id列表 .getUsersInfo(userIDList: userIdList); //id列表
if (getUsersInfoRes.code == 0) { if (getUsersInfoRes.code == 0) {
// //
getUsersInfoRes.data?.forEach((element) { getUsersInfoRes.data?.forEach((element) {

View File

@ -74,6 +74,7 @@ class ReportLogic extends GetxController {
} }
Future getImageFile() async { Future getImageFile() async {
checkPhotosStatus();
try { try {
final XFile? pickedFile = await _picker.pickImage( final XFile? pickedFile = await _picker.pickImage(
source: ImageSource.gallery, source: ImageSource.gallery,

View File

@ -368,6 +368,7 @@ class UserinfoLogic extends GetxController {
} }
Future getImageFile() async { Future getImageFile() async {
checkPhotosStatus();
try { try {
final XFile? pickedFile = await _picker.pickImage( final XFile? pickedFile = await _picker.pickImage(
source: ImageSource.gallery, source: ImageSource.gallery,

View File

@ -292,7 +292,7 @@ class _UnlockWxTipState extends State<UnlockWxTip> {
Text( Text(
"同时对方可获得${price.bonus == 30 ? '一个月' : price.bonus == 90 ? '三个月' : price.bonus == 365 ? '一年' : '3年' }会员时长", price.note ?? '',
style: TextStyle( style: TextStyle(
color: const Color(0xFFEFD84E), fontSize: 10.0.sp), color: const Color(0xFFEFD84E), fontSize: 10.0.sp),
), ),
@ -397,6 +397,7 @@ class Prices {
int? bonus; int? bonus;
double? curPrice; double? curPrice;
String? desc; String? desc;
String? note;
int? expireTime; int? expireTime;
int? expireType; int? expireType;
int? id; int? id;
@ -426,6 +427,7 @@ class Prices {
expireTime = json['expireTime']; expireTime = json['expireTime'];
expireType = json['expireType']; expireType = json['expireType'];
id = json['id']; id = json['id'];
note = json['note'];
itemId = json['itemId']; itemId = json['itemId'];
oldPrice = json['oldPrice']; oldPrice = json['oldPrice'];
show = json['show']; show = json['show'];

View File

@ -2,6 +2,7 @@ import 'dart:convert';
import 'dart:io'; import 'dart:io';
import 'dart:ui'; import 'dart:ui';
import 'package:app_settings/app_settings.dart';
import 'package:circle_app/app/chat/view.dart'; import 'package:circle_app/app/chat/view.dart';
import 'package:circle_app/app/circle/view.dart'; import 'package:circle_app/app/circle/view.dart';
import 'package:circle_app/app/circle/widgets/discover.dart'; import 'package:circle_app/app/circle/widgets/discover.dart';
@ -12,6 +13,7 @@ import 'package:circle_app/network/api.dart';
import 'package:circle_app/router/app_routers.dart'; import 'package:circle_app/router/app_routers.dart';
import 'package:circle_app/util/eventBus.dart'; import 'package:circle_app/util/eventBus.dart';
import 'package:event_bus/event_bus.dart'; import 'package:event_bus/event_bus.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
@ -931,6 +933,39 @@ showVipDialog() {
}); });
} }
checkPhotosStatus() async {
var status = await Permission.photos.status;
if (PermissionStatus.permanentlyDenied == status) {
Get.bottomSheet(CupertinoAlertDialog(
content:
SingleChildScrollView(
child: ListBody(
children: <Widget>[Text("请开启相册权限以上传图片")],
),
),
actions: <Widget>[
CupertinoDialogAction(
child: Text("确定"),
onPressed: (){
AppSettings.openAppSettings();
},
),
CupertinoDialogAction(
child: Text("取消"),
onPressed: (){
Get.back();
},
),
],
),isScrollControlled: true,
enableDrag: false
);
return;
}
}
pushPage(String action,String param,{String name = ''}) { pushPage(String action,String param,{String name = ''}) {
// public final static String MY_MAIN = "my_main";// // public final static String MY_MAIN = "my_main";//
// public final static String MY_USER_HOME = "my_user_home";// // public final static String MY_USER_HOME = "my_user_home";//

View File

@ -41,6 +41,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "5.13.0" version: "5.13.0"
app_settings:
dependency: "direct main"
description:
name: app_settings
sha256: e6a34735d4ddb24ca9c5fd7e965ec65c8b611cbd3a329152c294f9e9f4bacb33
url: "https://pub.dev"
source: hosted
version: "4.3.1"
archive: archive:
dependency: transitive dependency: transitive
description: description: