Skip to content

Commit

Permalink
Merge pull request #62 from jerichoi224/60-images-array-needs-to-get-…
Browse files Browse the repository at this point in the history
…reset-in-grid-view

60 images array needs to get reset in grid view
  • Loading branch information
jerichoi224 authored Oct 29, 2023
2 parents 24322b4 + 608bfab commit be3adcd
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
1 change: 0 additions & 1 deletion android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_MEDIA_LOCATION" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
Expand Down
17 changes: 8 additions & 9 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -68,27 +68,26 @@ class _MainState extends State<MainApp> {
Future<void> checkPermission() async {
bool permitted = false;
var androidInfo = await DeviceInfoPlugin().androidInfo;
final PermissionState ps = await PhotoManager.requestPermissionExtend();

if (androidInfo.version.sdkInt <= 32) {
permitted = await Permission.storage.request().isGranted;
permitted = await Permission.storage.isGranted;
} else {
permitted = await Permission.mediaLibrary.request().isGranted &&
await Permission.photos.request().isGranted &&
await Permission.videos.request().isGranted;
}
final PermissionState ps = await PhotoManager.requestPermissionExtend();

if (permitted || ps.isAuth) {
setState(() {
permissionChecked = permissionGranted = true;
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
WidgetsBinding.instance.addPostFrameCallback((timeStamp) async {
Provider.of<AppStatus>(context, listen: false).initialize();
Provider.of<AlbumInfoList>(context, listen: false)
.refreshAlbums()
.then((value) {
setState(() {
initialized = true;
});
await Provider.of<AlbumInfoList>(context, listen: false)
.refreshAlbums();

setState(() {
initialized = true;
});
});
});
Expand Down
1 change: 1 addition & 0 deletions lib/pages/image_grid_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ class _ImageGridState extends LifecycleListenerState<ImageGridWidget> {

Future<void> getImages() async {
assets.clear();
images.clear();

List<AssetEntity> newAssets = [];
while (assets.length < albumInfo.assetCount) {
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: 0.5.1+1
version: 0.5.2+1

environment:
sdk: '>=2.19.3 <3.0.0'
Expand Down

0 comments on commit be3adcd

Please sign in to comment.