Skip to content
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

Fixes to running on iOS 13 #70

Merged
merged 3 commits into from
Sep 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## [0.3.3] - 2019/09/25
iOS 13.0 fixes

## [0.3.2] - 2019/09/11
iOS Interstitial crash fix if `didFailToReceiveAdWithError`

Expand Down
7 changes: 7 additions & 0 deletions example/android/app/src/debug/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.shatsy.example">
<!-- Flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
<uses-permission android:name="android.permission.INTERNET"/>
</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.shatsy.example

import android.os.Bundle

import io.flutter.app.FlutterActivity
import io.flutter.plugins.GeneratedPluginRegistrant

class MainActivity: FlutterActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
GeneratedPluginRegistrant.registerWith(this)
}
}
7 changes: 7 additions & 0 deletions example/android/app/src/profile/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.shatsy.example">
<!-- Flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
<uses-permission android:name="android.permission.INTERNET"/>
</manifest>
16 changes: 8 additions & 8 deletions example/ios/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,10 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>io.flutter.embedded_views_preview</key>
<true/>
<key>LSApplicationCategoryType</key>
<string></string>
<key>GADApplicationIdentifier</key>
<string>ca-app-pub-3940256099942544~1458002511</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleShortVersionString</key>
<string>$(FLUTTER_BUILD_NAME)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
Expand All @@ -20,12 +16,14 @@
<string>admob_flutter_example</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>$(FLUTTER_BUILD_NAME)</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>$(FLUTTER_BUILD_NUMBER)</string>
<key>GADApplicationIdentifier</key>
<string>ca-app-pub-3940256099942544~1458002511</string>
<key>LSApplicationCategoryType</key>
<string></string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>
Expand All @@ -47,5 +45,7 @@
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>io.flutter.embedded_views_preview</key>
<true/>
</dict>
</plist>
1 change: 1 addition & 0 deletions example/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: admob_flutter_example
description: Demonstrates how to use the admob_flutter plugin.
publish_to: 'none'
version: 1.0.0+1

environment:
sdk: ">=2.0.0-dev.68.0 <3.0.0"
Expand Down
2 changes: 1 addition & 1 deletion ios/Classes/AdmobBanner.swift
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class AdmobBanner : NSObject, FlutterPlatformView {
fileprivate func requestAd() {
if let ad = getBannerAdView() {
let request = GADRequest()
request.testDevices = [kGADSimulatorID]
GADMobileAds.sharedInstance().requestConfiguration.testDeviceIdentifiers = [kGADSimulatorID as! String]
ad.load(request)
}
}
Expand Down
2 changes: 1 addition & 1 deletion ios/Classes/AdmobInterstitialPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public class AdmobIntersitialPlugin: NSObject, FlutterPlugin {
private func loadInterstantialAd(id: Int, interstantialAdUnitId: String) {
let interstantial = getInterstitialAd(id: id, interstantialAdUnitId: interstantialAdUnitId)
let request = GADRequest()
request.testDevices = [kGADSimulatorID]
GADMobileAds.sharedInstance().requestConfiguration.testDeviceIdentifiers = [kGADSimulatorID as! String]
interstantial.load(request)
}

Expand Down
2 changes: 1 addition & 1 deletion ios/Classes/AdmobRewardPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public class AdmobRewardPlugin: NSObject, FlutterPlugin {
private func loadRewardBasedVideoAd(id: Int, rewardBasedVideoAdUnitId: String) {
let interstantial = getRewardBasedVideoAd(id: id)
let request = GADRequest()
request.testDevices = [kGADSimulatorID]
GADMobileAds.sharedInstance().requestConfiguration.testDeviceIdentifiers = [kGADSimulatorID as! String]
interstantial.load(request, withAdUnitID: rewardBasedVideoAdUnitId)
}

Expand Down
11 changes: 8 additions & 3 deletions lib/src/admob_event_handler.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'dart:async';

import 'package:flutter/services.dart';

import 'admob_events.dart';
Expand All @@ -6,15 +8,17 @@ export 'admob_events.dart';
abstract class AdmobEventHandler {
final Function(AdmobAdEvent, Map<String, dynamic>) _listener;

AdmobEventHandler(Function(AdmobAdEvent, Map<String, dynamic>) listener) : _listener = listener;
AdmobEventHandler(Function(AdmobAdEvent, Map<String, dynamic>) listener)
: _listener = listener;

Future<dynamic> handleEvent(MethodCall call) async {
switch (call.method) {
case 'loaded':
_listener(AdmobAdEvent.loaded, null);
break;
case 'failedToLoad':
_listener(AdmobAdEvent.failedToLoad, Map<String, dynamic>.from(call.arguments));
_listener(AdmobAdEvent.failedToLoad,
Map<String, dynamic>.from(call.arguments));
break;
case 'clicked':
_listener(AdmobAdEvent.clicked, null);
Expand All @@ -35,7 +39,8 @@ abstract class AdmobEventHandler {
_listener(AdmobAdEvent.completed, null);
break;
case 'rewarded':
_listener(AdmobAdEvent.rewarded, Map<String, dynamic>.from(call.arguments));
_listener(
AdmobAdEvent.rewarded, Map<String, dynamic>.from(call.arguments));
break;
case 'started':
_listener(AdmobAdEvent.started, null);
Expand Down
2 changes: 2 additions & 0 deletions lib/src/admob_interstitial.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'dart:async';

import 'package:flutter/services.dart';
import 'package:meta/meta.dart';
import 'admob_event_handler.dart';
Expand Down
2 changes: 2 additions & 0 deletions lib/src/admob_reward.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'dart:async';

import 'package:flutter/services.dart';
import 'package:meta/meta.dart';
import 'admob_event_handler.dart';
Expand Down
4 changes: 2 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name: admob_flutter
description: Admob plugin that shows banner ads using native platform views.
version: 0.3.2
version: 0.3.3
author: Youssef Kababe <youssef.kbe@gmail.com>
homepage: https://github.com/YoussefKababe/admob_flutter

environment:
sdk: ">=2.0.0-dev.68.0 <3.0.0"
sdk: ">=2.1.0 <3.0.0"

dependencies:
flutter:
Expand Down