Skip to content
Open
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
10 changes: 7 additions & 3 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ buildscript {
repositories {
google()
jcenter()
maven { url 'https://artifacts.netcore.co.in/artifactory/android' }
}

dependencies {
Expand All @@ -19,14 +20,15 @@ rootProject.allprojects {
google()
jcenter()
mavenCentral()
maven { url 'https://artifacts.netcore.co.in/artifactory/android' }
}
}

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

android {
compileSdkVersion 30
compileSdkVersion 32

sourceSets {
main.java.srcDirs += 'src/main/kotlin'
Expand All @@ -38,6 +40,8 @@ android {

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.netcore.android:smartech-sdk:3.1.4'
implementation 'androidx.work:work-runtime-ktx:2.5.0'
implementation 'com.netcore.android:smartech-sdk:3.2.30'
implementation 'com.netcore.android:smartech-push:3.2.16'
implementation 'com.netcore.android:smartech-appinbox:3.2.11'
implementation 'androidx.work:work-runtime-ktx:2.7.1'
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.netcore.flutter.smartech

import android.content.Context
import com.netcore.android.SMTFirebaseMessagingService
import com.netcore.android.smartechpush.SMTFirebaseMessagingService
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@ import android.location.LocationManager
import android.util.Log
import androidx.annotation.NonNull
import com.netcore.android.Smartech
import com.netcore.android.notification.SMTNotificationOptions
import com.netcore.android.notification.channel.SMTNotificationChannel
import com.netcore.android.smartechappinbox.SmartechAppInbox
import com.netcore.android.smartechappinbox.utility.SMTAppInboxMessageType
import com.netcore.android.smartechpush.SmartPush
import com.netcore.android.smartechpush.notification.SMTNotificationOptions
import com.netcore.android.smartechpush.notification.channel.SMTNotificationChannel
import com.netcore.flutter.smartech.SmartechHTMLlistener
import io.flutter.app.FlutterApplication
import io.flutter.embedding.android.FlutterActivity
Expand All @@ -34,6 +37,8 @@ class SmartechPlugin: FlutterPlugin, MethodCallHandler,ActivityAware,Application
private var activityBinding: ActivityPluginBinding? = null
private var activity:Activity? = null
private lateinit var smartech: Smartech
private lateinit var smartpush: SmartPush
private lateinit var smartechAppInbox: SmartechAppInbox
private lateinit var smartechHTMLlistener: SmartechHTMLlistener
lateinit var sBackgroundService:FlutterEngine
lateinit var channel : MethodChannel
Expand All @@ -60,6 +65,8 @@ class SmartechPlugin: FlutterPlugin, MethodCallHandler,ActivityAware,Application

channel.setMethodCallHandler(this)
smartech = Smartech.getInstance(WeakReference(context))
smartpush = SmartPush.getInstance(WeakReference(context))
smartechAppInbox = SmartechAppInbox.getInstance(WeakReference(applicationContext))
smartechHTMLlistener = SmartechHTMLlistener()
}

Expand Down Expand Up @@ -103,7 +110,7 @@ class SmartechPlugin: FlutterPlugin, MethodCallHandler,ActivityAware,Application

}
"fetchAlreadyGeneratedTokenFromFCM" -> {
smartech.fetchAlreadyGeneratedTokenFromFCM()
smartpush.fetchAlreadyGeneratedTokenFromFCM()

result.success("fetchAlreadyGeneratedTokenFromFCM set")

Expand Down Expand Up @@ -186,10 +193,10 @@ class SmartechPlugin: FlutterPlugin, MethodCallHandler,ActivityAware,Application
result.success(smartech.hasOptedTracking())
}
"optPushNotification" -> {
smartech.optPushNotification(call.arguments as Boolean)
smartpush.optPushNotification(call.arguments as Boolean)
}
"hasOptedPushNotification" -> {
result.success(smartech.hasOptedPushNotification())
result.success(smartpush.hasOptedPushNotification())
}
"optInAppMessage" -> {
smartech.optInAppMessage(call.arguments as Boolean)
Expand All @@ -206,10 +213,23 @@ class SmartechPlugin: FlutterPlugin, MethodCallHandler,ActivityAware,Application
result.success(smartech.getUserIdentity())
}
"getInboxMessageCount" -> {
result.success(smartech.getInboxMessageCount(call.arguments as Int))
val index = call.arguments as Int
var type = SMTAppInboxMessageType.INBOX_MESSAGE
when (index) {
0 -> {
type = SMTAppInboxMessageType.INBOX_MESSAGE
}
1 -> {
type = SMTAppInboxMessageType.READ_MESSAGE
}
2 -> {
type = SMTAppInboxMessageType.UNREAD_MESSAGE
}
}
result.success(smartechAppInbox.getAppInboxMessageCount(type))
}
"getDevicePushToken" -> {
result.success(smartech.getDevicePushToken())
result.success(smartpush.getDevicePushToken())
}
"openNativeWebView" -> {
openNativeWebView?.invoke()
Expand Down Expand Up @@ -305,7 +325,6 @@ class SmartechPlugin: FlutterPlugin, MethodCallHandler,ActivityAware,Application
}

private fun setInAppCustomHTMLListener() {
val options = SMTNotificationOptions(context)

smartech.setInAppCustomHTMLListener(smartechHTMLlistener)
}
Expand Down Expand Up @@ -337,21 +356,21 @@ activity = binding.activity
private fun setNotificationOptions(payload: HashMap<String, Any>) {
val option = SMTNotificationOptions(context)
if (payload["smallIconTransparentId"] != null) {
option.smallIconTransparentId = getIconResourceId(payload["smallIconTransparentId"] as String)
option.smallIconTransparent = getIconResourceId(payload["smallIconTransparentId"] as String).toString()
}
if (payload["largeIconId"] != null) {
option.largeIconId = getIconResourceId(payload["largeIconId"] as String)
option.largeIcon = getIconResourceId(payload["largeIconId"] as String).toString()
}
if (payload["placeHolderIcon"] != null) {
option.placeHolderIcon = getIconResourceId(payload["placeHolderIcon"] as String)
option.placeHolderIcon = getIconResourceId(payload["placeHolderIcon"] as String).toString()
}
if (payload["smallIconId"] != null) {
option.smallIconId = getIconResourceId(payload["smallIconId"] as String)
option.smallIcon = getIconResourceId(payload["smallIconId"] as String).toString()
}
if (payload["transparentIconBgColor"] != null) {
option.transparentIconBgColor = payload["transparentIconBgColor"] as String
}
smartech.setNotificationOptions(option)
smartpush.setNotificationOptions(option)
}

private fun createNotificationChannel(payload: HashMap<String, Any>) {
Expand All @@ -372,20 +391,20 @@ activity = binding.activity
builder.setNotificationSound(payload["Sound_File_Name"] as String)
}
val smtNotificationChannel: SMTNotificationChannel = builder.build()
smartech.createNotificationChannel(smtNotificationChannel)
smartpush.createNotificationChannel(smtNotificationChannel)

}

private fun createNotificationChannelGroup(payload: HashMap<String, Any>) {
smartech.createNotificationChannelGroup(payload["group_id"] as String, payload["group_name"] as String)
smartpush.createNotificationChannelGroup(payload["group_id"] as String, payload["group_name"] as String)
}

private fun deleteNotificationChannel(channelId: String) {
smartech.deleteNotificationChannel(channelId)
smartpush.deleteNotificationChannel(channelId)
}

private fun deleteNotificationChannelGroup(groupId: String) {
smartech.deleteNotificationChannelGroup(groupId)
smartpush.deleteNotificationChannelGroup(groupId)
}

private fun updateUserProfile(payload: HashMap<String, Any>) {
Expand Down Expand Up @@ -424,7 +443,7 @@ activity = binding.activity
var openUrl : ((url: String?)->Unit)? = null
lateinit var app:Application
fun setDevicePushToken(token: String) {
Smartech.getInstance(WeakReference(context)).setDevicePushToken(token)
SmartPush.getInstance(WeakReference(context)).setDevicePushToken(token)
}

fun initializePlugin(application: Application) {
Expand All @@ -436,7 +455,7 @@ activity = binding.activity
}

fun handlePushNotification(notificationData: String?) {
Smartech.getInstance(WeakReference(context)).handlePushNotification(notificationData)
SmartPush.getInstance(WeakReference(context)).handlePushNotification(notificationData)
}
fun trackAppInstallUpdateBySmartech() {
Smartech.getInstance(WeakReference(context)).trackAppInstallUpdateBySmartech()
Expand Down
4 changes: 2 additions & 2 deletions example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
compileSdkVersion 31
compileSdkVersion 33

sourceSets {
main.java.srcDirs += 'src/main/kotlin'
Expand All @@ -36,7 +36,7 @@ android {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.flutter.smartech.smartech_demo"
minSdkVersion 19
targetSdkVersion 30
targetSdkVersion 32
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
Expand Down
9 changes: 7 additions & 2 deletions example/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,16 @@
android:icon="@mipmap/ic_launcher"
android:label="smartech_demo"
android:usesCleartextTraffic="true">
<activity android:name=".BaseWebView"
<activity
android:exported="true"
android:name=".BaseWebView"
android:theme="@style/AppTheme"></activity>
<activity android:name=".WebView"
<activity
android:exported="true"
android:name=".WebView"
android:theme="@style/AppTheme"></activity>
<activity
android:exported="true"
android:name=".MainActivity"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
Expand Down
33 changes: 13 additions & 20 deletions example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ packages:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.8.2"
version: "2.9.0"
boolean_selector:
dependency: transitive
description:
Expand All @@ -21,21 +21,14 @@ packages:
name: characters
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.1"
version: "1.2.1"
clock:
dependency: transitive
description:
name: clock
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
version: "1.1.1"
collection:
dependency: transitive
description:
Expand All @@ -56,7 +49,7 @@ packages:
name: fake_async
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0"
version: "1.3.1"
ffi:
dependency: transitive
description:
Expand Down Expand Up @@ -176,28 +169,28 @@ packages:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.11"
version: "0.12.12"
material_color_utilities:
dependency: transitive
description:
name: material_color_utilities
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.4"
version: "0.1.5"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.dartlang.org"
source: hosted
version: "1.7.0"
version: "1.8.0"
path:
dependency: transitive
description:
name: path
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.1"
version: "1.8.2"
path_provider_linux:
dependency: transitive
description:
Expand Down Expand Up @@ -307,14 +300,14 @@ packages:
path: ".."
relative: true
source: path
version: "2.0.0"
version: "2.0.1"
source_span:
dependency: transitive
description:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.2"
version: "1.9.0"
stack_trace:
dependency: transitive
description:
Expand All @@ -335,21 +328,21 @@ packages:
name: string_scanner
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
version: "1.1.1"
term_glyph:
dependency: transitive
description:
name: term_glyph
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
version: "1.2.1"
test_api:
dependency: transitive
description:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.4.9"
version: "0.4.12"
typed_data:
dependency: transitive
description:
Expand Down