-
Notifications
You must be signed in to change notification settings - Fork 440
store ios: Exclude the database file from iOS backup #2195
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,107 @@ | ||
| // Autogenerated from Pigeon (v26.1.7), do not edit directly. | ||
| // See also: https://pub.dev/packages/pigeon | ||
|
|
||
| import Foundation | ||
|
|
||
| #if os(iOS) | ||
| import Flutter | ||
| #elseif os(macOS) | ||
| import FlutterMacOS | ||
| #else | ||
| #error("Unsupported platform.") | ||
| #endif | ||
|
|
||
| private func wrapResult(_ result: Any?) -> [Any?] { | ||
| return [result] | ||
| } | ||
|
|
||
| private func wrapError(_ error: Any) -> [Any?] { | ||
| if let pigeonError = error as? PigeonError { | ||
| return [ | ||
| pigeonError.code, | ||
| pigeonError.message, | ||
| pigeonError.details, | ||
| ] | ||
| } | ||
| if let flutterError = error as? FlutterError { | ||
| return [ | ||
| flutterError.code, | ||
| flutterError.message, | ||
| flutterError.details, | ||
| ] | ||
| } | ||
| return [ | ||
| "\(error)", | ||
| "\(type(of: error))", | ||
| "Stacktrace: \(Thread.callStackSymbols)", | ||
| ] | ||
| } | ||
|
|
||
| private func isNullish(_ value: Any?) -> Bool { | ||
| return value is NSNull || value == nil | ||
| } | ||
|
|
||
| private func nilOrValue<T>(_ value: Any?) -> T? { | ||
| if value is NSNull { return nil } | ||
| return value as! T? | ||
| } | ||
|
|
||
|
|
||
| private class IosNativePigeonCodecReader: FlutterStandardReader { | ||
| } | ||
|
|
||
| private class IosNativePigeonCodecWriter: FlutterStandardWriter { | ||
| } | ||
|
|
||
| private class IosNativePigeonCodecReaderWriter: FlutterStandardReaderWriter { | ||
| override func reader(with data: Data) -> FlutterStandardReader { | ||
| return IosNativePigeonCodecReader(data: data) | ||
| } | ||
|
|
||
| override func writer(with data: NSMutableData) -> FlutterStandardWriter { | ||
| return IosNativePigeonCodecWriter(data: data) | ||
| } | ||
| } | ||
|
|
||
| class IosNativePigeonCodec: FlutterStandardMessageCodec, @unchecked Sendable { | ||
| static let shared = IosNativePigeonCodec(readerWriter: IosNativePigeonCodecReaderWriter()) | ||
| } | ||
|
|
||
| /// Generated protocol from Pigeon that represents a handler of messages from Flutter. | ||
| protocol IosNativeHostApi { | ||
| /// Sets UrlResourceValues.isExcludedFromBackup for the given file path. | ||
| /// | ||
| /// See doc: | ||
| /// https://developer.apple.com/documentation/foundation/urlresourcevalues/isexcludedfrombackup | ||
| /// https://developer.apple.com/documentation/foundation/optimizing-your-app-s-data-for-icloud-backup | ||
| func setExcludedFromBackup(filePath: String) throws | ||
| } | ||
|
|
||
| /// Generated setup class from Pigeon to handle messages through the `binaryMessenger`. | ||
| class IosNativeHostApiSetup { | ||
| static var codec: FlutterStandardMessageCodec { IosNativePigeonCodec.shared } | ||
| /// Sets up an instance of `IosNativeHostApi` to handle messages through the `binaryMessenger`. | ||
| static func setUp(binaryMessenger: FlutterBinaryMessenger, api: IosNativeHostApi?, messageChannelSuffix: String = "") { | ||
| let channelSuffix = messageChannelSuffix.count > 0 ? ".\(messageChannelSuffix)" : "" | ||
| /// Sets UrlResourceValues.isExcludedFromBackup for the given file path. | ||
| /// | ||
| /// See doc: | ||
| /// https://developer.apple.com/documentation/foundation/urlresourcevalues/isexcludedfrombackup | ||
| /// https://developer.apple.com/documentation/foundation/optimizing-your-app-s-data-for-icloud-backup | ||
| let setExcludedFromBackupChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.zulip.IosNativeHostApi.setExcludedFromBackup\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) | ||
| if let api = api { | ||
| setExcludedFromBackupChannel.setMessageHandler { message, reply in | ||
| let args = message as! [Any?] | ||
| let filePathArg = args[0] as! String | ||
| do { | ||
| try api.setExcludedFromBackup(filePath: filePathArg) | ||
| reply(wrapResult(nil)) | ||
| } catch { | ||
| reply(wrapError(error)) | ||
| } | ||
| } | ||
| } else { | ||
| setExcludedFromBackupChannel.setMessageHandler(nil) | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| // Autogenerated from Pigeon (v26.1.7), do not edit directly. | ||
| // See also: https://pub.dev/packages/pigeon | ||
| // ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, omit_obvious_local_variable_types, unused_shown_name, unnecessary_import, no_leading_underscores_for_local_identifiers | ||
|
|
||
| import 'dart:async'; | ||
| import 'dart:typed_data' show Float64List, Int32List, Int64List, Uint8List; | ||
|
|
||
| import 'package:flutter/foundation.dart' show ReadBuffer, WriteBuffer; | ||
| import 'package:flutter/services.dart'; | ||
|
|
||
| PlatformException _createConnectionError(String channelName) { | ||
| return PlatformException( | ||
| code: 'channel-error', | ||
| message: 'Unable to establish connection on channel: "$channelName".', | ||
| ); | ||
| } | ||
|
|
||
|
|
||
| class _PigeonCodec extends StandardMessageCodec { | ||
| const _PigeonCodec(); | ||
| @override | ||
| void writeValue(WriteBuffer buffer, Object? value) { | ||
| if (value is int) { | ||
| buffer.putUint8(4); | ||
| buffer.putInt64(value); | ||
| } else { | ||
| super.writeValue(buffer, value); | ||
| } | ||
| } | ||
|
|
||
| @override | ||
| Object? readValueOfType(int type, ReadBuffer buffer) { | ||
| switch (type) { | ||
| default: | ||
| return super.readValueOfType(type, buffer); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| class IosNativeHostApi { | ||
| /// Constructor for [IosNativeHostApi]. The [binaryMessenger] named argument is | ||
| /// available for dependency injection. If it is left null, the default | ||
| /// BinaryMessenger will be used which routes to the host platform. | ||
| IosNativeHostApi({BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) | ||
| : pigeonVar_binaryMessenger = binaryMessenger, | ||
| pigeonVar_messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; | ||
| final BinaryMessenger? pigeonVar_binaryMessenger; | ||
|
|
||
| static const MessageCodec<Object?> pigeonChannelCodec = _PigeonCodec(); | ||
|
|
||
| final String pigeonVar_messageChannelSuffix; | ||
|
|
||
| /// Sets UrlResourceValues.isExcludedFromBackup for the given file path. | ||
| /// | ||
| /// See doc: | ||
| /// https://developer.apple.com/documentation/foundation/urlresourcevalues/isexcludedfrombackup | ||
| /// https://developer.apple.com/documentation/foundation/optimizing-your-app-s-data-for-icloud-backup | ||
| Future<void> setExcludedFromBackup(String filePath) async { | ||
| final pigeonVar_channelName = 'dev.flutter.pigeon.zulip.IosNativeHostApi.setExcludedFromBackup$pigeonVar_messageChannelSuffix'; | ||
| final pigeonVar_channel = BasicMessageChannel<Object?>( | ||
| pigeonVar_channelName, | ||
| pigeonChannelCodec, | ||
| binaryMessenger: pigeonVar_binaryMessenger, | ||
| ); | ||
| final Future<Object?> pigeonVar_sendFuture = pigeonVar_channel.send(<Object?>[filePath]); | ||
| final pigeonVar_replyList = await pigeonVar_sendFuture as List<Object?>?; | ||
| if (pigeonVar_replyList == null) { | ||
| throw _createConnectionError(pigeonVar_channelName); | ||
| } else if (pigeonVar_replyList.length > 1) { | ||
| throw PlatformException( | ||
| code: pigeonVar_replyList[0]! as String, | ||
| message: pigeonVar_replyList[1] as String?, | ||
| details: pigeonVar_replyList[2], | ||
| ); | ||
| } else { | ||
| return; | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| import 'package:pigeon/pigeon.dart'; | ||
|
|
||
| // To rebuild this pigeon's output after editing this file, | ||
| // run `tools/check pigeon --fix`. | ||
| @ConfigurePigeon(PigeonOptions( | ||
| dartOut: 'lib/host/ios_native.g.dart', | ||
| swiftOut: 'ios/Runner/IosNative.g.swift', | ||
| swiftOptions: SwiftOptions(includeErrorClass: false), | ||
| )) | ||
|
|
||
| @HostApi() | ||
| abstract class IosNativeHostApi { | ||
| /// Sets UrlResourceValues.isExcludedFromBackup for the given file path. | ||
| /// | ||
| /// The file at this path must already exist, | ||
| /// and be a regular file (not a directory). | ||
| /// | ||
| /// See doc: | ||
| /// https://developer.apple.com/documentation/foundation/urlresourcevalues/isexcludedfrombackup | ||
| /// https://developer.apple.com/documentation/foundation/optimizing-your-app-s-data-for-icloud-backup | ||
| void setExcludedFromBackup(String filePath); | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The substantive change here is just to add an empty
exceptionsentry, right? It looks like this section was added in 509d88f (Patrol setup); I suspect it's not related to the intended change for your commit.Would you take a few minutes to try and reproduce this change on its own, and either discard it or make a separate commit for it depending on what you learn? (E.g. probably we want to keep this change if it happens naturally when you clear an Xcode cache and rebuild, because in that case it probably belonged in 509d88f and was just left out accidentally.)