diff --git a/.gitignore b/.gitignore
index e9dc58d3..0fa6b675 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,7 +1,46 @@
+# Miscellaneous
+*.class
+*.log
+*.pyc
+*.swp
.DS_Store
-.dart_tool/
+.atom/
+.buildlog/
+.history
+.svn/
+
+# 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
+**/doc/api/
+**/ios/Flutter/.last_build_id
+.dart_tool/
+.flutter-plugins
+.flutter-plugins-dependencies
.packages
+.pub-cache/
.pub/
+/build/
+
+# Web related
+lib/generated_plugin_registrant.dart
+
+# Symbolication related
+app.*.symbols
+
+# Obfuscation related
+app.*.map.json
-build/
+# Android Studio will place build artifacts here
+/android/app/debug
+/android/app/profile
+/android/app/release
diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml
deleted file mode 100644
index 681f41ae..00000000
--- a/.idea/codeStyles/Project.xml
+++ /dev/null
@@ -1,116 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
- xmlns:android
-
- ^$
-
-
-
-
-
-
-
-
- xmlns:.*
-
- ^$
-
-
- BY_NAME
-
-
-
-
-
-
- .*:id
-
- http://schemas.android.com/apk/res/android
-
-
-
-
-
-
-
-
- .*:name
-
- http://schemas.android.com/apk/res/android
-
-
-
-
-
-
-
-
- name
-
- ^$
-
-
-
-
-
-
-
-
- style
-
- ^$
-
-
-
-
-
-
-
-
- .*
-
- ^$
-
-
- BY_NAME
-
-
-
-
-
-
- .*
-
- http://schemas.android.com/apk/res/android
-
-
- ANDROID_ATTRIBUTE_ORDER
-
-
-
-
-
-
- .*
-
- .*
-
-
- BY_NAME
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Dart_SDK.xml b/.idea/libraries/Dart_SDK.xml
deleted file mode 100644
index 0febb736..00000000
--- a/.idea/libraries/Dart_SDK.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Flutter_Plugins.xml b/.idea/libraries/Flutter_Plugins.xml
deleted file mode 100644
index a0d49784..00000000
--- a/.idea/libraries/Flutter_Plugins.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Flutter_for_Android.xml b/.idea/libraries/Flutter_for_Android.xml
deleted file mode 100644
index 9fa1aab8..00000000
--- a/.idea/libraries/Flutter_for_Android.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
-
-
-
diff --git a/.idea/misc.xml b/.idea/misc.xml
deleted file mode 100644
index c8842e1d..00000000
--- a/.idea/misc.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
deleted file mode 100644
index ac0a95e4..00000000
--- a/.idea/modules.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
-
-
-
-
-
diff --git a/.idea/runConfigurations/example_lib_main_dart.xml b/.idea/runConfigurations/example_lib_main_dart.xml
deleted file mode 100644
index bac2c8a7..00000000
--- a/.idea/runConfigurations/example_lib_main_dart.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
deleted file mode 100644
index 22dcf6fa..00000000
--- a/.idea/vcs.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
deleted file mode 100644
index 07b11508..00000000
--- a/.idea/workspace.xml
+++ /dev/null
@@ -1,338 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 1575884091134
-
-
- 1575884091134
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f25d02b8..bc254b94 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 2.2.0
+
+- Update android to target 31
+
## 2.1.1
- Val reassign error fix
diff --git a/android/.idea/codeStyles/Project.xml b/android/.idea/codeStyles/Project.xml
deleted file mode 100644
index 681f41ae..00000000
--- a/android/.idea/codeStyles/Project.xml
+++ /dev/null
@@ -1,116 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
- xmlns:android
-
- ^$
-
-
-
-
-
-
-
-
- xmlns:.*
-
- ^$
-
-
- BY_NAME
-
-
-
-
-
-
- .*:id
-
- http://schemas.android.com/apk/res/android
-
-
-
-
-
-
-
-
- .*:name
-
- http://schemas.android.com/apk/res/android
-
-
-
-
-
-
-
-
- name
-
- ^$
-
-
-
-
-
-
-
-
- style
-
- ^$
-
-
-
-
-
-
-
-
- .*
-
- ^$
-
-
- BY_NAME
-
-
-
-
-
-
- .*
-
- http://schemas.android.com/apk/res/android
-
-
- ANDROID_ATTRIBUTE_ORDER
-
-
-
-
-
-
- .*
-
- .*
-
-
- BY_NAME
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/android/.idea/gradle.xml b/android/.idea/gradle.xml
deleted file mode 100644
index b68060b9..00000000
--- a/android/.idea/gradle.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/android/.idea/misc.xml b/android/.idea/misc.xml
deleted file mode 100644
index 48725873..00000000
--- a/android/.idea/misc.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/android/.idea/modules.xml b/android/.idea/modules.xml
deleted file mode 100644
index e54e28e5..00000000
--- a/android/.idea/modules.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/android/.idea/runConfigurations.xml b/android/.idea/runConfigurations.xml
deleted file mode 100644
index 7f68460d..00000000
--- a/android/.idea/runConfigurations.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/android/.idea/vcs.xml b/android/.idea/vcs.xml
deleted file mode 100644
index 6c0b8635..00000000
--- a/android/.idea/vcs.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/android/build.gradle b/android/build.gradle
index 4f75b607..8578b118 100644
--- a/android/build.gradle
+++ b/android/build.gradle
@@ -2,14 +2,14 @@ group 'com.shekarmudaliyar.social_share'
version '1.0-SNAPSHOT'
buildscript {
- ext.kotlin_version = '1.3.50'
+ ext.kotlin_version = '1.5.31'
repositories {
google()
- jcenter()
+ mavenCentral()
}
dependencies {
- classpath 'com.android.tools.build:gradle:3.5.0'
+ classpath 'com.android.tools.build:gradle:3.5.4'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
@@ -17,7 +17,7 @@ buildscript {
rootProject.allprojects {
repositories {
google()
- jcenter()
+ mavenCentral()
}
}
@@ -25,7 +25,7 @@ apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
android {
- compileSdkVersion 28
+ compileSdkVersion 31
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
diff --git a/android/gradle.properties b/android/gradle.properties
index 38c8d454..4b98d933 100644
--- a/android/gradle.properties
+++ b/android/gradle.properties
@@ -2,3 +2,5 @@ org.gradle.jvmargs=-Xmx1536M
android.enableR8=true
android.useAndroidX=true
android.enableJetifier=true
+kotlin.code.style=official
+file.encoding=utf-8
\ No newline at end of file
diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties
index 019065d1..297f2fec 100644
--- a/android/gradle/wrapper/gradle-wrapper.properties
+++ b/android/gradle/wrapper/gradle-wrapper.properties
@@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip
diff --git a/android/src/main/AndroidManifest.xml b/android/src/main/AndroidManifest.xml
index d754bee7..5dd9f6fe 100644
--- a/android/src/main/AndroidManifest.xml
+++ b/android/src/main/AndroidManifest.xml
@@ -1,4 +1 @@
-
-
+
diff --git a/android/src/main/kotlin/com/shekarmudaliyar/social_share/SocialSharePlugin.kt b/android/src/main/kotlin/com/shekarmudaliyar/social_share/SocialSharePlugin.kt
index e76adbd8..b5f124cc 100644
--- a/android/src/main/kotlin/com/shekarmudaliyar/social_share/SocialSharePlugin.kt
+++ b/android/src/main/kotlin/com/shekarmudaliyar/social_share/SocialSharePlugin.kt
@@ -7,9 +7,7 @@ import android.content.pm.ResolveInfo
import android.net.Uri
import android.os.Build
import android.util.Log
-import androidx.annotation.NonNull
import androidx.annotation.RequiresApi
-import androidx.core.content.ContextCompat.startActivity
import androidx.core.content.FileProvider
import io.flutter.plugin.common.MethodCall
import io.flutter.plugin.common.MethodChannel
@@ -19,196 +17,277 @@ import io.flutter.plugin.common.PluginRegistry.Registrar
import java.io.File
/** SocialSharePlugin */
-class SocialSharePlugin(private val registrar: Registrar): MethodCallHandler {
-
- companion object {
- @JvmStatic
- fun registerWith(registrar: Registrar) {
- val channel = MethodChannel(registrar.messenger(), "social_share")
- channel.setMethodCallHandler(SocialSharePlugin(registrar))
- }
- }
+class SocialSharePlugin(private val registrar: Registrar) : MethodCallHandler {
@RequiresApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
- override fun onMethodCall(@NonNull call: MethodCall, @NonNull result: Result) {
- if (call.method == "shareInstagramStory") {
- //share on instagram story
- val stickerImage: String? = call.argument("stickerImage")
- val backgroundImage: String? = call.argument("backgroundImage")
-
- val backgroundTopColor: String? = call.argument("backgroundTopColor")
- val backgroundBottomColor: String? = call.argument("backgroundBottomColor")
- val attributionURL: String? = call.argument("attributionURL")
- val file = File(registrar.activeContext().cacheDir,stickerImage)
- val stickerImageFile = FileProvider.getUriForFile(registrar.activeContext(), registrar.activeContext().applicationContext.packageName + ".com.shekarmudaliyar.social_share", file)
-
- val intent = Intent("com.instagram.share.ADD_TO_STORY")
- intent.type = "image/*"
- intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
- intent.putExtra("interactive_asset_uri", stickerImageFile)
- if (backgroundImage!=null) {
- //check if background image is also provided
- val backfile = File(registrar.activeContext().cacheDir,backgroundImage)
- val backgroundImageFile = FileProvider.getUriForFile(registrar.activeContext(), registrar.activeContext().applicationContext.packageName + ".com.shekarmudaliyar.social_share", backfile)
- intent.setDataAndType(backgroundImageFile,"image/*")
+ override fun onMethodCall(call: MethodCall, result: Result) {
+ when (call.method) {
+ "shareInstagramStory" -> {
+ val stickerImage: String? = call.argument("stickerImage")
+ val backgroundImage: String? = call.argument("backgroundImage")
+ val backgroundTopColor: String? = call.argument("backgroundTopColor")
+ val backgroundBottomColor: String? = call.argument("backgroundBottomColor")
+ val attributionURL: String? = call.argument("attributionURL")
+
+ val activity: Activity = registrar.activity()
+ Log.d(TAG, "$activity")
+
+ val intent = Intent("com.instagram.share.ADD_TO_STORY")
+ intent.type = "image/*"
+ intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
+ intent.putExtra("content_url", attributionURL)
+ intent.putExtra("top_background_color", backgroundTopColor)
+ intent.putExtra("bottom_background_color", backgroundBottomColor)
+
+ if (stickerImage != null) {
+ val file = File(activity.cacheDir, stickerImage)
+ val uri = FileProvider.getUriForFile(
+ activity,
+ "${activity.packageName}.com.shekarmudaliyar.social_share",
+ file,
+ )
+ activity.grantUriPermission(
+ "com.instagram.android",
+ uri,
+ Intent.FLAG_GRANT_READ_URI_PERMISSION,
+ )
+ intent.putExtra("interactive_asset_uri", uri)
+ }
+
+ if (backgroundImage != null) {
+ val file = File(activity.cacheDir, backgroundImage)
+ val uri = FileProvider.getUriForFile(
+ activity,
+ "${activity.packageName}.com.shekarmudaliyar.social_share",
+ file,
+ )
+ activity.grantUriPermission(
+ "com.instagram.android",
+ uri,
+ Intent.FLAG_GRANT_READ_URI_PERMISSION,
+ )
+ intent.setDataAndType(uri, "image/*")
+ }
+
+ try {
+ activity.startActivity(intent)
+ } catch (e: Exception) {
+ result.success("error")
+ Log.e(TAG, "error", e)
+ return
+ }
+ result.success("success")
}
+ "shareFacebookStory" -> {
+ val stickerImage: String? = call.argument("stickerImage")
+ val backgroundTopColor: String? = call.argument("backgroundTopColor")
+ val backgroundBottomColor: String? = call.argument("backgroundBottomColor")
+ val attributionURL: String? = call.argument("attributionURL")
+ val appId: String? = call.argument("appId")
+
+ val activity: Activity = registrar.activity()
+ Log.d(TAG, "$activity")
+
+ val intent = Intent("com.facebook.stories.ADD_TO_STORY")
+ intent.type = "image/*"
+ intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
+ intent.putExtra("com.facebook.platform.extra.APPLICATION_ID", appId)
+ intent.putExtra("content_url", attributionURL)
+ intent.putExtra("top_background_color", backgroundTopColor)
+ intent.putExtra("bottom_background_color", backgroundBottomColor)
+
+ if (stickerImage != null) {
+ val file = File(activity.cacheDir, stickerImage)
+ val uri = FileProvider.getUriForFile(
+ activity,
+ "${activity.packageName}.com.shekarmudaliyar.social_share",
+ file,
+ )
+ intent.putExtra("interactive_asset_uri", uri)
+ activity.grantUriPermission(
+ "com.facebook.katana",
+ uri,
+ Intent.FLAG_GRANT_READ_URI_PERMISSION
+ )
+ }
- intent.putExtra("content_url", attributionURL)
- intent.putExtra("top_background_color", backgroundTopColor)
- intent.putExtra("bottom_background_color", backgroundBottomColor)
- Log.d("", registrar.activity().toString())
- // Instantiate activity and verify it will resolve implicit intent
- val activity: Activity = registrar.activity()
- activity.grantUriPermission("com.instagram.android", stickerImageFile, Intent.FLAG_GRANT_READ_URI_PERMISSION)
- if (activity.packageManager.resolveActivity(intent, 0) != null) {
- registrar.activeContext().startActivity(intent)
+ try {
+ activity.startActivity(intent)
+ } catch (e: Exception) {
+ result.success("error")
+ Log.e(TAG, "error", e)
+ return
+ }
result.success("success")
- } else {
- result.success("error")
}
- } else if (call.method == "shareFacebookStory") {
- //share on facebook story
- val stickerImage: String? = call.argument("stickerImage")
- val backgroundTopColor: String? = call.argument("backgroundTopColor")
- val backgroundBottomColor: String? = call.argument("backgroundBottomColor")
- val attributionURL: String? = call.argument("attributionURL")
- val appId: String? = call.argument("appId")
-
- val file = File(registrar.activeContext().cacheDir,stickerImage)
- val stickerImageFile = FileProvider.getUriForFile(registrar.activeContext(), registrar.activeContext().applicationContext.packageName + ".com.shekarmudaliyar.social_share", file)
- val intent = Intent("com.facebook.stories.ADD_TO_STORY")
- intent.type = "image/*"
- intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
- intent.putExtra("com.facebook.platform.extra.APPLICATION_ID", appId)
- intent.putExtra("interactive_asset_uri", stickerImageFile)
- intent.putExtra("content_url", attributionURL)
- intent.putExtra("top_background_color", backgroundTopColor)
- intent.putExtra("bottom_background_color", backgroundBottomColor)
- Log.d("", registrar.activity().toString())
- // Instantiate activity and verify it will resolve implicit intent
- val activity: Activity = registrar.activity()
- activity.grantUriPermission("com.facebook.katana", stickerImageFile, Intent.FLAG_GRANT_READ_URI_PERMISSION)
- if (activity.packageManager.resolveActivity(intent, 0) != null) {
- registrar.activeContext().startActivity(intent)
+ "shareOptions" -> {
+ val content: String? = call.argument("content")
+ val image: String? = call.argument("image")
+
+ val activity: Activity = registrar.activity()
+ Log.d(TAG, "$activity")
+
+ val intent = Intent()
+ intent.action = Intent.ACTION_SEND
+ intent.putExtra(Intent.EXTRA_TEXT, content)
+
+ if (image != null) {
+ val file = File(registrar.activeContext().cacheDir, image)
+ val imageFileUri = FileProvider.getUriForFile(
+ registrar.activeContext(),
+ "${activity.packageName}.com.shekarmudaliyar.social_share",
+ file,
+ )
+ intent.type = "image/*"
+ intent.putExtra(Intent.EXTRA_STREAM, imageFileUri)
+ } else {
+ intent.type = "text/plain"
+ }
+
+ val chooserIntent: Intent = Intent.createChooser(intent, null)
+
+ try {
+ activity.startActivity(chooserIntent)
+ } catch (e: Exception) {
+ result.success("error")
+ Log.e(TAG, "error", e)
+ return
+ }
result.success("success")
- } else {
- result.success("error")
+
}
- } else if (call.method == "shareOptions") {
- //native share options
- val content: String? = call.argument("content")
- val image: String? = call.argument("image")
- val intent = Intent()
- intent.action = Intent.ACTION_SEND
-
- if (image!=null) {
- //check if image is also provided
- val imagefile = File(registrar.activeContext().cacheDir,image)
- val imageFileUri = FileProvider.getUriForFile(registrar.activeContext(), registrar.activeContext().applicationContext.packageName + ".com.shekarmudaliyar.social_share", imagefile)
- intent.type = "image/*"
- intent.putExtra(Intent.EXTRA_STREAM,imageFileUri)
- } else {
- intent.type = "text/plain";
+ "copyToClipboard" -> {
+ val content: String? = call.argument("content")
+
+ val clipboard =
+ registrar.context().getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
+ val clip = ClipData.newPlainText("", content)
+ clipboard.setPrimaryClip(clip)
+ result.success(true)
}
+ "shareWhatsapp" -> {
+ val content: String? = call.argument("content")
+
+ val intent = Intent(Intent.ACTION_SEND)
+ intent.type = "text/plain"
+ intent.setPackage("com.whatsapp")
+ intent.putExtra(Intent.EXTRA_TEXT, content)
- intent.putExtra(Intent.EXTRA_TEXT, content)
-
- //create chooser intent to launch intent
- //source: "share" package by flutter (https://github.com/flutter/plugins/blob/master/packages/share/)
- val chooserIntent: Intent = Intent.createChooser(intent, null /* dialog title optional */)
-
- registrar.activeContext().startActivity(chooserIntent)
- result.success(true)
-
- } else if (call.method == "copyToClipboard") {
- //copies content onto the clipboard
- val content: String? = call.argument("content")
- val clipboard =registrar.context().getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
- val clip = ClipData.newPlainText("", content)
- clipboard.setPrimaryClip(clip)
- result.success(true)
- } else if (call.method == "shareWhatsapp") {
- //shares content on WhatsApp
- val content: String? = call.argument("content")
- val whatsappIntent = Intent(Intent.ACTION_SEND)
- whatsappIntent.type = "text/plain"
- whatsappIntent.setPackage("com.whatsapp")
- whatsappIntent.putExtra(Intent.EXTRA_TEXT, content)
- try {
- registrar.activity().startActivity(whatsappIntent)
- result.success("true")
- } catch (ex: ActivityNotFoundException) {
- result.success("false")
+ val activity: Activity = registrar.activity()
+ Log.d(TAG, "$activity")
+
+ try {
+ activity.startActivity(intent)
+ } catch (e: Exception) {
+ result.success("error")
+ Log.e(TAG, "error", e)
+ return
+ }
+ result.success("success")
}
- } else if (call.method == "shareSms") {
- //shares content on sms
- val content: String? = call.argument("message")
- val intent = Intent(Intent.ACTION_SENDTO)
- intent.addCategory(Intent.CATEGORY_DEFAULT)
- intent.type = "vnd.android-dir/mms-sms"
- intent.data = Uri.parse("sms:" )
- intent.putExtra("sms_body", content)
- try {
- registrar.activity().startActivity(intent)
- result.success("true")
- } catch (ex: ActivityNotFoundException) {
- result.success("false")
+ "shareSms" -> {
+ val content: String? = call.argument("message")
+
+ val intent = Intent(Intent.ACTION_SENDTO)
+ intent.addCategory(Intent.CATEGORY_DEFAULT)
+ intent.type = "vnd.android-dir/mms-sms"
+ intent.data = Uri.parse("sms:")
+ intent.putExtra("sms_body", content)
+
+ val activity: Activity = registrar.activity()
+ Log.d(TAG, "$activity")
+
+ try {
+ activity.startActivity(intent)
+ } catch (e: Exception) {
+ result.success("error")
+ Log.e(TAG, "error", e)
+ return
+ }
+ result.success("success")
}
- } else if (call.method == "shareTwitter") {
- //shares content on twitter
- val text: String? = call.argument("captionText")
- val url: String? = call.argument("url")
- val trailingText: String? = call.argument("trailingText")
- val urlScheme = "http://www.twitter.com/intent/tweet?text=$text$url$trailingText"
- Log.d("log",urlScheme)
- val intent = Intent(Intent.ACTION_VIEW)
- intent.data = Uri.parse(urlScheme)
- try {
- registrar.activity().startActivity(intent)
- result.success("true")
- } catch (ex: ActivityNotFoundException) {
- result.success("false")
+ "shareTwitter" -> {
+ val text: String? = call.argument("captionText")
+ val url: String? = call.argument("url")
+ val trailingText: String? = call.argument("trailingText")
+ val urlScheme = "http://www.twitter.com/intent/tweet?text=$text$url$trailingText"
+ Log.d("log", urlScheme)
+ val intent = Intent(Intent.ACTION_VIEW)
+ intent.data = Uri.parse(urlScheme)
+
+ val activity: Activity = registrar.activity()
+ Log.d(TAG, "$activity")
+
+ try {
+ activity.startActivity(intent)
+ } catch (e: Exception) {
+ result.success("error")
+ Log.e(TAG, "error", e)
+ return
+ }
+ result.success("success")
}
- }
- else if (call.method == "shareTelegram") {
- //shares content on Telegram
- val content: String? = call.argument("content")
- val telegramIntent = Intent(Intent.ACTION_SEND)
- telegramIntent.type = "text/plain"
- telegramIntent.setPackage("org.telegram.messenger")
- telegramIntent.putExtra(Intent.EXTRA_TEXT, content)
- try {
- registrar.activity().startActivity(telegramIntent)
- result.success("true")
- } catch (ex: ActivityNotFoundException) {
- result.success("false")
+ "shareTelegram" -> {
+ val content: String? = call.argument("content")
+ val intent = Intent(Intent.ACTION_SEND)
+ intent.type = "text/plain"
+ intent.setPackage("org.telegram.messenger")
+ intent.putExtra(Intent.EXTRA_TEXT, content)
+
+ val activity: Activity = registrar.activity()
+ Log.d(TAG, "$activity")
+
+ try {
+ activity.startActivity(intent)
+ } catch (e: Exception) {
+ result.success("error")
+ Log.e(TAG, "error", e)
+ return
+ }
+ result.success("success")
+ }
+ "checkInstalledApps" -> {
+ //check if the apps exists
+ //creating a mutable map of apps
+ val apps: MutableMap = mutableMapOf()
+ //assigning package manager
+ val pm: PackageManager = registrar.context().packageManager
+ //get a list of installed apps.
+ val packages = pm.getInstalledApplications(PackageManager.GET_META_DATA)
+ //intent to check sms app exists
+ val intent = Intent(Intent.ACTION_SENDTO).addCategory(Intent.CATEGORY_DEFAULT)
+ intent.type = "vnd.android-dir/mms-sms"
+ intent.data = Uri.parse("sms:")
+ val resolvedActivities: List = pm.queryIntentActivities(intent, 0)
+ //if sms app exists
+ apps["sms"] = resolvedActivities.isNotEmpty()
+ //if other app exists
+ apps["instagram"] =
+ packages.any { it.packageName.toString().contentEquals("com.instagram.android") }
+ apps["facebook"] =
+ packages.any { it.packageName.toString().contentEquals("com.facebook.katana") }
+ apps["twitter"] =
+ packages.any { it.packageName.toString().contentEquals("com.twitter.android") }
+ apps["whatsapp"] =
+ packages.any { it.packageName.toString().contentEquals("com.whatsapp") }
+ apps["telegram"] =
+ packages.any { it.packageName.toString().contentEquals("org.telegram.messenger") }
+
+ result.success(apps)
+ }
+ else -> {
+ result.notImplemented()
}
}
- else if (call.method == "checkInstalledApps") {
- //check if the apps exists
- //creating a mutable map of apps
- var apps:MutableMap = mutableMapOf()
- //assigning package manager
- val pm: PackageManager =registrar.context().packageManager
- //get a list of installed apps.
- val packages = pm.getInstalledApplications(PackageManager.GET_META_DATA)
- //intent to check sms app exists
- val intent = Intent(Intent.ACTION_SENDTO).addCategory(Intent.CATEGORY_DEFAULT)
- intent.type = "vnd.android-dir/mms-sms"
- intent.data = Uri.parse("sms:" )
- val resolvedActivities: List = pm.queryIntentActivities(intent, 0)
- //if sms app exists
- apps["sms"] = resolvedActivities.isNotEmpty()
- //if other app exists
- apps["instagram"] = packages.any { it.packageName.toString().contentEquals("com.instagram.android") }
- apps["facebook"] = packages.any { it.packageName.toString().contentEquals("com.facebook.katana") }
- apps["twitter"] = packages.any { it.packageName.toString().contentEquals("com.twitter.android") }
- apps["whatsapp"] = packages.any { it.packageName.toString().contentEquals("com.whatsapp") }
- apps["telegram"] = packages.any { it.packageName.toString().contentEquals("org.telegram.messenger") }
-
- result.success(apps)
- } else {
- result.notImplemented()
+ }
+
+ private companion object {
+ private val TAG = SocialSharePlugin::class.java.name
+
+ @JvmStatic
+ fun registerWith(registrar: Registrar) {
+ val channel = MethodChannel(registrar.messenger(), "social_share")
+ channel.setMethodCallHandler(SocialSharePlugin(registrar))
}
}
}
diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle
index 4e4386f0..1ca012a9 100644
--- a/example/android/app/build.gradle
+++ b/example/android/app/build.gradle
@@ -26,7 +26,7 @@ apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
- compileSdkVersion 28
+ compileSdkVersion 31
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
@@ -37,10 +37,9 @@ android {
}
defaultConfig {
- // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.shekarmudaliyar.social_share_example"
minSdkVersion 16
- targetSdkVersion 28
+ targetSdkVersion 31
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
@@ -48,8 +47,6 @@ android {
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
}
}
@@ -61,7 +58,4 @@ flutter {
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
- testImplementation 'junit:junit:4.12'
- androidTestImplementation 'androidx.test:runner:1.1.1'
- androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
}
diff --git a/example/android/app/src/debug/AndroidManifest.xml b/example/android/app/src/debug/AndroidManifest.xml
deleted file mode 100644
index c9e6754d..00000000
--- a/example/android/app/src/debug/AndroidManifest.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
diff --git a/example/android/app/src/main/AndroidManifest.xml b/example/android/app/src/main/AndroidManifest.xml
index f415224a..692e300d 100644
--- a/example/android/app/src/main/AndroidManifest.xml
+++ b/example/android/app/src/main/AndroidManifest.xml
@@ -1,30 +1,27 @@
-
+
+
+ android:allowBackup="false"
+ android:icon="@mipmap/ic_launcher"
+ android:label="social_share_example">
-
-
+
+
-
diff --git a/example/android/app/src/main/kotlin/com/shekarmudaliyar/social_share_example/MainActivity.kt b/example/android/app/src/main/kotlin/com/shekarmudaliyar/social_share_example/MainActivity.kt
index e870df8c..03e7c014 100644
--- a/example/android/app/src/main/kotlin/com/shekarmudaliyar/social_share_example/MainActivity.kt
+++ b/example/android/app/src/main/kotlin/com/shekarmudaliyar/social_share_example/MainActivity.kt
@@ -1,12 +1,11 @@
package com.shekarmudaliyar.social_share_example
-import androidx.annotation.NonNull;
import io.flutter.embedding.android.FlutterActivity
import io.flutter.embedding.engine.FlutterEngine
import io.flutter.plugins.GeneratedPluginRegistrant
-class MainActivity: FlutterActivity() {
- override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) {
+class MainActivity : FlutterActivity() {
+ override fun configureFlutterEngine(flutterEngine: FlutterEngine) {
GeneratedPluginRegistrant.registerWith(flutterEngine);
}
}
diff --git a/example/android/app/src/main/res/xml/filepaths.xml b/example/android/app/src/main/res/xml/filepaths.xml
index c0f3b318..825d0530 100644
--- a/example/android/app/src/main/res/xml/filepaths.xml
+++ b/example/android/app/src/main/res/xml/filepaths.xml
@@ -1,4 +1,6 @@
-
-
+
+
\ No newline at end of file
diff --git a/example/android/app/src/profile/AndroidManifest.xml b/example/android/app/src/profile/AndroidManifest.xml
deleted file mode 100644
index c9e6754d..00000000
--- a/example/android/app/src/profile/AndroidManifest.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
diff --git a/example/android/build.gradle b/example/android/build.gradle
index 232bc0d6..319ffbb0 100644
--- a/example/android/build.gradle
+++ b/example/android/build.gradle
@@ -1,12 +1,12 @@
buildscript {
- ext.kotlin_version = '1.3.50'
+ ext.kotlin_version = '1.5.31'
repositories {
google()
- jcenter()
+ mavenCentral()
}
dependencies {
- classpath 'com.android.tools.build:gradle:3.5.3'
+ classpath 'com.android.tools.build:gradle:7.0.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
@@ -14,7 +14,7 @@ buildscript {
allprojects {
repositories {
google()
- jcenter()
+ mavenCentral()
}
}
diff --git a/example/android/gradle.properties b/example/android/gradle.properties
index 38c8d454..4b98d933 100644
--- a/example/android/gradle.properties
+++ b/example/android/gradle.properties
@@ -2,3 +2,5 @@ org.gradle.jvmargs=-Xmx1536M
android.enableR8=true
android.useAndroidX=true
android.enableJetifier=true
+kotlin.code.style=official
+file.encoding=utf-8
\ No newline at end of file
diff --git a/example/android/gradle/wrapper/gradle-wrapper.properties b/example/android/gradle/wrapper/gradle-wrapper.properties
index 296b146b..b8793d3c 100644
--- a/example/android/gradle/wrapper/gradle-wrapper.properties
+++ b/example/android/gradle/wrapper/gradle-wrapper.properties
@@ -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-5.6.2-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip
diff --git a/example/lib/main.dart b/example/lib/main.dart
index d569f7ea..d8e26dcf 100644
--- a/example/lib/main.dart
+++ b/example/lib/main.dart
@@ -1,8 +1,7 @@
-import 'dart:io';
-
+import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:image_picker/image_picker.dart';
-import 'dart:async';
+import 'package:path_provider/path_provider.dart';
import 'package:screenshot/screenshot.dart';
import 'package:social_share/social_share.dart';
@@ -14,182 +13,220 @@ class MyApp extends StatefulWidget {
}
class _MyAppState extends State {
- String _platformVersion = 'Unknown';
+ final screenshotController = ScreenshotController();
@override
- void initState() {
- super.initState();
- initPlatformState();
+ Widget build(BuildContext context) {
+ return MaterialApp(
+ home: Scaffold(
+ appBar: _appBar(),
+ body: _body(),
+ ),
+ );
}
- Future initPlatformState() async {
- String platformVersion;
+ AppBar _appBar() {
+ return AppBar(title: const Text('Plugin example app'));
+ }
- if (!mounted) return;
+ Widget _body() {
+ return Screenshot(
+ controller: screenshotController,
+ child: Container(
+ color: Colors.white,
+ alignment: Alignment.center,
+ child: Column(
+ mainAxisAlignment: MainAxisAlignment.center,
+ crossAxisAlignment: CrossAxisAlignment.center,
+ children: [
+ _title(),
+ _toInstagramStory(),
+ _toInstagramStoryWithBackground(),
+ _toFacebookStory(),
+ _copyToClipboard(),
+ _toTwitter(),
+ _toSms(),
+ _shareOptions(),
+ _toWhatsapp(),
+ _toTelegram(),
+ _getAllApps(),
+ ],
+ ),
+ ),
+ );
+ }
- setState(() {
- _platformVersion = platformVersion;
- });
+ Widget _getAllApps() {
+ return ElevatedButton(
+ onPressed: () async {
+ SocialShare.checkInstalledAppsForShare().then((data) {
+ print(data.toString());
+ });
+ },
+ child: Text("Get all Apps"),
+ );
}
- ScreenshotController screenshotController = ScreenshotController();
+ Widget _toTelegram() {
+ return ElevatedButton(
+ onPressed: () async {
+ SocialShare.shareTelegram(
+ "Hello World \n https://google.com",
+ ).then((data) {
+ print(data);
+ });
+ },
+ child: Text("Share on Telegram"),
+ );
+ }
- @override
- Widget build(BuildContext context) {
- return MaterialApp(
- home: Scaffold(
- appBar: AppBar(
- title: const Text('Plugin example app'),
- ),
- body: Screenshot(
- controller: screenshotController,
- child: Container(
- color: Colors.white,
- alignment: Alignment.center,
- child: Column(
- mainAxisAlignment: MainAxisAlignment.center,
- crossAxisAlignment: CrossAxisAlignment.center,
- children: [
- Text(
- 'Running on: $_platformVersion\n',
- textAlign: TextAlign.center,
- ),
- RaisedButton(
- onPressed: () async {
- File file = await ImagePicker.pickImage(
- source: ImageSource.gallery,
- );
- SocialShare.shareInstagramStory(
- file.path,
- backgroundTopColor: "#ffffff",
- backgroundBottomColor: "#000000",
- attributionURL: "https://deep-link-url",
- ).then((data) {
- print(data);
- });
- },
- child: Text("Share On Instagram Story"),
- ),
- RaisedButton(
- onPressed: () async {
- await screenshotController.capture().then((image) async {
- SocialShare.shareInstagramStory(
- image.path,
- backgroundTopColor: "#ffffff",
- backgroundBottomColor: "#000000",
- attributionURL: "https://deep-link-url",
- backgroundImagePath: image.path,
- ).then((data) {
- print(data);
- });
- });
- },
- child: Text("Share On Instagram Story with background"),
- ),
- RaisedButton(
- onPressed: () async {
- await screenshotController.capture().then((image) async {
- //facebook appId is mandatory for andorid or else share won't work
- Platform.isAndroid
- ? SocialShare.shareFacebookStory(
- image.path,
- "#ffffff",
- "#000000",
- "https://google.com",
- appId: "xxxxxxxxxxxxx",
- ).then((data) {
- print(data);
- })
- : SocialShare.shareFacebookStory(
- image.path,
- "#ffffff",
- "#000000",
- "https://google.com",
- ).then((data) {
- print(data);
- });
- });
- },
- child: Text("Share On Facebook Story"),
- ),
- RaisedButton(
- onPressed: () async {
- SocialShare.copyToClipboard(
- "This is Social Share plugin",
- ).then((data) {
- print(data);
- });
- },
- child: Text("Copy to clipboard"),
- ),
- RaisedButton(
- onPressed: () async {
- SocialShare.shareTwitter(
- "This is Social Share twitter example",
- hashtags: ["hello", "world", "foo", "bar"],
- url: "https://google.com/#/hello",
- trailingText: "\nhello",
- ).then((data) {
- print(data);
- });
- },
- child: Text("Share on twitter"),
- ),
- RaisedButton(
- onPressed: () async {
- SocialShare.shareSms(
- "This is Social Share Sms example",
- url: "\nhttps://google.com/",
- trailingText: "\nhello",
- ).then((data) {
- print(data);
- });
- },
- child: Text("Share on Sms"),
- ),
- RaisedButton(
- onPressed: () async {
- await screenshotController.capture().then((image) async {
- SocialShare.shareOptions("Hello world").then((data) {
- print(data);
- });
- });
- },
- child: Text("Share Options"),
- ),
- RaisedButton(
- onPressed: () async {
- SocialShare.shareWhatsapp(
- "Hello World \n https://google.com",
- ).then((data) {
- print(data);
- });
- },
- child: Text("Share on Whatsapp"),
- ),
- RaisedButton(
- onPressed: () async {
- SocialShare.shareTelegram(
- "Hello World \n https://google.com",
- ).then((data) {
- print(data);
- });
- },
- child: Text("Share on Telegram"),
- ),
- RaisedButton(
- onPressed: () async {
- SocialShare.checkInstalledAppsForShare().then((data) {
- print(data.toString());
- });
- },
- child: Text("Get all Apps"),
- ),
- ],
- ),
- ),
- ),
- ),
+ Widget _toWhatsapp() {
+ return ElevatedButton(
+ onPressed: () async {
+ SocialShare.shareWhatsapp(
+ "Hello World \n https://google.com",
+ ).then((data) {
+ print(data);
+ });
+ },
+ child: Text("Share on Whatsapp"),
+ );
+ }
+
+ Widget _shareOptions() {
+ return ElevatedButton(
+ onPressed: () async {
+ await screenshotController.capture().then((image) async {
+ SocialShare.shareOptions("Hello world").then((data) {
+ print(data);
+ });
+ });
+ },
+ child: Text("Share Options"),
+ );
+ }
+
+ Widget _toSms() {
+ return ElevatedButton(
+ onPressed: () async {
+ SocialShare.shareSms(
+ "This is Social Share Sms example",
+ url: "\nhttps://google.com/",
+ trailingText: "\nhello",
+ ).then((data) {
+ print(data);
+ });
+ },
+ child: Text("Share on Sms"),
+ );
+ }
+
+ Widget _toTwitter() {
+ return ElevatedButton(
+ onPressed: () async {
+ SocialShare.shareTwitter(
+ "This is Social Share twitter example",
+ hashtags: ["hello", "world", "foo", "bar"],
+ url: "https://google.com/#/hello",
+ trailingText: "\nhello",
+ ).then((data) {
+ print(data);
+ });
+ },
+ child: Text("Share on twitter"),
+ );
+ }
+
+ Widget _copyToClipboard() {
+ return ElevatedButton(
+ onPressed: () async {
+ SocialShare.copyToClipboard(
+ "This is Social Share plugin",
+ ).then((data) {
+ print(data);
+ });
+ },
+ child: Text("Copy to clipboard"),
+ );
+ }
+
+ Widget _toFacebookStory() {
+ return ElevatedButton(
+ onPressed: () async {
+ await getTemporaryDirectory()
+ .then((directory) =>
+ screenshotController.captureAndSave(directory.path))
+ .then((image) async {
+ //facebook appId is mandatory for andorid or else share won't work
+ defaultTargetPlatform == TargetPlatform.android
+ ? SocialShare.shareFacebookStory(
+ image!,
+ "#ffffff",
+ "#000000",
+ "https://google.com",
+ appId: "xxxxxxxxxxxxx",
+ ).then((data) {
+ print(data);
+ })
+ : SocialShare.shareFacebookStory(
+ image!,
+ "#ffffff",
+ "#000000",
+ "https://google.com",
+ ).then((data) {
+ print(data);
+ });
+ });
+ },
+ child: Text("Share On Facebook Story"),
+ );
+ }
+
+ Widget _toInstagramStoryWithBackground() {
+ return ElevatedButton(
+ onPressed: () async {
+ getTemporaryDirectory()
+ .then((directory) =>
+ screenshotController.captureAndSave(directory.path))
+ .then((image) async {
+ SocialShare.shareInstagramStory(
+ image!,
+ backgroundTopColor: "#ffffff",
+ backgroundBottomColor: "#000000",
+ attributionURL: "https://deep-link-url",
+ backgroundImagePath: image,
+ ).then((data) {
+ print(data);
+ });
+ });
+ },
+ child: Text("Share On Instagram Story with background"),
+ );
+ }
+
+ Widget _toInstagramStory() {
+ return ElevatedButton(
+ onPressed: () async {
+ final file = await ImagePicker().pickImage(
+ source: ImageSource.gallery,
+ );
+ SocialShare.shareInstagramStory(
+ file!.path,
+ backgroundTopColor: "#ffffff",
+ backgroundBottomColor: "#000000",
+ attributionURL: "https://deep-link-url",
+ ).then((data) {
+ print(data);
+ });
+ },
+ child: Text("Share On Instagram Story"),
+ );
+ }
+
+ Text _title() {
+ return Text(
+ 'Running on: ${describeEnum(defaultTargetPlatform)}',
+ textAlign: TextAlign.center,
);
}
}
diff --git a/example/pubspec.lock b/example/pubspec.lock
index 6be5c6b7..00a16510 100644
--- a/example/pubspec.lock
+++ b/example/pubspec.lock
@@ -7,7 +7,7 @@ packages:
name: async
url: "https://pub.dartlang.org"
source: hosted
- version: "2.5.0"
+ version: "2.8.2"
boolean_selector:
dependency: transitive
description:
@@ -21,14 +21,14 @@ packages:
name: characters
url: "https://pub.dartlang.org"
source: hosted
- version: "1.1.0"
+ version: "1.2.0"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.dartlang.org"
source: hosted
- version: "1.2.0"
+ version: "1.3.1"
clock:
dependency: transitive
description:
@@ -43,13 +43,20 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.15.0"
+ cross_file:
+ dependency: transitive
+ description:
+ name: cross_file
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "0.3.1+5"
cupertino_icons:
dependency: "direct main"
description:
name: cupertino_icons
url: "https://pub.dartlang.org"
source: hosted
- version: "0.1.3"
+ version: "1.0.3"
fake_async:
dependency: transitive
description:
@@ -82,47 +89,73 @@ packages:
name: flutter_plugin_android_lifecycle
url: "https://pub.dartlang.org"
source: hosted
- version: "1.0.5"
+ version: "2.0.3"
flutter_test:
dependency: "direct dev"
description: flutter
source: sdk
version: "0.0.0"
+ flutter_web_plugins:
+ dependency: transitive
+ description: flutter
+ source: sdk
+ version: "0.0.0"
http:
dependency: "direct main"
description:
name: http
url: "https://pub.dartlang.org"
source: hosted
- version: "0.12.0+4"
+ version: "0.13.4"
http_parser:
dependency: transitive
description:
name: http_parser
url: "https://pub.dartlang.org"
source: hosted
- version: "3.1.3"
+ version: "4.0.0"
image_picker:
dependency: "direct main"
description:
name: image_picker
url: "https://pub.dartlang.org"
source: hosted
- version: "0.6.3+1"
+ version: "0.8.4+2"
+ image_picker_for_web:
+ dependency: transitive
+ description:
+ name: image_picker_for_web
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "2.1.3"
+ image_picker_platform_interface:
+ dependency: transitive
+ description:
+ name: image_picker_platform_interface
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "2.4.1"
+ js:
+ dependency: transitive
+ description:
+ name: js
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "0.6.3"
matcher:
dependency: transitive
description:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
- version: "0.12.10"
+ version: "0.12.11"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.dartlang.org"
source: hosted
- version: "1.3.0"
+ version: "1.7.0"
path:
dependency: transitive
description:
@@ -136,7 +169,7 @@ packages:
name: path_provider
url: "https://pub.dartlang.org"
source: hosted
- version: "2.0.1"
+ version: "2.0.5"
path_provider_linux:
dependency: transitive
description:
@@ -165,13 +198,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
- pedantic:
- dependency: transitive
- description:
- name: pedantic
- url: "https://pub.dartlang.org"
- source: hosted
- version: "1.8.0+1"
platform:
dependency: transitive
description:
@@ -199,7 +225,7 @@ packages:
name: screenshot
url: "https://pub.dartlang.org"
source: hosted
- version: "0.3.0"
+ version: "1.2.3"
sky_engine:
dependency: transitive
description: flutter
@@ -218,7 +244,7 @@ packages:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
- version: "1.8.0"
+ version: "1.8.1"
stack_trace:
dependency: transitive
description:
@@ -253,7 +279,7 @@ packages:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
- version: "0.2.19"
+ version: "0.4.3"
typed_data:
dependency: transitive
description:
@@ -283,5 +309,5 @@ packages:
source: hosted
version: "0.2.0"
sdks:
- dart: ">=2.12.0 <3.0.0"
- flutter: ">=1.20.0"
+ dart: ">=2.14.0 <3.0.0"
+ flutter: ">=2.5.0"
diff --git a/example/pubspec.yaml b/example/pubspec.yaml
index f1868e12..b9008599 100644
--- a/example/pubspec.yaml
+++ b/example/pubspec.yaml
@@ -1,62 +1,24 @@
name: social_share_example
-description: Demonstrates how to use the social_share plugin.
-publish_to: "none"
+description: Demonstrates how to use the social_share plugin
+publish_to: none
environment:
- sdk: ">=2.1.0 <3.0.0"
+ sdk: ">=2.12.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
-
- # The following adds the Cupertino Icons font to your application.
- # Use with the CupertinoIcons class for iOS style icons.
- cupertino_icons: ^0.1.2
- screenshot: ^0.3.0
- path_provider: ^2.0.1
+ cupertino_icons: ^1.0.3
+ screenshot: ^1.2.3
+ path_provider: ^2.0.5
http:
- image_picker: ^0.6.3+1
+ image_picker: ^0.8.4+2
dev_dependencies:
flutter_test:
sdk: flutter
-
social_share:
path: ../
-# For information on the generic Dart part of this file, see the
-# following page: https://dart.dev/tools/pub/pubspec
-
-# The following section is specific to Flutter.
flutter:
- # The following line ensures that the Material Icons font is
- # included with your application, so that you can use the icons in
- # the material Icons class.
- uses-material-design: true
- # To add assets to your application, add an assets section, like this:
- # assets:
- # - images/a_dot_burr.jpeg
- # - images/a_dot_ham.jpeg
- # An image asset can refer to one or more resolution-specific "variants", see
- # https://flutter.dev/assets-and-images/#resolution-aware.
- # For details regarding adding assets from package dependencies, see
- # https://flutter.dev/assets-and-images/#from-packages
- # To add custom fonts to your application, add a fonts section here,
- # in this "flutter" section. Each entry in this list should have a
- # "family" key with the font family name, and a "fonts" key with a
- # list giving the asset and other descriptors for the font. For
- # example:
- # fonts:
- # - family: Schyler
- # fonts:
- # - asset: fonts/Schyler-Regular.ttf
- # - asset: fonts/Schyler-Italic.ttf
- # style: italic
- # - family: Trajan Pro
- # fonts:
- # - asset: fonts/TrajanPro.ttf
- # - asset: fonts/TrajanPro_Bold.ttf
- # weight: 700
- #
- # For details regarding fonts from package dependencies,
- # see https://flutter.dev/custom-fonts/#from-packages
+ uses-material-design: true
\ No newline at end of file
diff --git a/example/test/widget_test.dart b/example/test/widget_test.dart
deleted file mode 100644
index 921b8546..00000000
--- a/example/test/widget_test.dart
+++ /dev/null
@@ -1,27 +0,0 @@
-// This is a basic Flutter widget test.
-//
-// To perform an interaction with a widget in your test, use the WidgetTester
-// utility that Flutter provides. For example, you can send tap and scroll
-// gestures. You can also use WidgetTester to find child widgets in the widget
-// tree, read text, and verify that the values of widget properties are correct.
-
-import 'package:flutter/material.dart';
-import 'package:flutter_test/flutter_test.dart';
-
-import 'package:social_share_example/main.dart';
-
-void main() {
- // testWidgets('Verify Platform version', (WidgetTester tester) async {
- // // Build our app and trigger a frame.
- // await tester.pumpWidget(MyApp());
-
- // // Verify that platform version is retrieved.
- // expect(
- // find.byWidgetPredicate(
- // (Widget widget) => widget is Text &&
- // widget.data.startsWith('Running on:'),
- // ),
- // findsOneWidget,
- // );
- // });
-}
diff --git a/pubspec.lock b/pubspec.lock
index 80754823..5c1e9960 100644
--- a/pubspec.lock
+++ b/pubspec.lock
@@ -7,7 +7,7 @@ packages:
name: async
url: "https://pub.dartlang.org"
source: hosted
- version: "2.5.0"
+ version: "2.8.2"
boolean_selector:
dependency: transitive
description:
@@ -21,14 +21,14 @@ packages:
name: characters
url: "https://pub.dartlang.org"
source: hosted
- version: "1.1.0"
+ version: "1.2.0"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.dartlang.org"
source: hosted
- version: "1.2.0"
+ version: "1.3.1"
clock:
dependency: transitive
description:
@@ -80,14 +80,14 @@ packages:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
- version: "0.12.10"
+ version: "0.12.11"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.dartlang.org"
source: hosted
- version: "1.3.0"
+ version: "1.7.0"
path:
dependency: transitive
description:
@@ -101,7 +101,7 @@ packages:
name: path_provider
url: "https://pub.dartlang.org"
source: hosted
- version: "2.0.1"
+ version: "2.0.5"
path_provider_linux:
dependency: transitive
description:
@@ -162,7 +162,7 @@ packages:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
- version: "1.8.0"
+ version: "1.8.1"
stack_trace:
dependency: transitive
description:
@@ -197,7 +197,7 @@ packages:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
- version: "0.2.19"
+ version: "0.4.3"
typed_data:
dependency: transitive
description:
@@ -227,5 +227,5 @@ packages:
source: hosted
version: "0.2.0"
sdks:
- dart: ">=2.12.0 <3.0.0"
- flutter: ">=1.20.0"
+ dart: ">=2.14.0 <3.0.0"
+ flutter: ">=2.5.0"
diff --git a/pubspec.yaml b/pubspec.yaml
index 09678afb..3798f648 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,5 +1,5 @@
name: social_share
-description: Wide variety of sharing options you'll need to share directly to certain well-known apps.
+description: Wide variety of sharing options you'll need to share directly to certain well-known apps
version: 2.1.1
homepage: https://github.com/ShekarMudaliyar/social_share
@@ -10,7 +10,7 @@ environment:
dependencies:
flutter:
sdk: flutter
- path_provider: ^2.0.1
+ path_provider: ^2.0.5
dev_dependencies:
flutter_test:
diff --git a/social_share.iml b/social_share.iml
deleted file mode 100644
index 73e7ebd0..00000000
--- a/social_share.iml
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/test/social_share_test.dart b/test/social_share_test.dart
deleted file mode 100644
index 3fccd9ed..00000000
--- a/test/social_share_test.dart
+++ /dev/null
@@ -1,23 +0,0 @@
-import 'package:flutter/services.dart';
-import 'package:flutter_test/flutter_test.dart';
-import 'package:social_share/social_share.dart';
-
-void main() {
- // const MethodChannel channel = MethodChannel('social_share');
-
- // TestWidgetsFlutterBinding.ensureInitialized();
-
- // setUp(() {
- // channel.setMockMethodCallHandler((MethodCall methodCall) async {
- // return '42';
- // });
- // });
-
- // tearDown(() {
- // channel.setMockMethodCallHandler(null);
- // });
-
- // test('getPlatformVersion', () async {
- // expect(await SocialShare.platformVersion, '42');
- // });
-}