mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-17 19:18:06 +00:00
basic ui
This commit is contained in:
parent
9e6c045a35
commit
7e0634cfed
6 changed files with 112 additions and 8 deletions
|
|
@ -1230,8 +1230,9 @@ static void linphone_iphone_popup_password_request(LinphoneCore *lc, LinphoneAut
|
|||
}
|
||||
content.sound = [UNNotificationSound soundNamed:@"msg.caf"];
|
||||
content.categoryIdentifier = @"msg_cat";
|
||||
// save data to user info for rich notification content
|
||||
NSMutableArray *msgs = [NSMutableArray array];
|
||||
bctbx_list_t *history = linphone_chat_room_get_history(room, 3);
|
||||
bctbx_list_t *history = linphone_chat_room_get_history(room, 4);
|
||||
while (history) {
|
||||
NSMutableDictionary *msgData = [NSMutableDictionary dictionary];
|
||||
LinphoneChatMessage *msg = history->data;
|
||||
|
|
@ -1250,9 +1251,9 @@ static void linphone_iphone_popup_password_request(LinphoneCore *lc, LinphoneAut
|
|||
[msgData setObject:fromImageData forKey:@"fromImageData"];
|
||||
if (isFileTransfer) {
|
||||
// TODO
|
||||
[msgData setObject:[UIChatBubbleTextCell TextMessageForChat:msg] forKey:@"msg"];
|
||||
} else {
|
||||
const char *textMsg = linphone_chat_message_get_text_content(msg);
|
||||
[msgData setObject:[NSString stringWithUTF8String:textMsg] forKey:@"msg"];
|
||||
[msgData setObject:[UIChatBubbleTextCell TextMessageForChat:msg] forKey:@"msg"];
|
||||
}
|
||||
[msgData setObject:[NSNumber numberWithBool:isOutgoing] forKey:@"isOutgoing"];
|
||||
[msgs addObject:msgData];
|
||||
|
|
|
|||
|
|
@ -64,6 +64,7 @@
|
|||
570742671D5A63DB004B9C84 /* StoreKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 570742661D5A63DB004B9C84 /* StoreKit.framework */; };
|
||||
5E10ED4820D00630002BF6FE /* avatar.png in Resources */ = {isa = PBXBuildFile; fileRef = 633FEBE61D3CD5570014B822 /* avatar.png */; };
|
||||
5E10ED4920D006C9002BF6FE /* chat_group_avatar.png in Resources */ = {isa = PBXBuildFile; fileRef = 8C2A81941F87B8000012A66B /* chat_group_avatar.png */; };
|
||||
5E223A9920E244B400D06A36 /* NotificationTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 5E223A9820E244B400D06A36 /* NotificationTableViewCell.m */; };
|
||||
5E31290120D7A37E00CF3AAE /* NotificationCenter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5EF0C33820C806A5005081B0 /* NotificationCenter.framework */; };
|
||||
5E31290520D7A37E00CF3AAE /* TodayViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 5E31290420D7A37E00CF3AAE /* TodayViewController.m */; };
|
||||
5E31290820D7A37E00CF3AAE /* MainInterface.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 5E31290620D7A37E00CF3AAE /* MainInterface.storyboard */; };
|
||||
|
|
@ -1077,6 +1078,8 @@
|
|||
570742601D5A09B8004B9C84 /* ShopView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ShopView.h; sourceTree = "<group>"; };
|
||||
570742631D5A1860004B9C84 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/ShopView.strings; sourceTree = "<group>"; };
|
||||
570742661D5A63DB004B9C84 /* StoreKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = StoreKit.framework; path = System/Library/Frameworks/StoreKit.framework; sourceTree = SDKROOT; };
|
||||
5E223A9720E244B400D06A36 /* NotificationTableViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NotificationTableViewCell.h; sourceTree = "<group>"; };
|
||||
5E223A9820E244B400D06A36 /* NotificationTableViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NotificationTableViewCell.m; sourceTree = "<group>"; };
|
||||
5E30780420D8F00D00256DAE /* latestChatroomsWidget.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = latestChatroomsWidget.entitlements; sourceTree = "<group>"; };
|
||||
5E31290020D7A37E00CF3AAE /* latestChatroomsWidget.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = latestChatroomsWidget.appex; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
5E31290320D7A37E00CF3AAE /* TodayViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TodayViewController.h; sourceTree = "<group>"; };
|
||||
|
|
@ -2535,6 +2538,8 @@
|
|||
5E58962920DCE5700030868C /* NotificationViewController.m */,
|
||||
5E58962B20DCE5700030868C /* MainInterface.storyboard */,
|
||||
5E58962E20DCE5710030868C /* Info.plist */,
|
||||
5E223A9720E244B400D06A36 /* NotificationTableViewCell.h */,
|
||||
5E223A9820E244B400D06A36 /* NotificationTableViewCell.m */,
|
||||
);
|
||||
path = richNotifications;
|
||||
sourceTree = "<group>";
|
||||
|
|
@ -4460,6 +4465,7 @@
|
|||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
5E223A9920E244B400D06A36 /* NotificationTableViewCell.m in Sources */,
|
||||
5E58962A20DCE5700030868C /* NotificationViewController.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
|
|
|
|||
|
|
@ -13,18 +13,66 @@
|
|||
<scene sceneID="ciY-6l-Mki">
|
||||
<objects>
|
||||
<tableViewController id="X9Y-jO-gVr" customClass="NotificationViewController" sceneMemberID="viewController">
|
||||
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" showsHorizontalScrollIndicator="NO" dataMode="prototypes" style="plain" separatorStyle="default" allowsSelection="NO" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" id="xjB-Tn-AYr">
|
||||
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" showsHorizontalScrollIndicator="NO" dataMode="prototypes" style="plain" separatorStyle="none" allowsSelection="NO" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" id="xjB-Tn-AYr">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<prototypes>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" reuseIdentifier="notificationCell" id="4dO-Sq-LtB">
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" reuseIdentifier="notificationCell" id="4dO-Sq-LtB" customClass="NotificationTableViewCell">
|
||||
<rect key="frame" x="0.0" y="28" width="375" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="4dO-Sq-LtB" id="Q3t-C0-U1O">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="43.5"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" alignment="center" translatesAutoresizingMaskIntoConstraints="NO" id="OXj-8D-5BS">
|
||||
<rect key="frame" x="60" y="10" width="305" height="23.5"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="WZa-ow-o0L">
|
||||
<rect key="frame" x="0.0" y="0.0" width="305" height="17"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="17" id="tvJ-aj-CIf"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" text="Lorem ipsum " textAlignment="natural" translatesAutoresizingMaskIntoConstraints="NO" id="3tK-2u-Ixe">
|
||||
<rect key="frame" x="0.0" y="17" width="305" height="6.5"/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="14"/>
|
||||
<textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
|
||||
</textView>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="WZa-ow-o0L" firstAttribute="leading" secondItem="OXj-8D-5BS" secondAttribute="leading" id="7wZ-7m-XoH"/>
|
||||
<constraint firstItem="3tK-2u-Ixe" firstAttribute="leading" secondItem="OXj-8D-5BS" secondAttribute="leading" id="A4k-hw-bfV"/>
|
||||
<constraint firstItem="3tK-2u-Ixe" firstAttribute="top" secondItem="WZa-ow-o0L" secondAttribute="bottom" id="XWZ-K9-hVC"/>
|
||||
<constraint firstItem="WZa-ow-o0L" firstAttribute="top" secondItem="OXj-8D-5BS" secondAttribute="top" id="dSr-F5-pKr"/>
|
||||
</constraints>
|
||||
</stackView>
|
||||
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="SKQ-W1-Lmw">
|
||||
<rect key="frame" x="10" y="10" width="40" height="40"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="40" id="d6N-Hv-RS0"/>
|
||||
<constraint firstAttribute="width" constant="40" id="kWJ-Qu-esd"/>
|
||||
</constraints>
|
||||
</imageView>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="OXj-8D-5BS" firstAttribute="top" secondItem="Q3t-C0-U1O" secondAttribute="top" constant="10" id="9no-0X-SIc"/>
|
||||
<constraint firstItem="SKQ-W1-Lmw" firstAttribute="top" secondItem="Q3t-C0-U1O" secondAttribute="top" constant="10" id="EqG-ZA-H0w"/>
|
||||
<constraint firstAttribute="trailing" secondItem="OXj-8D-5BS" secondAttribute="trailing" constant="10" id="Oq5-ST-lUC"/>
|
||||
<constraint firstItem="SKQ-W1-Lmw" firstAttribute="leading" secondItem="Q3t-C0-U1O" secondAttribute="leading" constant="10" id="ZPR-9n-0E4"/>
|
||||
<constraint firstItem="OXj-8D-5BS" firstAttribute="leading" secondItem="Q3t-C0-U1O" secondAttribute="leading" constant="60" id="e0Q-na-hor"/>
|
||||
<constraint firstAttribute="bottom" secondItem="OXj-8D-5BS" secondAttribute="bottom" constant="10" id="mVA-WG-D1q"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
<connections>
|
||||
<outlet property="contactImage" destination="SKQ-W1-Lmw" id="nsD-4b-g0W"/>
|
||||
<outlet property="msgText" destination="3tK-2u-Ixe" id="aVq-ra-Sd7"/>
|
||||
<outlet property="nameDate" destination="WZa-ow-o0L" id="WdA-QI-xv1"/>
|
||||
</connections>
|
||||
</tableViewCell>
|
||||
</prototypes>
|
||||
<sections/>
|
||||
|
|
|
|||
15
richNotifications/NotificationTableViewCell.h
Normal file
15
richNotifications/NotificationTableViewCell.h
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
//
|
||||
// NotificationTableViewCell.h
|
||||
// richNotifications
|
||||
//
|
||||
// Created by David Idmansour on 26/06/2018.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@interface NotificationTableViewCell : UITableViewCell
|
||||
@property (weak, nonatomic) IBOutlet UIImageView *contactImage;
|
||||
@property (weak, nonatomic) IBOutlet UILabel *nameDate;
|
||||
@property (weak, nonatomic) IBOutlet UITextView *msgText;
|
||||
|
||||
@end
|
||||
25
richNotifications/NotificationTableViewCell.m
Normal file
25
richNotifications/NotificationTableViewCell.m
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
//
|
||||
// NotificationTableViewCell.m
|
||||
// richNotifications
|
||||
//
|
||||
// Created by David Idmansour on 26/06/2018.
|
||||
//
|
||||
|
||||
#import "NotificationTableViewCell.h"
|
||||
|
||||
@implementation NotificationTableViewCell
|
||||
|
||||
- (void)awakeFromNib {
|
||||
[super awakeFromNib];
|
||||
// Initialization code
|
||||
_contactImage.layer.cornerRadius = _contactImage.frame.size.height / 2;
|
||||
_contactImage.clipsToBounds = YES;
|
||||
}
|
||||
|
||||
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
|
||||
[super setSelected:selected animated:animated];
|
||||
|
||||
// Configure the view for the selected state
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
@ -6,6 +6,7 @@
|
|||
//
|
||||
|
||||
#import "NotificationViewController.h"
|
||||
#import "NotificationTableViewCell.h"
|
||||
#import <UserNotifications/UserNotifications.h>
|
||||
#import <UserNotificationsUI/UserNotificationsUI.h>
|
||||
|
||||
|
|
@ -25,7 +26,6 @@
|
|||
|
||||
- (void)didReceiveNotification:(UNNotification *)notification {
|
||||
msgs = [[[[notification request] content] userInfo] objectForKey:@"msgs"];
|
||||
printf("Taille tab : %d\n", (unsigned int)msgs.count);
|
||||
[self.tableView reloadData];
|
||||
}
|
||||
|
||||
|
|
@ -48,8 +48,17 @@
|
|||
display.UTF8String,
|
||||
msgText.UTF8String);
|
||||
printf("Taille de l'image de profil : %d\n", (unsigned int)imageData.length);
|
||||
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"notificationCell" forIndexPath:indexPath];
|
||||
NotificationTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"notificationCell" forIndexPath:indexPath];
|
||||
cell.contactImage.image = [UIImage imageWithData:imageData];
|
||||
cell.nameDate.text = display;
|
||||
cell.msgText.text = msgText;
|
||||
return cell;
|
||||
}
|
||||
|
||||
#pragma mark - UITableViewDelegate Functions
|
||||
|
||||
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
return 100;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue