Giter VIP home page Giter VIP logo

Comments (4)

tom0gao avatar tom0gao commented on August 20, 2024

在构造JPushNotification时为android平台时 参数传递不全

from flutter_jpush.

jzoom avatar jzoom commented on August 20, 2024

已经上到pub了,

environment:
  sdk: ">=2.0.0-dev.48.0 <3.0.0"
  flutter: ">=0.1.4 <3.0.0"

依赖是这样的

from flutter_jpush.

jzoom avatar jzoom commented on August 20, 2024

参数哪里不全,能指出来吗

from flutter_jpush.

tom0gao avatar tom0gao commented on August 20, 2024

这个是我改后的 可能参数还不是很全,主要是android 没有传extras 回来 我发现在构造里面 取值赋值会出现 值为null 所以改为了在外面接好值再去赋值

factory JPushNotification.fromMap(dynamic dic, bool fromOpen) {
print("Enter new ");
try {
if (Platform.isIOS) {
dynamic aps = dic['aps'];
String appState = dic['appState'];
AppState state;
switch (appState) {
case 'inactive':
state = AppState.inactive;
break;
case 'active':
state = AppState.active;
break;
case 'background':
state = AppState.background;
break;
}
dynamic alert = aps['alert'];
String content;
String title;
String subtitle;
if (alert is String) {
content = alert;
} else {
title = alert['title'];
content = alert['body'];
subtitle = alert['subtitle'];
}
var badge = aps['badge'] as int;
var sound = aps['sound'];
var extras = dic['extras'];
var id = dic['_j_msgid'];
return new JPushNotification(
title: title,
badge: badge,
content: content,
sound: sound,
extras: extras,
subtitle: subtitle,
appState: state,
id: id,
fromOpen: fromOpen,
fireTime: new DateTime.now());
} else {
String content = dic['alertContent'];
var extras = dic['extras'];
var id = dic['id'] as int;
var alertType = dic['alertType'] as int;
return new JPushNotification(
alertType: alertType,
content: content,
id: id,
extras: extras,
fromOpen: fromOpen,
fireTime: new DateTime.now(),
);
}
} catch (e) {
print(e);
return new JPushNotification();
}
}

from flutter_jpush.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.