Skip to content

Commit

Permalink
1.6.5. - Backup & Restore data (#120)
Browse files Browse the repository at this point in the history
* removing migration code

* updating injectable generated code

* adding backup ability

* fixing UI unresponsiveness

* updating backup list layout

* first cut of restoring data

* fixing sharing on ios. adding loading indicator when restoring

* progress on fixing an issue with updating playthroughs

* fixing a lot of code to work with mobx rather than provider

* dunno anymore

* ?

* fixing issues with scores not updating when navigating back to the history

* updating TODOs

* fixing backup sharing on ios

* fixing issues with stoping playthrough

* progress on refreshing hive after restore

* fixing user store and completing restore/backup

* copy and slidable adjustments
  • Loading branch information
mkieres authored Sep 21, 2022
1 parent 65e2037 commit 7b2e27e
Show file tree
Hide file tree
Showing 77 changed files with 4,037 additions and 1,262 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</intent>
</queries>

<application android:name="${applicationName}" android:label="Board Games Companion" android:icon="@mipmap/ic_launcher">
<application android:name="${applicationName}" android:label="Board Games Companion" android:icon="@mipmap/ic_launcher" android:allowBackup="false">
<activity android:name=".MainActivity" android:launchMode="singleTop" android:theme="@style/LaunchTheme" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode" android:hardwareAccelerated="true" android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
Expand Down
56 changes: 56 additions & 0 deletions board_games_companion/ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,4 +1,38 @@
PODS:
- DKImagePickerController/Core (4.3.4):
- DKImagePickerController/ImageDataManager
- DKImagePickerController/Resource
- DKImagePickerController/ImageDataManager (4.3.4)
- DKImagePickerController/PhotoGallery (4.3.4):
- DKImagePickerController/Core
- DKPhotoGallery
- DKImagePickerController/Resource (4.3.4)
- DKPhotoGallery (0.0.17):
- DKPhotoGallery/Core (= 0.0.17)
- DKPhotoGallery/Model (= 0.0.17)
- DKPhotoGallery/Preview (= 0.0.17)
- DKPhotoGallery/Resource (= 0.0.17)
- SDWebImage
- SwiftyGif
- DKPhotoGallery/Core (0.0.17):
- DKPhotoGallery/Model
- DKPhotoGallery/Preview
- SDWebImage
- SwiftyGif
- DKPhotoGallery/Model (0.0.17):
- SDWebImage
- SwiftyGif
- DKPhotoGallery/Preview (0.0.17):
- DKPhotoGallery/Model
- DKPhotoGallery/Resource
- SDWebImage
- SwiftyGif
- DKPhotoGallery/Resource (0.0.17):
- SDWebImage
- SwiftyGif
- file_picker (0.0.1):
- DKImagePickerController/PhotoGallery
- Flutter
- Firebase/Analytics (9.2.0):
- Firebase/Core
- Firebase/Core (9.2.0):
Expand Down Expand Up @@ -123,13 +157,20 @@ PODS:
- path_provider_ios (0.0.1):
- Flutter
- PromisesObjC (2.1.1)
- SDWebImage (5.13.2):
- SDWebImage/Core (= 5.13.2)
- SDWebImage/Core (5.13.2)
- share_plus (0.0.1):
- Flutter
- sqflite (0.0.2):
- Flutter
- FMDB (>= 2.7.5)
- SwiftyGif (5.4.3)
- url_launcher_ios (0.0.1):
- Flutter

DEPENDENCIES:
- file_picker (from `.symlinks/plugins/file_picker/ios`)
- firebase_analytics (from `.symlinks/plugins/firebase_analytics/ios`)
- firebase_core (from `.symlinks/plugins/firebase_core/ios`)
- firebase_crashlytics (from `.symlinks/plugins/firebase_crashlytics/ios`)
Expand All @@ -138,11 +179,14 @@ DEPENDENCIES:
- in_app_review (from `.symlinks/plugins/in_app_review/ios`)
- package_info (from `.symlinks/plugins/package_info/ios`)
- path_provider_ios (from `.symlinks/plugins/path_provider_ios/ios`)
- share_plus (from `.symlinks/plugins/share_plus/ios`)
- sqflite (from `.symlinks/plugins/sqflite/ios`)
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)

SPEC REPOS:
trunk:
- DKImagePickerController
- DKPhotoGallery
- Firebase
- FirebaseAnalytics
- FirebaseCore
Expand All @@ -156,8 +200,12 @@ SPEC REPOS:
- GoogleUtilities
- nanopb
- PromisesObjC
- SDWebImage
- SwiftyGif

EXTERNAL SOURCES:
file_picker:
:path: ".symlinks/plugins/file_picker/ios"
firebase_analytics:
:path: ".symlinks/plugins/firebase_analytics/ios"
firebase_core:
Expand All @@ -174,12 +222,17 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/package_info/ios"
path_provider_ios:
:path: ".symlinks/plugins/path_provider_ios/ios"
share_plus:
:path: ".symlinks/plugins/share_plus/ios"
sqflite:
:path: ".symlinks/plugins/sqflite/ios"
url_launcher_ios:
:path: ".symlinks/plugins/url_launcher_ios/ios"

SPEC CHECKSUMS:
DKImagePickerController: b512c28220a2b8ac7419f21c491fc8534b7601ac
DKPhotoGallery: fdfad5125a9fdda9cc57df834d49df790dbb4179
file_picker: 817ab1d8cd2da9d2da412a417162deee3500fc95
Firebase: 4ba896cb8e5105d4b9e247e1c1b6222b548df55a
firebase_analytics: 4e55c4e99e2b914449eb890c13897194a8c0b5f0
firebase_core: ada8be870601fe3c2684dae2356f634189bd598f
Expand All @@ -201,7 +254,10 @@ SPEC CHECKSUMS:
package_info: 873975fc26034f0b863a300ad47e7f1ac6c7ec62
path_provider_ios: 14f3d2fd28c4fdb42f44e0f751d12861c43cee02
PromisesObjC: ab77feca74fa2823e7af4249b8326368e61014cb
SDWebImage: 72f86271a6f3139cc7e4a89220946489d4b9a866
share_plus: 056a1e8ac890df3e33cb503afffaf1e9b4fbae68
sqflite: 6d358c025f5b867b29ed92fc697fd34924e11904
SwiftyGif: 6c3eafd0ce693cad58bb63d2b2fb9bacb8552780
url_launcher_ios: 839c58cdb4279282219f5e248c3321761ff3c4de

PODFILE CHECKSUM: b259ee2cff80e9e247a66f9310d20a4efd32c397
Expand Down
12 changes: 12 additions & 0 deletions board_games_companion/ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,8 @@
);
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh",
"${BUILT_PRODUCTS_DIR}/DKImagePickerController/DKImagePickerController.framework",
"${BUILT_PRODUCTS_DIR}/DKPhotoGallery/DKPhotoGallery.framework",
"${BUILT_PRODUCTS_DIR}/FMDB/FMDB.framework",
"${BUILT_PRODUCTS_DIR}/FirebaseCore/FirebaseCore.framework",
"${BUILT_PRODUCTS_DIR}/FirebaseCoreDiagnostics/FirebaseCoreDiagnostics.framework",
Expand All @@ -230,16 +232,22 @@
"${BUILT_PRODUCTS_DIR}/GoogleDataTransport/GoogleDataTransport.framework",
"${BUILT_PRODUCTS_DIR}/GoogleUtilities/GoogleUtilities.framework",
"${BUILT_PRODUCTS_DIR}/PromisesObjC/FBLPromises.framework",
"${BUILT_PRODUCTS_DIR}/SDWebImage/SDWebImage.framework",
"${BUILT_PRODUCTS_DIR}/SwiftyGif/SwiftyGif.framework",
"${BUILT_PRODUCTS_DIR}/file_picker/file_picker.framework",
"${BUILT_PRODUCTS_DIR}/image_picker_ios/image_picker_ios.framework",
"${BUILT_PRODUCTS_DIR}/in_app_review/in_app_review.framework",
"${BUILT_PRODUCTS_DIR}/nanopb/nanopb.framework",
"${BUILT_PRODUCTS_DIR}/package_info/package_info.framework",
"${BUILT_PRODUCTS_DIR}/path_provider_ios/path_provider_ios.framework",
"${BUILT_PRODUCTS_DIR}/share_plus/share_plus.framework",
"${BUILT_PRODUCTS_DIR}/sqflite/sqflite.framework",
"${BUILT_PRODUCTS_DIR}/url_launcher_ios/url_launcher_ios.framework",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/DKImagePickerController.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/DKPhotoGallery.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FMDB.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FirebaseCore.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FirebaseCoreDiagnostics.framework",
Expand All @@ -249,11 +257,15 @@
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/GoogleDataTransport.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/GoogleUtilities.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FBLPromises.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SDWebImage.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SwiftyGif.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/file_picker.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/image_picker_ios.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/in_app_review.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/nanopb.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/package_info.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/path_provider_ios.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/share_plus.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/sqflite.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/url_launcher_ios.framework",
);
Expand Down
19 changes: 10 additions & 9 deletions board_games_companion/lib/app.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:board_games_companion/pages/games/games_view_model.dart';
import 'package:board_games_companion/pages/settings/settings_view_model.dart';
import 'package:firebase_analytics/observer.dart';
import 'package:flutter/material.dart';

Expand All @@ -24,7 +25,6 @@ import 'services/analytics_service.dart';
import 'services/preferences_service.dart';
import 'services/rate_and_review_service.dart';
import 'stores/board_games_filters_store.dart';
import 'stores/playthroughs_store.dart';
import 'utilities/analytics_route_observer.dart';

class BoardGamesCompanionApp extends StatefulWidget {
Expand Down Expand Up @@ -116,25 +116,26 @@ class BoardGamesCompanionAppState extends State<BoardGamesCompanionApp> {
builder: (BuildContext context) => PlaythroughsPage(viewModel: viewModel),
);

case EditPlaythoughPage.pageRoute:
case EditPlaythroughPage.pageRoute:
final arguments = routeSettings.arguments as EditPlaythroughPageArguments;

// MK Need to create view model manually (i.e. without DI) because the passed in playthroughViewModel
// needs to be exactly the same as the one on the history page to ensure it's updated once navigated back
final viewModel =
EditPlaythoughViewModel(arguments.playthroughViewModel, getIt<PlaythroughsStore>());
final viewModel = getIt<EditPlaythoughViewModel>();
viewModel.setPlaythroughId(arguments.playthroughId);

return MaterialPageRoute<dynamic>(
settings: routeSettings,
builder: (BuildContext context) => EditPlaythoughPage(viewModel: viewModel));
builder: (BuildContext context) => EditPlaythroughPage(viewModel: viewModel));

case AboutPage.pageRoute:
return MaterialPageRoute<dynamic>(
settings: routeSettings, builder: (BuildContext context) => const AboutPage());

case SettingsPage.pageRoute:
final viewModel = getIt<SettingsViewModel>();

return MaterialPageRoute<dynamic>(
settings: routeSettings, builder: (BuildContext context) => const SettingsPage());
settings: routeSettings,
builder: (BuildContext context) => SettingsPage(viewModel: viewModel),
);

default:
return null;
Expand Down
7 changes: 7 additions & 0 deletions board_games_companion/lib/common/app_text.dart
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,13 @@ class AppText {
'Games imported from the BGG collections are missing some details (e.g. complexity or expansions). Refresh the data to get the latest information.';
static const gamesPageSearchResultExpansionsSectionTitleFormat = 'Expansions (%i)';

static const settingsPageBackupAndRestoreSectionBody =
"Backup app's data to a *.zip archive in case you want to migrate your data to a new/other device.";
static const settingsPageBackupAndRestoreSectionTitle = 'Backup & Restore';
static const settingsPageBackupButtonText = 'Backup';
static const settingsPageRestireButtonText = 'Restore';
static const settingsPageBackupsListTitle = 'Backups';

static const gamePlaytimeFormat = '%s min';
static const gamePlayersSingularFormat = '%i players';
static const gamePlayersPluralFormat = '%i players';
Expand Down
2 changes: 2 additions & 0 deletions board_games_companion/lib/common/constants.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ class Constants {
static const shortMonthDateFormat = 'MMM';
static const shortWeekDayDateFormat = 'E';

static const appDataBackupDateFormat = 'y-MM-dd HH:mm:ss';

static const top100 = 100;
static const double boardGameDetailsImageHeight = 300;

Expand Down
22 changes: 21 additions & 1 deletion board_games_companion/lib/common/hive_boxes.dart
Original file line number Diff line number Diff line change
@@ -1,10 +1,30 @@
// ignore_for_file: avoid_classes_with_only_static_members

import 'package:board_games_companion/services/board_games_service.dart';
import 'package:board_games_companion/services/player_service.dart';
import 'package:board_games_companion/services/score_service.dart';
import 'package:board_games_companion/services/user_service.dart';

import '../services/board_games_filters_service.dart';
import '../services/playthroughs_service.dart';
import '../services/preferences_service.dart';

class HiveBoxes {
static Map<Type, String> boxesNamesMap = {
BoardGamesService: boardGames,
PlayerService: players,
UserService: user,
PlaythroughService: playthroughs,
ScoreService: scores,
BoardGamesFiltersService: collectionFilters,
PreferencesService: preferences,
};

static const boardGames = 'boardGames';
static const players = 'players';
static const user = 'user';
static const playthroughs = 'playthroughs';
static const scores = 'scores';
static const sortBy = 'sortBy';
static const collectionFilters = 'collectionFilters';
static const preferences = 'preferences';
static const dioCache = 'dioCache';
Expand Down
Loading

0 comments on commit 7b2e27e

Please sign in to comment.