-
Notifications
You must be signed in to change notification settings - Fork 4k
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
refactor!: rework remote config plugin #4186
Conversation
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.
Looking good so far 👍 Few comments, however main things once it's ready are:
- Error handling around the Method Channel calls so errors are passed as
FirebaseException
s (example) - Pub code comments
packages/firebase_remote_config/firebase_remote_config/lib/src/remote_config.dart
Outdated
Show resolved
Hide resolved
..._config_platform_interface/lib/src/method_channel/method_channel_firebase_remote_config.dart
Outdated
Show resolved
Hide resolved
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.
OMG thanks, I really like that a Remote config rework is coming soon 😍
packages/firebase_remote_config/firebase_remote_config/lib/src/remote_config.dart
Outdated
Show resolved
Hide resolved
..._remote_config/firebase_remote_config_platform_interface/lib/src/remote_config_settings.dart
Outdated
Show resolved
Hide resolved
80a21cc
to
0eee980
Compare
@kroikie generally we do this when an error can be thrown from a user side-effect, so when there are calls over the bridge from a direct user action. |
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.
Looking good - few things commented on. @Salakar / @russellwheatley could you give the iOS a look over?
packages/firebase_remote_config/firebase_remote_config/analysis_options.yaml
Outdated
Show resolved
Hide resolved
...c/main/java/io/flutter/plugins/firebase/firebaseremoteconfig/FirebaseRemoteConfigPlugin.java
Outdated
Show resolved
Hide resolved
packages/firebase_remote_config/firebase_remote_config/lib/src/remote_config.dart
Show resolved
Hide resolved
..._config_platform_interface/lib/src/method_channel/method_channel_firebase_remote_config.dart
Outdated
Show resolved
Hide resolved
...config/firebase_remote_config_platform_interface/lib/src/method_channel/utils/exception.dart
Show resolved
Hide resolved
packages/firebase_remote_config/firebase_remote_config/lib/src/remote_config.dart
Show resolved
Hide resolved
packages/firebase_remote_config/firebase_remote_config/example/lib/main.dart
Show resolved
Hide resolved
packages/firebase_remote_config/firebase_remote_config/lib/src/remote_config.dart
Outdated
Show resolved
Hide resolved
packages/firebase_remote_config/firebase_remote_config/lib/src/remote_config.dart
Show resolved
Hide resolved
packages/firebase_remote_config/firebase_remote_config/lib/src/remote_config.dart
Outdated
Show resolved
Hide resolved
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.
In iOS, the example app crashes when fetching the config in airplane mode:
Stacktrace
2021-01-05 10:51:10.872634-0500 Runner[94569:3476689] Task <C1792643-7196-4EE5-BB54-0D9EC5DDF6EC>.<1> HTTP load failed, 0/0 bytes (error code: -1009 [1:50])
2021-01-05 10:51:10.877075-0500 Runner[94569:3476689] Task <C1792643-7196-4EE5-BB54-0D9EC5DDF6EC>.<1> finished with error [-1009] Error Domain=NSURLErrorDomain Code=-1009 "The Internet connection appears to be offline." UserInfo={_kCFStreamErrorCodeKey=50, NSUnderlyingError=0x6000026e79c0 {Error Domain=kCFErrorDomainCFNetwork Code=-1009 "(null)" UserInfo={_kCFStreamErrorCodeKey=50, _kCFStreamErrorDomainKey=1}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <C1792643-7196-4EE5-BB54-0D9EC5DDF6EC>.<1>, _NSURLErrorRelatedURLSessionTaskErrorKey=(
"LocalDataTask <C1792643-7196-4EE5-BB54-0D9EC5DDF6EC>.<1>"
), NSLocalizedDescription=The Internet connection appears to be offline., NSErrorFailingURLStringKey=https://firebaseinstallations.googleapis.com/v1/projects/flutterfire-cd2f7/installations/, NSErrorFailingURLKey=https://firebaseinstallations.googleapis.com/v1/projects/flutterfire-cd2f7/installations/, _kCFStreamErrorDomainKey=1}
2021-01-05 10:51:10.878082-0500 Runner[94569:3476281] *** Assertion failure in -[FlutterError initWithCode:message:details:], ../../flutter/shell/platform/darwin/common/framework/Source/FlutterChannels.mm:105
2021-01-05 10:51:10.878134-0500 Runner[94569:3476477] 6.33.0 - [Firebase/RemoteConfig][I-RCN000073] Failed to get installations token. Error : Error Domain=com.firebase.installations Code=0 "(null)" UserInfo={NSUnderlyingError=0x6000026e0570 {Error Domain=NSURLErrorDomain Code=-1009 "The Internet connection appears to be offline." UserInfo={_kCFStreamErrorCodeKey=50, NSUnderlyingError=0x6000026e79c0 {Error Domain=kCFErrorDomainCFNetwork Code=-1009 "(null)" UserInfo={_kCFStreamErrorCodeKey=50, _kCFStreamErrorDomainKey=1}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <C1792643-7196-4EE5-BB54-0D9EC5DDF6EC>.<1>, _NSURLErrorRelatedURLSessionTaskErrorKey=(
"LocalDataTask <C1792643-7196-4EE5-BB54-0D9EC5DDF6EC>.<1>"
), NSLocalizedDescription=The Internet connection appears to be offline., NSErrorFailingURLStringKey=https://firebaseinstallations.googleapis.com/v1/projects/flutterfire-cd2f7/installations/, NSErrorFailingURLKey=https://firebaseinstallations.googleapis.com/v1/projects/flutterfire-cd2f7/installations/, _kCFStreamErrorDomainKey=1}}}.
2021-01-05 10:51:10.914839-0500 Runner[94569:3476281] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Code cannot be nil'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff20420af6 __exceptionPreprocess + 242
1 libobjc.A.dylib 0x00007fff20177e78 objc_exception_throw + 48
2 CoreFoundation 0x00007fff2042091f +[NSException raise:format:] + 0
3 Foundation 0x00007fff2077056a -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 191
4 Flutter 0x00000001089da9b7 -[FlutterError initWithCode:message:details:] + 244
5 Flutter 0x00000001089da8b1 +[FlutterError errorWithCode:message:details:] + 56
6 Runner 0x0000000107e47c6d +[FLTFirebasePlugin createFlutterErrorFromCode:message:optionalDetails:andOptionalNSError:] + 653
7 Runner 0x0000000107e49777 __57-[FLTFirebaseRemoteConfigPlugin handleMethodCall:result:]_block_invoke + 391
8 Runner 0x0000000107e4a5a9 __71-[FLTFirebaseRemoteConfigPlugin fetchAndActivate:withMethodCallResult:]_block_invoke + 121
9 Runner 0x0000000107def81c __57-[FIRRemoteConfig fetchAndActivateWithCompletionHandler:]_block_invoke + 332
10 Runner 0x0000000107e033b8 __65-[RCNConfigFetch reportCompletionOnHandler:withStatus:withError:]_block_invoke + 40
11 libdispatch.dylib 0x000000010a4117ec _dispatch_call_block_and_release + 12
12 libdispatch.dylib 0x000000010a4129c8 _dispatch_client_callout + 8
13 libdispatch.dylib 0x000000010a420e75 _dispatch_main_queue_callback_4CF + 1152
14 CoreFoundation 0x00007fff2038edbb __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
15 CoreFoundation 0x00007fff2038963e __CFRunLoopRun + 2685
16 CoreFoundation 0x00007fff203886d6 CFRunLoopRunSpecific + 567
17 GraphicsServices 0x00007fff2bededb3 GSEventRunModal + 139
18 UIKitCore 0x00007fff24690e0b -[UIApplication _run] + 912
19 UIKitCore 0x00007fff24695cbc UIApplicationMain + 101
20 Runner 0x0000000107dc3ec0 main + 112
21 libdyld.dylib 0x00007fff202593e9 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Code cannot be nil'
CoreSimulator 732.18.6 - Device: iPhone 11 (3AE4D40C-3A69-46F3-98C0-695EA67BF824) - Runtime: iOS 14.3 (18C61) - DeviceType: iPhone 11
terminating with uncaught exception of type NSException
To repro:
- Launch the example app on iOS device or simulator
- Turn to airplane mode (or turn off the laptop wifi if using the simulator)
- Tap on the fetch button
a596b9f
to
0c7d24f
Compare
All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the ℹ️ Googlers: Go here for more info. |
e2927a1
to
6e52739
Compare
Visit the preview URL for this PR (updated for commit b146368): https://flutter-firebase-docs--pr4186-remote-config-rework-i0k40rvu.web.app (expires Tue, 19 Jan 2021 19:54:17 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 |
packages/firebase_remote_config/firebase_remote_config_platform_interface/README.md
Outdated
Show resolved
Hide resolved
…m_interface/README.md Co-authored-by: Mike Diarmid <[email protected]>
@kroikie what are your plans with this PR? Do you plan to merge this PR with the reworked remote config API and in a second PR introduce support for the web. Basically, my question is when you intend to merge/release the reworked plugin? |
All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the ℹ️ Googlers: Go here for more info. |
@IchordeDionysos the plan will be to land this update with the Platform Interface support then add web support in a follow up PR. |
…terface on example app
All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the ℹ️ Googlers: Go here for more info. |
@googlebot I consent. |
Co-authored-by: Mike Diarmid <[email protected]>
NSString *const kFirebaseRemoteConfigChannelName = @"plugins.flutter.io/firebase_remote_config"; | ||
|
||
@interface FLTFirebaseRemoteConfigPlugin () | ||
@property(nonatomic, retain) FlutterMethodChannel *channel; |
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.
this field is unused & could be removed.
It only seems to be set to nil in dealloc
} | ||
} | ||
|
||
- (void)detachFromEngineForRegistrar:(NSObject<FlutterPluginRegistrar> *)registrar { |
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.
This will never be called because the plugin is not calling publish
, per the API docs:
You will only receive this method if you registered your plugin instance with the `FlutterEngine` via `-[FlutterPluginRegistry publish:]`.
Description
Update remote config plugin to:
Related Issues
#4035
Checklist
Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]
).This will ensure a smooth and quick review process. Updating the
pubspec.yaml
and changelogs is not required.///
).flutter analyze
) does not report any problems on my PR.Breaking Change
Does your PR require plugin users to manually update their apps to accommodate your change?