Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into ben-better-error-showing
Browse files Browse the repository at this point in the history
  • Loading branch information
gnunicorn committed Aug 28, 2024
2 parents 024c15e + 4a9dd31 commit 7eed21e
Show file tree
Hide file tree
Showing 38 changed files with 640 additions and 352 deletions.
1 change: 0 additions & 1 deletion .changes/2029-backgrounding-and-tray-icon.md

This file was deleted.

4 changes: 0 additions & 4 deletions .changes/2067-refactor-pin-details.md

This file was deleted.

1 change: 0 additions & 1 deletion .changes/2072-calendar-sync.md

This file was deleted.

1 change: 0 additions & 1 deletion .changes/2078-fix-chat-search.md

This file was deleted.

1 change: 0 additions & 1 deletion .changes/2086-limited-spaces-list.md

This file was deleted.

1 change: 1 addition & 0 deletions .changes/chat-compose-draft.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Now Chat supports storing unsent composed message in improved way .i.e. can persist between app restarts and reply/edit views.
2 changes: 0 additions & 2 deletions .changes/chat-input-fixes.md

This file was deleted.

1 change: 1 addition & 0 deletions .changes/chat-input-text-disappear.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Chat: fix bug where text disappears when try to tap on field in edit/reply state.
2 changes: 1 addition & 1 deletion .github/workflows/build-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ jobs:
- uses: subosito/flutter-action@v2
name: Set up flutter
with:
flutter-version: '3.22'
flutter-version: '3.24'
channel: 'stable'

- name: Flutter info
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- name: Setup flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '3.22'
flutter-version: '3.24'
channel: 'stable'

- name: Install supported toolchain
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/check-flutter-integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ jobs:
# - uses: subosito/flutter-action@v2
# name: Set up flutter
# with:
# flutter-version: '3.22'
# flutter-version: '3.24'
# channel: 'stable'

# - uses: actions/setup-python@v4
Expand Down Expand Up @@ -224,7 +224,7 @@ jobs:
# - uses: subosito/flutter-action@v2
# name: Set up flutter
# with:
# flutter-version: '3.22'
# flutter-version: '3.24'
# channel: 'stable'

# - uses: actions/setup-python@v4
Expand Down Expand Up @@ -313,7 +313,7 @@ jobs:
- uses: subosito/flutter-action@v2
name: Set up flutter
with:
flutter-version: '3.22'
flutter-version: '3.24'
channel: 'stable'
- uses: actions/setup-java@v4
with:
Expand Down Expand Up @@ -397,7 +397,7 @@ jobs:
- uses: subosito/flutter-action@v2
name: Set up flutter
with:
flutter-version: '3.22'
flutter-version: '3.24'
channel: 'stable'

- uses: actions/setup-python@v4
Expand Down Expand Up @@ -548,7 +548,7 @@ jobs:
# - uses: subosito/flutter-action@v2
# name: Set up flutter
# with:
# flutter-version: '3.22'
# flutter-version: '3.24'
# channel: 'stable'

# - uses: actions/setup-python@v4
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/check-native.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
- uses: subosito/flutter-action@v2
if: ${{matrix.needs_flutter}}
with:
flutter-version: '3.22'
flutter-version: '3.24'
channel: 'stable'
- name: Run Clippy
run: cargo clippy -p ${{matrix.package}} ${{matrix.clippy_extras}} -- -D warnings
Expand Down Expand Up @@ -78,7 +78,7 @@ jobs:
- uses: subosito/flutter-action@v2
if: ${{matrix.needs_flutter}}
with:
flutter-version: '3.22'
flutter-version: '3.24'
channel: 'stable'
- name: Release Build
run: cargo build -p ${{matrix.package}} --release
Expand All @@ -91,7 +91,7 @@ jobs:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
with:
flutter-version: '3.22'
flutter-version: '3.24'
channel: 'stable'
- name: Install supported rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/check-styles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
with:
flutter-version: '3.22'
flutter-version: '3.24'
channel: 'stable'

- name: Generate env
Expand Down
18 changes: 17 additions & 1 deletion .github/workflows/deploy-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -392,9 +392,25 @@ jobs:
- name: Tag for release
run: |
echo "Add release ${{ needs.tags.outputs.tag }}"
git co ci/release-${{ needs.tags.outputs.tag }}
git commit -m "Releasing ${{ needs.tags.outputs.tag }}"
git tag ${{ needs.tags.outputs.tag }}
git push origin main ${{ needs.tags.outputs.tag }} release-latest
git push origin ci/release-${{ needs.tags.outputs.tag }} ${{ needs.tags.outputs.tag }}
- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@v6
with:
branch: "ci/release-${{ needs.tags.outputs.tag }}"
title: "Releasing ${{ needs.tags.outputs.tag }}"
body: Release ${{ needs.tags.outputs.tag }} auto PR.
labels: minor
assignees: gnunicorn

- name: Enable Pull Request Automerge
uses: peter-evans/enable-pull-request-automerge@v3
with:
pull-request-number: ${{ steps.cpr.outputs.pull-request-number }}

- name: Release
id: create_release
Expand Down
2 changes: 0 additions & 2 deletions app/integration_test/tests/tasks.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import 'package:acter/common/utils/utils.dart';
import 'package:acter/features/home/data/keys.dart';
import 'package:acter/features/search/model/keys.dart';
import 'package:acter/features/space/providers/space_navbar_provider.dart';
Expand All @@ -24,7 +23,6 @@ typedef TaskListCreateResult = ({

extension ActerTasks on ConvenientTest {
Future<void> ensureTasksAreEnabled(String? spaceId) async {
await ensureLabEnabled(LabsFeature.tasks);
if (spaceId != null) {
await gotoSpace(spaceId);

Expand Down
4 changes: 2 additions & 2 deletions app/lib/common/pages/fatal_fail.dart
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ class _FatalFailPageState extends ConsumerState<FatalFailPage> {
],
),
if (showStack) Text(stack),
ButtonBar(
alignment: MainAxisAlignment.center,
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
ActerDangerActionButton.icon(
icon: const Icon(
Expand Down
4 changes: 2 additions & 2 deletions app/lib/common/pages/not_found.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ class NotFoundPage extends ConsumerWidget {
Text(
'How did you get here? There is nothing to see at `$currentLocation`...',
),
ButtonBar(
alignment: MainAxisAlignment.center,
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
OutlinedButton.icon(
icon: const Icon(Atlas.home_thin),
Expand Down
25 changes: 17 additions & 8 deletions app/lib/common/utils/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'dart:convert';
import 'dart:math';

import 'package:acter/common/providers/room_providers.dart';
import 'package:acter/common/utils/constants.dart';
import 'package:acter/common/utils/routes.dart';
import 'package:acter_flutter_sdk/acter_flutter_sdk.dart';
import 'package:acter_flutter_sdk/acter_flutter_sdk_ffi.dart';
Expand Down Expand Up @@ -408,26 +409,34 @@ enum LabsFeature {
cobudget,
polls,
discussions,
comments,

// specific features
chatUnread,

// system features
deviceCalendarSync,
encryptionBackup,

// candidates for always on
comments,
mobilePushNotifications,

// not a lab anymore but needs to stay for backwards compat
// -- not a lab anymore but needs to stay for backwards compat
tasks,
events,
pins,
showNotifications; // old name for desktop notifications

// searchOptions
encryptionBackup,
showNotifications, // FIXME: old name for desktop notifications
mobilePushNotifications;
static List<LabsFeature> get defaults =>
isDevBuild || isNightly ? nightlyDefaults : releaseDefaults;

static List<LabsFeature> get releaseDefaults => [
LabsFeature.mobilePushNotifications,
];

static List<LabsFeature> get defaults => [
LabsFeature.comments,
static List<LabsFeature> get nightlyDefaults => [
LabsFeature.encryptionBackup,
LabsFeature.deviceCalendarSync,
LabsFeature.mobilePushNotifications,
];
}
Expand Down
2 changes: 0 additions & 2 deletions app/lib/common/widgets/emoji_picker_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ class EmojiPickerWidget extends StatelessWidget {
categoryViewConfig: CategoryViewConfig(
backgroundColor: Theme.of(context).colorScheme.surface,
initCategory: Category.RECENT,
showBackspaceButton: true,
),
bottomActionBarConfig: BottomActionBarConfig(
showBackspaceButton: false,
Expand All @@ -70,7 +69,6 @@ class EmojiPickerWidget extends StatelessWidget {
),
searchViewConfig: SearchViewConfig(
backgroundColor: Theme.of(context).colorScheme.surface,
buttonColor: Theme.of(context).colorScheme.primary,
buttonIconColor: Theme.of(context).colorScheme.onPrimary,
),
checkPlatformCompatibility:
Expand Down
1 change: 1 addition & 0 deletions app/lib/config/app_shell.dart
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ class AppShellState extends ConsumerState<AppShell> {
// no wait goes there
Future.delayed(
const Duration(seconds: 1),
// ignore: use_build_context_synchronously
() => bottomNavigationTutorials(context: context),
);
initShake();
Expand Down
13 changes: 11 additions & 2 deletions app/lib/features/chat/providers/chat_providers.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ final autoDownloadMediaProvider =

// keep track of text controller values across rooms.
final chatInputProvider =
StateNotifierProvider<ChatInputNotifier, ChatInputState>(
StateNotifierProvider.autoDispose<ChatInputNotifier, ChatInputState>(
(ref) => ChatInputNotifier(),
);

Expand All @@ -44,6 +44,15 @@ final chatStateProvider =
(ref, roomId) => ChatRoomNotifier(ref: ref, roomId: roomId),
);

final chatComposerDraftProvider = FutureProvider.autoDispose
.family<ComposeDraft?, String>((ref, roomId) async {
final chat = await ref.watch(chatProvider(roomId).future);
if (chat == null) {
return null;
}
return (await chat.msgDraft().then((val) => val.draft()));
});

final chatTopic =
FutureProvider.autoDispose.family<String?, String>((ref, roomId) async {
final c = await ref.watch(chatProvider(roomId).future);
Expand Down Expand Up @@ -128,7 +137,7 @@ final chatMessagesProvider =
return [...messages, ...moreMessages];
});

final isAuthorOfSelectedMessage = StateProvider<bool>((ref) {
final isAuthorOfSelectedMessage = StateProvider.autoDispose<bool>((ref) {
final chatInputState = ref.watch(chatInputProvider);
final myUserId = ref.watch(myUserIdStrProvider);
return chatInputState.selectedMessage?.author.id == myUserId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ class MediaChatNotifier extends StateNotifier<MediaChatState> {
destFile: destPath,
width: 300,
height: 300,
keepAspectRatio: true,
format: 'jpeg',
quality: 90,
);
Expand Down
24 changes: 24 additions & 0 deletions app/lib/features/chat/utils.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import 'package:acter/common/providers/chat_providers.dart';
import 'package:acter/common/providers/room_providers.dart';
import 'package:acter/common/toolkit/buttons/primary_action_button.dart';
import 'package:acter/features/chat/models/chat_input_state/chat_input_state.dart';
import 'package:acter/features/chat/providers/chat_providers.dart';
import 'package:acter/features/room/actions/join_room.dart';
import 'package:acter/router/utils.dart';
import 'package:acter_flutter_sdk/acter_flutter_sdk_ffi.dart';
Expand Down Expand Up @@ -271,3 +274,24 @@ String parseEditMsg(types.Message message) {
}
return '';
}

// save composer draft object handler
Future<void> saveDraft(String text, String roomId, WidgetRef ref) async {
// get the convo object to initiate draft
final chat = await ref.read(chatProvider(roomId).future);
final messageId = ref.read(chatInputProvider).selectedMessage?.id;

if (chat != null) {
if (messageId != null) {
final selectedMessageState =
ref.read(chatInputProvider).selectedMessageState;
if (selectedMessageState == SelectedMessageState.edit) {
await chat.saveMsgDraft(text, null, 'edit', messageId);
} else if (selectedMessageState == SelectedMessageState.replyTo) {
await chat.saveMsgDraft(text, null, 'reply', messageId);
}
} else {
await chat.saveMsgDraft(text, null, 'new', null);
}
}
}
Loading

0 comments on commit 7eed21e

Please sign in to comment.