Skip to content

Commit

Permalink
Email content body issue fix #11
Browse files Browse the repository at this point in the history
  • Loading branch information
keval-devani committed Mar 15, 2024
1 parent b494546 commit 4367b81
Show file tree
Hide file tree
Showing 57 changed files with 517 additions and 1,041 deletions.
892 changes: 68 additions & 824 deletions .gitignore

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions .metadata
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled.
# This file should be version controlled and should not be manually edited.

version:
revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
channel: stable
revision: "ba393198430278b6595976de84fe170f553cc728"
channel: "stable"

project_type: plugin

# Tracks metadata for the flutter migrate command
migration:
platforms:
- platform: root
create_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
base_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
create_revision: ba393198430278b6595976de84fe170f553cc728
base_revision: ba393198430278b6595976de84fe170f553cc728
- platform: android
create_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
base_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
create_revision: ba393198430278b6595976de84fe170f553cc728
base_revision: ba393198430278b6595976de84fe170f553cc728
- platform: ios
create_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
base_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
create_revision: ba393198430278b6595976de84fe170f553cc728
base_revision: ba393198430278b6595976de84fe170f553cc728

# User provided section

Expand Down
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 1.0.8

* Bump to latest flutter SDK
* Rename Twitter to X 🚀
* Email content body issue fix #11

## 1.0.7

* Android inferred type issue fixed
Expand Down Expand Up @@ -28,4 +34,4 @@
* copy text to clipboard
* share with social apps
* open system UI to share
* custom app share support (only Android)
* custom app share support (only Android)
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# custom_social_share
# [custom_social_share](https://pub.dev/packages/custom_social_share)

Flutter plugin for sharing text content to most popular social media apps.

Expand Down
18 changes: 10 additions & 8 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@ group 'com.kd.custom_social_share'
version '1.0-SNAPSHOT'

buildscript {
ext.kotlin_version = '1.6.21'
ext.kotlin_version = '1.7.10'
repositories {
google()
mavenCentral()
}

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

rootProject.allprojects {
allprojects {
repositories {
google()
mavenCentral()
Expand All @@ -25,7 +25,11 @@ apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'

android {
compileSdkVersion 31
if (project.android.hasProperty("namespace")) {
namespace 'com.kd.custom_social_share'
}

compileSdk 34

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
Expand All @@ -41,10 +45,8 @@ android {
}

defaultConfig {
minSdkVersion 16
minSdkVersion 19
}
}

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
dependencies {}
}
2 changes: 1 addition & 1 deletion android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<manifest package="com.kd.custom_social_share" />
<manifest package="com.kd.custom_social_share" />
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class CustomSocialSharePlugin : FlutterPlugin, MethodCallHandler, ActivityAware
"slack" to "com.Slack",
"snapchat" to "com.snapchat.android",
"telegram" to "org.telegram.messenger",
"twitter" to "com.twitter.android",
"x" to "com.twitter.android",
"viber" to "com.viber.voip",
"wechat" to "com.tencent.mm",
"whatsapp" to "com.whatsapp",
Expand Down Expand Up @@ -65,7 +65,7 @@ class CustomSocialSharePlugin : FlutterPlugin, MethodCallHandler, ActivityAware
override fun onDetachedFromActivity() {}

override fun onMethodCall(call: MethodCall, result: Result) {
val content: String? = call.argument("content")
val content: String = call.argument("content")
when (call.method) {

"sms" -> {
Expand All @@ -77,7 +77,7 @@ class CustomSocialSharePlugin : FlutterPlugin, MethodCallHandler, ActivityAware
}

"email" -> {
callIntent(Intent(Intent.ACTION_SENDTO, Uri.parse("mailto:?subject=$content")), result)
callIntent(Intent(Intent.ACTION_SENDTO, Uri.parse("mailto:?body=$content")), result)
}

"toAll" -> {
Expand Down Expand Up @@ -140,4 +140,4 @@ class CustomSocialSharePlugin : FlutterPlugin, MethodCallHandler, ActivityAware
result.success(false)
}
}
}
}
4 changes: 0 additions & 4 deletions example/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,10 @@ migrate_working_dir/
.dart_tool/
.flutter-plugins
.flutter-plugins-dependencies
.packages
.pub-cache/
.pub/
/build/

# Web related
lib/generated_plugin_registrant.dart

# Symbolication related
app.*.symbols

Expand Down
4 changes: 2 additions & 2 deletions example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ A few resources to get you started if this is your first Flutter project:
- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook)

For help getting started with Flutter development, view the
[online documentation](https://docs.flutter.dev/), which offers tutorials, samples, guidance on mobile development, and a full API
reference.
[online documentation](https://docs.flutter.dev/), which offers tutorials,
samples, guidance on mobile development, and a full API reference.
3 changes: 1 addition & 2 deletions example/analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ 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.
# and their documentation is published at https://dart.dev/lints.
#
# 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
Expand Down
26 changes: 12 additions & 14 deletions example/android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
plugins {
id "com.android.application"
id "kotlin-android"
id "dev.flutter.flutter-gradle-plugin"
}

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
Expand All @@ -6,11 +12,6 @@ if (localPropertiesFile.exists()) {
}
}

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.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
Expand All @@ -21,12 +22,9 @@ if (flutterVersionName == null) {
flutterVersionName = '1.0'
}

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
compileSdkVersion flutter.compileSdkVersion
namespace "com.kd.custom_social_share_example"
compileSdk flutter.compileSdkVersion
ndkVersion flutter.ndkVersion

compileOptions {
Expand All @@ -43,9 +41,10 @@ android {
}

defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.kd.custom_social_share_example"
// 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.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
minSdkVersion flutter.minSdkVersion
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
Expand All @@ -54,6 +53,7 @@ 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
}
Expand All @@ -64,6 +64,4 @@ flutter {
source '../..'
}

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
dependencies {}
7 changes: 7 additions & 0 deletions example/android/app/src/debug/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<!-- 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" />
</manifest>
23 changes: 15 additions & 8 deletions example/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.kd.custom_social_share_example">

<uses-permission android:name="android.permission.INTERNET" />

<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher"
android:name="${applicationName}"
android:label="custom_social_share_example">
<activity
android:name=".MainActivity"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:exported="true"
android:hardwareAccelerated="true"
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">
<!-- Specifies an Android theme to apply to this Activity as soon as
the Android process has started. This theme is visible to the user
Expand All @@ -33,4 +29,15 @@
android:name="flutterEmbedding"
android:value="2" />
</application>
<!-- Required to query activities that can process text, see:
https://developer.android.com/training/package-visibility?hl=en and
https://developer.android.com/reference/android/content/Intent#ACTION_PROCESS_TEXT.
In particular, this is used by the Flutter engine in io.flutter.plugin.text.ProcessTextPlugin. -->
<queries>
<intent>
<action android:name="android.intent.action.PROCESS_TEXT" />
<data android:mimeType="text/plain" />
</intent>
</queries>
</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@ package com.kd.custom_social_share_example

import io.flutter.embedding.android.FlutterActivity

class MainActivity : FlutterActivity() {
}
class MainActivity : FlutterActivity()
3 changes: 1 addition & 2 deletions example/android/app/src/profile/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.kd.custom_social_share_example">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<!-- 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.
Expand Down
13 changes: 0 additions & 13 deletions example/android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,16 +1,3 @@
buildscript {
ext.kotlin_version = '1.6.21'
repositories {
google()
mavenCentral()
}

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

allprojects {
repositories {
google()
Expand Down
2 changes: 1 addition & 1 deletion example/android/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
org.gradle.jvmargs=-Xmx1536M
org.gradle.jvmargs=-Xmx4G
android.useAndroidX=true
android.enableJetifier=true
3 changes: 1 addition & 2 deletions example/android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#Fri Jun 23 08:50:38 CEST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.3-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
}
settings.ext.flutterSdkPath = flutterSdkPath()

def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
def properties = new Properties()
includeBuild("${settings.ext.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 "7.3.0" apply false
id "org.jetbrains.kotlin.android" version "1.7.10" apply false
}

include ":app"
21 changes: 21 additions & 0 deletions example/integration_test/plugin_integration_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// This is a basic Flutter integration test.
//
// Since integration tests run in a full Flutter application, they can interact
// with the host side of a plugin implementation, unlike Dart unit tests.
//
// For more information about Flutter integration tests, please see
// https://docs.flutter.dev/cookbook/testing/integration/introduction

import 'package:custom_social_share/custom_social_share.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';

void main() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();

testWidgets('toAll test', (WidgetTester tester) async {
final CustomSocialShare plugin = CustomSocialShare();
final bool result = await plugin.toAll('Test');
expect(result, true);
});
}
Loading

0 comments on commit 4367b81

Please sign in to comment.