Skip to content

Commit aed2d21

Browse files
committed
切换附件URL为读取url接口
1 parent edfe571 commit aed2d21

5 files changed

Lines changed: 35 additions & 12 deletions

File tree

CHANGELOG.MD

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
更新日志文档,版本顺序从新到旧,最新版本在最前(上)面。
44

5+
# 1.4.3
6+
PS: 需要服务端版本 >= 1.0.4
7+
8+
- 切换附件URL为读取url接口
9+
510
# 20.4.3
611

712
PS: 需要服务端版本 >= 0.20.11

README.md

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,11 @@ ikaros app by flutter
99
flutter packages pub run build_runner build
1010
```
1111

12-
# Version
13-
APP的版本规定
12+
## 核心版本适配情况
13+
请根据ikaros server版本(core版本),选择合适的插件版本下载,
1414

15-
服务端版本.主版本.子版本
16-
17-
app的服务端版本只取服务端版本的主版本和子版本,忽略第三级别的Bug版本,
18-
19-
比如当前APP适配的服务端是 0.15.5, 那么服务端版本就是15,此时APP的版本就是 15.3.0
20-
21-
如果服务端版本是1.0.0,此时服务端的子版本最大曾是两位数,则,app的服务端版本是 1 * 100 + 0 = 100
22-
,此时APP的版本就是 100.3.0
15+
核心版本适配情况如下:
16+
- 插件版本1.x.x 到 现在:需要core版本大于1.0.4
2317

2418
# Build
2519

lib/api/attachment/AttachmentApi.dart

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1+
import 'dart:convert';
2+
13
import 'package:crypto/crypto.dart';
24
import 'package:dio/dio.dart';
35
import 'package:flutter/foundation.dart';
6+
import 'package:ikaros/api/dio_client.dart';
47

58
class AttachmentApi {
69

@@ -39,4 +42,23 @@ class AttachmentApi {
3942
}
4043
return List.empty();
4144
}
45+
46+
47+
Future<String> findReadUrlByAttachmentId(int attachmentId) async {
48+
String apiUrl =
49+
"/api/v1alpha1/attachment/url/read/id/$attachmentId";
50+
try {
51+
// print("queryParams: $queryParams");
52+
Dio dio = await DioClient.getDio();
53+
var response = await dio.get(apiUrl);
54+
// print("response status code: ${response.statusCode}");
55+
if (response.statusCode != 200) {
56+
return "";
57+
}
58+
return response.data;
59+
} catch (e) {
60+
print(e);
61+
return "";
62+
}
63+
}
4264
}

lib/subject/episode.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import 'dart:io';
44
import 'package:dart_vlc/dart_vlc.dart' as DartVlc;
55
import 'package:flutter/foundation.dart';
66
import 'package:flutter/material.dart';
7+
import 'package:ikaros/api/attachment/AttachmentApi.dart';
78
import 'package:ikaros/api/attachment/AttachmentRelationApi.dart';
89
import 'package:ikaros/api/attachment/model/VideoSubtitle.dart';
910
import 'package:ikaros/api/auth/AuthApi.dart';
@@ -156,7 +157,8 @@ class _SubjectEpisodesState extends State<SubjectEpisodesPage> {
156157
}
157158

158159
String coverUrl = UrlUtils.getCoverUrl(_apiBaseUrl, _subject?.cover ?? "");
159-
String videUrl = UrlUtils.getCoverUrl(_apiBaseUrl, episodeResource.url);
160+
// String videUrl = UrlUtils.getCoverUrl(_apiBaseUrl, episodeResource.url);
161+
String videUrl = await AttachmentApi().findReadUrlByAttachmentId(episodeResource.attachmentId);
160162
String videoTitle = _getEpisodeName(episodeRecord.episode);
161163
String videoSubTitle = episodeResource.name;
162164

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: ikaros
22
description: ikaros app by flutter
3-
version: 20.4.3
3+
version: 1.4.3
44

55
environment:
66
sdk: '>=2.18.4 <=3.10.5'

0 commit comments

Comments
 (0)