Skip to content
This repository has been archived by the owner on Apr 11, 2023. It is now read-only.

Commit

Permalink
Added new designs, bug fixes, downloadable videos and audio files.
Browse files Browse the repository at this point in the history
  • Loading branch information
bostrot committed Aug 17, 2018
1 parent c8eb9d2 commit 273402c
Show file tree
Hide file tree
Showing 14 changed files with 1,450 additions and 418 deletions.
4 changes: 2 additions & 2 deletions android/app/build.gradle
Expand Up @@ -30,8 +30,8 @@ android {
applicationId "pro.bostrot.dtubeviewer"
minSdkVersion 16
targetSdkVersion 27
versionCode 30
versionName "2.2.0"
versionCode 34
versionName "2.3.3"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}

Expand Down
129 changes: 81 additions & 48 deletions lib/components/api.dart
Expand Up @@ -24,71 +24,94 @@ theme(String mode) {
Steemit steemit = new Steemit();

class Steemit {
Future getAll(user) async {
var _temp0 = await steemit.getDiscussionsByHot();
var _temp1 = await steemit.getDiscussionsByTrending();
var _temp2 = await steemit.getDiscussionsByCreated();
var _temp3 = await steemit.getDiscussionsByFeed(user);

var _tempArray = [
_temp0,
_temp1,
_temp2,
_temp3,
];
return _tempArray;
}

Future getDiscussionsByHot() async {
Dio dio = new Dio();
Response response = await dio.post("https://api.steemit.com", data: {
"id": "0",
"jsonrpc": "2.0",
"method": "call",
"params": [
"database_api",
"get_discussions_by_hot",
[
{"tag": "dtube", "limit": 100, "truncate_body": 1}
]
]
});
Response response = await dio.get("https://dtubeapp.cf:2053/getDiscussions?by=hot");
return (response.data);
}

Future getTrendingTags() async {
Dio dio = new Dio();
{
DateTime now = new DateTime.now();

Response response = await dio.get("https://api.asksteem.com/trending?q=meta.video.info.title:* AND created:>=" +
now.year.toString() +
"-" +
now.month.toString() +
"-" +
now.day.toString() +
"&types=tags&size=50");
return (response.data);
}
}

Future getTag(var tag) async {
Dio dio = new Dio();
{
DateTime now = new DateTime.now();

Response response = await dio.get("https://api.asksteem.com/search?q=created:>=" +
now.year.toString() +
"-" +
now.month.toString() +
"-" +
now.day.toString() +
" AND meta.video.content.tags:dtube&include=meta,payout&sort_by=net_votes&pg=3&order=desc&types=post");
print("https://api.asksteem.com/search?q=created:>=" +
now.year.toString() +
"-" +
now.month.toString() +
"-" +
now.day.toString() +
" AND meta.video.content.tags:dtube&include=meta,payout&sort_by=net_votes&pg=3&order=desc&types=post");
return (response.data);
}
}

Future getDiscussionsByTrending() async {
Dio dio = new Dio();
Response response = await dio.post("https://api.steemit.com", data: {
"id": "1",
"jsonrpc": "2.0",
"method": "call",
"params": [
"database_api",
"get_discussions_by_trending",
[
{"tag": "dtube", "limit": 100, "truncate_body": 1}
]
]
});
Response response = await dio.get("https://dtubeapp.cf:2053/getDiscussions?by=trending");
return (response.data);
}

Future getDiscussionsByCreated() async {
Dio dio = new Dio();
Response response = await dio.post("https://api.steemit.com", data: {
"id": "2",
"jsonrpc": "2.0",
"method": "call",
"params": [
"database_api",
"get_discussions_by_created",
[
{"tag": "dtube", "limit": 100, "truncate_body": 1}
]
]
});
Response response = await dio.get("https://dtubeapp.cf:2053/getDiscussions?by=created");
return (response.data);
}

Future getDiscussionsByFeed(var user) async {
Dio dio = new Dio();
Response response = await dio.post("https://api.steemit.com", data: {
"id": "4",
"jsonrpc": "2.0",
"method": "call",
"params": [
"database_api",
"get_discussions_by_feed",
[
{"tag": user, "limit": 100, "truncate_body": 1}
]
]
});
Response response = user != null
? await dio.post("https://api.steemit.com", data: {
"id": "4",
"jsonrpc": "2.0",
"method": "call",
"params": [
"database_api",
"get_discussions_by_feed",
[
{"tag": user == null ? "bostrot" : user, "limit": 100, "truncate_body": 1}
]
]
})
: await dio.get("https://dtubeapp.cf:2053/getDiscussions?by=feed");
return (response.data);
}

Expand Down Expand Up @@ -256,11 +279,21 @@ void saveData(var key, var data) async {
prefs.setString(key, data);
}

void saveDataMap(var key, List data) async {
final prefs = await SharedPreferences.getInstance();
prefs.setStringList(key, data);
}

retrieveData(var key) async {
final prefs = await SharedPreferences.getInstance();
return (prefs.getString(key));
}

retrieveDataMap(var key) async {
final prefs = await SharedPreferences.getInstance();
return (prefs.getStringList(key));
}

String linkify(String text) {
text = text.replaceAll("\\n", "\n");
var urlPattern = r"(https?|ftp)://([-A-Z0-9.]+)(/[-A-Z0-9+&@#/%=~_|!:,.;]*)?(\?[A-Z0-9+&@#/%=~_|!:‌​,.;]*)?";
Expand Down

0 comments on commit 273402c

Please sign in to comment.