repro_flutter 0.0.1

Repro Flutter Plugin #

  • Repro plugin for Flutter.
  • Support all the features of Repro except for WebView event tracking.

How to run the example app #

Replace the following YOUR SDK TOKEN by your SDK token (if you don't have a Repro account, sign-up here for free).

android/app/src/main/java/io/repro/repro_flutter_example/MyApplication.java:

public class MyApplication extends FlutterApplication {
    @Override
    public void onCreate() {
        super.onCreate();
        Repro.setup(this, "YOUR SDK TOKEN");

ios/Runner/AppDelegate.m:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    [GeneratedPluginRegistrant registerWithRegistry:self];
    // Override point for customization after application launch.
    [Repro setup:@"YOUR SDK TOKEN"];

Go to example directory and run:

flutter run

Enable Push Notifications in the example app #

1. Add Firebase Flutter Plugin #

Please refer to the official document of Firebase to:

  • Add Firebase Flutter Plugin
  • Add google-services.json and GoogleServices-Info.plist

NOTE (for iOS): Because you may not be able to create the same bundle id for testing, remember to change the bundle id io.repro.reproFlutterExample to one you have control of.

2. Setup APNs Certificate and FCM #

Please refer to the following document of Repro:

Uncomment the following code which implements Push Notifications:

android/app/src/main/AndroidManifest.xml:

        <!-- To enable push notifications on Repro, uncomment the following: -->
        <receiver
            android:name="io.repro.android.ReproReceiver"
            android:exported="true"
            android:permission="com.google.android.c2dm.permission.SEND">
            <intent-filter>
                <action android:name="com.google.android.c2dm.intent.RECEIVE" />
                <category android:name="io.repro.repro_flutter_example" />
            </intent-filter>
        </receiver>

        <meta-data
            android:name="io.repro.android.PushNotification.ChannelId"
            android:value="io.repro.flutter.repro_test.channel_id">
        </meta-data>

        <meta-data
            android:name="io.repro.android.PushNotification.ChannelName"
            android:resource="@string/repro_channel_name">
        </meta-data>

        <meta-data
            android:name="io.repro.android.PushNotification.ChannelDescription"
            android:resource="@string/repro_channel_description">
        </meta-data>

        <meta-data
            android:name="io.repro.android.PushNotification.ShowBadge"
            android:value="true">
        </meta-data>

android/app/src/main/res/values/strings.xml:

    <!-- To enable push notifications on Repro, uncomment the following: -->
    <string name="repro_channel_name">Channel Name</string>
    <string name="repro_channel_description">Channel Description</string>

android/app/src/main/java/io/repro/repro_flutter_example/MyApplication.java:

    public void onCreate() {
        super.onCreate();
        Repro.setup(this, "YOUR SDK TOKEN");

        // To enable push notifications on Repro, uncomment the following:
        Repro.enablePushNotification();

ios/Runner/AppDelegate.m:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    ...

    // To enable push notifications on Repro, uncomment the following:
    if (floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_9_x_Max) {
        UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
        [center requestAuthorizationWithOptions:(UNAuthorizationOptionAlert | UNAuthorizationOptionBadge | UNAuthorizationOptionSound) completionHandler:^(BOOL granted, NSError * _Nullable error) {
        }];
        [[UIApplication sharedApplication] registerForRemoteNotifications];
    } else {
        UIUserNotificationType types = UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert;
        UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:types categories:nil];
        [[UIApplication sharedApplication] registerUserNotificationSettings:settings];
        [[UIApplication sharedApplication] registerForRemoteNotifications];
    }

    ...
}

// To enable push notifications on Repro, uncomment the following:
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
{
    [Repro setPushDeviceToken:deviceToken];
}

- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error
{
    NSLog(@"Remote Notification Error: %@", error);
}

4. Send Push Notifications from Repro #

Please see the Dashboard Guide of Repro.

How to add Repro Flutter Plugin to an app #

Add Repro Flutter Plugin #

1. Add dependencies #

Add repro_flutter to your pubspec.yaml and run flutter packages get:

dependencies:
  flutter:
    sdk: flutter
  ...
  repro_flutter: ^0.0.1 # add this line

2. Add native code (Android) #

Add dependencies to android/app/build.gradle:

dependencies {
    implementation 'io.repro:repro-android-sdk:4.0.4' // add this line
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}

Add a custom Application class extending from io.flutter.app.FlutterApplication. If you've done this before for the other reasons, please skip this step and just add the call to Repro.setup (in below).

Create a new Application class under android/app/src/main/your/package/name:

package your.package.name;

import io.flutter.app.FlutterApplication;
import io.repro.android.Repro;

public class MyApplication extends FlutterApplication {

    @Override
    public void onCreate() {
        super.onCreate();
    }
}

Set it to android/app/src/main/AndroidManifest.xml:

      <application
-         android:name="io.flutter.app.FlutterApplication"
+         android:name="your.package.name.MyApplication"
          android:label="repro_integration_test"
          android:icon="@mipmap/ic_launcher">

Call Repro.setup in your Application class (replace YOUR SDK TOKEN by your SDK token):

    public void onCreate() {
        super.onCreate();
        Repro.setup(this, "YOUR SDK TOKEN"); // add this line
    }

3. Add native code (iOS) #

Call Repro#setup in ios/Runner/AppDelegate.m (replace YOUR SDK TOKEN by your SDK token):

- (BOOL)application:(UIApplication *)application
    didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  [GeneratedPluginRegistrant registerWithRegistry:self];
  // Override point for customization after application launch.
  [Repro setup:@"YOUR SDK TOKEN"]; // add this line
  return [super application:application didFinishLaunchingWithOptions:launchOptions];
}

Enable Push Notifications #

1. Add Firebase Flutter Plugin #

Please refer to the official document of Firebase to:

  • Add Firebase Flutter Plugin
  • Add google-services.json and GoogleServices-Info.plist

2. Setup for Android #

Please refer to the following document of Repro:

3. Setup for iOS #

Please refer to the following document of Repro:

Development Guide #

Please see the example code in example/lib/main.dart while refer to the Development Guide of Repro.

0.0.1 #

  • Support all the features of Repro except for WebView event tracking.

example/README.md

repro_flutter_example #

Demonstrates how to use the repro_flutter plugin.

Getting Started #

This project is a starting point for a Flutter application.

A few resources to get you started if this is your first Flutter project:

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  repro_flutter: ^0.0.1

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:repro_flutter/repro.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
25
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
70
Overall:
Weighted score of the above. [more]
56
Learn more about scoring.

We analyzed this package on Aug 20, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.4.0
  • pana: 0.12.19
  • Flutter: 1.7.8+hotfix.4

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health issues and suggestions

Document public APIs. (-1 points)

38 out of 38 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Format lib/repro.dart.

Run flutter format to format lib/repro.dart.

Maintenance suggestions

The package description is too short. (-20 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.6 1.1.7
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test