├── .gitignore
├── .idea
├── Flutter-One-Signal.iml
├── codeStyles
│ └── Project.xml
├── libraries
│ ├── Dart_SDK.xml
│ └── Flutter_Plugins.xml
├── misc.xml
├── modules.xml
├── vcs.xml
└── workspace.xml
├── .vscode
└── launch.json
├── CHANGELOG.md
├── LICENSE
├── README.md
├── android
├── .gitignore
├── .idea
│ ├── codeStyles
│ │ └── Project.xml
│ ├── gradle.xml
│ ├── misc.xml
│ ├── modules.xml
│ └── runConfigurations.xml
├── build.gradle
├── gradle.properties
├── settings.gradle
└── src
│ └── main
│ ├── AndroidManifest.xml
│ └── kotlin
│ └── com
│ └── myhexaville
│ └── flutteronesignal
│ └── FlutterOneSignalPlugin.kt
├── example
├── .gitignore
├── .idea
│ ├── libraries
│ │ ├── Dart_SDK.xml
│ │ └── Flutter_for_Android.xml
│ ├── modules.xml
│ ├── runConfigurations
│ │ └── main_dart.xml
│ └── workspace.xml
├── .metadata
├── README.md
├── android
│ ├── .gitignore
│ ├── .idea
│ │ ├── codeStyles
│ │ │ └── Project.xml
│ │ ├── gradle.xml
│ │ ├── misc.xml
│ │ ├── modules.xml
│ │ └── runConfigurations.xml
│ ├── app
│ │ ├── build.gradle
│ │ └── src
│ │ │ └── main
│ │ │ ├── AndroidManifest.xml
│ │ │ ├── kotlin
│ │ │ └── com
│ │ │ │ └── myhexaville
│ │ │ │ └── flutteronesignalexample
│ │ │ │ └── MainActivity.kt
│ │ │ └── res
│ │ │ ├── drawable-hdpi
│ │ │ └── ic_stat_onesignal_default.png
│ │ │ ├── drawable-mdpi
│ │ │ └── ic_stat_onesignal_default.png
│ │ │ ├── drawable-xhdpi
│ │ │ └── ic_stat_onesignal_default.png
│ │ │ ├── drawable-xxhdpi
│ │ │ └── ic_stat_onesignal_default.png
│ │ │ ├── drawable-xxxhdpi
│ │ │ └── ic_stat_onesignal_default.png
│ │ │ ├── drawable
│ │ │ └── launch_background.xml
│ │ │ ├── mipmap-hdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-mdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xhdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xxxhdpi
│ │ │ └── ic_launcher.png
│ │ │ └── values
│ │ │ └── styles.xml
│ ├── build.gradle
│ ├── gradle.properties
│ ├── gradle
│ │ └── wrapper
│ │ │ ├── gradle-wrapper.jar
│ │ │ └── gradle-wrapper.properties
│ ├── gradlew
│ ├── gradlew.bat
│ └── settings.gradle
├── flutter_one_signal_example.iml
├── flutter_one_signal_example_android.iml
├── ios
│ ├── .gitignore
│ ├── Flutter
│ │ ├── AppFrameworkInfo.plist
│ │ ├── Debug.xcconfig
│ │ └── Release.xcconfig
│ ├── Podfile
│ ├── Podfile.lock
│ ├── Runner.xcodeproj
│ │ ├── project.pbxproj
│ │ ├── project.xcworkspace
│ │ │ └── contents.xcworkspacedata
│ │ └── xcshareddata
│ │ │ └── xcschemes
│ │ │ └── Runner.xcscheme
│ ├── Runner.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcshareddata
│ │ │ └── IDEWorkspaceChecks.plist
│ └── Runner
│ │ ├── AppDelegate.swift
│ │ ├── Assets.xcassets
│ │ ├── AppIcon.appiconset
│ │ │ ├── Contents.json
│ │ │ ├── Icon-App-1024x1024@1x.png
│ │ │ ├── Icon-App-20x20@1x.png
│ │ │ ├── Icon-App-20x20@2x.png
│ │ │ ├── Icon-App-20x20@3x.png
│ │ │ ├── Icon-App-29x29@1x.png
│ │ │ ├── Icon-App-29x29@2x.png
│ │ │ ├── Icon-App-29x29@3x.png
│ │ │ ├── Icon-App-40x40@1x.png
│ │ │ ├── Icon-App-40x40@2x.png
│ │ │ ├── Icon-App-40x40@3x.png
│ │ │ ├── Icon-App-60x60@2x.png
│ │ │ ├── Icon-App-60x60@3x.png
│ │ │ ├── Icon-App-76x76@1x.png
│ │ │ ├── Icon-App-76x76@2x.png
│ │ │ └── Icon-App-83.5x83.5@2x.png
│ │ └── LaunchImage.imageset
│ │ │ ├── Contents.json
│ │ │ ├── LaunchImage.png
│ │ │ ├── LaunchImage@2x.png
│ │ │ ├── LaunchImage@3x.png
│ │ │ └── README.md
│ │ ├── Base.lproj
│ │ ├── LaunchScreen.storyboard
│ │ └── Main.storyboard
│ │ ├── Info.plist
│ │ ├── Runner-Bridging-Header.h
│ │ └── Runner.entitlements
├── lib
│ └── main.dart
├── pubspec.yaml
└── test
│ └── widget_test.dart
├── flutter_one_signal.iml
├── flutter_one_signal_android.iml
├── ios
├── .gitignore
├── Assets
│ └── .gitkeep
├── Classes
│ ├── FlutterOneSignalPlugin.h
│ ├── FlutterOneSignalPlugin.m
│ ├── NotificationService.swift
│ └── SwiftFlutterOneSignalPlugin.swift
└── flutter_one_signal.podspec
├── lib
├── flutter_one_signal.dart
└── generated
│ └── i18n.dart
├── pubspec.yaml
└── res
└── values
└── strings_en.arb
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | .dart_tool/
3 |
4 | .packages
5 | .pub/
6 | pubspec.lock
7 |
8 | build/
9 |
--------------------------------------------------------------------------------
/.idea/Flutter-One-Signal.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/.idea/codeStyles/Project.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/.idea/libraries/Dart_SDK.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/.idea/libraries/Flutter_Plugins.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/workspace.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 | 51
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 | Flutter
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 |
206 |
207 |
208 |
209 |
210 |
211 |
212 |
213 |
214 |
215 |
216 |
217 |
218 |
219 |
220 |
221 |
222 |
223 |
224 |
225 |
226 |
227 |
228 |
229 |
230 |
231 |
232 |
233 |
234 |
235 |
236 |
237 |
238 |
239 |
240 |
241 |
242 |
243 |
244 |
245 |
246 |
247 |
248 |
249 |
250 |
251 |
252 |
253 |
254 |
255 |
256 |
257 |
258 |
259 |
260 |
261 |
262 |
263 |
264 |
265 |
266 |
267 |
268 |
269 |
270 |
271 |
272 |
273 |
274 |
275 |
276 |
277 |
278 |
279 |
280 |
281 |
282 |
283 |
284 |
285 |
286 |
287 |
288 |
289 |
290 |
291 |
292 |
293 |
294 |
295 |
296 |
297 | 1529770658032
298 |
299 |
300 | 1529770658032
301 |
302 |
303 |
304 |
305 |
306 |
307 |
308 |
309 |
310 |
311 |
312 |
313 |
314 |
315 |
316 |
317 |
318 |
319 |
320 |
321 |
322 |
323 |
324 |
325 |
326 |
327 |
328 |
329 |
330 |
331 |
332 |
333 |
334 |
335 |
336 |
337 |
338 |
339 |
340 |
341 |
342 |
343 |
344 |
345 |
346 |
347 |
348 |
349 |
350 |
351 |
352 |
353 |
354 |
355 |
356 |
357 |
358 |
359 |
360 |
361 |
362 |
363 |
364 |
365 |
366 |
367 |
368 |
369 |
370 |
371 |
372 |
373 |
374 |
375 |
376 |
377 |
378 |
379 |
380 |
381 |
382 |
383 |
384 |
385 |
386 |
387 |
388 |
389 |
390 |
391 |
392 |
393 |
394 |
395 |
396 |
397 |
398 |
399 |
400 |
401 |
402 |
403 |
404 |
405 |
406 |
407 |
408 |
409 |
410 |
411 |
412 |
413 |
414 |
415 |
416 |
417 |
418 |
419 |
420 |
421 |
422 |
423 |
424 |
425 |
426 |
427 |
428 |
429 |
430 |
431 |
432 |
433 |
434 |
435 |
436 |
437 |
438 |
439 |
440 |
441 |
442 |
443 |
444 |
445 |
446 |
447 |
448 |
449 |
450 |
451 |
452 |
453 |
454 |
455 |
456 |
457 |
458 |
459 |
460 |
--------------------------------------------------------------------------------
/.vscode/launch.json:
--------------------------------------------------------------------------------
1 | {
2 | // Use IntelliSense to learn about possible attributes.
3 | // Hover to view descriptions of existing attributes.
4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5 | "version": "0.2.0",
6 | "configurations": [
7 | {
8 | "name": "Flutter",
9 | "request": "launch",
10 | "type": "dart"
11 | }
12 | ]
13 | }
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | ## 0.2.1
2 |
3 | * getUserId returns null on initial call fix
4 |
5 | ## 0.2.0
6 |
7 | * Logout email, setSubscription
8 |
9 | ## 0.1.2
10 |
11 | * Set email Android fix
12 |
13 | ## 0.1.1
14 |
15 | * Set email
16 |
17 | ## 0.1.0
18 |
19 | * Initial release
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License
2 |
3 | Copyright (c) 2010-2018 Google, Inc. http://angularjs.org
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ## flutter_one_signal
2 | [](https://pub.dartlang.org/packages/flutter_one_signal)
3 |
4 |
5 | ### Update
6 | There's an official plugin available now [here](https://github.com/OneSignal/OneSignal-Flutter-SDK)
7 |
8 | ### Current Features
9 | Current features available:
10 |
11 | * Sign up for push notifications
12 | * Send a user tag
13 | * Set email
14 | * Logout email
15 | * Get user id
16 | * Set subscription
17 | * Handle notification receive/open events with notification as an input
18 | ### Android Setup
19 | Just follow these steps, and ignore all the native instructions from both Firebase and One Signal, a big chunk of that boilerplate code is handled by this plugin
20 |
21 | Create a One Signal, Firebase projects
22 |
23 | Open android/app/src/main/AndroidManifest.xml and copy package value
24 |
25 | Open Firebase console/Project Settings, add Android app and paste package copied before into Android package name
26 |
27 | Click Register app in the next step download google-services.json and paste in in android/app
28 |
29 | Now, add an Android app in One Signal using Server key and Sender ID from Firebase Project Settings/Cloud messaging
30 |
31 | Next, add this code to android/app/src/build.gradle, replacing APP_ID with your One Signal App ID
32 |
33 | ```gradle
34 | android {
35 | defaultConfig {
36 | ...
37 | manifestPlaceholders = [
38 | onesignal_app_id: 'APP_ID',
39 | onesignal_google_project_number: 'REMOTE'
40 | ]
41 | }
42 | }
43 | ```
44 | ### iOS Setup
45 | Open ios directory in Xcode and copy Bundle identifier
46 |
47 | Now open FIrebase console, add an iOS app for your project using that Bundle ID and download GoogleService-info.plist from the next step. Click continue for the next steps, just ignore them
48 |
49 | Open Xcode and paste GoogleService-info.plist into Runner directory, the one that has AppDelegate file in it
50 |
51 | It's important that you paste it using Xcode, if you use just a file explorer there will be some missing setting that I think Xcode does for you and your app won't work
52 |
53 | Now go to the General tab and make sure you have Automatically manage signing on and select your profile, this is going to save you from taking an extra step
54 |
55 | If you don't have an Apple developer profile - set it up first
56 |
57 | Next open Capabilities tab and turn Push Notifications on
58 |
59 | And Background Modes with Remote notifications checkbox
60 |
61 | Next, generate a .p12 file for your app using [this](https://onesignal.com/provisionator) tool, download it and keep the password
62 |
63 | Add iOS app is One Signal/Settings and upload .p12 file and the password that you get before
64 |
65 | ### Flutter Part
66 | To use this plugin, add `flutter_one_signal` as a [dependency in your pubspec.yaml file](https://flutter.io/platform-plugins/).
67 |
68 | And this code anywhere where you want to initialize One Signal push notifications in your app
69 |
70 | ```dart
71 | var notificationsPermissionGranted = await FlutterOneSignal.startInit(
72 | appId: 'ONE_SIGNAL_APP_ID',
73 | inFocusDisplaying: OSInFocusDisplayOption.InAppAlert,
74 | notificationReceivedHandler: (notification) {
75 | print('received : $notification');
76 | },
77 | notificationOpenedHandler: (notification) {
78 | print('opened : $notification');
79 | },
80 | unsubscribeWhenNotificationsAreDisabled: false,
81 | );
82 |
83 | print('Push notification permission granted $notificationsPermissionGranted');
84 |
85 | FlutterOneSignal.sendTag('userId', 'demoUserId');
86 |
87 | FlutterOneSignal.setEmail('email');
88 |
89 | FlutterOneSignal.logoutEmail();
90 |
91 | FlutterOneSignal.setSubscription(false);
92 |
93 | var userId = await FlutterOneSignal.getUserId();
94 | print("Received $userId");
95 | ```
96 |
97 | startInit method signs you up for notifications and you pass notificationReceivedHandler, notificationOpenedHandler just like in the native SDK's
98 |
99 | The only required attribute here is appId. inFocusDisplaying by default is InAppAlert, unsubscribeWhenNotificationsAreDisabled works only on Android, it's false by default
100 |
101 | You could've noticed that I have a duplicated way of declaring One Signal app id. This is due to a very different iOS/Android setup logic. So, for now, you have to include it in build.gradle file. In the next iterations, I'll try to get rid of this part
102 |
103 | On Android startInit returns Future of true instantaneously
104 |
105 | ### Notification Open Handler
106 | By default you have your home page opened when notification is clicked. This is not a behavior you'd want for a real app. To disable this behavior on Android add this code to android/app/src/main/AndroidManifest.xml
107 |
108 | ```xml
109 |
111 | ...
112 |
113 |
114 | ```
115 |
116 | And now you can open the screen you want in Flutter
117 | ```dart
118 | FlutterOneSignal.startInit(
119 | ...
120 | notificationOpenedHandler: (notification) {
121 | Navigator.of(context).pushNamed('somePage');
122 | },
123 | );
124 | ```
125 | I haven't figured out an iOS fix to disable the default open behavior. You can still use the Flutter logic, it's just that your initial page will appear before the intended one
126 |
127 | ### TODO
128 |
129 | - [ ] Privacy section
130 | - [ ] Post notification
131 |
132 |
--------------------------------------------------------------------------------
/android/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/workspace.xml
5 | /.idea/libraries
6 | .DS_Store
7 | /build
8 | /captures
9 |
--------------------------------------------------------------------------------
/android/.idea/codeStyles/Project.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/android/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/android/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/android/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/android/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/android/build.gradle:
--------------------------------------------------------------------------------
1 | group 'com.myhexaville.flutteronesignal'
2 | version '1.0-SNAPSHOT'
3 |
4 | buildscript {
5 | ext.kotlin_version = '1.1.51'
6 | repositories {
7 | google()
8 | jcenter()
9 | maven { url 'https://plugins.gradle.org/m2/'}
10 | }
11 |
12 | dependencies {
13 | classpath 'com.android.tools.build:gradle:3.0.1'
14 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
15 | classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.10.1, 0.99.99]'
16 | }
17 | }
18 |
19 | rootProject.allprojects {
20 | repositories {
21 | google()
22 | jcenter()
23 | maven { url 'https://maven.google.com' }
24 | }
25 | }
26 |
27 | apply plugin: 'com.android.library'
28 | apply plugin: 'kotlin-android'
29 | apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
30 |
31 | android {
32 | compileSdkVersion 27
33 |
34 | sourceSets {
35 | main.java.srcDirs += 'src/main/kotlin'
36 | }
37 | defaultConfig {
38 | minSdkVersion 16
39 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
40 | }
41 | lintOptions {
42 | disable 'InvalidPackage'
43 | }
44 | }
45 |
46 | dependencies {
47 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
48 | compile 'com.onesignal:OneSignal:[3.9.1, 3.99.99]'
49 | }
50 |
--------------------------------------------------------------------------------
/android/gradle.properties:
--------------------------------------------------------------------------------
1 | org.gradle.jvmargs=-Xmx1536M
2 |
--------------------------------------------------------------------------------
/android/settings.gradle:
--------------------------------------------------------------------------------
1 | rootProject.name = 'flutter_one_signal'
2 |
--------------------------------------------------------------------------------
/android/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
--------------------------------------------------------------------------------
/android/src/main/kotlin/com/myhexaville/flutteronesignal/FlutterOneSignalPlugin.kt:
--------------------------------------------------------------------------------
1 | package com.myhexaville.flutteronesignal
2 |
3 | import com.onesignal.*
4 | import io.flutter.plugin.common.MethodChannel
5 | import io.flutter.plugin.common.MethodChannel.MethodCallHandler
6 | import io.flutter.plugin.common.MethodChannel.Result
7 | import io.flutter.plugin.common.MethodCall
8 | import io.flutter.plugin.common.PluginRegistry.Registrar
9 | import io.flutter.plugin.common.EventChannel
10 |
11 | class FlutterOneSignalPlugin(private val registrar: Registrar)
12 | : MethodCallHandler, EventChannel.StreamHandler, OSSubscriptionObserver {
13 | private var sink: EventChannel.EventSink? = null
14 | private var result: Result? = null
15 |
16 | companion object {
17 | @JvmStatic
18 | fun registerWith(registrar: Registrar) {
19 | val methodsChannel = MethodChannel(registrar.messenger(), "flutter_one_signal/methods")
20 | val eventChannel = EventChannel(registrar.messenger(), "flutter_one_signal/events")
21 |
22 | val instance = FlutterOneSignalPlugin(registrar)
23 | methodsChannel.setMethodCallHandler(instance)
24 | eventChannel.setStreamHandler(instance)
25 | }
26 | }
27 |
28 | override fun onMethodCall(call: MethodCall, result: Result) {
29 | when (call.method) {
30 | "startInit" -> startInit(call, result)
31 | "sendTag" -> sendTag(call)
32 | "setEmail" -> setEmail(call)
33 | "logoutEmail" -> logoutEmail(call)
34 | "setSubscription" -> setSubscription(call)
35 | "getUserId" -> getUserId(call, result)
36 | else -> result.notImplemented()
37 | }
38 | }
39 |
40 | override fun onListen(p0: Any?, sink: EventChannel.EventSink?) {
41 | this.sink = sink
42 | }
43 |
44 | override fun onCancel(p0: Any?) {
45 | }
46 |
47 | private fun setSubscription(call: MethodCall) {
48 | val enable = call.argument("enable")
49 |
50 | OneSignal.setSubscription(enable)
51 | }
52 |
53 | private fun startInit(call: MethodCall, result: Result) {
54 | val inFocusDisplaying = parseInFocusDisplaying(call)
55 | val unsubscribeWhenNotificationsAreDisabled = parseUnsubscribeWhenNotificationsAreDisabled(call)
56 |
57 | OneSignal.startInit(registrar.context())
58 | .inFocusDisplaying(inFocusDisplaying)
59 | .setNotificationOpenedHandler { result ->
60 | sink?.success("opened:${result?.notification?.toJSONObject().toString()}")
61 | }
62 | .setNotificationReceivedHandler({ notification ->
63 | sink?.success("received:${notification.toJSONObject().toString()}")
64 | })
65 | .unsubscribeWhenNotificationsAreDisabled(unsubscribeWhenNotificationsAreDisabled)
66 | .init()
67 | result.success(true)
68 | }
69 |
70 | private fun sendTag(call: MethodCall) {
71 | val key = call.argument("key")
72 | val value = call.argument("value")
73 |
74 | OneSignal.sendTag(key, value)
75 | }
76 |
77 | private fun setEmail(call: MethodCall) {
78 | val email = call.argument("email")
79 | OneSignal.setEmail(email)
80 | }
81 |
82 | private fun logoutEmail(call: MethodCall) {
83 | OneSignal.logoutEmail()
84 | }
85 |
86 | private fun getUserId(call: MethodCall, result: Result) {
87 | val status = OneSignal.getPermissionSubscriptionState()
88 | val userId = status.subscriptionStatus.userId
89 | if (userId == null) {
90 | this.result = result
91 | OneSignal.addSubscriptionObserver(this)
92 | } else {
93 | result.success(status.subscriptionStatus.userId)
94 | }
95 | }
96 |
97 | private fun parseUnsubscribeWhenNotificationsAreDisabled(call: MethodCall): Boolean {
98 | return call.argument("unsubscribeWhenNotificationsAreDisabled").toBoolean()
99 | }
100 |
101 | private fun parseInFocusDisplaying(call: MethodCall): OneSignal.OSInFocusDisplayOption {
102 | val inFocusDisplaying = call.argument("inFocusDisplaying")
103 | return when (inFocusDisplaying) {
104 | "OSInFocusDisplayOption.InAppAlert" -> OneSignal.OSInFocusDisplayOption.InAppAlert
105 | "OSInFocusDisplayOption.Notification" -> OneSignal.OSInFocusDisplayOption.Notification
106 | else -> OneSignal.OSInFocusDisplayOption.None
107 | }
108 | }
109 |
110 | override fun onOSSubscriptionChanged(stateChanges: OSSubscriptionStateChanges?) {
111 | if (stateChanges?.to?.userId != null) {
112 | result?.success(stateChanges.to?.userId)
113 | OneSignal.removeSubscriptionObserver(this)
114 | }
115 | }
116 | }
117 |
--------------------------------------------------------------------------------
/example/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | .dart_tool/
3 |
4 | .packages
5 | .pub/
6 |
7 | build/
8 |
9 | .flutter-plugins
10 |
--------------------------------------------------------------------------------
/example/.idea/libraries/Dart_SDK.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/example/.idea/libraries/Flutter_for_Android.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/example/.idea/runConfigurations/main_dart.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/example/.idea/workspace.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 | 1527400141996
192 |
193 |
194 | 1527400141996
195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 |
206 |
207 |
208 |
209 |
210 |
211 |
212 |
213 |
214 |
215 |
216 |
217 |
218 |
219 |
220 |
221 |
222 |
223 |
224 |
225 |
226 |
227 |
228 |
229 |
230 |
231 |
232 |
233 |
234 |
235 |
236 |
237 |
238 |
239 |
240 |
241 |
242 |
243 |
244 |
245 |
246 |
247 |
248 |
249 |
250 |
251 |
--------------------------------------------------------------------------------
/example/.metadata:
--------------------------------------------------------------------------------
1 | # This file tracks properties of this Flutter project.
2 | # Used by Flutter tool to assess capabilities and perform upgrades etc.
3 | #
4 | # This file should be version controlled and should not be manually edited.
5 |
6 | version:
7 | revision: 6c03a3f96bf17c959867bc379f4306aae101e797
8 | channel: dev
9 |
--------------------------------------------------------------------------------
/example/README.md:
--------------------------------------------------------------------------------
1 | # flutter_one_signal_example
2 |
3 | Demonstrates how to use the flutter_one_signal plugin.
4 |
5 | ## Getting Started
6 |
7 | For help getting started with Flutter, view our online
8 | [documentation](https://flutter.io/).
9 |
--------------------------------------------------------------------------------
/example/android/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | *.class
3 | .gradle
4 | /local.properties
5 | /.idea/workspace.xml
6 | /.idea/libraries
7 | .DS_Store
8 | /build
9 | /captures
10 | GeneratedPluginRegistrant.java
11 |
--------------------------------------------------------------------------------
/example/android/.idea/codeStyles/Project.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/example/android/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/example/android/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/android/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/example/android/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/example/android/app/build.gradle:
--------------------------------------------------------------------------------
1 | def localProperties = new Properties()
2 | def localPropertiesFile = rootProject.file('local.properties')
3 | if (localPropertiesFile.exists()) {
4 | localPropertiesFile.withReader('UTF-8') { reader ->
5 | localProperties.load(reader)
6 | }
7 | }
8 |
9 | def flutterRoot = localProperties.getProperty('flutter.sdk')
10 | if (flutterRoot == null) {
11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
12 | }
13 |
14 | apply plugin: 'com.android.application'
15 | apply plugin: 'kotlin-android'
16 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
17 |
18 | android {
19 | compileSdkVersion 27
20 |
21 | sourceSets {
22 | main.java.srcDirs += 'src/main/kotlin'
23 | }
24 |
25 | lintOptions {
26 | disable 'InvalidPackage'
27 | }
28 |
29 | defaultConfig {
30 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
31 | applicationId "com.myhexaville.flutteronesignalexample"
32 | minSdkVersion 16
33 | targetSdkVersion 27
34 | versionCode 1
35 | versionName "1.0"
36 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
37 | manifestPlaceholders = [
38 | onesignal_app_id: '50c236d4-8355-451d-a140-3adf38b04c43',
39 | onesignal_google_project_number: 'REMOTE'
40 | ]
41 | }
42 |
43 | buildTypes {
44 | release {
45 | // TODO: Add your own signing config for the release build.
46 | // Signing with the debug keys for now, so `flutter run --release` works.
47 | signingConfig signingConfigs.debug
48 | }
49 | }
50 | }
51 |
52 | flutter {
53 | source '../..'
54 | }
55 |
56 | dependencies {
57 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
58 | testImplementation 'junit:junit:4.12'
59 | androidTestImplementation 'com.android.support.test:runner:1.0.2'
60 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
61 | }
62 |
--------------------------------------------------------------------------------
/example/android/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
8 |
9 |
10 |
15 |
19 |
20 |
21 |
22 |
23 |
24 |
31 |
35 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/example/android/app/src/main/kotlin/com/myhexaville/flutteronesignalexample/MainActivity.kt:
--------------------------------------------------------------------------------
1 | package com.myhexaville.flutteronesignalexample
2 |
3 | import android.os.Bundle
4 |
5 | import io.flutter.app.FlutterActivity
6 | import io.flutter.plugins.GeneratedPluginRegistrant
7 |
8 | class MainActivity(): FlutterActivity() {
9 | override fun onCreate(savedInstanceState: Bundle?) {
10 | super.onCreate(savedInstanceState)
11 | GeneratedPluginRegistrant.registerWith(this)
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/drawable-hdpi/ic_stat_onesignal_default.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IhorKlimov/Flutter-One-Signal/94765dabeea885eb831699de3fcc41019c0545f1/example/android/app/src/main/res/drawable-hdpi/ic_stat_onesignal_default.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/drawable-mdpi/ic_stat_onesignal_default.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IhorKlimov/Flutter-One-Signal/94765dabeea885eb831699de3fcc41019c0545f1/example/android/app/src/main/res/drawable-mdpi/ic_stat_onesignal_default.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/drawable-xhdpi/ic_stat_onesignal_default.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IhorKlimov/Flutter-One-Signal/94765dabeea885eb831699de3fcc41019c0545f1/example/android/app/src/main/res/drawable-xhdpi/ic_stat_onesignal_default.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/drawable-xxhdpi/ic_stat_onesignal_default.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IhorKlimov/Flutter-One-Signal/94765dabeea885eb831699de3fcc41019c0545f1/example/android/app/src/main/res/drawable-xxhdpi/ic_stat_onesignal_default.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/drawable-xxxhdpi/ic_stat_onesignal_default.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IhorKlimov/Flutter-One-Signal/94765dabeea885eb831699de3fcc41019c0545f1/example/android/app/src/main/res/drawable-xxxhdpi/ic_stat_onesignal_default.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/drawable/launch_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IhorKlimov/Flutter-One-Signal/94765dabeea885eb831699de3fcc41019c0545f1/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IhorKlimov/Flutter-One-Signal/94765dabeea885eb831699de3fcc41019c0545f1/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IhorKlimov/Flutter-One-Signal/94765dabeea885eb831699de3fcc41019c0545f1/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IhorKlimov/Flutter-One-Signal/94765dabeea885eb831699de3fcc41019c0545f1/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IhorKlimov/Flutter-One-Signal/94765dabeea885eb831699de3fcc41019c0545f1/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
--------------------------------------------------------------------------------
/example/android/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | ext.kotlin_version = '1.2.41'
3 | repositories {
4 | google()
5 | jcenter()
6 | }
7 |
8 | dependencies {
9 | classpath 'com.android.tools.build:gradle:3.1.3'
10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
11 | }
12 | }
13 |
14 | allprojects {
15 | repositories {
16 | google()
17 | jcenter()
18 | }
19 | }
20 |
21 | rootProject.buildDir = '../build'
22 | subprojects {
23 | project.buildDir = "${rootProject.buildDir}/${project.name}"
24 | }
25 | subprojects {
26 | project.evaluationDependsOn(':app')
27 | }
28 |
29 | task clean(type: Delete) {
30 | delete rootProject.buildDir
31 | }
32 |
--------------------------------------------------------------------------------
/example/android/gradle.properties:
--------------------------------------------------------------------------------
1 | org.gradle.jvmargs=-Xmx1536M
2 |
--------------------------------------------------------------------------------
/example/android/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IhorKlimov/Flutter-One-Signal/94765dabeea885eb831699de3fcc41019c0545f1/example/android/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/example/android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Sun May 27 08:49:44 EEST 2018
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
7 |
--------------------------------------------------------------------------------
/example/android/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # Attempt to set APP_HOME
46 | # Resolve links: $0 may be a link
47 | PRG="$0"
48 | # Need this for relative symlinks.
49 | while [ -h "$PRG" ] ; do
50 | ls=`ls -ld "$PRG"`
51 | link=`expr "$ls" : '.*-> \(.*\)$'`
52 | if expr "$link" : '/.*' > /dev/null; then
53 | PRG="$link"
54 | else
55 | PRG=`dirname "$PRG"`"/$link"
56 | fi
57 | done
58 | SAVED="`pwd`"
59 | cd "`dirname \"$PRG\"`/" >/dev/null
60 | APP_HOME="`pwd -P`"
61 | cd "$SAVED" >/dev/null
62 |
63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
64 |
65 | # Determine the Java command to use to start the JVM.
66 | if [ -n "$JAVA_HOME" ] ; then
67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
68 | # IBM's JDK on AIX uses strange locations for the executables
69 | JAVACMD="$JAVA_HOME/jre/sh/java"
70 | else
71 | JAVACMD="$JAVA_HOME/bin/java"
72 | fi
73 | if [ ! -x "$JAVACMD" ] ; then
74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
75 |
76 | Please set the JAVA_HOME variable in your environment to match the
77 | location of your Java installation."
78 | fi
79 | else
80 | JAVACMD="java"
81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
82 |
83 | Please set the JAVA_HOME variable in your environment to match the
84 | location of your Java installation."
85 | fi
86 |
87 | # Increase the maximum file descriptors if we can.
88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
89 | MAX_FD_LIMIT=`ulimit -H -n`
90 | if [ $? -eq 0 ] ; then
91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
92 | MAX_FD="$MAX_FD_LIMIT"
93 | fi
94 | ulimit -n $MAX_FD
95 | if [ $? -ne 0 ] ; then
96 | warn "Could not set maximum file descriptor limit: $MAX_FD"
97 | fi
98 | else
99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
100 | fi
101 | fi
102 |
103 | # For Darwin, add options to specify how the application appears in the dock
104 | if $darwin; then
105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
106 | fi
107 |
108 | # For Cygwin, switch paths to Windows format before running java
109 | if $cygwin ; then
110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
112 | JAVACMD=`cygpath --unix "$JAVACMD"`
113 |
114 | # We build the pattern for arguments to be converted via cygpath
115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
116 | SEP=""
117 | for dir in $ROOTDIRSRAW ; do
118 | ROOTDIRS="$ROOTDIRS$SEP$dir"
119 | SEP="|"
120 | done
121 | OURCYGPATTERN="(^($ROOTDIRS))"
122 | # Add a user-defined pattern to the cygpath arguments
123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
125 | fi
126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
127 | i=0
128 | for arg in "$@" ; do
129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
131 |
132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
134 | else
135 | eval `echo args$i`="\"$arg\""
136 | fi
137 | i=$((i+1))
138 | done
139 | case $i in
140 | (0) set -- ;;
141 | (1) set -- "$args0" ;;
142 | (2) set -- "$args0" "$args1" ;;
143 | (3) set -- "$args0" "$args1" "$args2" ;;
144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
150 | esac
151 | fi
152 |
153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
154 | function splitJvmOpts() {
155 | JVM_OPTS=("$@")
156 | }
157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
159 |
160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
161 |
--------------------------------------------------------------------------------
/example/android/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/example/android/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
3 | def flutterProjectRoot = rootProject.projectDir.parentFile.toPath()
4 |
5 | def plugins = new Properties()
6 | def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins')
7 | if (pluginsFile.exists()) {
8 | pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) }
9 | }
10 |
11 | plugins.each { name, path ->
12 | def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile()
13 | include ":$name"
14 | project(":$name").projectDir = pluginDirectory
15 | }
16 |
--------------------------------------------------------------------------------
/example/flutter_one_signal_example.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/example/flutter_one_signal_example_android.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/example/ios/.gitignore:
--------------------------------------------------------------------------------
1 | .idea/
2 | .vagrant/
3 | .sconsign.dblite
4 | .svn/
5 |
6 | .DS_Store
7 | *.swp
8 | profile
9 |
10 | DerivedData/
11 | build/
12 | GeneratedPluginRegistrant.h
13 | GeneratedPluginRegistrant.m
14 |
15 | .generated/
16 |
17 | *.pbxuser
18 | *.mode1v3
19 | *.mode2v3
20 | *.perspectivev3
21 |
22 | !default.pbxuser
23 | !default.mode1v3
24 | !default.mode2v3
25 | !default.perspectivev3
26 |
27 | xcuserdata
28 |
29 | *.moved-aside
30 |
31 | *.pyc
32 | *sync/
33 | Icon?
34 | .tags*
35 |
36 | /Flutter/app.flx
37 | /Flutter/app.zip
38 | /Flutter/flutter_assets/
39 | /Flutter/App.framework
40 | /Flutter/Flutter.framework
41 | /Flutter/Generated.xcconfig
42 | /ServiceDefinitions.json
43 |
44 | Pods/
45 | .symlinks/
46 |
--------------------------------------------------------------------------------
/example/ios/Flutter/AppFrameworkInfo.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | App
9 | CFBundleIdentifier
10 | io.flutter.flutter.app
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | App
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1.0
23 | MinimumOSVersion
24 | 8.0
25 |
26 |
27 |
--------------------------------------------------------------------------------
/example/ios/Flutter/Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
2 | #include "Generated.xcconfig"
3 |
--------------------------------------------------------------------------------
/example/ios/Flutter/Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
2 | #include "Generated.xcconfig"
3 |
--------------------------------------------------------------------------------
/example/ios/Podfile:
--------------------------------------------------------------------------------
1 | # Uncomment this line to define a global platform for your project
2 | # platform :ios, '9.0'
3 |
4 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency.
5 | ENV['COCOAPODS_DISABLE_STATS'] = 'true'
6 |
7 | def parse_KV_file(file, separator='=')
8 | file_abs_path = File.expand_path(file)
9 | if !File.exists? file_abs_path
10 | return [];
11 | end
12 | pods_ary = []
13 | skip_line_start_symbols = ["#", "/"]
14 | File.foreach(file_abs_path) { |line|
15 | next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ }
16 | plugin = line.split(pattern=separator)
17 | if plugin.length == 2
18 | podname = plugin[0].strip()
19 | path = plugin[1].strip()
20 | podpath = File.expand_path("#{path}", file_abs_path)
21 | pods_ary.push({:name => podname, :path => podpath});
22 | else
23 | puts "Invalid plugin specification: #{line}"
24 | end
25 | }
26 | return pods_ary
27 | end
28 |
29 | target 'Runner' do
30 | use_frameworks!
31 |
32 | # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
33 | # referring to absolute paths on developers' machines.
34 | system('rm -rf .symlinks')
35 | system('mkdir -p .symlinks/plugins')
36 |
37 | # Flutter Pods
38 | generated_xcode_build_settings = parse_KV_file('./Flutter/Generated.xcconfig')
39 | if generated_xcode_build_settings.empty?
40 | puts "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter packages get is executed first."
41 | end
42 | generated_xcode_build_settings.map { |p|
43 | if p[:name] == 'FLUTTER_FRAMEWORK_DIR'
44 | symlink = File.join('.symlinks', 'flutter')
45 | File.symlink(File.dirname(p[:path]), symlink)
46 | pod 'Flutter', :path => File.join(symlink, File.basename(p[:path]))
47 | end
48 | }
49 |
50 | # Plugin Pods
51 | plugin_pods = parse_KV_file('../.flutter-plugins')
52 | plugin_pods.map { |p|
53 | symlink = File.join('.symlinks', 'plugins', p[:name])
54 | File.symlink(p[:path], symlink)
55 | pod p[:name], :path => File.join(symlink, 'ios')
56 | }
57 | end
58 |
59 | post_install do |installer|
60 | installer.pods_project.targets.each do |target|
61 | target.build_configurations.each do |config|
62 | config.build_settings['ENABLE_BITCODE'] = 'NO'
63 | end
64 | end
65 | end
66 |
--------------------------------------------------------------------------------
/example/ios/Podfile.lock:
--------------------------------------------------------------------------------
1 | PODS:
2 | - Flutter (1.0.0)
3 | - flutter_one_signal (0.0.1):
4 | - Flutter
5 | - OneSignal
6 | - OneSignal (2.8.5)
7 |
8 | DEPENDENCIES:
9 | - Flutter (from `.symlinks/flutter/ios`)
10 | - flutter_one_signal (from `.symlinks/plugins/flutter_one_signal/ios`)
11 |
12 | SPEC REPOS:
13 | https://github.com/cocoapods/specs.git:
14 | - OneSignal
15 |
16 | EXTERNAL SOURCES:
17 | Flutter:
18 | :path: ".symlinks/flutter/ios"
19 | flutter_one_signal:
20 | :path: ".symlinks/plugins/flutter_one_signal/ios"
21 |
22 | SPEC CHECKSUMS:
23 | Flutter: 9d0fac939486c9aba2809b7982dfdbb47a7b0296
24 | flutter_one_signal: ba6cefce3c435bf723862b2e2168bea186682723
25 | OneSignal: 42dae269c7eca517aee34963820e1eb922390031
26 |
27 | PODFILE CHECKSUM: 7765ea4305eaab0b3dfd384c7de11902aa3195fd
28 |
29 | COCOAPODS: 1.5.2
30 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
11 | 2D5378261FAA1A9400D5DBA9 /* flutter_assets in Resources */ = {isa = PBXBuildFile; fileRef = 2D5378251FAA1A9400D5DBA9 /* flutter_assets */; };
12 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
13 | 3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; };
14 | 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
15 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; };
16 | 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; };
17 | 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
18 | 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB21CF90195004384FC /* Debug.xcconfig */; };
19 | 9740EEB51CF90195004384FC /* Generated.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB31CF90195004384FC /* Generated.xcconfig */; };
20 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
21 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
22 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
23 | AE03C9F69DCD468709A28D06 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D547F6403B2EBFB4BE0B0F75 /* Pods_Runner.framework */; };
24 | /* End PBXBuildFile section */
25 |
26 | /* Begin PBXCopyFilesBuildPhase section */
27 | 9705A1C41CF9048500538489 /* Embed Frameworks */ = {
28 | isa = PBXCopyFilesBuildPhase;
29 | buildActionMask = 2147483647;
30 | dstPath = "";
31 | dstSubfolderSpec = 10;
32 | files = (
33 | 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */,
34 | 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */,
35 | );
36 | name = "Embed Frameworks";
37 | runOnlyForDeploymentPostprocessing = 0;
38 | };
39 | /* End PBXCopyFilesBuildPhase section */
40 |
41 | /* Begin PBXFileReference section */
42 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; };
43 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; };
44 | 2D5378251FAA1A9400D5DBA9 /* flutter_assets */ = {isa = PBXFileReference; lastKnownFileType = folder; name = flutter_assets; path = Flutter/flutter_assets; sourceTree = SOURCE_ROOT; };
45 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; };
46 | 3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = ""; };
47 | 5885768020CCE87800CB1839 /* Runner.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Runner.entitlements; sourceTree = ""; };
48 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; };
49 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; };
50 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; };
51 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; };
52 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; };
53 | 9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = ""; };
54 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; };
55 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; };
56 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
57 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; };
58 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
59 | D547F6403B2EBFB4BE0B0F75 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
60 | /* End PBXFileReference section */
61 |
62 | /* Begin PBXFrameworksBuildPhase section */
63 | 97C146EB1CF9000F007C117D /* Frameworks */ = {
64 | isa = PBXFrameworksBuildPhase;
65 | buildActionMask = 2147483647;
66 | files = (
67 | 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */,
68 | 3B80C3941E831B6300D905FE /* App.framework in Frameworks */,
69 | AE03C9F69DCD468709A28D06 /* Pods_Runner.framework in Frameworks */,
70 | );
71 | runOnlyForDeploymentPostprocessing = 0;
72 | };
73 | /* End PBXFrameworksBuildPhase section */
74 |
75 | /* Begin PBXGroup section */
76 | 15BA0243FDE338AEC620387D /* Pods */ = {
77 | isa = PBXGroup;
78 | children = (
79 | );
80 | name = Pods;
81 | sourceTree = "";
82 | };
83 | 63A2408A1A5396406293B431 /* Frameworks */ = {
84 | isa = PBXGroup;
85 | children = (
86 | D547F6403B2EBFB4BE0B0F75 /* Pods_Runner.framework */,
87 | );
88 | name = Frameworks;
89 | sourceTree = "";
90 | };
91 | 9740EEB11CF90186004384FC /* Flutter */ = {
92 | isa = PBXGroup;
93 | children = (
94 | 2D5378251FAA1A9400D5DBA9 /* flutter_assets */,
95 | 3B80C3931E831B6300D905FE /* App.framework */,
96 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */,
97 | 9740EEBA1CF902C7004384FC /* Flutter.framework */,
98 | 9740EEB21CF90195004384FC /* Debug.xcconfig */,
99 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */,
100 | 9740EEB31CF90195004384FC /* Generated.xcconfig */,
101 | );
102 | name = Flutter;
103 | sourceTree = "";
104 | };
105 | 97C146E51CF9000F007C117D = {
106 | isa = PBXGroup;
107 | children = (
108 | 9740EEB11CF90186004384FC /* Flutter */,
109 | 97C146F01CF9000F007C117D /* Runner */,
110 | 97C146EF1CF9000F007C117D /* Products */,
111 | 15BA0243FDE338AEC620387D /* Pods */,
112 | 63A2408A1A5396406293B431 /* Frameworks */,
113 | );
114 | sourceTree = "";
115 | };
116 | 97C146EF1CF9000F007C117D /* Products */ = {
117 | isa = PBXGroup;
118 | children = (
119 | 97C146EE1CF9000F007C117D /* Runner.app */,
120 | );
121 | name = Products;
122 | sourceTree = "";
123 | };
124 | 97C146F01CF9000F007C117D /* Runner */ = {
125 | isa = PBXGroup;
126 | children = (
127 | 5885768020CCE87800CB1839 /* Runner.entitlements */,
128 | 97C146FA1CF9000F007C117D /* Main.storyboard */,
129 | 97C146FD1CF9000F007C117D /* Assets.xcassets */,
130 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */,
131 | 97C147021CF9000F007C117D /* Info.plist */,
132 | 97C146F11CF9000F007C117D /* Supporting Files */,
133 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */,
134 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */,
135 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */,
136 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */,
137 | );
138 | path = Runner;
139 | sourceTree = "";
140 | };
141 | 97C146F11CF9000F007C117D /* Supporting Files */ = {
142 | isa = PBXGroup;
143 | children = (
144 | );
145 | name = "Supporting Files";
146 | sourceTree = "";
147 | };
148 | /* End PBXGroup section */
149 |
150 | /* Begin PBXNativeTarget section */
151 | 97C146ED1CF9000F007C117D /* Runner */ = {
152 | isa = PBXNativeTarget;
153 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
154 | buildPhases = (
155 | 3F01A10CA91BCDCB12FBE5C8 /* [CP] Check Pods Manifest.lock */,
156 | 9740EEB61CF901F6004384FC /* Run Script */,
157 | 97C146EA1CF9000F007C117D /* Sources */,
158 | 97C146EB1CF9000F007C117D /* Frameworks */,
159 | 97C146EC1CF9000F007C117D /* Resources */,
160 | 9705A1C41CF9048500538489 /* Embed Frameworks */,
161 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */,
162 | 1EFA3D812AA0AFF7583495DE /* [CP] Embed Pods Frameworks */,
163 | );
164 | buildRules = (
165 | );
166 | dependencies = (
167 | );
168 | name = Runner;
169 | productName = Runner;
170 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */;
171 | productType = "com.apple.product-type.application";
172 | };
173 | /* End PBXNativeTarget section */
174 |
175 | /* Begin PBXProject section */
176 | 97C146E61CF9000F007C117D /* Project object */ = {
177 | isa = PBXProject;
178 | attributes = {
179 | LastUpgradeCheck = 0910;
180 | ORGANIZATIONNAME = "The Chromium Authors";
181 | TargetAttributes = {
182 | 97C146ED1CF9000F007C117D = {
183 | CreatedOnToolsVersion = 7.3.1;
184 | DevelopmentTeam = 9JHGLN7WTV;
185 | LastSwiftMigration = 0910;
186 | SystemCapabilities = {
187 | com.apple.BackgroundModes = {
188 | enabled = 1;
189 | };
190 | com.apple.Push = {
191 | enabled = 1;
192 | };
193 | };
194 | };
195 | };
196 | };
197 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */;
198 | compatibilityVersion = "Xcode 3.2";
199 | developmentRegion = English;
200 | hasScannedForEncodings = 0;
201 | knownRegions = (
202 | en,
203 | Base,
204 | );
205 | mainGroup = 97C146E51CF9000F007C117D;
206 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */;
207 | projectDirPath = "";
208 | projectRoot = "";
209 | targets = (
210 | 97C146ED1CF9000F007C117D /* Runner */,
211 | );
212 | };
213 | /* End PBXProject section */
214 |
215 | /* Begin PBXResourcesBuildPhase section */
216 | 97C146EC1CF9000F007C117D /* Resources */ = {
217 | isa = PBXResourcesBuildPhase;
218 | buildActionMask = 2147483647;
219 | files = (
220 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */,
221 | 9740EEB51CF90195004384FC /* Generated.xcconfig in Resources */,
222 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,
223 | 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */,
224 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */,
225 | 2D5378261FAA1A9400D5DBA9 /* flutter_assets in Resources */,
226 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */,
227 | );
228 | runOnlyForDeploymentPostprocessing = 0;
229 | };
230 | /* End PBXResourcesBuildPhase section */
231 |
232 | /* Begin PBXShellScriptBuildPhase section */
233 | 1EFA3D812AA0AFF7583495DE /* [CP] Embed Pods Frameworks */ = {
234 | isa = PBXShellScriptBuildPhase;
235 | buildActionMask = 2147483647;
236 | files = (
237 | );
238 | inputPaths = (
239 | "${SRCROOT}/Pods/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh",
240 | "${PODS_ROOT}/../.symlinks/flutter/ios/Flutter.framework",
241 | );
242 | name = "[CP] Embed Pods Frameworks";
243 | outputPaths = (
244 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Flutter.framework",
245 | );
246 | runOnlyForDeploymentPostprocessing = 0;
247 | shellPath = /bin/sh;
248 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
249 | showEnvVarsInLog = 0;
250 | };
251 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
252 | isa = PBXShellScriptBuildPhase;
253 | buildActionMask = 2147483647;
254 | files = (
255 | );
256 | inputPaths = (
257 | );
258 | name = "Thin Binary";
259 | outputPaths = (
260 | );
261 | runOnlyForDeploymentPostprocessing = 0;
262 | shellPath = /bin/sh;
263 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin";
264 | };
265 | 3F01A10CA91BCDCB12FBE5C8 /* [CP] Check Pods Manifest.lock */ = {
266 | isa = PBXShellScriptBuildPhase;
267 | buildActionMask = 2147483647;
268 | files = (
269 | );
270 | inputPaths = (
271 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock",
272 | "${PODS_ROOT}/Manifest.lock",
273 | );
274 | name = "[CP] Check Pods Manifest.lock";
275 | outputPaths = (
276 | "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt",
277 | );
278 | runOnlyForDeploymentPostprocessing = 0;
279 | shellPath = /bin/sh;
280 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
281 | showEnvVarsInLog = 0;
282 | };
283 | 9740EEB61CF901F6004384FC /* Run Script */ = {
284 | isa = PBXShellScriptBuildPhase;
285 | buildActionMask = 2147483647;
286 | files = (
287 | );
288 | inputPaths = (
289 | );
290 | name = "Run Script";
291 | outputPaths = (
292 | );
293 | runOnlyForDeploymentPostprocessing = 0;
294 | shellPath = /bin/sh;
295 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
296 | };
297 | /* End PBXShellScriptBuildPhase section */
298 |
299 | /* Begin PBXSourcesBuildPhase section */
300 | 97C146EA1CF9000F007C117D /* Sources */ = {
301 | isa = PBXSourcesBuildPhase;
302 | buildActionMask = 2147483647;
303 | files = (
304 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */,
305 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */,
306 | );
307 | runOnlyForDeploymentPostprocessing = 0;
308 | };
309 | /* End PBXSourcesBuildPhase section */
310 |
311 | /* Begin PBXVariantGroup section */
312 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = {
313 | isa = PBXVariantGroup;
314 | children = (
315 | 97C146FB1CF9000F007C117D /* Base */,
316 | );
317 | name = Main.storyboard;
318 | sourceTree = "";
319 | };
320 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = {
321 | isa = PBXVariantGroup;
322 | children = (
323 | 97C147001CF9000F007C117D /* Base */,
324 | );
325 | name = LaunchScreen.storyboard;
326 | sourceTree = "";
327 | };
328 | /* End PBXVariantGroup section */
329 |
330 | /* Begin XCBuildConfiguration section */
331 | 97C147031CF9000F007C117D /* Debug */ = {
332 | isa = XCBuildConfiguration;
333 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
334 | buildSettings = {
335 | ALWAYS_SEARCH_USER_PATHS = NO;
336 | CLANG_ANALYZER_NONNULL = YES;
337 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
338 | CLANG_CXX_LIBRARY = "libc++";
339 | CLANG_ENABLE_MODULES = YES;
340 | CLANG_ENABLE_OBJC_ARC = YES;
341 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
342 | CLANG_WARN_BOOL_CONVERSION = YES;
343 | CLANG_WARN_COMMA = YES;
344 | CLANG_WARN_CONSTANT_CONVERSION = YES;
345 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
346 | CLANG_WARN_EMPTY_BODY = YES;
347 | CLANG_WARN_ENUM_CONVERSION = YES;
348 | CLANG_WARN_INFINITE_RECURSION = YES;
349 | CLANG_WARN_INT_CONVERSION = YES;
350 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
351 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
352 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
353 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
354 | CLANG_WARN_STRICT_PROTOTYPES = YES;
355 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
356 | CLANG_WARN_UNREACHABLE_CODE = YES;
357 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
358 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
359 | COPY_PHASE_STRIP = NO;
360 | DEBUG_INFORMATION_FORMAT = dwarf;
361 | ENABLE_STRICT_OBJC_MSGSEND = YES;
362 | ENABLE_TESTABILITY = YES;
363 | GCC_C_LANGUAGE_STANDARD = gnu99;
364 | GCC_DYNAMIC_NO_PIC = NO;
365 | GCC_NO_COMMON_BLOCKS = YES;
366 | GCC_OPTIMIZATION_LEVEL = 0;
367 | GCC_PREPROCESSOR_DEFINITIONS = (
368 | "DEBUG=1",
369 | "$(inherited)",
370 | );
371 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
372 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
373 | GCC_WARN_UNDECLARED_SELECTOR = YES;
374 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
375 | GCC_WARN_UNUSED_FUNCTION = YES;
376 | GCC_WARN_UNUSED_VARIABLE = YES;
377 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
378 | MTL_ENABLE_DEBUG_INFO = YES;
379 | ONLY_ACTIVE_ARCH = YES;
380 | SDKROOT = iphoneos;
381 | TARGETED_DEVICE_FAMILY = "1,2";
382 | };
383 | name = Debug;
384 | };
385 | 97C147041CF9000F007C117D /* Release */ = {
386 | isa = XCBuildConfiguration;
387 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
388 | buildSettings = {
389 | ALWAYS_SEARCH_USER_PATHS = NO;
390 | CLANG_ANALYZER_NONNULL = YES;
391 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
392 | CLANG_CXX_LIBRARY = "libc++";
393 | CLANG_ENABLE_MODULES = YES;
394 | CLANG_ENABLE_OBJC_ARC = YES;
395 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
396 | CLANG_WARN_BOOL_CONVERSION = YES;
397 | CLANG_WARN_COMMA = YES;
398 | CLANG_WARN_CONSTANT_CONVERSION = YES;
399 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
400 | CLANG_WARN_EMPTY_BODY = YES;
401 | CLANG_WARN_ENUM_CONVERSION = YES;
402 | CLANG_WARN_INFINITE_RECURSION = YES;
403 | CLANG_WARN_INT_CONVERSION = YES;
404 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
405 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
406 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
407 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
408 | CLANG_WARN_STRICT_PROTOTYPES = YES;
409 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
410 | CLANG_WARN_UNREACHABLE_CODE = YES;
411 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
412 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
413 | COPY_PHASE_STRIP = NO;
414 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
415 | ENABLE_NS_ASSERTIONS = NO;
416 | ENABLE_STRICT_OBJC_MSGSEND = YES;
417 | GCC_C_LANGUAGE_STANDARD = gnu99;
418 | GCC_NO_COMMON_BLOCKS = YES;
419 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
420 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
421 | GCC_WARN_UNDECLARED_SELECTOR = YES;
422 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
423 | GCC_WARN_UNUSED_FUNCTION = YES;
424 | GCC_WARN_UNUSED_VARIABLE = YES;
425 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
426 | MTL_ENABLE_DEBUG_INFO = NO;
427 | SDKROOT = iphoneos;
428 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
429 | TARGETED_DEVICE_FAMILY = "1,2";
430 | VALIDATE_PRODUCT = YES;
431 | };
432 | name = Release;
433 | };
434 | 97C147061CF9000F007C117D /* Debug */ = {
435 | isa = XCBuildConfiguration;
436 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
437 | buildSettings = {
438 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
439 | CLANG_ENABLE_MODULES = YES;
440 | CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
441 | CURRENT_PROJECT_VERSION = 1;
442 | DEVELOPMENT_TEAM = 9JHGLN7WTV;
443 | ENABLE_BITCODE = NO;
444 | FRAMEWORK_SEARCH_PATHS = (
445 | "$(inherited)",
446 | "$(PROJECT_DIR)/Flutter",
447 | );
448 | INFOPLIST_FILE = Runner/Info.plist;
449 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
450 | LIBRARY_SEARCH_PATHS = (
451 | "$(inherited)",
452 | "$(PROJECT_DIR)/Flutter",
453 | );
454 | PRODUCT_BUNDLE_IDENTIFIER = com.myhexaville.flutterOneSignalExample;
455 | PRODUCT_NAME = "$(TARGET_NAME)";
456 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
457 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
458 | SWIFT_SWIFT3_OBJC_INFERENCE = On;
459 | SWIFT_VERSION = 4.0;
460 | VERSIONING_SYSTEM = "apple-generic";
461 | };
462 | name = Debug;
463 | };
464 | 97C147071CF9000F007C117D /* Release */ = {
465 | isa = XCBuildConfiguration;
466 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
467 | buildSettings = {
468 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
469 | CLANG_ENABLE_MODULES = YES;
470 | CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
471 | CURRENT_PROJECT_VERSION = 1;
472 | DEVELOPMENT_TEAM = 9JHGLN7WTV;
473 | ENABLE_BITCODE = NO;
474 | FRAMEWORK_SEARCH_PATHS = (
475 | "$(inherited)",
476 | "$(PROJECT_DIR)/Flutter",
477 | );
478 | INFOPLIST_FILE = Runner/Info.plist;
479 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
480 | LIBRARY_SEARCH_PATHS = (
481 | "$(inherited)",
482 | "$(PROJECT_DIR)/Flutter",
483 | );
484 | PRODUCT_BUNDLE_IDENTIFIER = com.myhexaville.flutterOneSignalExample;
485 | PRODUCT_NAME = "$(TARGET_NAME)";
486 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
487 | SWIFT_SWIFT3_OBJC_INFERENCE = On;
488 | SWIFT_VERSION = 4.0;
489 | VERSIONING_SYSTEM = "apple-generic";
490 | };
491 | name = Release;
492 | };
493 | /* End XCBuildConfiguration section */
494 |
495 | /* Begin XCConfigurationList section */
496 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = {
497 | isa = XCConfigurationList;
498 | buildConfigurations = (
499 | 97C147031CF9000F007C117D /* Debug */,
500 | 97C147041CF9000F007C117D /* Release */,
501 | );
502 | defaultConfigurationIsVisible = 0;
503 | defaultConfigurationName = Release;
504 | };
505 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = {
506 | isa = XCConfigurationList;
507 | buildConfigurations = (
508 | 97C147061CF9000F007C117D /* Debug */,
509 | 97C147071CF9000F007C117D /* Release */,
510 | );
511 | defaultConfigurationIsVisible = 0;
512 | defaultConfigurationName = Release;
513 | };
514 | /* End XCConfigurationList section */
515 | };
516 | rootObject = 97C146E61CF9000F007C117D /* Project object */;
517 | }
518 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
31 |
32 |
33 |
34 |
40 |
41 |
42 |
43 |
44 |
45 |
56 |
58 |
64 |
65 |
66 |
67 |
68 |
69 |
75 |
77 |
83 |
84 |
85 |
86 |
88 |
89 |
92 |
93 |
94 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/ios/Runner/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | import UIKit
2 | import Flutter
3 |
4 | @UIApplicationMain
5 | @objc class AppDelegate: FlutterAppDelegate {
6 | override func application(
7 | _ application: UIApplication,
8 | didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?
9 | ) -> Bool {
10 | GeneratedPluginRegistrant.register(with: self)
11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions)
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "size" : "20x20",
5 | "idiom" : "iphone",
6 | "filename" : "Icon-App-20x20@2x.png",
7 | "scale" : "2x"
8 | },
9 | {
10 | "size" : "20x20",
11 | "idiom" : "iphone",
12 | "filename" : "Icon-App-20x20@3x.png",
13 | "scale" : "3x"
14 | },
15 | {
16 | "size" : "29x29",
17 | "idiom" : "iphone",
18 | "filename" : "Icon-App-29x29@1x.png",
19 | "scale" : "1x"
20 | },
21 | {
22 | "size" : "29x29",
23 | "idiom" : "iphone",
24 | "filename" : "Icon-App-29x29@2x.png",
25 | "scale" : "2x"
26 | },
27 | {
28 | "size" : "29x29",
29 | "idiom" : "iphone",
30 | "filename" : "Icon-App-29x29@3x.png",
31 | "scale" : "3x"
32 | },
33 | {
34 | "size" : "40x40",
35 | "idiom" : "iphone",
36 | "filename" : "Icon-App-40x40@2x.png",
37 | "scale" : "2x"
38 | },
39 | {
40 | "size" : "40x40",
41 | "idiom" : "iphone",
42 | "filename" : "Icon-App-40x40@3x.png",
43 | "scale" : "3x"
44 | },
45 | {
46 | "size" : "60x60",
47 | "idiom" : "iphone",
48 | "filename" : "Icon-App-60x60@2x.png",
49 | "scale" : "2x"
50 | },
51 | {
52 | "size" : "60x60",
53 | "idiom" : "iphone",
54 | "filename" : "Icon-App-60x60@3x.png",
55 | "scale" : "3x"
56 | },
57 | {
58 | "size" : "20x20",
59 | "idiom" : "ipad",
60 | "filename" : "Icon-App-20x20@1x.png",
61 | "scale" : "1x"
62 | },
63 | {
64 | "size" : "20x20",
65 | "idiom" : "ipad",
66 | "filename" : "Icon-App-20x20@2x.png",
67 | "scale" : "2x"
68 | },
69 | {
70 | "size" : "29x29",
71 | "idiom" : "ipad",
72 | "filename" : "Icon-App-29x29@1x.png",
73 | "scale" : "1x"
74 | },
75 | {
76 | "size" : "29x29",
77 | "idiom" : "ipad",
78 | "filename" : "Icon-App-29x29@2x.png",
79 | "scale" : "2x"
80 | },
81 | {
82 | "size" : "40x40",
83 | "idiom" : "ipad",
84 | "filename" : "Icon-App-40x40@1x.png",
85 | "scale" : "1x"
86 | },
87 | {
88 | "size" : "40x40",
89 | "idiom" : "ipad",
90 | "filename" : "Icon-App-40x40@2x.png",
91 | "scale" : "2x"
92 | },
93 | {
94 | "size" : "76x76",
95 | "idiom" : "ipad",
96 | "filename" : "Icon-App-76x76@1x.png",
97 | "scale" : "1x"
98 | },
99 | {
100 | "size" : "76x76",
101 | "idiom" : "ipad",
102 | "filename" : "Icon-App-76x76@2x.png",
103 | "scale" : "2x"
104 | },
105 | {
106 | "size" : "83.5x83.5",
107 | "idiom" : "ipad",
108 | "filename" : "Icon-App-83.5x83.5@2x.png",
109 | "scale" : "2x"
110 | },
111 | {
112 | "size" : "1024x1024",
113 | "idiom" : "ios-marketing",
114 | "filename" : "Icon-App-1024x1024@1x.png",
115 | "scale" : "1x"
116 | }
117 | ],
118 | "info" : {
119 | "version" : 1,
120 | "author" : "xcode"
121 | }
122 | }
123 |
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IhorKlimov/Flutter-One-Signal/94765dabeea885eb831699de3fcc41019c0545f1/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IhorKlimov/Flutter-One-Signal/94765dabeea885eb831699de3fcc41019c0545f1/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IhorKlimov/Flutter-One-Signal/94765dabeea885eb831699de3fcc41019c0545f1/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IhorKlimov/Flutter-One-Signal/94765dabeea885eb831699de3fcc41019c0545f1/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IhorKlimov/Flutter-One-Signal/94765dabeea885eb831699de3fcc41019c0545f1/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IhorKlimov/Flutter-One-Signal/94765dabeea885eb831699de3fcc41019c0545f1/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IhorKlimov/Flutter-One-Signal/94765dabeea885eb831699de3fcc41019c0545f1/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IhorKlimov/Flutter-One-Signal/94765dabeea885eb831699de3fcc41019c0545f1/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IhorKlimov/Flutter-One-Signal/94765dabeea885eb831699de3fcc41019c0545f1/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IhorKlimov/Flutter-One-Signal/94765dabeea885eb831699de3fcc41019c0545f1/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IhorKlimov/Flutter-One-Signal/94765dabeea885eb831699de3fcc41019c0545f1/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IhorKlimov/Flutter-One-Signal/94765dabeea885eb831699de3fcc41019c0545f1/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IhorKlimov/Flutter-One-Signal/94765dabeea885eb831699de3fcc41019c0545f1/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IhorKlimov/Flutter-One-Signal/94765dabeea885eb831699de3fcc41019c0545f1/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IhorKlimov/Flutter-One-Signal/94765dabeea885eb831699de3fcc41019c0545f1/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "LaunchImage.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "filename" : "LaunchImage@2x.png",
11 | "scale" : "2x"
12 | },
13 | {
14 | "idiom" : "universal",
15 | "filename" : "LaunchImage@3x.png",
16 | "scale" : "3x"
17 | }
18 | ],
19 | "info" : {
20 | "version" : 1,
21 | "author" : "xcode"
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IhorKlimov/Flutter-One-Signal/94765dabeea885eb831699de3fcc41019c0545f1/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IhorKlimov/Flutter-One-Signal/94765dabeea885eb831699de3fcc41019c0545f1/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IhorKlimov/Flutter-One-Signal/94765dabeea885eb831699de3fcc41019c0545f1/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md:
--------------------------------------------------------------------------------
1 | # Launch Screen Assets
2 |
3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory.
4 |
5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images.
--------------------------------------------------------------------------------
/example/ios/Runner/Base.lproj/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/example/ios/Runner/Base.lproj/Main.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/example/ios/Runner/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | flutter_one_signal_example
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 | LSRequiresIPhoneOS
24 |
25 | UIBackgroundModes
26 |
27 | remote-notification
28 |
29 | UILaunchStoryboardName
30 | LaunchScreen
31 | UIMainStoryboardFile
32 | Main
33 | UISupportedInterfaceOrientations
34 |
35 | UIInterfaceOrientationPortrait
36 | UIInterfaceOrientationLandscapeLeft
37 | UIInterfaceOrientationLandscapeRight
38 |
39 | UISupportedInterfaceOrientations~ipad
40 |
41 | UIInterfaceOrientationPortrait
42 | UIInterfaceOrientationPortraitUpsideDown
43 | UIInterfaceOrientationLandscapeLeft
44 | UIInterfaceOrientationLandscapeRight
45 |
46 | UIViewControllerBasedStatusBarAppearance
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/example/ios/Runner/Runner-Bridging-Header.h:
--------------------------------------------------------------------------------
1 | #import "GeneratedPluginRegistrant.h"
--------------------------------------------------------------------------------
/example/ios/Runner/Runner.entitlements:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | aps-environment
6 | development
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/lib/main.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_one_signal/flutter_one_signal.dart';
3 |
4 | void main() => runApp(MyApp());
5 |
6 | class MyApp extends StatelessWidget {
7 | @override
8 | Widget build(BuildContext context) {
9 | return MaterialApp(
10 | title: 'Flutter Demo',
11 | theme: ThemeData(
12 | primarySwatch: Colors.blue,
13 | ),
14 | home: Home(title: 'Flutter One Signal'),
15 | routes: {
16 | 'pageTwo': (context) => PageTwo(title: 'Page Two'),
17 | },
18 | );
19 | }
20 | }
21 |
22 | class Home extends StatefulWidget {
23 | final String title;
24 |
25 | Home({Key key, this.title}) : super(key: key);
26 |
27 | @override
28 | _HomeState createState() => new _HomeState();
29 | }
30 |
31 | class _HomeState extends State {
32 | static const String DEFAULT_APP_ID = '50c236d4-8355-451d-a140-3adf38b04c43';
33 | static const String TEST_APP_ID = '5e92b9ef-1336-4ca8-8357-7c8e3dd92e9c';
34 |
35 | @override
36 | void initState() {
37 | super.initState();
38 | _initOneSignal();
39 | }
40 |
41 | @override
42 | Widget build(BuildContext context) {
43 | return Scaffold(
44 | appBar: AppBar(
45 | title: Text(widget.title),
46 | ),
47 | body: Column(
48 | mainAxisAlignment: MainAxisAlignment.center,
49 | children: [
50 | Align(
51 | alignment: Alignment.center,
52 | child: RaisedButton(
53 | onPressed: _unsubscribe,
54 | child: Text('Unsubscrbe'),
55 | ),
56 | ),
57 | SizedBox(height: 16.0),
58 | Align(
59 | alignment: Alignment.center,
60 | child: RaisedButton(
61 | onPressed: _logoutEmail,
62 | child: Text('Logout email'),
63 | ),
64 | )
65 | ],
66 | ),
67 | );
68 | }
69 |
70 | _initOneSignal() async {
71 | var notificationsPermissionGranted = await FlutterOneSignal.startInit(
72 | appId: DEFAULT_APP_ID,
73 | // todo Replace with your own, this won't work for you
74 | notificationOpenedHandler: (notification) {
75 | print('opened notification: $notification');
76 | Navigator.of(context).pushNamed('pageTwo');
77 | },
78 | notificationReceivedHandler: (notification) {
79 | print('received notification: $notification');
80 | });
81 | print(
82 | 'Push notification permission granted $notificationsPermissionGranted');
83 |
84 | FlutterOneSignal.sendTag('userId', 'demoUserId');
85 |
86 | // FlutterOneSignal.setEmail('name@email.com');
87 |
88 | var userId = await FlutterOneSignal.getUserId();
89 | print("User id : $userId");
90 | }
91 |
92 | _logoutEmail() {
93 | FlutterOneSignal.logoutEmail();
94 | }
95 |
96 | _unsubscribe() {
97 | FlutterOneSignal.setSubscription(false);
98 | }
99 | }
100 |
101 | class PageTwo extends StatefulWidget {
102 | final String title;
103 |
104 | PageTwo({Key key, this.title}) : super(key: key);
105 |
106 | @override
107 | _PageTwoState createState() => new _PageTwoState();
108 | }
109 |
110 | class _PageTwoState extends State {
111 | @override
112 | Widget build(BuildContext context) {
113 | return Scaffold(
114 | appBar: AppBar(
115 | title: Text(widget.title),
116 | ),
117 | body: Center(
118 | child: Text('Page two'),
119 | ),
120 | );
121 | }
122 | }
123 |
--------------------------------------------------------------------------------
/example/pubspec.yaml:
--------------------------------------------------------------------------------
1 | name: flutter_one_signal_example
2 | description: Demonstrates how to use the flutter_one_signal plugin.
3 |
4 | dependencies:
5 | flutter:
6 | sdk: flutter
7 |
8 | # The following adds the Cupertino Icons font to your application.
9 | # Use with the CupertinoIcons class for iOS style icons.
10 | cupertino_icons: ^0.1.2
11 |
12 | dev_dependencies:
13 | flutter_test:
14 | sdk: flutter
15 |
16 | flutter_one_signal:
17 | path: ../
18 |
19 | # For information on the generic Dart part of this file, see the
20 | # following page: https://www.dartlang.org/tools/pub/pubspec
21 |
22 | # The following section is specific to Flutter.
23 | flutter:
24 |
25 | # The following line ensures that the Material Icons font is
26 | # included with your application, so that you can use the icons in
27 | # the material Icons class.
28 | uses-material-design: true
29 |
30 | # To add assets to your application, add an assets section, like this:
31 | # assets:
32 | # - images/a_dot_burr.jpeg
33 | # - images/a_dot_ham.jpeg
34 |
35 | # An image asset can refer to one or more resolution-specific "variants", see
36 | # https://flutter.io/assets-and-images/#resolution-aware.
37 |
38 | # For details regarding adding assets from package dependencies, see
39 | # https://flutter.io/assets-and-images/#from-packages
40 |
41 | # To add custom fonts to your application, add a fonts section here,
42 | # in this "flutter" section. Each entry in this list should have a
43 | # "family" key with the font family name, and a "fonts" key with a
44 | # list giving the asset and other descriptors for the font. For
45 | # example:
46 | # fonts:
47 | # - family: Schyler
48 | # fonts:
49 | # - asset: fonts/Schyler-Regular.ttf
50 | # - asset: fonts/Schyler-Italic.ttf
51 | # style: italic
52 | # - family: Trajan Pro
53 | # fonts:
54 | # - asset: fonts/TrajanPro.ttf
55 | # - asset: fonts/TrajanPro_Bold.ttf
56 | # weight: 700
57 | #
58 | # For details regarding fonts from package dependencies,
59 | # see https://flutter.io/custom-fonts/#from-packages
60 |
--------------------------------------------------------------------------------
/example/test/widget_test.dart:
--------------------------------------------------------------------------------
1 | // This is a basic Flutter widget test.
2 | // To perform an interaction with a widget in your test, use the WidgetTester utility that Flutter
3 | // provides. For example, you can send tap and scroll gestures. You can also use WidgetTester to
4 | // find child widgets in the widget tree, read text, and verify that the values of widget properties
5 | // are correct.
6 |
7 | import 'package:flutter/material.dart';
8 | import 'package:flutter_test/flutter_test.dart';
9 |
10 | import 'package:flutter_one_signal_example/main.dart';
11 |
12 | void main() {
13 | testWidgets('Verify Platform version', (WidgetTester tester) async {
14 | // Build our app and trigger a frame.
15 | await tester.pumpWidget(new MyApp());
16 |
17 | // Verify that platform version is retrieved.
18 | expect(
19 | find.byWidgetPredicate(
20 | (Widget widget) =>
21 | widget is Text && widget.data.startsWith('Running on:'),
22 | ),
23 | findsOneWidget);
24 | });
25 | }
26 |
--------------------------------------------------------------------------------
/flutter_one_signal.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/flutter_one_signal_android.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/ios/.gitignore:
--------------------------------------------------------------------------------
1 | .idea/
2 | .vagrant/
3 | .sconsign.dblite
4 | .svn/
5 |
6 | .DS_Store
7 | *.swp
8 | profile
9 |
10 | DerivedData/
11 | build/
12 | GeneratedPluginRegistrant.h
13 | GeneratedPluginRegistrant.m
14 |
15 | .generated/
16 |
17 | *.pbxuser
18 | *.mode1v3
19 | *.mode2v3
20 | *.perspectivev3
21 |
22 | !default.pbxuser
23 | !default.mode1v3
24 | !default.mode2v3
25 | !default.perspectivev3
26 |
27 | xcuserdata
28 |
29 | *.moved-aside
30 |
31 | *.pyc
32 | *sync/
33 | Icon?
34 | .tags*
35 |
36 | /Flutter/Generated.xcconfig
37 |
--------------------------------------------------------------------------------
/ios/Assets/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IhorKlimov/Flutter-One-Signal/94765dabeea885eb831699de3fcc41019c0545f1/ios/Assets/.gitkeep
--------------------------------------------------------------------------------
/ios/Classes/FlutterOneSignalPlugin.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | @interface FlutterOneSignalPlugin : NSObject
4 | @end
5 |
--------------------------------------------------------------------------------
/ios/Classes/FlutterOneSignalPlugin.m:
--------------------------------------------------------------------------------
1 | #import "FlutterOneSignalPlugin.h"
2 | #import
3 | #import
4 |
5 | @implementation FlutterOneSignalPlugin
6 | + (void)registerWithRegistrar:(NSObject*)registrar {
7 | [SwiftFlutterOneSignalPlugin registerWithRegistrar:registrar];
8 | }
9 | @end
10 |
--------------------------------------------------------------------------------
/ios/Classes/NotificationService.swift:
--------------------------------------------------------------------------------
1 | import UserNotifications
2 |
3 | import OneSignal
4 |
5 | @available(iOS 10.0, *)
6 | class NotificationService: UNNotificationServiceExtension {
7 |
8 | var contentHandler: ((UNNotificationContent) -> Void)?
9 | var receivedRequest: UNNotificationRequest!
10 | var bestAttemptContent: UNMutableNotificationContent?
11 |
12 | override func didReceive(_ request: UNNotificationRequest, withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) {
13 | self.receivedRequest = request;
14 | self.contentHandler = contentHandler
15 | bestAttemptContent = (request.content.mutableCopy() as? UNMutableNotificationContent)
16 |
17 | if let bestAttemptContent = bestAttemptContent {
18 | OneSignal.didReceiveNotificationExtensionRequest(self.receivedRequest, with: self.bestAttemptContent)
19 | contentHandler(bestAttemptContent)
20 | }
21 | }
22 |
23 | override func serviceExtensionTimeWillExpire() {
24 | // Called just before the extension will be terminated by the system.
25 | // Use this as an opportunity to deliver your "best attempt" at modified content, otherwise the original push payload will be used.
26 | if let contentHandler = contentHandler, let bestAttemptContent = bestAttemptContent {
27 | OneSignal.serviceExtensionTimeWillExpireRequest(self.receivedRequest, with: self.bestAttemptContent)
28 | contentHandler(bestAttemptContent)
29 | }
30 | }
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/ios/Classes/SwiftFlutterOneSignalPlugin.swift:
--------------------------------------------------------------------------------
1 | import Flutter
2 | import UIKit
3 | import OneSignal
4 |
5 | public class SwiftFlutterOneSignalPlugin: NSObject, FlutterPlugin, FlutterStreamHandler, OSSubscriptionObserver {
6 | private var sink: FlutterEventSink?
7 | private var result: FlutterResult?
8 |
9 | public static func register(with registrar: FlutterPluginRegistrar) {
10 | let channel = FlutterMethodChannel(name: "flutter_one_signal/methods", binaryMessenger: registrar.messenger())
11 | let eventChannel = FlutterEventChannel(name: "flutter_one_signal/events", binaryMessenger: registrar.messenger())
12 | let instance = SwiftFlutterOneSignalPlugin()
13 | registrar.addMethodCallDelegate(instance, channel: channel)
14 | eventChannel.setStreamHandler(instance)
15 | }
16 |
17 | public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) {
18 | if (call.method == "startInit") {
19 | let onesignalInitSettings = [kOSSettingsKeyAutoPrompt: false]
20 | let map = call.arguments as? Dictionary
21 | let appId = map?["appId"]
22 |
23 | let inFocusDisplaying = parseInFocusDisplaying(map: map!)
24 |
25 | let notificationOpenedBlock: OSHandleNotificationActionBlock = { result in
26 | self.sink!("opened:" + result!.notification.stringify())
27 | }
28 |
29 | let notificationReceivedBlock: OSHandleNotificationReceivedBlock = { notification in
30 | self.sink!("received:" + notification!.stringify())
31 | }
32 |
33 | OneSignal.initWithLaunchOptions(nil,
34 | appId: appId,
35 | handleNotificationReceived: notificationReceivedBlock,
36 | handleNotificationAction: notificationOpenedBlock,
37 | settings: onesignalInitSettings)
38 |
39 | OneSignal.inFocusDisplayType = inFocusDisplaying
40 |
41 | OneSignal.promptForPushNotifications(userResponse: { accepted in
42 | print("User accepted notifications: \(accepted)")
43 | result(accepted)
44 | })
45 | } else if (call.method == "sendTag") {
46 | let map = call.arguments as? Dictionary
47 | let key = map?["key"]
48 | let value = map?["value"]
49 |
50 | OneSignal.sendTag(key, value: value)
51 | } else if (call.method == "setEmail") {
52 | let map = call.arguments as? Dictionary
53 | let email = map?["email"]
54 |
55 | OneSignal.setEmail(email!)
56 | } else if (call.method == "logoutEmail") {
57 | OneSignal.logoutEmail();
58 | } else if (call.method == "setSubscription") {
59 | let map = call.arguments as? Dictionary
60 | let enable: Bool = (map?["enable"] as? Bool)!
61 | OneSignal.setSubscription(enable)
62 | } else if (call.method == "getUserId") {
63 | let status: OSPermissionSubscriptionState = OneSignal.getPermissionSubscriptionState()
64 | let userID = status.subscriptionStatus.userId
65 | if (userID != nil){
66 | result(userID)
67 | } else {
68 | self.result = result
69 | OneSignal.add(self as OSSubscriptionObserver)
70 | }
71 | }
72 | }
73 |
74 | public func onOSSubscriptionChanged(_ stateChanges: OSSubscriptionStateChanges!) {
75 | if (stateChanges.to.userId != nil){
76 | result?(stateChanges.to.userId)
77 | OneSignal.remove(self as OSSubscriptionObserver)
78 | }
79 | }
80 |
81 | private func parseInFocusDisplaying(map: Dictionary ) -> OSNotificationDisplayType{
82 | let inFocusDisplaying = map["inFocusDisplaying"]
83 | if (inFocusDisplaying == "OSInFocusDisplayOption.InAppAlert.InAppAlert"){
84 | return OSNotificationDisplayType.inAppAlert
85 | }else if (inFocusDisplaying == "OSInFocusDisplayOption.InAppAlert.Notification"){
86 | return OSNotificationDisplayType.notification
87 | } else {
88 | return OSNotificationDisplayType.none
89 | }
90 | }
91 |
92 | public func onListen(withArguments arguments: Any?, eventSink events: @escaping FlutterEventSink) -> FlutterError? {
93 | sink = events
94 | return nil
95 | }
96 |
97 | public func onCancel(withArguments arguments: Any?) -> FlutterError? {
98 | return nil
99 | }
100 | }
101 |
--------------------------------------------------------------------------------
/ios/flutter_one_signal.podspec:
--------------------------------------------------------------------------------
1 | #
2 | # To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html
3 | #
4 | Pod::Spec.new do |s|
5 | s.name = 'flutter_one_signal'
6 | s.version = '0.0.1'
7 | s.summary = 'Flutter OneSignal'
8 | s.description = <<-DESC
9 | Flutter OneSignal
10 | DESC
11 | s.homepage = 'http://example.com'
12 | s.license = { :file => '../LICENSE' }
13 | s.author = { 'Your Company' => 'email@example.com' }
14 | s.source = { :path => '.' }
15 | s.source_files = 'Classes/**/*'
16 | s.public_header_files = 'Classes/**/*.h'
17 | s.dependency 'Flutter'
18 | s.dependency 'OneSignal'
19 | s.static_framework = true
20 | end
21 |
22 |
--------------------------------------------------------------------------------
/lib/flutter_one_signal.dart:
--------------------------------------------------------------------------------
1 | import 'dart:async';
2 |
3 | import 'package:flutter/foundation.dart';
4 | import 'package:flutter/services.dart';
5 |
6 | enum OSInFocusDisplayOption { InAppAlert, Notification, None }
7 |
8 | class FlutterOneSignal {
9 | static MethodChannel _channel = MethodChannel('flutter_one_signal/methods');
10 | static final EventChannel eventChannel =
11 | EventChannel('flutter_one_signal/events');
12 |
13 | /// Returns a Future of bool for notification permission granted value
14 | /// Returns a Future of true instantaneously on Android
15 | /// And a Future of the result of a notification permission popup on iOS
16 | static Future startInit({
17 | @required String appId,
18 | OSInFocusDisplayOption inFocusDisplaying =
19 | OSInFocusDisplayOption.InAppAlert,
20 | bool unsubscribeWhenNotificationsAreDisabled = false,
21 | void notificationReceivedHandler(dynamic notification),
22 | void notificationOpenedHandler(dynamic notification),
23 | }) async {
24 | var notificationPermissionGranted =
25 | await _channel.invokeMethod('startInit', {
26 | 'appId': appId,
27 | 'inFocusDisplaying': inFocusDisplaying.toString(),
28 | 'unsubscribeWhenNotificationsAreDisabled':
29 | unsubscribeWhenNotificationsAreDisabled.toString()
30 | });
31 |
32 | eventChannel.receiveBroadcastStream().listen((data) {
33 | var input = data as String;
34 | print(input);
35 | if (input.startsWith('opened:') && notificationOpenedHandler != null) {
36 | notificationOpenedHandler(input.substring(7, input.length));
37 | } else if (input.startsWith('received:') &&
38 | notificationReceivedHandler != null) {
39 | notificationReceivedHandler(input.substring(9, input.length));
40 | }
41 | });
42 |
43 | return notificationPermissionGranted;
44 | }
45 |
46 | /// Read more here https://documentation.onesignal.com/docs/data-tags
47 | static sendTag(String key, String value) {
48 | _channel.invokeMethod('sendTag', {
49 | 'key': key,
50 | 'value': value,
51 | });
52 | }
53 |
54 | /// Read more https://documentation.onesignal.com/docs/email-quickstart
55 | static setEmail(String email) {
56 | _channel.invokeMethod('setEmail', {
57 | 'email': email,
58 | });
59 | }
60 |
61 | /// Read more https://documentation.onesignal.com/docs/email-quickstart
62 | static logoutEmail() {
63 | _channel.invokeMethod('logoutEmail');
64 | }
65 |
66 | /// Read more https://documentation.onesignal.com/docs/player-id
67 | static Future getUserId() async {
68 | return await _channel.invokeMethod('getUserId');
69 | }
70 |
71 | static setSubscription(bool enable) {
72 | _channel.invokeMethod('setSubscription', {'enable': enable});
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/lib/generated/i18n.dart:
--------------------------------------------------------------------------------
1 |
2 | import 'dart:async';
3 |
4 | import 'package:flutter/foundation.dart';
5 | import 'package:flutter/material.dart';
6 | // ignore_for_file: non_constant_identifier_names
7 | // ignore_for_file: camel_case_types
8 | // ignore_for_file: prefer_single_quotes
9 |
10 | //This file is automatically generated. DO NOT EDIT, all your changes would be lost.
11 |
12 | class S implements WidgetsLocalizations {
13 | const S();
14 |
15 | static const GeneratedLocalizationsDelegate delegate =
16 | const GeneratedLocalizationsDelegate();
17 |
18 | static S of(BuildContext context) =>
19 | Localizations.of(context, WidgetsLocalizations);
20 |
21 | @override
22 | TextDirection get textDirection => TextDirection.ltr;
23 |
24 | }
25 |
26 | class en extends S {
27 | const en();
28 | }
29 |
30 |
31 | class GeneratedLocalizationsDelegate extends LocalizationsDelegate {
32 | const GeneratedLocalizationsDelegate();
33 |
34 | List get supportedLocales {
35 | return const [
36 |
37 | const Locale("en", ""),
38 |
39 | ];
40 | }
41 |
42 | LocaleResolutionCallback resolution({Locale fallback}) {
43 | return (Locale locale, Iterable supported) {
44 | final Locale languageLocale = new Locale(locale.languageCode, "");
45 | if (supported.contains(locale))
46 | return locale;
47 | else if (supported.contains(languageLocale))
48 | return languageLocale;
49 | else {
50 | final Locale fallbackLocale = fallback ?? supported.first;
51 | return fallbackLocale;
52 | }
53 | };
54 | }
55 |
56 | @override
57 | Future load(Locale locale) {
58 | final String lang = getLang(locale);
59 | switch (lang) {
60 |
61 | case "en":
62 | return new SynchronousFuture(const en());
63 |
64 | default:
65 | return new SynchronousFuture(const S());
66 | }
67 | }
68 |
69 | @override
70 | bool isSupported(Locale locale) => supportedLocales.contains(locale);
71 |
72 | @override
73 | bool shouldReload(GeneratedLocalizationsDelegate old) => false;
74 | }
75 |
76 | String getLang(Locale l) => l.countryCode != null && l.countryCode.isEmpty
77 | ? l.languageCode
78 | : l.toString();
79 |
--------------------------------------------------------------------------------
/pubspec.yaml:
--------------------------------------------------------------------------------
1 | name: flutter_one_signal
2 | description: Flutter OneSignal
3 | version: 0.2.1
4 | author: Ihor Klimov
5 | homepage: https://github.com/IhorKlimov/Flutter-One-Signal
6 |
7 | dependencies:
8 | flutter:
9 | sdk: flutter
10 |
11 | flutter:
12 | plugin:
13 | androidPackage: com.myhexaville.flutteronesignal
14 | pluginClass: FlutterOneSignalPlugin
15 |
16 | environment:
17 | sdk: ">=2.0.0-dev.28.0 <3.0.0"
18 | flutter: ">=0.1.4 <2.0.0"
--------------------------------------------------------------------------------
/res/values/strings_en.arb:
--------------------------------------------------------------------------------
1 | {}
--------------------------------------------------------------------------------