mirror of
				https://github.com/AppFlowy-IO/AppFlowy.git
				synced 2025-10-31 01:54:37 +00:00 
			
		
		
		
	 d842f228e8
			
		
	
	
		d842f228e8
		
			
		
	
	
	
	
		
			
			* feat: integrate supabase auth service * chore: ignore the sercet * feat: separate and inject the auth service * chore: integrate auth service into sign in/up page * feat: integrate github and google sign in * chore: update user trait * feat: box any params in UserCloudService trait * feat: add flowy-server crate * refactor: user trait * docs: doc ThirdPartyAuthPB * feat: server provider * feat: pass the uuid to rust side * feat: pass supabase config to rust side * feat: integrate env file * feat: implement login as guest * feat: impl postgrest * test: use env * chore: upper case key * feat: optimize the file storage * fix: don't call set auth when user login in local * docs: add docs * feat: create/update/get user using postgrest * feat: optimize the login as guest * feat: create user workspace * feat: create user default workspace * feat: redesign the setting path location page * feat: use uuid as view id * feat: send auth info to rust backend * fix: sign up * fix: skip to wrong page after login * fix: integrate test error * fix: indent command error * feat: add discord login in type * fix: flutter analyze * ci: fix rust tests * ci: fix tauri build * ci: fix tauri build --------- Co-authored-by: nathan <nathan@appflowy.io>
		
			
				
	
	
		
			70 lines
		
	
	
		
			2.1 KiB
		
	
	
	
		
			Dart
		
	
	
	
	
	
			
		
		
	
	
			70 lines
		
	
	
		
			2.1 KiB
		
	
	
	
		
			Dart
		
	
	
	
	
	
| import 'dart:io';
 | |
| 
 | |
| import 'package:appflowy/core/config/kv_keys.dart';
 | |
| import 'package:archive/archive_io.dart';
 | |
| import 'package:flutter/services.dart';
 | |
| import 'package:path/path.dart' as p;
 | |
| import 'package:path_provider/path_provider.dart';
 | |
| import 'package:shared_preferences/shared_preferences.dart';
 | |
| 
 | |
| enum TestWorkspace {
 | |
|   board("board"),
 | |
|   emptyDocument("empty_document"),
 | |
|   aiWorkSpace("ai_workspace"),
 | |
|   coverImage("cover_image");
 | |
| 
 | |
|   const TestWorkspace(this._name);
 | |
| 
 | |
|   final String _name;
 | |
| 
 | |
|   Future<File> get zip async {
 | |
|     final Directory parent = await TestWorkspace._parent;
 | |
|     final File out = File(p.join(parent.path, '$_name.zip'));
 | |
|     if (await out.exists()) return out;
 | |
|     await out.create();
 | |
|     final ByteData data = await rootBundle.load(_asset);
 | |
|     await out.writeAsBytes(data.buffer.asUint8List());
 | |
|     return out;
 | |
|   }
 | |
| 
 | |
|   Future<Directory> get root async {
 | |
|     final Directory parent = await TestWorkspace._parent;
 | |
|     return Directory(p.join(parent.path, _name));
 | |
|   }
 | |
| 
 | |
|   static Future<Directory> get _parent async {
 | |
|     final Directory root = await getTemporaryDirectory();
 | |
|     if (await root.exists()) return root;
 | |
|     await root.create();
 | |
|     return root;
 | |
|   }
 | |
| 
 | |
|   String get _asset => 'assets/test/workspaces/$_name.zip';
 | |
| }
 | |
| 
 | |
| class TestWorkspaceService {
 | |
|   const TestWorkspaceService(this.workspace);
 | |
| 
 | |
|   final TestWorkspace workspace;
 | |
| 
 | |
|   /// Instructs the application to read workspace data from the workspace found under this [TestWorkspace]'s path.
 | |
|   Future<void> setUpAll() async {
 | |
|     SharedPreferences.setMockInitialValues(
 | |
|       {
 | |
|         KVKeys.pathLocation: await workspace.root.then((value) => value.path),
 | |
|       },
 | |
|     );
 | |
|   }
 | |
| 
 | |
|   /// Workspaces that are checked into source are compressed. [TestWorkspaceService.setUp()] decompresses the file into an ephemeral directory that will be ignored by source control.
 | |
|   Future<void> setUp() async {
 | |
|     final inputStream =
 | |
|         InputFileStream(await workspace.zip.then((value) => value.path));
 | |
|     final archive = ZipDecoder().decodeBuffer(inputStream);
 | |
|     extractArchiveToDisk(
 | |
|       archive,
 | |
|       await TestWorkspace._parent.then((value) => value.path),
 | |
|     );
 | |
|   }
 | |
| }
 |