best-flutter / flutter_jpush

Flutter版本jpush
Other
142 stars 26 forks source link

版本问题该如何解决? #3

Open tom0gao opened 6 years ago

tom0gao commented 6 years ago

The current Dart SDK version is 2.1.0-dev.0.0.flutter-be6309690f.

Because lian_miao depends on flutter_jpush from git which requires SDK version <2.0.0, version solving failed. 版本问题该如何解决?

tom0gao commented 6 years ago

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

jzoom commented 6 years ago

已经上到pub了,

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

依赖是这样的

jzoom commented 6 years ago

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

tom0gao commented 6 years ago

这个是我改后的 可能参数还不是很全,主要是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(); } }