Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
7c363fd
dart side of implementation
bparrishMines May 11, 2022
2e55266
objc side of callback impl
bparrishMines May 12, 2022
4a12eaa
documentation and a test messenger
bparrishMines May 12, 2022
6bc048b
dart side update
bparrishMines May 16, 2022
4efa9a1
objc side
bparrishMines May 16, 2022
f9d54e2
formatting
bparrishMines May 16, 2022
2f73074
Merge branch 'main' of github.com:flutter/plugins into callbacks
bparrishMines May 16, 2022
ddfde5c
handles
bparrishMines May 17, 2022
96c21ae
some fixes for PR comments
bparrishMines May 18, 2022
f2a3504
new instance manager
bparrishMines May 19, 2022
77da52f
bunch of work
bparrishMines May 19, 2022
e388090
instance manager tests
bparrishMines May 19, 2022
ac3a2de
fix foundation tests
bparrishMines May 19, 2022
696c25c
dart touchups
bparrishMines May 19, 2022
88816c9
finish dart standardization and support earlier versions
bparrishMines May 19, 2022
9d25ab1
fix dart instance manager
bparrishMines May 19, 2022
4d7ebc4
instance manager ish
bparrishMines May 19, 2022
81b201f
most tests passing
bparrishMines May 19, 2022
62581ba
instance manager tests
bparrishMines May 20, 2022
f0d2498
formatting and one last test
bparrishMines May 20, 2022
4bd6d2a
formatting
bparrishMines May 20, 2022
7974d56
naming
bparrishMines May 20, 2022
ad9b4e6
better comment
bparrishMines May 20, 2022
d8b720e
update comment with info about platform/flutter
bparrishMines May 23, 2022
3c98004
fix bug from instance manager identifier
bparrishMines May 24, 2022
368fb30
limits on identifiers
bparrishMines May 25, 2022
a6980c5
use removeReference name instead
bparrishMines May 25, 2022
179f109
maybe an even better name?
bparrishMines May 25, 2022
e966816
use init constructor
bparrishMines May 25, 2022
3897535
version bump
bparrishMines May 25, 2022
312825a
update name
bparrishMines May 25, 2022
36fa0a0
Merge branch 'main' of github.com:flutter/plugins into callbacks
bparrishMines May 25, 2022
2b7a9af
undo changes to webview_flutter
bparrishMines May 25, 2022
86b193a
add api impls
bparrishMines May 25, 2022
61d5f8a
undo changes to create methods
bparrishMines May 25, 2022
29e8ad0
changes and stuff
bparrishMines May 25, 2022
2be09aa
some updates
bparrishMines May 26, 2022
e212aa4
Merge branch 'main' of github.com:flutter/plugins into callbacks
bparrishMines May 26, 2022
ea0fe93
method names
bparrishMines May 26, 2022
9e47dda
more docs, yay
bparrishMines May 26, 2022
8076bed
spelling and docs
bparrishMines May 31, 2022
0fa7a14
pr comments
bparrishMines Jun 2, 2022
797d448
format and issue
bparrishMines Jun 2, 2022
ba8161a
Merge branch 'main' of github.com:flutter/plugins into callbacks
bparrishMines Jun 2, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
some updates
  • Loading branch information
bparrishMines committed May 26, 2022
commit 2be09aa09984948fbf55712367f9051cc20328a1
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
<key>CFBundleVersion</key>
<string>1.0</string>
<key>MinimumOSVersion</key>
<string>9.0</string>
<string>11.0</string>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe these were caused by compiling with Flutter version 3.0.0. I can remove if needed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we should hold off on the 9->11 changes.

</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'
# platform :ios, '11.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
Expand Down Expand Up @@ -664,7 +664,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
// found in the LICENSE file.

#import <XCTest/XCTest.h>

@import webview_flutter_wkwebview;
@import webview_flutter_wkwebview.Test;

@interface FWFInstanceManagerTests : XCTestCase
@end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,5 @@ - (void)testSetOpaque {
OCMVerify([mockUIView setOpaque:YES]);
XCTAssertNil(error);
}

@end
Original file line number Diff line number Diff line change
Expand Up @@ -82,21 +82,6 @@ typedef void (^FWFOnDeallocCallback)(long identifier);
*/
- (long)identifierForInstance:(nonnull NSObject *)instance
identifierWillBePassedToFlutter:(BOOL)willBePassed;

/**
* The number of instances stored as a strong reference.
*
* Added for debugging purposes.
*/
- (NSUInteger)strongInstanceCount;

/**
* The number of instances stored as a weak reference.
*
* Added for debugging purposes. NSMapTables that store keys or objects as weak reference will be
* reclaimed nondeterministically.
*/
- (NSUInteger)weakInstanceCount;
@end

NS_ASSUME_NONNULL_END
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
// found in the LICENSE file.

#import "FWFInstanceManager.h"
#import "FWFInstanceManager_Test.h"

#import <objc/runtime.h>

// Attaches to an object to receive a callback when the object is deallocated.
@interface FWFFinalizer : NSObject
Expand Down Expand Up @@ -51,7 +54,7 @@ @interface FWFInstanceManager ()

@implementation FWFInstanceManager
// Identifiers are locked to a specific range to avoid collisions with objects
// created simultaneously by Dart.
// created simultaneously from Dart.
// Host uses identifiers >= 2^16 and Dart is expected to use values n where,
// 0 <= n < 2^16.
long const FWFMinHostCreatedIdentifier = 65536;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#import <webview_flutter_wkwebview/FWFInstanceManager.h>

NS_ASSUME_NONNULL_BEGIN

@interface FWFInstanceManager ()
/**
* The number of instances stored as a strong reference.
*
* Added for debugging purposes.
*/
- (NSUInteger)strongInstanceCount;

/**
* The number of instances stored as a weak reference.
*
* Added for debugging purposes. NSMapTables that store keys or objects as weak reference will be
* reclaimed nondeterministically.
*/
- (NSUInteger)weakInstanceCount;
@end

NS_ASSUME_NONNULL_END
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#import "FWFWebViewConfigurationHostApi.h"

@interface FWFNavigationDelegateFlutterApiImpl ()
// This reference must be weak to prevent a circular reference with the objects it stores.
@property(nonatomic, weak) FWFInstanceManager *instanceManager;
@end

Expand Down Expand Up @@ -60,6 +61,7 @@ - (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigat

@interface FWFNavigationDelegateHostApiImpl ()
@property(weak) id<FlutterBinaryMessenger> binaryMessenger;
// This reference must be weak to prevent a circular reference with the objects it stores.
@property(nonatomic, weak) FWFInstanceManager *instanceManager;
@end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#import "FWFDataConverters.h"

@interface FWFObjectFlutterApi ()
// This reference must be weak to prevent a circular reference with the objects it stores.
@property(nonatomic, weak) FWFInstanceManager *instanceManager;
@end

Expand Down Expand Up @@ -33,6 +34,7 @@ - (instancetype)initWithBinaryMessenger:(id<FlutterBinaryMessenger>)binaryMessen
@end

@interface FWFObjectHostApiImpl ()
// This reference must be weak to prevent a circular reference with the objects it stores.
@property(nonatomic, weak) FWFInstanceManager *instanceManager;
@end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,4 @@ - (void)createWithIdentifier:(nonnull NSNumber *)identifier
FWFUIDelegate *uIDelegate = [[FWFUIDelegate alloc] init];
[self.instanceManager addDartCreatedInstance:uIDelegate withIdentifier:identifier.longValue];
}

@end
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ framework module webview_flutter_wkwebview {
explicit module Test {
header "FlutterWebView_Test.h"
header "FLTCookieManager_Test.h"
header "FWFInstanceManager_Test.h"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,11 @@ class InstanceManager {
}

int _nextUniqueIdentifier() {
while (containsIdentifier(_nextIdentifier)) {
late int identifier;
do {
identifier = _nextIdentifier;
_nextIdentifier = (_nextIdentifier + 1) % _maxDartCreatedIdentifier;
}
return _nextIdentifier;
} while (containsIdentifier(identifier));
return identifier;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import 'dart:async';
import 'dart:math';

import 'package:flutter/painting.dart' show Color;
import 'package:flutter/services.dart';
import 'package:webview_flutter_wkwebview/src/foundation/foundation.dart';

import '../common/instance_manager.dart';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ import 'web_kit/web_kit.dart';
class WebKitWebViewWidget extends StatefulWidget {
/// Constructs a [WebKitWebViewWidget].
const WebKitWebViewWidget({
Key? key,
super.key,
required this.creationParams,
required this.callbacksHandler,
required this.javascriptChannelRegistry,
required this.onBuildWidget,
this.configuration,
@visibleForTesting this.webViewProxy = const WebViewWidgetProxy(),
}) : super(key: key);
});

/// The initial parameters used to setup the WebView.
final CreationParams creationParams;
Expand Down