Skip to content

Commit 72187bc

Browse files
committed
Merge branch 'master' into Translation/Crowdin
# Conflicts: # lib/l10n/app_zh.arb
2 parents 18a681d + ec2c831 commit 72187bc

38 files changed

Lines changed: 1916 additions & 1292 deletions

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ If you face trouble please [create tickets](https://github.com/Piwigo/piwigo-flu
1010

1111
# Installation
1212

13-
For now, this application is in Beta. You can download the latest version either from Github or from Google Play Store:
13+
You can download the latest version either from Github or from Google Play Store:
1414

1515
## Download from Play Store
1616

@@ -87,7 +87,7 @@ With Piwigo NG, you can upload images from the phone.
8787

8888
# Flutter
8989

90-
This application is made with [Google's Flutter](https://flutter.dev/?gclid=Cj0KCQjwvYSEBhDjARIsAJMn0lj-G1Ly0oznQeMGvyTYBY2TZfxFpkb9WYp4dsyMSwKIUsmTwE-SltIaAsjFEALw_wcB&gclsrc=aw.ds)
90+
This application is made with [Flutter](https://flutter.dev/?gclid=Cj0KCQjwvYSEBhDjARIsAJMn0lj-G1Ly0oznQeMGvyTYBY2TZfxFpkb9WYp4dsyMSwKIUsmTwE-SltIaAsjFEALw_wcB&gclsrc=aw.ds)
9191

9292
A UI toolkit for building beautiful, natively compiled applications for [mobile](https://flutter.dev/docs), [web](https://flutter.dev/web), and [desktop](https://flutter.dev/desktop) from a single codebase.
9393

@@ -105,4 +105,4 @@ For the upload, we are using the **uploadAsync** method of the API. This method
105105
# Licence
106106

107107
Piwigo is a free software, it can be redistributed it and / or modified under the terms of the GNU General Public License
108-
[see more here](./LICENCE.txt)
108+
[see more here](./LICENCE.txt)

android/app/src/main/AndroidManifest.xml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
22
package="com.remi.piwigo_ng">
3-
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES"/>
3+
44
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
55
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
66
<uses-permission android:name="android.permission.CAMERA" />
77
<uses-permission android:name="android.permission.INTERNET"/>
88

99
<application
10-
android:label="piwigo_ng"
10+
android:label="Piwigo NG"
1111
android:usesCleartextTraffic="true"
1212
android:requestLegacyExternalStorage="true"
1313
android:icon="@mipmap/ic_launcher">
@@ -27,20 +27,12 @@
2727
android:name="io.flutter.embedding.android.NormalTheme"
2828
android:resource="@style/NormalTheme"
2929
/>
30-
<!-- Displays an Android View that continues showing the launch screen
31-
Drawable until Flutter paints its first frame, then this splash
32-
screen fades out. A splash screen is useful to avoid any visual
33-
gap between the end of Android's launch screen and the painting of
34-
Flutter's first frame. -->
35-
<meta-data
36-
android:name="io.flutter.embedding.android.SplashScreenDrawable"
37-
android:resource="@drawable/launch_background"
38-
/>
3930
<intent-filter>
4031
<action android:name="android.intent.action.MAIN"/>
4132
<category android:name="android.intent.category.LAUNCHER"/>
4233
</intent-filter>
4334
</activity>
35+
4436
<!-- Don't delete the meta-data below.
4537
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
4638
<meta-data
@@ -52,12 +44,20 @@
5244
<!-- If your app opens https URLs -->
5345
<intent>
5446
<action android:name="android.intent.action.VIEW" />
47+
<category android:name="android.intent.category.BROWSABLE" />
5548
<data android:scheme="https" />
5649
</intent>
57-
<!-- If your app makes calls -->
5850
<intent>
5951
<action android:name="android.intent.action.DIAL" />
6052
<data android:scheme="tel" />
6153
</intent>
54+
<intent>
55+
<action android:name="android.intent.action.VIEW" />
56+
<data android:scheme="sms" />
57+
</intent>
58+
<intent>
59+
<action android:name="android.intent.action.SEND" />
60+
<data android:mimeType="*/*" />
61+
</intent>
6262
</queries>
6363
</manifest>

android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
buildscript {
2-
ext.kotlin_version = '1.5.31'
2+
ext.kotlin_version = '1.6.21'
33
repositories {
44
google()
55
jcenter()

android/gradle.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
org.gradle.jvmargs=-Xmx1536M
22
android.useAndroidX=true
33
android.enableJetifier=true
4+
android.jetifier.blacklist=bcprov-jdk15on

lib/api/API.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import 'package:flutter_local_notifications/flutter_local_notifications.dart';
44
import 'package:piwigo_ng/services/upload/Uploader.dart';
55
import 'package:shared_preferences/shared_preferences.dart';
66
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
7+
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
78

89
class API {
910
static final API _singleton = API._internal();
@@ -12,6 +13,7 @@ class API {
1213
static CookieJar cookieJar = CookieJar();
1314
static Uploader uploader;
1415
static SharedPreferences prefs;
16+
static final storage = FlutterSecureStorage();
1517
static FlutterLocalNotificationsPlugin localNotification;
1618

1719
factory API() {

lib/api/CategoryAPI.dart

Lines changed: 52 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,62 @@
11
import 'dart:convert';
22

33
import 'package:dio/dio.dart';
4+
import 'package:flutter/material.dart';
45
import 'API.dart';
6+
import 'SessionAPI.dart';
57

68
Future<Map<String,dynamic>> fetchAlbums(String albumID) async {
7-
8-
Map<String, String> queries = {
9+
Map<String, dynamic> queries = {
910
"format": "json",
1011
"method": "pwg.categories.getList",
1112
"cat_id": albumID,
1213
"thumbnail_size": API.prefs.getString('thumbnail_size'),
1314
};
15+
List<String> uploadCategoryIdList = [];
16+
if (await methodExist('community.categories.getList')) {
17+
queries['faked_by_community'] = false;
18+
var communityResult = await fetchCommunityAlbums(albumID);
19+
uploadCategoryIdList = communityResult['result']['categories'].map<String>(
20+
(cat) => cat['id'].toString(),
21+
).toList();
22+
}
23+
24+
try {
25+
Response response = await API().dio.get('ws.php', queryParameters: queries);
26+
27+
if (response.statusCode == 200) {
28+
Map<String, dynamic> result = json.decode(response.data);
29+
if(result['stat'] == 'fail') return result;
30+
var categoryList = result['result']['categories'];
31+
for (var cat in categoryList) {
32+
bool canUpload = false;
33+
if (!['normal', 'guest'].contains(API.prefs.getString('user_status'))
34+
|| uploadCategoryIdList.contains(cat['id'].toString())) {
35+
canUpload = true;
36+
}
37+
cat['can_upload'] = canUpload;
38+
}
39+
result['result']['categories'] = categoryList;
40+
return result;
41+
} else {
42+
return {
43+
'stat': 'fail',
44+
'result': response.statusMessage
45+
};
46+
}
47+
} on DioError {
48+
return {
49+
'stat': 'fail',
50+
'result': 'error',
51+
};
52+
}
53+
}
54+
Future<Map<String,dynamic>> fetchCommunityAlbums(String albumID) async {
55+
Map<String, dynamic> queries = {
56+
"format": "json",
57+
"method": "community.categories.getList",
58+
"cat_id": albumID,
59+
};
1460

1561
try {
1662
Response response = await API().dio.get('ws.php', queryParameters: queries);
@@ -24,10 +70,10 @@ Future<Map<String,dynamic>> fetchAlbums(String albumID) async {
2470
};
2571
}
2672
} catch(e) {
27-
//var error = e as DioError;
73+
var error = e as DioError;
2874
return {
2975
'stat': 'fail',
30-
'result': e.toString(),
76+
'result': error.message,
3177
};
3278
}
3379
}
@@ -76,8 +122,7 @@ Future<dynamic> addCategory(String catName, String catDesc, String parent) async
76122
'result': response.statusMessage
77123
};
78124
}
79-
} catch(e) {
80-
var error = e as DioError;
125+
} on DioError catch(error) {
81126
return {
82127
'stat': 'fail',
83128
'result': error.message
@@ -170,7 +215,7 @@ Future<dynamic> editCategory(int catId, String catName, String catDesc) async {
170215
return json.decode(response.data);
171216
}
172217
} catch (e) {
173-
print('Dio move category error $e');
218+
debugPrint('Dio move category error $e');
174219
return e;
175220
}
176221
}

0 commit comments

Comments
 (0)