Skip to content

HwangSB/SimHae

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

86 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

What is Simhae?

심해(心海) - 우리의 마음이 머무는 바다 (Simhae - Deep sea of mind)

We developed ‘Deep sea of mind’ it called ‘Simhae’ which can communicate with suicide survivor and provide information about support center and offline meeting. The meaning of the title is sharing your heart in the deep sea.

Getting Started

Install

  1. How to install Flutter

  2. Set up an editor

Build and Run

  1. Providing SHA1/SHA256 key

  2. After creating SHA-1 / 256 key using JAVA keytool, add it to "SHA certificate fingerprint" in "My App" of firebase.

  3. Launch Terminal and move to Project Directory.

  4. Enter flutter pub get.

  5. Click Run tab on side of and 'create a launch.json' file.

  6. Click the Run tab on the left side of VSCode and click create a launch.json file.

  7. Select Dart & Flutter Environment.

  8. Click the Run tab on the left side of VSCode and click the Run button to run.

DB

image
InformationMapCommunity Firestore Database
image
InformationMap Firestore Database
image
Users/Stories Firestore Database (Only if hasStory is true)
image
MemorialSpace Firestore Database

Technical Stack

Firebase - FireStore

  • We used firestore because We built a community and felt the need for cloud DB.

  • Usage

StreamBuilder<QuerySnapshot>(
    stream: document.reference.collection('Stories').snapshots(),
    builder: (context, snapshot) {
        if (snapshot.hasError) {
            ...
        }
        switch (snapshot.connectionState) {
            case ConnectionState.waiting:
                ...
            default:
                List<DocumentSnapshot> documents = snapshot.data.documents;
                DocumentSnapshot document = documents[random.nextInt(documents.length)];
                ...
        }
    },
);

Firebase - Storage

  • Used to store self-help meeting logos and activity photos. The image address of the storage was saved from the FireStore database to retrieve photos.

  • Usage

    Get URL

    Future<List<String>> _getURLs(List<String> paths) async {
        List<String> result = List<String>();
    
        final FirebaseStorage storage = FirebaseStorage(
            ...
        );
    
        for (var path in paths) {
            final String url = await storage.ref().child(path).getDownloadURL();
            result.add(url);
        }
        return result;
    }

    Get FireStorage Image

    FutureBuilder<List<String>>(
        future: _getURLs(mapData.images),
        builder: (context, snapshot) {
        Widget child;
    
        if (snapshot.hasData) {
            child = Image.network(snapshot.data[index]);
        } else if (snapshot.connectionState == ConnectionState.waiting) {
            child = Text('Loading...');
        }
    
        return Padding(
                padding: const EdgeInsets.all(8.0),
                child: Container(
                    decoration: BoxDecoration(
                        borderRadius: BorderRadius.circular(18.0),
                        color: Colors.white,
                    ),
                    child: Padding(
                        padding: const EdgeInsets.all(8.0),
                        child: Center(
                        child: child,
                        ),
                    ),
                ),
            );
        },
    );

Firebase - Authentication

  • Among the various authentication methods, Google login was used because it used from many people and was easy to use.

  • Usage

    Authentication

    GoogleSignInAccount googleSignInAccount = await googleSignIn.signIn();
    if (googleSignInAccount != null) {
        await GlobalUserAccount.instance.connect(googleSignInAccount);
        final snapshot = await Firestore.instance
            .collection('Users')
            .document(GlobalUserAccount.instance.uid)
            .get();
        if (snapshot == null || !snapshot.exists) {
            Firestore.instance
                .collection('Users')
                .document(GlobalUserAccount.instance.uid)
                .setData({'hasStory': false}, merge: true);
        }
    }
    
    if (googleSignInAccount != null) {
        bool isAcceptAllTos = await _checkAllTosAccept();
        if (!isAcceptAllTos) {
            Navigator.pushReplacement(
                context,
                MaterialPageRoute(
                builder: (context) => TosPage(),
                ),
            );
        }
    }

Google Cloud Platform - Google Map

  • Google Maps were used to visually indicate the location of the self-help group. Because Google Maps covers 99% of the world's maps, We thought it was easy to expand services around the world.

  • Usage

    Google Map

    GoogleMap(
        mapType: MapType.normal,
        markers: _markerLocations,
        initialCameraPosition: CameraPosition(
            target: LatLng(..., ...),
            zoom: 7.0,
        ),
        onMapCreated: (controller) {
            _controller.complete(controller);
        },
    );

SQLite

  • It was used to determine whether the terms and conditions of use are agreed within the app. implemented using sqflite package.

  • Usage

    Initialize Firestore Database

    Future<Database> _open() async {
        Database database = await openDatabase(
        join(await getDatabasesPath(), 'settings.db'),
        onCreate: (db, version) {
            db.execute(
            ...
            );
            db.rawInsert(
            ...
            );
        },
        version: 1,
        );
    
        return database;
    }

    Get Value from SQLite Database

    Future<String> valueOf(String key) async {
        Database database = await _open();
    
        final List<Map<String, dynamic>> rawAppSettings = await database.query(
            ...
        );
    
        database.close();
    
        List<AppSetting> appSettings = List.generate(rawAppSettings.length, (i) {
            return AppSetting(
                ...
            );
        });
    
        AppSetting setting = appSettings.firstWhere((setting) => setting.key == key);
        return setting.value;
    }

    Update SQLite Database

    void update(AppSetting appSetting) async {
        Database database = await _open();
    
        await database.update(
            ...
        );
    
        database.close();
    }

Preview

image image image image
image image image preview8

Contributer

Yuna Kim - UI/UX Designer, Video productor

Younghoon Joe - Project Manager, Data Analyst

Jeongyoon Joo - Front/Back-End Developer

Sangbeom Hwang - Front/Back-End Developer

About

DSC SCH Solution Challenge Project

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages