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

chore #185: include iris_method_channel directly in project #186

Merged
merged 4 commits into from
Dec 2, 2024
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
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,8 @@ migrate_working_dir/
build/

.plugin_dev

# FVM Version Cache
.fvm/
.vscode
.fvmrc
19 changes: 18 additions & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
group = "io.agora.agorartm.agora_rtm"
version = "1.0"

def safeExtGet(prop, fallback) {
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
}

buildscript {
repositories {
google()
Expand All @@ -26,16 +30,23 @@ android {
namespace = "io.agora.agorartm.agora_rtm"
}

compileSdk = 34
compileSdkVersion safeExtGet('compileSdkVersion', 31)

compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

defaultConfig {
minSdkVersion safeExtGet('minSdkVersion', 21)
minSdk = 16
consumerProguardFiles 'consumer-rules.pro'

externalNativeBuild {
cmake {
arguments '-DANDROID_STL=c++_static'
}
}
}

sourceSets {
Expand All @@ -45,6 +56,12 @@ android {
}
}

externalNativeBuild {
cmake {
path '../src/CMakeLists.txt'
}
}

dependencies {
testImplementation("junit:junit:4.13.2")
testImplementation("org.mockito:mockito-core:5.0.0")
Expand Down
5 changes: 0 additions & 5 deletions example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,6 @@ dependencies:

flutter_riverpod: ^1.0.0

dependency_overrides:
# When using agora_rtm 2.2.2 with agora_rtc_engine 6.3.2, we need to override the iris_method_channel to 2.2.2,
# the issue will be fixed with the next release of agora_rtc_engine
iris_method_channel: ^2.2.2

dev_dependencies:
integration_test:
sdk: flutter
Expand Down
14 changes: 14 additions & 0 deletions ios/Classes/AgoraRtmPlugin.m → ios/Classes/AgoraRtmPlugin.mm
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
#import "AgoraRtmPlugin.h"

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdocumentation"
#include "../../src/iris_event.cc"
#pragma clang diagnostic pop

// Ignore warning of [-Wdocumentation/-Wstrict-prototypes] of dart_api_dl.c
// #pragma clang diagnostic push
// #pragma clang diagnostic ignored "-Wdocumentation"
// #pragma clang diagnostic ignored "-Wstrict-prototypes"
// #include "../../src/dart-sdk/include/dart_api_dl.c"
// #pragma clang diagnostic pop

#include "../../src/iris_life_cycle_observer.mm"

@implementation AgoraRtmPlugin
+ (void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar>*)registrar {
FlutterMethodChannel* channel = [FlutterMethodChannel
Expand Down
6 changes: 6 additions & 0 deletions ios/Classes/dart_api_dl.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// Ignore warning of [-Wdocumentation/-Wstrict-prototypes] of dart_api_dl.c
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdocumentation"
#pragma clang diagnostic ignored "-Wstrict-prototypes"
#include "../../src/dart-sdk/include/dart_api_dl.c"
#pragma clang diagnostic pop
2 changes: 1 addition & 1 deletion lib/src/bindings/agora_rtm_client_impl_override.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import 'package:flutter/services.dart' show MethodChannel;

import 'gen/agora_rtm_client_event_impl.dart';
import 'gen/agora_rtm_client_impl.dart' as rtmc_binding;
import 'package:iris_method_channel/iris_method_channel.dart';
import 'package:agora_rtm/src/method_channel/iris_method_channel.dart';
import 'agora_stream_channel_impl_override.dart';
import 'package:async/async.dart' show AsyncMemoizer;
import 'package:meta/meta.dart';
Expand Down
2 changes: 1 addition & 1 deletion lib/src/bindings/agora_stream_channel_impl_override.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import 'dart:typed_data' show Uint8List;
import 'package:agora_rtm/src/agora_rtm_base.dart' show TopicMessageOptions;

import 'gen/agora_stream_channel_impl.dart' as sci_binding;
import 'package:iris_method_channel/iris_method_channel.dart';
import 'package:agora_rtm/src/method_channel/iris_method_channel.dart';

class StreamChannelImpl extends sci_binding.StreamChannelImpl
with ScopedDisposableObjectMixin {
Expand Down
2 changes: 1 addition & 1 deletion lib/src/bindings/gen/agora_rtm_client_event_impl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import 'binding_forward_export.dart';
// import 'package:agora_rtc_engine/src/binding/impl_forward_export.dart';
import 'package:iris_method_channel/iris_method_channel.dart';
import 'package:agora_rtm/src/method_channel/iris_method_channel.dart';

class RtmEventHandlerWrapper implements EventLoopEventHandler {
const RtmEventHandlerWrapper(this.rtmEventHandler);
Expand Down
2 changes: 1 addition & 1 deletion lib/src/bindings/gen/agora_rtm_client_impl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// ignore_for_file: public_member_api_docs, unused_local_variable, unused_import, annotate_overrides

import 'binding_forward_export.dart';
import 'package:iris_method_channel/iris_method_channel.dart';
import 'package:agora_rtm/src/method_channel/iris_method_channel.dart';

class RtmClientImpl implements RtmClient {
RtmClientImpl(this.irisMethodChannel);
Expand Down
2 changes: 1 addition & 1 deletion lib/src/bindings/gen/agora_rtm_lock_impl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// ignore_for_file: public_member_api_docs, unused_local_variable, unused_import, annotate_overrides

import 'binding_forward_export.dart';
import 'package:iris_method_channel/iris_method_channel.dart';
import 'package:agora_rtm/src/method_channel/iris_method_channel.dart';

class RtmLockImpl implements RtmLock {
RtmLockImpl(this.irisMethodChannel);
Expand Down
2 changes: 1 addition & 1 deletion lib/src/bindings/gen/agora_rtm_presence_impl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// ignore_for_file: public_member_api_docs, unused_local_variable, unused_import, annotate_overrides

import 'binding_forward_export.dart';
import 'package:iris_method_channel/iris_method_channel.dart';
import 'package:agora_rtm/src/method_channel/iris_method_channel.dart';

class RtmPresenceImpl implements RtmPresence {
RtmPresenceImpl(this.irisMethodChannel);
Expand Down
2 changes: 1 addition & 1 deletion lib/src/bindings/gen/agora_rtm_storage_impl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// ignore_for_file: public_member_api_docs, unused_local_variable, unused_import, annotate_overrides

import 'binding_forward_export.dart';
import 'package:iris_method_channel/iris_method_channel.dart';
import 'package:agora_rtm/src/method_channel/iris_method_channel.dart';

class RtmStorageImpl implements RtmStorage {
RtmStorageImpl(this.irisMethodChannel);
Expand Down
2 changes: 1 addition & 1 deletion lib/src/bindings/gen/agora_stream_channel_impl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// ignore_for_file: public_member_api_docs, unused_local_variable, unused_import, annotate_overrides

import 'binding_forward_export.dart';
import 'package:iris_method_channel/iris_method_channel.dart';
import 'package:agora_rtm/src/method_channel/iris_method_channel.dart';

class StreamChannelImpl implements StreamChannel {
StreamChannelImpl(this.irisMethodChannel);
Expand Down
4 changes: 2 additions & 2 deletions lib/src/bindings/native_iris_api_engine_binding_delegate.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import 'dart:ffi' as ffi;
import 'package:ffi/ffi.dart';

import 'gen/native_iris_api_engine_bindings.dart' as bindings;
import 'package:iris_method_channel/iris_method_channel.dart';
import 'package:iris_method_channel/iris_method_channel_bindings_io.dart'
import 'package:agora_rtm/src/method_channel/iris_method_channel.dart';
import 'package:agora_rtm/src/method_channel/iris_method_channel_bindings_io.dart'
as iris_bindings;

// ignore_for_file: public_member_api_docs
Expand Down
2 changes: 1 addition & 1 deletion lib/src/impl/agora_rtm_client_impl_override.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import 'package:agora_rtm/src/bindings/gen/agora_rtm_client_impl.dart'
import 'package:agora_rtm/src/impl/gen/rtm_result_handler.dart';
import 'package:agora_rtm/src/impl/rtm_result_handler_impl.dart';
import 'package:flutter/foundation.dart';
import 'package:iris_method_channel/iris_method_channel.dart';
import 'package:agora_rtm/src/method_channel/iris_method_channel.dart';

InitilizationArgProvider? _mockSharedNativeHandleProvider;
@visibleForTesting
Expand Down
3 changes: 1 addition & 2 deletions lib/src/impl/extensions.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import 'dart:async';

import 'package:agora_rtm/src/agora_rtm_client_ext.dart';
import 'package:agora_rtm/src/binding_forward_export.dart';
import 'package:iris_method_channel/iris_method_channel.dart';
import 'package:agora_rtm/src/method_channel/iris_method_channel.dart';

extension IrisMethodChannelExt on IrisMethodChannel {
Future<RtmStatus> wrapRtmStatus(
Expand Down
57 changes: 57 additions & 0 deletions lib/src/method_channel/internal/iris_handles.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/// Callable class that represent the `Handle` type. You can get the actual handle
/// value as a callable function. e.g.,
/// ```dart
/// final IrisHandle handle = IrisApiEngineHandle(10);
/// final value = handle(); // value = 10
/// ```
abstract class IrisHandle {
/// Construct the [IrisHandle]
const IrisHandle();

/// Callable function that allow you to get the handle value as function.
Object call();
}

/// [IrisHandle] implementation that hold a value of [Object] type. And return the
/// value when the callable function is called.
class ObjectIrisHandle extends IrisHandle {
/// Construct the [ObjectIrisHandle]
const ObjectIrisHandle(this._h);

final Object _h;

@override
Object call() {
return _h;
}
}

/// The [IrisHandle] of the iris's `IrisApiEngine`
class IrisApiEngineHandle extends ObjectIrisHandle {
/// Construct the [IrisApiEngineHandle]
const IrisApiEngineHandle(Object h) : super(h);
}

/// The [IrisHandle] of the iris's `ApiParam`
class IrisApiParamHandle extends ObjectIrisHandle {
/// Construct the [IrisApiParamHandle]
const IrisApiParamHandle(Object h) : super(h);
}

/// The [IrisHandle] of the iris's `IrisCEventHandler`
class IrisCEventHandlerHandle extends ObjectIrisHandle {
/// Construct the [IrisCEventHandlerHandle]
const IrisCEventHandlerHandle(Object h) : super(h);
}

/// The [IrisHandle] of the iris's `IrisEventHandler`
class IrisEventHandlerHandle extends ObjectIrisHandle {
/// Construct the [IrisEventHandlerHandle]
const IrisEventHandlerHandle(Object h) : super(h);
}

/// The [IrisHandle] of the `BufferParam`
class BufferParamHandle extends ObjectIrisHandle {
/// Construct the [BufferParamHandle]
const BufferParamHandle(Object h) : super(h);
}
Loading
Loading