Skip to content

Commit

Permalink
Merge branch 'release/v0.9.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
lucien144 committed Nov 29, 2022
2 parents fa6e89e + a77ddf5 commit 45ce2d1
Show file tree
Hide file tree
Showing 23 changed files with 327 additions and 111 deletions.
2 changes: 1 addition & 1 deletion ios/Flutter/AppFrameworkInfo.plist
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
<key>CFBundleVersion</key>
<string>1.0</string>
<key>MinimumOSVersion</key>
<string>10.0</string>
<string>11.0</string>
</dict>
</plist>
2 changes: 1 addition & 1 deletion ios/Podfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'
platform :ios, '11.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
Expand Down
14 changes: 7 additions & 7 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ PODS:
- Flutter
- wakelock (0.0.1):
- Flutter
- webview_flutter (0.0.1):
- webview_flutter_wkwebview (0.0.1):
- Flutter

DEPENDENCIES:
Expand All @@ -175,7 +175,7 @@ DEPENDENCIES:
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)
- video_player_avfoundation (from `.symlinks/plugins/video_player_avfoundation/ios`)
- wakelock (from `.symlinks/plugins/wakelock/ios`)
- webview_flutter (from `.symlinks/plugins/webview_flutter/ios`)
- webview_flutter_wkwebview (from `.symlinks/plugins/webview_flutter_wkwebview/ios`)

SPEC REPOS:
trunk:
Expand Down Expand Up @@ -233,8 +233,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/video_player_avfoundation/ios"
wakelock:
:path: ".symlinks/plugins/wakelock/ios"
webview_flutter:
:path: ".symlinks/plugins/webview_flutter/ios"
webview_flutter_wkwebview:
:path: ".symlinks/plugins/webview_flutter_wkwebview/ios"

SPEC CHECKSUMS:
device_info: d7d233b645a32c40dfdc212de5cf646ca482f175
Expand All @@ -247,7 +247,7 @@ SPEC CHECKSUMS:
FirebaseCoreDiagnostics: 92e07a649aeb66352b319d43bdd2ee3942af84cb
FirebaseInstallations: 40bd9054049b2eae9a2c38ef1c3dd213df3605cd
FirebaseMessaging: 82c4a48638f53f7b184f3cc9f6cd2cbe533ab316
Flutter: 50d75fe2f02b26cc09d224853bb45737f8b3214a
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
fluttertoast: 16fbe6039d06a763f3533670197d01fc73459037
FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
GoogleAppMeasurement: 837649ad3987936c232f6717c5680216f6243d24
Expand All @@ -270,8 +270,8 @@ SPEC CHECKSUMS:
url_launcher_ios: 839c58cdb4279282219f5e248c3321761ff3c4de
video_player_avfoundation: e489aac24ef5cf7af82702979ed16f2a5ef84cff
wakelock: d0fc7c864128eac40eba1617cb5264d9c940b46f
webview_flutter: 3603125dfd3bcbc9d8d418c3f80aeecf331c068b
webview_flutter_wkwebview: b7e70ef1ddded7e69c796c7390ee74180182971f

PODFILE CHECKSUM: 54b56b37ef04a402b4e20983b360f8d98c1d2f96
PODFILE CHECKSUM: 89a09e9f5abb8e2c7d30d14730ed5d3c05befb0f

COCOAPODS: 1.11.3
25 changes: 17 additions & 8 deletions ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@
"${BUILT_PRODUCTS_DIR}/url_launcher_ios/url_launcher_ios.framework",
"${BUILT_PRODUCTS_DIR}/video_player_avfoundation/video_player_avfoundation.framework",
"${BUILT_PRODUCTS_DIR}/wakelock/wakelock.framework",
"${BUILT_PRODUCTS_DIR}/webview_flutter/webview_flutter.framework",
"${BUILT_PRODUCTS_DIR}/webview_flutter_wkwebview/webview_flutter_wkwebview.framework",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
Expand Down Expand Up @@ -309,7 +309,7 @@
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/url_launcher_ios.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/video_player_avfoundation.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/wakelock.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/webview_flutter.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/webview_flutter_wkwebview.framework",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
Expand Down Expand Up @@ -428,8 +428,11 @@
"$(PROJECT_DIR)/Flutter",
);
INFOPLIST_FILE = Runner/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
Expand Down Expand Up @@ -564,8 +567,11 @@
"$(PROJECT_DIR)/Flutter",
);
INFOPLIST_FILE = Runner/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
Expand Down Expand Up @@ -596,8 +602,11 @@
"$(PROJECT_DIR)/Flutter",
);
INFOPLIST_FILE = Runner/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
Expand Down
11 changes: 10 additions & 1 deletion lib/FyxApp.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import 'package:fyx/theme/T.dart';
import 'package:fyx/theme/skin/Skin.dart';
import 'package:fyx/theme/skin/skins/ForestSkin.dart';
import 'package:fyx/theme/skin/skins/FyxSkin.dart';
import 'package:fyx/theme/skin/skins/GreyMatterSkin.dart';
import 'package:package_info/package_info.dart';
import 'package:provider/provider.dart';
import 'package:sentry/sentry.dart';
Expand Down Expand Up @@ -102,6 +103,10 @@ class FyxApp extends StatefulWidget {
MainRepository().deviceInfo = results[2] as DeviceInfo;
MainRepository().settings = results[3] as SettingsProvider;

Sentry.configureScope(
(scope) => scope.setUser(SentryUser(username: MainRepository().credentials?.nickname)),
);

_notificationsService = NotificationService(
onToken: (fcmToken) => ApiController().registerFcmToken(fcmToken),
// TODO: Do not register if the token is already saved.
Expand Down Expand Up @@ -204,7 +209,11 @@ class _FyxAppState extends State<FyxApp> with WidgetsBindingObserver {
builder: (ctx, widget) => Directionality(
textDirection: TextDirection.ltr,
child: Skin(
skins: [FyxSkin.create(fontSize: ctx.watch<ThemeModel>().fontSize), ForestSkin.create(fontSize: ctx.watch<ThemeModel>().fontSize)],
skins: [
FyxSkin.create(fontSize: ctx.watch<ThemeModel>().fontSize),
ForestSkin.create(fontSize: ctx.watch<ThemeModel>().fontSize),
GreyMatterSkin.create(fontSize: ctx.watch<ThemeModel>().fontSize)
],
skin: ctx.watch<ThemeModel>().skin,
brightness: (() {
if (ctx.watch<ThemeModel>().theme == ThemeEnum.system && _platformBrightness != null) {
Expand Down
24 changes: 22 additions & 2 deletions lib/components/post/post_html.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import 'package:fyx/theme/skin/Skin.dart';
import 'package:fyx/theme/skin/SkinColors.dart';
import 'package:html/dom.dart' as dom;
import 'package:html_unescape/html_unescape.dart';
import 'package:material_design_icons_flutter/material_design_icons_flutter.dart';

class PostHtml extends StatelessWidget {
final Content? content;
Expand All @@ -42,6 +43,9 @@ class PostHtml extends StatelessWidget {
'body': Style(margin: EdgeInsets.all(0)),
'pre': Style(color: Colors.transparent),
'a': Style(color: colors.primary),
'.twitter-header a, .twitter-text a': Style(color: colors.twitter),
'.twitter-header .name': Style(fontWeight: FontWeight.bold),
'.twitter-text': Style(margin: EdgeInsets.symmetric(vertical: 10))
},
customRender: {
'em': (
Expand Down Expand Up @@ -127,6 +131,23 @@ class PostHtml extends StatelessWidget {
return Spoiler(parsedChild);
}

// Twitter
if (element.attributes['data-embed-type'] == 'twitter') {
return Padding(
padding: const EdgeInsets.only(left: 10, top: 20),
child: Column(
children: [
Icon(MdiIcons.twitter, color: colors.twitter),
Container(
padding: EdgeInsets.only(left: 10),
child: parsedChild,
decoration: BoxDecoration(border: Border(left: BorderSide(width: 6, color: colors.twitter))),
),
],
),
);
}

// Youtube
if (element.attributes['data-embed-type'] == 'youtube') {
var img = element.querySelector('img');
Expand Down Expand Up @@ -199,8 +220,7 @@ class PostHtml extends StatelessWidget {
// Click through to another discussion
var parserResult = Helpers.parseDiscussionUri(link);
if (parserResult.isNotEmpty) {
var arguments =
DiscussionPageArguments(parserResult[INTERNAL_URI_PARSER.discussionId]!, search: parserResult[INTERNAL_URI_PARSER.search]);
var arguments = DiscussionPageArguments(parserResult[INTERNAL_URI_PARSER.discussionId]!, search: parserResult[INTERNAL_URI_PARSER.search]);
Navigator.of(context.buildContext, rootNavigator: true).pushNamed('/discussion', arguments: arguments);
return;
}
Expand Down
45 changes: 26 additions & 19 deletions lib/components/pull_to_refresh_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,27 @@ import 'package:sentry/sentry.dart';
class PullToRefreshList<TProvider> extends StatefulWidget {
final TDataProvider dataProvider;
final Function? sliverListBuilder;
final bool searchEnabled;
final String? searchLabel;
final String? searchTerm;
final int searchLimit;
final ValueChanged? onSearch;
final VoidCallback? onSearchClear;
final Function(ScrollNotification info)? onPullDown;
final Widget? pinnedWidget;
bool _disabled;
bool _isInfinite;
int _rebuild;

PullToRefreshList(
{required this.dataProvider,
this.searchEnabled = false,
this.onSearch, // TODO: move to SearchController
this.onSearchClear, // TODO: move to SearchController
this.searchLabel, // TODO: move to SearchController
this.searchTerm, // TODO: move to SearchController
this.searchLimit = 3, // TODO: move to SearchController
this.onPullDown,
isInfinite = false,
int rebuild = 0,
this.sliverListBuilder,
Expand All @@ -62,6 +66,7 @@ class _PullToRefreshListState<TProvider> extends State<PullToRefreshList> with S
List<Widget> _slivers = <Widget>[];
int _lastRebuild = 0;
String? _searchTerm;
bool _search = false;
late AnimationController slideController;
late Animation<Offset> slideOffset;

Expand Down Expand Up @@ -90,6 +95,7 @@ class _PullToRefreshListState<TProvider> extends State<PullToRefreshList> with S
// Add the refresh control on first position
_slivers.add(CupertinoSliverRefreshControl(
builder: Platform.isIOS ? CupertinoSliverRefreshControl.buildRefreshIndicator : buildAndroidRefreshIndicator,
refreshTriggerPullDistance: widget.onSearch != null ? 160 : 100,
onRefresh: () {
setState(() => _hasPulledDown = true);
if (!widget._disabled) {
Expand Down Expand Up @@ -132,15 +138,15 @@ class _PullToRefreshListState<TProvider> extends State<PullToRefreshList> with S
height: double.infinity,
width: double.infinity,
child: Column(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
if (widget.onSearch != null)
SearchBox(
loading: _isLoading,
label: widget.searchLabel,
limit: widget.searchLimit,
searchTerm: widget.searchTerm,
onSearch: widget.onSearch!,
onClear: widget.onSearchClear,
),
SearchBox(
enabled: widget.searchEnabled,
loading: _isLoading,
label: widget.searchLabel,
limit: widget.searchLimit,
searchTerm: _searchTerm,
onSearch: widget.onSearch,
onClear: widget.onSearchClear,
),
Expanded(child: T.feedbackScreen(context, isLoading: _isLoading, onPress: loadData, label: L.GENERAL_REFRESH)),
]));
}
Expand All @@ -167,20 +173,19 @@ class _PullToRefreshListState<TProvider> extends State<PullToRefreshList> with S
Column(
mainAxisSize: MainAxisSize.max,
children: [
if (widget.onSearch != null)
SearchBox(
loading: _isLoading,
label: widget.searchLabel,
limit: widget.searchLimit,
searchTerm: widget.searchTerm,
onSearch: widget.onSearch!,
onClear: widget.onSearchClear,
),
SearchBox(
enabled: widget.searchEnabled,
loading: _isLoading,
label: widget.searchLabel,
limit: widget.searchLimit,
searchTerm: _searchTerm,
onSearch: widget.onSearch,
onClear: widget.onSearchClear,
),
Expanded(
child: NotificationListener(
onNotification: (scrollInfo) {
if (scrollInfo is ScrollNotification) {

// Hide keyboard -> https://github.com/lucien144/fyx/issues/343
FocusManager.instance.primaryFocus?.unfocus();

Expand All @@ -189,6 +194,8 @@ class _PullToRefreshListState<TProvider> extends State<PullToRefreshList> with S
slideController.reverse();
}

if (widget.onPullDown != null) widget.onPullDown!(scrollInfo);

if (widget._isInfinite) {
if (_controller.position.userScrollDirection == ScrollDirection.reverse && scrollInfo.metrics.outOfRange) {
if (_slivers.last is! SliverPadding) {
Expand Down
24 changes: 11 additions & 13 deletions lib/components/search_box.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@ import 'package:fyx/theme/skin/Skin.dart';
import 'package:fyx/theme/skin/SkinColors.dart';

class SearchBox extends ConsumerStatefulWidget {
final bool enabled;
final String? label;
final ValueChanged onSearch;
final ValueChanged? onSearch;
final VoidCallback? onClear;
final String? searchTerm;
final int limit;
final bool loading;

SearchBox({Key? key, required this.onSearch, this.onClear, this.searchTerm, this.limit = 3, this.label = 'Hledej', this.loading = false})
SearchBox({Key? key, this.onSearch, this.enabled = false, this.onClear, this.searchTerm, this.limit = 3, this.label = 'Hledej', this.loading = false})
: super(key: key);

@override
Expand All @@ -35,7 +36,7 @@ class _SearchBoxState extends ConsumerState<SearchBox> with TickerProviderStateM
void initState() {
super.initState();

searchAnimation = AnimationController(vsync: this, value: widget.searchTerm == null ? 0 : 1);
searchAnimation = AnimationController(vsync: this, value: widget.enabled ? 1 : 0);
searchController.text = widget.searchTerm ?? '';
_loading = widget.loading;
}
Expand All @@ -44,21 +45,16 @@ class _SearchBoxState extends ConsumerState<SearchBox> with TickerProviderStateM
void didUpdateWidget(oldWidget) {
super.didUpdateWidget(oldWidget);

if (oldWidget.searchTerm != widget.searchTerm) {
if (widget.searchTerm == null) {
searchController.clear();
}
if (oldWidget.enabled != widget.enabled) {
searchAnimation.animateTo(
widget.searchTerm == null ? 0 : 1,
widget.enabled ? 1 : 0,
curve: Curves.easeOutExpo,
duration: const Duration(milliseconds: 600),
);
}

if (widget.searchTerm == null) {
if (!widget.enabled) {
focus.unfocus();
} else if (widget.searchTerm == '' && oldWidget.searchTerm != '') {
focus.requestFocus();
}

// Update the loading only if has finished outside,
Expand All @@ -80,7 +76,8 @@ class _SearchBoxState extends ConsumerState<SearchBox> with TickerProviderStateM
T.warn('Zadejte alespoň ${widget.limit} písmena...');
setState(() => _loading = false);
} else {
widget.onSearch(term);
if (widget.onSearch != null)
widget.onSearch!(term);
setState(() => _loading = true);
}
}
Expand Down Expand Up @@ -112,7 +109,8 @@ class _SearchBoxState extends ConsumerState<SearchBox> with TickerProviderStateM
},
onSubmitted: _submit,
onSuffixTap: () {
widget.onSearch('');
if (widget.onSearch != null)
widget.onSearch!('');
searchController.clear();
if (widget.onClear != null) {
widget.onClear!();
Expand Down
Loading

0 comments on commit 45ce2d1

Please sign in to comment.