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

feat(wifi_connect_to): plugin added #276

Draft
wants to merge 13 commits into
base: master
Choose a base branch
from
Draft
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
3 changes: 2 additions & 1 deletion .github/workflows/cancel_previous.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@ jobs:
workflow_id: >-
all_plugins.yaml,
wifi_iot.yaml,
wifi_scan.yaml
wifi_scan.yaml,
wifi_connect_to.yaml
all_but_latest: true
91 changes: 91 additions & 0 deletions .github/workflows/wifi_connect_to.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# Build wifi_connect_to example
name: wifi_connect_to

on:
pull_request:
paths:
- "packages/wifi_connect_to/**"
- ".github/workflows/wifi_connect_to.yaml"

env:
PLUGIN_SCOPE: "*wifi_connect_to*"
PLUGIN_EXAMPLE_SCOPE: "*wifi_connect_to_example*"

jobs:
android:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: "Checkout repository"
uses: actions/checkout@v2
- name: "Install Flutter"
run: ./.github/workflows/scripts/install-flutter.sh stable
- name: "Install Tools"
run: ./.github/workflows/scripts/install-tools.sh
- name: "Build Example"
run: ./.github/workflows/scripts/build-examples.sh android ./lib/main.dart

ios:
runs-on: macos-latest
timeout-minutes: 30
steps:
- name: "Checkout repository"
uses: actions/checkout@v2
- name: "Install Flutter"
run: ./.github/workflows/scripts/install-flutter.sh stable
- name: "Install Tools"
run: ./.github/workflows/scripts/install-tools.sh
- name: "Build Example"
run: ./.github/workflows/scripts/build-examples.sh ios ./lib/main.dart

# macos:
# runs-on: macos-latest
# timeout-minutes: 30
# steps:
# - name: "Checkout repository"
# uses: actions/checkout@v2
# - name: "Install Flutter"
# run: ./.github/workflows/scripts/install-flutter.sh stable
# - name: "Install Tools"
# run: ./.github/workflows/scripts/install-tools.sh
# - name: "Build Example"
# run: ./.github/workflows/scripts/build-examples.sh macos ./lib/main.dart

# linux:
# runs-on: ubuntu-latest
# timeout-minutes: 30
# steps:
# - name: "Checkout repository"
# uses: actions/checkout@v2
# - name: "Install Flutter"
# run: ./.github/workflows/scripts/install-flutter.sh stable
# - name: "Install Tools"
# run: ./.github/workflows/scripts/install-tools.sh
# - name: "Build Example"
# run: ./.github/workflows/scripts/build-examples.sh linux ./lib/main.dart

# windows:
# runs-on: ubuntu-latest
# timeout-minutes: 30
# steps:
# - name: "Checkout repository"
# uses: actions/checkout@v2
# - name: "Install Flutter"
# run: ./.github/workflows/scripts/install-flutter.sh stable
# - name: "Install Tools"
# run: ./.github/workflows/scripts/install-tools.sh
# - name: "Build Example"
# run: ./.github/workflows/scripts/build-examples.sh windows ./lib/main.dart

# web:
# runs-on: ubuntu-latest
# timeout-minutes: 30
# steps:
# - name: "Checkout repository"
# uses: actions/checkout@v2
# - name: "Install Flutter"
# run: ./.github/workflows/scripts/install-flutter.sh stable
# - name: "Install Tools"
# run: ./.github/workflows/scripts/install-tools.sh
# - name: "Build Example"
# run: ./.github/workflows/scripts/build-examples.sh web ./lib/main.dart
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ WiFiFlutter is a suite of Flutter plugins that enable Flutter apps to use variou
- [Basic (`wifi_basic`)](#wifi_basic)
-->
- [Scan (`wifi_scan`)](#wifi_scan)
- [Connect (`wifi_connect_to`)](#wifi_connect_to)
<!--
- [Station (`wifi_sta`)](#wifi_sta)
- [Access Point / Hotspot (`wifi_ap`)](#wifi_ap)
- [Aware (`wifi_aware`)](#wifi_aware)
- [Location / RTT (`wifi_rtt`)](#wifi_rtt)
Expand Down Expand Up @@ -97,13 +97,12 @@ Flutter plugin to scan for nearby visible WiFi access points.

---

<!-- HIDING until available
### `wifi_sta`
> [![wifi_sta][sta_workflow_badge]][sta_workflow] [![wifi_sta][sta_pub_badge]][sta_pub] [![pub points][sta_pub_points_badge]][sta_pub_points]
### `wifi_connect_to`
> [![wifi_connect_to][connect_workflow_badge]][connect_workflow] [![wifi_connect_to][connect_pub_badge]][connect_pub] [![pub points][connect_pub_points_badge]][connect_pub_points]

Flutter plugin to connect or disconnect device to a traditional WiFi network.
Flutter plugin to connect (and disconnect) to a WiFi access point.

[[View Source][sta_code]]
[[View Source][connect_code]]

#### Platform Support
| Android | iOS |
Expand All @@ -112,6 +111,7 @@ Flutter plugin to connect or disconnect device to a traditional WiFi network.

---

<!-- HIDING until available
### `wifi_ap`
> [![wifi_ap][ap_workflow_badge]][ap_workflow] [![wifi_ap][ap_pub_badge]][ap_pub] [![pub points][ap_pub_points_badge]][ap_pub_points]

Expand Down Expand Up @@ -211,13 +211,13 @@ This project follows the [all-contributors][all_contributors] specification. Con
[scan_pub_points]: https://pub.dev/packages/wifi_scan/score
[scan_pub_points_badge]: https://img.shields.io/pub/likes/wifi_scan.svg

[sta_code]: https://github.com/flutternetwork/WiFiFlutter/tree/master/packages/wifi_sta
[sta_workflow]: https://github.com/flutternetwork/WiFiFlutter/actions/workflows/wifi_sta.yaml
[sta_workflow_badge]: https://github.com/flutternetwork/WiFiFlutter/actions/workflows/wifi_sta.yaml/badge.svg
[sta_pub]: https://pub.dev/packages/wifi_sta
[sta_pub_badge]: https://img.shields.io/pub/v/wifi_sta.svg
[sta_pub_points]: https://pub.dev/packages/wifi_sta/score
[sta_pub_points_badge]: https://img.shields.io/pub/likes/wifi_sta.svg
[connect_code]: https://github.com/flutternetwork/WiFiFlutter/tree/master/packages/wifi_connect_to
[connect_workflow]: https://github.com/flutternetwork/WiFiFlutter/actions/workflows/wifi_connect_to.yaml
[connect_workflow_badge]: https://github.com/flutternetwork/WiFiFlutter/actions/workflows/wifi_connect_to.yaml/badge.svg
[connect_pub]: https://pub.dev/packages/wifi_connect_to
[connect_pub_badge]: https://img.shields.io/pub/v/wifi_connect_to.svg
[connect_pub_points]: https://pub.dev/packages/wifi_connect_to/score
[connect_pub_points_badge]: https://img.shields.io/pub/likes/wifi_connect_to.svg

[ap_code]: https://github.com/flutternetwork/WiFiFlutter/tree/master/packages/wifi_ap
[ap_workflow]: https://github.com/flutternetwork/WiFiFlutter/actions/workflows/wifi_ap.yaml
Expand Down
30 changes: 30 additions & 0 deletions packages/wifi_connect_to/.gitignore
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/
.packages
build/
33 changes: 33 additions & 0 deletions packages/wifi_connect_to/.metadata
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# 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.

version:
revision: ffccd96b62ee8cec7740dab303538c5fc26ac543
channel: stable

project_type: plugin

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

# User provided section

# List of Local paths (relative to this file) that should be
# ignored by the migrate tool.
#
# Files that are not part of the templates will be ignored by default.
unmanaged_files:
- 'lib/main.dart'
- 'ios/Runner.xcodeproj/project.pbxproj'
3 changes: 3 additions & 0 deletions packages/wifi_connect_to/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## 0.0.1

* TODO: Describe initial release.
19 changes: 19 additions & 0 deletions packages/wifi_connect_to/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Copyright (c) 2022 WiFiFlutter

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
15 changes: 15 additions & 0 deletions packages/wifi_connect_to/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# wifi_connect_to *[COMING SOON]*

Flutter plugin to connect (and disconnect) to a WiFi access point.

## Getting Started

This project is a starting point for a Flutter
[plug-in package](https://flutter.dev/developing-packages/),
a specialized package that includes platform-specific implementation code for
Android and/or iOS.

For help getting started with Flutter development, view the
[online documentation](https://flutter.dev/docs), which offers tutorials,
samples, guidance on mobile development, and a full API reference.

9 changes: 9 additions & 0 deletions packages/wifi_connect_to/android/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
*.iml
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
.DS_Store
/build
/captures
.cxx
46 changes: 46 additions & 0 deletions packages/wifi_connect_to/android/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
group 'dev.flutternetwork.wifi.wifi_connect_to'
version '1.0-SNAPSHOT'

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

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

allprojects {
repositories {
google()
mavenCentral()
}
}

apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'

android {
compileSdkVersion 31

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

kotlinOptions {
jvmTarget = '1.8'
}

sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}

defaultConfig {
minSdkVersion 16
}
}
1 change: 1 addition & 0 deletions packages/wifi_connect_to/android/settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rootProject.name = 'wifi_connect_to'
3 changes: 3 additions & 0 deletions packages/wifi_connect_to/android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="dev.flutternetwork.wifi.wifi_connect_to">
</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package dev.flutternetwork.wifi.wifi_connect_to

import androidx.annotation.NonNull

import io.flutter.embedding.engine.plugins.FlutterPlugin
import io.flutter.plugin.common.MethodCall
import io.flutter.plugin.common.MethodChannel
import io.flutter.plugin.common.MethodChannel.MethodCallHandler
import io.flutter.plugin.common.MethodChannel.Result

/** WifiConnectToPlugin */
class WifiConnectToPlugin: FlutterPlugin, MethodCallHandler {
/// The MethodChannel that will the communication between Flutter and native Android
///
/// This local reference serves to register the plugin with the Flutter Engine and unregister it
/// when the Flutter Engine is detached from the Activity
private lateinit var channel : MethodChannel

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

override fun onMethodCall(@NonNull call: MethodCall, @NonNull result: Result) {
if (call.method == "getPlatformVersion") {
result.success("Android ${android.os.Build.VERSION.RELEASE}")
} else {
result.notImplemented()
}
}

override fun onDetachedFromEngine(@NonNull binding: FlutterPlugin.FlutterPluginBinding) {
channel.setMethodCallHandler(null)
}
}
Loading