Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
78ae502
initial flutter create
bparrishMines Feb 5, 2024
6847016
add repo required stuff
bparrishMines Feb 5, 2024
b49ae74
fix pubspecs and add licenses
bparrishMines Feb 5, 2024
c1067a6
remove analysis options
bparrishMines Feb 5, 2024
3f7f6bb
fix analyze warnings
bparrishMines Feb 5, 2024
b29653d
add podfile for example
bparrishMines Feb 5, 2024
c0cff54
add base platform interface classes
bparrishMines Feb 5, 2024
0801f4c
fix analyze warning
bparrishMines Feb 5, 2024
c980a80
more impls
bparrishMines Feb 5, 2024
d2bde70
use verify token
bparrishMines Feb 5, 2024
e54e56a
add app facing interface
bparrishMines Feb 5, 2024
e4bdf45
implementation of addisplaycontainer
bparrishMines Feb 6, 2024
bab7c98
connect app facing to platform interface
bparrishMines Feb 6, 2024
645753a
stuff
bparrishMines Feb 6, 2024
3c60012
add documentation
bparrishMines Feb 7, 2024
972c0ed
Merge branch 'main' of github.com:flutter/packages into ima
bparrishMines Feb 7, 2024
45e3fba
cleanup some dart
bparrishMines Feb 7, 2024
16b0a7d
add first interface test
bparrishMines Feb 8, 2024
6c1b1ad
test platform ad display container
bparrishMines Feb 8, 2024
e9f92db
ads manager delegate tests
bparrishMines Feb 8, 2024
9c8ee61
add app facing tests
bparrishMines Feb 8, 2024
8ae248a
finish tests
bparrishMines Feb 8, 2024
b6e2014
Merge branch 'main' of github.com:flutter/packages into ima
bparrishMines Feb 8, 2024
89d10a9
fix lint errors
bparrishMines Feb 8, 2024
7a82249
formatting
bparrishMines Feb 8, 2024
764d97b
fix more lints
bparrishMines Feb 8, 2024
c38bf50
update readme about development
bparrishMines Feb 8, 2024
04eadac
update podspec
bparrishMines Feb 8, 2024
4fa492e
try fix podspec again
bparrishMines Feb 8, 2024
37c3fe3
formatting
bparrishMines Feb 8, 2024
aef9c3d
fix more lints
bparrishMines Feb 8, 2024
1aa0455
try getting integration tests running
bparrishMines Feb 8, 2024
ef693a8
try gradle 8
bparrishMines Feb 8, 2024
7574d7c
maybe fix
bparrishMines Feb 8, 2024
52083c0
try fixing integration test runner
bparrishMines Feb 8, 2024
45f57b0
remove espresso
bparrishMines Feb 8, 2024
321ba99
change package name
bparrishMines Feb 9, 2024
c4ceda3
change dartintegrationteset location
bparrishMines Feb 9, 2024
c80733d
bump gradle for legacy project
bparrishMines Feb 9, 2024
ca7eb6a
for kotlin
bparrishMines Feb 9, 2024
d2e6974
add the dot
bparrishMines Feb 9, 2024
bdf655f
fix gradle
bparrishMines Feb 9, 2024
0ebe298
try fix gradle
bparrishMines Feb 9, 2024
6d135cd
lower versions for compilation
bparrishMines Feb 9, 2024
8d31250
fix import
bparrishMines Feb 9, 2024
7384eff
fix package name
bparrishMines Feb 10, 2024
78b4067
add wake lock permission
bparrishMines Feb 12, 2024
8d44136
Merge branch 'main' of github.com:flutter/packages into ima
bparrishMines Feb 12, 2024
4691fb0
add file
bparrishMines Feb 12, 2024
0870a5a
try remaking plugin
bparrishMines Feb 12, 2024
8e0c675
replace old with new
bparrishMines Feb 12, 2024
e5575bd
fix package name
bparrishMines Feb 12, 2024
e782cc3
formatting
bparrishMines Feb 12, 2024
39dcf50
try to add integration test
bparrishMines Feb 12, 2024
7ea9beb
add licenses
bparrishMines Feb 12, 2024
c90e582
Merge branch 'main' of github.com:flutter/packages into ima
bparrishMines Feb 12, 2024
78fe3b6
add test implementation runner
bparrishMines Feb 13, 2024
e191fd5
change file location
bparrishMines Feb 13, 2024
c790f46
Merge branch 'main' of github.com:flutter/packages into ima
bparrishMines Feb 13, 2024
a8785ef
fix integration test
bparrishMines Feb 13, 2024
5e6c9e7
fix integration tests again
bparrishMines Feb 13, 2024
350c216
try close system dialog
bparrishMines Feb 13, 2024
68c854e
add to int test too i guess
bparrishMines Feb 13, 2024
ec017ba
try doing nothing in int test
bparrishMines Feb 13, 2024
1fbd152
Merge branch 'main' of github.com:flutter/packages into ima
bparrishMines Feb 13, 2024
1e8a3c3
add launch android test
bparrishMines Feb 13, 2024
4222ea2
use with text and not key
bparrishMines Feb 13, 2024
9d8a55a
add a print
bparrishMines Feb 13, 2024
93bc180
add print
bparrishMines Feb 14, 2024
886bf26
add pragmas
bparrishMines Feb 14, 2024
ac4714c
fwoaie
bparrishMines Feb 14, 2024
43e2023
undo
bparrishMines Feb 14, 2024
331b163
Merge branch 'main' of github.com:flutter/packages into ima
bparrishMines Feb 14, 2024
6fc8d04
add kotlin to androidtest maybe
bparrishMines Feb 14, 2024
9de555f
undo
bparrishMines Feb 14, 2024
7fc6b5a
remove int test
bparrishMines Feb 14, 2024
ff73a65
Merge branch 'main' of github.com:flutter/packages into ima
bparrishMines Feb 18, 2024
f764bfb
update dart and flutter versions
bparrishMines Feb 18, 2024
50e2f20
Merge branch 'main' of github.com:flutter/packages into ima
bparrishMines Mar 6, 2024
93e62fc
PR comments
bparrishMines Mar 17, 2024
378b539
change platform to base
bparrishMines Mar 20, 2024
3579326
update platform classes with base
bparrishMines Mar 20, 2024
8c45df5
Merge branch 'main' of github.com:flutter/packages into ima
bparrishMines Mar 20, 2024
630ecba
remove todos
bparrishMines Mar 20, 2024
dfbb53d
make methods required
bparrishMines Mar 26, 2024
25fc282
Merge branch 'main' of github.com:flutter/packages into ima
bparrishMines Mar 26, 2024
476a4bc
since methods are required no tests are needed
bparrishMines Mar 27, 2024
1fef696
Merge branch 'main' of github.com:flutter/packages into ima
bparrishMines Mar 27, 2024
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
add base platform interface classes
  • Loading branch information
bparrishMines committed Feb 5, 2024
commit c0cff54c467a2f43f142ea2926a37896b5c35744
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
// 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 'package:plugin_platform_interface/plugin_platform_interface.dart';

import 'platform_ad_display_container.dart';
import 'platform_ads_loader.dart';
import 'platform_ads_manager.dart';
import 'platform_ads_manager_delegate.dart';

/// Interface for a platform implementation of the Interactive Media Ads SDKs.
abstract class InteractiveMediaAdsPlatform extends PlatformInterface {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Since this is new, maybe we should just use base, per flutter/flutter#127396

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 reimplemented InteractiveMediaAdsPlatform and the platform interface classes with base. So I could no longer use mockito and I had to write a stub for all the classes. See test/test_stubs.dart. Writing stubs for everything takes more time than using mockito, but now we no longer have to test "can't implements" and "can extend" for the platform interface classes. And I think adding new methods to the stubs should be quick moving forward.

/// Creates a new [InteractiveMediaAdsPlatform].
InteractiveMediaAdsPlatform() : super(token: _token);

static final Object _token = Object();

static InteractiveMediaAdsPlatform? _instance;

/// The instance of [InteractiveMediaAdsPlatform] to use.
static InteractiveMediaAdsPlatform? get instance => _instance;

/// Platform-specific plugins should set this with their own platform-specific
/// class that extends [InteractiveMediaAdsPlatform] when they register
/// themselves.
static set instance(InteractiveMediaAdsPlatform? instance) {
if (instance == null) {
throw AssertionError(
'Platform interfaces can only be set to a non-null instance',
);
}

PlatformInterface.verify(instance, _token);
_instance = instance;
}

/// Creates a new [PlatformAdsManager].
PlatformAdsManager createPlatformAdsManager(
PlatformAdsManagerCreationParams params,
) {
throw UnimplementedError(
'createPlatformAdsManager is not implemented on the current platform.',
);
}

/// Creates a new [PlatformAdsLoader].
PlatformAdsLoader createPlatformAdsLoader(
PlatformAdsLoaderCreationParams params,
) {
throw UnimplementedError(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Since it's abstract, and there are not yet any implementations to be compatible with, should we just remove the implementations?

I'm fine if you want to leave them for consistency with later additions, but I don't think they should be necessary unless these are optional.

'createPlatformAdsLoader is not implemented on the current platform.',
);
}

/// Creates a new [PlatformAdsManagerDelegate].
PlatformAdsManagerDelegate createPlatformAdsManagerDelegate(
PlatformAdsManagerDelegateCreationParams params,
) {
throw UnimplementedError(
'createPlatformAdsManagerDelegate is not implemented on the current platform.',
);
}

/// Creates a new [PlatformAdDisplayContainer].
PlatformAdDisplayContainer createPlatformAdDisplayContainer(
PlatformAdDisplayContainerCreationParams params,
) {
throw UnimplementedError(
'createPlatformAdDisplayContainer is not implemented on the current platform.',
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
// 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 'package:flutter/foundation.dart';
import 'package:plugin_platform_interface/plugin_platform_interface.dart';

import 'interactive_media_ads_platform.dart';

/// Object specifying creation parameters for creating a
/// [PlatformAdDisplayContainer].
///
/// Platform specific implementations can add additional fields by extending
/// this class.
///
/// This example demonstrates how to extend the
/// [PlatformAdDisplayContainerCreationParams] to provide additional platform
/// specific parameters.
///
/// When extending [PlatformAdDisplayContainerCreationParams] additional
/// parameters should always accept `null` or have a default value to prevent
/// breaking changes.
///
/// ```dart
/// class AndroidPlatformAdDisplayContainerCreationParams
/// extends PlatformAdDisplayContainerCreationParams {
/// AndroidPlatformAdDisplayContainerCreationParams._(
/// PlatformAdDisplayContainerCreationParams params, {
/// this.uri,
/// }) : super();
///
/// factory AndroidAdDisplayContainerCreationParams.fromPlatformAdDisplayContainerCreationParams(
/// PlatformAdDisplayContainerCreationParams params, {
/// Uri? uri,
/// }) {
/// return AndroidAdDisplayContainerCreationParams._(params, uri: uri);
/// }
///
/// final Uri? uri;
/// }
/// ```
@immutable
class PlatformAdDisplayContainerCreationParams {
/// Used by the platform implementation to create a new [PlatformAdDisplayContainer].
const PlatformAdDisplayContainerCreationParams();
}

/// Interface for a platform implementation of a `AdDisplayContainer`.
abstract class PlatformAdDisplayContainer extends PlatformInterface {
/// Creates a new [PlatformAdDisplayContainer]
factory PlatformAdDisplayContainer(
PlatformAdDisplayContainerCreationParams params,
) {
assert(
InteractiveMediaAdsPlatform.instance != null,
'A platform implementation for `interactive_media_ads` has not been set. '
'Please ensure that an implementation of `InteractiveMediaAdsPlatform` '
'has been set to `InteractiveMediaAdsPlatform.instance` before use. For '
'unit testing, `InteractiveMediaAdsPlatform.instance` can be set with '
'your own test implementation.',
);
final PlatformAdDisplayContainer implementation =
InteractiveMediaAdsPlatform.instance!
.createPlatformAdDisplayContainer(params);
PlatformInterface.verify(implementation, _token);
return implementation;
}

/// Used by the platform implementation to create a new [PlatformAdDisplayContainer].
///
/// Should only be used by platform implementations because they can't extend
/// a class that only contains a factory constructor.
@protected
PlatformAdDisplayContainer.implementation(this.params) : super(token: _token);

static final Object _token = Object();

/// The parameters used to initialize the [PlatformAdDisplayContainer].
final PlatformAdDisplayContainerCreationParams params;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
// 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 'package:flutter/foundation.dart';
import 'package:plugin_platform_interface/plugin_platform_interface.dart';

import 'interactive_media_ads_platform.dart';

/// Object specifying creation parameters for creating a [PlatformAdsLoader].
///
/// Platform specific implementations can add additional fields by extending
/// this class.
///
/// This example demonstrates how to extend the
/// [PlatformAdsLoaderCreationParams] to provide additional platform specific
/// parameters.
///
/// When extending [PlatformAdsLoaderCreationParams] additional parameters
/// should always accept `null` or have a default value to prevent breaking
/// changes.
///
/// ```dart
/// class AndroidPlatformAdsLoaderCreationParams
/// extends PlatformAdsLoaderCreationParams {
/// AndroidPlatformAdsLoaderCreationParams._(
/// PlatformAdsLoaderCreationParams params, {
/// this.uri,
/// }) : super();
///
/// factory AndroidAdsLoaderCreationParams.fromPlatformAdsLoaderCreationParams(
/// PlatformAdsLoaderCreationParams params, {
/// Uri? uri,
/// }) {
/// return AndroidAdsLoaderCreationParams._(params, uri: uri);
/// }
///
/// final Uri? uri;
/// }
/// ```
@immutable
class PlatformAdsLoaderCreationParams {
/// Used by the platform implementation to create a new [PlatformAdsLoader].
const PlatformAdsLoaderCreationParams();
}

/// Interface for a platform implementation of a `AdsLoader`.
abstract class PlatformAdsLoader extends PlatformInterface {
/// Creates a new [PlatformAdsLoader]
factory PlatformAdsLoader(
PlatformAdsLoaderCreationParams params,
) {
assert(
InteractiveMediaAdsPlatform.instance != null,
'A platform implementation for `interactive_media_ads` has not been set. '
'Please ensure that an implementation of `InteractiveMediaAdsPlatform` '
'has been set to `InteractiveMediaAdsPlatform.instance` before use. For '
'unit testing, `InteractiveMediaAdsPlatform.instance` can be set with '
'your own test implementation.',
);
final PlatformAdsLoader implementation =
InteractiveMediaAdsPlatform.instance!.createPlatformAdsLoader(params);
PlatformInterface.verify(implementation, _token);
return implementation;
}

/// Used by the platform implementation to create a new [PlatformAdsLoader].
///
/// Should only be used by platform implementations because they can't extend
/// a class that only contains a factory constructor.
@protected
PlatformAdsLoader.implementation(this.params) : super(token: _token);

static final Object _token = Object();

/// The parameters used to initialize the [PlatformAdsLoader].
final PlatformAdsLoaderCreationParams params;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
// 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 'package:flutter/foundation.dart';
import 'package:plugin_platform_interface/plugin_platform_interface.dart';

import 'interactive_media_ads_platform.dart';

/// Object specifying creation parameters for creating a [PlatformAdsManager].
///
/// Platform specific implementations can add additional fields by extending
/// this class.
///
/// This example demonstrates how to extend the
/// [PlatformAdsManagerCreationParams] to provide additional platform specific
/// parameters.
///
/// When extending [PlatformAdsManagerCreationParams] additional parameters
/// should always accept `null` or have a default value to prevent breaking
/// changes.
///
/// ```dart
/// class AndroidPlatformAdsManagerCreationParams
/// extends PlatformAdsManagerCreationParams {
/// AndroidPlatformAdsManagerCreationParams._(
/// PlatformAdsManagerCreationParams params, {
/// this.uri,
/// }) : super();
///
/// factory AndroidAdsManagerCreationParams.fromPlatformAdsManagerCreationParams(
/// PlatformAdsManagerCreationParams params, {
/// Uri? uri,
/// }) {
/// return AndroidAdsManagerCreationParams._(params, uri: uri);
/// }
///
/// final Uri? uri;
/// }
/// ```
@immutable
class PlatformAdsManagerCreationParams {
/// Used by the platform implementation to create a new [PlatformAdsManager].
const PlatformAdsManagerCreationParams();
}

/// Interface for a platform implementation of a `AdsManager`.
abstract class PlatformAdsManager extends PlatformInterface {
/// Creates a new [PlatformAdsManager]
factory PlatformAdsManager(
PlatformAdsManagerCreationParams params,
) {
assert(
InteractiveMediaAdsPlatform.instance != null,
'A platform implementation for `interactive_media_ads` has not been set. '
'Please ensure that an implementation of `InteractiveMediaAdsPlatform` '
'has been set to `InteractiveMediaAdsPlatform.instance` before use. For '
'unit testing, `InteractiveMediaAdsPlatform.instance` can be set with '
'your own test implementation.',
);
final PlatformAdsManager implementation = InteractiveMediaAdsPlatform
.instance!
.createPlatformAdsManager(params);
PlatformInterface.verify(implementation, _token);
return implementation;
}

/// Used by the platform implementation to create a new [PlatformAdsManager].
///
/// Should only be used by platform implementations because they can't extend
/// a class that only contains a factory constructor.
@protected
PlatformAdsManager.implementation(this.params) : super(token: _token);

static final Object _token = Object();

/// The parameters used to initialize the [PlatformAdsManager].
final PlatformAdsManagerCreationParams params;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
// 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 'package:flutter/foundation.dart';
import 'package:plugin_platform_interface/plugin_platform_interface.dart';

import 'interactive_media_ads_platform.dart';

/// Object specifying creation parameters for creating a
/// [PlatformAdsManagerDelegate].
///
/// Platform specific implementations can add additional fields by extending
/// this class.
///
/// This example demonstrates how to extend the
/// [PlatformAdsManagerDelegateCreationParams] to provide additional platform
/// specific parameters.
///
/// When extending [PlatformAdsManagerDelegateCreationParams] additional
/// parameters should always accept `null` or have a default value to prevent
/// breaking changes.
///
/// ```dart
/// class AndroidPlatformAdsManagerDelegateCreationParams
/// extends PlatformAdsManagerDelegateCreationParams {
/// AndroidPlatformAdsManagerDelegateCreationParams._(
/// PlatformAdsManagerDelegateCreationParams params, {
/// this.uri,
/// }) : super();
///
/// factory AndroidAdsManagerDelegateCreationParams.fromPlatformAdsManagerDelegateCreationParams(
/// PlatformAdsManagerDelegateCreationParams params, {
/// Uri? uri,
/// }) {
/// return AndroidAdsManagerDelegateCreationParams._(params, uri: uri);
/// }
///
/// final Uri? uri;
/// }
/// ```
@immutable
class PlatformAdsManagerDelegateCreationParams {
/// Used by the platform implementation to create a new [PlatformAdsManagerDelegate].
const PlatformAdsManagerDelegateCreationParams();
}

/// Interface for a platform implementation of a `AdsManagerDelegate`.
abstract class PlatformAdsManagerDelegate extends PlatformInterface {
/// Creates a new [PlatformAdsManagerDelegate]
factory PlatformAdsManagerDelegate(
PlatformAdsManagerDelegateCreationParams params,
) {
assert(
InteractiveMediaAdsPlatform.instance != null,
'A platform implementation for `interactive_media_ads` has not been set. '
'Please ensure that an implementation of `InteractiveMediaAdsPlatform` '
'has been set to `InteractiveMediaAdsPlatform.instance` before use. For '
'unit testing, `InteractiveMediaAdsPlatform.instance` can be set with '
'your own test implementation.',
);
final PlatformAdsManagerDelegate implementation =
InteractiveMediaAdsPlatform.instance!
.createPlatformAdsManagerDelegate(params);
PlatformInterface.verify(implementation, _token);
return implementation;
}

/// Used by the platform implementation to create a new
/// [PlatformAdsManagerDelegate].
///
/// Should only be used by platform implementations because they can't extend
/// a class that only contains a factory constructor.
@protected
PlatformAdsManagerDelegate.implementation(this.params) : super(token: _token);

static final Object _token = Object();

/// The parameters used to initialize the [PlatformAdsManagerDelegate].
final PlatformAdsManagerDelegateCreationParams params;
}