Skip to content

Commit

Permalink
feat: upgrade native to 1.5.x
Browse files Browse the repository at this point in the history
  • Loading branch information
LichKing-2234 committed Nov 30, 2022
1 parent 58f9c73 commit 69738fc
Show file tree
Hide file tree
Showing 35 changed files with 576 additions and 215 deletions.
35 changes: 26 additions & 9 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,13 +1,30 @@
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.dart_tool/
.atom/
.buildlog/
.history
.svn/
migrate_working_dir/

.packages
.pub/
# IntelliJ related
*.iml
*.ipr
*.iws
.idea/

# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/

# Flutter/Dart/Pub related
# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock.
/pubspec.lock
**/doc/api/
.dart_tool/
.packages
build/
*.lock
*.*~
example/*.lock
example/ios/Podfile.lock
.idea
*.iml
4 changes: 4 additions & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
include: package:flutter_lints/flutter.yaml

# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options
1 change: 1 addition & 0 deletions android/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
.DS_Store
/build
/captures
.cxx
34 changes: 16 additions & 18 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,54 +1,52 @@
group 'io.agora.agora_rtm'

def safeExtGet(prop, fallback) {
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
}
version '1.0-SNAPSHOT'

buildscript {
def kotlin_version = rootProject.ext.has('kotlin_version') ? rootProject.ext.get('kotlin_version') : '1.3.72'

ext.kotlin_version = '1.6.10'
repositories {
mavenCentral()
google()
mavenCentral()
}

dependencies {
classpath 'com.android.tools.build:gradle:7.1.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}

rootProject.allprojects {
repositories {
mavenCentral()
google()
mavenCentral()
}
}

apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'

android {
compileSdkVersion safeExtGet('compileSdkVersion', 28)
buildToolsVersion safeExtGet('buildToolsVersion', '28.0.3')
compileSdkVersion 31

defaultConfig {
minSdkVersion safeExtGet('minSdkVersion', 16)
targetSdkVersion safeExtGet('targetSdkVersion', 28)
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

consumerProguardFiles 'consumer-rules.pro'
kotlinOptions {
jvmTarget = '1.8'
}

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

lintOptions {
disable 'InvalidPackage'
defaultConfig {
minSdkVersion 16
}
}

dependencies {
api 'io.agora.rtm:rtm-sdk:1.4.10'
api 'io.agora.rtm:rtm-sdk:1.5.3'

implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:${safeExtGet('kotlin_version', '1.3.72')}"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
24 changes: 12 additions & 12 deletions android/src/main/kotlin/io/agora/agorartm/AgoraRtmPlugin.kt
Original file line number Diff line number Diff line change
Expand Up @@ -306,12 +306,12 @@ class AgoraRtmPlugin : FlutterPlugin, MethodCallHandler {
val message = client.createMessage()
message.text = text
val options = SendMessageOptions().apply {
(args["historical"] as? Boolean)?.let {
enableHistoricalMessaging = it
}
(args["offline"] as? Boolean)?.let {
enableOfflineMessaging = it
}
// (args["historical"] as? Boolean)?.let {
// enableHistoricalMessaging = it
// }
// (args["offline"] as? Boolean)?.let {
// enableOfflineMessaging = it
// }
}
client.sendMessageToPeer(peerId,
message,
Expand Down Expand Up @@ -1016,12 +1016,12 @@ class AgoraRtmPlugin : FlutterPlugin, MethodCallHandler {
val message = client.createMessage()
message.text = args?.get("message") as String
val options = SendMessageOptions().apply {
(args["historical"] as? Boolean)?.let {
enableHistoricalMessaging = it
}
(args["offline"] as? Boolean)?.let {
enableOfflineMessaging = it
}
// (args["historical"] as? Boolean)?.let {
// enableHistoricalMessaging = it
// }
// (args["offline"] as? Boolean)?.let {
// enableOfflineMessaging = it
// }
}
rtmChannel.sendMessage(message, options, object : ResultCallback<Void> {
override fun onSuccess(resp: Void?) {
Expand Down
8 changes: 0 additions & 8 deletions android/src/main/kotlin/io/agora/agorartm/RTMChannel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,6 @@ class RTMChannel : RtmChannelListener, EventChannel.StreamHandler {
)
}

override fun onImageMessageReceived(p0: RtmImageMessage?, p1: RtmChannelMember?) {
TODO("Not yet implemented")
}

override fun onFileMessageReceived(p0: RtmFileMessage?, p1: RtmChannelMember?) {
TODO("Not yet implemented")
}

override
fun onMemberJoined(member: RtmChannelMember) {
sendChannelEvent(
Expand Down
20 changes: 4 additions & 16 deletions android/src/main/kotlin/io/agora/agorartm/RTMClient.kt
Original file line number Diff line number Diff line change
Expand Up @@ -234,27 +234,15 @@ class RTMClient : RtmClientListener, EventChannel.StreamHandler, RtmCallEventLis
)
}

override fun onImageMessageReceivedFromPeer(p0: RtmImageMessage?, p1: String?) {
TODO("Not yet implemented")
}

override fun onFileMessageReceivedFromPeer(p0: RtmFileMessage?, p1: String?) {
TODO("Not yet implemented")
}

override fun onMediaUploadingProgress(p0: RtmMediaOperationProgress?, p1: Long) {
TODO("Not yet implemented")
}

override fun onMediaDownloadingProgress(p0: RtmMediaOperationProgress?, p1: Long) {
TODO("Not yet implemented")
}

override
fun onTokenExpired() {
sendClientEvent("onTokenExpired", hashMapOf())
}

override fun onTokenPrivilegeWillExpire() {
sendClientEvent("onTokenPrivilegeWillExpire", hashMapOf())
}

override
fun onListen(params: Any?, eventSink: EventChannel.EventSink) {
this.eventSink = eventSink
Expand Down
1 change: 1 addition & 0 deletions example/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
.buildlog/
.history
.svn/
migrate_working_dir/

# IntelliJ related
*.iml
Expand Down
29 changes: 29 additions & 0 deletions example/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# This file configures the analyzer, which statically analyzes Dart code to
# check for errors, warnings, and lints.
#
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
# invoked from the command line by running `flutter analyze`.

# The following line activates a set of recommended lints for Flutter apps,
# packages, and plugins designed to encourage good coding practices.
include: package:flutter_lints/flutter.yaml

linter:
# The lint rules applied to this project can be customized in the
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
# included above or to enable additional rules. A list of all available lints
# and their documentation is published at
# https://dart-lang.github.io/linter/lints/index.html.
#
# Instead of disabling a lint rule for the entire project in the
# section below, it can also be suppressed for a single line of code
# or a specific dart file by using the `// ignore: name_of_lint` and
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
# producing the lint.
rules:
# avoid_print: false # Uncomment to disable the `avoid_print` rule
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule

# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options
2 changes: 2 additions & 0 deletions example/android/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ GeneratedPluginRegistrant.java
# Remember to never publicly share your keystore.
# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
key.properties
**/*.keystore
**/*.jks
26 changes: 15 additions & 11 deletions example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,24 +26,31 @@ apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
compileSdkVersion 28
compileSdkVersion flutter.compileSdkVersion
ndkVersion flutter.ndkVersion

sourceSets {
main.java.srcDirs += 'src/main/kotlin'
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

kotlinOptions {
jvmTarget = '1.8'
}

lintOptions {
disable 'InvalidPackage'
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 "io.agora.agora_rtm_example"
minSdkVersion 16
targetSdkVersion 28
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
minSdkVersion flutter.minSdkVersion
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

buildTypes {
Expand All @@ -61,7 +68,4 @@ flutter {

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
}
3 changes: 2 additions & 1 deletion example/android/app/src/debug/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="io.agora.agora_rtm_example">
<!-- Flutter needs it to communicate with the running application
<!-- The INTERNET permission is required for development. Specifically,
the Flutter tool needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
<uses-permission android:name="android.permission.INTERNET"/>
Expand Down
22 changes: 4 additions & 18 deletions example/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="io.agora.agora_rtm_example">

<!-- io.flutter.app.FlutterApplication is an android.app.Application that
calls FlutterMain.startInitialization(this); in its onCreate method.
In most cases you can leave this as-is, but you if you want to provide
additional functionality it is fine to subclass or reimplement
FlutterApplication and put your custom class here. -->
<application
android:name="io.flutter.app.FlutterApplication"
<application
android:label="agora_rtm_example"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher">
<activity
android:name=".MainActivity"
android:exported="true"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
Expand All @@ -25,15 +20,6 @@
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme"
/>
<!-- Displays an Android View that continues showing the launch screen
Drawable until Flutter paints its first frame, then this splash
screen fades out. A splash screen is useful to avoid any visual
gap between the end of Android's launch screen and the painting of
Flutter's first frame. -->
<meta-data
android:name="io.flutter.embedding.android.SplashScreenDrawable"
android:resource="@drawable/launch_background"
/>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
Expand All @@ -45,4 +31,4 @@
android:name="flutterEmbedding"
android:value="2" />
</application>
</manifest>
</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ package io.agora.agora_rtm_example

import io.flutter.embedding.android.FlutterActivity

class MainActivity : FlutterActivity() {
class MainActivity: FlutterActivity() {
}
4 changes: 2 additions & 2 deletions example/android/app/src/main/res/values-night/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is on -->
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
<!-- Show a splash screen on the activity. Automatically removed when
Flutter draws its first frame -->
the Flutter engine draws its first frame -->
<item name="android:windowBackground">@drawable/launch_background</item>
</style>
<!-- Theme applied to the Android Window as soon as the process has started.
Expand All @@ -15,4 +15,4 @@
<style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar">
<item name="android:windowBackground">?android:colorBackground</item>
</style>
</resources>
</resources>
12 changes: 6 additions & 6 deletions example/android/app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Theme applied to the Android Window while the process is starting -->
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is off -->
<style name="LaunchTheme" parent="@android:style/Theme.Light.NoTitleBar">
<!-- Show a splash screen on the activity. Automatically removed when
Flutter draws its first frame -->
the Flutter engine draws its first frame -->
<item name="android:windowBackground">@drawable/launch_background</item>
</style>
<!-- Theme applied to the Android Window as soon as the process has started.
Expand All @@ -12,7 +12,7 @@
running.
This Theme is only used starting with V2 of Flutter's Android embedding. -->
<style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar">
<item name="android:windowBackground">@android:color/white</item>
<style name="NormalTheme" parent="@android:style/Theme.Light.NoTitleBar">
<item name="android:windowBackground">?android:colorBackground</item>
</style>
</resources>
</resources>

0 comments on commit 69738fc

Please sign in to comment.