Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update naming #575

Closed
wants to merge 8 commits into from
Closed
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
4 changes: 2 additions & 2 deletions IOS_SETUP.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import workmanager
WorkmanagerPlugin.registerBGProcessingTask(withIdentifier: "task-identifier")

// Register a periodic task in iOS 13+
WorkmanagerPlugin.registerPeriodicTask(withIdentifier: "be.tramckrijte.workmanagerExample.iOSBackgroundAppRefresh", frequency: NSNumber(value: 20 * 60))
WorkmanagerPlugin.registerPeriodicTask(withIdentifier: "com.mishmashtech.workmanagerExample.iOSBackgroundAppRefresh", frequency: NSNumber(value: 20 * 60))
```

- Info.plist
Expand All @@ -49,7 +49,7 @@ WorkmanagerPlugin.registerPeriodicTask(withIdentifier: "be.tramckrijte.workmanag
<string>task-identifier</string>

<!-- Register a periodic task in iOS 13+ -->
<string>be.tramckrijte.workmanagerExample.iOSBackgroundAppRefresh</string>
<string>com.mishmashtech.workmanagerExample.iOSBackgroundAppRefresh</string>
</array>
```
> ⚠️ On iOS 13+, adding a `BGTaskSchedulerPermittedIdentifiers` key to the Info.plist for new `BGTaskScheduler` API disables the `performFetchWithCompletionHandler` and `setMinimumBackgroundFetchInterval`
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,12 @@ To use `registerPeriodicTask` first register the task in `Info.plist` and `AppDe

```objc
// Register a periodic task with 20 minutes frequency. The frequency is in seconds.
WorkmanagerPlugin.registerPeriodicTask(withIdentifier: "be.tramckrijte.workmanagerExample.iOSBackgroundAppRefresh", frequency: NSNumber(value: 20 * 60))
WorkmanagerPlugin.registerPeriodicTask(withIdentifier: "com.mishmashtech.workmanagerExample.iOSBackgroundAppRefresh", frequency: NSNumber(value: 20 * 60))
```

Then schedule the task from your App
```dart
const iOSBackgroundAppRefresh = "be.tramckrijte.workmanagerExample.iOSBackgroundAppRefresh";
const iOSBackgroundAppRefresh = "com.mishmashtech.workmanagerExample.iOSBackgroundAppRefresh";
Workmanager().registerPeriodicTask(
iOSBackgroundAppRefresh,
iOSBackgroundAppRefresh,
Expand All @@ -161,7 +161,7 @@ iOS might terminate any running background processing tasks when the user starts
For more information see [BGProcessingTask](https://developer.apple.com/documentation/backgroundtasks/bgprocessingtask)

```dart
const iOSBackgroundProcessingTask = "be.tramckrijte.workmanagerExample.iOSBackgroundProcessingTask";
const iOSBackgroundProcessingTask = "com.mishmashtech.workmanagerExample.iOSBackgroundProcessingTask";
Workmanager().registerProcessingTask(
iOSBackgroundProcessingTask,
iOSBackgroundProcessingTask,
Expand Down
8 changes: 4 additions & 4 deletions example/integration_test/workmanager_integration_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ void main() {
final wm = Workmanager();
await wm.initialize(callbackDispatcher);
await wm.registerOneOffTask(
'be.tramckrijte.workmanagerExample.taskId',
'com.mishmashtech.workmanagerExample.taskId',
'taskName',
);
}, skip: !Platform.isAndroid);
Expand All @@ -30,7 +30,7 @@ void main() {
await wm.initialize(callbackDispatcher);
try {
await wm.registerOneOffTask(
'be.tramckrijte.workmanagerExample.taskId',
'com.mishmashtech.workmanagerExample.taskId',
'taskName',
);
await wm.cancelAll();
Expand Down Expand Up @@ -61,11 +61,11 @@ void main() {
await wm.initialize(callbackDispatcher);
try {
await wm.registerOneOffTask(
'be.tramckrijte.workmanagerExample.taskId',
'com.mishmashtech.workmanagerExample.taskId',
'taskName',
);
await wm.cancelByUniqueName(
'be.tramckrijte.workmanagerExample.taskId',
'com.mishmashtech.workmanagerExample.taskId',
);
} on PlatformException catch (e) {
if (e.code !=
Expand Down
6 changes: 3 additions & 3 deletions example/ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
PRODUCT_BUNDLE_IDENTIFIER = be.tramckrijte.workmanagerExample;
PRODUCT_BUNDLE_IDENTIFIER = com.mishmashtech.workmanagerExample;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
Expand Down Expand Up @@ -680,7 +680,7 @@
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
PRODUCT_BUNDLE_IDENTIFIER = be.tramckrijte.workmanagerExample;
PRODUCT_BUNDLE_IDENTIFIER = com.mishmashtech.workmanagerExample;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
Expand Down Expand Up @@ -712,7 +712,7 @@
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
PRODUCT_BUNDLE_IDENTIFIER = be.tramckrijte.workmanagerExample;
PRODUCT_BUNDLE_IDENTIFIER = com.mishmashtech.workmanagerExample;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
Expand Down
10 changes: 5 additions & 5 deletions example/ios/Runner/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ import workmanager
GeneratedPluginRegistrant.register(with: registry)
}

WorkmanagerPlugin.registerBGProcessingTask(withIdentifier: "be.tramckrijte.workmanagerExample.taskId")
WorkmanagerPlugin.registerBGProcessingTask(withIdentifier: "be.tramckrijte.workmanagerExample.rescheduledTask")
WorkmanagerPlugin.registerBGProcessingTask(withIdentifier: "be.tramckrijte.workmanagerExample.simpleDelayedTask")
WorkmanagerPlugin.registerBGProcessingTask(withIdentifier: "be.tramckrijte.workmanagerExample.iOSBackgroundProcessingTask")
WorkmanagerPlugin.registerBGProcessingTask(withIdentifier: "com.mishmashtech.workmanagerExample.taskId")
WorkmanagerPlugin.registerBGProcessingTask(withIdentifier: "com.mishmashtech.workmanagerExample.rescheduledTask")
WorkmanagerPlugin.registerBGProcessingTask(withIdentifier: "com.mishmashtech.workmanagerExample.simpleDelayedTask")
WorkmanagerPlugin.registerBGProcessingTask(withIdentifier: "com.mishmashtech.workmanagerExample.iOSBackgroundProcessingTask")

// When this task is scheduled from dart it will run with minimum 20 minute frequency. The
// frequency is not guaranteed rather iOS will schedule it as per user's App usage pattern.
// If frequency is not provided it will default to 15 minutes
WorkmanagerPlugin.registerPeriodicTask(withIdentifier: "be.tramckrijte.workmanagerExample.iOSBackgroundAppRefresh", frequency: NSNumber(value: 20 * 60))
WorkmanagerPlugin.registerPeriodicTask(withIdentifier: "com.mishmashtech.workmanagerExample.iOSBackgroundAppRefresh", frequency: NSNumber(value: 20 * 60))

return super.application(application, didFinishLaunchingWithOptions: launchOptions)

Expand Down
18 changes: 9 additions & 9 deletions example/ios/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
<dict>
<key>BGTaskSchedulerPermittedIdentifiers</key>
<array>
<string>be.tramckrijte.workmanagerExample.taskId</string>
<string>be.tramckrijte.workmanagerExample.simpleTask</string>
<string>be.tramckrijte.workmanagerExample.rescheduledTask</string>
<string>be.tramckrijte.workmanagerExample.failedTask</string>
<string>be.tramckrijte.workmanagerExample.simpleDelayedTask</string>
<string>be.tramckrijte.workmanagerExample.simplePeriodicTask</string>
<string>be.tramckrijte.workmanagerExample.simplePeriodic1HourTask</string>
<string>be.tramckrijte.workmanagerExample.iOSBackgroundAppRefresh</string>
<string>be.tramckrijte.workmanagerExample.iOSBackgroundProcessingTask</string>
<string>com.mishmashtech.workmanagerExample.taskId</string>
<string>com.mishmashtech.workmanagerExample.simpleTask</string>
<string>com.mishmashtech.workmanagerExample.rescheduledTask</string>
<string>com.mishmashtech.workmanagerExample.failedTask</string>
<string>com.mishmashtech.workmanagerExample.simpleDelayedTask</string>
<string>com.mishmashtech.workmanagerExample.simplePeriodicTask</string>
<string>com.mishmashtech.workmanagerExample.simplePeriodic1HourTask</string>
<string>com.mishmashtech.workmanagerExample.iOSBackgroundAppRefresh</string>
<string>com.mishmashtech.workmanagerExample.iOSBackgroundProcessingTask</string>
</array>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
Expand Down
19 changes: 9 additions & 10 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@ import 'package:workmanager/workmanager.dart';

void main() => runApp(MaterialApp(home: MyApp()));

const simpleTaskKey = "be.tramckrijte.workmanagerExample.simpleTask";
const rescheduledTaskKey = "be.tramckrijte.workmanagerExample.rescheduledTask";
const failedTaskKey = "be.tramckrijte.workmanagerExample.failedTask";
const simpleDelayedTask = "be.tramckrijte.workmanagerExample.simpleDelayedTask";
const simpleTaskKey = "com.mishmashtech.workmanagerExample.simpleTask";
const rescheduledTaskKey = "com.mishmashtech.workmanagerExample.rescheduledTask";
const failedTaskKey = "com.mishmashtech.workmanagerExample.failedTask";
const simpleDelayedTask = "com.mishmashtech.workmanagerExample.simpleDelayedTask";
const simplePeriodicTask =
"be.tramckrijte.workmanagerExample.simplePeriodicTask";
"com.mishmashtech.workmanagerExample.simplePeriodicTask";
const simplePeriodic1HourTask =
"be.tramckrijte.workmanagerExample.simplePeriodic1HourTask";
"com.mishmashtech.workmanagerExample.simplePeriodic1HourTask";
const iOSBackgroundAppRefresh =
"be.tramckrijte.workmanagerExample.iOSBackgroundAppRefresh";
"com.mishmashtech.workmanagerExample.iOSBackgroundAppRefresh";
const iOSBackgroundProcessingTask =
"be.tramckrijte.workmanagerExample.iOSBackgroundProcessingTask";
"com.mishmashtech.workmanagerExample.iOSBackgroundProcessingTask";

final List<String> allTasks = [
simpleTaskKey,
Expand Down Expand Up @@ -224,7 +224,6 @@ class _MyAppState extends State<MyApp> {
Workmanager().registerPeriodicTask(
simplePeriodic1HourTask,
simplePeriodic1HourTask,
flexInterval: Duration(minutes: 15),
frequency: Duration(hours: 1),
);
}
Expand Down Expand Up @@ -263,7 +262,7 @@ class _MyAppState extends State<MyApp> {
_showNotInitialized();
return;
}
await Workmanager().registerProcessingTask(
await Workmanager().registerOneOffTask(
iOSBackgroundProcessingTask,
iOSBackgroundProcessingTask,
initialDelay: Duration(seconds: 20),
Expand Down
3 changes: 2 additions & 1 deletion example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ dependencies:
permission_handler:
flutter:
sdk: flutter
workmanager:
workmanager:
path: ../workmanager

dev_dependencies:
integration_test:
Expand Down
3 changes: 2 additions & 1 deletion melos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ packages:
- example
scripts:
get: melos exec -- dart pub get

analyze:
exec: dart analyze .
generate:dart:
run: melos exec -c 1 --depends-on="build_runner" --no-flutter -- "dart run build_runner build --delete-conflicting-outputs"
description: Build all generated files for Dart packages in this project.
4 changes: 2 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: workmanager_workspace
name: workmanager

environment:
sdk: '>=2.17.0 <3.0.0'
dev_dependencies:
melos: ^5.3.0
melos: ^6.2.0
2 changes: 1 addition & 1 deletion workmanager/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@
```xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="be.tramckrijte.workmanager_example">
package="com.mishmashtech.workmanager_example">

<!-- io.flutter.app.FlutterApplication is an android.app.Application that
calls FlutterMain.startInitialization(this); in its onCreate method.
Expand Down
14 changes: 7 additions & 7 deletions workmanager/android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
group 'dev.fluttercommunity.workmanager'
group 'com.mishmashtech.workmanager'
version '1.0-SNAPSHOT'

rootProject.allprojects {
Expand All @@ -14,7 +14,7 @@ apply plugin: 'kotlin-android'
android {
// Conditional for compatibility with AGP <4.2.
if (project.android.hasProperty("namespace")) {
namespace 'dev.fluttercommunity.workmanager'
namespace 'com.mishmashtech.workmanager'
}

sourceSets {
Expand All @@ -29,22 +29,22 @@ android {
disable 'InvalidPackage'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}

kotlinOptions {
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
kotlinOptions.jvmTarget = "1.8"
kotlinOptions.jvmTarget = "17"
}
}

}

dependencies {
def work_version = "2.9.0"
def work_version = "2.9.1"
implementation "androidx.work:work-runtime:$work_version"
implementation "androidx.concurrent:concurrent-futures:1.1.0"
implementation "androidx.concurrent:concurrent-futures:1.2.0"

testImplementation 'junit:junit:4.13.2'
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ class BackgroundWorker(
companion object {
const val TAG = "BackgroundWorker"

const val PAYLOAD_KEY = "be.tramckrijte.workmanager.INPUT_DATA"
const val DART_TASK_KEY = "be.tramckrijte.workmanager.DART_TASK"
const val IS_IN_DEBUG_MODE_KEY = "be.tramckrijte.workmanager.IS_IN_DEBUG_MODE_KEY"
const val PAYLOAD_KEY = "com.mishmashtech.workmanager.INPUT_DATA"
const val DART_TASK_KEY = "com.mishmashtech.workmanager.DART_TASK"
const val IS_IN_DEBUG_MODE_KEY = "com.mishmashtech.workmanager.IS_IN_DEBUG_MODE_KEY"

const val BACKGROUND_CHANNEL_NAME =
"be.tramckrijte.workmanager/background_channel_work_manager"
"com.mishmashtech.workmanager/background_channel_work_manager"
const val BACKGROUND_CHANNEL_INITIALIZED = "backgroundChannelInitialized"

private val flutterLoader = FlutterLoader()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import android.content.Context

object SharedPreferenceHelper {
private const val SHARED_PREFS_FILE_NAME = "flutter_workmanager_plugin"
private const val CALLBACK_DISPATCHER_HANDLE_KEY = "be.tramckrijte.workmanager.CALLBACK_DISPATCHER_HANDLE_KEY"
private const val CALLBACK_DISPATCHER_HANDLE_KEY = "com.mishmashtech.workmanager.CALLBACK_DISPATCHER_HANDLE_KEY"

private fun Context.prefs() = getSharedPreferences(SHARED_PREFS_FILE_NAME, Context.MODE_PRIVATE)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class WorkmanagerPlugin : FlutterPlugin {
messenger: BinaryMessenger,
) {
workmanagerCallHandler = WorkmanagerCallHandler(context)
methodChannel = MethodChannel(messenger, "be.tramckrijte.workmanager/foreground_channel_work_manager")
methodChannel = MethodChannel(messenger, "com.mishmashtech.workmanager/foreground_channel_work_manager")
methodChannel?.setMethodCallHandler(workmanagerCallHandler)
}

Expand Down
2 changes: 1 addition & 1 deletion workmanager/ios/Classes/BackgroundWorker.swift
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ class BackgroundWorker {
result(true) // Agree to Flutter's method invocation
var arguments = self.backgroundMode.onResultSendArguments
if self.inputData != "" {
arguments = arguments.merging(["be.tramckrijte.workmanager.INPUT_DATA": self.inputData]) { current, _ in current }
arguments = arguments.merging(["com.mishmashtech.workmanager.INPUT_DATA": self.inputData]) { current, _ in current }
}

backgroundMethodChannel?.invokeMethod(
Expand Down
2 changes: 1 addition & 1 deletion workmanager/ios/Classes/SwiftWorkmanagerPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ extension String {
}

public class SwiftWorkmanagerPlugin: FlutterPluginAppLifeCycleDelegate {
static let identifier = "be.tramckrijte.workmanager"
static let identifier = "com.mishmashtech.workmanager"

private static var flutterPluginRegistrantCallback: FlutterPluginRegistrantCallback?

Expand Down
12 changes: 6 additions & 6 deletions workmanager/lib/src/workmanager.dart
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ class Workmanager {

static final Workmanager _instance = Workmanager._internal(
const MethodChannel(
"be.tramckrijte.workmanager/background_channel_work_manager"),
"com.mishmashtech.workmanager/background_channel_work_manager"),
const MethodChannel(
"be.tramckrijte.workmanager/foreground_channel_work_manager"));
"com.mishmashtech.workmanager/foreground_channel_work_manager"));

/// Use this constant inside your callbackDispatcher to identify when an iOS Background Fetch occurred.
///
Expand Down Expand Up @@ -127,19 +127,19 @@ class Workmanager {
static bool _isInDebugMode = false;

MethodChannel _backgroundChannel = const MethodChannel(
"be.tramckrijte.workmanager/background_channel_work_manager");
"com.mishmashtech.workmanager/background_channel_work_manager");
MethodChannel _foregroundChannel = const MethodChannel(
"be.tramckrijte.workmanager/foreground_channel_work_manager");
"com.mishmashtech.workmanager/foreground_channel_work_manager");

/// A helper function so you only need to implement a [BackgroundTaskHandler]
void executeTask(final BackgroundTaskHandler backgroundTask) {
WidgetsFlutterBinding.ensureInitialized();
DartPluginRegistrant.ensureInitialized();

_backgroundChannel.setMethodCallHandler((call) async {
final inputData = call.arguments["be.tramckrijte.workmanager.INPUT_DATA"];
final inputData = call.arguments["com.mishmashtech.workmanager.INPUT_DATA"];
return backgroundTask(
call.arguments["be.tramckrijte.workmanager.DART_TASK"],
call.arguments["com.mishmashtech.workmanager.DART_TASK"],
inputData == null ? null : jsonDecode(inputData),
);
});
Expand Down
16 changes: 8 additions & 8 deletions workmanager/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
name: workmanager
description: Flutter Workmanager. This plugin allows you to schedule background work on Android and iOS.
version: 0.5.2
description: Flutter Workmanager fork.
version: 1.0.0
homepage: https://github.com/fluttercommunity/flutter_workmanager
repository: https://github.com/fluttercommunity/flutter_workmanager
issue_tracker: https://github.com/fluttercommunity/flutter_workmanager/issues

environment:
sdk: '>=3.1.2 <4.0.0'
flutter: ">=2.5.0"
flutter: ">=3.0.0"

dependencies:
flutter:
sdk: flutter

dev_dependencies:
build_runner: ^2.1.7
test: ^1.16.3
mockito: ^5.0.4
get_it: ^7.2.0
build_runner: ^2.4.13
test: ^1.25.7
mockito: ^5.4.4
get_it: ^8.0.1
flutter_test:
sdk: flutter
flutter_lints: ^2.0.1
flutter_lints: ^5.0.0

flutter:
plugin:
Expand Down
Loading