Skip to content

Commit

Permalink
Setup plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
lbirkert committed Aug 30, 2024
1 parent 99f2745 commit 35ce411
Show file tree
Hide file tree
Showing 7 changed files with 60 additions and 16 deletions.
6 changes: 3 additions & 3 deletions qb-mobile/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ plugins {
}

android {
namespace = "com.example.qb_mobile"
namespace = "org.quixbyte.qb_mobile"
compileSdk = flutter.compileSdkVersion
ndkVersion = flutter.ndkVersion

packagingOptions {
jniLibs {
useLegacyPackaging = true
Expand All @@ -27,7 +27,7 @@ android {

defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId = "com.example.qb_mobile"
applicationId "org.quixbyte.qb_mobile"
// You can update the following values to match your application needs.
// For more information, see: https://flutter.dev/to/review-gradle-config.
minSdk = flutter.minSdkVersion
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package org.quixbyte.qb_mobile

import androidx.annotation.NonNull
import io.flutter.embedding.engine.plugins.FlutterPlugin
import io.flutter.plugin.common.MethodCall
import io.flutter.plugin.common.MethodChannel

class DocumentsProviderPlugin : FlutterPlugin, MethodChannel.MethodCallHandler {
private lateinit var channel: MethodChannel
private val CHANNEL_ID = "org.quixbyte.qb_mobile/android_documents_provider"

override fun onAttachedToEngine(
@NonNull flutterPluginBinding: FlutterPlugin.FlutterPluginBinding
) {
channel = MethodChannel(flutterPluginBinding.binaryMessenger, CHANNEL_ID)
channel.setMethodCallHandler(this)
}

override fun onMethodCall(@NonNull call: MethodCall, @NonNull result: MethodChannel.Result) {
if (call.method == "kekw") {
result.success("kekw")
} else {
result.success("abc")
// result.notImplemented()
}
}

override fun onDetachedFromEngine(@NonNull binding: FlutterPlugin.FlutterPluginBinding) {
channel.setMethodCallHandler(null)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package org.quixbyte.qb_mobile

import androidx.annotation.NonNull
import io.flutter.embedding.android.FlutterActivity
import io.flutter.embedding.engine.FlutterEngine

class MainActivity : FlutterActivity() {
override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) {
super.configureFlutterEngine(flutterEngine)
}
}
12 changes: 6 additions & 6 deletions qb-mobile/ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.example.qbMobile;
PRODUCT_BUNDLE_IDENTIFIER = org.quixbyte.qb_mobile;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_VERSION = 5.0;
Expand All @@ -384,7 +384,7 @@
CURRENT_PROJECT_VERSION = 1;
GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.example.qbMobile.RunnerTests;
PRODUCT_BUNDLE_IDENTIFIER = org.quixbyte.qb_mobile;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
Expand All @@ -401,7 +401,7 @@
CURRENT_PROJECT_VERSION = 1;
GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.example.qbMobile.RunnerTests;
PRODUCT_BUNDLE_IDENTIFIER = org.quixbyte.qb_mobile;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner";
Expand All @@ -416,7 +416,7 @@
CURRENT_PROJECT_VERSION = 1;
GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.example.qbMobile.RunnerTests;
PRODUCT_BUNDLE_IDENTIFIER = org.quixbyte.qb_mobile;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner";
Expand Down Expand Up @@ -547,7 +547,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.example.qbMobile;
PRODUCT_BUNDLE_IDENTIFIER = org.quixbyte.qb_mobile;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
Expand All @@ -569,7 +569,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.example.qbMobile;
PRODUCT_BUNDLE_IDENTIFIER = org.quixbyte.qb_mobile;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_VERSION = 5.0;
Expand Down
2 changes: 1 addition & 1 deletion qb-mobile/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ class QuixByteHomePage extends StatelessWidget {
// wireframe for each widget.
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
FilledButton(onPressed: () {}, child: const Text("kekw")),
FilledButton(onPressed: () {}, child: const Text("Settings")),
FilledButton(onPressed: () {}, child: const Text("Manage")),
FilledButton(onPressed: () {}, child: const Text("View Files")),
Expand All @@ -89,4 +90,3 @@ class QuixByteHomePage extends StatelessWidget {
);
}
}

9 changes: 8 additions & 1 deletion qb-mobile/lib/service.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'dart:convert';
import 'dart:ui';
import 'dart:async';
import 'package:flutter/services.dart';
import 'package:path_provider/path_provider.dart';
import 'package:process/process.dart';

Expand All @@ -12,6 +13,9 @@ import 'package:qb_mobile/src/rust/frb_generated.dart';

const ProcessManager processManager = LocalProcessManager();

const methodChannel =
MethodChannel('org.quixbyte.qb_mobile/android_documents_provider');

Future<void> initializeService() async {
final service = FlutterBackgroundService();

Expand Down Expand Up @@ -65,11 +69,14 @@ void onStart(ServiceInstance service) async {
print("background service started!");
});

final percentage = await methodChannel.invokeMethod('kekw');
print("Battery percentage: $percentage");

//Timer.periodic(const Duration(seconds: 1), (timer) {
// print("service is successfully running ${DateTime.now().second}");
//});

while(true) {
while (true) {
await daemon.process();
}
}
Expand Down

0 comments on commit 35ce411

Please sign in to comment.