-
-
Notifications
You must be signed in to change notification settings - Fork 531
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
exp: starting sqflite darwin plugin (placeholder) without FMDB
- Loading branch information
1 parent
46eb20e
commit 37fba4e
Showing
25 changed files
with
635 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Miscellaneous | ||
*.class | ||
*.log | ||
*.pyc | ||
*.swp | ||
.DS_Store | ||
.atom/ | ||
.buildlog/ | ||
.history | ||
.svn/ | ||
migrate_working_dir/ | ||
|
||
# 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 | ||
# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock. | ||
/pubspec.lock | ||
**/doc/api/ | ||
.dart_tool/ | ||
build/ | ||
/.metadata |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
## 0.0.1 | ||
|
||
* TODO: Describe initial release. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
BSD 2-Clause License | ||
|
||
Copyright (c) 2024, Alexandre Roux Tekartik | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are met: | ||
|
||
* Redistributions of source code must retain the above copyright notice, this | ||
list of conditions and the following disclaimer. | ||
|
||
* Redistributions in binary form must reproduce the above copyright notice, | ||
this list of conditions and the following disclaimer in the documentation | ||
and/or other materials provided with the distribution. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | ||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | ||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# sqflite_darwin | ||
|
||
SQFlite plugin for Flutter on macOS/iOS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
include: package:flutter_lints/flutter.yaml | ||
|
||
# Additional information about this file can be found at | ||
# https://dart.dev/guides/language/analysis-options |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
.idea/ | ||
.vagrant/ | ||
.sconsign.dblite | ||
.svn/ | ||
|
||
.DS_Store | ||
*.swp | ||
profile | ||
|
||
DerivedData/ | ||
build/ | ||
GeneratedPluginRegistrant.h | ||
GeneratedPluginRegistrant.m | ||
|
||
.generated/ | ||
|
||
*.pbxuser | ||
*.mode1v3 | ||
*.mode2v3 | ||
*.perspectivev3 | ||
|
||
!default.pbxuser | ||
!default.mode1v3 | ||
!default.mode2v3 | ||
!default.perspectivev3 | ||
|
||
xcuserdata | ||
|
||
*.moved-aside | ||
|
||
*.pyc | ||
*sync/ | ||
Icon? | ||
.tags* | ||
|
||
/Flutter/Generated.xcconfig | ||
/Flutter/ephemeral/ | ||
/Flutter/flutter_export_environment.sh |
Empty file.
33 changes: 33 additions & 0 deletions
33
packages_flutter/sqflite_darwin/darwin/Classes/SqfliteDarwinPlugin.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#if os(iOS) | ||
import Flutter | ||
import UIKit | ||
#elseif os(macOS) | ||
import FlutterMacOS | ||
import Cocoa | ||
#endif | ||
|
||
|
||
public class SqfliteDarwinPlugin: NSObject, FlutterPlugin { | ||
public static func register(with registrar: FlutterPluginRegistrar) { | ||
#if os(iOS) | ||
let channel = FlutterMethodChannel(name: "sqflite_darwin", binaryMessenger: registrar.messenger()); | ||
#elseif os (macOS) | ||
let channel = FlutterMethodChannel(name: "sqflite_darwin", binaryMessenger: registrar.messenger); | ||
#endif | ||
let instance = SqfliteDarwinPlugin() | ||
registrar.addMethodCallDelegate(instance, channel: channel) | ||
} | ||
|
||
public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) { | ||
switch call.method { | ||
case "getPlatformVersion": | ||
#if os(iOS) | ||
result("iOS " + UIDevice.current.systemVersion) | ||
#elseif os (macOS) | ||
result("macOS " + ProcessInfo.processInfo.operatingSystemVersionString) | ||
#endif | ||
default: | ||
result(FlutterMethodNotImplemented) | ||
} | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
packages_flutter/sqflite_darwin/darwin/Resources/PrivacyInfo.xcprivacy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>NSPrivacyTrackingDomains</key> | ||
<array/> | ||
<key>NSPrivacyAccessedAPITypes</key> | ||
<array/> | ||
<key>NSPrivacyCollectedDataTypes</key> | ||
<array/> | ||
<key>NSPrivacyTracking</key> | ||
<false/> | ||
</dict> | ||
</plist> |
24 changes: 24 additions & 0 deletions
24
packages_flutter/sqflite_darwin/darwin/sqflite_darwin.podspec
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# | ||
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html. | ||
# Run `pod lib lint sqflite_darwin.podspec` to validate before publishing. | ||
# | ||
Pod::Spec.new do |s| | ||
s.name = 'sqflite_darwin' | ||
s.version = '0.0.1' | ||
s.summary = 'SQLite plugin.' | ||
s.description = <<-DESC | ||
Access SQLite database. | ||
DESC | ||
s.homepage = 'https://github.com/tekartik/sqflite' | ||
s.license = { :file => '../LICENSE' } | ||
s.author = { 'Tekartik' => '[email protected]' } | ||
s.source = { :path => '.' } | ||
s.source_files = 'Classes/**/*' | ||
s.ios.dependency 'Flutter' | ||
s.osx.dependency 'FlutterMacOS' | ||
s.ios.deployment_target = '12.0' | ||
s.osx.deployment_target = '10.14' | ||
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386' } | ||
s.swift_version = '5.0' | ||
s.resource_bundles = {'sqflite_darwin_privacy' => ['Resources/PrivacyInfo.xcprivacy']} | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# Miscellaneous | ||
*.class | ||
*.log | ||
*.pyc | ||
*.swp | ||
.DS_Store | ||
.atom/ | ||
.buildlog/ | ||
.history | ||
.svn/ | ||
migrate_working_dir/ | ||
|
||
# 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 | ||
.pub-cache/ | ||
.pub/ | ||
/build/ | ||
|
||
# Symbolication related | ||
app.*.symbols | ||
|
||
# Obfuscation related | ||
app.*.map.json | ||
|
||
# Android Studio will place build artifacts here | ||
/android/app/debug | ||
/android/app/profile | ||
/android/app/release | ||
/ios/ | ||
/macos/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# sqflite_darwin_example | ||
|
||
Demonstrates how to use the sqflite_darwin plugin. |
28 changes: 28 additions & 0 deletions
28
packages_flutter/sqflite_darwin/example/analysis_options.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# This file configures the analyzer, which statically analyzes Dart code to | ||
# check for errors, warnings, and lints. | ||
# | ||
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled | ||
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be | ||
# invoked from the command line by running `flutter analyze`. | ||
|
||
# The following line activates a set of recommended lints for Flutter apps, | ||
# packages, and plugins designed to encourage good coding practices. | ||
include: package:flutter_lints/flutter.yaml | ||
|
||
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.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 | ||
# or a specific dart file by using the `// ignore: name_of_lint` and | ||
# `// ignore_for_file: name_of_lint` syntax on the line or in the file | ||
# producing the lint. | ||
rules: | ||
# avoid_print: false # Uncomment to disable the `avoid_print` rule | ||
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule | ||
|
||
# Additional information about this file can be found at | ||
# https://dart.dev/guides/language/analysis-options |
25 changes: 25 additions & 0 deletions
25
packages_flutter/sqflite_darwin/example/integration_test/plugin_integration_test.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// 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:flutter_test/flutter_test.dart'; | ||
import 'package:integration_test/integration_test.dart'; | ||
|
||
import 'package:sqflite_darwin/sqflite_darwin.dart'; | ||
|
||
void main() { | ||
IntegrationTestWidgetsFlutterBinding.ensureInitialized(); | ||
|
||
testWidgets('getPlatformVersion test', (WidgetTester tester) async { | ||
final SqfliteDarwin plugin = SqfliteDarwin(); | ||
final String? version = await plugin.getPlatformVersion(); | ||
// The version string depends on the host platform running the test, so | ||
// just assert that some non-empty string is returned. | ||
expect(version?.isNotEmpty, true); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'dart:async'; | ||
|
||
import 'package:flutter/services.dart'; | ||
import 'package:sqflite_darwin/sqflite_darwin.dart'; | ||
|
||
void main() { | ||
runApp(const MyApp()); | ||
} | ||
|
||
class MyApp extends StatefulWidget { | ||
const MyApp({super.key}); | ||
|
||
@override | ||
State<MyApp> createState() => _MyAppState(); | ||
} | ||
|
||
class _MyAppState extends State<MyApp> { | ||
String _platformVersion = 'Unknown'; | ||
final _sqfliteDarwinPlugin = SqfliteDarwin(); | ||
|
||
@override | ||
void initState() { | ||
super.initState(); | ||
initPlatformState(); | ||
} | ||
|
||
// Platform messages are asynchronous, so we initialize in an async method. | ||
Future<void> initPlatformState() async { | ||
String platformVersion; | ||
// Platform messages may fail, so we use a try/catch PlatformException. | ||
// We also handle the message potentially returning null. | ||
try { | ||
platformVersion = | ||
await _sqfliteDarwinPlugin.getPlatformVersion() ?? 'Unknown platform version'; | ||
} on PlatformException { | ||
platformVersion = 'Failed to get platform version.'; | ||
} | ||
|
||
// If the widget was removed from the tree while the asynchronous platform | ||
// message was in flight, we want to discard the reply rather than calling | ||
// setState to update our non-existent appearance. | ||
if (!mounted) return; | ||
|
||
setState(() { | ||
_platformVersion = platformVersion; | ||
}); | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return MaterialApp( | ||
home: Scaffold( | ||
appBar: AppBar( | ||
title: const Text('Plugin example app'), | ||
), | ||
body: Center( | ||
child: Text('Running on: $_platformVersion\n'), | ||
), | ||
), | ||
); | ||
} | ||
} |
Oops, something went wrong.