Skip to content

Commit 183e976

Browse files
committed
merged with theirs
2 parents 86abcd6 + a8dad3c commit 183e976

25 files changed

+819
-113
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Space_Mapper/android/key.properties
1616
.buildlog/
1717
.history
1818
.svn/
19+
.fvm/
1920

2021
# IntelliJ related
2122
*.iml
@@ -119,3 +120,5 @@ app.*.symbols
119120
!/dev/ci/**/Gemfile.lock
120121
Space_Mapper/android/app/space_mapper.keystore
121122
Space_Mapper/space_mapper.keystore
123+
Space_Mapper/.fvm/flutter_sdk
124+
Space_Mapper/.fvm/fvm_config.json

Space_Mapper/.fvm/flutter_sdk

Lines changed: 0 additions & 1 deletion
This file was deleted.

Space_Mapper/.fvm/fvm_config.json

Lines changed: 0 additions & 4 deletions
This file was deleted.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>NSPrivacyTracking</key>
6+
<false/>
7+
8+
<key>NSPrivacyAccessedAPITypes</key>
9+
<array>
10+
<!-- [1] background_fetch: UserDefaults -->
11+
<dict>
12+
<key>NSPrivacyAccessedAPIType</key>
13+
<string>NSPrivacyAccessedAPICategoryUserDefaults</string>
14+
15+
<key>NSPrivacyAccessedAPITypeReasons</key>
16+
<array>
17+
<string>CA92.1</string>
18+
</array>
19+
</dict>
20+
</array>
21+
</dict>
22+
</plist>

Space_Mapper/ios/Runner.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,12 +231,14 @@
231231
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh",
232232
"${BUILT_PRODUCTS_DIR}/CocoaLumberjack/CocoaLumberjack.framework",
233233
"${BUILT_PRODUCTS_DIR}/FMDB/FMDB.framework",
234+
"${BUILT_PRODUCTS_DIR}/MTBBarcodeScanner/MTBBarcodeScanner.framework",
234235
"${BUILT_PRODUCTS_DIR}/background_fetch/background_fetch.framework",
235236
"${BUILT_PRODUCTS_DIR}/fast_rsa/fast_rsa.framework",
236237
"${BUILT_PRODUCTS_DIR}/geocoding_ios/geocoding_ios.framework",
237238
"${BUILT_PRODUCTS_DIR}/integration_test/integration_test.framework",
238239
"${BUILT_PRODUCTS_DIR}/package_info_plus/package_info_plus.framework",
239240
"${BUILT_PRODUCTS_DIR}/path_provider_foundation/path_provider_foundation.framework",
241+
"${BUILT_PRODUCTS_DIR}/qr_code_scanner/qr_code_scanner.framework",
240242
"${BUILT_PRODUCTS_DIR}/share/share.framework",
241243
"${BUILT_PRODUCTS_DIR}/shared_preferences_foundation/shared_preferences_foundation.framework",
242244
"${BUILT_PRODUCTS_DIR}/sqflite/sqflite.framework",
@@ -247,12 +249,14 @@
247249
outputPaths = (
248250
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CocoaLumberjack.framework",
249251
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FMDB.framework",
252+
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MTBBarcodeScanner.framework",
250253
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/background_fetch.framework",
251254
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/fast_rsa.framework",
252255
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/geocoding_ios.framework",
253256
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/integration_test.framework",
254257
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/package_info_plus.framework",
255258
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/path_provider_foundation.framework",
259+
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/qr_code_scanner.framework",
256260
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/share.framework",
257261
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/shared_preferences_foundation.framework",
258262
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/sqflite.framework",

Space_Mapper/ios/Runner.xcworkspace/contents.xcworkspacedata

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Space_Mapper/ios/Runner/Info.plist

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,20 @@
55
<key>BGTaskSchedulerPermittedIdentifiers</key>
66
<array>
77
<string>com.transistorsoft.fetch</string>
8+
<string>com.transistorsoft.spacemapper</string>
89
</array>
910
<key>CADisableMinimumFrameDurationOnPhone</key>
1011
<true/>
1112
<key>CFBundleDevelopmentRegion</key>
1213
<string>$(DEVELOPMENT_LANGUAGE)</string>
14+
<key>CFBundleDisplayName</key>
15+
<string>Space Mapper</string>
1316
<key>CFBundleExecutable</key>
1417
<string>$(EXECUTABLE_NAME)</string>
1518
<key>CFBundleIdentifier</key>
1619
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
1720
<key>CFBundleInfoDictionaryVersion</key>
1821
<string>6.0</string>
19-
<key>CFBundleDisplayName</key>
20-
<string>Space Mapper</string>
2122
<key>CFBundleName</key>
2223
<string>Space Mapper</string>
2324
<key>CFBundlePackageType</key>

Space_Mapper/lang/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"side_drawer_title": "Space Mapper Menu",
33
"participate_in_a_project": "Participate in a project",
44
"active_projects": "Active Projects",
5+
"new_project": "New Project",
56
"locations_history": "Locations History",
67
"share_locations": "Share Locations",
78
"visit_project_website": "Visit Project Website",

Space_Mapper/lang/es.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"side_drawer_title": "Menú de Space Mapper",
33
"participate_in_a_project": "Participe en un proyecto",
44
"active_projects": "Activo Proyecto",
5+
"new_project": "Nuevo Proyecto",
56
"locations_history": "Historial de ubicaciones",
67
"share_locations": "Compartir ubicaciones",
78
"visit_project_website": "Visita nuestra web",

Space_Mapper/lib/db/database_project.dart

Lines changed: 118 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import '../external_projects/tiger_in_car/models/participating_projects.dart';
2+
import '../external_projects/tiger_in_car/models/project_list.dart';
23

34
import 'package:path/path.dart';
45
import 'package:sqflite/sqflite.dart';
@@ -22,7 +23,8 @@ class ProjectDatabase {
2223
final dbPath = await getDatabasesPath();
2324
final path = join(dbPath, filePath);
2425

25-
return await openDatabase(path, version: 1, onCreate: _createDB);
26+
return await openDatabase(path, version: 2, onCreate: _createDB, onUpgrade: _onUpgrade);
27+
//return await openDatabase(path, version: 1, onCreate: _createDB);
2628
}
2729

2830
Future _createDB(Database db, int version) async {
@@ -47,9 +49,44 @@ class ProjectDatabase {
4749
${ProjectFields.locationSharingMethod} $intType,
4850
${ProjectFields.surveyElementCode} $stringType
4951
)
52+
''');
53+
54+
await db.execute('''
55+
CREATE TABLE $tableProjectList (
56+
${ProjectListFields.projectId} $idType,
57+
${ProjectListFields.projectName} $stringType,
58+
${ProjectListFields.projectDescription} $stringType,
59+
${ProjectListFields.externalLink} $NullstringType,
60+
${ProjectListFields.internalLink} $NullstringType,
61+
${ProjectListFields.projectImageLocation} $stringType,
62+
${ProjectListFields.locationSharingMethod} INTEGER NOT NULL,
63+
${ProjectListFields.surveyElementCode} $stringType,
64+
${ProjectListFields.projectURL} $stringType
65+
)
5066
''');
5167
}
5268

69+
Future _onUpgrade(Database db, int oldVersion, int newVersion) async {
70+
if (oldVersion < 2) {
71+
72+
final NullstringType = 'STRING';
73+
await db.execute('''
74+
CREATE TABLE $tableProjectList (
75+
${ProjectListFields.projectId} INTEGER PRIMARY KEY AUTOINCREMENT,
76+
${ProjectListFields.projectName} STRING NOT NULL,
77+
${ProjectListFields.projectDescription} STRING NOT NULL,
78+
${ProjectListFields.externalLink} $NullstringType,
79+
${ProjectListFields.internalLink} $NullstringType,
80+
${ProjectListFields.projectImageLocation} STRING NOT NULL,
81+
${ProjectListFields.locationSharingMethod} INTEGER NOT NULL,
82+
${ProjectListFields.surveyElementCode} STRING NOT NULL,
83+
${ProjectListFields.projectURL} STRING NOT NULL
84+
)
85+
''');
86+
}
87+
88+
}
89+
//Procedures for projects user has joined
5390
Future<Particpating_Project> createProject(Particpating_Project project) async {
5491
final db = await instance.database;
5592

@@ -87,6 +124,8 @@ class ProjectDatabase {
87124
}
88125
}
89126

127+
128+
90129
Future<List<Particpating_Project>> getOngoingProjects() async {
91130
final db = await instance.database;
92131

@@ -177,5 +216,83 @@ final db = await instance.database;
177216
whereArgs: [id]);
178217
}
179218

219+
220+
//List of projects user has loaded onto their phone
221+
222+
Future<ProjectList> createNewProject(ProjectList project) async {
223+
final db = await instance.database;
224+
print("It made it into createProject");
225+
final id = await db.insert(tableProjectList, project.toJson());
226+
return project.copy(projectId: id);
227+
}
228+
229+
Future<ProjectList> RetrieveProject(int id) async {
230+
final db = await instance.database;
231+
final maps = await db.query(
232+
tableProjectList,
233+
columns: ProjectListFields.values,
234+
where: '${ProjectListFields.projectId} = ?',
235+
whereArgs: [id],
236+
);
237+
238+
if (maps.isNotEmpty) {
239+
return ProjectList.fromJson(maps.first);
240+
} else {
241+
throw Exception('Project ID $id not found');
242+
}
243+
}
244+
245+
Future<ProjectList> RetrieveProjectbyURL(String URL) async {
246+
final db = await instance.database;
247+
final maps = await db.query(
248+
tableProjectList,
249+
columns: ProjectListFields.values,
250+
where: '${ProjectListFields.projectURL} = ?',
251+
whereArgs: [URL],
252+
);
253+
254+
if (maps.isNotEmpty) {
255+
return ProjectList.fromJson(maps.first);
256+
} else {
257+
return ProjectList(
258+
projectId: -1,
259+
projectName: '-1',
260+
projectDescription: '-1',
261+
externalLink: '-1',
262+
internalLink: '-1',
263+
projectImageLocation: '-1',
264+
locationSharingMethod: -1,
265+
surveyElementCode: '-1',
266+
);
267+
}
268+
}
269+
270+
Future<List<ProjectList>> FetchAllProjects() async {
271+
final db = await instance.database;
272+
final result = await db.query(tableProjectList);
273+
return result.map((json) => ProjectList.fromJson(json)).toList();
274+
}
275+
276+
Future<int> updateProjectList(ProjectList project) async {
277+
final db = await instance.database;
278+
return db.update(
279+
tableProjectList,
280+
project.toJson(),
281+
where: '${ProjectListFields.projectId} = ?',
282+
whereArgs: [project.projectId],
283+
);
284+
}
285+
286+
Future<int> deleteProjectList(int id) async {
287+
final db = await instance.database;
288+
return await db.delete(
289+
tableProjectList,
290+
where: '${ProjectListFields.projectId} = ?',
291+
whereArgs: [id],
292+
);
293+
}
294+
295+
296+
180297
}
181298

0 commit comments

Comments
 (0)