Skip to content
This repository was archived by the owner on Oct 5, 2020. It is now read-only.

Commit f8d023d

Browse files
committed
fix conflicts
2 parents 88e32dc + 5355ffa commit f8d023d

File tree

3 files changed

+8
-25
lines changed

3 files changed

+8
-25
lines changed

example/README.md

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,9 @@
1-
# chirp_flutter_example
1+
# Chirp Flutter Example
22

3-
Demonstrates how to use the chirp_flutter plugin.
3+
Demonstrates how to use the Chirp Flutter plugin.
44

55
## Getting Started
66

7-
This project is a starting point for a Flutter application.
7+
This project is a starting point for a Flutter application using Chirp.
88

9-
A few resources to get you started if this is your first Flutter project:
10-
11-
- [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab)
12-
- [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook)
13-
14-
For help getting started with Flutter, view our
15-
[online documentation](https://flutter.dev/docs), which offers tutorials,
16-
samples, guidance on mobile development, and a full API reference.
9+
- [Example Code](https://github.com/chirp/chirp-flutter/tree/master/example)

example/lib/main.dart

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,6 @@ class _ChirpAppState extends State<ChirpApp> with WidgetsBindingObserver {
3838
});
3939
}
4040

41-
void setErrorCode(int errorCode) async {
42-
var errorMessage = await ChirpSDK.errorCodeToString(errorCode);
43-
setErrorMessage(errorMessage);
44-
}
45-
4641
Future<void> _initChirp() async {
4742
try {
4843
// Init ChirpSDK
@@ -102,11 +97,7 @@ class _ChirpAppState extends State<ChirpApp> with WidgetsBindingObserver {
10297
try {
10398
Uint8List payload = await ChirpSDK.randomPayload();
10499
setPayload(payload);
105-
var errorCode = await ChirpSDK.send(payload);
106-
if (errorCode > 0) {
107-
setErrorCode(errorCode);
108-
return;
109-
}
100+
await ChirpSDK.send(payload);
110101
} catch (err) {
111102
setErrorMessage("Error sending random payload: ${err.message};");
112103
}

ios/Classes/ChirpFlutterPlugin.m

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ - (BOOL)isInitialised:(FlutterMethodCall*)call result:(FlutterResult)result {
5656
- (void)handleError:(FlutterMethodCall*)call result:(FlutterResult)result withError:(NSError *)error {
5757
if (error) {
5858
result([FlutterError errorWithCode:[NSString stringWithFormat:@"%ld", (long)error.code]
59-
message:error.description
59+
message:error.localizedDescription
6060
details:nil]);
6161
} else {
6262
result(nil);
@@ -140,7 +140,7 @@ - (void)setConfig:(FlutterMethodCall*)call result:(FlutterResult)result {
140140
NSError *error = [self.chirp setConfig:config];
141141
if (error) {
142142
result([FlutterError errorWithCode:[NSString stringWithFormat:@"%ld", (long)error.code]
143-
message:error.description
143+
message:error.localizedDescription
144144
details:nil]);
145145
} else {
146146
[self setCallbacks];
@@ -170,8 +170,7 @@ - (void)send:(FlutterMethodCall*)call result:(FlutterResult)result {
170170
- (void)randomPayload:(FlutterMethodCall*)call result:(FlutterResult)result {
171171
if (![self isInitialised:call result:result]) return;
172172
NSData *payload = [self.chirp randomPayloadWithRandomLength];
173-
NSError *error = [self.chirp send:payload];
174-
[self handleError:call result:result withError:error];
173+
result([FlutterStandardTypedData typedDataWithBytes:payload]);
175174
}
176175

177176
- (void)getState:(FlutterMethodCall*)call result:(FlutterResult)result {

0 commit comments

Comments
 (0)