Skip to content

Commit

Permalink
Update project structure
Browse files Browse the repository at this point in the history
  • Loading branch information
ctrysbita committed Mar 7, 2019
1 parent c0fd806 commit d780665
Show file tree
Hide file tree
Showing 21 changed files with 68 additions and 44 deletions.
7 changes: 0 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,3 @@ pubspec.lock

build/
android/src/main/libs
example/ios/Flutter/Debug.xcconfig
example/ios/Flutter/Release.xcconfig
example/ios/Podfile
example/ios/Runner.xcodeproj/project.pbxproj
example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
example/ios/Runner.xcworkspace/contents.xcworkspacedata
example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
2 changes: 1 addition & 1 deletion .metadata
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# This file should be version controlled and should not be manually edited.

version:
revision: 5391447fae6209bb21a89e6a5a6583cac1af9b4b
revision: 8661d8aecd626f7f57ccbcb735553edc05a2e713
channel: beta

project_type: plugin
9 changes: 5 additions & 4 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
group 'io.xdea.fluttervpn'
group 'io.xdea.flutter_vpn'
version '1.0-SNAPSHOT'

buildscript {
ext.kotlin_version = '1.2.71'
ext.kotlin_version = '1.3.20'
repositories {
google()
jcenter()
}

dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.android.tools.build:gradle:3.3.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// For downloading prebuilt libs
classpath 'de.undercouch:gradle-download-task:3.4.3'
}
}

apply plugin: 'de.undercouch.download'

// Download pre-build native libs.
// Download prebuilt native libs.
task downloadNaticeLib(type: Download) {
src 'https://github.com/X-dea/Flutter_VPN/releases/download/v0.0.2/strongswan_libs_v5.7.2.zip'
dest "$buildDir/native.zip"
Expand Down
2 changes: 1 addition & 1 deletion android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="io.xdea.fluttervpn">
package="io.xdea.flutter_vpn">
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
import java.util.UUID;

import io.flutter.plugin.common.EventChannel;
import io.xdea.fluttervpn.VPNStateHandler;
import io.xdea.flutter_vpn.VPNStateHandler;


public class CharonVpnService extends VpnService implements Runnable {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* GNU General Public License for more details.
*/

package io.xdea.fluttervpn
package io.xdea.flutter_vpn

import android.app.Activity.RESULT_OK
import android.content.Intent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* GNU General Public License for more details.
*/

package io.xdea.fluttervpn
package io.xdea.flutter_vpn

import io.flutter.plugin.common.EventChannel

Expand Down Expand Up @@ -43,4 +43,4 @@ class VPNStateHandler : EventChannel.StreamHandler {
override fun onCancel(p0: Any?) {
eventHandler = null
}
}
}
3 changes: 1 addition & 2 deletions example/.gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Miscellaneous
*.class
*.lock
*.log
*.pyc
*.swp
Expand All @@ -26,7 +25,7 @@
.packages
.pub-cache/
.pub/
build/
/build/

# Android related
**/android/**/gradle-wrapper.jar
Expand Down
2 changes: 1 addition & 1 deletion example/.metadata
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# This file should be version controlled and should not be manually edited.

version:
revision: 5391447fae6209bb21a89e6a5a6583cac1af9b4b
revision: 8661d8aecd626f7f57ccbcb735553edc05a2e713
channel: beta

project_type: app
13 changes: 13 additions & 0 deletions example/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
# flutter_vpn_example

Demonstrates how to use the flutter_vpn plugin.

## Getting Started

This project is a starting point for a Flutter application.

A few resources to get you started if this is your first Flutter project:

- [Lab: Write your first Flutter app](https://flutter.io/docs/get-started/codelab)
- [Cookbook: Useful Flutter samples](https://flutter.io/docs/cookbook)

For help getting started with Flutter, view our
[online documentation](https://flutter.io/docs), which offers tutorials,
samples, guidance on mobile development, and a full API reference.
6 changes: 3 additions & 3 deletions example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ android {
}

defaultConfig {
applicationId "io.xdea.fluttervpn.example"
minSdkVersion 19
targetSdkVersion 27
applicationId "io.xdea.flutter_vpn_example"
minSdkVersion 16
targetSdkVersion 28
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
Expand Down
6 changes: 3 additions & 3 deletions example/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="io.xdea.fluttervpnexample">
package="io.xdea.flutter_vpn_example">

<!-- The INTERNET permission is required for development. Specifically,
flutter needs it to communicate with the running application
Expand All @@ -14,13 +14,13 @@
FlutterApplication and put your custom class here. -->
<application
android:name="io.flutter.app.FlutterApplication"
android:label="VPN"
android:label="flutter_vpn_example"
android:icon="@mipmap/ic_launcher">
<activity
android:name=".MainActivity"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<!-- This keeps the window background of the activity showing
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.xdea.fluttervpnexample
package io.xdea.flutter_vpn_example

import android.os.Bundle

Expand Down
4 changes: 2 additions & 2 deletions example/android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
buildscript {
ext.kotlin_version = '1.2.71'
ext.kotlin_version = '1.3.20'
repositories {
google()
jcenter()
}

dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.android.tools.build:gradle:3.3.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
Expand Down
4 changes: 0 additions & 4 deletions example/ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

/* Begin PBXBuildFile section */
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
2D5378261FAA1A9400D5DBA9 /* flutter_assets in Resources */ = {isa = PBXBuildFile; fileRef = 2D5378251FAA1A9400D5DBA9 /* flutter_assets */; };
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; };
3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
Expand Down Expand Up @@ -39,7 +38,6 @@
/* Begin PBXFileReference section */
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; };
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
2D5378251FAA1A9400D5DBA9 /* flutter_assets */ = {isa = PBXFileReference; lastKnownFileType = folder; name = flutter_assets; path = Flutter/flutter_assets; sourceTree = SOURCE_ROOT; };
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = "<group>"; };
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -71,7 +69,6 @@
9740EEB11CF90186004384FC /* Flutter */ = {
isa = PBXGroup;
children = (
2D5378251FAA1A9400D5DBA9 /* flutter_assets */,
3B80C3931E831B6300D905FE /* App.framework */,
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */,
9740EEBA1CF902C7004384FC /* Flutter.framework */,
Expand Down Expand Up @@ -187,7 +184,6 @@
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,
9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */,
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */,
2D5378261FAA1A9400D5DBA9 /* flutter_assets in Resources */,
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down
2 changes: 1 addition & 1 deletion example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: Demonstrates how to use the flutter_vpn plugin.
publish_to: 'none'

environment:
sdk: ">=2.0.0-dev.68.0 <3.0.0"
sdk: ">=2.1.0 <3.0.0"

dependencies:
flutter:
Expand Down
5 changes: 3 additions & 2 deletions example/test/widget_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';

import 'package:flutter_vpn_example/main.dart';

void main() {
Expand All @@ -17,8 +18,8 @@ void main() {
// Verify that platform version is retrieved.
expect(
find.byWidgetPredicate(
(Widget widget) =>
widget is Text && widget.data.startsWith('Running on:'),
(Widget widget) => widget is Text &&
widget.data.startsWith('Running on:'),
),
findsOneWidget,
);
Expand Down
3 changes: 0 additions & 3 deletions flutter_vpn.iml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/lib" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/android" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/ios" isTestSource="false" />
<excludeFolder url="file://$MODULE_DIR$/.dart_tool" />
<excludeFolder url="file://$MODULE_DIR$/.idea" />
<excludeFolder url="file://$MODULE_DIR$/.pub" />
Expand All @@ -14,7 +12,6 @@
<excludeFolder url="file://$MODULE_DIR$/example/.pub" />
<excludeFolder url="file://$MODULE_DIR$/example/build" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Dart SDK" level="project" />
<orderEntry type="library" name="Flutter Plugins" level="project" />
Expand Down
6 changes: 3 additions & 3 deletions ios/flutter_vpn.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
#
Pod::Spec.new do |s|
s.name = 'flutter_vpn'
s.version = '0.0.1'
s.summary = 'Flutter plugin to provide vpn service.'
s.version = '0.1.0'
s.summary = 'Flutter plugin to access vpn service.'
s.description = <<-DESC
Flutter plugin to provide vpn service.
Flutter plugin to access vpn service.
DESC
s.homepage = 'http://example.com'
s.license = { :file => '../LICENSE' }
Expand Down
8 changes: 6 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,16 @@ author: Jason C.H <[email protected]>
homepage: https://github.com/X-dea/Flutter_VPN

environment:
sdk: ">=2.0.0-dev.68.0 <3.0.0"
sdk: ">=2.1.0 <3.0.0"

dependencies:
flutter:
sdk: flutter

dev_dependencies:
flutter_test:
sdk: flutter

# For information on the generic Dart part of this file, see the
# following page: https://www.dartlang.org/tools/pub/pubspec

Expand All @@ -21,7 +25,7 @@ flutter:
# be modified. They are used by the tooling to maintain consistency when
# adding or updating assets for this project.
plugin:
androidPackage: io.xdea.fluttervpn
androidPackage: io.xdea.flutter_vpn
pluginClass: FlutterVpnPlugin

# To add assets to your plugin package, add an assets section, like this:
Expand Down
20 changes: 20 additions & 0 deletions test/flutter_vpn_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';

void main() {
const MethodChannel channel = MethodChannel('flutter_vpn');

setUp(() {
channel.setMockMethodCallHandler((MethodCall methodCall) async {
return '42';
});
});

tearDown(() {
channel.setMockMethodCallHandler(null);
});

test('getPlatformVersion', () async {
// expect(await FlutterVpn.platformVersion, '42');
});
}

0 comments on commit d780665

Please sign in to comment.