Skip to content

Commit 2f8585a

Browse files
author
Maksym Khobotin
committed
Release 1.1.0
Support for geometry data types Guest login with social account Custom classes caching
1 parent 53274d2 commit 2f8585a

35 files changed

+987
-496
lines changed

.travis.yml

+43-56
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ env:
77
- ANDROID_TOOLS=4333796 # android-28
88
# Flutter
99
- FLUTTER_CHANNEL=stable
10-
- FLUTTER_VERSION=1.9.1+hotfix.6-${FLUTTER_CHANNEL}
10+
- FLUTTER_VERSION=1.12.13+hotfix.5-${FLUTTER_CHANNEL}
1111
# Path
1212
- ANDROID_HOME=${HOME}/android-sdk-linux
1313
- TOOLS=${ANDROID_HOME}/tools
@@ -18,56 +18,23 @@ env:
1818
- PATH=${HOME}/.pub-cache/bin:${PATH}
1919
- PATH=${FLUTTER_HOME}/bin:${FLUTTER_HOME}/bin/cache/dart-sdk/bin:${PATH}
2020

21+
branches:
22+
only:
23+
- master
24+
- develop
25+
- travis
26+
2127
jobs:
2228
include:
23-
- stage: iOS Tests
24-
os: osx
25-
language: objective-c
26-
osx_image: xcode11
27-
git:
28-
depth: 3
29-
before_script:
30-
- open /Applications/Xcode.app/Contents/Developer/Applications/Simulator.app
31-
# - brew update
32-
- brew install libimobiledevice
33-
- brew install ideviceinstaller
34-
- brew install ios-deploy
35-
- sudo gem install cocoapods
36-
# - git clone https://github.com/flutter/flutter.git -b beta
37-
- export PATH="$PATH":"$HOME/.pub-cache/bin"
38-
- export PATH=`pwd`/flutter/bin:`pwd`/flutter/bin/cache/dart-sdk/bin:$PATH
39-
# - flutter precache
40-
# - flutter doctor -v
41-
# - flutter devices
42-
# - flutter packages get
43-
44-
- if [ ! -f $HOME/flutter/bin/flutter ] ; then
45-
git clone https://github.com/flutter/flutter.git $FLUTTER_HOME -b beta;
46-
flutter pub get;
47-
fi
48-
49-
50-
# - flutter packages pub run build_runner build --delete-conflicting-outputs
51-
- cd example
52-
script:
53-
- ./test_driver/run_tests.sh iPhone X
54-
cache:
55-
directories:
56-
- $HOME/.pub-cache
57-
- flutter
58-
branches:
59-
only:
60-
- bodnar/19570/tests
61-
62-
63-
- stage: Android Tests
29+
# Android integration tests
30+
- &integration-test-stage
31+
stage: Integration Testing
6432
os: linux
6533
dist: bionic
6634
language: shell
35+
env: Android tests
6736
git:
6837
depth: 3
69-
70-
7138

7239
cache:
7340
directories:
@@ -76,10 +43,6 @@ jobs:
7643
- $HOME/.pub-cache
7744
- flutter
7845

79-
branches:
80-
only:
81-
- bodnar/19570/tests
82-
8346
before_cache:
8447
- rm -rf $HOME/.gradle/caches/[1-9]*
8548
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
@@ -91,7 +54,7 @@ jobs:
9154
- bridge-utils
9255
- openjdk-8-jdk-headless
9356

94-
install:
57+
before_install:
9558
# Android tools
9659
- curl -L "https://dl.google.com/android/repository/sdk-tools-linux-$ANDROID_TOOLS.zip" -o $HOME/tools.zip
9760
- unzip -oq $HOME/tools.zip -d ${ANDROID_HOME}
@@ -135,26 +98,50 @@ jobs:
13598
git clone https://github.com/flutter/flutter.git $FLUTTER_HOME -b beta;
13699
flutter pub get;
137100
fi
138-
# - wget --quiet --output-document=flutter.tar.xz https://storage.googleapis.com/flutter_infra/releases/${FLUTTER_CHANNEL}/linux/flutter_linux_v${FLUTTER_VERSION}.tar.xz
139-
# - tar xf flutter.tar.xz -C $(dirname ${FLUTTER_HOME})
140-
# - rm flutter.tar.xz
141101

142102
# Download the script to wait for emulator
143103
- curl -L https://raw.githubusercontent.com/travis-ci/travis-cookbooks/master/community-cookbooks/android-sdk/files/default/android-wait-for-emulator -o $HOME/bin/android-wait-for-emulator
144104
- chmod +x $HOME/bin/android-wait-for-emulator
145105
- chmod -R +x $FLUTTER_HOME
146-
147-
before_script:
148106
# Wait for emulator to finish startup
149107
- android-wait-for-emulator
150108
# Unlock screen
151109
- adb shell input keyevent 82 &
152110

153111
script:
154112
- cd example
155-
- ./test_driver/run_tests.sh emulator-5554
113+
- flutter drive --target=test_driver/backendless_tests.dart --driver=test_driver/backendless_driver.dart
114+
115+
# iOS integration tests
116+
- <<: *integration-test-stage
117+
os: osx
118+
language: objective-c
119+
osx_image: xcode11
120+
env: iOS tests
121+
git:
122+
depth: 3
123+
before_install:
124+
- open /Applications/Xcode.app/Contents/Developer/Applications/Simulator.app
125+
# - brew update
126+
- brew install libimobiledevice
127+
- brew install ideviceinstaller
128+
- brew install ios-deploy
129+
- sudo gem install cocoapods
130+
- export PATH="$PATH":"$HOME/.pub-cache/bin"
131+
- export PATH=`pwd`/flutter/bin:`pwd`/flutter/bin/cache/dart-sdk/bin:$PATH
132+
133+
- if [ ! -f $HOME/flutter/bin/flutter ] ; then
134+
git clone https://github.com/flutter/flutter.git $FLUTTER_HOME -b beta;
135+
flutter pub get;
136+
fi
137+
# - flutter packages pub run build_runner build --delete-conflicting-outputs
138+
139+
cache:
140+
directories:
141+
- $HOME/.pub-cache
142+
- flutter
156143

157144

158145
notifications:
159146
email:
160-
147+

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## 1.1.0
2+
3+
* Support for geometry data types
4+
* Guest login with social account
5+
* Custom classes caching
6+
17
## 1.0.1
28

39
* Fix crash during publish() call

android/build.gradle

+3-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ buildscript {
88
}
99

1010
dependencies {
11-
classpath 'com.android.tools.build:gradle:3.2.1'
11+
classpath 'com.android.tools.build:gradle:3.5.3'
1212
}
1313
}
1414

@@ -34,8 +34,9 @@ android {
3434
}
3535

3636
dependencies {
37-
api 'com.backendless:backendless:5.3.1'
3837
implementation 'com.fasterxml.jackson.core:jackson-core:2.9.8'
3938
implementation 'com.fasterxml.jackson.core:jackson-databind:2.9.8'
4039
api 'com.google.firebase:firebase-messaging:20.0.0'
40+
41+
api 'com.backendless:backendless:5.7.0'
4142
}

android/src/main/java/com/backendless/backendless_sdk/call_handlers/UserServiceCallHandler.java

+15
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ public void onMethodCall(MethodCall call, MethodChannel.Result result) {
5757
case "Backendless.UserService.update":
5858
update(call, result);
5959
break;
60+
case "Backendless.UserService.loginAsGuest":
61+
loginAsGuest(call, result);
62+
break;
6063
case "Backendless.UserService.getUserToken":
6164
getUserToken(result);
6265
break;
@@ -139,6 +142,18 @@ private void update(MethodCall call, MethodChannel.Result result) {
139142
Backendless.UserService.update(user, new FlutterCallback<BackendlessUser>(result));
140143
}
141144

145+
private void loginAsGuest(MethodCall call, MethodChannel.Result result) {
146+
Boolean stayLoggedIn = call.argument("stayLoggedIn");
147+
148+
FlutterCallback<BackendlessUser> callback = new FlutterCallback<>(result);
149+
150+
if (stayLoggedIn != null) {
151+
Backendless.UserService.loginAsGuest(callback, stayLoggedIn);
152+
} else {
153+
Backendless.UserService.loginAsGuest(callback);
154+
}
155+
}
156+
142157
private void getUserToken(MethodChannel.Result result) {
143158
String userToken = HeadersManager.getInstance().getHeader(HeadersManager.HeadersEnum.USER_TOKEN_KEY);
144159
result.success(userToken);

android/src/main/java/com/backendless/backendless_sdk/utils/codec/BackendlessMessageCodec.java

+21
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@
2424
import com.backendless.messaging.PublishOptions;
2525
import com.backendless.persistence.BackendlessDataQuery;
2626
import com.backendless.persistence.DataQueryBuilder;
27+
import com.backendless.persistence.LineString;
2728
import com.backendless.persistence.LoadRelationsQueryBuilder;
29+
import com.backendless.persistence.Point;
30+
import com.backendless.persistence.Polygon;
2831
import com.backendless.property.ObjectProperty;
2932
import com.backendless.property.UserProperty;
3033
import com.backendless.push.DeviceRegistrationResult;
@@ -77,6 +80,9 @@ public final class BackendlessMessageCodec extends StandardMessageCodec {
7780
private static final byte USER_PROPERTY = (byte) 152;
7881
private static final byte BULK_EVENT = (byte) 153;
7982
private static final byte EMAIL_ENVELOPE = (byte) 154;
83+
private static final byte POINT = (byte) 155;
84+
private static final byte LINE_STRING = (byte) 156;
85+
private static final byte POLYGON = (byte) 157;
8086

8187
private BackendlessMessageCodec() {
8288
objectMapper.enable(SerializationFeature.WRITE_ENUMS_USING_INDEX);
@@ -188,6 +194,15 @@ protected void writeValue(ByteArrayOutputStream stream, Object value) {
188194
} else if (value instanceof EmailEnvelope) {
189195
stream.write(EMAIL_ENVELOPE);
190196
writeValue(stream, objectMapper.convertValue(value, Map.class));
197+
} else if (value instanceof Point) {
198+
stream.write(POINT);
199+
writeValue(stream, ((Point) value).asWKT());
200+
} else if (value instanceof LineString) {
201+
stream.write(LINE_STRING);
202+
writeValue(stream, ((LineString) value).asWKT());
203+
} else if (value instanceof Polygon) {
204+
stream.write(POLYGON);
205+
writeValue(stream, ((Polygon) value).asWKT());
191206
} else if (value != null && value.getClass().isArray()) {
192207
Object[] array = (Object[]) value;
193208
List list = Arrays.asList(array);
@@ -254,6 +269,12 @@ protected Object readValueOfType(byte type, ByteBuffer buffer) {
254269
return objectMapper.convertValue(readValue(buffer), BulkEvent.class);
255270
case EMAIL_ENVELOPE:
256271
return objectMapper.convertValue(readValue(buffer), EmailEnvelope.class);
272+
case POINT:
273+
return Point.<Point>fromWKT((String) readValue(buffer));
274+
case LINE_STRING:
275+
return LineString.<LineString>fromWKT((String) readValue(buffer));
276+
case POLYGON:
277+
return Polygon.<Polygon>fromWKT((String) readValue(buffer));
257278
default:
258279
return super.readValueOfType(type, buffer);
259280
}

example/ios/Flutter/AppFrameworkInfo.plist

+25-20
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,30 @@
22
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
33
<plist version="1.0">
44
<dict>
5-
<key>CFBundleDevelopmentRegion</key>
6-
<string>en</string>
7-
<key>CFBundleExecutable</key>
8-
<string>App</string>
9-
<key>CFBundleIdentifier</key>
10-
<string>io.flutter.flutter.app</string>
11-
<key>CFBundleInfoDictionaryVersion</key>
12-
<string>6.0</string>
13-
<key>CFBundleName</key>
14-
<string>App</string>
15-
<key>CFBundlePackageType</key>
16-
<string>FMWK</string>
17-
<key>CFBundleShortVersionString</key>
18-
<string>1.0</string>
19-
<key>CFBundleSignature</key>
20-
<string>????</string>
21-
<key>CFBundleVersion</key>
22-
<string>1.0</string>
23-
<key>MinimumOSVersion</key>
24-
<string>8.0</string>
5+
<key>CFBundleDevelopmentRegion</key>
6+
<string>en</string>
7+
<key>CFBundleExecutable</key>
8+
<string>App</string>
9+
<key>CFBundleIdentifier</key>
10+
<string>io.flutter.flutter.app</string>
11+
<key>CFBundleInfoDictionaryVersion</key>
12+
<string>6.0</string>
13+
<key>CFBundleName</key>
14+
<string>App</string>
15+
<key>CFBundlePackageType</key>
16+
<string>FMWK</string>
17+
<key>CFBundleShortVersionString</key>
18+
<string>1.0</string>
19+
<key>CFBundleSignature</key>
20+
<string>????</string>
21+
<key>CFBundleVersion</key>
22+
<string>1.0</string>
23+
<key>MinimumOSVersion</key>
24+
<string>8.0</string>
25+
<key>NSAppTransportSecurity</key>
26+
<dict>
27+
<key>NSAllowsArbitraryLoads</key>
28+
<true/>
29+
</dict>
2530
</dict>
2631
</plist>

example/ios/Runner/Info.plist

+5
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,10 @@
4545
</array>
4646
<key>UIViewControllerBasedStatusBarAppearance</key>
4747
<false/>
48+
<key>NSAppTransportSecurity</key>
49+
<dict>
50+
<key>NSAllowsArbitraryLoads</key>
51+
<true/>
52+
</dict>
4853
</dict>
4954
</plist>

example/lib/main.dart

+38-5
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,19 @@ import 'package:flutter/material.dart';
22
import 'package:backendless_sdk/backendless_sdk.dart';
33
import 'main.reflectable.dart';
44

5+
@reflector
6+
class Test {
7+
String foo;
8+
Point point;
9+
LineString lineString;
10+
Polygon polygon;
11+
12+
@override
13+
String toString() =>
14+
"'Test' custom class:\n\tpoint: $point\n\tlineString: $lineString\n\tpolygon: $polygon";
15+
}
16+
517
void main() {
6-
initializeReflectable();
718
runApp(MyApp());
819
}
920

@@ -18,15 +29,37 @@ class _MyAppState extends State<MyApp> {
1829
@override
1930
void initState() {
2031
super.initState();
32+
initializeReflectable();
2133

22-
Backendless.initApp(
23-
"APPLICATION-ID",
24-
"ANDROID-API-KEY",
25-
"IOS-API-KEY");
34+
Backendless.setUrl("https://api.backendless.com");
35+
Backendless.initApp("APP-ID", "ANDROID-KEY", "IOS-KEY");
2636
}
2737

2838
void buttonPressed() async {
39+
final dataStore = Backendless.data.withClass<Test>();
40+
41+
final point = Point(x: 20, y: 20);
42+
43+
final point1 = Point(x: 30, y: 30);
44+
final point2 = Point(x: 40, y: 40);
45+
46+
final ppoint1 = Point(x: -114.86082225, y: 51.77113916);
47+
final ppoint2 = Point(x: -113.45457225, y: 47.44655569);
48+
final ppoint3 = Point(x: -108.53269725, y: 49.31427466);
49+
final ppoint4 = Point(x: -114.86082225, y: 51.77113916);
50+
51+
final lineString = LineString(points: [point1, point2]);
52+
final polygon = Polygon(
53+
boundary: LineString(points: [ppoint1, ppoint2, ppoint3, ppoint4]));
54+
55+
final objectOfCustomClass = Test()
56+
..point = point
57+
..lineString = lineString
58+
..polygon = polygon;
2959

60+
dataStore.save(objectOfCustomClass).then((saved) {
61+
print("🟢 SAVED: $saved");
62+
});
3063
}
3164

3265
@override

0 commit comments

Comments
 (0)