Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions packages/share_plus/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 1.2.0

- Add Web support (`share_plus_web`)
- Rename method channel to avoid conflicts

## 1.1.1

- Transfer to plus-plugins monorepo
Expand Down
2 changes: 1 addition & 1 deletion packages/share_plus/android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
group 'io.flutter.plugins.share'
group 'dev.fluttercommunity.plus.share'
version '1.0-SNAPSHOT'

buildscript {
Expand Down
4 changes: 2 additions & 2 deletions packages/share_plus/android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="io.flutter.plugins.share">
package="dev.fluttercommunity.plus.share">
<application>
<provider
android:name="io.flutter.plugins.share.ShareFileProvider"
android:name="dev.fluttercommunity.plus.share.ShareFileProvider"
android:authorities="${applicationId}.flutter.share_provider"
android:exported="false"
android:grantUriPermissions="true">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package io.flutter.plugins.share;
package dev.fluttercommunity.plus.share;

import io.flutter.plugin.common.MethodCall;
import io.flutter.plugin.common.MethodChannel;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package io.flutter.plugins.share;
package dev.fluttercommunity.plus.share;

import android.app.Activity;
import android.content.Context;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package io.flutter.plugins.share;
package dev.fluttercommunity.plus.share;

import androidx.core.content.FileProvider;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package io.flutter.plugins.share;
package dev.fluttercommunity.plus.share;

import android.app.Activity;
import android.content.Context;
Expand All @@ -14,15 +14,15 @@
import io.flutter.plugin.common.PluginRegistry.Registrar;

/** Plugin method host for presenting a share sheet via Intent */
public class SharePlugin implements FlutterPlugin, ActivityAware {
public class SharePlusPlugin implements FlutterPlugin, ActivityAware {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think renaming the Java class is not necessary but thanks for doing it aways!


private static final String CHANNEL = "plugins.flutter.io/share";
private static final String CHANNEL = "dev.fluttercommunity.plus/share";
private MethodCallHandler handler;
private Share share;
private MethodChannel methodChannel;

public static void registerWith(Registrar registrar) {
SharePlugin plugin = new SharePlugin();
SharePlusPlugin plugin = new SharePlusPlugin();
plugin.setUpChannel(registrar.context(), registrar.activity(), registrar.messenger());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

import android.os.Bundle;
import dev.flutter.plugins.integration_test.IntegrationTestPlugin;
import dev.fluttercommunity.plus.share.SharePlusPlugin;
import io.flutter.app.FlutterActivity;
import io.flutter.plugins.share.SharePlugin;

public class EmbeddingV1Activity extends FlutterActivity {

Expand All @@ -16,6 +16,6 @@ protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
IntegrationTestPlugin.registerWith(
registrarFor("dev.flutter.plugins.integration_test.IntegrationTestPlugin"));
SharePlugin.registerWith(registrarFor("io.flutter.plugins.share.SharePlugin"));
SharePlusPlugin.registerWith(registrarFor("dev.fluttercommunity.plus.share.SharePlusPlugin"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@

#import <Flutter/Flutter.h>

@interface FLTSharePlugin : NSObject <FlutterPlugin>
@interface FLTSharePlusPlugin : NSObject <FlutterPlugin>
@end
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#import "FLTSharePlugin.h"
#import "FLTSharePlusPlugin.h"

static NSString *const PLATFORM_CHANNEL = @"plugins.flutter.io/share";
static NSString *const PLATFORM_CHANNEL = @"dev.fluttercommunity.plus/share";

@interface ShareData : NSObject <UIActivityItemSource>
@interface SharePlusData : NSObject <UIActivityItemSource>

@property(readonly, nonatomic, copy) NSString *subject;
@property(readonly, nonatomic, copy) NSString *text;
Expand All @@ -21,7 +21,7 @@ - (instancetype)init __attribute__((unavailable("Use initWithSubject:text: inste

@end

@implementation ShareData
@implementation SharePlusData

- (instancetype)init {
[super doesNotRecognizeSelector:_cmd];
Expand Down Expand Up @@ -91,7 +91,7 @@ - (UIImage *)imageWithImage:(UIImage *)image scaledToSize:(CGSize)newSize {

@end

@implementation FLTSharePlugin
@implementation FLTSharePlusPlugin

+ (void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar> *)registrar {
FlutterMethodChannel *shareChannel =
Expand Down Expand Up @@ -178,7 +178,7 @@ + (void)shareText:(NSString *)shareText
subject:(NSString *)subject
withController:(UIViewController *)controller
atSource:(CGRect)origin {
ShareData *data = [[ShareData alloc] initWithSubject:subject text:shareText];
SharePlusData *data = [[SharePlusData alloc] initWithSubject:subject text:shareText];
[self share:@[ data ] withController:controller atSource:origin];
}

Expand All @@ -191,7 +191,7 @@ + (void)shareFiles:(NSArray *)paths
NSMutableArray *items = [[NSMutableArray alloc] init];

if (text || subject) {
[items addObject:[[ShareData alloc] initWithSubject:subject text:text]];
[items addObject:[[SharePlusData alloc] initWithSubject:subject text:text]];
}

for (int i = 0; i < [paths count]; i++) {
Expand All @@ -207,7 +207,7 @@ + (void)shareFiles:(NSArray *)paths
UIImage *image = [UIImage imageWithContentsOfFile:path];
[items addObject:image];
} else {
[items addObject:[[ShareData alloc] initWithFile:path mimeType:mimeType]];
[items addObject:[[SharePlusData alloc] initWithFile:path mimeType:mimeType]];
}
}

Expand Down
10 changes: 5 additions & 5 deletions packages/share_plus/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
name: share_plus
description: Flutter plugin for sharing content via the platform share UI, using the ACTION_SEND intent on Android and UIActivityViewController on iOS.
version: 1.1.1
version: 1.2.0
homepage: https://plus.fluttercommunity.dev/
repository: https://github.com/fluttercommunity/plus_plugins/tree/main/packages/

flutter:
plugin:
platforms:
android:
package: io.flutter.plugins.share
pluginClass: SharePlugin
package: dev.fluttercommunity.plus.share
pluginClass: SharePlusPlugin
ios:
pluginClass: FLTSharePlugin
pluginClass: FLTSharePlusPlugin
linux:
default_package: share_plus_linux
web:
Expand All @@ -24,7 +24,7 @@ dependencies:
mime: ^0.9.7
flutter:
sdk: flutter
share_plus_platform_interface: ^1.1.0
share_plus_platform_interface: ^1.2.0
share_plus_linux: ^1.1.0
share_plus_windows: ^0.1.0
share_plus_web: ^0.1.0
Expand Down
4 changes: 4 additions & 0 deletions packages/share_plus_platform_interface/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 1.2.0

- Rename method channel to avoid conflicts

## 1.1.0

- Transfer to plus-plugins monorepo
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class MethodChannelShare extends SharePlatform {
/// [MethodChannel] used to communicate with the platform side.
@visibleForTesting
static const MethodChannel channel =
MethodChannel('plugins.flutter.io/share');
MethodChannel('dev.fluttercommunity.plus/share');

/// Summons the platform's share sheet to share text.
@override
Expand Down
2 changes: 1 addition & 1 deletion packages/share_plus_platform_interface/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: share_plus_platform_interface
description: A common platform interface for the share_plus plugin.
version: 1.1.0
version: 1.2.0
homepage: https://plus.fluttercommunity.dev/
repository: https://github.com/fluttercommunity/plus_plugins/tree/main/packages/

Expand Down
6 changes: 3 additions & 3 deletions packages/share_plus_web/lib/share_plus_web.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ import 'package:share_plus_platform_interface/share_plus_platform_interface.dart
import 'package:url_launcher/url_launcher.dart';

/// The web implementation of [SharePlatform].
class SharePlugin extends SharePlatform {
class SharePlusPlugin extends SharePlatform {
/// Registers this class as the default instance of [SharePlatform].
static void registerWith(Registrar registrar) {
SharePlatform.instance = SharePlugin();
SharePlatform.instance = SharePlusPlugin();
}

final _navigator;

/// A constructor that allows tests to override the window object used by the plugin.
SharePlugin({@visibleForTesting html.Navigator debugNavigator})
SharePlusPlugin({@visibleForTesting html.Navigator debugNavigator})
: _navigator = debugNavigator ?? html.window.navigator;

@override
Expand Down
4 changes: 2 additions & 2 deletions packages/share_plus_web/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ flutter:
plugin:
platforms:
web:
pluginClass: SharePlugin
pluginClass: SharePlusPlugin
fileName: share_plus_web.dart

dependencies:
share_plus_platform_interface: ^1.1.0
share_plus_platform_interface: ^1.2.0
url_launcher: ^5.2.5
flutter:
sdk: flutter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@ class _MockNavigator extends Mock implements html.Navigator {}

void main() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
group('SharePlugin', () {
group('SharePlusPlugin', () {
_MockWindow mockWindow;
_MockNavigator mockNavigator;

SharePlugin plugin;
SharePlusPlugin plugin;

setUp(() {
mockWindow = _MockWindow();
mockNavigator = _MockNavigator();
when(mockWindow.navigator).thenReturn(mockNavigator);

plugin = SharePlugin(debugNavigator: mockNavigator);
plugin = SharePlusPlugin(debugNavigator: mockNavigator);
});
group('share', () {
testWidgets('can share url', (WidgetTester _) async {
Expand Down