Skip to content

Commit

Permalink
Feat/0.4.0 (#157)
Browse files Browse the repository at this point in the history
* feat: updated dependencies

* refactor: updated lint

* fix: added missing swift code for example project

* fix: updated version, updated CI settings

* fix: added missing file

* fix: added missing dependency

* fix: updated readme

* fix: fixed dark mode

* fix: fixed dark mode

* fix: updated chopper interceptor API

* fix: fixed hashcode issue for chopper

* feat: added isInspectorOpened

* feat: added support for MacOS

* feat: added support for MacOS

* feat: added support for macos

* fix: fixed lint

* fix: fixed lint
  • Loading branch information
jhomlala authored Nov 12, 2023
1 parent 09534af commit 765a5f9
Show file tree
Hide file tree
Showing 92 changed files with 3,126 additions and 1,156 deletions.
24 changes: 14 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,30 @@ on:

jobs:
check-format:
name: Check format using flutter format
runs-on: ubuntu-latest
container: cirrusci/flutter:stable
name: Check format using dart format.
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Check format
run: flutter format -n --set-exit-if-changed .
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Flutter Action
uses: subosito/flutter-action@v2
- name: Check format
run: dart format . --set-exit-if-changed

lint:
name: Lint
runs-on: ubuntu-latest
container: cirrusci/flutter:stable

steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Flutter Action
uses: subosito/flutter-action@v2
- name: Install Package Dependencies
run: flutter packages get
- name: Get dependencies for example
run: flutter pub get
working-directory: example
- name: Lint using flutter analyze
run: flutter analyze
run: flutter analyze .
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
# 0.4.0
* [BREAKING_CHANGE] Updated dart min version to 3.0.0.
* [BREAKING_CHANGE] Removed `darkTheme` parameter. Alice will now automatically detect the color scheme.
* [BREAKING_CHANGE] Alice will now return chopper interceptor instance instead of list with that interceptor.
* Added `isInspectorOpened` method to check inspector state.
* Added support for macOS.
* Fixed issue with the same http call not properly handled with chopper. Alice will add "alice_token" to the headers of the request to identify given http call.
* Fixed lints.
* Updated dependencies.
* Updated example.

# 0.3.3
* Updated dependencies
* Added fix for call time for http package (by itsara-odds https://github.com/itsara-odds)
Expand Down
20 changes: 12 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ Alice is an HTTP Inspector tool for Flutter which helps debugging http requests.

```yaml
dependencies:
alice: ^0.3.3
alice: ^0.4.0
```
2. Install it
Expand Down Expand Up @@ -135,12 +135,6 @@ You can set `showInspectorOnShake` in Alice constructor to open inspector by sha
Alice alice = Alice(..., showInspectorOnShake: true);
```

If you want to use dark mode just add `darkTheme` flag:

```dart
Alice alice = Alice(..., darkTheme: true);
```

If you want to pass another notification icon, you can use `notificationIcon` parameter. Default value is @mipmap/ic_launcher.
```dart
Alice alice = Alice(..., notificationIcon: "myNotificationIconResourceName");
Expand Down Expand Up @@ -196,10 +190,12 @@ If you're using Chopper. you need to add interceptor:

```dart
chopper = ChopperClient(
interceptors: alice.getChopperInterceptor(),
interceptors: [alice.getChopperInterceptor()],
);
```

Attention! Alice will add special "alice_token" header to the request in order to calculate correct id for the http call.

If you have other HTTP client you can use generic http call interface:
```dart
AliceHttpCall aliceHttpCall = AliceHttpCall(id);
Expand Down Expand Up @@ -233,6 +229,14 @@ alice.addLogs(logList);
```


## Inspector state

Check current inspector state (opened/closed) with:

```dart
alice.isInspectorOpened();
```


## Extensions
You can use extensions to shorten your http and http client code. This is optional, but may improve your codebase.
Expand Down
28 changes: 10 additions & 18 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,24 +1,16 @@
#include: package:lint/analysis_options.yaml

analyzer:
strong-mode:
implicit-dynamic: false
exclude:
- "**/*.chopper.dart"
include: package:very_good_analysis/analysis_options.yaml

linter:
rules:
close_sinks: true
public_member_api_docs: false
flutter_style_todos: false
avoid_final_parameters: false
sort_constructors_first: false
avoid_classes_with_only_static_members: false
avoid_void_async: false
avoid_positional_boolean_parameters: false
avoid_function_literals_in_foreach_calls: false
avoid_positional_boolean_parameters: false
use_if_null_to_convert_nulls_to_bools: false
use_build_context_synchronously: false
prefer_constructors_over_static_methods: false
sort_unnamed_constructors_first: false
sized_box_for_whitespace: false
invalid_dependency: false
sort_pub_dependencies: false
directives_ordering: false
noop_primitive_operations: false
use_build_context_synchronously: false
use_setters_to_change_properties: false
avoid_print: false
sort_pub_dependencies: false
8 changes: 8 additions & 0 deletions android/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
*.iml
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
.DS_Store
/build
/captures
40 changes: 40 additions & 0 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
group 'com.jhomlala.alice'
version '1.0-SNAPSHOT'

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

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

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

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

android {
compileSdkVersion 34

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

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
3 changes: 3 additions & 0 deletions android/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true
android.enableJetifier=true
5 changes: 5 additions & 0 deletions android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
1 change: 1 addition & 0 deletions android/settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rootProject.name = 'alice'
3 changes: 3 additions & 0 deletions 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="com.jhomlala.alice">
</manifest>
36 changes: 36 additions & 0 deletions android/src/main/kotlin/com/jhomlala/alice/AlicePlugin.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package com.jhomlala.alice

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
import io.flutter.plugin.common.PluginRegistry.Registrar

/** AlicePlugin */

class AlicePlugin: 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, "alice")
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)
}
}
24 changes: 22 additions & 2 deletions example/.metadata
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,27 @@
# This file should be version controlled and should not be manually edited.

version:
revision: 8661d8aecd626f7f57ccbcb735553edc05a2e713
channel: stable
revision: "d211f42860350d914a5ad8102f9ec32764dc6d06"
channel: "stable"

project_type: app

# Tracks metadata for the flutter migrate command
migration:
platforms:
- platform: root
create_revision: d211f42860350d914a5ad8102f9ec32764dc6d06
base_revision: d211f42860350d914a5ad8102f9ec32764dc6d06
- platform: macos
create_revision: d211f42860350d914a5ad8102f9ec32764dc6d06
base_revision: d211f42860350d914a5ad8102f9ec32764dc6d06

# 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'
2 changes: 1 addition & 1 deletion example/ios/Flutter/AppFrameworkInfo.plist
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
<key>CFBundleVersion</key>
<string>1.0</string>
<key>MinimumOSVersion</key>
<string>8.0</string>
<string>11.0</string>
</dict>
</plist>
2 changes: 1 addition & 1 deletion example/ios/Podfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'
# platform :ios, '11.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
Expand Down
Loading

0 comments on commit 765a5f9

Please sign in to comment.