feat: 알림 권한 처리 개선 및 빌드 시스템 업데이트
- Android NDK 버전을 27.0.12077973으로 업데이트 - Core library desugaring 설정 추가 - POST_NOTIFICATIONS 권한 추가 (Android 13+) - flutter_local_notifications 17.2.4로 업데이트 - iOS/Android 알림 권한 요청 메서드 개선 - 권한 상태 확인 메서드 추가
This commit is contained in:
@@ -8,11 +8,12 @@ plugins {
|
||||
android {
|
||||
namespace = "com.example.submanager"
|
||||
compileSdk = flutter.compileSdkVersion
|
||||
ndkVersion = flutter.ndkVersion
|
||||
ndkVersion = "27.0.12077973"
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility = JavaVersion.VERSION_11
|
||||
targetCompatibility = JavaVersion.VERSION_11
|
||||
isCoreLibraryDesugaringEnabled = true
|
||||
}
|
||||
|
||||
kotlinOptions {
|
||||
@@ -42,3 +43,7 @@ android {
|
||||
flutter {
|
||||
source = "../.."
|
||||
}
|
||||
|
||||
dependencies {
|
||||
coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.0.4")
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<uses-permission android:name="android.permission.READ_SMS" />
|
||||
<uses-permission android:name="android.permission.RECEIVE_SMS" />
|
||||
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
|
||||
<application
|
||||
android:label="구독 관리"
|
||||
android:name="${applicationName}"
|
||||
|
||||
@@ -3,6 +3,7 @@ import 'package:timezone/timezone.dart' as tz;
|
||||
import 'package:timezone/data/latest_all.dart' as tz;
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'dart:io' show Platform;
|
||||
import '../models/subscription_model.dart';
|
||||
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
||||
|
||||
@@ -151,11 +152,72 @@ class NotificationService {
|
||||
|
||||
|
||||
static Future<bool> requestPermission() async {
|
||||
final result = await _notifications
|
||||
// 웹 플랫폼인 경우 false 반환
|
||||
if (_isWeb) return false;
|
||||
|
||||
// iOS 처리
|
||||
if (Platform.isIOS) {
|
||||
final iosImplementation = _notifications
|
||||
.resolvePlatformSpecificImplementation<
|
||||
AndroidFlutterLocalNotificationsPlugin>()
|
||||
?.requestPermission();
|
||||
return result ?? false;
|
||||
IOSFlutterLocalNotificationsPlugin>();
|
||||
|
||||
if (iosImplementation != null) {
|
||||
final granted = await iosImplementation.requestPermissions(
|
||||
alert: true,
|
||||
badge: true,
|
||||
sound: true,
|
||||
);
|
||||
return granted ?? false;
|
||||
}
|
||||
}
|
||||
|
||||
// Android 처리
|
||||
if (Platform.isAndroid) {
|
||||
final androidImplementation = _notifications
|
||||
.resolvePlatformSpecificImplementation<
|
||||
AndroidFlutterLocalNotificationsPlugin>();
|
||||
|
||||
if (androidImplementation != null) {
|
||||
final granted = await androidImplementation
|
||||
.requestNotificationsPermission();
|
||||
return granted ?? false;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// 권한 상태 확인
|
||||
static Future<bool> checkPermission() async {
|
||||
// 웹 플랫폼인 경우 false 반환
|
||||
if (_isWeb) return false;
|
||||
|
||||
// Android 처리
|
||||
if (Platform.isAndroid) {
|
||||
final androidImplementation = _notifications
|
||||
.resolvePlatformSpecificImplementation<
|
||||
AndroidFlutterLocalNotificationsPlugin>();
|
||||
|
||||
if (androidImplementation != null) {
|
||||
// Android 13 이상에서만 권한 확인 필요
|
||||
final isEnabled = await androidImplementation.areNotificationsEnabled();
|
||||
return isEnabled ?? false;
|
||||
}
|
||||
}
|
||||
|
||||
// iOS 처리
|
||||
if (Platform.isIOS) {
|
||||
final iosImplementation = _notifications
|
||||
.resolvePlatformSpecificImplementation<
|
||||
IOSFlutterLocalNotificationsPlugin>();
|
||||
|
||||
if (iosImplementation != null) {
|
||||
final settings = await iosImplementation.checkPermissions();
|
||||
return settings?.isEnabled ?? false;
|
||||
}
|
||||
}
|
||||
|
||||
return true; // 기본값
|
||||
}
|
||||
|
||||
// 알림 스케줄 설정
|
||||
|
||||
@@ -59,7 +59,7 @@ EXTERNAL SOURCES:
|
||||
:path: Flutter/ephemeral/.symlinks/plugins/webview_flutter_wkwebview/darwin
|
||||
|
||||
SPEC CHECKSUMS:
|
||||
flutter_local_notifications: 3805ca215b2fb7f397d78b66db91f6a747af52e4
|
||||
flutter_local_notifications: 4b427ffabf278fc6ea9484c97505e231166927a5
|
||||
flutter_secure_storage_macos: c2754d3483d20bb207bb9e5a14f1b8e771abcdb9
|
||||
FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24
|
||||
local_auth_darwin: 66e40372f1c29f383a314c738c7446e2f7fdadc3
|
||||
|
||||
@@ -343,10 +343,10 @@ packages:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: flutter_local_notifications
|
||||
sha256: "401643a6ea9d8451365f2ec11145335bf130560cfde367bdf8f0be6d60f89479"
|
||||
sha256: "674173fd3c9eda9d4c8528da2ce0ea69f161577495a9cc835a2a4ecd7eadeb35"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "15.1.3"
|
||||
version: "17.2.4"
|
||||
flutter_local_notifications_linux:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
||||
@@ -13,7 +13,7 @@ dependencies:
|
||||
provider: ^6.1.1
|
||||
hive: ^2.2.3
|
||||
hive_flutter: ^1.1.0
|
||||
flutter_local_notifications: ^15.1.0
|
||||
flutter_local_notifications: ^17.2.4
|
||||
flutter_secure_storage: ^9.0.0
|
||||
local_auth: ^2.1.6
|
||||
fl_chart: ^0.66.2
|
||||
|
||||
Reference in New Issue
Block a user