Skip to content

Commit f1fda96

Browse files
authored
Merge pull request #3 from woosignal/master
v3.0.0 - updates
2 parents 1ffa3e8 + 5da88b1 commit f1fda96

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+1406
-1683
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ build/
88
# Omit committing pubspec.lock for library packages; see
99
# https://dart.dev/guides/libraries/private-files#pubspeclock.
1010
pubspec.lock
11+
lib/env.dart

.idea/libraries/Dart_Packages.xml

Lines changed: 44 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/libraries/Flutter_Plugins.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/vcs.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
## [3.0.0] - 2021-12-16
2+
3+
* Breaking changes
4+
* Major refactor to woosignal.dart class
5+
* Added CustomerDownload model
6+
* Ability to store theme colors, theme font and social links in WooSignalApp class
7+
* Dependency updates
8+
19
## [2.2.1] - 2021-11-02
210

311
* Update readme

README.md

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
[Official WooSignal WooCommerce package](https://woosignal.com)
44

55
Build apps for WooCommerce easier with our new package.
6-
Our API provides many requests types e.g. getProducts, getOrders, getCustomers and many more.
6+
Our API provides many requests types e.g. getProducts, getOrders and many more.
77
Free to get started, see the simple examples below.
88

99
For help getting started with WooSignal, view our
@@ -15,7 +15,7 @@ In your flutter project add the dependency:
1515
``` dart
1616
dependencies:
1717
...
18-
woosignal: ^2.2.1
18+
woosignal: ^3.0.0
1919
```
2020

2121
### Usage example #
@@ -34,16 +34,13 @@ import 'package:woosignal/woosignal.dart';
3434
// EXAMPLE GET PRODUCTS
3535
_getProducts() async {
3636
37-
// CONFIG FOR WOOSIGNAL
38-
var wsConfig = {
39-
"appKey":"your app key",
40-
"debugMode":true
41-
};
37+
// Step 1 - Initialize WooSignal
38+
WooSignal wooSignal = await WooSignal.instance.init(appKey: "your app key");
4239
43-
// CREATING AN INSTANCE
44-
WooSignal wooSignal = await WooSignal.getInstance(config: wsConfig);
45-
List<Product> products = await wooSignal.getProducts();
46-
print(products[0].name);
40+
// Step 2 - Call an API
41+
List<Product> products = await WooSignal.instance.getProducts();
42+
43+
print(products[0].name); // prints a product name
4744
});
4845
}
4946
```
@@ -218,4 +215,4 @@ _getProducts() async {
218215
[See Setting options API](https://woosignal.com/docs/api/1.0/setting-options)
219216

220217

221-
Disclaimer: This plugin is not affiliated with or supported by Automattic, Inc. All logos and trademarks are the property of their respective owners.
218+
Disclaimer: This plugin is not affiliated with or supported by Automattic, Inc. All logos and trademarks are the property of their respective owners.

example/lib/main.dart

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import 'package:flutter/material.dart';
22
import 'package:woosignal/woosignal.dart';
3+
import 'package:woosignal/models/response/products.dart';
34

45
void woosignal_woocommerce_example() => runApp(MyApp());
56

@@ -29,15 +30,14 @@ class _MyHomePageState extends State<MyHomePage> {
2930
String _productName = "";
3031

3132
_incrementCounter() async {
32-
// CONFIG FOR WOOSIGNAL
33-
var wsConfig = {"appKey": "your app key", "debugMode": true};
33+
// CREATING AN INSTANCE FOR WOOSIGNAL
34+
WooSignal wooSignal = await WooSignal.instance.init(appKey: "your app key");
3435

35-
// CREATING AN INSTANCE
36-
WooSignal wooSignal = await WooSignal.getInstance(config: wsConfig);
37-
38-
setState(() {
39-
_productName = "";
40-
});
36+
List<Product> products = await wooSignal.getProducts();
37+
if (products.isNotEmpty) {
38+
_productName = products[0].name ?? "";
39+
}
40+
setState(() {});
4141
}
4242

4343
@override
@@ -50,13 +50,11 @@ class _MyHomePageState extends State<MyHomePage> {
5050
child: Column(
5151
mainAxisAlignment: MainAxisAlignment.center,
5252
children: <Widget>[
53-
Text(
54-
'WooCommerce product :',
55-
),
56-
Text(
57-
'$_productName',
58-
style: Theme.of(context).textTheme.headline4,
59-
),
53+
Text('Tap the light bulb to get a product'),
54+
if (_productName != "")
55+
Text(
56+
'WooCommerce product :\n $_productName',
57+
),
6058
],
6159
),
6260
),

example/pubspec.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,19 @@ name: woosignal_woocommerce_example
22
description: Demonstrates how to use the woosignal plugin.
33

44
environment:
5-
sdk: '>=2.14.4 <3.0.0'
5+
sdk: '>=2.15.0 <3.0.0'
66

77
dependencies:
88
flutter:
99
sdk: flutter
1010
dev_dependencies:
11+
lints: ^1.0.0
12+
test: ^1.16.0
1113
flutter_test:
1214
sdk: flutter
1315

1416
woosignal:
1517
path: ../
16-
1718

1819
flutter:
1920

lib/env.dart

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)