Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# 3.10.0

- Bump iOS version from 3.9.14 to 3.13.5
- Bump Android version from 3.9.8 to 3.13.2

# 3.9.1

- Bump iOS version from 3.9.7 to 3.9.14
Expand Down
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ android {
}

dependencies {
implementation 'io.radar:sdk:3.9.8'
implementation 'io.radar:sdk:3.15.0'
implementation 'com.google.android.gms:play-services-location:21.0.1'
implementation 'com.google.code.gson:gson:2.8.6'
}
81 changes: 27 additions & 54 deletions android/src/main/java/io/radar/flutter/RadarFlutterPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
import io.radar.sdk.model.RadarTrip;
import io.radar.sdk.model.RadarRouteMatrix;
import io.radar.sdk.RadarTrackingOptions.RadarTrackingOptionsForegroundService;
import io.radar.sdk.model.RadarVerifiedLocationToken;

import io.flutter.embedding.engine.dart.DartExecutor;
import io.flutter.embedding.engine.dart.DartExecutor.DartCallback;
Expand Down Expand Up @@ -104,7 +105,7 @@ private static void initializeBackgroundEngine(Context context) {
}
}
}

@Override
public void onAttachedToEngine(@NonNull FlutterPluginBinding binding) {
Radar.setReceiver(new RadarFlutterReceiver());
Expand Down Expand Up @@ -215,6 +216,9 @@ public void onMethodCall(@NonNull MethodCall call, @NonNull final Result result)
case "startTrackingVerified":
startTrackingVerified(call, result);
break;
case "stopTrackingVerified":
stopTrackingVerified(call, result);
break;
case "stopTracking":
stopTracking(result);
break;
Expand Down Expand Up @@ -293,9 +297,6 @@ public void onMethodCall(@NonNull MethodCall call, @NonNull final Result result)
case "trackVerified":
trackVerified(call, result);
break;
case "trackVerifiedToken":
trackVerifiedToken(call, result);
break;
case "validateAddress":
validateAddress(call, result);
break;
Expand Down Expand Up @@ -324,7 +325,7 @@ private void initialize(MethodCall call, Result result) {
String publishableKey = call.argument("publishableKey");
SharedPreferences.Editor editor = mContext.getSharedPreferences("RadarSDK", Context.MODE_PRIVATE).edit();
editor.putString("x_platform_sdk_type", "Flutter");
editor.putString("x_platform_sdk_version", "3.9.1");
editor.putString("x_platform_sdk_version", "3.10.0");
editor.apply();
Radar.initialize(mContext, publishableKey);
result.success(true);
Expand Down Expand Up @@ -569,10 +570,14 @@ private void startTrackingCustom(MethodCall call, Result result) {
}

private void startTrackingVerified(MethodCall call, Result result) {
Boolean token = call.hasArgument("token") ? call.argument("token") : false;
int interval = call.hasArgument("interval") && call.argument("interval") != null ? (int)call.argument("interval") : 1;
Boolean beacons = call.hasArgument("beacons") ? call.argument("beacons") : false;
Radar.startTrackingVerified(token, interval, beacons);
Radar.startTrackingVerified(interval, beacons);
result.success(true);
}

private void stopTrackingVerified(MethodCall call, Result result) {
Radar.stopTrackingVerified();
result.success(true);
}

Expand Down Expand Up @@ -848,11 +853,12 @@ public void run() {
HashMap metadataMap = (HashMap)call.argument("metadata");
JSONObject metadata = jsonForMap(metadataMap);
int limit = call.hasArgument("limit") ? (int)call.argument("limit") : 10;
boolean includeGeometry = call.hasArgument("includeGeometry") ? call.argument("includeGeometry") : false;

if (near != null) {
Radar.searchGeofences(near, radius, tags, metadata, limit, callback);
Radar.searchGeofences(near, radius, tags, metadata, limit, includeGeometry, callback);
} else {
Radar.searchGeofences(radius, tags, metadata, limit, callback);
Radar.searchGeofences(radius, tags, metadata, limit, includeGeometry, callback);
}
}

Expand Down Expand Up @@ -942,7 +948,7 @@ public void run() {
public void geocode(MethodCall call, final Result result) {
String query = call.argument("query");

Radar.geocode(query, new Radar.RadarGeocodeCallback() {
Radar.geocode(query, null, null, new Radar.RadarGeocodeCallback() {
@Override
public void onComplete(final Radar.RadarStatus status, final RadarAddress[] addresses) {
runOnMainThread(new Runnable() {
Expand Down Expand Up @@ -993,9 +999,9 @@ public void run() {
if (call.hasArgument("location")) {
HashMap locationMap = (HashMap)call.argument("location");
Location location = locationForMap(locationMap);
Radar.reverseGeocode(location, callback);
Radar.reverseGeocode(location, null, callback);
} else {
Radar.reverseGeocode(callback);
Radar.reverseGeocode(null ,callback);
}
}

Expand Down Expand Up @@ -1182,22 +1188,16 @@ public void run() {
public void trackVerified(MethodCall call, final Result result) {
Boolean beacons = call.hasArgument("beacons") ? call.argument("beacons") : false;

Radar.RadarTrackCallback callback = new Radar.RadarTrackCallback() {
Radar.RadarTrackVerifiedCallback callback = new Radar.RadarTrackVerifiedCallback() {
@Override
public void onComplete(final Radar.RadarStatus status, final Location location, final RadarEvent[] events, final RadarUser user) {
public void onComplete(final Radar.RadarStatus status, final RadarVerifiedLocationToken token) {
runOnMainThread(new Runnable() {
@Override
public void run() {
try {
JSONObject obj = new JSONObject();
obj.put("status", status.toString());
if (location != null) {
obj.put("location", Radar.jsonForLocation(location));
}
obj.put("events", RadarEvent.toJson(events));
if ( user != null) {
obj.put("user", user.toJson());
}
obj.put("token", token.toJson());

HashMap<String, Object> map = new Gson().fromJson(obj.toString(), HashMap.class);
result.success(map);
Expand All @@ -1212,33 +1212,6 @@ public void run() {
Radar.trackVerified(beacons, callback);
}

public void trackVerifiedToken(MethodCall call, final Result result) {
Boolean beacons = call.hasArgument("beacons") ? call.argument("beacons") : false;

Radar.RadarTrackTokenCallback callback = new Radar.RadarTrackTokenCallback() {
@Override
public void onComplete(final Radar.RadarStatus status, final String token) {
runOnMainThread(new Runnable() {
@Override
public void run() {
try {
JSONObject obj = new JSONObject();
obj.put("status", status.toString());
obj.put("token", token);

HashMap<String, Object> map = new Gson().fromJson(obj.toString(), HashMap.class);
result.success(map);
} catch (Exception e) {
result.error(e.toString(), e.getMessage(), e.getMessage());
}
}
});
}
};

Radar.trackVerifiedToken(beacons, callback);
}

private void isUsingRemoteTrackingOptions(Result result) {
Boolean isRemoteTracking = Radar.isUsingRemoteTrackingOptions();
result.success(isRemoteTracking);
Expand Down Expand Up @@ -1339,7 +1312,7 @@ public void run() {
Log.e(TAG, e.toString());
}
}

@Override
public void onLocationUpdated(Context context, Location location, RadarUser user) {
try {
Expand All @@ -1352,7 +1325,7 @@ public void onLocationUpdated(Context context, Location location, RadarUser user
}

RadarFlutterPlugin.initializeBackgroundEngine(context);

JSONObject obj = new JSONObject();
obj.put("location", Radar.jsonForLocation(location));
obj.put("user", user.toJson());
Expand All @@ -1373,6 +1346,7 @@ public void run() {
Log.e(TAG, e.toString());
}
}


public void onClientLocationUpdated(Context context, Location location, boolean stopped, Radar.RadarLocationSource source) {
try {
Expand Down Expand Up @@ -1470,13 +1444,12 @@ public void run() {
Log.e(TAG, e.toString());
}
}

}

public static class RadarFlutterVerifiedReceiver extends RadarVerifiedReceiver {

@Override
public void onTokenUpdated(Context context, String token) {
public void onTokenUpdated(Context context, RadarVerifiedLocationToken token) {
try {
SharedPreferences sharedPrefs = context.getSharedPreferences(TAG, Context.MODE_PRIVATE);
long callbackHandle = sharedPrefs.getLong("token", 0L);
Expand All @@ -1488,7 +1461,7 @@ public void onTokenUpdated(Context context, String token) {
RadarFlutterPlugin.initializeBackgroundEngine(context);

JSONObject obj = new JSONObject();
obj.put("token", token);
obj.put("token", token.toJson());

HashMap<String, Object> res = new Gson().fromJson(obj.toString(), HashMap.class);
synchronized(lock) {
Expand Down
4 changes: 2 additions & 2 deletions example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ android {
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "io.radar.example"
minSdkVersion 16
minSdkVersion flutter.minSdkVersion
targetSdkVersion 29
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
Expand All @@ -49,7 +49,7 @@ android {
}

dependencies {
implementation 'io.radar:sdk:3.9.8'
implementation 'io.radar:sdk:3.15.0'
implementation "com.google.android.play:integrity:1.2.0"
}
}
Expand Down
2 changes: 1 addition & 1 deletion example/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ subprojects {
project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
tasks.register("clean", Delete) {
delete rootProject.buildDir
}
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>11.0</string>
<string>12.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, '11.0'
platform :ios, '12.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
Expand Down
25 changes: 23 additions & 2 deletions example/ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 51;
objectVersion = 54;
objects = {

/* Begin PBXBuildFile section */
Expand Down Expand Up @@ -149,6 +149,7 @@
97C146EC1CF9000F007C117D /* Resources */,
9705A1C41CF9048500538489 /* Embed Frameworks */,
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
717FBB0054865DEA34CA9827 /* [CP] Copy Pods Resources */,
);
buildRules = (
);
Expand All @@ -165,7 +166,7 @@
97C146E61CF9000F007C117D /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1300;
LastUpgradeCheck = 1510;
ORGANIZATIONNAME = "";
TargetAttributes = {
97C146ED1CF9000F007C117D = {
Expand Down Expand Up @@ -208,10 +209,12 @@
/* Begin PBXShellScriptBuildPhase section */
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
"${TARGET_BUILD_DIR}/${INFOPLIST_PATH}",
);
name = "Thin Binary";
outputPaths = (
Expand All @@ -220,6 +223,23 @@
shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin\n";
};
717FBB0054865DEA34CA9827 /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-input-files.xcfilelist",
);
name = "[CP] Copy Pods Resources";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-output-files.xcfilelist",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n";
showEnvVarsInLog = 0;
};
8AED107CD2EAE06C6755A899 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
Expand All @@ -244,6 +264,7 @@
};
9740EEB61CF901F6004384FC /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1300"
LastUpgradeVersion = "1510"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
2 changes: 2 additions & 0 deletions example/ios/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -78,5 +78,7 @@
</dict>
</dict>
</dict>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
</dict>
</plist>
Loading