Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into issue198_cleanup-pe…
Browse files Browse the repository at this point in the history
…riodically
  • Loading branch information
bitfriend committed Aug 14, 2024
2 parents f04eba2 + 481db61 commit d0bb599
Show file tree
Hide file tree
Showing 334 changed files with 1,721 additions and 5,640 deletions.
3 changes: 3 additions & 0 deletions .changes/2048-pin-refactoring.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- [New] : Brand new UI-UX for Pin creation
- [New] : Support for adding attachment while Pin Creation
- [New] : Now you can add one or more Link as attachment for Pin
39 changes: 11 additions & 28 deletions .github/workflows/docs.yml → .github/workflows/build-docs.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,14 @@
name: Docs
name: Reusable Docs Build

on:
push:
branches:
- main
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

workflow_call:

jobs:
docs:
runs-on: ubuntu-20.04
name: Build Latest API Docs
steps:
- uses: actions/checkout@v3
with:
submodules: true

# ---- setup of systems

- uses: actions/checkout@v4
- name: Setup flutter
uses: subosito/flutter-action@v2
with:
Expand Down Expand Up @@ -52,25 +39,21 @@ jobs:
run: |
cargo doc -p acter -p acter-core -p matrix-sdk-store-media-cache-wrapper
echo --- Moving docs
mv target/doc/ docs/static/api/main/rust
mv target/doc/ docs/api/main/rust
- name: Build Dart App
run: flutter pub global run dartdoc --include-external integration_test/main_test.dart --output ../docs/static/api/main/app/
run: flutter pub global run dartdoc --include-external integration_test/main_test.dart --output ../docs/api/main/app/
working-directory: app

- name: Checking for bindings
run: ls -ltas packages/rust_sdk/lib/

- name: Build Dart SDK
run: flutter pub global run dartdoc --output ../../../docs/static/api/main/dart-sdk/
run: flutter pub global run dartdoc --output ../../../docs/api/main/dart-sdk/
working-directory: packages/rust_sdk

# ---- Finalisation for github pages

- name: build zola
uses: shalzz/[email protected]
if: ${{ github.ref == 'refs/heads/main' }}
env:
BUILD_DIR: docs
PAGES_BRANCH: "gh-pages"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
# Upload the docs
path: 'docs/'
26 changes: 26 additions & 0 deletions .github/workflows/check-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Docs

on:
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:

docs:
uses: ./.github/workflows/build-docs.yml
secrets: inherit

deploy:
runs-on: ubuntu-20.04
if: ${{ github.ref == 'refs/heads/main' }}
needs:
- docs
name: Build Latest API Docs
steps:
- name: Deploy to GitHub Pages
if: ${{ github.ref == 'refs/heads/main' }}
id: deployment
uses: actions/deploy-pages@v4
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
name: Demo builds

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

Expand Down
37 changes: 37 additions & 0 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Deploy Docs

on:
push:
branches: ["main"]

workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

jobs:

docs:
uses: ./.github/workflows/build-docs.yml
secrets: inherit

deploy:
runs-on: ubuntu-20.04
if: ${{ github.ref == 'refs/heads/main' }}
needs:
- docs
name: Build Latest API Docs
steps:
- name: Deploy to GitHub Pages
if: ${{ github.ref == 'refs/heads/main' }}
id: deployment
uses: actions/deploy-pages@v4
File renamed without changes.
File renamed without changes.
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +0,0 @@
[submodule "docs/themes/adidoks"]
path = docs/themes/adidoks
url = https://github.com/aaranxu/adidoks.git
12 changes: 4 additions & 8 deletions app/integration_test/tests/pins.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import 'package:acter/common/utils/constants.dart';
import 'package:acter/common/widgets/html_editor.dart';
import 'package:acter/common/widgets/spaces/select_space_form_field.dart';
import 'package:acter/features/home/data/keys.dart';
import 'package:acter/features/pins/pages/create_pin.dart';
import 'package:acter/features/pins/pages/pin_page.dart';
import 'package:acter/features/pins/pages/create_pin_page.dart';
import 'package:acter/features/pins/widgets/pin_item.dart';
import 'package:acter/features/search/model/keys.dart';
import 'package:appflowy_editor/appflowy_editor.dart';
Expand Down Expand Up @@ -56,23 +56,19 @@ extension ActerNews on ConvenientTest {
await pinActionKey.should(findsOneWidget);
await pinActionKey.tap();

final titleField = find.byKey(CreatePinPage.titleFieldKey);
final titleField = find.byKey(CreatePin.titleFieldKey);
await titleField.should(findsOneWidget);
await titleField.enterTextWithoutReplace(title);

final urlField = find.byKey(CreatePinPage.urlFieldKey);
await urlField.should(findsOneWidget);
await urlField.enterTextWithoutReplace(url);

final descriptionField = find.byKey(CreatePinPage.descriptionFieldKey);
final descriptionField = find.byKey(CreatePin.descriptionFieldKey);
await descriptionField.should(findsOneWidget);
final textEditorState =
(tester.firstState(descriptionField) as HtmlEditorState).editorState;
await textEditorState.insertText(0, content, path: [0]);
textEditorState.service.keyboardService!.closeKeyboard();
await selectSpace(spaceId, SelectSpaceFormField.openKey);

final submit = find.byKey(CreatePinPage.submitBtn);
final submit = find.byKey(CreatePin.submitBtn);
await tester.ensureVisible(submit);
await submit.tap();
}
Expand Down
10 changes: 9 additions & 1 deletion app/lib/common/models/types.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,15 @@ typedef MemberInfo = ({String userId, String roomId});
typedef ChatMessageInfo = ({String messageId, String roomId});
typedef RoomQuery = ({String roomId, String query});

enum AttachmentType { camera, image, audio, video, location, file }
enum AttachmentType {
camera,
image,
audio,
video,
location,
file,
link,
}

typedef AttachmentInfo = ({AttachmentType type, File file});

Expand Down
12 changes: 12 additions & 0 deletions app/lib/common/themes/components/input_decoration_theme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,18 @@ var inputDecorationTheme = InputDecorationTheme(
borderSide: BorderSide.none,
borderRadius: BorderRadius.circular(12),
),
errorBorder: OutlineInputBorder(
borderSide: const BorderSide(
color: Colors.red,
),
borderRadius: BorderRadius.circular(12),
),
focusedErrorBorder: OutlineInputBorder(
borderSide: const BorderSide(
color: Colors.red,
),
borderRadius: BorderRadius.circular(12),
),
hintStyle: const TextStyle(
color: Color(0xFF898989),
fontWeight: FontWeight.w300,
Expand Down
1 change: 1 addition & 0 deletions app/lib/common/utils/routes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ enum Routes {
// -- pins
pins('/pins'),
pin('/pins/:pinId'),
createPin('/pins/create'),

// -- events
calendarEvents('/events'),
Expand Down
32 changes: 32 additions & 0 deletions app/lib/common/utils/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ final idMatrixRegexp = RegExp(
r'matrix:roomid/(?<id>[^?]+)(\?via=(?<server_name>[^&]+))?(&via=(?<server_name2>[^&]+))?(&via=(?<server_name3>[^&]+))?',
);

final urlValidatorRegexp = RegExp(
r'^[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b[-a-zA-Z0-9()@:%_+.~#?&/=]*$',
);

/// Get provider right from the context no matter where we are
extension Context on BuildContext {
// Custom call a provider for reading method only
Expand Down Expand Up @@ -162,6 +166,34 @@ Future<bool> openLink(String target, BuildContext context) async {
}
}

String getHumanReadableFileSize(int bytes) {
if (bytes <= 0) return '0 B';
const suffixes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
var i = (log(bytes) / log(1024)).floor();
return '${(bytes / pow(1024, i)).toStringAsFixed(1)} ${suffixes[i]}';
}

String documentTypeFromFileExtension(String fileExtension) {
switch (fileExtension) {
case 'png':
case 'jpg':
case 'jpeg':
return 'Image';
case 'mov':
case 'mp4':
return 'Video';
case 'mp3':
case 'wav':
return 'Audio';
case 'pdf':
return 'PDF';
case 'txt':
return 'Text File';
default:
return '';
}
}

Future<void> shareTextToWhatsApp(
BuildContext context, {
required String text,
Expand Down
8 changes: 4 additions & 4 deletions app/lib/common/widgets/edit_html_description_sheet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ void showEditHtmlDescriptionBottomSheet({
useSafeArea: true,
context: context,
isDismissible: true,
constraints: const BoxConstraints(maxHeight: 450),
isScrollControlled: true,
builder: (context) {
return EditHtmlDescriptionSheet(
Expand Down Expand Up @@ -69,9 +68,10 @@ class _EditHtmlDescriptionSheetState

@override
Widget build(BuildContext context) {
return Container(
padding: const EdgeInsets.symmetric(horizontal: 20.0),
return Padding(
padding: MediaQuery.of(context).viewInsets,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Text(widget.bottomSheetTitle ?? L10n.of(context).editDescription),
const SizedBox(height: 20),
Expand Down Expand Up @@ -112,7 +112,7 @@ class _EditHtmlDescriptionSheetState
),
],
),
const SizedBox(height: 20),
const SizedBox(height: 100),
],
),
);
Expand Down
6 changes: 3 additions & 3 deletions app/lib/common/widgets/edit_title_sheet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ void showEditTitleBottomSheet({
showDragHandle: true,
useSafeArea: true,
context: context,
constraints: const BoxConstraints(maxHeight: 300),
isScrollControlled: true,
builder: (context) {
return EditTitleSheet(
bottomSheetTitle: bottomSheetTitle,
Expand Down Expand Up @@ -52,9 +52,9 @@ class _EditTitleSheetState extends ConsumerState<EditTitleSheet> {
@override
Widget build(BuildContext context) {
return Container(
padding: const EdgeInsets.symmetric(horizontal: 20.0),
constraints: const BoxConstraints(maxWidth: 500),
padding: MediaQuery.of(context).viewInsets,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Text(
widget.bottomSheetTitle ?? L10n.of(context).editTitle,
Expand Down
Loading

0 comments on commit d0bb599

Please sign in to comment.