Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions assets/haptics/heartbeats.ahap
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"Version":1,"Metadata":{"CreatedBy":"Haptics Simulator","CreatedAt":"","Description":"Three organic heartbeats over three seconds, made using precisely spaced transient events at varying parameters."},"Pattern":[{"Event":{"EventParameters":[{"ParameterValue":0.8,"ParameterID":"HapticIntensity"},{"ParameterValue":0.2,"ParameterID":"HapticSharpness"}],"Time":0,"EventType":"HapticTransient","EventDuration":0}},{"Event":{"EventParameters":[{"ParameterValue":1,"ParameterID":"HapticIntensity"},{"ParameterValue":0.3,"ParameterID":"HapticSharpness"}],"Time":0.013,"EventType":"HapticTransient","EventDuration":0}},{"Event":{"EventParameters":[{"ParameterValue":0.8,"ParameterID":"HapticIntensity"},{"ParameterValue":0.1,"ParameterID":"HapticSharpness"}],"Time":0.22,"EventType":"HapticTransient","EventDuration":0}},{"Event":{"EventParameters":[{"ParameterValue":0.7,"ParameterID":"HapticIntensity"},{"ParameterValue":0,"ParameterID":"HapticSharpness"}],"Time":0.255,"EventType":"HapticTransient","EventDuration":0}},{"Event":{"EventParameters":[{"ParameterValue":0.8,"ParameterID":"HapticIntensity"},{"ParameterValue":0.2,"ParameterID":"HapticSharpness"}],"Time":1,"EventType":"HapticTransient","EventDuration":0}},{"Event":{"EventParameters":[{"ParameterValue":1,"ParameterID":"HapticIntensity"},{"ParameterValue":0.3,"ParameterID":"HapticSharpness"}],"Time":1.013,"EventType":"HapticTransient","EventDuration":0}},{"Event":{"EventParameters":[{"ParameterValue":0.8,"ParameterID":"HapticIntensity"},{"ParameterValue":0.1,"ParameterID":"HapticSharpness"}],"Time":1.22,"EventType":"HapticTransient","EventDuration":0}},{"Event":{"EventParameters":[{"ParameterValue":0.7,"ParameterID":"HapticIntensity"},{"ParameterValue":0,"ParameterID":"HapticSharpness"}],"Time":1.255,"EventType":"HapticTransient","EventDuration":0}},{"Event":{"EventParameters":[{"ParameterValue":0.8,"ParameterID":"HapticIntensity"},{"ParameterValue":0.2,"ParameterID":"HapticSharpness"}],"Time":2,"EventType":"HapticTransient","EventDuration":0}},{"Event":{"EventParameters":[{"ParameterValue":1,"ParameterID":"HapticIntensity"},{"ParameterValue":0.3,"ParameterID":"HapticSharpness"}],"Time":2.013,"EventType":"HapticTransient","EventDuration":0}},{"Event":{"EventParameters":[{"ParameterValue":0.8,"ParameterID":"HapticIntensity"},{"ParameterValue":0.1,"ParameterID":"HapticSharpness"}],"Time":2.22,"EventType":"HapticTransient","EventDuration":0}},{"Event":{"EventParameters":[{"ParameterValue":0.7,"ParameterID":"HapticIntensity"},{"ParameterValue":0,"ParameterID":"HapticSharpness"}],"Time":2.255,"EventType":"HapticTransient","EventDuration":0}}]}
6 changes: 6 additions & 0 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
PODS:
- advanced_haptics (0.0.1):
- Flutter
- app_links (7.0.0):
- Flutter
- connectivity_plus (0.0.1):
Expand Down Expand Up @@ -95,6 +97,7 @@ PODS:
- Flutter

DEPENDENCIES:
- advanced_haptics (from `.symlinks/plugins/advanced_haptics/ios`)
- app_links (from `.symlinks/plugins/app_links/ios`)
- connectivity_plus (from `.symlinks/plugins/connectivity_plus/ios`)
- device_info_plus (from `.symlinks/plugins/device_info_plus/ios`)
Expand Down Expand Up @@ -129,6 +132,8 @@ SPEC REPOS:
- SwiftyGif

EXTERNAL SOURCES:
advanced_haptics:
:path: ".symlinks/plugins/advanced_haptics/ios"
app_links:
:path: ".symlinks/plugins/app_links/ios"
connectivity_plus:
Expand Down Expand Up @@ -179,6 +184,7 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/workmanager_apple/ios"

SPEC CHECKSUMS:
advanced_haptics: 6bb54f03d66fe7258ab48130a19ce32bf85c212b
app_links: 6d01271b3907b0ee7325c5297c75d697c4226c4d
connectivity_plus: 2a701ffec2c0ae28a48cf7540e279787e77c447d
device_info_plus: bf2e3232933866d73fe290f2942f2156cdd10342
Expand Down
2 changes: 2 additions & 0 deletions lib/config/constants.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import 'package:hacki/extensions/extensions.dart';

abstract class Constants {
static const String hackiFirstCommitLink =
'https://github.com/Livinglist/Hacki/tree/fe3e343ed9a9ebb4f608384e0aa64d0f1b19685d';
static const String endUserAgreementLink =
'https://github.com/Livinglist/Hacki/blob/master/assets/eula.md';
static const String privacyPolicyLink =
Expand Down
6 changes: 3 additions & 3 deletions lib/config/locator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ final GetIt locator = GetIt.instance;

/// Set up [GetIt] locator.
Future<void> setUpLocator() async {
final File logOutputFile = await LogUtil.initLogFile();
final File logOutputFile = await LogUtils.initLogFile();

locator
..registerSingleton<Logger>(
Logger(
filter: CustomLogFilter(),
printer: LogUtil.logPrinter,
output: LogUtil.logOutput(logOutputFile),
printer: LogUtils.logPrinter,
output: LogUtils.logOutput(logOutputFile),
),
)
..registerSingleton<SembastRepository>(SembastRepository())
Expand Down
12 changes: 6 additions & 6 deletions lib/cubits/comments/comments_cubit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ class CommentsCubit extends Cubit<CommentsState> with Loggable, BuildableMixin {
}

void loadAll(Story story) {
HapticFeedbackUtil.light();
HapticFeedbackUtils.light();
emit(
state.copyWith(
onlyShowTargetComment: false,
Expand Down Expand Up @@ -664,7 +664,7 @@ class CommentsCubit extends Cubit<CommentsState> with Loggable, BuildableMixin {
}

Future<void> loadParentThread() async {
HapticFeedbackUtil.light();
HapticFeedbackUtils.light();
emit(state.copyWith(fetchParentStatus: CommentsStatus.inProgress));
final Item? parent =
await _hackerNewsRepository.fetchItem(id: state.item.parent);
Expand All @@ -686,7 +686,7 @@ class CommentsCubit extends Cubit<CommentsState> with Loggable, BuildableMixin {
}

Future<void> loadRootThread() async {
HapticFeedbackUtil.light();
HapticFeedbackUtils.light();
emit(state.copyWith(fetchRootStatus: CommentsStatus.inProgress));
final Story? parent = await _hackerNewsRepository
.fetchParentStory(id: state.item.id)
Expand All @@ -712,7 +712,7 @@ class CommentsCubit extends Cubit<CommentsState> with Loggable, BuildableMixin {
if (order == null) return;
if (state.order == order) return;
if (state.status == CommentsStatus.inProgress) return;
HapticFeedbackUtil.selection();
HapticFeedbackUtils.selection();
_streamSubscription?.cancel();
for (final StreamSubscription<Comment> s in _streamSubscriptions.values) {
s.cancel();
Expand Down Expand Up @@ -744,7 +744,7 @@ class CommentsCubit extends Cubit<CommentsState> with Loggable, BuildableMixin {

if (fetchMode == null) return;
if (state.fetchMode == fetchMode) return;
HapticFeedbackUtil.selection();
HapticFeedbackUtils.selection();
_streamSubscription?.cancel();
for (final StreamSubscription<Comment> s in _streamSubscriptions.values) {
s.cancel();
Expand Down Expand Up @@ -1151,7 +1151,7 @@ comments length is ${state.comments.length}
final int newCommentsCount =
state.comments.where((Comment c) => c.isNew).length;
if (newCommentsCount > 0) {
HapticFeedbackUtil.success();
HapticFeedbackUtils.success();
navigatorKey.currentContext?.showSnackBar(
persist: false,
duration: AppDurations.fiveSeconds,
Expand Down
5 changes: 5 additions & 0 deletions lib/cubits/preference/preference_cubit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import 'package:hacki/config/locator.dart';
import 'package:hacki/extensions/extensions.dart';
import 'package:hacki/models/models.dart';
import 'package:hacki/repositories/repositories.dart';
import 'package:hacki/utils/haptic_feedback_utils.dart';

part 'preference_state.dart';

Expand Down Expand Up @@ -79,6 +80,10 @@ class PreferenceCubit extends Cubit<PreferenceState> with Loggable {

emit(state.copyWithPreference(preference));

if (preference is EyeCandyPreference && preference.val as bool) {
unawaited(HapticFeedbackUtils.loadAndPlay());
}

switch (preference.val) {
case int():
_preferenceRepository.setInt(
Expand Down
20 changes: 10 additions & 10 deletions lib/cubits/search/search_cubit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import 'package:hacki/config/locator.dart';
import 'package:hacki/extensions/buildable_mixin.dart';
import 'package:hacki/models/models.dart';
import 'package:hacki/repositories/repositories.dart';
import 'package:hacki/utils/haptic_feedback_util.dart';
import 'package:hacki/utils/haptic_feedback_utils.dart';
import 'package:rxdart/rxdart.dart';

part 'search_state.dart';
Expand Down Expand Up @@ -72,7 +72,7 @@ class SearchCubit extends Cubit<SearchState> with BuildableMixin {
}

void addFilter<T extends SearchFilter>(T filter) {
HapticFeedbackUtil.selection();
HapticFeedbackUtils.selection();
if (state.params.contains<T>()) {
emit(
state.copyWith(
Expand All @@ -91,7 +91,7 @@ class SearchCubit extends Cubit<SearchState> with BuildableMixin {
}

void removeFilter<T extends SearchFilter>() {
HapticFeedbackUtil.selection();
HapticFeedbackUtils.selection();
if (state.params.contains<T>() == false) return;

emit(
Expand All @@ -104,7 +104,7 @@ class SearchCubit extends Cubit<SearchState> with BuildableMixin {
}

void onToggled(TypeTagFilter filter) {
HapticFeedbackUtil.selection();
HapticFeedbackUtils.selection();
if (state.params.contains<TypeTagFilter>() &&
state.params.get<TypeTagFilter>() == filter) {
removeFilter<TypeTagFilter>();
Expand All @@ -115,7 +115,7 @@ class SearchCubit extends Cubit<SearchState> with BuildableMixin {
}

void onSortToggled() {
HapticFeedbackUtil.selection();
HapticFeedbackUtils.selection();
emit(
state.copyWith(
params: state.params.copyWith(
Expand All @@ -128,7 +128,7 @@ class SearchCubit extends Cubit<SearchState> with BuildableMixin {
}

void onExactMatchToggled() {
HapticFeedbackUtil.selection();
HapticFeedbackUtils.selection();
emit(
state.copyWith(
params: state.params.copyWith(
Expand All @@ -141,7 +141,7 @@ class SearchCubit extends Cubit<SearchState> with BuildableMixin {
}

void onDateTimeRangeUpdated(DateTime start, DateTime end) {
HapticFeedbackUtil.selection();
HapticFeedbackUtils.selection();
final DateTime updatedStart = start.copyWith(
second: 0,
millisecond: 0,
Expand All @@ -168,7 +168,7 @@ class SearchCubit extends Cubit<SearchState> with BuildableMixin {
}

void onPostedByChanged(String? username) {
HapticFeedbackUtil.selection();
HapticFeedbackUtils.selection();
if (username == null) {
removeFilter<PostedByFilter>();
} else {
Expand All @@ -181,7 +181,7 @@ class SearchCubit extends Cubit<SearchState> with BuildableMixin {
state.params.filters.whereType<PointsFilter>().singleOrNull;
if (pointsFilter == existingFilter) return;

HapticFeedbackUtil.selection();
HapticFeedbackUtils.selection();
if (pointsFilter == null) {
removeFilter<PointsFilter>();
} else {
Expand All @@ -194,7 +194,7 @@ class SearchCubit extends Cubit<SearchState> with BuildableMixin {
state.params.filters.whereType<CommentsNumberFilter>().singleOrNull;
if (filter == existingFilter) return;

HapticFeedbackUtil.selection();
HapticFeedbackUtils.selection();
if (filter == null) {
removeFilter<CommentsNumberFilter>();
} else {
Expand Down
20 changes: 10 additions & 10 deletions lib/cubits/vote/vote_cubit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import 'package:hacki/blocs/blocs.dart';
import 'package:hacki/config/locator.dart';
import 'package:hacki/models/models.dart';
import 'package:hacki/repositories/repositories.dart';
import 'package:hacki/utils/haptic_feedback_util.dart';
import 'package:hacki/utils/haptic_feedback_utils.dart';

part 'vote_state.dart';

Expand Down Expand Up @@ -53,19 +53,19 @@ class VoteCubit extends Cubit<VoteState> {

Future<bool> upvote({bool cancelIfVoted = true}) async {
if (!_authBloc.state.isLoggedIn) {
HapticFeedbackUtil.error();
HapticFeedbackUtils.error();
emit(state.copyWith(status: VoteStatus.failureNotLoggedIn));
return false;
}

if (state.item.by == _authBloc.state.username) {
HapticFeedbackUtil.error();
HapticFeedbackUtils.error();
emit(state.copyWith(status: VoteStatus.failureBeHumble));
return false;
}

if (state.item.dead || state.item.deleted || state.item.by.isEmpty) {
HapticFeedbackUtil.error();
HapticFeedbackUtils.error();
emit(state.copyWith(status: VoteStatus.failure));
return false;
}
Expand All @@ -77,7 +77,7 @@ class VoteCubit extends Cubit<VoteState> {
);

if (success) {
HapticFeedbackUtil.success();
HapticFeedbackUtils.success();
emit(
state.copyWith(
vote: Vote.up,
Expand All @@ -95,7 +95,7 @@ class VoteCubit extends Cubit<VoteState> {

return true;
} else {
HapticFeedbackUtil.error();
HapticFeedbackUtils.error();

emit(
state.copyWith(
Expand All @@ -112,7 +112,7 @@ class VoteCubit extends Cubit<VoteState> {
id: state.item.id,
);

HapticFeedbackUtil.success();
HapticFeedbackUtils.success();
emit(
state.copyWithVoteRemoved(
status: VoteStatus.canceled,
Expand Down Expand Up @@ -148,7 +148,7 @@ class VoteCubit extends Cubit<VoteState> {
vote: false,
);

HapticFeedbackUtil.success();
HapticFeedbackUtils.success();
emit(
state.copyWith(
vote: Vote.down,
Expand All @@ -163,15 +163,15 @@ class VoteCubit extends Cubit<VoteState> {
id: state.item.id,
);

HapticFeedbackUtil.success();
HapticFeedbackUtils.success();
emit(
state.copyWithVoteRemoved(
status: VoteStatus.canceled,
),
);
}
} else {
HapticFeedbackUtil.error();
HapticFeedbackUtils.error();
emit(state.copyWith(status: VoteStatus.failureKarmaBelowThreshold));
}
}
Expand Down
4 changes: 2 additions & 2 deletions lib/extensions/buildable_mixin.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ mixin BuildableMixin {
if (comment == null) return null;

final List<LinkifyElement> elements = await Isolate.run(
() => LinkifierUtil.linkify(
() => LinkifierUtils.linkify(
comment.text,
extraLinkifiers: <Linkifier>[
if (withHighlightedText != null && withHighlightedText.isNotEmpty)
Expand All @@ -60,7 +60,7 @@ mixin BuildableMixin {

final List<LinkifyElement> elements =
await compute<String, List<LinkifyElement>>(
LinkifierUtil.linkify,
LinkifierUtils.linkify,
story.text,
);

Expand Down
10 changes: 5 additions & 5 deletions lib/extensions/item_action_mixin.dart
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ mixin ItemActionMixin<T extends StatefulWidget> on State<T> {
Item? parent,
VoidCallback? onSearchInThreadTapped,
}) {
HapticFeedbackUtil.light();
HapticFeedbackUtils.light();

if (item.dead || item.deleted) {
return;
Expand Down Expand Up @@ -106,11 +106,11 @@ mixin ItemActionMixin<T extends StatefulWidget> on State<T> {
if (isFav) {
favCubit.removeFav(item.id);
showSnackBar(content: 'Removed from favorites.');
HapticFeedbackUtil.success();
HapticFeedbackUtils.success();
} else {
favCubit.addFav(item.id);
showSnackBar(content: 'Added to favorites.');
HapticFeedbackUtil.success();
HapticFeedbackUtils.success();
}
}

Expand Down Expand Up @@ -194,7 +194,7 @@ mixin ItemActionMixin<T extends StatefulWidget> on State<T> {
if (mounted && (yesTapped ?? false)) {
context.read<AuthBloc>().add(AuthFlag(item: item));
showSnackBar(content: 'Comment flagged!');
HapticFeedbackUtil.success();
HapticFeedbackUtils.success();
}
});
}
Expand Down Expand Up @@ -240,7 +240,7 @@ mixin ItemActionMixin<T extends StatefulWidget> on State<T> {
}

showSnackBar(content: 'User ${isBlocked ? 'unblocked' : 'blocked'}!');
HapticFeedbackUtil.success();
HapticFeedbackUtils.success();
}
});
}
Expand Down
4 changes: 2 additions & 2 deletions lib/extensions/widget_extension.dart
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,14 @@ extension ContextMenuBuilder on Widget {
)
..addAll(<ContextMenuButtonItem>[
ContextMenuButtonItem(
onPressed: () => LinkUtil.launch(
onPressed: () => LinkUtils.launch(
'''${Constants.wikipediaLink}$selectedText''',
context,
),
label: 'Wikipedia',
),
ContextMenuButtonItem(
onPressed: () => LinkUtil.launch(
onPressed: () => LinkUtils.launch(
'''${Constants.wiktionaryLink}$selectedText''',
context,
),
Expand Down
Loading