Skip to content

Commit

Permalink
No push script and manual changes added (#78)
Browse files Browse the repository at this point in the history
* No push script and manual changes added

* iOs podspec changes for no push

* pod files updated after pod install

* Manual change for no push in countly_flutter.dart
  • Loading branch information
ijunaid authored Dec 15, 2022
1 parent 1211702 commit 1ed853a
Show file tree
Hide file tree
Showing 12 changed files with 37 additions and 128 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ You can find minimal SDK integration information for your project in [this secti
For an example integration of this SDK, you can have a look [here](https://github.com/Countly/countly-sdk-flutter-bridge/tree/master/example).
This SDK supports the following features:
* [Analytics](https://support.count.ly/hc/en-us/articles/4431589003545-Analytics)
* [Push Notifications](https://support.count.ly/hc/en-us/articles/4405405459225-Push-Notifications)
* [User Profiles](https://support.count.ly/hc/en-us/articles/4403281285913-User-Profiles)
* [Crash Reports](https://support.count.ly/hc/en-us/articles/4404213566105-Crashes-Errors)
* [A/B Testing](https://support.count.ly/hc/en-us/articles/4416496362393-A-B-Testing-)
Expand Down
3 changes: 1 addition & 2 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.android.tools.build:gradle:3.5.4'
}
}

Expand All @@ -35,5 +35,4 @@ android {

dependencies {
implementation 'ly.count.android:sdk:22.02.1'
implementation 'com.google.firebase:firebase-messaging:20.2.1'
}
2 changes: 1 addition & 1 deletion android/settings.gradle
Original file line number Diff line number Diff line change
@@ -1 +1 @@
rootProject.name = 'countly_flutter'
rootProject.name = 'countly_flutter_np'
12 changes: 0 additions & 12 deletions android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,7 @@
package="ly.count.dart.countly_flutter">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="${applicationId}.CountlyPush.BROADCAST_PERMISSION" />
<uses-permission android:name="android.permission.BROADCAST_CLOSE_SYSTEM_DIALOGS" android:maxSdkVersion="30" />
<permission
android:name="${applicationId}.CountlyPush.BROADCAST_PERMISSION"
android:protectionLevel="signature" />
<application>
<service
android:name="ly.count.dart.countly_flutter.CountlyMessagingService"
android:exported="true">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
<receiver
android:name="ly.count.android.sdk.ReferrerReceiver"
android:exported="true">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@
import ly.count.android.sdk.StarRatingCallback;
import ly.count.android.sdk.messaging.CountlyPush;

import com.google.firebase.iid.FirebaseInstanceId;
import com.google.firebase.iid.InstanceIdResult;
import com.google.android.gms.tasks.Task;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.firebase.FirebaseApp;
//import com.google.firebase.iid.FirebaseInstanceId;
//import com.google.firebase.iid.InstanceIdResult;
//import com.google.android.gms.tasks.Task;
//import com.google.android.gms.tasks.OnCompleteListener;
//import com.google.firebase.FirebaseApp;

/**
* CountlyFlutterPlugin
Expand All @@ -62,7 +62,7 @@ public class CountlyFlutterPlugin implements MethodCallHandler, FlutterPlugin, A
private final String COUNTLY_FLUTTER_SDK_NAME = "dart-flutterb-android";
private final String COUNTLY_FLUTTER_SDK_NAME_NO_PUSH = "dart-flutterbnp-android";

private final boolean BUILDING_WITH_PUSH_DISABLED = false;
private final boolean BUILDING_WITH_PUSH_DISABLED = true;

/**
* Plugin registration.
Expand Down Expand Up @@ -383,19 +383,19 @@ public void onMethodCall(MethodCall call, final Result result) {
}
}
CountlyPush.init(activity.getApplication(), pushTokenType);
FirebaseApp.initializeApp(context);
FirebaseInstanceId.getInstance().getInstanceId()
.addOnCompleteListener(new OnCompleteListener<InstanceIdResult>() {
@Override
public void onComplete(@NonNull Task<InstanceIdResult> task) {
if (!task.isSuccessful()) {
log("getInstanceId failed", task.getException(), LogLevel.WARNING);
return;
}
String token = task.getResult().getToken();
CountlyPush.onTokenRefresh(token);
}
});
// FirebaseApp.initializeApp(context);
// FirebaseInstanceId.getInstance().getInstanceId()
// .addOnCompleteListener(new OnCompleteListener<InstanceIdResult>() {
// @Override
// public void onComplete(@NonNull Task<InstanceIdResult> task) {
// if (!task.isSuccessful()) {
// log("getInstanceId failed", task.getException(), LogLevel.WARNING);
// return;
// }
// String token = task.getResult().getToken();
// CountlyPush.onTokenRefresh(token);
// }
// });
result.success(" askForNotificationPermission!");
} else if ("pushTokenType".equals(call.method)) {
String tokenType = args.getString(0);
Expand Down

This file was deleted.

8 changes: 4 additions & 4 deletions example-no-push/ios/Flutter/Flutter.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
Pod::Spec.new do |s|
s.name = 'Flutter'
s.version = '1.0.0'
s.summary = 'High-performance, high-fidelity mobile apps.'
s.homepage = 'https://flutter.io'
s.license = { :type => 'MIT' }
s.summary = 'A UI toolkit for beautiful and fast apps.'
s.homepage = 'https://flutter.dev'
s.license = { :type => 'BSD' }
s.author = { 'Flutter Dev Team' => '[email protected]' }
s.source = { :git => 'https://github.com/flutter/engine', :tag => s.version.to_s }
s.ios.deployment_target = '9.0'
s.ios.deployment_target = '11.0'
# Framework linking is handled by Flutter tooling, not CocoaPods.
# Add a placeholder to satisfy `s.dependency 'Flutter'` plugin podspecs.
s.vendored_frameworks = 'path/to/nothing'
Expand Down
12 changes: 6 additions & 6 deletions example-no-push/ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
PODS:
- countly_flutter (22.02.1):
- countly_flutter_np (22.02.1):
- Flutter
- Flutter (1.0.0)

DEPENDENCIES:
- countly_flutter (from `.symlinks/plugins/countly_flutter/ios`)
- countly_flutter_np (from `.symlinks/plugins/countly_flutter_np/ios`)
- Flutter (from `Flutter`)

EXTERNAL SOURCES:
countly_flutter:
:path: ".symlinks/plugins/countly_flutter/ios"
countly_flutter_np:
:path: ".symlinks/plugins/countly_flutter_np/ios"
Flutter:
:path: Flutter

SPEC CHECKSUMS:
countly_flutter: c1c0f790841565e956256c4d2e11aee73c517da5
Flutter: 50d75fe2f02b26cc09d224853bb45737f8b3214a
countly_flutter_np: 97893332ef72cb40018e155412ed888ccd69529c
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854

PODFILE CHECKSUM: aafe91acc616949ddb318b77800a7f51bffa2a4c

Expand Down
2 changes: 1 addition & 1 deletion ios/Classes/CountlyFlutterPlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ + (CountlyFeedbackWidget *)createWithDictionary:(NSDictionary *)dictionary;
@end

// #define COUNTLY_EXCLUDE_PUSHNOTIFICATIONS
BOOL BUILDING_WITH_PUSH_DISABLED = false;
BOOL BUILDING_WITH_PUSH_DISABLED = true;

CLYPushTestMode const CLYPushTestModeProduction = @"CLYPushTestModeProduction";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html
#
Pod::Spec.new do |s|
s.name = 'countly_flutter'
s.name = 'countly_flutter_np'
s.version = '22.02.1'
s.summary = 'Countly is an innovative, real-time, open source mobile analytics platform.'
s.homepage = 'https://github.com/Countly/countly-sdk-flutter-bridge'
Expand Down
4 changes: 2 additions & 2 deletions lib/countly_flutter.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'dart:async';

import 'package:countly_flutter/countly_config.dart';
import 'package:countly_flutter_np/countly_config.dart';
import 'package:flutter/services.dart';
import 'dart:convert';
import 'dart:io' show Platform;
Expand Down Expand Up @@ -36,7 +36,7 @@ abstract class CountlyConsent {
}

class Countly {
static const bool BUILDING_WITH_PUSH_DISABLED = false;
static const bool BUILDING_WITH_PUSH_DISABLED = true;
static const String _pushDisabledMsg = 'In this plugin Push notification is disabled, Countly has separate plugin with push notification enabled';

static const MethodChannel _channel = MethodChannel('countly_flutter');
Expand Down
4 changes: 2 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: countly_flutter
description: Countly is an innovative, real-time, open source mobile analytics and push notifications platform.
name: countly_flutter_np
description: Countly is an innovative, real-time, open source mobile analytics. This plugin is a flavour of the SDK without push notifications.
version: 22.02.1
homepage: https://support.count.ly/hc/en-us/articles/360037944212-Flutter

Expand Down

0 comments on commit 1ed853a

Please sign in to comment.