Skip to content

Commit 1c0e17c

Browse files
committed
fix android example
1 parent beba636 commit 1c0e17c

File tree

23 files changed

+324
-235
lines changed

23 files changed

+324
-235
lines changed

.github/workflows/ci.yml

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,22 @@ name: CI
22
on:
33
pull_request:
44
branches:
5-
- '**'
5+
- "**"
66
paths-ignore:
7-
- '.github/**'
8-
- '.vscode/**'
9-
- 'README.md'
7+
- ".github/**"
8+
- ".vscode/**"
9+
- "README.md"
1010
workflow_dispatch:
1111

1212
jobs:
1313
build:
1414
runs-on: ubuntu-latest
15+
container:
16+
image: ghcr.io/cirruslabs/flutter:3.35.5
1517

1618
steps:
17-
- name: Setup Flutter
18-
uses: subosito/flutter-action@v2
19-
with:
20-
flutter-version: '3.3.2'
21-
channel: 'stable'
22-
2319
- name: Checkout OneSignal-Flutter-SDK
24-
uses: actions/checkout@v3
20+
uses: actions/checkout@v5
2521

2622
- name: Install Dependencies 🔗⛓📦
2723
run: flutter pub get
@@ -30,7 +26,7 @@ jobs:
3026
run: flutter analyze
3127

3228
- name: Ensure the Dart code is formatted correctly
33-
run: flutter format --set-exit-if-changed --dry-run .
29+
run: dart format --set-exit-if-changed --output=none .
3430

3531
- name: Run Flutter unit tests
3632
run: flutter test

example/.metadata

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,27 @@
44
# This file should be version controlled and should not be manually edited.
55

66
version:
7-
revision: c7ea3ca377e909469c68f2ab878a5bc53d3cf66b
8-
channel: beta
7+
revision: "ac4e799d237041cf905519190471f657b657155a"
8+
channel: "stable"
9+
10+
project_type: app
11+
12+
# Tracks metadata for the flutter migrate command
13+
migration:
14+
platforms:
15+
- platform: root
16+
create_revision: ac4e799d237041cf905519190471f657b657155a
17+
base_revision: ac4e799d237041cf905519190471f657b657155a
18+
- platform: android
19+
create_revision: ac4e799d237041cf905519190471f657b657155a
20+
base_revision: ac4e799d237041cf905519190471f657b657155a
21+
22+
# User provided section
23+
24+
# List of Local paths (relative to this file) that should be
25+
# ignored by the migrate tool.
26+
#
27+
# Files that are not part of the templates will be ignored by default.
28+
unmanaged_files:
29+
- 'lib/main.dart'
30+
- 'ios/Runner.xcodeproj/project.pbxproj'

example/analysis_options.yaml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# This file configures the analyzer, which statically analyzes Dart code to
2+
# check for errors, warnings, and lints.
3+
#
4+
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
5+
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
6+
# invoked from the command line by running `flutter analyze`.
7+
8+
# The following line activates a set of recommended lints for Flutter apps,
9+
# packages, and plugins designed to encourage good coding practices.
10+
include: package:flutter_lints/flutter.yaml
11+
12+
linter:
13+
# The lint rules applied to this project can be customized in the
14+
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
15+
# included above or to enable additional rules. A list of all available lints
16+
# and their documentation is published at https://dart.dev/lints.
17+
#
18+
# Instead of disabling a lint rule for the entire project in the
19+
# section below, it can also be suppressed for a single line of code
20+
# or a specific dart file by using the `// ignore: name_of_lint` and
21+
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
22+
# producing the lint.
23+
rules:
24+
# Disable style lints for example app
25+
avoid_print: false
26+
unnecessary_new: false
27+
unnecessary_this: false
28+
prefer_const_constructors: false
29+
prefer_const_constructors_in_immutables: false
30+
use_key_in_widget_constructors: false
31+
library_private_types_in_public_api: false
32+
prefer_final_fields: false
33+
prefer_interpolation_to_compose_strings: false
34+
prefer_collection_literals: false
35+
sort_child_properties_last: false
36+
prefer_generic_function_type_aliases: false
37+
annotate_overrides: false
38+
depend_on_referenced_packages: false
39+
40+
# Additional information about this file can be found at
41+
# https://dart.dev/guides/language/analysis-options

example/android/.gitignore

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1-
*.iml
2-
*.class
3-
.gradle
1+
gradle-wrapper.jar
2+
/.gradle
3+
/captures/
4+
/gradlew
5+
/gradlew.bat
46
/local.properties
5-
/.idea/workspace.xml
6-
/.idea/libraries
7-
.DS_Store
8-
/build
9-
/captures
107
GeneratedPluginRegistrant.java
8+
.cxx/
9+
10+
# Remember to never publicly share your keystore.
11+
# See https://flutter.dev/to/reference-keystore
12+
key.properties
13+
**/*.keystore
14+
**/*.jks

example/android/app/build.gradle

Lines changed: 0 additions & 65 deletions
This file was deleted.
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
plugins {
2+
id("com.android.application")
3+
id("kotlin-android")
4+
// The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
5+
id("dev.flutter.flutter-gradle-plugin")
6+
}
7+
8+
android {
9+
namespace = "com.onesignal.onesignal_example"
10+
compileSdk = flutter.compileSdkVersion
11+
ndkVersion = flutter.ndkVersion
12+
13+
compileOptions {
14+
sourceCompatibility = JavaVersion.VERSION_11
15+
targetCompatibility = JavaVersion.VERSION_11
16+
}
17+
18+
kotlinOptions {
19+
jvmTarget = JavaVersion.VERSION_11.toString()
20+
}
21+
22+
defaultConfig {
23+
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
24+
applicationId = "com.onesignal.onesignal_example"
25+
// You can update the following values to match your application needs.
26+
// For more information, see: https://flutter.dev/to/review-gradle-config.
27+
minSdk = flutter.minSdkVersion
28+
targetSdk = flutter.targetSdkVersion
29+
versionCode = flutter.versionCode
30+
versionName = flutter.versionName
31+
}
32+
33+
buildTypes {
34+
release {
35+
// TODO: Add your own signing config for the release build.
36+
// Signing with the debug keys for now, so `flutter run --release` works.
37+
signingConfig = signingConfigs.getByName("debug")
38+
}
39+
}
40+
}
41+
42+
flutter {
43+
source = "../.."
44+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
2+
<!-- The INTERNET permission is required for development. Specifically,
3+
the Flutter tool needs it to communicate with the running application
4+
to allow setting breakpoints, to provide hot reload, etc.
5+
-->
6+
<uses-permission android:name="android.permission.INTERNET"/>
7+
</manifest>
Lines changed: 18 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,25 @@
1-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
package="com.onesignal.onesignalexample">
3-
4-
<!-- The INTERNET permission is required for development. Specifically,
5-
flutter needs it to communicate with the running application
6-
to allow setting breakpoints, to provide hot reload, etc.
7-
-->
8-
<uses-permission android:name="android.permission.INTERNET"/>
9-
10-
<uses-permission android:name="com.android.vending.BILLING" />
11-
12-
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
13-
14-
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
15-
16-
<!-- io.flutter.app.FlutterApplication is an android.app.Application that
17-
calls FlutterMain.startInitialization(this); in its onCreate method.
18-
In most cases you can leave this as-is, but you if you want to provide
19-
additional functionality it is fine to subclass or reimplement
20-
FlutterApplication and put your custom class here. -->
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
212
<application
223
android:label="onesignal_example"
4+
android:name="${applicationName}"
235
android:icon="@mipmap/ic_launcher">
246
<activity
257
android:name=".MainActivity"
268
android:exported="true"
279
android:launchMode="singleTop"
10+
android:taskAffinity=""
2811
android:theme="@style/LaunchTheme"
29-
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density"
12+
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
3013
android:hardwareAccelerated="true"
3114
android:windowSoftInputMode="adjustResize">
3215
<!-- Specifies an Android theme to apply to this Activity as soon as
3316
the Android process has started. This theme is visible to the user
3417
while the Flutter UI initializes. After that, this theme continues
3518
to determine the Window background behind the Flutter UI. -->
3619
<meta-data
37-
android:name="io.flutter.embedding.android.NormalTheme"
38-
android:resource="@style/NormalTheme"
39-
/>
40-
<!-- Displays an Android View that continues showing the launch screen
41-
Drawable until Flutter paints its first frame, then this splash
42-
screen fades out. A splash screen is useful to avoid any visual
43-
gap between the end of Android's launch screen and the painting of
44-
Flutter's first frame. -->
45-
<meta-data
46-
android:name="io.flutter.embedding.android.SplashScreenDrawable"
47-
android:resource="@drawable/launch_background"
48-
/>
20+
android:name="io.flutter.embedding.android.NormalTheme"
21+
android:resource="@style/NormalTheme"
22+
/>
4923
<intent-filter>
5024
<action android:name="android.intent.action.MAIN"/>
5125
<category android:name="android.intent.category.LAUNCHER"/>
@@ -57,4 +31,15 @@
5731
android:name="flutterEmbedding"
5832
android:value="2" />
5933
</application>
34+
<!-- Required to query activities that can process text, see:
35+
https://developer.android.com/training/package-visibility and
36+
https://developer.android.com/reference/android/content/Intent#ACTION_PROCESS_TEXT.
37+
38+
In particular, this is used by the Flutter engine in io.flutter.plugin.text.ProcessTextPlugin. -->
39+
<queries>
40+
<intent>
41+
<action android:name="android.intent.action.PROCESS_TEXT"/>
42+
<data android:mimeType="text/plain"/>
43+
</intent>
44+
</queries>
6045
</manifest>

example/android/app/src/main/java/com/onesignal/onesignalexample/MainActivity.java

Lines changed: 0 additions & 6 deletions
This file was deleted.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package com.onesignal.onesignal_example
2+
3+
import io.flutter.embedding.android.FlutterActivity
4+
5+
class MainActivity : FlutterActivity()

0 commit comments

Comments
 (0)