Skip to content

Commit a35c2b2

Browse files
Fix link
1 parent cdb22de commit a35c2b2

File tree

160 files changed

+15918
-1457
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

160 files changed

+15918
-1457
lines changed

android/app/src/main/AndroidManifest.xml

+25-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44

55
<uses-permission android:name="android.permission.CAMERA" />
66
<uses-permission android:name="android.permission.VIBRATE" />
7-
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" android:maxSdkVersion="32"/>
7+
<uses-permission
8+
android:name="android.permission.READ_EXTERNAL_STORAGE"
9+
android:maxSdkVersion="32" />
810
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
911
<uses-permission android:name="android.permission.READ_MEDIA_VIDEOS" />
1012
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
@@ -37,10 +39,31 @@
3739
<meta-data
3840
android:name="io.flutter.embedding.android.NormalTheme"
3941
android:resource="@style/NormalTheme" />
42+
4043
<intent-filter>
4144
<action android:name="android.intent.action.MAIN" />
4245
<category android:name="android.intent.category.LAUNCHER" />
4346
</intent-filter>
47+
<intent-filter>
48+
<data
49+
android:host="*.x.com"
50+
android:pathPrefix="/"
51+
android:scheme="x" />
52+
<action android:name="android.intent.action.VIEW" />
53+
54+
<category android:name="android.intent.category.DEFAULT" />
55+
<category android:name="android.intent.category.BROWSABLE" />
56+
</intent-filter>
57+
<intent-filter>
58+
<data
59+
android:host="*.twitter.com"
60+
android:pathPrefix="/"
61+
android:scheme="twitter" />
62+
<action android:name="android.intent.action.VIEW" />
63+
64+
<category android:name="android.intent.category.DEFAULT" />
65+
<category android:name="android.intent.category.BROWSABLE" />
66+
</intent-filter>
4467
</activity>
4568

4669
<activity
@@ -54,6 +77,7 @@
5477

5578
<data android:scheme="twitee" />
5679
<data android:scheme="com.cloudchewie.twitee" />
80+
<data android:scheme="com.cloudchewie.twitee" />
5781
</intent-filter>
5882
</activity>
5983

lib/Api/post_api.dart

+3
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,9 @@ class PostApi {
333333
message: 'Success',
334334
);
335335
} catch (e, t) {
336+
if (e is DioException && e.response?.statusCode == 404) {
337+
return ResponseResult.error(code: 404, message: 'Success');
338+
}
336339
ILogger.error("Twitee", "Failed to translate", e, t);
337340
return ResponseResult.error(message: e.toString());
338341
}

lib/Api/user_api.dart

+48-17
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import 'package:dio/dio.dart';
1919
import 'package:twitee/Models/response_result.dart';
2020
import 'package:twitee/Openapi/export.dart';
2121

22+
import '../Models/translation_result.dart';
2223
import '../Utils/ilogger.dart';
2324
import '../Utils/request_util.dart';
2425

@@ -498,7 +499,7 @@ class UserApi {
498499
"creator_subscriptions_tweet_preview_api_enabled": true,
499500
"responsive_web_graphql_timeline_navigation_enabled": true,
500501
"responsive_web_graphql_skip_user_profile_image_extensions_enabled":
501-
false,
502+
false,
502503
"communities_web_enable_tweet_community_results_fetch": true,
503504
"c9s_tweet_anatomy_moderator_badge_enabled": true,
504505
"articles_preview_enabled": true,
@@ -512,7 +513,7 @@ class UserApi {
512513
"freedom_of_speech_not_reach_fetch_enabled": true,
513514
"standardized_nudges_misinfo": true,
514515
"tweet_with_visibility_results_prefer_gql_limited_actions_policy_enabled":
515-
true,
516+
true,
516517
"rweb_video_timestamps_enabled": true,
517518
"longform_notetweets_rich_text_read_enabled": true,
518519
"longform_notetweets_inline_media_enabled": true,
@@ -627,7 +628,7 @@ class UserApi {
627628
"creator_subscriptions_tweet_preview_api_enabled": true,
628629
"responsive_web_graphql_timeline_navigation_enabled": true,
629630
"responsive_web_graphql_skip_user_profile_image_extensions_enabled":
630-
false,
631+
false,
631632
"communities_web_enable_tweet_community_results_fetch": true,
632633
"c9s_tweet_anatomy_moderator_badge_enabled": true,
633634
"articles_preview_enabled": true,
@@ -641,7 +642,7 @@ class UserApi {
641642
"freedom_of_speech_not_reach_fetch_enabled": true,
642643
"standardized_nudges_misinfo": true,
643644
"tweet_with_visibility_results_prefer_gql_limited_actions_policy_enabled":
644-
true,
645+
true,
645646
"rweb_video_timestamps_enabled": true,
646647
"longform_notetweets_rich_text_read_enabled": true,
647648
"longform_notetweets_inline_media_enabled": true,
@@ -662,8 +663,7 @@ class UserApi {
662663
message: 'Success',
663664
);
664665
} catch (e, t) {
665-
ILogger.error(
666-
"Twitee", "Failed to get follower you know list", e, t);
666+
ILogger.error("Twitee", "Failed to get follower you know list", e, t);
667667
return ResponseResult.error(message: e.toString());
668668
}
669669
}
@@ -846,7 +846,6 @@ class UserApi {
846846
}
847847
}
848848

849-
850849
static Future<ResponseResult> getUserHighlights({
851850
required String userId,
852851
int count = 20,
@@ -873,7 +872,7 @@ class UserApi {
873872
"creator_subscriptions_tweet_preview_api_enabled": true,
874873
"responsive_web_graphql_timeline_navigation_enabled": true,
875874
"responsive_web_graphql_skip_user_profile_image_extensions_enabled":
876-
false,
875+
false,
877876
"communities_web_enable_tweet_community_results_fetch": true,
878877
"c9s_tweet_anatomy_moderator_badge_enabled": true,
879878
"articles_preview_enabled": true,
@@ -887,7 +886,7 @@ class UserApi {
887886
"freedom_of_speech_not_reach_fetch_enabled": true,
888887
"standardized_nudges_misinfo": true,
889888
"tweet_with_visibility_results_prefer_gql_limited_actions_policy_enabled":
890-
true,
889+
true,
891890
"rweb_video_timestamps_enabled": true,
892891
"longform_notetweets_rich_text_read_enabled": true,
893892
"longform_notetweets_inline_media_enabled": true,
@@ -1067,13 +1066,13 @@ class UserApi {
10671066
"creator_subscriptions_tweet_preview_api_enabled": true,
10681067
"responsive_web_graphql_timeline_navigation_enabled": true,
10691068
"responsive_web_graphql_skip_user_profile_image_extensions_enabled":
1070-
false,
1069+
false,
10711070
"communities_web_enable_tweet_community_results_fetch": true,
10721071
"c9s_tweet_anatomy_moderator_badge_enabled": true,
10731072
"articles_preview_enabled": true,
10741073
"responsive_web_edit_tweet_api_enabled": true,
10751074
"graphql_is_translatable_rweb_tweet_is_translatable_enabled":
1076-
true,
1075+
true,
10771076
"view_counts_everywhere_api_enabled": true,
10781077
"longform_notetweets_consumption_enabled": true,
10791078
"responsive_web_twitter_article_tweet_consumption_enabled": true,
@@ -1082,7 +1081,7 @@ class UserApi {
10821081
"freedom_of_speech_not_reach_fetch_enabled": true,
10831082
"standardized_nudges_misinfo": true,
10841083
"tweet_with_visibility_results_prefer_gql_limited_actions_policy_enabled":
1085-
true,
1084+
true,
10861085
"rweb_video_timestamps_enabled": true,
10871086
"longform_notetweets_rich_text_read_enabled": true,
10881087
"longform_notetweets_inline_media_enabled": true,
@@ -1133,13 +1132,13 @@ class UserApi {
11331132
"creator_subscriptions_tweet_preview_api_enabled": true,
11341133
"responsive_web_graphql_timeline_navigation_enabled": true,
11351134
"responsive_web_graphql_skip_user_profile_image_extensions_enabled":
1136-
false,
1135+
false,
11371136
"communities_web_enable_tweet_community_results_fetch": true,
11381137
"c9s_tweet_anatomy_moderator_badge_enabled": true,
11391138
"articles_preview_enabled": true,
11401139
"responsive_web_edit_tweet_api_enabled": true,
11411140
"graphql_is_translatable_rweb_tweet_is_translatable_enabled":
1142-
true,
1141+
true,
11431142
"view_counts_everywhere_api_enabled": true,
11441143
"longform_notetweets_consumption_enabled": true,
11451144
"responsive_web_twitter_article_tweet_consumption_enabled": true,
@@ -1148,7 +1147,7 @@ class UserApi {
11481147
"freedom_of_speech_not_reach_fetch_enabled": true,
11491148
"standardized_nudges_misinfo": true,
11501149
"tweet_with_visibility_results_prefer_gql_limited_actions_policy_enabled":
1151-
true,
1150+
true,
11521151
"rweb_video_timestamps_enabled": true,
11531152
"longform_notetweets_rich_text_read_enabled": true,
11541153
"longform_notetweets_inline_media_enabled": true,
@@ -1166,13 +1165,45 @@ class UserApi {
11661165
}
11671166
final data = response.data;
11681167
return ResponseResult.success(
1169-
data: Timeline.fromJson(
1170-
data['data']['user']['result']['viewing_other_users_topics_page']['body']['timeline']),
1168+
data: Timeline.fromJson(data['data']['user']['result']
1169+
['viewing_other_users_topics_page']['body']['timeline']),
11711170
message: 'Success',
11721171
);
11731172
} catch (e, t) {
11741173
ILogger.error("Twitee", "Failed to get topics", e, t);
11751174
return ResponseResult.error(message: e.toString());
11761175
}
11771176
}
1177+
1178+
static Future<ResponseResult> translateProfile({
1179+
required String userId,
1180+
required String destinationLanguage,
1181+
}) async {
1182+
try {
1183+
ILogger.info("Twitee API", "Translating");
1184+
final response = await RequestUtil.get(
1185+
"/strato/column/None/profileUserId=$userId,destinationLanguage=None,translationSource=Some(Google)/translation/service/translateProfile",
1186+
domainType: DomainType.v1,
1187+
forceCsrfToken: true,
1188+
);
1189+
if (response == null || response.statusCode != 200) {
1190+
return ResponseResult.error(
1191+
message: "Failed to translate",
1192+
data: response?.data,
1193+
statusCode: response?.statusCode ?? 500,
1194+
);
1195+
}
1196+
final data = response.data;
1197+
return ResponseResult.success(
1198+
data: TranslationResult.fromJson(data['profileTranslation']),
1199+
message: 'Success',
1200+
);
1201+
} catch (e, t) {
1202+
if (e is DioException && e.response?.statusCode == 404) {
1203+
return ResponseResult.error(code: 404, message: 'Success');
1204+
}
1205+
ILogger.error("Twitee", "Failed to translate", e, t);
1206+
return ResponseResult.error(message: e.toString());
1207+
}
1208+
}
11781209
}

lib/Models/translation_result.dart

+3-3
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@ class TranslationResult {
4040

4141
factory TranslationResult.fromJson(Map<String, dynamic> json) =>
4242
TranslationResult(
43-
id: json['id'],
44-
idStr: json['id_str'],
43+
id: json['id'] ?? "",
44+
idStr: json['id_str'] ?? "",
4545
translation: json['translation'],
4646
entities: Entities.fromJsonWithoutMedia(json['entities']),
47-
translationState: json['translationState'],
47+
translationState: json['translationState'] ?? "",
4848
sourceLanguage: json['sourceLanguage'] ?? "",
4949
localizedSourceLanguage: json['localizedSourceLanguage'] ?? "",
5050
destinationLanguage: json['destinationLanguage'] ?? "",

lib/Openapi/models/client_event_info.dart

+5-4
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,16 @@ import 'package:json_annotation/json_annotation.dart';
77
part 'client_event_info.g.dart';
88

99
@JsonSerializable()
10-
class ClientEventInfo {
10+
class ClientEventInfo {
1111
const ClientEventInfo({
1212
required this.component,
1313
required this.details,
1414
required this.element,
1515
});
16-
17-
factory ClientEventInfo.fromJson(Map<String, Object?> json) => _$ClientEventInfoFromJson(json);
18-
16+
17+
factory ClientEventInfo.fromJson(Map<String, Object?> json) =>
18+
_$ClientEventInfoFromJson(json);
19+
1920
final String? component;
2021
final dynamic details;
2122
final String? element;

lib/Openapi/models/cover_cta.g.dart

+2-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/Openapi/models/instruction_type.dart

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ enum InstructionType {
2222
timelineTerminateTimeline('TimelineTerminateTimeline'),
2323
@JsonValue('TimelineShowCover')
2424
timelineShowCover('TimelineShowCover'),
25+
2526
/// Default value for all unparsed values, allows backward compatibility when adding new values on the backend.
2627
$unknown(null);
2728

lib/Openapi/models/item_content_union.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,4 @@ class TimelineEventSummary extends ItemContentUnion {
5656

5757
@override
5858
Map<String, Object?> toJson() => {};
59-
}
59+
}

lib/Openapi/models/item_result.dart

+5-4
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,15 @@ import 'type_name.dart';
1010
part 'item_result.g.dart';
1111

1212
@JsonSerializable()
13-
class ItemResult {
13+
class ItemResult {
1414
const ItemResult({
1515
required this.privateTypename,
1616
required this.result,
1717
});
18-
19-
factory ItemResult.fromJson(Map<String, Object?> json) => _$ItemResultFromJson(json);
20-
18+
19+
factory ItemResult.fromJson(Map<String, Object?> json) =>
20+
_$ItemResultFromJson(json);
21+
2122
@JsonKey(name: '__typename')
2223
final TypeName? privateTypename;
2324
final TweetUnion? result;

lib/Openapi/models/list_latest_tweets_timeline_response.dart

+8-5
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,17 @@ import 'list_tweets_timeline_data.dart';
99
part 'list_latest_tweets_timeline_response.g.dart';
1010

1111
@JsonSerializable()
12-
class ListLatestTweetsTimelineResponse {
12+
class ListLatestTweetsTimelineResponse {
1313
const ListLatestTweetsTimelineResponse({
1414
required this.data,
1515
});
16-
17-
factory ListLatestTweetsTimelineResponse.fromJson(Map<String, Object?> json) => _$ListLatestTweetsTimelineResponseFromJson(json);
18-
16+
17+
factory ListLatestTweetsTimelineResponse.fromJson(
18+
Map<String, Object?> json) =>
19+
_$ListLatestTweetsTimelineResponseFromJson(json);
20+
1921
final ListTweetsTimelineData data;
2022

21-
Map<String, Object?> toJson() => _$ListLatestTweetsTimelineResponseToJson(this);
23+
Map<String, Object?> toJson() =>
24+
_$ListLatestTweetsTimelineResponseToJson(this);
2225
}

lib/Openapi/models/list_tweets_timeline.dart

+5-4
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,14 @@ import 'timeline.dart';
99
part 'list_tweets_timeline.g.dart';
1010

1111
@JsonSerializable()
12-
class ListTweetsTimeline {
12+
class ListTweetsTimeline {
1313
const ListTweetsTimeline({
1414
required this.timeline,
1515
});
16-
17-
factory ListTweetsTimeline.fromJson(Map<String, Object?> json) => _$ListTweetsTimelineFromJson(json);
18-
16+
17+
factory ListTweetsTimeline.fromJson(Map<String, Object?> json) =>
18+
_$ListTweetsTimelineFromJson(json);
19+
1920
final Timeline? timeline;
2021

2122
Map<String, Object?> toJson() => _$ListTweetsTimelineToJson(this);

lib/Openapi/models/user.g.dart

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)