ios: Add iCloud capability

I cannot see the GitJournal app's data in my iCloud, but I believe maybe
my app needs to go through the app review process.
This commit is contained in:
Vishesh Handa
2020-10-19 18:18:42 +02:00
parent 98c92a3fe1
commit 9f53115616
10 changed files with 68 additions and 6 deletions

View File

@ -135,6 +135,7 @@ settings:
title: Storage
fileName: Filename
useLocal: Store Repo Internally
icloud: Store in iCloud
repoLocation: Repo Location
drawer:
title: Sidebar Settings

View File

@ -120,6 +120,8 @@ PODS:
- GoogleUtilities/Logger
- GoogleUtilities/UserDefaults (6.7.2):
- GoogleUtilities/Logger
- icloud_documents_path (0.0.1):
- Flutter
- image_picker (0.0.1):
- Flutter
- in_app_purchase (0.0.1):
@ -172,6 +174,7 @@ DEPENDENCIES:
- flutter_email_sender (from `.symlinks/plugins/flutter_email_sender/ios`)
- flutter_sentry (from `.symlinks/plugins/flutter_sentry/ios`)
- flutter_webview_plugin (from `.symlinks/plugins/flutter_webview_plugin/ios`)
- icloud_documents_path (from `.symlinks/plugins/icloud_documents_path/ios`)
- image_picker (from `.symlinks/plugins/image_picker/ios`)
- in_app_purchase (from `.symlinks/plugins/in_app_purchase/ios`)
- launch_review (from `.symlinks/plugins/launch_review/ios`)
@ -229,6 +232,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/flutter_sentry/ios"
flutter_webview_plugin:
:path: ".symlinks/plugins/flutter_webview_plugin/ios"
icloud_documents_path:
:path: ".symlinks/plugins/icloud_documents_path/ios"
image_picker:
:path: ".symlinks/plugins/image_picker/ios"
in_app_purchase:
@ -278,6 +283,7 @@ SPEC CHECKSUMS:
GoogleAppMeasurement: 67458367830514fb20fd9e233496f1eef9d90185
GoogleDataTransport: 672fb0ce96fe7f7f31d43672fca62ad2c9c86f7b
GoogleUtilities: 7f2f5a07f888cdb145101d6042bc4422f57e70b3
icloud_documents_path: 11c858abe03d6900cacce4ef86267f527c89ab7d
image_picker: 66aa71bc96850a90590a35d4c4a2907b0d823109
in_app_purchase: 3e2155afa9d03d4fa32d9e62d567885080ce97d6
launch_review: 75d5a956ba8eaa493e9c9d4bf4c05e505e8d5ed0

View File

@ -45,6 +45,7 @@
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
7A0DAA2D2475DD8D00C0E570 /* StoreKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = StoreKit.framework; path = System/Library/Frameworks/StoreKit.framework; sourceTree = SDKROOT; };
7A24F7D5253B512A009E06F7 /* Runner.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Runner.entitlements; sourceTree = "<group>"; };
7A2A0C18229C2E3300FE4F1B /* libssl.framework */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libssl.framework; path = libs/libssl.framework; sourceTree = "<group>"; };
7A2A0C19229C2E3300FE4F1B /* libcrypto.framework */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libcrypto.framework; path = libs/libcrypto.framework; sourceTree = "<group>"; };
7A2A0C1C229FEA4500FE4F1B /* libgit2.framework */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libgit2.framework; path = libs/libgit2.framework; sourceTree = "<group>"; };
@ -148,6 +149,7 @@
97C146F01CF9000F007C117D /* Runner */ = {
isa = PBXGroup;
children = (
7A24F7D5253B512A009E06F7 /* Runner.entitlements */,
7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */,
7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */,
97C146FA1CF9000F007C117D /* Main.storyboard */,
@ -340,6 +342,7 @@
"${BUILT_PRODUCTS_DIR}/file_picker/file_picker.framework",
"${BUILT_PRODUCTS_DIR}/flutter_email_sender/flutter_email_sender.framework",
"${BUILT_PRODUCTS_DIR}/flutter_webview_plugin/flutter_webview_plugin.framework",
"${BUILT_PRODUCTS_DIR}/icloud_documents_path/icloud_documents_path.framework",
"${BUILT_PRODUCTS_DIR}/image_picker/image_picker.framework",
"${BUILT_PRODUCTS_DIR}/in_app_purchase/in_app_purchase.framework",
"${BUILT_PRODUCTS_DIR}/launch_review/launch_review.framework",
@ -372,6 +375,7 @@
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/file_picker.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_email_sender.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_webview_plugin.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/icloud_documents_path.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/image_picker.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/in_app_purchase.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/launch_review.framework",
@ -540,6 +544,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
@ -575,6 +580,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";

View File

@ -2,6 +2,18 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSUbiquitousContainers</key>
<dict>
<key>iCloud.io.gitjournal.gitjournal</key>
<dict>
<key>NSUbiquitousContainerSupportedFolderLevels</key>
<string>Any</string>
<key>NSUbiquitousContainerName</key>
<string>GitJournal</string>
<key>NSUbiquitousContainerIsDocumentScopePublic</key>
<true/>
</dict>
</dict>
<key>LSSupportsOpeningDocumentsInPlace</key>
<true/>
<key>UIFileSharingEnabled</key>

View File

@ -10,6 +10,7 @@ import 'package:dynamic_theme/dynamic_theme.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:easy_localization_loader/easy_localization_loader.dart';
import 'package:flutter_sentry/flutter_sentry.dart';
import 'package:icloud_documents_path/icloud_documents_path.dart';
import 'package:package_info/package_info.dart';
import 'package:path_provider/path_provider.dart';
import 'package:provider/provider.dart';
@ -25,19 +26,19 @@ import 'package:gitjournal/iap.dart';
import 'package:gitjournal/screens/filesystem_screen.dart';
import 'package:gitjournal/screens/folder_listing.dart';
import 'package:gitjournal/screens/graph_view.dart';
import 'package:gitjournal/screens/home_screen.dart';
import 'package:gitjournal/screens/note_editor.dart';
import 'package:gitjournal/screens/onboarding_screens.dart';
import 'package:gitjournal/screens/purchase_screen.dart';
import 'package:gitjournal/screens/purchase_thankyou_screen.dart';
import 'package:gitjournal/screens/settings_screen.dart';
import 'package:gitjournal/screens/tag_listing.dart';
import 'package:gitjournal/settings.dart';
import 'package:gitjournal/setup/screens.dart';
import 'package:gitjournal/state_container.dart';
import 'package:gitjournal/themes.dart';
import 'package:gitjournal/utils.dart';
import 'package:gitjournal/utils/logger.dart';
import 'screens/home_screen.dart';
import 'screens/onboarding_screens.dart';
import 'screens/settings_screen.dart';
import 'setup/screens.dart';
class JournalApp extends StatefulWidget {
final AppState appState;

View File

@ -6,6 +6,7 @@ import 'package:dynamic_theme/dynamic_theme.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:ext_storage/ext_storage.dart';
import 'package:filesystem_picker/filesystem_picker.dart';
import 'package:icloud_documents_path/icloud_documents_path.dart';
import 'package:path/path.dart' as p;
import 'package:permission_handler/permission_handler.dart';
import 'package:provider/provider.dart';
@ -351,6 +352,27 @@ class SettingsListState extends State<SettingsList> {
subtitle: Text(settings.storageLocation),
enabled: !settings.storeInternally,
),
if (Platform.isIOS)
SwitchListTile(
title: Text(tr('settings.storage.icloud')),
value: !settings.storeInternally,
onChanged: (bool newVal) async {
if (newVal == false) {
settings.storeInternally = true;
settings.storageLocation = "";
} else {
settings.storageLocation =
await ICloudDocumentsPath.documentsPath;
if (settings.storageLocation.isNotEmpty) {
settings.storeInternally = false;
}
}
settings.save();
stateContainer.moveRepoToPath();
setState(() {});
},
),
ListTile(
title: Text(tr('settings.misc.title')),
onTap: () {

View File

@ -361,6 +361,8 @@ class StateContainer with ChangeNotifier {
repoPath = newRepoPath;
appState.notesFolder.reset(repoPath);
notifyListeners();
_loadNotes();
}
}
}

View File

@ -438,7 +438,7 @@ packages:
name: git_bindings
url: "https://pub.dartlang.org"
source: hosted
version: "0.0.15"
version: "0.0.16"
git_url_parse2:
dependency: "direct main"
description:
@ -481,6 +481,15 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "3.1.3"
icloud_documents_path:
dependency: "direct main"
description:
path: "."
ref: HEAD
resolved-ref: "3fcefd4ba6c1897da1d3a67608dd30eeaa71a9b8"
url: "https://github.com/GitJournal/icloud_documents_path.git"
source: git
version: "0.0.1"
image:
dependency: transitive
description:
@ -1155,4 +1164,4 @@ packages:
version: "0.0.9"
sdks:
dart: ">=2.10.0-110 <2.11.0"
flutter: ">=1.17.0 <2.0.0"
flutter: ">=1.20.0 <2.0.0"

View File

@ -62,6 +62,8 @@ dependencies:
filesystem_picker: ^1.0.3 # for directories
permission_handler: ^5.0.1+1
ext_storage: ^1.0.3
icloud_documents_path:
git: https://github.com/GitJournal/icloud_documents_path.git
dev_dependencies:
flutter_launcher_icons: "^0.7.2"

View File

@ -14,6 +14,7 @@ cd ../
if [[ $(git status -s | grep -v '??') ]]; then
echo "Uncommitted Changes."
echo "Exiting"
git status
exit 1
fi