Skip to content

Commit 62eddf8

Browse files
committed
v6.1.0
1 parent d155a17 commit 62eddf8

File tree

18 files changed

+166
-27
lines changed

18 files changed

+166
-27
lines changed

android/app/build.gradle

+6-2
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,11 @@ if (flutterVersionName == null) {
2424

2525
android {
2626
namespace "com.nylo.android"
27-
compileSdk flutter.compileSdkVersion
27+
compileSdk 34
2828
ndkVersion flutter.ndkVersion
2929

3030
compileOptions {
31+
coreLibraryDesugaringEnabled true
3132
sourceCompatibility JavaVersion.VERSION_1_8
3233
targetCompatibility JavaVersion.VERSION_1_8
3334
}
@@ -42,6 +43,7 @@ android {
4243

4344
defaultConfig {
4445
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
46+
multiDexEnabled true
4547
applicationId "com.nylo.android"
4648
// You can update the following values to match your application needs.
4749
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
@@ -64,4 +66,6 @@ flutter {
6466
source '../..'
6567
}
6668

67-
dependencies {}
69+
dependencies {
70+
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.2.2'
71+
}

android/app/src/main/AndroidManifest.xml

+31
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
2+
3+
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
4+
<uses-permission android:name="android.permission.VIBRATE" />
5+
<uses-permission android:name="android.permission.USE_FULL_SCREEN_INTENT" />
6+
<uses-permission android:name="android.permission.USE_EXACT_ALARM" />
7+
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
8+
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
9+
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_SPECIAL_USE" />
10+
211
<application
312
android:label="Nylo"
413
android:name="${applicationName}"
@@ -8,6 +17,8 @@
817
<activity
918
android:name=".MainActivity"
1019
android:exported="true"
20+
android:showWhenLocked="true"
21+
android:turnScreenOn="true"
1122
android:launchMode="singleTop"
1223
android:theme="@style/LaunchTheme"
1324
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
@@ -31,7 +42,27 @@
3142
<meta-data
3243
android:name="flutterEmbedding"
3344
android:value="2" />
45+
46+
<service
47+
android:name="com.nylo.android.ForegroundService"
48+
android:exported="false"
49+
android:stopWithTask="false"
50+
android:foregroundServiceType="specialUse">
51+
<property android:name="android.app.PROPERTY_SPECIAL_USE_FGS_SUBTYPE" android:value="To demonstrate how to use foreground services to show notifications"/>
52+
</service>
53+
<receiver android:exported="false" android:name="com.nylo.android.ActionBroadcastReceiver" />
54+
<receiver android:exported="false" android:name="com.nylo.android.ScheduledNotificationReceiver" />
55+
<receiver android:exported="false" android:name="com.nylo.android.ScheduledNotificationBootReceiver">
56+
<intent-filter>
57+
<action android:name="android.intent.action.BOOT_COMPLETED"/>
58+
<action android:name="android.intent.action.MY_PACKAGE_REPLACED"/>
59+
<action android:name="android.intent.action.QUICKBOOT_POWERON" />
60+
<action android:name="com.htc.intent.action.QUICKBOOT_POWERON"/>
61+
</intent-filter>
62+
</receiver>
63+
3464
</application>
65+
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
3566
<!-- Required to query activities that can process text, see:
3667
https://developer.android.com/training/package-visibility?hl=en and
3768
https://developer.android.com/reference/android/content/Intent#ACTION_PROCESS_TEXT.
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,33 @@
11
package com.nylo.android
22

3+
import android.content.ContentResolver
4+
import android.content.Context
5+
import android.media.RingtoneManager
36
import io.flutter.embedding.android.FlutterActivity
7+
import io.flutter.embedding.engine.FlutterEngine
8+
import io.flutter.plugin.common.MethodChannel
9+
import java.util.*
410

5-
class MainActivity: FlutterActivity()
11+
class MainActivity: FlutterActivity() {
12+
override fun configureFlutterEngine(flutterEngine: FlutterEngine) {
13+
super.configureFlutterEngine(flutterEngine)
14+
MethodChannel(flutterEngine.dartExecutor.binaryMessenger, "nylo.dev/android").setMethodCallHandler { call, result ->
15+
if ("drawableToUri" == call.method) {
16+
val resourceId = this@MainActivity.resources.getIdentifier(call.arguments as String, "drawable", this@MainActivity.packageName)
17+
result.success(resourceToUriString(this@MainActivity.applicationContext, resourceId))
18+
}
19+
if ("getAlarmUri" == call.method) {
20+
result.success(RingtoneManager.getDefaultUri(RingtoneManager.TYPE_ALARM).toString())
21+
}
22+
}
23+
}
24+
25+
private fun resourceToUriString(context: Context, resId: Int): String? {
26+
return (ContentResolver.SCHEME_ANDROID_RESOURCE + "://"
27+
+ context.resources.getResourcePackageName(resId)
28+
+ "/"
29+
+ context.resources.getResourceTypeName(resId)
30+
+ "/"
31+
+ context.resources.getResourceEntryName(resId))
32+
}
33+
}
57.8 KB
Loading

ios/Podfile.lock

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ EXTERNAL SOURCES:
4848
SPEC CHECKSUMS:
4949
app_badge_plus: 060babf17a97011f0093739f0aa8bc65b2479233
5050
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
51-
flutter_local_notifications: 4cde75091f6327eb8517fa068a0a5950212d2086
51+
flutter_local_notifications: df98d66e515e1ca797af436137b4459b160ad8c9
5252
flutter_secure_storage: d33dac7ae2ea08509be337e775f6b59f1ff45f12
5353
flutter_timezone: ffb07bdad3c6276af8dada0f11978d8a1f8a20bb
5454
path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46

ios/Runner.xcodeproj/project.pbxproj

+5
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
5656
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
5757
7CB3EF96860B8A70A1BBB19E /* Pods-RunnerTests.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.profile.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.profile.xcconfig"; sourceTree = "<group>"; };
58+
926D7F5D2CD87CCE003BD3CC /* Runner.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Runner.entitlements; sourceTree = "<group>"; };
5859
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = "<group>"; };
5960
9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = "<group>"; };
6061
97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -143,6 +144,7 @@
143144
97C146F01CF9000F007C117D /* Runner */ = {
144145
isa = PBXGroup;
145146
children = (
147+
926D7F5D2CD87CCE003BD3CC /* Runner.entitlements */,
146148
97C146FA1CF9000F007C117D /* Main.storyboard */,
147149
97C146FD1CF9000F007C117D /* Assets.xcassets */,
148150
97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */,
@@ -467,6 +469,7 @@
467469
buildSettings = {
468470
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
469471
CLANG_ENABLE_MODULES = YES;
472+
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
470473
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
471474
DEVELOPMENT_TEAM = "";
472475
ENABLE_BITCODE = NO;
@@ -646,6 +649,7 @@
646649
buildSettings = {
647650
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
648651
CLANG_ENABLE_MODULES = YES;
652+
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
649653
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
650654
DEVELOPMENT_TEAM = "";
651655
ENABLE_BITCODE = NO;
@@ -669,6 +673,7 @@
669673
buildSettings = {
670674
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
671675
CLANG_ENABLE_MODULES = YES;
676+
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
672677
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
673678
DEVELOPMENT_TEAM = "";
674679
ENABLE_BITCODE = NO;

ios/Runner/AppDelegate.swift

+9
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,21 @@
11
import UIKit
22
import Flutter
3+
import flutter_local_notifications
34

45
@main
56
@objc class AppDelegate: FlutterAppDelegate {
67
override func application(
78
_ application: UIApplication,
89
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
910
) -> Bool {
11+
FlutterLocalNotificationsPlugin.setPluginRegistrantCallback { (registry) in
12+
GeneratedPluginRegistrant.register(with: registry)
13+
}
14+
15+
if #available(iOS 10.0, *) {
16+
UNUserNotificationCenter.current().delegate = self as UNUserNotificationCenterDelegate
17+
}
18+
1019
GeneratedPluginRegistrant.register(with: self)
1120
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
1221
}
+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"info" : {
3+
"author" : "xcode",
4+
"version" : 1
5+
}
6+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"images" : [
3+
{
4+
"filename" : "icon.png",
5+
"idiom" : "universal",
6+
"scale" : "1x"
7+
},
8+
{
9+
"idiom" : "universal",
10+
"scale" : "2x"
11+
},
12+
{
13+
"idiom" : "universal",
14+
"scale" : "3x"
15+
}
16+
],
17+
"info" : {
18+
"author" : "xcode",
19+
"version" : 1
20+
}
21+
}
Loading
+19-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2-
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12121" systemVersion="16G29" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="23094" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
3+
<device id="retina6_12" orientation="portrait" appearance="light"/>
34
<dependencies>
45
<deployment identifier="iOS"/>
5-
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12089"/>
6+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="23084"/>
7+
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
68
</dependencies>
79
<scenes>
810
<!--View Controller-->
@@ -14,24 +16,36 @@
1416
<viewControllerLayoutGuide type="bottom" id="xbc-2k-c8Z"/>
1517
</layoutGuides>
1618
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
19+
<rect key="frame" x="0.0" y="0.0" width="393" height="852"/>
1720
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
1821
<subviews>
1922
<imageView opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" image="LaunchImage" translatesAutoresizingMaskIntoConstraints="NO" id="YRO-k0-Ey4">
23+
<rect key="frame" x="196.33333333333334" y="426" width="0.33333333333334281" height="0.33333333333331439"/>
24+
</imageView>
25+
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="icon" translatesAutoresizingMaskIntoConstraints="NO" id="C2P-Jf-eGY">
26+
<rect key="frame" x="146.66666666666666" y="326" width="100" height="200"/>
27+
<constraints>
28+
<constraint firstAttribute="width" constant="100" id="2Ju-AQ-Z2v"/>
29+
<constraint firstAttribute="height" constant="200" id="KTf-jT-XjO"/>
30+
</constraints>
2031
</imageView>
2132
</subviews>
2233
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
2334
<constraints>
2435
<constraint firstItem="YRO-k0-Ey4" firstAttribute="centerX" secondItem="Ze5-6b-2t3" secondAttribute="centerX" id="1a2-6s-vTC"/>
2536
<constraint firstItem="YRO-k0-Ey4" firstAttribute="centerY" secondItem="Ze5-6b-2t3" secondAttribute="centerY" id="4X2-HB-R7a"/>
37+
<constraint firstItem="C2P-Jf-eGY" firstAttribute="centerX" secondItem="Ze5-6b-2t3" secondAttribute="centerX" id="iPL-0j-mgL"/>
38+
<constraint firstItem="C2P-Jf-eGY" firstAttribute="centerY" secondItem="Ze5-6b-2t3" secondAttribute="centerY" id="kr1-Zf-xMo"/>
2639
</constraints>
2740
</view>
2841
</viewController>
2942
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
3043
</objects>
31-
<point key="canvasLocation" x="53" y="375"/>
44+
<point key="canvasLocation" x="80.152671755725194" y="264.08450704225356"/>
3245
</scene>
3346
</scenes>
3447
<resources>
35-
<image name="LaunchImage" width="168" height="185"/>
48+
<image name="LaunchImage" width="0.3333333432674408" height="0.3333333432674408"/>
49+
<image name="icon" width="1024" height="1024"/>
3650
</resources>
3751
</document>

ios/Runner/Info.plist

+6
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,12 @@
3232
<true/>
3333
<key>UIApplicationSupportsIndirectInputEvents</key>
3434
<true/>
35+
<key>UIBackgroundModes</key>
36+
<array>
37+
<string>fetch</string>
38+
<string>processing</string>
39+
<string>remote-notification</string>
40+
</array>
3541
<key>UILaunchStoryboardName</key>
3642
<string>LaunchScreen</string>
3743
<key>UIMainStoryboardFile</key>

ios/Runner/Runner.entitlements

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>aps-environment</key>
6+
<string>development</string>
7+
</dict>
8+
</plist>

lib/config/providers.dart

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import '/app/providers/push_notifications_provider.dart';
12
import '/app/providers/app_provider.dart';
23
import '/app/providers/event_provider.dart';
34
import '/app/providers/route_provider.dart';
@@ -15,4 +16,5 @@ final Map<Type, NyProvider> providers = {
1516
AppProvider: AppProvider(),
1617
RouteProvider: RouteProvider(),
1718
EventProvider: EventProvider(),
19+
PushNotificationsProvider: PushNotificationsProvider(),
1820
};

lib/resources/pages/home_page.dart

+5
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ class _HomePageState extends NyPage<HomePage> {
3838
floatingActionButton: FloatingActionButton(
3939
onPressed: () async {
4040
showToastSuccess(title: "Hello 👋", description: "Welcome to Nylo");
41+
42+
// Uncomment the code below to send a push notifications
43+
// await PushNotification.sendNotification(
44+
// title: "Hello 👋", body: "Welcome to Nylo",
45+
// );
4146
},
4247
child: const Icon(Icons.notifications),
4348
),

lib/routes/router.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import 'package:nylo_framework/nylo_framework.dart';
1717

1818
appRouter() => nyRoutes((router) {
1919
router.add(HomePage.path).initialRoute();
20-
// Add your routes here
20+
// Add your routes here ...
2121

2222
// router.add(NewPage.path, transition: PageTransitionType.fade);
2323

0 commit comments

Comments
 (0)