Fixed ompl file import bug, add rssUrl vilidate.
This commit is contained in:
parent
a6182973f2
commit
33e34e9966
|
@ -54,6 +54,7 @@ class _PopupMenuState extends State<PopupMenu> {
|
|||
|
||||
void _saveOmpl(String path) async {
|
||||
var subscribeWorker = Provider.of<GroupList>(context, listen: false);
|
||||
RegExp rssExp = RegExp(r'^(https?):\/\/(.*)');
|
||||
final s = context.s;
|
||||
File file = File(path);
|
||||
try {
|
||||
|
@ -63,9 +64,9 @@ class _PopupMenuState extends State<PopupMenu> {
|
|||
print(title);
|
||||
var list = entry.value.reversed;
|
||||
for (var rss in list) {
|
||||
if (rss.xmlUrl != null) {
|
||||
SubscribeItem item =
|
||||
SubscribeItem(rss.xmlUrl, rss.text, group: title);
|
||||
String rssLink = rssExp.stringMatch(rss.xmlUrl);
|
||||
if (rssLink != null) {
|
||||
SubscribeItem item = SubscribeItem(rssLink, rss.text, group: title);
|
||||
await subscribeWorker.setSubscribeItem(item);
|
||||
await Future.delayed(Duration(milliseconds: 200));
|
||||
print(rss.text);
|
||||
|
|
|
@ -76,7 +76,7 @@ class MyHomePageDelegate extends SearchDelegate<int> {
|
|||
child: Container(
|
||||
padding: EdgeInsets.only(top: 400),
|
||||
child: Image(
|
||||
image: Theme.of(context).brightness == Brightness.light
|
||||
image: context.brightness == Brightness.light
|
||||
? AssetImage('assets/listennotes.png')
|
||||
: AssetImage('assets/listennotes_light.png'),
|
||||
height: 20,
|
||||
|
|
|
@ -425,7 +425,7 @@ Future<void> subIsolateEntryPoint(SendPort sendPort) async {
|
|||
var dbHelper = DBHelper();
|
||||
String rss = item.url;
|
||||
sendPort.send([item.title, item.url, 1]);
|
||||
BaseOptions options = new BaseOptions(
|
||||
BaseOptions options = BaseOptions(
|
||||
connectTimeout: 20000,
|
||||
receiveTimeout: 20000,
|
||||
);
|
||||
|
@ -436,7 +436,7 @@ Future<void> subIsolateEntryPoint(SendPort sendPort) async {
|
|||
RssFeed p;
|
||||
try {
|
||||
p = RssFeed.parse(response.data);
|
||||
} on ArgumentError catch (e) {
|
||||
} catch (e) {
|
||||
print(e);
|
||||
sendPort.send([item.title, item.url, 6]);
|
||||
await Future.delayed(Duration(seconds: 2));
|
||||
|
@ -460,16 +460,21 @@ Future<void> subIsolateEntryPoint(SendPort sendPort) async {
|
|||
img.Image thumbnail;
|
||||
String imageUrl;
|
||||
try {
|
||||
Response<List<int>> imageResponse = await Dio().get<List<int>>(
|
||||
p.itunes.image.href,
|
||||
options: Options(responseType: ResponseType.bytes));
|
||||
Response<List<int>> imageResponse =
|
||||
await Dio().get<List<int>>(p.itunes.image.href,
|
||||
options: Options(
|
||||
responseType: ResponseType.bytes,
|
||||
receiveTimeout: 60000,
|
||||
));
|
||||
imageUrl = p.itunes.image.href;
|
||||
img.Image image = img.decodeImage(imageResponse.data);
|
||||
thumbnail = img.copyResize(image, width: 300);
|
||||
} catch (e) {
|
||||
try {
|
||||
Response<List<int>> imageResponse = await Dio().get<List<int>>(
|
||||
item.imgUrl,
|
||||
Response<List<int>> imageResponse = await Dio(BaseOptions(
|
||||
connectTimeout: 20000,
|
||||
receiveTimeout: 60000,
|
||||
)).get<List<int>>(item.imgUrl,
|
||||
options: Options(responseType: ResponseType.bytes));
|
||||
imageUrl = item.imgUrl;
|
||||
img.Image image = img.decodeImage(imageResponse.data);
|
||||
|
@ -543,7 +548,7 @@ Future<void> subIsolateEntryPoint(SendPort sendPort) async {
|
|||
} else
|
||||
sendPort.send("done");
|
||||
}
|
||||
} on DioError catch (e) {
|
||||
} catch (e) {
|
||||
print(e);
|
||||
sendPort.send([item.title, item.url, 6]);
|
||||
await Future.delayed(Duration(seconds: 2));
|
||||
|
|
Loading…
Reference in New Issue