Skip to content

Commit

Permalink
Uses Wikitude SDK 9.8 for samples
Browse files Browse the repository at this point in the history
  • Loading branch information
pnagele committed Jul 1, 2021
1 parent e6e0d58 commit 8ed5e18
Show file tree
Hide file tree
Showing 180 changed files with 11,996 additions and 406 deletions.
Binary file modified android/.gradle/5.6.4/executionHistory/executionHistory.bin
Binary file not shown.
Binary file modified android/.gradle/5.6.4/executionHistory/executionHistory.lock
Binary file not shown.
Binary file modified android/.gradle/5.6.4/fileContent/fileContent.lock
Binary file not shown.
Binary file modified android/.gradle/5.6.4/fileHashes/fileHashes.bin
Binary file not shown.
Binary file modified android/.gradle/5.6.4/fileHashes/fileHashes.lock
Binary file not shown.
Binary file modified android/.gradle/5.6.4/fileHashes/resourceHashesCache.bin
Binary file not shown.
Binary file modified android/.gradle/5.6.4/javaCompile/classAnalysis.bin
Binary file not shown.
Binary file modified android/.gradle/5.6.4/javaCompile/jarAnalysis.bin
Binary file not shown.
Binary file modified android/.gradle/5.6.4/javaCompile/javaCompile.lock
Binary file not shown.
Binary file modified android/.gradle/5.6.4/javaCompile/taskHistory.bin
Binary file not shown.
Binary file modified android/.gradle/buildOutputCleanup/buildOutputCleanup.lock
Binary file not shown.
2 changes: 1 addition & 1 deletion android/.gradle/buildOutputCleanup/cache.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#Wed May 19 17:56:33 CEST 2021
#Thu Jul 01 00:15:44 CEST 2021
gradle.version=5.6.4
Binary file modified android/.gradle/buildOutputCleanup/outputFiles.bin
Binary file not shown.
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ if (flutterVersionCode == null) {

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '9.8.0'
flutterVersionName = '9.9.0'
}

apply plugin: 'com.android.application'
Expand All @@ -35,7 +35,7 @@ android {
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.wikitude.fluttersamples"
minSdkVersion 22
minSdkVersion 23
targetSdkVersion 30
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
public final class GeneratedPluginRegistrant {
public static void registerWith(@NonNull FlutterEngine flutterEngine) {
ShimPluginRegistry shimPluginRegistry = new ShimPluginRegistry(flutterEngine);
com.lyokone.location.LocationPlugin.registerWith(shimPluginRegistry.registrarFor("com.lyokone.location.LocationPlugin"));
flutterEngine.getPlugins().add(new io.flutter.plugins.pathprovider.PathProviderPlugin());
flutterEngine.getPlugins().add(new creativecreatorormaybenot.wakelock.WakelockPlugin());
com.wikitude.wikitude_plugin.WikitudePlugin.registerWith(shimPluginRegistry.registrarFor("com.wikitude.wikitude_plugin.WikitudePlugin"));
flutterEngine.getPlugins().add(new com.lyokone.location.LocationPlugin());
flutterEngine.getPlugins().add(new io.flutter.plugins.pathprovider.PathProviderPlugin());
flutterEngine.getPlugins().add(new creativemaybeno.wakelock.WakelockPlugin());
}
}
8 changes: 4 additions & 4 deletions ios/Flutter/Flutter.podspec
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
#
# NOTE: This podspec is NOT to be published. It is only used as a local source!
# This is a generated file; do not edit or check into version control.
#

Pod::Spec.new do |s|
s.name = 'Flutter'
s.version = '1.0.0'
s.summary = 'High-performance, high-fidelity mobile apps.'
s.description = <<-DESC
Flutter provides an easy and productive way to build and deploy high-performance mobile apps for Android and iOS.
DESC
s.homepage = 'https://flutter.io'
s.license = { :type => 'MIT' }
s.author = { 'Flutter Dev Team' => 'flutter-dev@googlegroups.com' }
s.source = { :git => 'https://github.com/flutter/engine', :tag => s.version.to_s }
s.ios.deployment_target = '8.0'
s.vendored_frameworks = 'Flutter.framework'
# Framework linking is handled by Flutter tooling, not CocoaPods.
# Add a placeholder to satisfy `s.dependency 'Flutter'` plugin podspecs.
s.vendored_frameworks = 'path/to/nothing'
end
64 changes: 17 additions & 47 deletions ios/Podfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
platform :ios, '12.0'
# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
Expand All @@ -9,60 +10,29 @@ project 'Runner', {
'Release' => :release,
}

def parse_KV_file(file, separator='=')
file_abs_path = File.expand_path(file)
if !File.exists? file_abs_path
return [];
def flutter_root
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
unless File.exist?(generated_xcode_build_settings_path)
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
end
pods_ary = []
skip_line_start_symbols = ["#", "/"]
File.foreach(file_abs_path) { |line|
next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ }
plugin = line.split(pattern=separator)
if plugin.length == 2
podname = plugin[0].strip()
path = plugin[1].strip()
podpath = File.expand_path("#{path}", file_abs_path)
pods_ary.push({:name => podname, :path => podpath});
else
puts "Invalid plugin specification: #{line}"
end
}
return pods_ary

File.foreach(generated_xcode_build_settings_path) do |line|
matches = line.match(/FLUTTER_ROOT\=(.*)/)
return matches[1].strip if matches
end
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end

target 'Runner' do
# Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
# referring to absolute paths on developers' machines.
system('rm -rf .symlinks')
system('mkdir -p .symlinks/plugins')
require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)

# Flutter Pods
generated_xcode_build_settings = parse_KV_file('./Flutter/Generated.xcconfig')
if generated_xcode_build_settings.empty?
puts "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter packages get is executed first."
end
generated_xcode_build_settings.map { |p|
if p[:name] == 'FLUTTER_FRAMEWORK_DIR'
symlink = File.join('.symlinks', 'flutter')
File.symlink(File.dirname(p[:path]), symlink)
pod 'Flutter', :path => File.join(symlink, File.basename(p[:path]))
end
}
flutter_ios_podfile_setup

# Plugin Pods
plugin_pods = parse_KV_file('../.flutter-plugins')
plugin_pods.map { |p|
symlink = File.join('.symlinks', 'plugins', p[:name])
File.symlink(p[:path], symlink)
pod p[:name], :path => File.join(symlink, 'ios')
}
target 'Runner' do
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end

post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['ENABLE_BITCODE'] = 'NO'
end
flutter_additional_ios_build_settings(target)
end
end
24 changes: 20 additions & 4 deletions ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@
buildPhases = (
EB151F2033E0E7F480E9013D /* [CP] Check Pods Manifest.lock */,
9740EEB61CF901F6004384FC /* Run Script */,
57602FF1305E1610CBE59EDA /* [CP] Prepare Artifacts */,
97C146EA1CF9000F007C117D /* Sources */,
97C146EB1CF9000F007C117D /* Frameworks */,
97C146EC1CF9000F007C117D /* Resources */,
Expand Down Expand Up @@ -235,19 +236,34 @@
);
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh",
"${PODS_ROOT}/../.symlinks/flutter/ios-release/Flutter.framework",
"${PODS_ROOT}/../.symlinks/plugins/augmented_reality_plugin_wikitude/ios/Frameworks/WikitudeSDK.framework",
"${BUILT_PRODUCTS_DIR}/cocoapods-artifacts-${CONFIGURATION}.txt",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Flutter.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/WikitudeSDK.framework",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
57602FF1305E1610CBE59EDA /* [CP] Prepare Artifacts */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-artifacts.sh",
"${PODS_ROOT}/../.symlinks/plugins/augmented_reality_plugin_wikitude/ios/Frameworks/WikitudeSDK.xcframework",
);
name = "[CP] Prepare Artifacts";
outputPaths = (
"${BUILT_PRODUCTS_DIR}/cocoapods-artifacts-${CONFIGURATION}.txt",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-artifacts.sh\"\n";
showEnvVarsInLog = 0;
};
9740EEB61CF901F6004384FC /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions ios/Runner/GeneratedPluginRegistrant.m
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@

#import "GeneratedPluginRegistrant.h"

#if __has_include(<augmented_reality_plugin_wikitude/WikitudePlugin.h>)
#import <augmented_reality_plugin_wikitude/WikitudePlugin.h>
#else
@import augmented_reality_plugin_wikitude;
#endif

#if __has_include(<location/LocationPlugin.h>)
#import <location/LocationPlugin.h>
#else
Expand All @@ -22,19 +28,13 @@
@import wakelock;
#endif

#if __has_include(<augmented_reality_plugin_wikitude/WikitudePlugin.h>)
#import <augmented_reality_plugin_wikitude/WikitudePlugin.h>
#else
@import augmented_reality_plugin_wikitude;
#endif

@implementation GeneratedPluginRegistrant

+ (void)registerWithRegistry:(NSObject<FlutterPluginRegistry>*)registry {
[WikitudePlugin registerWithRegistrar:[registry registrarForPlugin:@"WikitudePlugin"]];
[LocationPlugin registerWithRegistrar:[registry registrarForPlugin:@"LocationPlugin"]];
[FLTPathProviderPlugin registerWithRegistrar:[registry registrarForPlugin:@"FLTPathProviderPlugin"]];
[WakelockPlugin registerWithRegistrar:[registry registrarForPlugin:@"WakelockPlugin"]];
[WikitudePlugin registerWithRegistrar:[registry registrarForPlugin:@"WikitudePlugin"]];
}

@end
22 changes: 8 additions & 14 deletions lib/applicationModelPois.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,18 @@ import 'package:location/location.dart';
import 'poi.dart';

class ApplicationModelPois {
static Future<List<Poi>> prepareApplicationDataModel() async {
final Random random = new Random();
final int min = 1;
final int max = 10;
final int placesAmount = 10;
final Location location = new Location();

final _random = new Random();
int min = 1;
int max = 10;

List<Poi> pois;
int placesAmount = 10;

ApplicationModelPois() {
pois = new List();
}

Future<List<Poi>> prepareApplicationDataModel() async {
Location location = new Location();
List<Poi> pois = <Poi>[];
try {
LocationData userLocation = await location.getLocation();
for (int i = 0; i < placesAmount; i++) {
pois.add(new Poi(i+1, userLocation.longitude + 0.001 * (5 - min + _random.nextInt(max - min)), userLocation.latitude + 0.001 * (5 - min + _random.nextInt(max - min)), 'This is the description of POI#' + (i+1).toString(), userLocation.altitude, 'POI#' + (i+1).toString()));
pois.add(new Poi(i+1, userLocation.longitude! + 0.001 * (5 - min + random.nextInt(max - min)), userLocation.latitude! + 0.001 * (5 - min + random.nextInt(max - min)), 'This is the description of POI#' + (i+1).toString(), userLocation.altitude!, 'POI#' + (i+1).toString()));
}
} catch(e) {
print("Location Error: " + e.toString());
Expand Down
49 changes: 23 additions & 26 deletions lib/arview.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,24 @@ import 'package:augmented_reality_plugin_wikitude/wikitude_response.dart';
import 'package:wikitude_flutter_app/poiDetails.dart';

class ArViewState extends State<ArViewWidget> with WidgetsBindingObserver {
ArchitectWidget architectWidget;
late ArchitectWidget architectWidget;
String wikitudeTrialLicenseKey = "rRcPFV/GWHOalFjHX9rP9TWGNRKVu8P4FSKvHtps1mo14SexXUmlVAebLNuKKr9OcOFD89RiMH03AY3eJL09d3Pbvb/V+AVYs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0BY+msO4h/vrb4dMB61qzxCuJM8ax6O5tuQc4u5WOi/6XrAIRFTCqLMST8U6JKN689s70FJtvQYm0DpbPfYTOfeA53B5fphfsTMQqXFwKPhVLczCoWftmlLhHb/NcmNmCHnTp/Mm9yObyNsiG3oQ1Wbb1a9eMOcJ5y/Wvpi0RSYGwIfJcIIknvJIwPphZ3AJ3K9x/M89kct/J65XZMAMdnM1FbtLRpgKUVAUIUJ/E6V03QP/ElUHHukYjbXABWs/fJ/6uy9E4aXjbmzJQ6I9VKQ1uUsT2Oh8585HoXp6LLiFxADdRSIllJBtuMCmgfrd06qQ/q9wu8xFzvJYBeIT6xlCbsBXgdm";
Sample sample;
String loadPath = "";
bool loadFailed = false;

ArViewState(Sample sample) {
this.sample = sample;
if(sample.path.contains("http://") || sample.path.contains("https://")) {
loadPath = sample.path;
ArViewState({required this.sample}) {
if(this.sample.path.contains("http://") || this.sample.path.contains("https://")) {
loadPath = this.sample.path;
} else {
loadPath = "samples/" + sample.path;
loadPath = "samples/" + this.sample.path;
}
}

@override
void initState() {
super.initState();
WidgetsBinding.instance.addObserver(this);
WidgetsBinding.instance!.addObserver(this);

architectWidget = new ArchitectWidget(
onArchitectWidgetCreated: onArchitectWidgetCreated,
Expand All @@ -49,11 +48,9 @@ class ArViewState extends State<ArViewWidget> with WidgetsBindingObserver {

@override
void dispose() {
if (this.architectWidget != null) {
this.architectWidget.pause();
this.architectWidget.destroy();
}
WidgetsBinding.instance.removeObserver(this);
this.architectWidget.pause();
this.architectWidget.destroy();
WidgetsBinding.instance!.removeObserver(this);

Wakelock.disable();
super.dispose();
Expand All @@ -63,14 +60,10 @@ class ArViewState extends State<ArViewWidget> with WidgetsBindingObserver {
void didChangeAppLifecycleState(AppLifecycleState state) {
switch (state) {
case AppLifecycleState.paused:
if (this.architectWidget != null) {
this.architectWidget.pause();
}
this.architectWidget.pause();
break;
case AppLifecycleState.resumed:
if (this.architectWidget != null) {
this.architectWidget.resume();
}
this.architectWidget.resume();
break;

default:
Expand All @@ -84,7 +77,12 @@ class ArViewState extends State<ArViewWidget> with WidgetsBindingObserver {
body: WillPopScope(
onWillPop: () async {
if(defaultTargetPlatform == TargetPlatform.android && !loadFailed) {
return !(await this.architectWidget.canWebViewGoBack());
bool? canWebViewGoBack = await this.architectWidget.canWebViewGoBack();
if (canWebViewGoBack != null) {
return !canWebViewGoBack;
} else {
return true;
}
} else {
return true;
}
Expand All @@ -100,13 +98,12 @@ class ArViewState extends State<ArViewWidget> with WidgetsBindingObserver {
this.architectWidget.load(loadPath, onLoadSuccess, onLoadFailed);
this.architectWidget.resume();

if(sample.requiredExtensions != null && sample.requiredExtensions.contains("application_model_pois")) {
ApplicationModelPois applicationModelPois = new ApplicationModelPois();
List<Poi> pois = await applicationModelPois.prepareApplicationDataModel();
if(sample.requiredExtensions.contains("application_model_pois")) {
List<Poi> pois = await ApplicationModelPois.prepareApplicationDataModel();
this.architectWidget.callJavascript("World.loadPoisFromJsonData(" + jsonEncode(pois) + ");");
}

if(sample.requiredExtensions != null && (sample.requiredExtensions.contains("screenshot") ||
if((sample.requiredExtensions.contains("screenshot") ||
sample.requiredExtensions.contains("save_load_instant_target") ||
sample.requiredExtensions.contains("native_detail"))) {
this.architectWidget.setJSONObjectReceivedCallback(onJSONObjectReceived);
Expand Down Expand Up @@ -181,10 +178,10 @@ class ArViewWidget extends StatefulWidget {
final Sample sample;

ArViewWidget({
Key key,
@required this.sample,
Key? key,
required this.sample,
});

@override
ArViewState createState() => new ArViewState(sample);
ArViewState createState() => new ArViewState(sample: sample);
}
4 changes: 2 additions & 2 deletions lib/category.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ class Category {
String categoryName;
List<Sample> samples;

Category({this.categoryName, this.samples});
Category({required this.categoryName, required this.samples});

factory Category.fromJson(Map<String, dynamic> jsonMap){
List<dynamic> samplesFromJson = jsonMap["samples"];
List<Sample> samples = new List();
List<Sample> samples = [];
for(int i = 0; i < samplesFromJson.length; i++) {
samples.add(new Sample.fromJson(samplesFromJson[i]));
}
Expand Down

0 comments on commit 8ed5e18

Please sign in to comment.