SquadHouseDev / SquadHouse

https://squadhousedev.github.io/
0 stars 1 forks source link

Backend Integration with Frontend Room Creation Process #59

Open henrylao opened 3 years ago

henrylao commented 3 years ago

squad-house-room-activity-prototype

henrylao commented 3 years ago

Tested querying on data-models-branch

public void queryAvailableRoutes(List<RoomRoute> allRoutes) {
    allRoutes.clear();
    ParseQuery<RoomRoute> mainQuery = new ParseQuery<RoomRoute>(RoomRoute.class);
    mainQuery.whereEqualTo(RoomRoute.KEY_IS_AVAILABLE, true);
    mainQuery.findInBackground(new FindCallback<RoomRoute>() {
        @Override
        public void done(List<RoomRoute> routesFound, ParseException e) {
            if (e == null) {
                allRoutes.addAll(routesFound);
                Log.i(TAG, String.valueOf(allRoutes.size()) + " routes found");
                String toDisplay = "";
                for (RoomRoute r : routesFound) {
                    Log.i(TAG, r.getPhoneNumber());
                    toDisplay += r.getPhoneNumber();
                    toDisplay += "\n";
                }
                Toast.makeText(getBaseContext(), toDisplay, Toast.LENGTH_SHORT).show();
                // add handling for no-routes found case

                // assignment should be done immediately... on the first resource found?

                // create room here and navigate accordingly away

                // current implementation opens itself up to race conditions tho unlikely

            } else {
                // add handling if there are issues with querying
                Log.i(TAG, "Error querying routes");
            }
        }
    });
}

v1 0 0-room-route-query-proof-of-concept

henrylao commented 3 years ago

Version 2

squad-house-room-activity-prototype