20240903 pre release
This commit is contained in:
65
ios_setup/Info.plist
Normal file
65
ios_setup/Info.plist
Normal file
@ -0,0 +1,65 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CADisableMinimumFrameDurationOnPhone</key>
|
||||
<true/>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
||||
<key>CFBundleDisplayName</key>
|
||||
<string>岐阜ナビ</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>岐阜ナビ</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>$(FLUTTER_BUILD_NAME)</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>$(FLUTTER_BUILD_NUMBER)</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true/>
|
||||
<key>NSCameraUsageDescription</key>
|
||||
<string>岐阜ナビはチェックポイントで撮影した写真を写真ライブラリに保存し、通過記録を保持し、競技結果として提出することができます。</string>
|
||||
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
|
||||
<string>岐阜ナビはアプリが閉じられているときでも位置情報へのアクセスが必要です。これにより、走行履歴の記録ができ、レビュー時の参考にすることができます。</string>
|
||||
<key>NSLocationAlwaysUsageDescription</key>
|
||||
<string>このアプリではバックグラウンドで位置情報にアクセスします。</string>
|
||||
<key>NSLocationWhenInUseUsageDescription</key>
|
||||
<string>このアプリはチェックポイントへのチェックインや走行履歴を記録するために、位置情報にアクセスします。</string>
|
||||
<key>NSMicrophoneUsageDescription</key>
|
||||
<string>このアプリではカメラは使用しますが、マイクの使用は当面行いません。</string>
|
||||
<key>NSPhotoLibraryAddUsageDescription</key>
|
||||
<string>撮影した写真はデバイスのアルバムに保存されます。これにより、不具合時の通過記録を安全に担保することができます。</string>
|
||||
<key>NSPhotoLibraryUsageDescription</key>
|
||||
<string>撮影した写真はデバイスのアルバムに保存されます。これにより、不具合時の通過記録を安全に担保することができます。</string>
|
||||
<key>UIApplicationSupportsIndirectInputEvents</key>
|
||||
<true/>
|
||||
<key>UILaunchStoryboardName</key>
|
||||
<string>LaunchScreen</string>
|
||||
<key>UIMainStoryboardFile</key>
|
||||
<string>Main</string>
|
||||
<key>UISupportedInterfaceOrientations</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations~ipad</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationPortraitUpsideDown</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>LSApplicationCategoryType</key>
|
||||
<string></string>
|
||||
</dict>
|
||||
</plist>
|
||||
56
ios_setup/Runner/AppDelegate.swift
Normal file
56
ios_setup/Runner/AppDelegate.swift
Normal file
@ -0,0 +1,56 @@
|
||||
import UIKit
|
||||
import Flutter
|
||||
import CoreMotion
|
||||
|
||||
@UIApplicationMain
|
||||
@objc class AppDelegate: FlutterAppDelegate {
|
||||
private let motionManager = CMMotionManager()
|
||||
|
||||
override func application(
|
||||
_ application: UIApplication,
|
||||
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
|
||||
) -> Bool {
|
||||
let controller : FlutterViewController = window?.rootViewController as! FlutterViewController
|
||||
let motionChannel = FlutterMethodChannel(name: "com.yourcompany.app/motion",
|
||||
binaryMessenger: controller.binaryMessenger)
|
||||
motionChannel.setMethodCallHandler({
|
||||
[weak self] (call: FlutterMethodCall, result: @escaping FlutterResult) -> Void in
|
||||
guard let self = self else { return }
|
||||
|
||||
switch call.method {
|
||||
case "startMotionUpdates":
|
||||
self.startMotionUpdates(result: result)
|
||||
case "stopMotionUpdates":
|
||||
self.stopMotionUpdates(result: result)
|
||||
default:
|
||||
result(FlutterMethodNotImplemented)
|
||||
}
|
||||
})
|
||||
|
||||
GeneratedPluginRegistrant.register(with: self)
|
||||
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
|
||||
}
|
||||
|
||||
private func startMotionUpdates(result: @escaping FlutterResult) {
|
||||
if motionManager.isDeviceMotionAvailable {
|
||||
motionManager.deviceMotionUpdateInterval = 0.1
|
||||
motionManager.startDeviceMotionUpdates(to: .main) { (motion, error) in
|
||||
DispatchQueue.main.async {
|
||||
// ここでUIの更新や状態の取得を行う
|
||||
let appState = UIApplication.shared.applicationState
|
||||
// 必要な処理を行う
|
||||
}
|
||||
}
|
||||
result(nil)
|
||||
} else {
|
||||
result(FlutterError(code: "UNAVAILABLE",
|
||||
message: "Device motion is not available.",
|
||||
details: nil))
|
||||
}
|
||||
}
|
||||
|
||||
private func stopMotionUpdates(result: @escaping FlutterResult) {
|
||||
motionManager.stopDeviceMotionUpdates()
|
||||
result(nil)
|
||||
}
|
||||
}
|
||||
30
ios_setup/services/main.dart
Normal file
30
ios_setup/services/main.dart
Normal file
@ -0,0 +1,30 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:your_app/services/motion_service.dart';
|
||||
|
||||
void main() async {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
|
||||
// アプリの起動時にモーション更新を開始
|
||||
await MotionService.startMotionUpdates();
|
||||
|
||||
runApp(MyApp());
|
||||
}
|
||||
|
||||
class MyApp extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp(
|
||||
// ... アプリの設定
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// アプリケーションの状態が変わったときにモーション更新を停止/再開する
|
||||
@override
|
||||
void didChangeAppLifecycleState(AppLifecycleState state) {
|
||||
if (state == AppLifecycleState.paused) {
|
||||
MotionService.stopMotionUpdates();
|
||||
} else if (state == AppLifecycleState.resumed) {
|
||||
MotionService.startMotionUpdates();
|
||||
}
|
||||
}
|
||||
21
ios_setup/services/motion_service.dart
Normal file
21
ios_setup/services/motion_service.dart
Normal file
@ -0,0 +1,21 @@
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
class MotionService {
|
||||
static const MethodChannel _channel = MethodChannel('com.yourcompany.app/motion');
|
||||
|
||||
static Future<void> startMotionUpdates() async {
|
||||
try {
|
||||
await _channel.invokeMethod('startMotionUpdates');
|
||||
} on PlatformException catch (e) {
|
||||
print("Failed to start motion updates: '${e.message}'.");
|
||||
}
|
||||
}
|
||||
|
||||
static Future<void> stopMotionUpdates() async {
|
||||
try {
|
||||
await _channel.invokeMethod('stopMotionUpdates');
|
||||
} on PlatformException catch (e) {
|
||||
print("Failed to stop motion updates: '${e.message}'.");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user