Skip to content

Commit

Permalink
something fixed..uploading is working now
Browse files Browse the repository at this point in the history
  • Loading branch information
Desync-o-tron committed Sep 17, 2024
1 parent a7b3c27 commit 6ad1bfb
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 35 deletions.
3 changes: 3 additions & 0 deletions ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
Expand Down Expand Up @@ -561,6 +562,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
Expand Down Expand Up @@ -616,6 +618,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
Expand Down
2 changes: 0 additions & 2 deletions lib/cloud_io/firestore_sync.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import 'dart:async';

import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:open_fitness_tracker/DOM/training_metadata.dart';
Expand All @@ -18,7 +17,6 @@ class MyStorage {
CollectionReference users = firestore.collection('users');
DocumentReference userDoc = users.doc(FirebaseAuth.instance.currentUser!.uid);
await userDoc.collection(historyKey).add(session.toJson());
print("geh");
} catch (e) {
print("Error adding session to history: $e");
}
Expand Down
3 changes: 1 addition & 2 deletions lib/history/history_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import 'package:open_fitness_tracker/cloud_io/firestore_sync.dart';
import 'package:open_fitness_tracker/common/common_widgets.dart';
import 'package:open_fitness_tracker/history/import_training_dialog.dart';
import 'package:open_fitness_tracker/utils/utils.dart';
import 'package:cloud_firestore/cloud_firestore.dart';

//todo when new history syncs in, the page needs to be updated to reflect the new data!
// we should be listening to state changes on firebase
Expand Down Expand Up @@ -117,7 +116,7 @@ class _HistoryPageState extends State<HistoryPage> {
width: 300,
height: 300,
decoration: BoxDecoration(color: Colors.blue[300]),
child: CircularProgressIndicator(),
child: const CircularProgressIndicator(),
));
} else {
return Container();
Expand Down
62 changes: 31 additions & 31 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,40 +40,40 @@ class MyApp extends StatefulWidget {
}

class _MyAppState extends State<MyApp> {
_myAsyncMethod() async {
var ff = FirebaseFirestore.instance;
final user = <String, dynamic>{"first": "Adaa", "last": "Lovelace", "born": 1815};
await ff.collection("users").get().then((event) {
for (var doc in event.docs) {
print("${doc.id} => ${doc.data()}");
}
});
// Add a new document with a generated ID
ff
.collection("users")
.add(user)
.then((DocumentReference doc) => print('DocumentSnapshot added with ID: ${doc.id}'));
// _myAsyncMethod() async {
// var ff = FirebaseFirestore.instance;
// final user = <String, dynamic>{"first": "hmm!", "last": "Lovelace", "born": 1815};
// // await ff.collection("users").get().then((event) {
// // for (var doc in event.docs) {
// // print("${doc.id} => ${doc.data()}");
// // }
// // });
// // Add a new document with a generated ID
// ff
// .collection("users")
// .add(user)
// .then((DocumentReference doc) => print('DocumentSnapshot added with ID: ${doc.id}'));

var usrCollection = ff.collection('users');
var athing = await usrCollection.get();
// var usrCollection = ff.collection('users');
// // var athing = await usrCollection.get();

// await usrCollection.add({"aoeu": "sth"});
var usrdoc = usrCollection.doc("0qYo6ihSKsh8s6dsLksQ2N6WLek2");
await usrdoc.set({"buttt": "stuff"}); //, SetOptions());
try {
var newcol = usrdoc.collection("newcol");
await newcol.add({"akey": "aval"});
} catch (e) {
print('crap');
}
print("object");
}
// // await usrCollection.add({"aoeu": "sth"});
// var usrdoc = usrCollection.doc("0qYo6ihSKsh8s6dsLksQ2N6WLek2");
// await usrdoc.set({"buttttX new": "stuff"}); //, SetOptions());
// try {
// var newcol = usrdoc.collection("newcol");
// await newcol.add({"akey": "aval"});
// } catch (e) {
// print('crap');
// }
// print("object");
// }

@override
void initState() {
super.initState();
_myAsyncMethod();
}
// @override
// void initState() {
// super.initState();
// _myAsyncMethod();
// }

@override
Widget build(BuildContext context) {
Expand Down

0 comments on commit 6ad1bfb

Please sign in to comment.