Skip to content
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
2 changes: 0 additions & 2 deletions .pubignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ ios/Podfile.lock
# Intl generated
lib/generated/

## https://pub.dev/packages/flutter_config
ios/.envfile
**/ios/Flutter/tmp.xcconfig

# Miscellaneous
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 0.8.0
- feat: add Swift Package Manager support alongside CocoaPods. NB: for SPM identity resolution to work, the plugin repository must be named `iterable_flutter` (underscore) to match the Dart package name.
- chore: bump Iterable iOS SDK 6.6.4 → 6.7.3 and Iterable Android SDK 3.6.3 → 3.9.0
- refactor: restructure iOS sources to the SPM layout as a Swift-only target (dropped the Objective-C forwarding shim)
- build: modernise the example app for Flutter 3.44 (Gradle 8.9 / AGP 8.7.3; replaced abandoned flutter_config with flutter_dotenv)

## 0.5.9
- Update README with no longer maintaining message

Expand Down
4 changes: 2 additions & 2 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
group 'com.lahaus.iterable_flutter'
version '0.5.7'
version '0.8.0'

buildscript {
ext.kotlin_version = '1.9.20'
Expand Down Expand Up @@ -54,7 +54,7 @@ android {
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"

implementation 'com.iterable:iterableapi:3.6.3'
implementation 'com.iterable:iterableapi:3.9.0'
testImplementation 'junit:junit:4.13.2'
testImplementation 'org.json:json:20231013'
}
61 changes: 22 additions & 39 deletions example/android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,63 +1,46 @@
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
plugins {
id "com.android.application"
id "kotlin-android"
id "dev.flutter.flutter-gradle-plugin"
id "com.google.gms.google-services"
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
apply from: project(':flutter_config').projectDir.getPath() + "/dotenv.gradle"
android {
namespace = "com.lahaus.iterable_flutter_example"
compileSdk = 34

apply plugin: 'com.google.gms.google-services'
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

android {
compileSdkVersion 33
kotlinOptions {
jvmTarget = "17"
}

sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}

defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.lahaus.iterable_flutter_example"
minSdkVersion 21
targetSdkVersion 31
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
applicationId = "com.lahaus.iterable_flutter_example"
minSdk = flutter.minSdkVersion
targetSdk = 34
versionCode = flutter.versionCode
versionName = flutter.versionName
}

buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
signingConfig = signingConfigs.debug
}
}
}

flutter {
source '../..'
source = "../.."
}

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.google.firebase:firebase-messaging:22.0.0'
}
2 changes: 1 addition & 1 deletion example/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.lahaus.iterable_flutter_example">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application android:label="iterable_flutter_example" android:icon="@mipmap/ic_launcher">
<activity android:name=".MainActivity" android:launchMode="singleTop" android:theme="@style/LaunchTheme" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode" android:hardwareAccelerated="true" android:windowSoftInputMode="adjustResize" android:exported="true">
<!-- Specifies an Android theme to apply to this Activity as soon as
Expand Down
20 changes: 3 additions & 17 deletions example/android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,28 +1,14 @@
buildscript {
ext.kotlin_version = '1.6.21'
repositories {
google()
jcenter()
}

dependencies {
classpath 'com.android.tools.build:gradle:7.0.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.10'
}
}

allprojects {
repositories {
google()
jcenter()
mavenCentral()
}
}

rootProject.buildDir = '../build'
rootProject.buildDir = "../build"
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
project.evaluationDependsOn(':app')
project.evaluationDependsOn(":app")
}

tasks.register("clean", Delete) {
Expand Down
5 changes: 4 additions & 1 deletion example/android/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true
android.enableJetifier=true
# This builtInKotlin flag was added automatically by Flutter migrator
android.builtInKotlin=false
# This newDsl flag was added automatically by Flutter migrator
android.newDsl=false
2 changes: 1 addition & 1 deletion example/android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-all.zip
31 changes: 23 additions & 8 deletions example/android/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,26 @@
include ':app'
pluginManagement {
def flutterSdkPath = {
def properties = new Properties()
file("local.properties").withInputStream { properties.load(it) }
def flutterSdkPath = properties.getProperty("flutter.sdk")
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
return flutterSdkPath
}()

def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
def properties = new Properties()
includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")

assert localPropertiesFile.exists()
localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}

def flutterSdkPath = properties.getProperty("flutter.sdk")
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version "8.7.3" apply false
id "org.jetbrains.kotlin.android" version "1.9.20" apply false
id "com.google.gms.google-services" version "4.4.2" apply false
}

include ":app"
2 changes: 0 additions & 2 deletions example/ios/Flutter/AppFrameworkInfo.plist
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,5 @@
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>MinimumOSVersion</key>
<string>13.0</string>
</dict>
</plist>
9 changes: 6 additions & 3 deletions example/ios/Runner/AppDelegate.swift
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import UIKit
import Flutter
import UIKit

@main
@objc class AppDelegate: FlutterAppDelegate {
@objc class AppDelegate: FlutterAppDelegate, FlutterImplicitEngineDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
GeneratedPluginRegistrant.register(with: self)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}

func didInitializeImplicitFlutterEngine(_ engineBridge: FlutterImplicitEngineBridge) {
GeneratedPluginRegistrant.register(with: engineBridge.pluginRegistry)
}
}
29 changes: 25 additions & 4 deletions example/ios/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
Expand All @@ -22,6 +24,29 @@
<string>$(FLUTTER_BUILD_NUMBER)</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UIApplicationSceneManifest</key>
<dict>
<key>UIApplicationSupportsMultipleScenes</key>
<false/>
<key>UISceneConfigurations</key>
<dict>
<key>UIWindowSceneSessionRoleApplication</key>
<array>
<dict>
<key>UISceneClassName</key>
<string>UIWindowScene</string>
<key>UISceneConfigurationName</key>
<string>flutter</string>
<key>UISceneDelegateClassName</key>
<string>FlutterSceneDelegate</string>
<key>UISceneStoryboardFile</key>
<string>Main</string>
</dict>
</array>
</dict>
</dict>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
<key>UIBackgroundModes</key>
<array>
<string>remote-notification</string>
Expand All @@ -45,9 +70,5 @@
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
</dict>
</plist>
12 changes: 6 additions & 6 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ import 'dart:async';
import 'dart:io';

import 'package:flutter/material.dart';
import 'package:flutter_config/flutter_config.dart';
import 'package:flutter_dotenv/flutter_dotenv.dart';
import 'package:iterable_flutter/iterable_flutter.dart';
import 'package:iterable_flutter_example/second_page.dart';

Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized(); // Required by FlutterConfig
await FlutterConfig.loadEnvVariables();
WidgetsFlutterBinding.ensureInitialized(); // Required before loading .env
await dotenv.load();

runApp(MaterialApp(
title: "App",
Expand All @@ -30,10 +30,10 @@ class _MyAppState extends State<MyApp> {
}

Future<void> initIterable() async {
final apiKey = FlutterConfig.get('ITERABLE_API_KEY');
final apiKey = dotenv.env['ITERABLE_API_KEY'] ?? '';
final pushIntegrationName = Platform.isAndroid
? FlutterConfig.get('ITERABLE_PUSH_INTEGRATION_NAME_ANDROID')
: FlutterConfig.get('ITERABLE_PUSH_INTEGRATION_NAME_IOS');
? dotenv.env['ITERABLE_PUSH_INTEGRATION_NAME_ANDROID'] ?? ''
: dotenv.env['ITERABLE_PUSH_INTEGRATION_NAME_IOS'] ?? '';

return await IterableFlutter.initialize(
apiKey: apiKey,
Expand Down
8 changes: 6 additions & 2 deletions example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ description: Demonstrates how to use the iterable_flutter plugin.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev

environment:
sdk: ">=2.12.0 <3.0.0"
sdk: ">=3.0.0 <4.0.0"

dependencies:
flutter:
Expand All @@ -24,7 +24,7 @@ dependencies:
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: 1.0.2

flutter_config: 2.0.0
flutter_dotenv: ^6.0.1

dev_dependencies:
flutter_test:
Expand All @@ -41,6 +41,10 @@ flutter:
# the material Icons class.
uses-material-design: true

# The .env file is bundled as an asset and read at runtime by flutter_dotenv.
assets:
- .env

# To add assets to your application, add an assets section, like this:
# assets:
# - images/a_dot_burr.jpeg
Expand Down
4 changes: 4 additions & 0 deletions ios/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ profile

DerivedData/
build/

# Swift Package Manager
.build/
.swiftpm/
GeneratedPluginRegistrant.h
GeneratedPluginRegistrant.m

Expand Down
4 changes: 0 additions & 4 deletions ios/Classes/IterableFlutterPlugin.h

This file was deleted.

15 changes: 0 additions & 15 deletions ios/Classes/IterableFlutterPlugin.m

This file was deleted.

6 changes: 3 additions & 3 deletions ios/iterable_flutter.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
Pod::Spec.new do |s|
s.name = 'iterable_flutter'
s.version = '0.7.0'
s.version = '0.8.0'
s.summary = 'Flutter implementation for iterable.com Cross Channel Marketing Platform'
s.description = <<-DESC
Flutter implementation for iterable.com Cross Channel Marketing Platform
Expand All @@ -13,9 +13,9 @@ Pod::Spec.new do |s|
s.license = { :file => '../LICENSE' }
s.author = { 'La Haus' => 'email@example.com' }
s.source = { :path => '.' }
s.source_files = 'Classes/**/*'
s.source_files = 'iterable_flutter/Sources/iterable_flutter/**/*'
s.dependency 'Flutter'
s.dependency 'Iterable-iOS-SDK', '6.6.4'
s.dependency 'Iterable-iOS-SDK', '6.7.3'
s.platform = :ios, '13.0'

# Flutter.framework does not contain a i386 slice.
Expand Down
Loading